smart-webcomponents-react 25.0.1 → 25.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/package.json +1 -1
  2. package/source/modules/smart.3dchart.js +2 -2
  3. package/source/modules/smart.accordion.js +2 -2
  4. package/source/modules/smart.array.js +2 -2
  5. package/source/modules/smart.barcode.js +2 -2
  6. package/source/modules/smart.breadcrumb.js +2 -2
  7. package/source/modules/smart.button.js +2 -2
  8. package/source/modules/smart.buttongroup.js +2 -2
  9. package/source/modules/smart.calendar.js +2 -2
  10. package/source/modules/smart.card.js +2 -2
  11. package/source/modules/smart.cardview.js +2 -2
  12. package/source/modules/smart.carousel.js +2 -2
  13. package/source/modules/smart.chart.js +2 -2
  14. package/source/modules/smart.checkbox.js +2 -2
  15. package/source/modules/smart.checkinput.js +2 -2
  16. package/source/modules/smart.chip.js +2 -2
  17. package/source/modules/smart.colorinput.js +2 -2
  18. package/source/modules/smart.colorpanel.js +2 -2
  19. package/source/modules/smart.colorpicker.js +2 -2
  20. package/source/modules/smart.combobox.js +2 -2
  21. package/source/modules/smart.common.js +2 -2
  22. package/source/modules/smart.countryinput.js +2 -2
  23. package/source/modules/smart.dateinput.js +2 -2
  24. package/source/modules/smart.daterangeinput.js +2 -2
  25. package/source/modules/smart.datetimepicker.js +2 -2
  26. package/source/modules/smart.dockinglayout.js +2 -2
  27. package/source/modules/smart.dropdownbutton.js +2 -2
  28. package/source/modules/smart.dropdownlist.js +2 -2
  29. package/source/modules/smart.editor.js +2 -2
  30. package/source/modules/smart.element.js +2 -2
  31. package/source/modules/smart.fileupload.js +2 -2
  32. package/source/modules/smart.form.js +2 -2
  33. package/source/modules/smart.formulaparser.js +2 -2
  34. package/source/modules/smart.ganttchart.js +2 -2
  35. package/source/modules/smart.gauge.js +2 -2
  36. package/source/modules/smart.grid.js +6 -6
  37. package/source/modules/smart.gridpanel.js +2 -2
  38. package/source/modules/smart.gridview.js +6 -6
  39. package/source/modules/smart.input.js +2 -2
  40. package/source/modules/smart.kanban.js +2 -2
  41. package/source/modules/smart.layout.js +2 -2
  42. package/source/modules/smart.led.js +2 -2
  43. package/source/modules/smart.listbox.js +2 -2
  44. package/source/modules/smart.listmenu.js +2 -2
  45. package/source/modules/smart.map.js +2 -2
  46. package/source/modules/smart.maskedtextbox.js +2 -2
  47. package/source/modules/smart.menu.js +2 -2
  48. package/source/modules/smart.multicomboinput.js +2 -2
  49. package/source/modules/smart.multiinput.js +2 -2
  50. package/source/modules/smart.multilinetextbox.js +2 -2
  51. package/source/modules/smart.multisplitbutton.js +2 -2
  52. package/source/modules/smart.numberinput.js +2 -2
  53. package/source/modules/smart.numerictextbox.js +2 -2
  54. package/source/modules/smart.pager.js +2 -2
  55. package/source/modules/smart.passwordinput.js +2 -2
  56. package/source/modules/smart.passwordtextbox.js +2 -2
  57. package/source/modules/smart.path.js +2 -2
  58. package/source/modules/smart.phoneinput.js +2 -2
  59. package/source/modules/smart.pivottable.js +2 -2
  60. package/source/modules/smart.progressbar.js +2 -2
  61. package/source/modules/smart.qrcode.js +2 -2
  62. package/source/modules/smart.querybuilder.js +2 -2
  63. package/source/modules/smart.radiobutton.js +2 -2
  64. package/source/modules/smart.rating.js +2 -2
  65. package/source/modules/smart.ribbon.js +2 -2
  66. package/source/modules/smart.router.js +2 -2
  67. package/source/modules/smart.scheduler.js +2 -2
  68. package/source/modules/smart.scrollbar.js +2 -2
  69. package/source/modules/smart.slider.js +2 -2
  70. package/source/modules/smart.sortable.js +2 -2
  71. package/source/modules/smart.splitter.js +2 -2
  72. package/source/modules/smart.switchbutton.js +2 -2
  73. package/source/modules/smart.table.js +2 -2
  74. package/source/modules/smart.tabs.js +2 -2
  75. package/source/modules/smart.tank.js +2 -2
  76. package/source/modules/smart.textarea.js +2 -2
  77. package/source/modules/smart.textbox.js +2 -2
  78. package/source/modules/smart.timeinput.js +2 -2
  79. package/source/modules/smart.timeline.js +2 -2
  80. package/source/modules/smart.timepicker.js +2 -2
  81. package/source/modules/smart.toast.js +2 -2
  82. package/source/modules/smart.tooltip.js +2 -2
  83. package/source/modules/smart.tree.js +2 -2
  84. package/source/modules/smart.validator.js +2 -2
  85. package/source/modules/smart.window.js +2 -2
  86. package/source/smart.3dchart.js +1 -1
  87. package/source/smart.accordion.js +1 -1
  88. package/source/smart.ajax.js +1 -1
  89. package/source/smart.array.js +1 -1
  90. package/source/smart.barcode.js +1 -1
  91. package/source/smart.bootstrap.js +1 -1
  92. package/source/smart.breadcrumb.js +1 -1
  93. package/source/smart.button.js +1 -1
  94. package/source/smart.buttongroup.js +1 -1
  95. package/source/smart.calendar.js +1 -1
  96. package/source/smart.card.js +1 -1
  97. package/source/smart.cardview.js +1 -1
  98. package/source/smart.carousel.js +1 -1
  99. package/source/smart.chart.annotations.js +1 -1
  100. package/source/smart.chart.api.js +1 -1
  101. package/source/smart.chart.core.js +1 -1
  102. package/source/smart.chart.js +1 -1
  103. package/source/smart.chart.rangeselector.js +1 -1
  104. package/source/smart.chart.waterfall.js +1 -1
  105. package/source/smart.checkbox.js +1 -1
  106. package/source/smart.checkinput.js +1 -1
  107. package/source/smart.chip.js +1 -1
  108. package/source/smart.colorinput.js +1 -1
  109. package/source/smart.colorpanel.js +1 -1
  110. package/source/smart.colorpicker.js +1 -1
  111. package/source/smart.combobox.js +1 -1
  112. package/source/smart.complex.js +1 -1
  113. package/source/smart.core.js +1 -1
  114. package/source/smart.countryinput.js +1 -1
  115. package/source/smart.data.js +1 -1
  116. package/source/smart.date.js +1 -1
  117. package/source/smart.dateformatpanel.js +1 -1
  118. package/source/smart.dateinput.js +1 -1
  119. package/source/smart.daterangeinput.js +1 -1
  120. package/source/smart.datetimepicker.js +1 -1
  121. package/source/smart.dockinglayout.js +1 -1
  122. package/source/smart.draw.js +1 -1
  123. package/source/smart.dropdownbutton.js +1 -1
  124. package/source/smart.dropdownlist.js +1 -1
  125. package/source/smart.editor.js +1 -1
  126. package/source/smart.element.js +1 -1
  127. package/source/smart.elements.js +5 -5
  128. package/source/smart.export.js +1 -1
  129. package/source/smart.fileupload.js +1 -1
  130. package/source/smart.filter.js +1 -1
  131. package/source/smart.filterbuilder.js +1 -1
  132. package/source/smart.filterpanel.js +1 -1
  133. package/source/smart.form.js +1 -1
  134. package/source/smart.format.js +1 -1
  135. package/source/smart.formulaparser.js +1 -1
  136. package/source/smart.ganttchart.js +1 -1
  137. package/source/smart.gauge.js +1 -1
  138. package/source/smart.grid.cell.js +2 -2
  139. package/source/smart.grid.chart.js +1 -1
  140. package/source/smart.grid.column.js +2 -2
  141. package/source/smart.grid.core.js +2 -2
  142. package/source/smart.grid.dialog.js +1 -1
  143. package/source/smart.grid.edit.js +1 -1
  144. package/source/smart.grid.export.js +1 -1
  145. package/source/smart.grid.filter.js +1 -1
  146. package/source/smart.grid.group.js +1 -1
  147. package/source/smart.grid.js +1 -1
  148. package/source/smart.grid.menu.js +1 -1
  149. package/source/smart.grid.pager.js +1 -1
  150. package/source/smart.grid.reorder.js +1 -1
  151. package/source/smart.grid.resize.js +1 -1
  152. package/source/smart.grid.row.js +1 -1
  153. package/source/smart.grid.select.js +1 -1
  154. package/source/smart.grid.sort.js +1 -1
  155. package/source/smart.grid.toolbar.js +2 -2
  156. package/source/smart.grid.tree.js +1 -1
  157. package/source/smart.grid.view.js +1 -1
  158. package/source/smart.gridpanel.js +1 -1
  159. package/source/smart.input.js +1 -1
  160. package/source/smart.kanban.js +1 -1
  161. package/source/smart.layout.js +1 -1
  162. package/source/smart.led.js +1 -1
  163. package/source/smart.listbox.js +1 -1
  164. package/source/smart.listmenu.js +1 -1
  165. package/source/smart.map.js +1 -1
  166. package/source/smart.maskedtextbox.js +1 -1
  167. package/source/smart.math.js +1 -1
  168. package/source/smart.menu.js +1 -1
  169. package/source/smart.multicomboinput.js +1 -1
  170. package/source/smart.multiinput.js +1 -1
  171. package/source/smart.multilinetextbox.js +1 -1
  172. package/source/smart.multisplitbutton.js +1 -1
  173. package/source/smart.numberformatpanel.js +1 -1
  174. package/source/smart.numberinput.js +1 -1
  175. package/source/smart.numeric.js +1 -1
  176. package/source/smart.numerictextbox.js +1 -1
  177. package/source/smart.pager.js +1 -1
  178. package/source/smart.passwordinput.js +1 -1
  179. package/source/smart.passwordtextbox.js +1 -1
  180. package/source/smart.path.js +1 -1
  181. package/source/smart.phoneinput.js +1 -1
  182. package/source/smart.pivottable.js +1 -1
  183. package/source/smart.powerbutton.js +1 -1
  184. package/source/smart.progressbar.js +1 -1
  185. package/source/smart.qrcode.js +1 -1
  186. package/source/smart.radiobutton.js +1 -1
  187. package/source/smart.rating.js +1 -1
  188. package/source/smart.ribbon.js +1 -1
  189. package/source/smart.router.js +1 -1
  190. package/source/smart.scheduler.js +1 -1
  191. package/source/smart.scrollbar.js +1 -1
  192. package/source/smart.slider.js +1 -1
  193. package/source/smart.sortable.js +1 -1
  194. package/source/smart.sparkline.js +1 -1
  195. package/source/smart.splitter.js +1 -1
  196. package/source/smart.switchbutton.js +1 -1
  197. package/source/smart.table.js +1 -1
  198. package/source/smart.tabs.js +1 -1
  199. package/source/smart.tank.js +1 -1
  200. package/source/smart.textarea.js +1 -1
  201. package/source/smart.textbox.js +1 -1
  202. package/source/smart.tickintervalhandler.js +1 -1
  203. package/source/smart.timeinput.js +1 -1
  204. package/source/smart.timeline.js +1 -1
  205. package/source/smart.timepicker.js +1 -1
  206. package/source/smart.toast.js +1 -1
  207. package/source/smart.tooltip.js +1 -1
  208. package/source/smart.tree.js +1 -1
  209. package/source/smart.validationpanel.js +1 -1
  210. package/source/smart.validator.js +1 -1
  211. package/source/smart.window.js +1 -1
  212. package/source/styles/bootstrap/dark/smart.bootstrap.blue.css +3373 -3373
  213. package/source/styles/bootstrap/dark/smart.bootstrap.css +3373 -3373
  214. package/source/styles/bootstrap/dark/smart.bootstrap.cyan.css +3373 -3373
  215. package/source/styles/bootstrap/dark/smart.bootstrap.green.css +3373 -3373
  216. package/source/styles/bootstrap/dark/smart.bootstrap.indigo.css +3373 -3373
  217. package/source/styles/bootstrap/dark/smart.bootstrap.orange.css +3373 -3373
  218. package/source/styles/bootstrap/dark/smart.bootstrap.pink.css +3373 -3373
  219. package/source/styles/bootstrap/dark/smart.bootstrap.purple.css +3373 -3373
  220. package/source/styles/bootstrap/dark/smart.bootstrap.red.css +3373 -3373
  221. package/source/styles/bootstrap/dark/smart.bootstrap.teal.css +3373 -3373
  222. package/source/styles/bootstrap/dark/smart.bootstrap.turquoise.css +3373 -3373
  223. package/source/styles/bootstrap/light/smart.bootstrap.blue.css +3373 -3373
  224. package/source/styles/bootstrap/light/smart.bootstrap.css +3373 -3373
  225. package/source/styles/bootstrap/light/smart.bootstrap.cyan.css +3373 -3373
  226. package/source/styles/bootstrap/light/smart.bootstrap.green.css +3373 -3373
  227. package/source/styles/bootstrap/light/smart.bootstrap.indigo.css +3373 -3373
  228. package/source/styles/bootstrap/light/smart.bootstrap.orange.css +3373 -3373
  229. package/source/styles/bootstrap/light/smart.bootstrap.pink.css +3373 -3373
  230. package/source/styles/bootstrap/light/smart.bootstrap.purple.css +3373 -3373
  231. package/source/styles/bootstrap/light/smart.bootstrap.red.css +3373 -3373
  232. package/source/styles/bootstrap/light/smart.bootstrap.teal.css +3373 -3373
  233. package/source/styles/bootstrap/light/smart.bootstrap.turquoise.css +3373 -3373
  234. package/source/styles/bootstrap/smart.bootstrap.blue.css +234 -215
  235. package/source/styles/bootstrap/smart.bootstrap.css +277 -286
  236. package/source/styles/bootstrap/smart.bootstrap.cyan.css +234 -215
  237. package/source/styles/bootstrap/smart.bootstrap.green.css +234 -215
  238. package/source/styles/bootstrap/smart.bootstrap.indigo.css +234 -215
  239. package/source/styles/bootstrap/smart.bootstrap.orange.css +234 -215
  240. package/source/styles/bootstrap/smart.bootstrap.pink.css +237 -215
  241. package/source/styles/bootstrap/smart.bootstrap.purple.css +237 -215
  242. package/source/styles/bootstrap/smart.bootstrap.red.css +234 -215
  243. package/source/styles/bootstrap/smart.bootstrap.teal.css +234 -215
  244. package/source/styles/bootstrap/smart.bootstrap.turquoise.css +234 -215
  245. package/source/styles/components/smart.datetimeformatpanel.css +1 -1
  246. package/source/styles/components/smart.dropdownbutton.css +1 -1
  247. package/source/styles/components/smart.grid.css +1 -1
  248. package/source/styles/components/smart.ribbon.css +1 -1
  249. package/source/styles/default/scss/smart.dropdownbutton.scss +21 -20
  250. package/source/styles/default/scss/smart.grid.scss +190 -115
  251. package/source/styles/default/smart.dropdownbutton.css +5 -3
  252. package/source/styles/default/smart.grid.css +34 -15
  253. package/source/styles/smart.default.css +2 -2
@@ -1,5 +1,5 @@
1
1
 
2
- /* Smart UI v25.0.2 (2025-11-27)
2
+ /* Smart UI v25.0.1 (2025-11-26)
3
3
  Copyright (c) 2011-2024 jQWidgets.
4
4
  License: https://htmlelements.com/license/ */ //
5
5
 
@@ -45,9 +45,9 @@ Smart("smart-text-box",class extends Smart.ComboBox{static get properties(){retu
45
45
  Smart("smart-masked-text-box",class extends Smart.BaseElement{static get properties(){return{allowPromptAsInput:{value:!1,type:"boolean"},asciiOnly:{value:!1,type:"boolean"},autoFocus:{value:!1,type:"boolean"},autoShowMask:{value:!1,type:"boolean"},cutCopyMaskFormat:{value:"excludePromptAndLiterals",allowedValues:["excludePromptAndLiterals","includePrompt","includeLiterals","includePromptAndLiterals"],type:"string"},hidePromptOnLeave:{value:!1,type:"boolean"},hint:{value:"",reflectToAttribute:!0,type:"string"},isOverwriteMode:{value:!1,type:"boolean"},label:{value:"",reflectToAttribute:!0,type:"string"},mask:{value:"#####",type:"string"},maskCompleted:{value:!1,type:"boolean"},maskFull:{value:!1,type:"boolean"},maxLength:{value:null,type:"number?"},minLength:{value:2,type:"number"},name:{value:"",type:"string"},placeholder:{value:"",type:"string"},promptChar:{value:"_",type:"string"},rejectInputOnFirstFailure:{value:!1,type:"boolean"},resetOnPrompt:{value:!1,type:"boolean"},resetOnSpace:{value:!1,type:"boolean"},selectAllOnFocus:{value:!1,type:"boolean"},textMaskFormat:{value:"excludePromptAndLiterals",allowedValues:["excludePromptAndLiterals","includePrompt","includeLiterals","includePromptAndLiterals"],type:"string"},validation:{value:null,type:"function?",reflectToAttribute:!1},value:{value:null,reflectToAttribute:!0,type:"string?"}}}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const a=e.dataset.property,r=e.value;a&&void 0!==t[a]&&(t[a]=r)}}}static get listeners(){return{mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler","input.copy":"_cutCopyHandler","input.change":"_textBoxChangeHandler","input.cut":"_cutCopyHandler","input.paste":"_textBoxPasteHandler","input.keydown":"_textBoxKeyDownHandler","input.keyup":"_textBoxKeyUpHandler","input.blur":"_blurHandler","input.focus":"_focusHandler"}}static get styleUrls(){return["smart.textbox.css","smart.maskedtextbox.css"]}template(){return'<div id="container" role="presentation"><span id="label" inner-h-t-m-l="[[label]]" class="smart-hidden smart-label"></span><input class="smart-input" type="text" id="input"\n autocomplete="off"\n autocorrect="off"\n autocapitalize="off"\n disabled="[[disabled]]"\n maxlength="[[maxLength]]"\n minlength="[[minLength]]"\n name="[[name]]"\n placeholder="[[placeholder]]"\n readonly="[[readonly]]" /><span id="hint" inner-h-t-m-l="[[hint]]" class="smart-hidden smart-hint"></span></div>'}propertyChangedHandler(e,t,a){const r=this;let l;switch(e){case"hidePromptOnLeave":a&&!r._focused?r._hidePrompt():r._promptHidden&&r._showPrompt();break;case"maxLength":r.mask.length>0&&(r.maxLength=t);break;case"maskCompleted":case"maskFull":r[e]=t;break;case"promptChar":r._updatePromptChar();break;case"placeholder":r._isPlaceholderRequired()?(r.$.input.value="",r.$.removeClass("has-value")):r._updatePromptChar(),r._updatePromptChar();break;case"mask":l=r._getValueWithTextMaskFormat({start:0,end:r._mask.length},"excludePromptAndLiterals"),r._isPlaceholderRequired()?(r.$.input.value="",r.$.removeClass("has-value")):(r._initializeMask(),r._setValueToMask(l),r._isMobileChrome&&document.activeElement===r.$.input||r._setMask(),r.maxLength=r._mask.length,r._promptHidden&&r._hidePrompt());break;case"value":r._overwrite=!0,r._setValueToMask(a),r._overwrite=!1,r._isMobileChrome&&document.activeElement===r.$.input||r._setMask(),r._promptHidden&&r._hidePrompt(),r._updateMaskFullAndCompleted();break;case"disabled":case"unfocusable":r._setFocusable();break;case"readonly":break;default:super.propertyChangedHandler(e,t,a)}r.value=r._getValueWithTextMaskFormat({start:0,end:r._mask.length},r.textMaskFormat)}render(){this._createElement(),super.render()}focus(){this.$.input.focus()}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.$.input.tabIndex=-1:e.$.input.removeAttribute("tabindex")}_createElement(){const e=this;e.autoFocus&&e.$.input.focus(),e.$.addClass("smart-input"),e._setFocusable(),e._initializeMask(),e._updateMaxLength(),e._isPlaceholderRequired()?(e.$.input.value="",e.$.removeClass("has-value")):(e._setValueToMask(e.value),e._isMobileChrome&&document.activeElement===e.$.input||e._setMask(),e._updateMaskFullAndCompleted(),e.$.addClass("has-value")),e.$.input.selectionStart=e.$.input.selectionEnd=0,e._initializationValue=e._value=e.value,e._rejectInput=!1,e.$.label.id||(e.$.label.id=e.id+"Label"),e.$.hint.id||(e.$.hint.id=e.id+"Hint"),e.hidePromptOnLeave&&!e._focused&&e._hidePrompt();const t=Smart.Utilities.Core;e._isMobileChrome=t.isMobile&&t.Browser.Chrome,e.$.input.setAttribute("aria-label",e.label||e.placeholder||e.hint||"Masked Text Box"),e.setAttribute("role","presentation"),e.$.input.setAttribute("aria-describedby",e.$.hint.id),e.$.input.setAttribute("aria-labelledby",e.$.label.id)}_blurHandler(){const e=this,t=e._isPlaceholderRequired();e.disabled||(e._valueBeforeChange!==e.value&&(e.$.fireEvent("change",{value:e.value,oldValue:e._valueBeforeChange}),e._updateTargetValue(),e._valueBeforeChange=""),e._isMobileChrome&&(e._overwrite=!0,e._setValueToMask(e.$.input.value),e._overwrite=!1,e._setMask()),e._focused=!1,e._hidePrompt(),e._validateMaskValue(),e.removeAttribute("focus"),e.$.input.value.length>0?e.$.addClass("has-value"):e.$.removeClass("has-value"),t&&(e.$.input.value="",e.$.removeClass("has-value")),e.$.fireEvent("blur"))}_updateMaskFullAndCompleted(){const e=this;let t=!0,a=!0,r=!1;for(let l=0;l<e._mask.length;l++){const s=e._mask[l];"mask"===s.type&&(s.required&&(r=!0),""===s.character&&(s.required&&(a=!1),t=!1))}t||!a||r||(a=!1),e.maskFull=t,e.maskCompleted=a}_isPlaceholderRequired(){const e=this,t=e.value&&e.value.length>0,a=e.placeholder.length>0;return!t&&(a||e.autoShowMask)}_cleanMask(e,t){const a=this;e=e||0,t=t||a._mask.length;for(let r=e;r<t;r++)"mask"===a._mask[r].type&&(a._mask[r].character="")}_cutCopyHandler(e,t){const a=this,r=parseInt(a.$.input.selectionStart,10),l=parseInt(a.$.input.selectionEnd,10),s=a._getValueWithTextMaskFormat({start:r,end:l});return window.clipboardData&&(window.clipboardData.setData("text/plain",s),window.clipboardData.setData("text/html",s)),e&&a._preventDefault(e),"Copy"===t||(a._cleanMask(r,l),a.value=a._getValueWithTextMaskFormat({start:0,end:a._mask.length},a.textMaskFormat),a._isMobileChrome&&document.activeElement===a.$.input||a._setMask(),a.$.input.selectionStart=a.$.input.selectionEnd=r,a.maskFull=a.maskCompleted=!1),s}_documentUpHandler(){}_deleteHandler(e){const t=this,a=t.$.input.selectionStart,r=t.$.input.selectionEnd,l=e.key;let s=a;if(t._preventDefault(e),a===r)if("Backspace"===l||"Unidentified"===l)for(let e=a;e>0;e--){const r=t._mask[e-1];if("mask"===r.type){s=e-1,r.character="";break}s=a-1;break}else for(let e=a;e<t._mask.length;e++){const r=t._mask[e];if("mask"===r.type){s=e+1,r.character="";break}s=a+1;break}else t._cleanMask(a,r),"Delete"===l&&(s=r);t._isMobileChrome&&document.activeElement===t.$.input||t._setMask(),t._updateMaskFullAndCompleted(),t.value=t._getValueWithTextMaskFormat({start:0,end:t._mask.length},t.textMaskFormat),t.$.input.selectionStart=t.$.input.selectionEnd=s}_findNextOccupiedPosition(e){const t=this,a=t._mask.length;let r=e;for(let l=e;l<a;l++){let e=t._mask[l];if("mask"!==e.type||""!==e.character)break;r++}return r}select(){this.$.input.select()}_focusHandler(e){const t=this;if("INPUT"===e.context.nodeName.toUpperCase()){if(!t.disabled)if(t.setAttribute("focus",""),t.selectAllOnFocus&&t.$.input.select(),t._focused=!0,t._isMobileChrome)t._removeMask();else{if(t._showPrompt(),t._isPlaceholderRequired()){t._initializeMask(),t._setValueToMask(t.value),t._setMask();const e=t._getEditableSelectionStart(0);t.$.input.selectionStart=t.$.input.selectionEnd=e}t.$.fireEvent("focus")}}else t.$.input.focus()}_setMask(){const e=this;let t="";for(let a=0;a<e._mask.length;a++){const r=e._mask[a];let l;if("literal"===r.type||"separator"===r.type||"placeholder"===r.type||"currency"===r.type)l=r.character;else if("mask"===r.type&&""!==r.character)switch(r.escapeSymbol){case">":l=r.character.toUpperCase();break;case"<":l=r.character.toLowerCase();break;case"|":case"\\":default:l=r.character}else l=r.defaultCharacter;t+=l}e.$.input.value=t}_removeMask(){const e=this;let t="";for(let a=0;a<e._mask.length;a++){const r=e._mask[a];r.character!==r.defaultCharacter&&(t+=r.character)}e.$.input.value=t}_getEditableSelectionStart(e,t){const a=this;for(let r=e;r<a._mask.length;r++){const e=a._mask[r];if("mask"===e.type&&(""===e.character||a.isOverwriteMode||" "===t&&a.resetOnSpace||t===a.promptChar&&a.resetOnPrompt))return r}return-1}_getNonEditableSelectionStart(e,t){const a=this;for(let r=e;r<a._mask.length;r++){const e=a._mask[r];if("mask"!==e.type&&e.character===t)return r}return-1}_getValueWithTextMaskFormat(e,t){const a=this,r=e?e.start:0,l=e?e.end:a._mask.length||a.$.input.value.length;let s="";if("includePromptAndLiterals"===(t=t||a.cutCopyMaskFormat))return a.$.input.value.substring(r,l);for(let e=r;e<l;e++){const r=a._mask[e];switch(t){case"excludePromptAndLiterals":if("mask"!==r.type)continue;s=""===r.character?s+" ":s+r.character;break;case"includePrompt":if("mask"!==r.type)continue;s=""===r.character?s+r.defaultCharacter:s+r.character;break;case"includeLiterals":if("mask"===r.type&&""===r.character)continue;s+=r.character}}return s.trim()}_hidePrompt(){const e=this,t=new RegExp(e.promptChar,"g");!e.disabled&&e.hidePromptOnLeave&&0!==e.mask.length&&(e.$.input.value=e.$.input.value.replace(t," "),e._promptHidden=!0)}_initializeMask(){const e=this;let t,a=e.mask.length;if(e._mask=[],void 0!==e.mask&&null!==e.mask&&0!==e.mask.length)for(let r=0;r<a;r++){const a=e.mask.charAt(r);let l={};switch(l.defaultCharacter=e.promptChar,a){case"0":l.editable=!0,l.required=!0,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="0",l.regex="\\d",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"9":l.editable=!0,l.required=!1,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="9",l.regex="(\\d|\\s)",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"#":l.editable=!0,l.required=!1,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="#",l.regex="(\\d|\\s|[+]|[-])",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"L":l.editable=!0,l.required=!0,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="L",l.regex="([a-zA-Zа-яА-Я])",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"?":l.editable=!0,l.required=!1,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="?",l.regex="[a-zA-Zа-яА-Я]?",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"&":l.editable=!0,l.required=!0,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="&",l.regex="[^\\s]",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"C":l.editable=!0,l.required=!1,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="C",l.regex=".",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"A":l.editable=!0,l.required=!0,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="A",l.regex="[a-zA-Zа-яА-Я0-9]",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"a":l.editable=!0,l.required=!1,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="a",l.regex="[a-zA-Zа-яА-Я0-9]?",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"Z":l.editable=!0,l.required=!0,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="Z",l.regex="[a-zA-Z0-9]",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"z":l.editable=!0,l.required=!1,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="z",l.regex="[a-zA-Z0-9]?",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"Y":l.editable=!0,l.required=!0,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="Y",l.regex="[a-zA-Z]",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case"y":l.editable=!0,l.required=!1,l.escapeSymbol=t,l.type="\\"===l.escapeSymbol?"literal":"mask",l.maskCharacter="y",l.regex="[a-zA-Z]?",l.character="\\"===l.escapeSymbol?l.maskCharacter:"",l.defaultCharacter=e.promptChar,t=null;break;case".":l.editable=!1,l.required=!0,l.escapeSymbol=t,l.type="placeholder",l.maskCharacter=".",l.regex=null,l.character=".",l.defaultCharacter=e.promptChar,t=null;break;case",":l.editable=!1,l.required=!0,l.escapeSymbol=t,l.type="placeholder",l.maskCharacter=",",l.regex=null,l.character=",",l.defaultCharacter=e.promptChar,t=null;break;case":":l.editable=!1,l.required=!0,l.escapeSymbol=t,l.type="separator",l.maskCharacter=":",l.regex=null,l.character=":",l.defaultCharacter=e.promptChar,t=null;break;case"/":l.editable=!1,l.required=!0,l.escapeSymbol=t,l.type="separator",l.maskCharacter="/",l.regex=null,l.character="/",l.defaultCharacter=e.promptChar,t=null;break;case"$":l.editable=!1,l.required=!0,l.escapeSymbol=t,l.type="currency",l.maskCharacter="$",l.regex=null,l.character="$",l.defaultCharacter=e.promptChar,t=null;break;case"<":t?"|"===t?t=null:"\\"===t?(l.editable=!1,l.required=!0,l.escapeSymbol=t,l.type="literal",l.maskCharacter="<",l.regex="<",l.character="<",l.defaultCharacter=e.promptChar,t=null):t="<":t="<";break;case">":t?"|"===t?t=null:"\\"===t?(l.editable=!1,l.required=!0,l.escapeSymbol=t,l.type="literal",l.maskCharacter=">",l.regex=">",l.character=">",l.defaultCharacter=e.promptChar,t=null):t=">":t=">";break;case"|":t&&"\\"===t?(l.editable=!1,l.required=!0,l.escapeSymbol=t,l.type="literal",l.maskCharacter="|",l.regex="|",l.character="|",l.defaultCharacter=e.promptChar,t=null):t="|";break;case"\\":t&&"\\"===t?(l.editable=!1,l.required=!0,l.escapeSymbol=t,l.type="literal",l.maskCharacter="\\",l.regex="\\",l.character="\\",l.defaultCharacter=e.promptChar,t=null):t="\\";break;default:l.editable=!1,l.required=!0,l.escapeSymbol=t,l.type="literal",l.maskCharacter=a,l.regex=null,l.character=a,l.defaultCharacter=a,t=null}t||l.type&&e._mask.push(l)}}_keyDownHandler(){}_validateInput(e,t){const a=this._mask[t];return new RegExp(a.regex).test(e)}_setValueToMask(e,t){const a=this,r=e||"",l=r.length,s=t&&t.start?t.start:0,n=t&&t.end?t.end:a._mask.length;let o=s,i=0;for(;o<n&&i<l;)"mask"===a._mask[o].type&&i++,(a._setCharAtPosition(r.charAt(i-1),o)||"mask"!==a._mask[o].type)&&o++;if(o<n)for(let e=o;e<n;e++)"mask"===a._mask[e].type&&(a._mask[e].character="");t&&(t.start=o)}_preventDefault(e){e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()}_showPrompt(){const e=this;!e.disabled&&e._promptHidden&&(e._isMobileChrome&&document.activeElement===e.$.input||e._setMask())}_textBoxChangeHandler(e){const t=this;t.disabled||t.readonly||(t.value=t._getValueWithTextMaskFormat({start:0,end:t._mask.length},t.textMaskFormat),t._valueBeforeChange!==t.value&&(t.$.fireEvent("change",{value:t.value,oldValue:t._valueBeforeChange}),t._updateTargetValue(),t._valueBeforeChange="",t._validateMaskValue()),e&&e.stopPropagation())}_textBoxKeyDownHandler(e){const t=this,a=e.key;if(t._isMobileChrome)return;const r=e.ctrlKey,l=t.$.input.selectionEnd,s=new RegExp("xxx[\0-]+xxx");let n=t.$.input.selectionStart;if(r&&["KeyA","KeyC","KeyV","KeyX"].indexOf(e.code)>-1){const a=function(e,a){const r=document.createElement("textarea");r.style.position="absolute",r.style.left="-1000px",r.style.top="-1000px",document.body.appendChild(r),r.focus(),"Paste"===e?setTimeout((function(){let e=r.value;0===e.length&&window.clipboardData&&(r.value=window.clipboardData.getData("Text"),e=r.value),r.parentNode.removeChild(r),t.$.input.focus(),a(e)}),25):(r.value=t._cutCopyHandler(null,e),r.focus(),r.setSelectionRange(0,r.value.length),setTimeout((function(){document.designMode="off",r.focus(),r.parentNode.removeChild(r),t.$.input.focus()}),25),window.clipboardData&&window.clipboardData.setData("Text",r.value))};switch(e.code){case"KeyA":t.$.input.setSelectionRange(0,t.$.input.value.length);break;case"KeyC":a("Copy");break;case"KeyV":a("Paste",(function(e){const a=t.context;t.context=t,t._textBoxPasteHandler(null,e),t.context=a}));break;case"KeyX":a("Cut")}return}if("Backspace"===a)return t._deleteHandler(e),void t._updateMaskFullAndCompleted();if("Delete"===a)return t._deleteHandler(e),void t._updateMaskFullAndCompleted();if(!t.allowPromptAsInput&&a===t.promptChar)return void t._preventDefault(e);if(t.disabled||t.readonly||t.asciiOnly&&!s.test(a)||!/^[a-zA-ZÀ-ÿа-яА-Я0-9.!@?#"$%&:';()*\+,\/;\-=[\\\]\^_{|}<>~` ]+$/.test(a)||a.length>1)return;if(t._preventDefault(e),n===l&&n===t.$.input.value.length)return;if(" "===a&&!t.resetOnSpace)return;n=t._getEditableSelectionStart(n,a);const o=function(){n=t._getNonEditableSelectionStart(t.$.input.selectionStart,a),-1!==n&&(t.$.input.selectionStart=t.$.input.selectionEnd=n+1)};-1!==n&&t._setCharAtPosition(a,n)?(t._isMobileChrome&&document.activeElement===t.$.input||t._setMask(),t._updateMaskFullAndCompleted(),t.$.input.selectionStart=t.$.input.selectionEnd=n+1):o()}_textBoxKeyUpHandler(){const e=this,t=e.value;e.value=e._getValueWithTextMaskFormat({start:0,end:e._mask.length},e.textMaskFormat),t!==e.value&&e.$.fireEvent("changing",{value:e.value,oldValue:t})}_textBoxPasteHandler(e,t){const a=this,r=a.$.input.value,l=a.$.input.selectionStart;let s,n=a.$.input.selectionEnd;if(e&&a._preventDefault(e),window.clipboardData&&window.clipboardData.getData?s=window.clipboardData.getData("Text"):e&&e.clipboardData&&e.clipboardData.getData?s=e.clipboardData.getData("text/plain"):t&&(s=t),n-l!==r.length){if(l===n&&(a.$.input.selectionEnd=n=a._mask.length),a.rejectInputOnFirstFailure){let e=0;for(let t=l;t<n;t++)if("mask"===a._mask[t].type){if(!a._validateInput(s.charAt(e),t))return void(a.$.input.selectionStart=a.$.input.selectionEnd=l);if(e++,e>s.length)break}}const e={start:l,end:n};a._overwrite=!0,a._setValueToMask(s,e),a._isMobileChrome&&document.activeElement===a.$.input||a._setMask(),a._updateMaskFullAndCompleted(),a.$.input.selectionStart=a.$.input.selectionEnd=e.start,a.value=a._getValueWithTextMaskFormat({start:0,end:a._mask.length},a.textMaskFormat)}}_setCharAtPosition(e,t){const a=this,r=a._mask[t];if(" "===e&&a.resetOnSpace&&(e=""),"mask"!==r.type||a.readonly||a.disabled||!r.editable)return!1;if(""===e&&!a.resetOnSpace)return!1;if(e===a.promptChar&&!a.resetOnPrompt&&a.allowPromptAsInput)return!1;if(!a.isOverwriteMode&&""!==e&&e!==a.promptChar&&""!==r.character&&!a._overwrite)return!1;const l=r.regex;if(l){if(new RegExp(l,"i").test(e)){switch(r.escapeSymbol){case">":e=e.toUpperCase();break;case"<":e=e.toLowerCase()}return a._mask[t].character=e,!0}return a.resetOnSpace&&""===e?(a._mask[t].character=e,!0):!(!a.resetOnPrompt||e!==a.promptChar||!a.allowPromptAsInput||(a._mask[t].character="",0))}return!1}_updateMaxLength(){const e=this;e._mask.length>0&&(e.maxLength=e._mask.length)}_updatePromptChar(){const e=this;for(let t=0;t<e._mask.length;t++)e._mask[t].defaultCharacter=e.promptChar;e._isMobileChrome&&document.activeElement===e.$.input||e._setMask()}_validateMaskValue(){const e=this;if(e.readonly||e.disabled||!e.validation||"function"!=typeof e.validation)return;const t=e.value,a=e.validation(t);a?e.removeAttribute("error"):e.setAttribute("error",""),e.$.fireEvent("validation",{success:a})}_keyUpHandler(){}refresh(){}_resizeHandler(){}_selectStartHandler(){}_mouseWheelHandler(){}_applySelection(){}_setDropDownSize(){}_styleChangedHandler(){}});
46
46
  Smart("smart-multiline-text-box",class extends Smart.TextBox{static get properties(){return{autoCapitalize:{value:"none",allowedValues:["none","words","characters"],type:"string"},autoComplete:{value:"off",allowedValues:["on","off"],type:"string"},autoExpand:{value:!1,type:"boolean"},cols:{value:20,type:"number?"},enterKeyBehavior:{value:"newLine",allowedValues:["submit","clearOnSubmit","newLine"],type:"string"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},minLength:{value:0,type:"number"},resizable:{value:!1,type:"boolean"},rows:{value:5,type:"number?"},selectionDirection:{value:"none",allowedValues:["forward","backward","none"],type:"string"},selectionEnd:{value:0,reflectToAttribute:!1,type:"number"},selectionStart:{value:0,reflectToAttribute:!1,type:"number"},spellCheck:{value:!1,type:"boolean"},type:{value:"textarea",type:"string",defaultReflectToAttribute:!0,readonly:!0},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},wrap:{value:"soft",allowedValues:["hard","soft","off"],type:"string"}}}static get styleUrls(){return["smart.textbox.css","smart.multilinetextbox.css"]}static get listeners(){return{"document.mousemove":"_documentSelectionOutsideHandler","container.resize":"_handleScrollbarsDisplay","document.move":"_resizeMoveHandler","document.up":"_upHandler",focus:"_focusHandler","horizontalScrollBar.change":"_horizontalScrollbarHandler",keydown:"_keyDownHandler",mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler",resize:"_handleScrollbarsDisplay","resizeElement.down":"_resizeDownHandler",styleChanged:"_handleScrollbarsDisplay","input.change":"_textBoxChangeHandler","input.focus":"_focusHandler","input.blur":"_blurHandler","input.keydown":"_textBoxKeyDownHandler","input.keyup":"_keyUpHandler","input.paste":"_textBoxChangeHandler","input.select":"_textBoxSelectHandler","input.touchmove":"_inputTouchmoveHandler","input.touchstart":"_inputTouchstartHandler",wheel:"_mouseWheelHandler","verticalScrollBar.change":"_verticalScrollbarHandler"}}attached(){const e=this;super.attached(),e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e.$.input,e.$.horizontalScrollBar,e.$.verticalScrollBar))}detached(){const e=this;super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView)}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}template(){return'<div id="container" role="presentation">\n <span id="label" class="smart-label">[[label]]</span>\n <div id="innerContainer" class="smart-inner-container" role="presentation">\n <textarea class="smart-input" id="input"\n autocapitalize="[[autoCapitalize]]"\n autocomplete="off"\n cols="[[cols]]"\n disabled="[[disabled]]"\n maxlength="[[maxLength]]"\n minlength="[[minLength]]"\n name="[[name]]"\n placeholder="[[placeholder]]"\n readonly="[[readonly]]"\n required="[[required]]"\n rows="[[rows]]"\n spellcheck="[[spellCheck]]"\n wrap="[[wrap]]"\n aria-label="[[placeholder]]"\n autocomplete="[[inputPurpose]]"></textarea>\n <smart-scroll-bar id="verticalScrollBar" theme="[[theme]]" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[disabled]]" orientation="vertical"></smart-scroll-bar>\n <smart-scroll-bar id="horizontalScrollBar" theme="[[theme]]" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[disabled]]"></smart-scroll-bar>\n <div id="resizeElement" class="smart-resize-element" aria-label="Resize"></div>\n\n <textarea id="textBoxHidden"\n class="smart-text-box-hidden"\n autocapitalize="[[autoCapitalize]]"\n autocomplete="off"\n cols="[[cols]]"\n disabled="[[disabled]]"\n inner-h-t-m-l="[[value]]"\n maxlength="[[maxLength]]"\n minlength="[[minLength]]"\n name="[[name]]"\n placeholder="[[placeholder]]"\n readonly="[[readonly]]"\n required="[[required]]"\n rows="[[rows]]"\n spellcheck="[[spellCheck]]"\n wrap="[[wrap]]"></textarea>\n </div>\n <span id="hint" class="smart-hidden smart-hint">[[hint]]</span>\n </div>'}propertyChangedHandler(e,t,l){const a=this;switch(e){case"autoExpand":a._autoExpandUpdate();break;case"displayMode":switch(l){case"escaped":a.$.input.value=a._toEscapedDisplayMode(a.value);break;default:a.$.input.value=a.value=a._toDefaultDisplayMode(a.$.input.value)}a._autoExpandUpdate(),a._handleScrollbarsDisplay();break;case"value":switch(a._preventProgramaticValueChange?(a._userValue="escaped"===a.displayMode?a._toDefaultDisplayMode(a.$.input.value):a.$.input.value,a._programmaticValue=l):a._userValue=a._programmaticValue=l,a.displayMode){case"escaped":a.$.input.value=a._toEscapedDisplayMode(a._userValue);break;default:a.$.input.value=a._userValue}a._oldValue=t,a._autoExpandUpdate(),a._handleScrollbarsDisplay();break;case"horizontalScrollBarVisibility":case"verticalScrollBarVisibility":case"singleLine":case"wrap":case"resizable":case"placeholder":a._autoExpandUpdate(),a._handleScrollbarsDisplay();break;case"selectionEnd":case"selectionStart":a._handleSelectedText();break;case"rows":case"cols":a._updateSizeRowsCols();break;case"disabled":a._setFocusable(),a._ariaPropertyChangedHandler("disabled",l);break;case"animation":break;case"readonly":a._ariaPropertyChangedHandler("readonly",l);break;default:super.propertyChangedHandler(e,t,l)}}selection(e){const t=this;let l=t.$.input.selectionStart,a=t.$.input.selectionEnd,i=t.value;return"escaped"===t.displayMode?(i=t.$.input.value.substring(l,a),"escaped"===e?i:t._toDefaultDisplayMode(i)):"escaped"===e?(i=i.substring(l,a),t._toEscapedDisplayMode(i)):(i=i.substring(l,a),i)}select(e,t){const l=this,a=Array.from(arguments).slice(0,2);let i,n;for(let e in a)a[e]=parseInt(a[e])||0;return 2===a.length?(i=Math.min([e,t]),n=Math.max([e,t])):i=a[0],2===a.length?(i=parseInt(i),i=i>0?i<l.$.input.length?l.$.input.length:i:0,n<i?n=i:n>l.$.input.length&&(i=0),l.$.input.focus(),void l.$.input.setSelectionRange(i,n)):1===a.length?(l.$.input.focus(),void l.$.input.setSelectionRange(i,i+1)):void l.$.input.select()}_autoExpandUpdate(){const e=this,t=e.$.input,l=e.$.textBoxHidden,a=e.$.verticalScrollBar;if(!e.autoExpand)return void(t.style.height=a.style.height=l.style.height=null);const i=parseFloat(window.getComputedStyle(e).getPropertyValue("max-height"));l.style.height=0,l.value=t.value;let n=0;e.resizeTrigger&&(n=e.resizeTrigger.clientHeight,n===e.clientHeight&&(n=0)),t.style.height=a.style.height=(isNaN(i)?l.scrollHeight:Math.min((i||0)-n,l.scrollHeight))+"px"}_blurHandler(){const e=this;e._outsideAutoScroll&&clearInterval(e._outsideAutoScroll),e.removeAttribute("focus"),e._preventProgramaticValueChange=!1,e._oldValue=e.value,e.value=e._userValue||e.value,e.$.fireEvent("blur")}_createElement(){const e=this;e.$.input.id||(e.$.input.id=e.id+"Input"),e.autoFocus&&(navigator.userAgent.match(/Edge/)?setTimeout((function(){e.$.input.focus(),e.setAttribute("focus","")}),10):(e.$.input.focus(),e.setAttribute("focus","")));const t=e.$.input.innerHTML;e.value?e.$.input.innerHTML="escaped"===e.displayMode?e._toEscapedDisplayMode(e.value):e.value:t.length>0&&"escaped"===e.displayMode?(e.value=t,e.$.input.innerHTML=e._toEscapedDisplayMode(t)):t.length>0&&(e.value=t),e._setFocusable(),e._syncTextBoxContentOnInitialization(),e._scrollView=new Smart.Utilities.Scroll(e.$.input,e.$.horizontalScrollBar,e.$.verticalScrollBar),e._autoExpandUpdate(),e._handleScrollbarsDisplay(),e._initializationValue=e._oldValue=e.value,e.value.length>0?e.$.addClass("has-value"):e.$.removeClass("has-value"),e._handleHintContainer(),e.setAttribute("role","textbox"),e.setAttribute("aria-multiline",!0),e.setAttribute("aria-describedby",e.$.hint.id),e.setAttribute("aria-labelledby",e.$.label.id),e.setAttribute("aria-label",e.label||e.placeholder||e.hint||"Multiline Text Box"),e.$.verticalScrollBar.setAttribute("aria-controls",e.$.input.id),e.$.horizontalScrollBar.setAttribute("aria-controls",e.$.input.id)}_handleScrollbarsDisplay(e){const t=this,l=t.$.input;requestAnimationFrame((()=>{switch(t._autoExpandUpdate(),t.horizontalScrollBarVisibility){case"disabled":t.$container.addClass("hscroll"),t.$.horizontalScrollBar.disabled=!0;break;case"hidden":t.$container.removeClass("hscroll");break;case"visible":t.$container.addClass("hscroll"),t._scrollView.scrollWidth=l.scrollWidth-l.clientWidth,t._scrollView.scrollTo(t.$.input.scrollLeft,!0),t.$.horizontalScrollBar.disabled=!1;break;default:l.scrollWidth>l.clientWidth?(t.$container.addClass("hscroll"),t._scrollView.scrollWidth=l.scrollWidth-l.clientWidth,e&&"resize"===e.type?t.$.input.scrollLeft=t._scrollView.scrollLeft:t._scrollView.scrollTo(t.$.input.scrollLeft,!0)):t.$container.removeClass("hscroll"),t.$.horizontalScrollBar.disabled=!1}switch(t.verticalScrollBarVisibility){case"disabled":t.$container.addClass("vscroll"),t.$.verticalScrollBar.disabled=!0;break;case"hidden":t.$container.removeClass("vscroll");break;case"visible":t.$container.addClass("vscroll"),t._scrollView.scrollHeight=l.scrollHeight-l.clientHeight,t._scrollView.scrollTo(t.$.input.scrollTop),t.$.verticalScrollBar.disabled=!1;break;default:l.scrollHeight>l.clientHeight?(t.$container.addClass("vscroll"),t._scrollView.scrollHeight=l.scrollHeight-l.clientHeight,e&&"resize"===e.type?t.$.input.scrollTop=t._scrollView.scrollTop:t._scrollView.scrollTo(t.$.input.scrollTop)):t.$container.removeClass("vscroll"),t.$.verticalScrollBar.disabled=!1}}))}_focusHandler(e){const t=this;if(!t.disabled){if(e.target===t)return t.$.input.focus(),void(t._edgeSelect=!1);if(t.setAttribute("focus",""),t.selectAllOnFocus)if(navigator.userAgent.match(/Edge/)){const e=t.$.input.scrollTop;if(t._edgeSelect)return void(t._edgeSelect=!1);setTimeout((function(){t._edgeSelect=!0,t.$.input.select(),t.$.input.scrollTop=e}),5)}else t.$.input.select();t.$.fireEvent("focus")}}_getScrollLeft(e,t){const l=this;return l.rightToLeft?(Smart.Utilities.Core.Browser.Chrome?(t||(t=l.$.input.scrollWidth-l.$.input.offsetWidth),e=t-e):e*=-1,e):e}_horizontalScrollbarHandler(e){const t=this;t.disabled||"hidden"===t.horizontalScrollBarVisibility||"disabled"===t.horizontalScrollBarVisibility||(e.stopPropagation(),t.$.input.scrollLeft=t._getScrollLeft(e.detail.value))}_keyDownHandler(e){const t=this,l=e.key,a=e.shiftKey,i=e.ctrlKey,n=t.$.input.value;function r(l){let a=t.$.input.selectionStart,i=t.$.input.selectionEnd,n=t.$.input.value;e.preventDefault(),t.$.input.value=n.substring(0,a)+l+n.substring(i,n.length),t.value=t._toDefaultDisplayMode(t.$.input.value),t.$.input.selectionStart=a+2,t.$.input.selectionEnd=a+2}if(t.allowVerticalScrollbar&&t.$.input.selectionEnd>t.$.input.value.length-5&&t._scrollView.scrollTo(t._scrollView.scrollTop+(e.deltaY<0?-t.offsetHeight:t.offsetHeight)),l.indexOf("Arrow")>-1)e.stopPropagation();else switch(l){case"Enter":if("newLine"===t.enterKeyBehavior&&!i&&!a||"newLine"!==t.enterKeyBehavior&&(i||a)){"escaped"===t.displayMode&&r("\\n");break}e.preventDefault(),t._userValue="escaped"===t.displayMode?t._toDefaultDisplayMode(t.$.input.value):t.$.input.value,t.value=t._userValue,("submit"===t.enterKeyBehavior||"clearOnSubmit"===t.enterKeyBehavior||""!==n&&t._userValue!==t._oldValue)&&t.$.fireEvent("change",{oldValue:t._oldValue,value:n,type:"submit"}),"clearOnSubmit"===t.enterKeyBehavior&&(t.$.input.value=""),t._oldValue=t.value=t._toDefaultDisplayMode(t.$.input.value),t._submitted=!0,"escaped"===t.displayMode&&t.enterKeyBehavior.toLowerCase().indexOf("submit")<0&&!i&&!a&&r("\\n"),("submit"===t.enterKeyBehavior||"newLine"===t.enterKeyBehavior&&i)&&t.$.input.blur();break;case"Escape":if("none"===t.escKeyMode)return;switch(t.escKeyMode){case"none":break;case"clearValue":t.value=t.$.input.value="";break;case"previousValue":t.$.input.value="escaped"===t.displayMode?t._toEscapedDisplayMode(t._oldValue):t._oldValue}break;case" ":"escaped"===t.displayMode&&r("\\s");break;case"Backspace":if("escaped"===t.displayMode&&t.$.input.selectionStart===t.$.input.selectionEnd){let e=t.$.input.selectionStart;"\\"!==n[e-2]||"s"!==n[e-1]&&"n"!==n[e-1]||(t.$.input.value=t.$.input.value.substring(0,e-2)+t.$.input.value.substring(e-2,t.$.input.value.length),t.$.input.selectionStart=e-2)}t._scrollView&&t._handleScrollbarsDisplay()}}_keyUpHandler(e){const t=this;switch(e.key){case"ArrowLeft":case"ArrowUp":case"ArrowDown":t._handlePointerInEscapedSymbol();break;case"ArrowRight":t._handlePointerInEscapedSymbol("next")}t._userValue="escaped"===t.displayMode?t._toDefaultDisplayMode(t.$.input.value):t.$.input.value,t._submitKeyUpHandler()}_textBoxKeyDownHandler(e){const t=this,l=e.key;t._scrollView&&t._handleScrollbarsDisplay(),t.value&&t.value.length>0?t.$.addClass("has-value"):t.$.removeClass("has-value"),-1===["Enter","Escape"].indexOf(l)&&(t._preventProgramaticValueChange=!0),["ArrowLeft","ArrowUp","ArrowDown","ArrowRight"].indexOf(l)>-1&&t._scrollView.scrollTo(t.$.input.scrollTop),["PageUp","PageDown"].indexOf(l)>-1&&Smart.Utilities.Core.Browser.Chrome&&("PageUp"===e.key&&(t.$.input.setSelectionRange(0,0),t.$.input.scrollTop=0),"PageDown"===e.key&&(t.$.input.setSelectionRange(t.$.input.value.length,t.$.input.value.length),t.$.input.scrollTop=t._scrollView.verticalScrollBar.max),e.preventDefault())}_mouseWheelHandler(e){const t=this;t.disabled||t.$.verticalScrollBar.disabled||(t._scrollView.scrollTo(t._scrollView.scrollTop+(e.deltaY<0?-t.offsetHeight:t.offsetHeight)),t.$.input.scrollTop+=e.deltaY<0?-t.offsetHeight:t.offsetHeight,t.$.input.scrollTop>0&&e.preventDefault())}_syncTextBoxContentOnInitialization(){const e=this;let t;t=""===e.value?e.innerHTML:e.value,"escaped"!==e.displayMode?e.$.input.value=e.value=e._initializationValue=t:t.match(/\r\n|\n\r|\n|\r|\s|\t|\f|\r/g)?(e.value=e._initializationValue=t,e.$.input.value=e._toEscapedDisplayMode(t)):(e.value=e._initializationValue=e._toDefaultDisplayMode(t),e.$.input.value=t)}_textBoxChangeHandler(e){const t=this,l=e.clipboardData||e.originalEvent&&e.originalEvent.clipboardData||window.clipboardData,a=t.value;if("escaped"===t.displayMode){const a=t.$.input.selectionStart,i=t.$.input.selectionEnd;if(l){let n=l.getData("text"),r=t.$.input.value;e.preventDefault(),n=t._toEscapedDisplayMode(n),t.$.input.value=r.substring(0,a)+n+r.substring(i,r.length)}t.value=t._toDefaultDisplayMode(t.$.input.value)}else t.value=t.$.input.value;t._handleScrollbarsDisplay(),t.value.length>0?t.$.addClass("has-value"):t.$.removeClass("has-value"),l||t.$.fireEvent("change",{value:t.value,oldValue:a,type:"blur"}),t._handleHintContainer()}_inputTouchmoveHandler(e){const t=this;if((t._resizeStarted||t._touchmoveInside)&&e.cancelable)return e.preventDefault(),void e.stopPropagation();const l=t.$.container.classList.contains("vscroll"),a=t._touchCoords;if(!t.$.container.classList.contains("hscroll")&&!l||!a)return;const i=t._scrollView,n=e.touches[0];let r,o,s,c;t._touchCoords=[n.pageX,n.pageY],l?(r=i.scrollTop,o=i.scrollHeight,s=n.pageY,c=a[1]):(r=i.scrollLeft,o=i.scrollWidth,s=n.pageX,c=a[0]);const u=parseFloat(s.toFixed(5)),d=parseFloat(c.toFixed(5));0===r&&u>=d||r===o&&u<=d||(s!==c&&(t._touchmoveInside=!0),e.cancelable&&(e.preventDefault(),e.stopPropagation()))}_inputTouchstartHandler(e){const t=e.touches[0];this._touchCoords=[t.pageX,t.pageY]}_resizeDownHandler(){const e=this;!e.disabled&&e.resizable&&(e._resizeStarted=!0,e.$container.addClass("smart-resize"),e.readonly||e.$.input.setAttribute("readonly",""))}_resizeMoveHandler(e){const t=this;if(t.disabled||!t.resizable||!t._resizeStarted)return;const l=t.getBoundingClientRect(),a=50,i=50,n=t.rightToLeft?l.width+l.left-e.clientX:e.clientX-l.left,r=e.clientY-l.top;n>a&&(t.style.width=n+"px"),r>i&&(t.style.height=r+"px")}_updateSizeRowsCols(){const e=this;e.$.container.removeAttribute("style"),setTimeout((function(){if(!("disabled"!==e.horizontalScrollBarVisibility&&"hidden"!==e.horizontalScrollBarVisibility||"disabled"!==e.verticalScrollBarVisibility&&"hidden"!==e.verticalScrollBarVisibility))return;const t=e.getBoundingClientRect();e.$.container.style.width=t.width+"px",e.$.container.style.height=t.height+"px"}),0)}_upHandler(e){const t=this;delete t._touchCoords,delete t._touchmoveInside,t._selectionStarted=!1,t.disabled||(e.originalEvent.target!==t.$.input?(t.$container.removeClass("smart-resize"),t.readonly||t.$.input.removeAttribute("readonly"),t._resizeStarted&&t.$.input.focus(),t._resizeStarted=!1):t._handlePointerInEscapedSymbol())}_verticalScrollbarHandler(e){const t=this;t.disabled||"disabled"===t.verticalScrollBarVisibility||"hidden"===t.verticalScrollBarVisibility||(e.stopPropagation(),t.$.input.scrollTop=e.detail.value)}_documentDownHandler(e){const t=this;t._selectionStarted=!1,e.originalEvent&&t.$.input.contains(e.originalEvent.target)&&(t._selectionStarted=!0,t._selectionStartTime=new Date,t._pointerDown={pageX:e.pageX,pageY:e.pageY},t._edgeSelect=!1)}_documentSelectionOutsideHandler(e){const t=this;if(clearInterval(t._outsideAutoScroll),!t._selectionStarted)return;const l=t.$.input.getBoundingClientRect(),a=l.y+10,i=l.y+l.height-10;function n(l){const a=t.getBoundingClientRect(),i=document.documentElement,n=l?"Left":"Top";(l?a.left+i.scrollLeft-e.pageX:a.top+i.scrollTop-e.pageY)>0?(t.$.input["scroll"+n]-=10,t._scrollView["scroll"+n]-=10):(t.$.input["scroll"+n]+=10,t._scrollView["scroll"+n]+=10)}e.pageY>a&&e.pageY<i||!(new Date-t._selectionStartTime<300)&&(Math.abs(t._pointerDown.pageX-e.pageX)>=3||Math.abs(t._pointerDown.pageY-e.pageY)>=3)&&(t._outsideAutoScroll=setInterval((function(){n(),n(!0)}),10))}_selectStartHandler(){}_styleChangedHandler(){}});
47
47
  Smart("smart-password-text-box",class extends Smart.BaseElement{static get properties(){return{autoFocus:{value:!1,type:"boolean"},hint:{value:"",reflectToAttribute:!0,type:"string"},label:{value:"",reflectToAttribute:!0,type:"string"},maxLength:{value:null,type:"number?"},minLength:{value:2,type:"number"},messages:{value:{en:{passwordStrength:"Password strength",short:"Short",weak:"Weak",far:"Far",good:"Good",strong:"Strong",showPassword:"Show password"}},type:"object",extend:!0},name:{value:"",type:"string"},passwordStrength:{value:null,type:"function?",reflectToAttribute:!1},placeholder:{value:"",type:"string"},selectAllOnFocus:{value:!1,type:"boolean"},showPasswordIcon:{value:!1,type:"boolean"},showPasswordStrength:{value:!1,type:"boolean"},tooltipArrow:{value:!1,type:"boolean"},tooltipDelay:{value:0,type:"number"},tooltipPosition:{allowedValues:["bottom","top","left","right","absolute"],value:"top",type:"string"},tooltipTemplate:{value:null,type:"string?"},type:{value:"password",type:"string",defaultReflectToAttribute:!0,readonly:!0},value:{value:"",reflectToAttribute:!1,type:"string"}}}static get listeners(){return{"document.up":"_documentUpHandler",mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler","passwordIcon.down":"_showPassword","input.change":"_textBoxChangeHandler","input.paste":"_textBoxChangeHandler","input.keyup":"_textBoxChangeHandler","input.blur":"_blurHandler","input.focus":"_focusHandler"}}static get requires(){return{"Smart.Tooltip":"smart.tooltip.js"}}static get styleUrls(){return["smart.textbox.css","smart.passwordtextbox.css"]}template(){return'<div id="container" role="presentation"><span id="label" class="smart-label">[[label]]</span><div id="innerContainer" class="smart-content" role="presentation"><input class="smart-input" type="password" id="input"\n disabled="[[disabled]]"\n maxlength="[[maxLength]]"\n minlength="[[minLength]]"\n name="[[name]]"\n placeholder="[[placeholder]]"\n readonly="[[readonly]]"\n value="[[value]]"/><span id="passwordIcon" title="Show Password" class="smart-password-icon smart-hidden" role="button" aria-label="Show Password"></span></div><span id="hint" class="smart-hint">[[hint]]</span><smart-tooltip id="tooltip"\n open-mode="manual"\n arrow="[[tooltipArrow]]"\n right-to-left="[[rightToLeft]]"\n tooltip-template="[[tooltipTemplate]]"\n position="[[tooltipPosition]]"\n delay="[[tooltipDelay]]"></smart-tooltip></div>'}propertyChangedHandler(e,t,a){const s=this;let o;switch(e){case"locale":case"messages":case"passwordStrength":o=s._evaluatePasswordStrength(),s._updateTooltipString(o),s.$.passwordIcon.setAttribute("title",s.localize("showPassword")),s._updatePasswordStrengthStyles(o);break;case"tooltipPosition":s.$.tooltip.position=s.tooltipPosition;break;case"tooltipTemplate":s.$.tooltip.tooltipTemplate=s.tooltipTemplate;break;case"value":o=s._evaluatePasswordStrength(),s._updateTooltipString(o),s._updatePasswordStrengthStyles(o);break;case"disabled":case"unfocusable":s._setFocusable();break;case"readonly":break;default:super.propertyChangedHandler(e,t,a)}}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.$.input.tabIndex=-1:e.$.input.removeAttribute("tabindex")}render(){this._createElement(),super.render()}focus(){this.$.input.focus()}blur(){this.$.input.blur()}reset(){const e=this;e.$.input.value=e.value=e._initializationValue}_createElement(){const e=this;e.autoFocus&&e.$.input.focus(),e.$.input.autocomplete="new-password",e.$.addClass("smart-input"),e._setFocusable(),e.$.tooltip.selector=e.$.innerContainer,e.$.passwordIcon.setAttribute("title",e.localize("showPassword")),e._updateTooltipString("short"),e._updatePasswordStrengthStyles(),e._initializationValue=e.value,e.value.length>0?e.$.addClass("has-value"):e.$.removeClass("has-value"),e._handleHintContainer(),e.shadowRoot&&(e.$.tooltip.style.display="none",requestAnimationFrame((()=>e.$.tooltip.style.display=""))),e.$.label.id||(e.$.label.id=e.id+"Label"),e.$.hint.id||(e.$.hint.id=e.id+"Hint"),e.setAttribute("role","presentation"),e.$.innerContainer.removeAttribute("aria-describedby"),e.$.input.setAttribute("aria-describedby",e.$.tooltip.id+" "+e.$.hint.id),e.$.input.setAttribute("aria-labelledby",e.$.label.id);const t=e.$.label.textContent.trim(),a=t||(e.placeholder?e.placeholder:"Input");e.$.input.setAttribute("aria-label",a)}_handleHintContainer(){const e=this;if(!e.hint)return;const t=e.$.hint;if("function"==typeof e.hint){const a=e.value;e.hint(a,t)?e.$.addClass("invalid"):e.$.removeClass("invalid")}else"string"==typeof e.hint&&(t.innerHTML=e.hint,e.$.removeClass("invalid"))}_focusHandler(){const e=this;e.disabled||(e.selectAllOnFocus&&e.$.input.select(),e.showPasswordIcon&&(e.className.indexOf("smart-validation")>=0?e.$.passwordIcon.style.marginRight="30px":e.$.passwordIcon.style.marginRight="",e.$passwordIcon.removeClass("smart-hidden")),e.setAttribute("focus",""),e._valueBeforeChange=e.value,e.$.fireEvent("focus"),e.showPasswordStrength&&(e._tooltipOpened||(e.$.tooltip.open(),e._tooltipOpened=!0)))}_blurHandler(){const e=this;e.disabled||e._passwordIconPressed||(e._valueBeforeChange!==e.value&&(e.$.fireEvent("change",{value:e.value,oldValue:e._valueBeforeChange}),e._valueBeforeChange=""),e.showPasswordIcon&&e.$passwordIcon.addClass("smart-hidden"),e.removeAttribute("focus"),e.value.length>0?e.$.addClass("has-value"):e.$.removeClass("has-value"),e.$.fireEvent("blur"),e._tooltipOpened&&(e.$.tooltip.close(),e._tooltipOpened=!1))}_showPassword(){const e=this;!e.disabled&&e.showPasswordIcon&&(e.$.input.type="text",e._passwordIconPressed=!0)}_documentUpHandler(){const e=this;!e.disabled&&e.showPasswordIcon&&e._passwordIconPressed&&(e.$.input.type="password",e._passwordIconPressed=!1,e.$.input.focus())}_textBoxChangeHandler(e){const t=this;if(t.disabled||t.readonly)return;const a=t.value;if(t.value=t.$.input.value,t.$.input){const s=t.$.input.value;a!==s&&t.$.fireEvent("changing",{oldValue:a,value:s}),e&&"Enter"===e.key&&(t.$.fireEvent("change",{value:t.value,oldValue:t._valueBeforeChange}),t._valueBeforeChange=t.value)}e&&"keyup"!==e.type&&e.stopPropagation();let s=t._evaluatePasswordStrength();t._updateTooltipString(s),t._updatePasswordStrengthStyles(s)}_updatePasswordStrengthStyles(e){const t=this,a=["short","weak","far","good","strong"];e=e||"short";for(let e=0;e<a.length;e++)t.$container.removeClass("smart-password-"+a[e]);t.disabled||t.$container.addClass("smart-password-"+e)}_evaluatePasswordStrength(){const e=this,t=e.$.input.value,a=t.length,s="<>@!#$%^&*()_+[]{}?:;|'\"\\,./~`-=";if(e.disabled)return;if(e.passwordStrength)return e.passwordStrength(t,s);let o=0,n=0,r=0,l=0;for(var i=0;i<a;i++){const e=t.charAt(i),a=t.charCodeAt(i);a>64&&a<91||a>96&&a<123||a>127&&a<155||a>159&&a<166?o+=1:!1!==isNaN(e)?-1===s.indexOf(e)||(r+=1):n+=1}return l=o+n+2*r+o*n/2+a,a<8?"short":l<20?"weak":l<30?"far":l<40?"good":"strong"}refresh(){}_keyUpHandler(){}_mouseWheelHandler(){}_resizeHandler(){}_selectStartHandler(){}_setDropDownSize(){}_styleChangedHandler(){}_mouseEventsHandler(e){"mouseenter"===e.type?this.setAttribute("hover",""):this.removeAttribute("hover")}_updateTooltipString(e){const t=this;t.$.tooltip.value='<span class="password-strength-label">'+t.localize("passwordStrength")+': </span><span class="password-strength-value">'+t.localize(e)+"</span>"}});
48
- Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!=typeof t?Object.assign(e,t):(e.label=t,e.dataField=t),e.dataField||(e.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.setState(t),e.dataType||(e.dataType="string"),e.title||(e.title=""),e.tooltip||(e.tooltip=""),e.tooltipRenderer||(e.tooltipRenderer=""),e.rowSpan||(e.rowSpan=null),e.formula||(e.formula=null),e.AIQuery||(e.AIQuery=null),e.columnGroup||(e.columnGroup=""),e.canNotify=!0,(!t||t&&!t.properties)&&(e.data=t);let o="left";switch(e.dataType){case"string":case"date":o="left";break;case"number":"rating"===t.template&&(o="left");break;case"boolean":o="center"}if(e.displayField!==e.dataField&&(o="left"),e.relationId||(e.relationId=""),e.relationField||(e.relationField=""),e.relationCascadingFields||(e.relationCascadingFields=""),e.highlight||(e.highlight=!1),void 0===e.index&&(e.index=-1),void 0===e.visibleIndex&&(e.visibleIndex=-1),void 0===e.selected&&(e.selected=!1),void 0===e.freeze&&(e.freeze=!1),e.label||(e.label=""),e.menuItems||(e.menuItems=null),e.options||(e.options=null),e.displayField||(e.displayField=e.dataField),e.template||(e.template=""),e.editor||(e.editor="input"),"string"==typeof e.editor){e.editor={template:e.editor,autoFocus:!0};let t=!0;e.editor.template&&e.editor.template.indexOf("<input")>=0&&(t=!1),t&&("number"===e.dataType||"int"===e.dataType||"float"===e.dataType?"slider"!==e.editor.template&&(e.editor.template="numberInput"):"date"===e.dataType?("timeInput"!==e.editor.template&&"dateTimePicker"!==e.editor.template&&(e.editor.template="dateInput"),e.editor.autoOpen=!0,e.cellsFormat||e.formatSettings||(e.cellsFormat="M/d/yyyy")):"time"===e.dataType?e.editor.template="timeInput":"boolean"===e.dataType||"bool"===e.dataType?e.editor.template="checkBox":"string"===e.dataType&&"tags"===e.template?(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,singleSelect:!0},e.templateSettings&&!0===e.templateSettings.multiSelect&&(e.editor.singleSelect=!1),e.options&&(e.editor.dataSource=e.options)):"string"===e.dataType&&"collaborator"===e.template&&(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,collaborator:!0,singleSelect:!0}))}else if(void 0===e.editor.autoFocus&&(e.editor.autoFocus=!0),e.editor.relationId&&e.editor.relationField&&e.grid){const t=e.grid._getRelationData(e.editor.relationId,e.editor.relationField,e.editor.singleSelect);e.editor.dataSource=t}if(e.icon||(e.icon="smart-icon-font","modifiedTime"===e.template&&(e.template="updatedTime"),"modifiedBy"===e.template&&(e.template="updatedBy"),"select"===e.editor.template&&(e.icon="smart-icon-sort-down"),"multiComboInput"===e.editor.template&&(e.icon="smart-icon-list-unordered"),"textArea"!==e.editor.template&&"textarea"!==e.editor.template||(e.icon="smart-icon-fontsize"),"url"===e.template&&(e.icon="smart-icon-link"),"email"===e.template&&(e.icon="smart-icon-mail"),"color"===e.template&&(e.icon="smart-icon-color-background"),"updatedTime"!==e.template&&"createdTime"!==e.template||(e.icon="smart-icon-clock"),"multiComboInput"===e.editor.template&&e.editor.collaborator&&(e.icon="smart-icon-user"),"createdBy"!==e.template&&"updatedBy"!==e.template&&"collaborator"!==e.template||(e.icon="smart-icon-user"),"image"===e.editor.template&&(e.icon="smart-icon-image"),"attachment"===e.editor.template&&(e.icon="smart-icon-docs"),"password"===e.editor.template&&(e.icon="smart-icon-lock"),"phone"===e.editor.template?e.icon="smart-icon-phone":"checkBox"===e.editor.template||"boolean"===e.dataType?e.icon="smart-icon-ok-squared":"numberInput"===e.editor.template||"slider"===e.editor.template||"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.icon="smart-icon-number":"dateInput"===e.editor.template||"dateTimePicker"===e.editor.template||"date"===e.dataType?(e.icon="smart-icon-calendar","timeInput"===e.editor.template&&(e.icon="smart-icon-clock")):"timeInput"===e.editor.template||"time"===e.dataType?e.icon="smart-icon-clock":"grid"===e.editor.template?e.icon="smart-icon-table-alt":e.editor.template&&e.editor.template.indexOf("multi")>=0&&"collaborator"!==e.template&&(e.editor.collaborator?e.icon="smart-icon-user":e.icon="smart-icon-list-ordered",e.editor.singleSelect&&(e.icon="smart-icon-sort-down")),e.relationId&&(e.icon="smart-icon-table-alt"),e.formula&&(e.icon="smart-icon-math"),(e.AIQuery||"ai"===e.template)&&(e.icon="smart-icon-ai"),"uuid"===e.template&&(e.icon="smart-icon-number"),"rating"!==e.editor.template&&"rating"!==e.template||(e.icon="smart-icon-star"),"sparklines"===e.template&&(e.icon="smart-icon-chart"),"vote"===e.template&&(e.icon="smart-icon-like"),"autoNumber"===e.template&&(e.icon="smart-icon-list-ordered")),e.menu=null,void 0===e.allowActionButtonAnimation&&(e.grid?e.allowActionButtonAnimation=e.grid.appearance.allowColumnActionButtonAnimation:e.allowActionButtonAnimation=!1),void 0===e.allowSortButtonAnimation&&(e.grid?e.allowSortButtonAnimation=e.grid.appearance.allowColumnSortButtonAnimation:e.allowSortButtonAnimation=!1),void 0===e.autoShowActionButton&&(e.grid?e.autoShowActionButton=e.grid.appearance.autoShowColumnActionButton:e.autoShowActionButton=!1),void 0===e.autoShowSortButton&&(e.grid?e.autoShowSortButton=e.grid.appearance.autoShowColumnSortButton:e.autoShowSortButton=!0),void 0===e.showSortButton&&(e.grid?e.showSortButton=e.grid.appearance.showColumnSortButton:e.showSortButton=!1),void 0===e.showCardLabel&&(e.showCardLabel=!0),void 0===e.cardSpan&&(e.cardSpan=!1),void 0===e.allowItemsAdd&&(e.allowItemsAdd=!1),void 0===e.dots&&(e.dots=!1),void 0===e.cardHeight&&(e.cardHeight=0,("image"===e.template||e.editor&&"textarea"===e.editor.template)&&(e.cardHeight=4)),void 0===e.showIcon&&(e.grid&&!e.autoGenerated?e.showIcon=e.grid.appearance.showColumnIcon:e.showIcon=!1),void 0===e.showDescriptionButton&&(e.grid?e.showDescriptionButton=e.grid.appearance.showColumnDescriptionButton:e.showDescriptionButton=!1),void 0===e.showCustomButton&&(e.grid?e.showCustomButton=e.grid.appearance.showColumnCustomButton:e.showCustomButton=!1),void 0===e.showActionButton&&(e.grid?e.showActionButton=e.grid.appearance.showColumnActionButton:e.showActionButton=!1),void 0===e.allowLabelAnimation&&(e.grid?e.allowLabelAnimation=e.grid.appearance.allowColumnLabelAnimation:e.allowLabelAnimation=!1),void 0===e.autoShowFilterButton&&(e.grid?e.autoShowFilterButton=e.grid.appearance.autoShowColumnFilterButton:e.autoShowFilterButton=!1),void 0===e.showFilterButton&&(e.grid?e.showFilterButton=e.grid.appearance.showColumnFilterButton:e.showFilterButton=!1),void 0===e.autoCloseMenu&&(e.grid?e.autoCloseMenu=e.grid.columnMenu.autoClose:e.autoCloseMenu=!0),void 0===e.allowNull&&(e.allowNull=!0),e.formatFunction||(e.formatFunction=null),e.cellsRenderer||(e.cellsRenderer=null),e.sortOrder||(e.sortOrder=null),void 0===e.sortIndex&&(e.sortIndex=null),e.sortComparator||(e.sortComparator=null),e.filter||(e.filter=null),e.className||(e.className=""),e.cellsClassName||(e.cellsClassName=""),e.cellsCSSRules||(e.cellsCSSRules=null),e.cellsCSSInlineRules||(e.cellsCSSInlineRules=null),e.filterMenuMode||(e.filterMenuMode="default",e.grid&&"excel"===e.grid.filtering.filterMenu.mode&&(e.filterMenuMode="excel"),e.autoGenerated&&(e.filterMenuMode="none")),e.align||(e.align=o),!e.cellsAlign)switch(e.cellsAlign=o,e.dataType){case"date":case"number":e.cellsAlign="right"}if(!(e.cellsWrap||(e.cellsWrap=!1,e.grid&&e.grid.layout.allowCellsWrap&&(e.cellsWrap=e.grid.layout.allowCellsWrap)),e.minWidth||(e.minWidth=30),e.width||(e.width=null),e.autoGenerated||e.width&&"number"==typeof e.width))if(e.grid&&e.grid.layout.columnWidth)e.width=e.grid.layout.columnWidth;else if(e.grid&&e.grid.layout.autoSizeNewColumn&&!e._autoSizeWidth){const t=e._autoSize();e.width=Math.max(e.grid.layout.autoSizeNewColumnMinWidth,t),e._autoSizeWidth=e.width}else e.width&&"string"==typeof e.width&&(isNaN(parseInt(e.width))||-1===e.width.indexOf("%")&&(e.width=parseInt(e.width)));if(void 0===e.visible&&(e.visible=!0),void 0===e.allowResize&&(e.allowResize=!0),void 0===e.allowFreeze&&(e.allowFreeze=!0),void 0===e.allowReorder&&(e.allowReorder=!0),void 0===e.allowHide&&(e.allowHide=!0),void 0===e.allowDelete&&(e.allowDelete=!0),void 0===e.allowSort&&(e.allowSort=!0),void 0===e.allowSelect&&(e.allowSelect=!0),void 0===e.allowSortToggleOnClick&&(e.allowSortToggleOnClick=!0),void 0===e.allowGroup&&(e.allowGroup=!0),void 0===e.allowFilter&&(e.allowFilter=!0),void 0===e.allowEdit&&(e.allowEdit=!0),void 0===e.allowTypeChange&&(e.allowTypeChange=!0),void 0===e.allowSummary&&(e.allowSummary=!0),void 0===e.allowHeaderEdit&&(e.allowHeaderEdit=!0),void 0===e.allowExport&&(e.allowExport=!0),void 0===e.allowCollapse&&(e.allowCollapse=!0),void 0===e.collapsed&&(e.collapsed=!1),void 0===e.description&&(e.description=""),void 0===e.group&&(e.group=!1),e.summary||(e.summary=[]),"false"===e.freeze&&(e.freeze=!1),"true"===e.freeze&&(e.freeze=!0),!1===e.allowFreeze&&(e.freeze=!1),void 0===e.defaultValue&&(e.defaultValue=null),e.disabledDialogOptions||(e.disabledDialogOptions=[]),e.formatSettings||(e.formatSettings={decimalPlaces:null,decimalSeparator:null,negativeWithBrackets:null,prefix:null,sufix:null,thousandsSeparator:null,dateFormat:"d"}),this.validationRules||(this.validationRules=[]),e.selected=!1,e.sorted=!1,e.filtered=!1,e.filter&&(e.filtered=!0),e.parent=null,e.children=[],e.templateSettings||(e.templateSettings={}),e.dataSet||(e.dataSet={}),e.grid&&e.formula){let t=e.formula;for(let o=0;o<e.grid.columns.length;o++){const l=e.grid.columns[o];-1===t.indexOf("COL("+l.dataField+")")&&-1===t.indexOf("COL("+l.label+")")&&(t.indexOf(l.label)>=0?(t=t.replaceAll(l.label,"COL("+l.dataField+")"),e.formula=t):t.indexOf(l.dataField)>=0&&(t=t.replaceAll(l.dataField,"COL("+l.dataField+")"),e.formula=t))}}if(!e.placeholder&&e.grid&&e.grid.appearance.allowColumnAutoPlaceholder&&("string"===e.dataType||"text"===e.dataType?e.placeholder=e.label:"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.placeholder="##":"date"===e.dataType&&(e.placeholder=e.cellsFormat||"m/d/yyyy"),e._state.placeholder=e.placeholder),"createdTime"===e.template||"updatedTime"===e.template||"createdBy"===e.template||"updatedBy"===e.template){const t=[];t.createdTime="createdDate",t.updatedTime="updatedDate",t.createdDate="createdDate",t.updatedDate="updatedDate",t.createdBy="createdBy",t.updatedBy="updatedBy",e.sortComparator=function(o,l,i,n){if(e.grid){const o=e.grid.rowById[i.$.id],l=e.grid.rowById[n.$.id],a=t[e.template];if("createdDate"===a){if(o.history[0].date<l.history[0].date)return-1;if(o.history[0].date>l.history[0].date)return 1}if("updatedDate"===a){if(o.history[o.history.length-1].date<l.history[l.history.length-1].date)return-1;if(o.history[o.history.length-1].date>l.history[l.history.length-1].date)return 1}}return 0}}}refresh(){const t=this;t.element&&t.element._refresh()}render(){const t=this;t.element.column=t,t.element&&t.element._render()}get stateProps(){return["allowExport","allowCollapse","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","formula","AIQuery","rowSpan","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","thHierarchy","dataSet","valueField","onAction","title","tooltip","tooltipRenderer","showCustomButton","showFilterButton","computedFields","showSortButton","editor","template","visibleIndex","validationRules","relationId","relationField","relationCascadingFields","parentDataField","cascadingDataField","allowItemsAdd","dots","placeholder"]}setState(t){const e=this;if(!t)return;if(e._state={},!t.dataField)return;if(t.dataField.startsWith("_"))return{};const o=e.stateProps;for(let l in t)if(!l.startsWith("_")&&o.indexOf(l)>=0)if("editor"===l){e._state[l]={};for(let t in e[l])"row"!==t&&"column"!==t&&"cell"!==t&&"columns"!==t&&"column"!==t&&"instance"!==t&&"element"!==t&&(e._state[l][t]=e[l][t])}else"groups"===l?e[l]&&e[l].length>0&&(e._state[l]=e[l]):e._state[l]=e[l]}getState(){const t=this;if(t.dataField.startsWith("_"))return{};if(t._state){t._state._visible=t._visible,t._state._dataField=t._dataField,t._state.editor={};for(let e in t.editor)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state.editor[e]=t.editor[e])}if(!t._state){t._state={label:t.label,dataField:t.dataField,dataType:t.dataType,_visible:t._visible};const e=t.stateProps;for(let o in t)if(!o.startsWith("_")&&e.indexOf(o)>=0)if("editor"===o){t._state[o]={};for(let e in t[o])"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state[o][e]=t[o][e])}else"groups"===o?t[o]&&t[o].length>0&&(t._state[o]=t[o]):"filter"===o?t[o]&&"string"!=typeof t[o]&&(t._state[o]=t[o].toString()):t._state[o]=t[o]}return t._state}setProperty(t,e,o=!0){const l=this,i=l.getProperty(t);i!==e&&(l.canNotify=!1,l[t]=e,o&&(l.propertyChanged(t,i,e),l.grid&&l.grid.onColumnChange&&l.stateProps.indexOf(t)>=0&&l.grid.onColumnChange(l,t,i,e)),l.canNotify=!0)}getProperty(t){const e=this;if("selected"===t){let o=!1;return e.grid&&(e.grid._selection.cells["column"+e.dataField]&&(o=null),e.grid&&e.grid._selection.columns[e.dataField]&&(o=!0),e.grid.columns.canNotify=!1,e[t]!==o&&(e[t]=o),e.grid.columns.canNotify=!0),o}return"group"===t?!(!e.dataSource||!e.dataSource.groupBy)&&e.dataSource.groupBy.indexOf(e.dataField)>=0:e[t]}get properties(){return["allowExport","allowCollapse","dataSet","options","allowTypeChange","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","canNotify","data","disabledDialogOptions","description","grid","icon","menuItems","menu","summary","cellsFormat","className","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","element","level","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","formula","AIQuery","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","rowSpan","showDescriptionButton","statusColumn","treeColumn","computedWidth","computedHeight","overflowWidth","parent","showCardLabel","cardSpan","tooltip","tooltipRenderer","cardHeight","relationId","relationField","relationCascadingFields","getFilterPanel","getCellValue","updateFilterPanel","children","value","thHierarchy","valueField","onAction","left","top","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules","parentDataField","cascadingDataField","computedFields","allowItemsAdd","dots","placeholder","detailColumns","collapsed"]}propertyChanged(t,e,o){const l=this;if(l.data&&void 0!==l.data[t]&&(l.data[t]=o),l._state||(l._state={label:l.label,dataField:l.dataField,dataType:l.dataType,_visible:l._visible}),l._state&&o!==e&&l.dataField&&!l.dataField.startsWith("_"))if("editor"===t){l._state[t]={};for(let e in o)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(l._state[t][e]=o[e])}else"filter"===t?l[t]&&"string"!=typeof o?l._state[t]=o.toString():l._state[t]=o:"sortOrder"===t?("asc"!==o&&"desc"!==o&&null!==o&&"ascending"!==o&&"descending"!==o&&(o=null),l.stateProps.indexOf(t)>=0&&(l._state[t]=o)):l.stateProps.indexOf(t)>=0&&(l._state[t]=o);if("formula"!==t)if("highlight"!==t)if("className"!==t)if("editor"!==t)if("allowSort"!==t&&"allowFilter"!==t)if("showIcon"!==t){if("visible"===t){const t=l.grid.grouping.enabled;return l.grid.refresh(t),void(t&&l.grid._filters&&l.grid.refreshFilters(t))}if("showCustomButton"===t&&(o?l.element._showCustomButton():l.element._hideCustomButton()),"showDescriptionButton"===t)return o?l.element._showDescriptionButton():l.element._hideDescriptionButton(),void l.refresh();if("description"!==t){if("filter"===t&&(l.filter?l.filter&&Array.isArray(l.filter)&&0===l.filter.length?(l.filter=null,l.filtered=!1,l.grid.removeFilter(l.dataField)):(l.grid.addFilter(l.dataField,l.filter),l.filtered=!0):(l.grid.removeFilter(l.dataField),l.filtered=!1),(l.autoShowFilterButton||l.showFilterButton)&&(o?l.element._showFilterButton():l.element._hideFilterButton()),l.grid.autoSaveState()),"sortIndex"===t)return-1===l.sortIndex&&(l.sortIndex=null),"many"===l.grid.sorting.mode&&l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),null!==l.sortIndex&&-1!==l.sortIndex?l.element.setAttribute("sort-index",l.sortIndex):l.element.removeAttribute("sort-index"),void l.element._updateSortOrder();if("selected"===t){if(!1===l.allowSelect)return;l.selectionColumn&&l.refresh(),o?l.grid._selection.columns[l.dataField]||(l.grid._selection.columns[l.dataField]=!0):!1===o&&l.grid._selection.columns[l.dataField]&&delete l.grid._selection.columns[l.dataField],l.grid._recycle(!1)}if("formatSettings"===t&&l.grid._recycle(!1),"sortOrder"===t)return l.sorted=!1,null===o?l.element._hideSortButton():(l.element._showSortButton(),l.sorted=!0),"asc"!==l.sortOrder&&"desc"!==l.sortOrder&&null!==l.sortOrder&&"ascending"!==l.sortOrder&&"descending"!==l.sortOrder&&(l.sortOrder=null),l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),void(l.sorted?l.element.setAttribute("aria-sort","asc"===l.sortOrder?"ascending":"descenting"):(l.element.removeAttribute("aria-sort"),l.element.removeAttribute("sort-index")));if("group"!==t){if("showActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._showActionButton():l.element._hideActionButton(),l.element.allowAnimations=!0),"autoShowActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._hideActionButton():l.element._showActionButton(),l.element.allowAnimations=!0),"showFilterButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowFilterButton&&(l._autoShowFilterButton=l.autoShowFilterButton),o?(l.autoShowFilterButton=!1,l.element._showFilterButton()):(l.element._hideFilterButton(),l.autoShowFilterButton=l._autoShowFilterButton),l.element.allowAnimations=!0),"showSortButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowSortButton&&(l._autoShowSortButton=l.autoShowSortButton),o?(l.autoShowSortButton=!1,l.element._showSortButton()):(l.element._hideSortButton(),l.autoShowSortButton=l._autoShowSortButton),l.element.allowAnimations=!0),"autoShowSortButton"===t&&(l.element.allowAnimations=!1,l._autoShowSortButton=l.autoShowSortButton,o?l.element._hideSortButton():l.element._showSortButton(),l.element.allowAnimations=!0),"menu"===t&&(o?l.element.setAttribute("aria-controls",l.menu.id):(l.element.removeAttribute("aria-controls"),l.autoShowActionButton&&l.element._hideActionButton())),"cellsFormat"!==t&&"formatSettings"!==t&&"dataField"!==t&&"displayField"!==t&&"template"!==t||l.grid._recycle(),"label"!==t&&"labelTemplate"!==t&&"width"!==t&&"minWidth"!==t||l.grid.refresh(),"freeze"===t){if(!l.allowFreeze)return;const t=l.grid,e=()=>{const e=t.context;t.context=t,t._renderColumns(),!1===o&&t._initializeRowElements(),t.refresh(),t.context=e};if(t.columnGroups&&t.columnGroups.length>0&&l.columnGroup)return void e();e()}}else l.grid.context===document&&(o?l.grid.addGroup(l.dataField):l.grid.removeGroup(l.dataField))}else l.refresh()}else l.refresh();else l.refresh();else l._editorId="_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);else l.refresh();else this.refresh();else l.grid&&l.grid._initFormulaParser()}_measureSize(t){const e=this.grid,o=function(){const o=[],l=document.createElement("div"),i=document.createElement("div"),n=Array.isArray(t)?t:[t];i.classList.add("smart-label"),l.appendChild(i),l.style.width="auto",l.style.position="static",e.$.columnHeader.appendChild(l);for(let t=0;t<n.length;t++){i.innerHTML="<span>"+n[t]+"</span>";const e=20+i.firstChild.offsetWidth,l=Math.max(30,e);o.push(l)}return e.$.columnHeader.removeChild(l),o}();return 1===o.length?o[0]:o}_autoSize(t){const e=this,o=e.grid;let l=e.label.toString();if(!t){const t=o.isInitialized?o._recyclingRows:[];for(let o=0;o<t.length;o++){const i=t[o],n=""+i.data[e.dataField];if("image"===e.template)break;n&&n.length>l.length&&(l=n),"date"===e.dataType&&n&&e.cellsFormat&&i.data[e.dataField]&&(l=new Smart.Utilities.DateTime(i.data[e.dataField]).toString(e.cellsFormat))}}const i=e._measureSize(l);return e.showIcon?i+20:i}autoSize(t){const e=this._autoSize(t);this.width=e}createElement(){const t=this,e=document.createElement("smart-grid-column");return e._initialize(t),e.setAttribute("role","columnheader"),e.setAttribute("aria-haspopup",""),t.element=e,t.grid.notify((function(e,o,l){switch(e){case"appearance_allowColumnLabelAnimation":t.setProperty("allowLabelAnimation",l);break;case"appearance_allowColumnSortAnimation":t.setProperty("allowSortAnimation",l);break;case"appearance_allowColumnSortButtonAnimation":t.setProperty("allowSortButtonAnimation",l);break;case"appearance_allowColumnActionButtonAnimation":t.setProperty("allowActionButtonAnimation",l);break;case"appearance_allowColumnFilterButtonAnimation":t.setProperty("allowFilterButtonAnimation",l);break;case"appearance_autoShowColumnActionButton":t.setProperty("autoShowActionButton",l);break;case"appearance_autoShowColumnSortButton":t.setProperty("autoShowSortButton",l);break;case"appearance_autoShowColumnFilterButton":t.setProperty("autoShowFilterButton",l);break;case"appearance_showColumnActionButton":t.setProperty("showActionButton",l);break;case"appearance_showColumnFilterButton":t.setProperty("showFilterButton",l);break;case"appearance_showColumnCustomButton":t.setProperty("showCustomButton",l);break;case"appearance_showColumnDescriptionButton":t.setProperty("showDescriptionButton",l);break;case"appearance_showColumnSortButton":t.setProperty("showSortButton",l);break;case"appearance_showFrozenColumnBackground":case"appearance_showSortColumnBackground":case"appearance_showFilterColumnBackground":t.grid._recycle(!1)}})),e}}),Smart("smart-grid-column",class extends Smart.BaseElement{_showSortButton(t){const e=this;e.column&&(e.column.autoGenerated||(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.column&&e.column.grid&&!1===e.column.grid.sorting.maintainSort?e.sortButton.removeAttribute("order"):(e.column.autoShowSortButton||e.column.allowSort&&e.sortButton.classList.add("smart-icon-sort","smart-grid-icon"),"asc"===e.column.sortOrder?e.sortButton.classList.add("asc"):"desc"===e.column.sortOrder&&e.sortButton.classList.add("desc"),e.column.showSortButton&&(e.sortButton.classList.add("show"),!1!==t&&e._refresh()),null!==e.column.sortIndex?e.sortButton.setAttribute("order",1+e.column.sortIndex):e.sortButton.removeAttribute("order"))))}_updateSortOrder(){const t=this;if(!t.column)return t.removeAttribute("sort-index"),void t.sortButton.removeAttribute("order");null!==t.column.sortIndex?(t.setAttribute("sort-index",t.column.sortIndex),t.sortButton.setAttribute("order",1+t.column.sortIndex)):(t.removeAttribute("sort-index"),t.sortButton.removeAttribute("order"))}_hideSortButton(t){const e=this;e.column&&(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.sortButton.removeAttribute("order"),e.column.showSortButton&&!e.column.autoShowSortButton||(e.sortButton.classList.remove("show"),e.sortButton.classList.remove("smart-icon-sort"),!1!==t&&e._refresh()))}_showFilterButton(t){const e=this;e.column&&!e.column.autoGenerated&&(e.filterButton.classList.add("show"),e._isInitialized&&!1!==t&&e._refresh())}_hideFilterButton(t){const e=this;e.column&&(e.filterButton.classList.remove("show"),e._isInitialized&&!1!==t&&e._refresh())}_showDescriptionButton(){const t=this;t.column&&!t.column.autoGenerated?t.hasAttribute("columnHeader")||(t.column.description?(t.descriptionButton.setAttribute("title",t.column.description),t.descriptionButton.classList.add("show")):t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh()):t.descriptionButton.classList.remove("show")}_hideDescriptionButton(){const t=this;t.column&&(t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh())}_showIcon(){const t=this;t.column&&!t.column.autoGenerated&&(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon",""),t._isInitialized&&t._refresh())}_hideIcon(){const t=this;t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon"),t._refresh()}_showCustomButton(){const t=this;t.column&&!t.column.autoGenerated&&(t.customButton.classList.add("show"),t._refresh())}_hideCustomButton(){const t=this;t.column&&(t.customButton.classList.remove("show"),t._refresh())}_showActionButton(){const t=this;t.column&&t.column.showActionButton&&t.column.grid.hasColumnMenu(t.column)&&!t.column.autoGenerated&&t.actionButton&&(t.actionButton.classList.add("show"),t._refresh())}_hideActionButton(){const t=this;t.column&&t.column.showActionButton&&t.actionButton&&!t.hasAttribute("aria-controls")&&t.actionButton.classList.contains("show")&&(t.actionButton.classList.remove("show"),t._refresh())}_rotate(){const t=this,e=document.createElement("span");return t.label.innerHTML="",e.innerHTML=t.column.label,t.label.appendChild(e),e.className="rotate",e.style.transform="rotate("+t.column.rotationAngle+"deg)",t.column.grid._recycleRotate(t.label,e,t.column.align,t.column.verticalAlign,t.column.label)}_align(){const t=this;let e=t.column.align;switch(t.column.grid.rightToLeft&&("left"===e?e="right":"right"===e&&(e="left")),e){case"left":t.label.classList.add("align-left");break;case"center":t.label.classList.add("align-center");break;case"right":t.label.classList.add("align-right")}switch(t.column.verticalAlign){case"top":t.label.classList.add("align-top");break;case"middle":t.label.classList.add("align-middle");break;case"bottom":t.label.classList.add("align-bottom")}}_refresh(){const t=this;if(!t.column)return;const e=t.column.grid;if(t.sortButton.classList.remove("filter"),t.sortButton.classList.remove("action"),t.label.className="smart-label",t.label.firstElementChild&&t.column.className&&(t.label.className="smart-label "+t.column.className),t.descriptionButton&&t.descriptionButton.setAttribute("title",t.column.description),!0===t.column.autoGenerated||t.hasAttribute("columnHeader")?t.descriptionButton.classList.remove("show"):t.column.showDescriptionButton&&t.column.description?t.descriptionButton.classList.add("show"):t.descriptionButton.classList.remove("show"),t.column.highlight?t.setAttribute("highlight",""):t.removeAttribute("highlight"),t.column.visible&&"_checkBoxColumn"===t.column.dataField){const e=t.column.grid;let o=e.getVisibleRows();e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode&&(o=o.slice(e.paging.pageIndex*e.paging.pageSize,(e.paging.pageIndex+1)*e.paging.pageSize));const l=e._getSelectedRows(!0,!1);if(e.selection.checkBoxes.autoShow?t.setAttribute("auto-show",""):t.removeAttribute("auto-show"),e._isVirtualMode()){const o=e.dataSource.virtualDataSourceLength;l>0&&l===o?t.setAttribute("selected",""):l>0&&l<o?t.setAttribute("selected","indeterminate"):0!==l&&0!==o||t.removeAttribute("selected")}else l.length>0&&l.length===o.length?t.setAttribute("selected",""):l.length>0&&l.length<o.length?t.setAttribute("selected","indeterminate"):0!==l.length&&0!==o.length||t.removeAttribute("selected");return t.removeAttribute("checkbox"),t.label.classList.remove("smart-input"),void("none"!==e.selection.checkBoxes.selectAllMode&&(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")))}if("_rowHeaderColumn"===this.column.dataField){const e=t.column.grid;if(e.selection.enabled&&e.selection.allowRowHeaderSelection&&e.appearance.showRowHeaderSelectIcon){let o='<div class="smart-grid-command-item">',l=e.areAllRowsSelected()?"smart-icon-check-squared":"smart-icon-check-empty";e.isEmpty()&&(l=""),o+='<span class="smart-grid-icon '+l+'"></span>',o+="</div>",t.label.style.paddingLeft="0px",t.label.style.paddingRight="0px",t.label.innerHTML=o}}if("_commandColumn"===t.column.dataField){const e=t.column.grid,o="icon"!==e.editing.commandColumn.displayMode,l="label"!==e.editing.commandColumn.displayMode,i=e.editing.commandColumn.dataSource.commandColumnMenu;let n='<div class="smart-grid-command-item">';const a="{{messages}}"===i.label?e.localize("commandColumnMenu"):i.label,r=i.icon;l&&o?(n+='<span class="smart-grid-icon '+r+'"></span>',n+='<span class="smart-grid-label">'+a+"</span>"):l&&!o?n+='<span class="smart-grid-icon '+r+'"></span>':o&&!l&&(n+='<span class="smart-grid-label">'+a+"</span>"),n+="</div>",i.visible&&(t.label.innerHTML=n)}const o=t.column.getProperty("selected");if(!1===o&&t.hasAttribute("selected")?t.removeAttribute("selected"):!0===o?t.setAttribute("selected",""):null===o&&t.setAttribute("selected","indeterminate"),t.column.allowSortButtonAnimation?t.sortButton.classList.add("smart-animate"):t.sortButton.classList.remove("smart-animate"),e.dragDrop&&e.dragDrop.column===t.column?t.classList.add("dragged"):t.classList.remove("dragged"),t.column.sorted?t._showSortButton(!1):t._hideSortButton(!1),t.column.sorted?(t.setAttribute("aria-sort","asc"===t.column.sortOrder?"ascending":"descenting"),t._updateSortOrder()):(t.removeAttribute("aria-sort"),t.removeAttribute("sort-index")),(t.column.autoShowFilterButton||t.column.showFilterButton)&&(t.column.filtered?t._showFilterButton(!1):t._hideFilterButton(!1)),t.column.allowFilterButtonAnimation?t.filterButton.classList.add("smart-animate"):t.filterButton.classList.remove("smart-animate"),t.column.allowActionButtonAnimation&&!1!==t.allowAnimations?t.buttonsGroup.classList.add("smart-animate"):t.buttonsGroup.classList.remove("smart-animate"),t.column.allowLabelAnimation&&!1!==t.allowAnimations?t.label.classList.add("smart-animate"):t.label.classList.remove("smart-animate"),t.buttonsGroup.classList.remove("action"),t.actionButton.classList.contains("show")&&t.buttonsGroup.classList.add("action"),t.column.showIcon?(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon","")):(t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon","")),t.icon.classList.contains("show"))if(t.icon.className="smart-grid-icon show column-icon",t.column.icon&&t.column.icon.indexOf(" ")>=0){const e=t.column.icon.trim().split(" ");for(let o=0;o<e.length;o++)t.icon.classList.add(e[o])}else t.icon.classList.add(t.column.icon);let l=t.column.showIcon?1:0;for(let e=0;e<t.buttonsGroup.children.length;e++)t.buttonsGroup.children[e].classList.contains("show")&&l++;switch(l){case 1:t.label.classList.add("one");break;case 2:t.label.classList.add("two");break;case 3:t.label.classList.add("three");break;case 4:t.label.classList.add("four");break;case 5:t.label.classList.add("five");break;case 6:t.label.classList.add("six")}t.classList.remove("smart-visibility-hidden"),t.column.grid._columnGap>0?t.classList.add("smart-grid-column-border"):t.classList.remove("smart-grid-column-border"),t.column.grid.appearance.showColumnHeaderLines?t.classList.remove("smart-grid-vertical-border-collapse"):t.classList.add("smart-grid-vertical-border-collapse"),(!t.column.rotationAngle||t._rotate())&&t._align()}_renderTemplate(){const t=this,e=t.column,o=e.labelTemplate;let l="";if("function"!=typeof o){if(o instanceof HTMLTemplateElement)l=o;else{if("string"!=typeof o||!o.startsWith||!o.startsWith("#"))return void(t.label.innerHTML=o);l=document.querySelector(o)}if(l){let o=l.content.cloneNode(!0).firstElementChild,i=e.label;i=i.toString(),i=i.replace(/'/gi,"\\'"),i=i.replace(/"/gi,'\\"');const n=o.outerHTML.replace(/{{value}}/gi,i).replace(/{{id}}/gi,e.label);t.label.innerHTML=n}}else t.label.innerHTML=o(e.label)}_render(){const t=this,e=t.column.dataField?t.column.dataField:"",o=t.column===t.column.grid._lastVisibleColumn;if(t.column.labelTemplate?t._renderTemplate():t.label.firstChild?t.label.firstChild.textContent!==t.column.label&&(t.column.label.indexOf("&")>=0||"SPAN"!==t.label.firstChild.nodeName?t.label.innerHTML="<span>"+t.column.label+"</span>":t.label.firstChild.textContent=t.column.label):t.label.innerHTML="<span>"+t.column.label+"</span>",t.column.title?t.setAttribute("title",t.column.title):t.removeAttribute("title"),t.column.tooltip&&(t.onmouseenter=e=>{t.column.grid._createTooltip(e,t.column.tooltip,t,"top")},t.onmouseleave=()=>{t.column.grid._cellTooltip&&(t.column.grid._cellTooltip.style.visibility="hidden")}),t._refresh(),t.column.autoGenerated&&t.setAttribute("auto-generated",""),t.column.autoGenerated||o){if(t.style.width=t.column.computedWidth+"px",t.column.grid.appearance.showRowComments&&t.column.rowHeaderColumn){const e=t.column.grid.rowDetailColumn,o=e?e.width:0;t.style.width=t.column.computedWidth+o+"px",t.style.zIndex=5}}else t.style.width=t.column.computedWidth-t.column.grid._columnGap+"px";if(t.style.height!==t.column.computedHeight+"px"&&(t.style.height=t.column.computedHeight+"px"),t.style.lineHeight!==t.column.computedHeight+"px"&&(t.style.lineHeight=t.column.computedHeight+"px"),t.column.grid.rightToLeft?t.style.right!==t.column.left+"px"&&(t.style.right=t.column.left+"px"):t.style.left!==t.column.left+"px"&&(t.style.left=t.column.left+"px"),t.style.top!==t.column.top+"px"&&(t.style.top=t.column.top+"px"),t.getAttribute("data-field")!==e&&t.setAttribute("data-field",e),t.setAttribute("header",""),t.column.freeze&&t.setAttribute("freeze",""),t.column.level>0&&(t.style.top=t.column.top+"px"),t.column.detailColumns&&t.column.detailColumns.length>0){const e=t.column.grid;if(t.column._collapseButton)return;const o={},l=[];for(let o=0;o<t.column.detailColumns.length;o++){const i=e.columnByDataField[t.column.detailColumns[o]];i&&l.push(i)}o.inline=!0,o.columns=l,o.collapsed=t.column.collapsed,o.column=t.column,e._initializeColumnGroupCollapsing(o);const i=o.collapseButton;i&&(o.column._collapseButton=i,o.column.element.label.appendChild(i),o.column.element.label.style.display="flex",o.column.element.label.style.justifyContent="space-between")}t.column.headerTemplate&&t.column.headerTemplate(t.label)}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_initialize(t){const e=this;e._isInitialized=!1;const o=document.createElement("div"),l=document.createElement("div"),i=document.createElement("div"),n=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div");e.column=t,e.classList.add("smart-visibility-hidden"),c.classList.add("smart-drag-handle"),s.classList.add("smart-icon","smart-grid-icon"),o.classList.add("smart-label"),l.classList.add("smart-sort-button","smart-grid-icon"),i.classList.add("smart-filter-button","smart-icon-filter","smart-grid-icon"),n.classList.add("smart-action-button","smart-grid-icon"),n.setAttribute("aria-haspopup",""),a.classList.add("smart-description-button","smart-icon-help-circled","smart-grid-icon"),r.classList.add("smart-custom-button",t.customButtonIcon?t.customButtonIcon:"smart-icon-tools","smart-grid-icon"),d.classList.add("smart-buttons-group"),n.innerHTML="<div></div>",e.style.width=e.column.computedWidth+"px",e.appendChild(c),e.appendChild(s),e.appendChild(o),e.appendChild(d),d.appendChild(l),d.appendChild(i),d.appendChild(a),d.appendChild(r),d.appendChild(n),e.handle=c,e.icon=s,e.label=o,e.sortButton=l,e.filterButton=i,e.actionButton=n,e.descriptionButton=a,e.customButton=r,e.buttonsGroup=d,e._properties=[];const u=window.PointerEvent?"pointerdown":"mousedown",m=window.PointerEvent?"pointerup":"mouseup";e._filterDownEvent=function(t){"col-resize"!==t.target.style.cursor&&(t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t))}.bind(e),e._filterUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionDownEvent=function(t){t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t)}.bind(e),e.filterButton.addEventListener(u,e._filterDownEvent),e.filterButton.addEventListener(m,e._filterUpEvent),e.actionButton.addEventListener(m,e._actionUpEvent),e.actionButton.addEventListener(u,e._actionDownEvent),!e.column.autoShowActionButton&&e.column.showActionButton&&e._showActionButton(),!e.column.autoShowSortButton&&e.column.showSortButton&&e._showSortButton(),!e.column.autoShowFilterButton&&e.column.showFilterButton&&e._showFilterButton(),e.column.showDescriptionButton&&e._showDescriptionButton(),e.column.showCustomButton&&e._showCustomButton(),e.column.showIcon&&e._showIcon(),"_rowHeaderColumn"===e.column.dataField&&e.classList.add("top-near-corner"),e.customButton.onclick=function(t){e.column.onCustomButtonClick&&e.column.onCustomButtonClick(t)}.bind(e),e.column.sorted||e.column.sortOrder?(e.column.sorted=!0,e.setAttribute("aria-sort","asc"===e.column.sortOrder?"ascending":"descenting"),e._updateSortOrder()):(e.removeAttribute("aria-sort"),e.removeAttribute("sort-index")),e._properties=[],e._isInitialized=!0}template(){return""}_detach(){const t=this,e=window.PointerEvent?"pointerdown":"mousedown",o=window.PointerEvent?"pointerup":"mouseup";t.filterButton.removeEventListener(e,t._filterDownEven),t.filterButton.removeEventListener(o,t._filterUpEvent),t.actionButton.removeEventListener(o,t._actionUpEvent),t.actionButton.removeEventListener(e,t._actionDownEvent),t.element=null,t.column&&(t.column.grid=null,t.column.element=null),t.icon=null,t.label=null,t.sortButton=null,t.filterButton=null,t.actionButton=null,t.descriptionButton=null,t.customButton=null,t.buttonsGroup=null,t.column=null,delete t.grid,delete t.column,delete t.icon,delete t.label,delete t.sortButton,delete t.filterButton,delete t.actionButton,delete t.descriptionButton,delete t.customButton,delete t.buttonsGroup}onDetached(){this._detach()}});
48
+ Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!=typeof t?Object.assign(e,t):(e.label=t,e.dataField=t),e.dataField||(e.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.setState(t),e.dataType||(e.dataType="string"),e.title||(e.title=""),e.tooltip||(e.tooltip=""),e.tooltipRenderer||(e.tooltipRenderer=""),e.rowSpan||(e.rowSpan=null),e.formula||(e.formula=null),e.AIQuery||(e.AIQuery=null),e.columnGroup||(e.columnGroup=""),e.canNotify=!0,(!t||t&&!t.properties)&&(e.data=t);let o="left";switch(e.dataType){case"string":case"date":o="left";break;case"number":"rating"===t.template&&(o="left");break;case"boolean":o="center"}if(e.displayField!==e.dataField&&(o="left"),e.relationId||(e.relationId=""),e.relationField||(e.relationField=""),e.relationCascadingFields||(e.relationCascadingFields=""),e.highlight||(e.highlight=!1),void 0===e.index&&(e.index=-1),void 0===e.visibleIndex&&(e.visibleIndex=-1),void 0===e.selected&&(e.selected=!1),void 0===e.freeze&&(e.freeze=!1),e.label||(e.label=""),e.menuItems||(e.menuItems=null),e.options||(e.options=null),e.displayField||(e.displayField=e.dataField),e.template||(e.template=""),e.editor||(e.editor="input"),"string"==typeof e.editor){e.editor={template:e.editor,autoFocus:!0};let t=!0;e.editor.template&&e.editor.template.indexOf("<input")>=0&&(t=!1),t&&("number"===e.dataType||"int"===e.dataType||"float"===e.dataType?"slider"!==e.editor.template&&(e.editor.template="numberInput"):"date"===e.dataType?("timeInput"!==e.editor.template&&"dateTimePicker"!==e.editor.template&&(e.editor.template="dateInput"),e.editor.autoOpen=!0,e.cellsFormat||e.formatSettings||(e.cellsFormat="M/d/yyyy")):"time"===e.dataType?e.editor.template="timeInput":"boolean"===e.dataType||"bool"===e.dataType?e.editor.template="checkBox":"string"===e.dataType&&"tags"===e.template?(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,singleSelect:!0},e.templateSettings&&!0===e.templateSettings.multiSelect&&(e.editor.singleSelect=!1),e.options&&(e.editor.dataSource=e.options)):"string"===e.dataType&&"collaborator"===e.template&&(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,collaborator:!0,singleSelect:!0}))}else if(void 0===e.editor.autoFocus&&(e.editor.autoFocus=!0),e.editor.relationId&&e.editor.relationField&&e.grid){const t=e.grid._getRelationData(e.editor.relationId,e.editor.relationField,e.editor.singleSelect);e.editor.dataSource=t}if(e.icon||(e.icon="smart-icon-font","modifiedTime"===e.template&&(e.template="updatedTime"),"modifiedBy"===e.template&&(e.template="updatedBy"),"select"===e.editor.template&&(e.icon="smart-icon-sort-down"),"multiComboInput"===e.editor.template&&(e.icon="smart-icon-list-unordered"),"textArea"!==e.editor.template&&"textarea"!==e.editor.template||(e.icon="smart-icon-fontsize"),"url"===e.template&&(e.icon="smart-icon-link"),"email"===e.template&&(e.icon="smart-icon-mail"),"color"===e.template&&(e.icon="smart-icon-color-background"),"updatedTime"!==e.template&&"createdTime"!==e.template||(e.icon="smart-icon-clock"),"multiComboInput"===e.editor.template&&e.editor.collaborator&&(e.icon="smart-icon-user"),"createdBy"!==e.template&&"updatedBy"!==e.template&&"collaborator"!==e.template||(e.icon="smart-icon-user"),"image"===e.editor.template&&(e.icon="smart-icon-image"),"attachment"===e.editor.template&&(e.icon="smart-icon-docs"),"password"===e.editor.template&&(e.icon="smart-icon-lock"),"phone"===e.editor.template?e.icon="smart-icon-phone":"checkBox"===e.editor.template||"boolean"===e.dataType?e.icon="smart-icon-ok-squared":"numberInput"===e.editor.template||"slider"===e.editor.template||"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.icon="smart-icon-number":"dateInput"===e.editor.template||"dateTimePicker"===e.editor.template||"date"===e.dataType?(e.icon="smart-icon-calendar","timeInput"===e.editor.template&&(e.icon="smart-icon-clock")):"timeInput"===e.editor.template||"time"===e.dataType?e.icon="smart-icon-clock":"grid"===e.editor.template?e.icon="smart-icon-table-alt":e.editor.template&&e.editor.template.indexOf("multi")>=0&&"collaborator"!==e.template&&(e.editor.collaborator?e.icon="smart-icon-user":e.icon="smart-icon-list-ordered",e.editor.singleSelect&&(e.icon="smart-icon-sort-down")),e.relationId&&(e.icon="smart-icon-table-alt"),e.formula&&(e.icon="smart-icon-math"),(e.AIQuery||"ai"===e.template)&&(e.icon="smart-icon-ai"),"uuid"===e.template&&(e.icon="smart-icon-number"),"rating"!==e.editor.template&&"rating"!==e.template||(e.icon="smart-icon-star"),"sparklines"===e.template&&(e.icon="smart-icon-chart"),"vote"===e.template&&(e.icon="smart-icon-like"),"autoNumber"===e.template&&(e.icon="smart-icon-list-ordered")),e.menu=null,void 0===e.allowActionButtonAnimation&&(e.grid?e.allowActionButtonAnimation=e.grid.appearance.allowColumnActionButtonAnimation:e.allowActionButtonAnimation=!1),void 0===e.allowSortButtonAnimation&&(e.grid?e.allowSortButtonAnimation=e.grid.appearance.allowColumnSortButtonAnimation:e.allowSortButtonAnimation=!1),void 0===e.autoShowActionButton&&(e.grid?e.autoShowActionButton=e.grid.appearance.autoShowColumnActionButton:e.autoShowActionButton=!1),void 0===e.autoShowSortButton&&(e.grid?e.autoShowSortButton=e.grid.appearance.autoShowColumnSortButton:e.autoShowSortButton=!0),void 0===e.showSortButton&&(e.grid?e.showSortButton=e.grid.appearance.showColumnSortButton:e.showSortButton=!1),void 0===e.showCardLabel&&(e.showCardLabel=!0),void 0===e.cardSpan&&(e.cardSpan=!1),void 0===e.allowItemsAdd&&(e.allowItemsAdd=!1),void 0===e.dots&&(e.dots=!1),void 0===e.cardHeight&&(e.cardHeight=0,("image"===e.template||e.editor&&"textarea"===e.editor.template)&&(e.cardHeight=4)),void 0===e.showIcon&&(e.grid&&!e.autoGenerated?e.showIcon=e.grid.appearance.showColumnIcon:e.showIcon=!1),void 0===e.showDescriptionButton&&(e.grid?e.showDescriptionButton=e.grid.appearance.showColumnDescriptionButton:e.showDescriptionButton=!1),void 0===e.showCustomButton&&(e.grid?e.showCustomButton=e.grid.appearance.showColumnCustomButton:e.showCustomButton=!1),void 0===e.showActionButton&&(e.grid?e.showActionButton=e.grid.appearance.showColumnActionButton:e.showActionButton=!1),void 0===e.allowLabelAnimation&&(e.grid?e.allowLabelAnimation=e.grid.appearance.allowColumnLabelAnimation:e.allowLabelAnimation=!1),void 0===e.autoShowFilterButton&&(e.grid?e.autoShowFilterButton=e.grid.appearance.autoShowColumnFilterButton:e.autoShowFilterButton=!1),void 0===e.showFilterButton&&(e.grid?e.showFilterButton=e.grid.appearance.showColumnFilterButton:e.showFilterButton=!1),void 0===e.autoCloseMenu&&(e.grid?e.autoCloseMenu=e.grid.columnMenu.autoClose:e.autoCloseMenu=!0),void 0===e.allowNull&&(e.allowNull=!0),e.formatFunction||(e.formatFunction=null),e.cellsRenderer||(e.cellsRenderer=null),e.sortOrder||(e.sortOrder=null),void 0===e.sortIndex&&(e.sortIndex=null),e.sortComparator||(e.sortComparator=null),e.filter||(e.filter=null),e.className||(e.className=""),e.cellsClassName||(e.cellsClassName=""),e.cellsCSSRules||(e.cellsCSSRules=null),e.cellsCSSInlineRules||(e.cellsCSSInlineRules=null),e.filterMenuMode||(e.filterMenuMode="default",e.grid&&"excel"===e.grid.filtering.filterMenu.mode&&(e.filterMenuMode="excel"),e.autoGenerated&&(e.filterMenuMode="none")),e.align||(e.align=o),!e.cellsAlign)switch(e.cellsAlign=o,e.dataType){case"date":case"number":e.cellsAlign="right"}if(!(e.cellsWrap||(e.cellsWrap=!1,e.grid&&e.grid.layout.allowCellsWrap&&(e.cellsWrap=e.grid.layout.allowCellsWrap)),e.minWidth||(e.minWidth=30),e.width||(e.width=null),e.autoGenerated||e.width&&"number"==typeof e.width))if(e.grid&&e.grid.layout.columnWidth)e.width=e.grid.layout.columnWidth;else if(e.grid&&e.grid.layout.autoSizeNewColumn&&!e._autoSizeWidth){const t=e._autoSize();e.width=Math.max(e.grid.layout.autoSizeNewColumnMinWidth,t),e._autoSizeWidth=e.width}else e.width&&"string"==typeof e.width&&(isNaN(parseInt(e.width))||-1===e.width.indexOf("%")&&(e.width=parseInt(e.width)));if(void 0===e.visible&&(e.visible=!0),void 0===e.allowResize&&(e.allowResize=!0),void 0===e.allowFreeze&&(e.allowFreeze=!0),void 0===e.allowReorder&&(e.allowReorder=!0),void 0===e.allowHide&&(e.allowHide=!0),void 0===e.allowDelete&&(e.allowDelete=!0),void 0===e.allowSort&&(e.allowSort=!0),void 0===e.allowSelect&&(e.allowSelect=!0),void 0===e.allowSortToggleOnClick&&(e.allowSortToggleOnClick=!0),void 0===e.allowGroup&&(e.allowGroup=!0),void 0===e.allowFilter&&(e.allowFilter=!0),void 0===e.allowEdit&&(e.allowEdit=!0),void 0===e.allowTypeChange&&(e.allowTypeChange=!0),void 0===e.allowSummary&&(e.allowSummary=!0),void 0===e.allowHeaderEdit&&(e.allowHeaderEdit=!0),void 0===e.allowExport&&(e.allowExport=!0),void 0===e.allowCollapse&&(e.allowCollapse=!0),void 0===e.collapsed&&(e.collapsed=!1),void 0===e.description&&(e.description=""),void 0===e.group&&(e.group=!1),e.summary||(e.summary=[]),"false"===e.freeze&&(e.freeze=!1),"true"===e.freeze&&(e.freeze=!0),!1===e.allowFreeze&&(e.freeze=!1),void 0===e.defaultValue&&(e.defaultValue=null),e.disabledDialogOptions||(e.disabledDialogOptions=[]),e.formatSettings||(e.formatSettings={decimalPlaces:null,decimalSeparator:null,negativeWithBrackets:null,prefix:null,sufix:null,thousandsSeparator:null,dateFormat:"d"}),this.validationRules||(this.validationRules=[]),e.selected=!1,e.sorted=!1,e.filtered=!1,e.filter&&(e.filtered=!0),e.parent=null,e.children=[],e.templateSettings||(e.templateSettings={}),e.dataSet||(e.dataSet={}),e.grid&&e.formula){let t=e.formula;for(let o=0;o<e.grid.columns.length;o++){const l=e.grid.columns[o];-1===t.indexOf("COL("+l.dataField+")")&&-1===t.indexOf("COL("+l.label+")")&&(t.indexOf(l.label)>=0?(t=t.replaceAll(l.label,"COL("+l.dataField+")"),e.formula=t):t.indexOf(l.dataField)>=0&&(t=t.replaceAll(l.dataField,"COL("+l.dataField+")"),e.formula=t))}}if(!e.placeholder&&e.grid&&e.grid.appearance.allowColumnAutoPlaceholder&&("string"===e.dataType||"text"===e.dataType?e.placeholder=e.label:"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.placeholder="##":"date"===e.dataType&&(e.placeholder=e.cellsFormat||"m/d/yyyy"),e._state.placeholder=e.placeholder),"createdTime"===e.template||"updatedTime"===e.template||"createdBy"===e.template||"updatedBy"===e.template){const t=[];t.createdTime="createdDate",t.updatedTime="updatedDate",t.createdDate="createdDate",t.updatedDate="updatedDate",t.createdBy="createdBy",t.updatedBy="updatedBy",e.sortComparator=function(o,l,n,i){if(e.grid){const o=e.grid.rowById[n.$.id],l=e.grid.rowById[i.$.id],a=t[e.template];if("createdDate"===a){if(o.history[0].date<l.history[0].date)return-1;if(o.history[0].date>l.history[0].date)return 1}if("updatedDate"===a){if(o.history[o.history.length-1].date<l.history[l.history.length-1].date)return-1;if(o.history[o.history.length-1].date>l.history[l.history.length-1].date)return 1}}return 0}}}refresh(){const t=this;t.element&&t.element._refresh()}render(){const t=this;t.element.column=t,t.element&&t.element._render()}get stateProps(){return["allowExport","allowCollapse","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","formula","AIQuery","rowSpan","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","thHierarchy","dataSet","valueField","onAction","title","tooltip","tooltipRenderer","showCustomButton","showFilterButton","computedFields","showSortButton","editor","template","visibleIndex","validationRules","relationId","relationField","relationCascadingFields","parentDataField","cascadingDataField","allowItemsAdd","dots","placeholder"]}setState(t){const e=this;if(!t)return;if(e._state={},!t.dataField)return;if(t.dataField.startsWith("_"))return{};const o=e.stateProps;for(let l in t)if(!l.startsWith("_")&&o.indexOf(l)>=0)if("editor"===l){e._state[l]={};for(let t in e[l])"row"!==t&&"column"!==t&&"cell"!==t&&"columns"!==t&&"column"!==t&&"instance"!==t&&"element"!==t&&(e._state[l][t]=e[l][t])}else"groups"===l?e[l]&&e[l].length>0&&(e._state[l]=e[l]):e._state[l]=e[l]}getState(){const t=this;if(t.dataField.startsWith("_"))return{};if(t._state){t._state._visible=t._visible,t._state._dataField=t._dataField,t._state.editor={};for(let e in t.editor)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state.editor[e]=t.editor[e])}if(!t._state){t._state={label:t.label,dataField:t.dataField,dataType:t.dataType,_visible:t._visible};const e=t.stateProps;for(let o in t)if(!o.startsWith("_")&&e.indexOf(o)>=0)if("editor"===o){t._state[o]={};for(let e in t[o])"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state[o][e]=t[o][e])}else"groups"===o?t[o]&&t[o].length>0&&(t._state[o]=t[o]):"filter"===o?t[o]&&"string"!=typeof t[o]&&(t._state[o]=t[o].toString()):t._state[o]=t[o]}return t._state}setProperty(t,e,o=!0){const l=this,n=l.getProperty(t);n!==e&&(l.canNotify=!1,l[t]=e,o&&(l.propertyChanged(t,n,e),l.grid&&l.grid.onColumnChange&&l.stateProps.indexOf(t)>=0&&l.grid.onColumnChange(l,t,n,e)),l.canNotify=!0)}getProperty(t){const e=this;if("selected"===t){let o=!1;return e.grid&&(e.grid._selection.cells["column"+e.dataField]&&(o=null),e.grid&&e.grid._selection.columns[e.dataField]&&(o=!0),e.grid.columns.canNotify=!1,e[t]!==o&&(e[t]=o),e.grid.columns.canNotify=!0),o}return"group"===t?!(!e.dataSource||!e.dataSource.groupBy)&&e.dataSource.groupBy.indexOf(e.dataField)>=0:e[t]}get properties(){return["allowExport","allowCollapse","dataSet","options","allowTypeChange","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","canNotify","data","disabledDialogOptions","description","grid","icon","menuItems","menu","summary","cellsFormat","className","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","element","level","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","formula","AIQuery","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","rowSpan","showDescriptionButton","statusColumn","treeColumn","computedWidth","computedHeight","overflowWidth","parent","showCardLabel","cardSpan","tooltip","tooltipRenderer","cardHeight","relationId","relationField","relationCascadingFields","getFilterPanel","getCellValue","updateFilterPanel","children","value","thHierarchy","valueField","onAction","left","top","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules","parentDataField","cascadingDataField","computedFields","allowItemsAdd","dots","placeholder","detailColumns","collapsed"]}propertyChanged(t,e,o){const l=this;if(l.data&&void 0!==l.data[t]&&(l.data[t]=o),l._state||(l._state={label:l.label,dataField:l.dataField,dataType:l.dataType,_visible:l._visible}),l._state&&o!==e&&l.dataField&&!l.dataField.startsWith("_"))if("editor"===t){l._state[t]={};for(let e in o)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(l._state[t][e]=o[e])}else"filter"===t?l[t]&&"string"!=typeof o?l._state[t]=o.toString():l._state[t]=o:"sortOrder"===t?("asc"!==o&&"desc"!==o&&null!==o&&"ascending"!==o&&"descending"!==o&&(o=null),l.stateProps.indexOf(t)>=0&&(l._state[t]=o)):l.stateProps.indexOf(t)>=0&&(l._state[t]=o);if("formula"!==t)if("highlight"!==t)if("className"!==t)if("editor"!==t)if("allowSort"!==t&&"allowFilter"!==t)if("showIcon"!==t){if("visible"===t){const t=l.grid.grouping.enabled;return l.grid.refresh(t),void(t&&l.grid._filters&&l.grid.refreshFilters(t))}if("showCustomButton"===t&&(o?l.element._showCustomButton():l.element._hideCustomButton()),"showDescriptionButton"===t)return o?l.element._showDescriptionButton():l.element._hideDescriptionButton(),void l.refresh();if("description"!==t){if("filter"===t&&(l.filter?l.filter&&Array.isArray(l.filter)&&0===l.filter.length?(l.filter=null,l.filtered=!1,l.grid.removeFilter(l.dataField)):(l.grid.addFilter(l.dataField,l.filter),l.filtered=!0):(l.grid.removeFilter(l.dataField),l.filtered=!1),(l.autoShowFilterButton||l.showFilterButton)&&(o?l.element._showFilterButton():l.element._hideFilterButton()),l.grid.autoSaveState()),"sortIndex"===t)return-1===l.sortIndex&&(l.sortIndex=null),"many"===l.grid.sorting.mode&&l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),null!==l.sortIndex&&-1!==l.sortIndex?l.element.setAttribute("sort-index",l.sortIndex):l.element.removeAttribute("sort-index"),void l.element._updateSortOrder();if("selected"===t){if(!1===l.allowSelect)return;l.selectionColumn&&l.refresh(),o?l.grid._selection.columns[l.dataField]||(l.grid._selection.columns[l.dataField]=!0):!1===o&&l.grid._selection.columns[l.dataField]&&delete l.grid._selection.columns[l.dataField],l.grid._recycle(!1)}if("formatSettings"===t&&l.grid._recycle(!1),"sortOrder"===t)return l.sorted=!1,null===o?l.element._hideSortButton():(l.element._showSortButton(),l.sorted=!0),"asc"!==l.sortOrder&&"desc"!==l.sortOrder&&null!==l.sortOrder&&"ascending"!==l.sortOrder&&"descending"!==l.sortOrder&&(l.sortOrder=null),l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),void(l.sorted?l.element.setAttribute("aria-sort","asc"===l.sortOrder?"ascending":"descenting"):(l.element.removeAttribute("aria-sort"),l.element.removeAttribute("sort-index")));if("group"!==t){if("showActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._showActionButton():l.element._hideActionButton(),l.element.allowAnimations=!0),"autoShowActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._hideActionButton():l.element._showActionButton(),l.element.allowAnimations=!0),"showFilterButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowFilterButton&&(l._autoShowFilterButton=l.autoShowFilterButton),o?(l.autoShowFilterButton=!1,l.element._showFilterButton()):(l.element._hideFilterButton(),l.autoShowFilterButton=l._autoShowFilterButton),l.element.allowAnimations=!0),"showSortButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowSortButton&&(l._autoShowSortButton=l.autoShowSortButton),o?(l.autoShowSortButton=!1,l.element._showSortButton()):(l.element._hideSortButton(),l.autoShowSortButton=l._autoShowSortButton),l.element.allowAnimations=!0),"autoShowSortButton"===t&&(l.element.allowAnimations=!1,l._autoShowSortButton=l.autoShowSortButton,o?l.element._hideSortButton():l.element._showSortButton(),l.element.allowAnimations=!0),"menu"===t&&(o?l.element.setAttribute("aria-controls",l.menu.id):(l.element.removeAttribute("aria-controls"),l.autoShowActionButton&&l.element._hideActionButton())),"cellsFormat"!==t&&"formatSettings"!==t&&"dataField"!==t&&"displayField"!==t&&"template"!==t||l.grid._recycle(),"label"!==t&&"labelTemplate"!==t&&"width"!==t&&"minWidth"!==t||l.grid.refresh(),"freeze"===t){if(!l.allowFreeze)return;const t=l.grid,e=()=>{const e=t.context;t.context=t,t._renderColumns(),!1===o&&t._initializeRowElements(),t.refresh(),t.context=e};if(t.columnGroups&&t.columnGroups.length>0&&l.columnGroup)return void e();e()}}else l.grid.context===document&&(o?l.grid.addGroup(l.dataField):l.grid.removeGroup(l.dataField))}else l.refresh()}else l.refresh();else l.refresh();else l._editorId="_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);else l.refresh();else this.refresh();else l.grid&&l.grid._initFormulaParser()}_measureSize(t){const e=this.grid,o=function(){const o=[],l=document.createElement("div"),n=document.createElement("div"),i=Array.isArray(t)?t:[t];n.classList.add("smart-label"),l.appendChild(n),l.style.width="auto",l.style.position="static",e.$.columnHeader.appendChild(l);for(let t=0;t<i.length;t++){n.innerHTML="<span>"+i[t]+"</span>";const e=20+n.firstChild.offsetWidth,l=Math.max(30,e);o.push(l)}return e.$.columnHeader.removeChild(l),o}();return 1===o.length?o[0]:o}_autoSize(t){const e=this,o=e.grid;let l=e.label.toString();if(!t){const t=o.isInitialized?o._recyclingRows:[];for(let o=0;o<t.length;o++){const n=t[o],i=""+n.data[e.dataField];if("image"===e.template)break;i&&i.length>l.length&&(l=i),"date"===e.dataType&&i&&e.cellsFormat&&n.data[e.dataField]&&(l=new Smart.Utilities.DateTime(n.data[e.dataField]).toString(e.cellsFormat))}}const n=e._measureSize(l);return e.showIcon?n+20:n}autoSize(t){const e=this._autoSize(t);this.width=e}createElement(){const t=this,e=document.createElement("smart-grid-column");return e._initialize(t),e.setAttribute("role","columnheader"),e.setAttribute("aria-haspopup",""),t.element=e,t.grid.notify((function(e,o,l){switch(e){case"appearance_allowColumnLabelAnimation":t.setProperty("allowLabelAnimation",l);break;case"appearance_allowColumnSortAnimation":t.setProperty("allowSortAnimation",l);break;case"appearance_allowColumnSortButtonAnimation":t.setProperty("allowSortButtonAnimation",l);break;case"appearance_allowColumnActionButtonAnimation":t.setProperty("allowActionButtonAnimation",l);break;case"appearance_allowColumnFilterButtonAnimation":t.setProperty("allowFilterButtonAnimation",l);break;case"appearance_autoShowColumnActionButton":t.setProperty("autoShowActionButton",l);break;case"appearance_autoShowColumnSortButton":t.setProperty("autoShowSortButton",l);break;case"appearance_autoShowColumnFilterButton":t.setProperty("autoShowFilterButton",l);break;case"appearance_showColumnActionButton":t.setProperty("showActionButton",l);break;case"appearance_showColumnFilterButton":t.setProperty("showFilterButton",l);break;case"appearance_showColumnCustomButton":t.setProperty("showCustomButton",l);break;case"appearance_showColumnDescriptionButton":t.setProperty("showDescriptionButton",l);break;case"appearance_showColumnSortButton":t.setProperty("showSortButton",l);break;case"appearance_showFrozenColumnBackground":case"appearance_showSortColumnBackground":case"appearance_showFilterColumnBackground":t.grid._recycle(!1)}})),e}}),Smart("smart-grid-column",class extends Smart.BaseElement{_showSortButton(t){const e=this;e.column&&(e.column.autoGenerated||(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.column&&e.column.grid&&!1===e.column.grid.sorting.maintainSort?e.sortButton.removeAttribute("order"):(e.column.autoShowSortButton||e.column.allowSort&&e.sortButton.classList.add("smart-icon-sort","smart-grid-icon"),"asc"===e.column.sortOrder?e.sortButton.classList.add("asc"):"desc"===e.column.sortOrder&&e.sortButton.classList.add("desc"),e.column.showSortButton&&(e.sortButton.classList.add("show"),!1!==t&&e._refresh()),null!==e.column.sortIndex?e.sortButton.setAttribute("order",1+e.column.sortIndex):e.sortButton.removeAttribute("order"))))}_updateSortOrder(){const t=this;if(!t.column)return t.removeAttribute("sort-index"),void t.sortButton.removeAttribute("order");null!==t.column.sortIndex?(t.setAttribute("sort-index",t.column.sortIndex),t.sortButton.setAttribute("order",1+t.column.sortIndex)):(t.removeAttribute("sort-index"),t.sortButton.removeAttribute("order"))}_hideSortButton(t){const e=this;e.column&&(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.sortButton.removeAttribute("order"),e.column.showSortButton&&!e.column.autoShowSortButton||(e.sortButton.classList.remove("show"),e.sortButton.classList.remove("smart-icon-sort"),!1!==t&&e._refresh()))}_showFilterButton(t){const e=this;e.column&&!e.column.autoGenerated&&(e.filterButton.classList.add("show"),e._isInitialized&&!1!==t&&e._refresh())}_hideFilterButton(t){const e=this;e.column&&(e.filterButton.classList.remove("show"),e._isInitialized&&!1!==t&&e._refresh())}_showDescriptionButton(){const t=this;t.column&&!t.column.autoGenerated?t.hasAttribute("columnHeader")||(t.column.description?(t.descriptionButton.setAttribute("title",t.column.description),t.descriptionButton.classList.add("show")):t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh()):t.descriptionButton.classList.remove("show")}_hideDescriptionButton(){const t=this;t.column&&(t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh())}_showIcon(){const t=this;t.column&&!t.column.autoGenerated&&(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon",""),t._isInitialized&&t._refresh())}_hideIcon(){const t=this;t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon"),t._refresh()}_showCustomButton(){const t=this;t.column&&!t.column.autoGenerated&&(t.customButton.classList.add("show"),t._refresh())}_hideCustomButton(){const t=this;t.column&&(t.customButton.classList.remove("show"),t._refresh())}_showActionButton(){const t=this;t.column&&t.column.showActionButton&&t.column.grid.hasColumnMenu(t.column)&&!t.column.autoGenerated&&t.actionButton&&(t.actionButton.classList.add("show"),t._refresh())}_hideActionButton(){const t=this;t.column&&t.column.showActionButton&&t.actionButton&&!t.hasAttribute("aria-controls")&&t.actionButton.classList.contains("show")&&(t.actionButton.classList.remove("show"),t._refresh())}_rotate(){const t=this,e=document.createElement("span");return t.label.innerHTML="",e.innerHTML=t.column.label,t.label.appendChild(e),e.className="rotate",e.style.transform="rotate("+t.column.rotationAngle+"deg)",t.column.grid._recycleRotate(t.label,e,t.column.align,t.column.verticalAlign,t.column.label)}_align(){const t=this;let e=t.column.align;switch(t.column.grid.rightToLeft&&("left"===e?e="right":"right"===e&&(e="left")),e){case"left":t.label.classList.add("align-left");break;case"center":t.label.classList.add("align-center");break;case"right":t.label.classList.add("align-right")}switch(t.column.verticalAlign){case"top":t.label.classList.add("align-top");break;case"middle":t.label.classList.add("align-middle");break;case"bottom":t.label.classList.add("align-bottom")}}_refresh(){const t=this;if(!t.column)return;const e=t.column.grid;if(t.sortButton.classList.remove("filter"),t.sortButton.classList.remove("action"),t.label.className="smart-label",t.label.firstElementChild&&t.column.className&&(t.label.className="smart-label "+t.column.className),t.descriptionButton&&t.descriptionButton.setAttribute("title",t.column.description),!0===t.column.autoGenerated||t.hasAttribute("columnHeader")?t.descriptionButton.classList.remove("show"):t.column.showDescriptionButton&&t.column.description?t.descriptionButton.classList.add("show"):t.descriptionButton.classList.remove("show"),t.column.highlight?t.setAttribute("highlight",""):t.removeAttribute("highlight"),t.column.visible&&"_checkBoxColumn"===t.column.dataField){const e=t.column.grid;let o=e.getVisibleRows();e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode&&(o=o.slice(e.paging.pageIndex*e.paging.pageSize,(e.paging.pageIndex+1)*e.paging.pageSize));const l=e._getSelectedRows(!0,!1);if(e.selection.checkBoxes.autoShow?t.setAttribute("auto-show",""):t.removeAttribute("auto-show"),e._isVirtualMode()){const o=e.dataSource.virtualDataSourceLength;l>0&&l===o?t.setAttribute("selected",""):l>0&&l<o?t.setAttribute("selected","indeterminate"):0!==l&&0!==o||t.removeAttribute("selected")}else l.length>0&&l.length===o.length?t.setAttribute("selected",""):l.length>0&&l.length<o.length?t.setAttribute("selected","indeterminate"):0!==l.length&&0!==o.length||t.removeAttribute("selected");return t.removeAttribute("checkbox"),t.label.classList.remove("smart-input"),void("none"!==e.selection.checkBoxes.selectAllMode&&(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")))}if("_rowHeaderColumn"===this.column.dataField){const e=t.column.grid;if(e.selection.enabled&&e.selection.allowRowHeaderSelection&&e.appearance.showRowHeaderSelectIcon){let o='<div class="smart-grid-command-item">',l=e.areAllRowsSelected()?"smart-icon-check-squared":"smart-icon-check-empty";e.isEmpty()&&(l=""),o+='<span class="smart-grid-icon '+l+'"></span>',o+="</div>",t.label.style.paddingLeft="0px",t.label.style.paddingRight="0px",t.label.innerHTML=o}}if("_commandColumn"===t.column.dataField){const e=t.column.grid,o="icon"!==e.editing.commandColumn.displayMode,l="label"!==e.editing.commandColumn.displayMode,n=e.editing.commandColumn.dataSource.commandColumnMenu;let i='<div class="smart-grid-command-item">';const a="{{messages}}"===n.label?e.localize("commandColumnMenu"):n.label,r=n.icon;l&&o?(i+='<span class="smart-grid-icon '+r+'"></span>',i+='<span class="smart-grid-label">'+a+"</span>"):l&&!o?i+='<span class="smart-grid-icon '+r+'"></span>':o&&!l&&(i+='<span class="smart-grid-label">'+a+"</span>"),i+="</div>",n.visible&&(t.label.innerHTML=i)}const o=t.column.getProperty("selected");if(!1===o&&t.hasAttribute("selected")?t.removeAttribute("selected"):!0===o?t.setAttribute("selected",""):null===o&&t.setAttribute("selected","indeterminate"),t.column.allowSortButtonAnimation?t.sortButton.classList.add("smart-animate"):t.sortButton.classList.remove("smart-animate"),e.dragDrop&&e.dragDrop.column===t.column?t.classList.add("dragged"):t.classList.remove("dragged"),t.column.sorted?t._showSortButton(!1):t._hideSortButton(!1),t.column.sorted?(t.setAttribute("aria-sort","asc"===t.column.sortOrder?"ascending":"descenting"),t._updateSortOrder()):(t.removeAttribute("aria-sort"),t.removeAttribute("sort-index")),(t.column.autoShowFilterButton||t.column.showFilterButton)&&(t.column.filtered?t._showFilterButton(!1):t._hideFilterButton(!1)),t.column.allowFilterButtonAnimation?t.filterButton.classList.add("smart-animate"):t.filterButton.classList.remove("smart-animate"),t.column.allowActionButtonAnimation&&!1!==t.allowAnimations?t.buttonsGroup.classList.add("smart-animate"):t.buttonsGroup.classList.remove("smart-animate"),t.column.allowLabelAnimation&&!1!==t.allowAnimations?t.label.classList.add("smart-animate"):t.label.classList.remove("smart-animate"),t.buttonsGroup.classList.remove("action"),t.actionButton.classList.contains("show")&&t.buttonsGroup.classList.add("action"),t.column.showIcon?(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon","")):(t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon","")),t.icon.classList.contains("show"))if(t.icon.className="smart-grid-icon show column-icon",t.column.icon&&t.column.icon.indexOf(" ")>=0){const e=t.column.icon.trim().split(" ");for(let o=0;o<e.length;o++)t.icon.classList.add(e[o])}else t.icon.classList.add(t.column.icon);let l=t.column.showIcon?1:0;for(let e=0;e<t.buttonsGroup.children.length;e++)t.buttonsGroup.children[e].classList.contains("show")&&l++;switch(l){case 1:t.label.classList.add("one");break;case 2:t.label.classList.add("two");break;case 3:t.label.classList.add("three");break;case 4:t.label.classList.add("four");break;case 5:t.label.classList.add("five");break;case 6:t.label.classList.add("six")}t.classList.remove("smart-visibility-hidden"),t.column.grid._columnGap>0?t.classList.add("smart-grid-column-border"):t.classList.remove("smart-grid-column-border"),t.column.grid.appearance.showColumnHeaderLines?t.classList.remove("smart-grid-vertical-border-collapse"):t.classList.add("smart-grid-vertical-border-collapse"),(!t.column.rotationAngle||t._rotate())&&t._align()}_renderTemplate(){const t=this,e=t.column,o=e.labelTemplate;let l="";if("function"!=typeof o){if(o instanceof HTMLTemplateElement)l=o;else{if("string"!=typeof o||!o.startsWith||!o.startsWith("#"))return void(t.label.innerHTML=o);l=document.querySelector(o)}if(l){let o=l.content.cloneNode(!0).firstElementChild,n=e.label;n=n.toString(),n=n.replace(/'/gi,"\\'"),n=n.replace(/"/gi,'\\"');const i=o.outerHTML.replace(/{{value}}/gi,n).replace(/{{id}}/gi,e.label);t.label.innerHTML=i}}else t.label.innerHTML=o(e.label)}_render(){const t=this,e=t.column.dataField?t.column.dataField:"",o=t.column===t.column.grid._lastVisibleColumn;if(t.column.labelTemplate?t._renderTemplate():t.label.firstChild?t.label.firstChild.textContent!==t.column.label&&(t.column.label.indexOf("&")>=0||"SPAN"!==t.label.firstChild.nodeName?t.label.innerHTML="<span>"+t.column.label+"</span>":t.label.firstChild.textContent=t.column.label):t.label.innerHTML="<span>"+t.column.label+"</span>",t.column.title?t.setAttribute("title",t.column.title):t.removeAttribute("title"),t.column.tooltip&&(t.onmouseenter=e=>{t.column.tooltip&&t.column.grid._createTooltip(e,t.column.tooltip,t,"top")},t.onmouseleave=()=>{t.column.grid._cellTooltip&&(t.column.grid._cellTooltip.style.visibility="hidden")}),t._refresh(),t.column.autoGenerated&&t.setAttribute("auto-generated",""),t.column.autoGenerated||o){if(t.style.width=t.column.computedWidth+"px",t.column.grid.appearance.showRowComments&&t.column.rowHeaderColumn){const e=t.column.grid.rowDetailColumn,o=e?e.width:0;t.style.width=t.column.computedWidth+o+"px",t.style.zIndex=5}}else t.style.width=t.column.computedWidth-t.column.grid._columnGap+"px";if(t.style.height!==t.column.computedHeight+"px"&&(t.style.height=t.column.computedHeight+"px"),t.style.lineHeight!==t.column.computedHeight+"px"&&(t.style.lineHeight=t.column.computedHeight+"px"),t.column.grid.rightToLeft?t.style.right!==t.column.left+"px"&&(t.style.right=t.column.left+"px"):t.style.left!==t.column.left+"px"&&(t.style.left=t.column.left+"px"),t.style.top!==t.column.top+"px"&&(t.style.top=t.column.top+"px"),t.getAttribute("data-field")!==e&&t.setAttribute("data-field",e),t.setAttribute("header",""),t.column.freeze&&t.setAttribute("freeze",""),t.column.level>0&&(t.style.top=t.column.top+"px"),t.column.detailColumns&&t.column.detailColumns.length>0){const e=t.column.grid,o=e=>{e.classList.remove("smart-hidden"),t.column.element.label.appendChild(e),t.column.element.label.style.display="flex",t.column.element.label.style.justifyContent="space-between"};if(t.column._collapseButton&&!t.column._collapseButton.parentNode&&delete t.column._collapseButton,t.column._collapseButton)return void o(t.column._collapseButton);const l={},n=[];for(let o=0;o<t.column.detailColumns.length;o++){const l=e.columnByDataField[t.column.detailColumns[o]];l&&n.push(l)}l.inline=!0,l.columns=n,l.collapsed=t.column.collapsed,l.column=t.column,e._initializeColumnGroupCollapsing(l);const i=l.collapseButton;i&&(l.column._collapseButton=i,o(i),e._detailColumns||(e._detailColumns=[]),e._detailColumns[t.column.dataField]=!0)}else{const e=t.column.grid;e._detailColumns&&!e._detailColumns[t.column.dataField]&&t.label.querySelector(".smart-grid-column-group-collapse-button")&&t.label.querySelector(".smart-grid-column-group-collapse-button").remove()}t.column.headerTemplate&&t.column.headerTemplate(t.label)}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_initialize(t){const e=this;e._isInitialized=!1;const o=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div"),i=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div");e.column=t,e.classList.add("smart-visibility-hidden"),c.classList.add("smart-drag-handle"),s.classList.add("smart-icon","smart-grid-icon"),o.classList.add("smart-label"),l.classList.add("smart-sort-button","smart-grid-icon"),n.classList.add("smart-filter-button","smart-icon-filter","smart-grid-icon"),i.classList.add("smart-action-button","smart-grid-icon"),i.setAttribute("aria-haspopup",""),a.classList.add("smart-description-button","smart-icon-help-circled","smart-grid-icon"),r.classList.add("smart-custom-button",t.customButtonIcon?t.customButtonIcon:"smart-icon-tools","smart-grid-icon"),d.classList.add("smart-buttons-group"),i.innerHTML="<div></div>",e.style.width=e.column.computedWidth+"px",e.appendChild(c),e.appendChild(s),e.appendChild(o),e.appendChild(d),d.appendChild(l),d.appendChild(n),d.appendChild(a),d.appendChild(r),d.appendChild(i),e.handle=c,e.icon=s,e.label=o,e.sortButton=l,e.filterButton=n,e.actionButton=i,e.descriptionButton=a,e.customButton=r,e.buttonsGroup=d,e._properties=[];const u=window.PointerEvent?"pointerdown":"mousedown",m=window.PointerEvent?"pointerup":"mouseup";e._filterDownEvent=function(t){"col-resize"!==t.target.style.cursor&&(t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t))}.bind(e),e._filterUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionDownEvent=function(t){t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t)}.bind(e),e.filterButton.addEventListener(u,e._filterDownEvent),e.filterButton.addEventListener(m,e._filterUpEvent),e.actionButton.addEventListener(m,e._actionUpEvent),e.actionButton.addEventListener(u,e._actionDownEvent),!e.column.autoShowActionButton&&e.column.showActionButton&&e._showActionButton(),!e.column.autoShowSortButton&&e.column.showSortButton&&e._showSortButton(),!e.column.autoShowFilterButton&&e.column.showFilterButton&&e._showFilterButton(),e.column.showDescriptionButton&&e._showDescriptionButton(),e.column.showCustomButton&&e._showCustomButton(),e.column.showIcon&&e._showIcon(),"_rowHeaderColumn"===e.column.dataField&&e.classList.add("top-near-corner"),e.customButton.onclick=function(t){e.column.onCustomButtonClick&&e.column.onCustomButtonClick(t)}.bind(e),e.column.sorted||e.column.sortOrder?(e.column.sorted=!0,e.setAttribute("aria-sort","asc"===e.column.sortOrder?"ascending":"descenting"),e._updateSortOrder()):(e.removeAttribute("aria-sort"),e.removeAttribute("sort-index")),e._properties=[],e._isInitialized=!0}template(){return""}_detach(){const t=this,e=window.PointerEvent?"pointerdown":"mousedown",o=window.PointerEvent?"pointerup":"mouseup";t.filterButton.removeEventListener(e,t._filterDownEven),t.filterButton.removeEventListener(o,t._filterUpEvent),t.actionButton.removeEventListener(o,t._actionUpEvent),t.actionButton.removeEventListener(e,t._actionDownEvent),t.element=null,t.column&&(t.column.grid=null,t.column.element=null),t.icon=null,t.label=null,t.sortButton=null,t.filterButton=null,t.actionButton=null,t.descriptionButton=null,t.customButton=null,t.buttonsGroup=null,t.column=null,delete t.grid,delete t.column,delete t.icon,delete t.label,delete t.sortButton,delete t.filterButton,delete t.actionButton,delete t.descriptionButton,delete t.customButton,delete t.buttonsGroup}onDetached(){this._detach()}});
49
49
  Smart.Utilities.Assign("Grid.Row",class{constructor(e){const t=this;if(e||(e={}),Object.assign(t,e),e){if(void 0===t.data){const i={$:{}};if(e.grid&&e.grid.dataSource&&e.grid.dataSource.dataFields){const t=e.grid.dataSource;for(let e=0;e<t.dataFields.length;e++)i[(t.dataFields?t.dataFields[e]:{}).name]=""}else Object.assign(i,e);e.id&&(i.$.id=e.id),t.data=i}if((void 0===e.$||e.$&&void 0===e.$.id)&&(e.data?(e.data.$&&e.data.$.id&&(t.id=e.data.$.id),t.id||(t.id=e.index)):void 0===t.id&&(t.id=e.index),void 0===t.id&&(t.id=Smart.Utilities.Core.createGUID())),void 0===t.detailHeight&&(t.grid?t.detailHeight=t.grid.rowDetail.height:t.detailHeight=200),void 0===t.height&&t.grid&&(t.height=t.grid.layout.rowMinHeight,t.grid.__autoRowHeight&&(t.height=t.grid.__autoRowHeight),t.grid.layout.rowHeight&&(t.height=t.grid.layout.rowHeight)),void 0===t.cellHeight&&(t.cellHeight=t.height),void 0===t.showDetail&&(t.showDetail=!1),void 0===t.index&&(t.index=-1),void 0===t.visibleIndex&&(t.visibleIndex=-1),void 0===t.freeze&&(t.freeze=!1),void 0===t.height&&(t.height=null),void 0===t.minHeight&&(t.minHeight=25,t.grid&&(t.minHeight=t.grid.layout.rowMinHeight)),void 0===t.checked&&(t.checked=!1),void 0===t.selected?(t.selected=!1,(t.grid&&t.grid._selection.rows[t.id]||t.grid&&t.grid._selection.indexes[t.index])&&(t.selected=!0)):t.selected&&t.grid&&(t.grid._selection.rows[t.id]=!0,t.grid._selection.indexes[t.index]=t.index),void 0===t.enabled&&(t.enabled=!0),void 0===t.visible&&(t.visible=!0),void 0===t.allowCheck&&(t.allowCheck=!0),void 0===t.filtered&&(t.filtered=!0),void 0===t.allowResize&&(t.allowResize=!0),void 0===t.allowReorder&&(t.allowReorder=!0),void 0===t.allowToggle&&(t.allowToggle=!0),void 0===t.allowSelect&&(t.allowSelect=!0),void 0===t.starred&&(t.starred=!1),void 0===t.expanded&&(e.data&&void 0!==e.data.expanded?t.expanded=e.data.expanded:t.expanded=!1),t._addStyle(),t.headerCell=null,t._cells=[],t.name="",t.comments=[],!t.autoGenerated&&999999!==t.index){if(t.data){if(t.data.comments)if("string"==typeof t.data.comments&&t.data.comments.indexOf("[{")>=0&&t.data.comments.indexOf("}]")>=0)try{t.data.comments=JSON.parse(t.data.comments.replaceAll("\t"," ").replaceAll("\\"," ")).replace(/\p{Emoji}/gu,(e=>"&#"+e.codePointAt(0)+";"))}catch(e){t.data.comments=[]}else"string"==typeof t.data.comments&&t.data.comments.indexOf("[{")>=0&&-1===t.data.comments.indexOf("}]")||"string"==typeof t.data.comments&&"[]"===t.data.comments?t.data.comments=[]:t.comments=JSON.parse(JSON.stringify(t.data.comments));if(t.data.rowStyle&&(t.style=t._style=e.rowStyle),t.data.history&&(t.history=t.data.history),t.data.style&&(t.style=t._style=t.data.style,t.grid&&(t.grid._cellStyles||(t.grid._cellStyles=[]),t.grid._cellStyles["row"+t.id]=!0,t.grid._cellStyles.length++)),t.data.settings){const e=JSON.parse(t.data.settings);void 0!==e.starred&&(t.starred=e.starred),void 0!==e.height&&(t.height=t.cellHeight=e.height)}const e=t.data.$?t.data.$:t.data;if(e.history&&(t.history=e.history),"string"==typeof t.history&&t.history.indexOf("[{")>=0&&t.history.indexOf("}]")>=0)try{t.history=JSON.parse(t.history.replaceAll("\t"," ").replaceAll("\\"," ")).replace(/\p{Emoji}/gu,(e=>"&#"+e.codePointAt(0)+";"))}catch(e){t.history=[]}t.history&&t.history.length&&(e.createdDate||(e.createdDate=t.history[0].date),e.createdBy||(e.createdBy=t.history[0].user),e.updatedDate||(e.updatedDate=t.history[t.history.length-1].date),e.updatedBy||(e.updatedBy=t.history[t.history.length-1].user)),e.style&&(t.style=t._style=e.style),e.height&&(t.height=t.cellHeight=e.height),e.comments&&(t.comments=e.comments),e.starred&&(t.starred=e.starred),e.createdDate&&(t.createdDate=e.createdDate),e.createdBy&&(t.createdBy=e.createdBy),e.updatedDate&&(t.updatedDate=e.updatedDate),e.updatedBy&&(t.updatedBy=e.updatedBy)}t.grid&&t.grid._currentUser&&t.grid._currentUser.info&&(void 0===t.createdBy?(t.createdBy=t.grid._currentUser.info.id,t.createdDate||(t.createdDate=new Date)):t.createdDate||(t.createdDate=new Date),t.history||(t.history=[],t.addHistory({action:"created",user:t.grid._currentUser.info.id,details:{value:t.name},date:t.createdDate})))}}}_addStyle(){this.style=this._style={background:"",color:"",status:"",fontSize:"",fontFamily:"",fontWeight:"",textDecoration:"",fontStyle:""}}setStyle(e){const t=this;t._style||t._addStyle(),["background","color","fontSize","status","fontFamily","fontWeight","textDecoration","fontStyle"].forEach((i=>{e[i]&&(t._style[i]=e[i])})),t.grid&&(t._style._changed=!0,t.grid._recycle(!1))}get properties(){return["allowToggle","allowResize","allowSelect","allowReorder","allowCheck","createdDate","updatedDate","createdBy","updatedBy","canNotify","children","starred","checked","cells","detailHeight","detailTemplate","cellHeight","expandHeight","data","enabled","expanded","filtered","freeze","grid","headerCell","height","index","id","minHeight","unbound","name","selected","showDetail","visible","parent","leaf","visibleIndex","history","comments","style"]}createElement(){const e=document.createElement("smart-grid-row");return this.element=e,e.setAttribute("role","row"),e._initialize(this),e}_autoSize(e){const t=this,i=t.grid;if(!i)return;let l=i.layout.rowMinHeight;void 0!==t.minHeight&&(l=t.minHeight);const a=t.element;if(e||(e=t),e&&(t.data=e.data),!a)return t.height;i.__autoHeightRows||(i.__autoHeightRows=[]);const r=(e,t,a)=>{if(!a||!t||t.autoGenerated)return 0;i.__autoHeightRows[t.dataField]||(i.__autoHeightRows[t.dataField]=[]);let r=""+e.data[t.dataField];"date"===t.dataType&&e.data[t.dataField]&&(r=""+e.data[t.dataField].toLocaleString());let n=r.length;e._templatesHeight&&e._templatesHeight[t.dataField]&&(n=e._templatesHeight[t.dataField]);const d=i.__autoHeightRows[t.dataField][n],o=d||function(e){a.style.height="auto",t.cellsWrap?a.content.classList.add("wrap"):a.content.classList.add("nowrap");let i=0;if(e&&t)if(t.template){const l=e.canNotify;if(e.canNotify=!1,a.cell.row=e,"function"==typeof t.template)if(a.content.textContent=e.data[t.dataField],e._templatesHeight&&e._templatesHeight[t.dataField])i=e._templatesHeight[t.dataField];else{const i={row:e,column:t,cell:a.cell,oldValue:a.cell.oldValue,value:a.cell.value,template:null,isMeasuring:!0},l=a.innerHTML,r=a.cell.canNotify;a.cell.canNotify=!1,a.cell.template(i),a.cell.canNotify=r,i.template?(a.content.textContent="",a.innerHTML=l):a.content.textContent=e.data[t.dataField]}else a._setTemplate(e.data[t.dataField]||"",t.template,a.content);e.canNotify=l}else if("date"===t.dataType){const i=a.cell.getFormattedValue(e.data[t.dataField],t.cellsFormat);a.content.textContent=i}else a.content.textContent=e.data[t.dataField];let l=a.offsetHeight;return"function"==typeof t.template&&i>0&&(l=i),a.style.height="",a.content.classList.remove("wrap"),a.content.classList.remove("nowrap"),l}(e);l=Math.max(l,o),i.__autoHeightRows[t.dataField][n]=o};for(let t=0;t<i._frozenNearColumns.length;t++)r(e,i._frozenNearColumns[t],a.children[0].children[t]);for(let t=0;t<i._frozenFarColumns.length;t++)r(e,i._frozenFarColumns[t],a.children[2].children[t]);for(let t=0;t<a.children[1].children.length;t++)r(e,i._columnElements[t].column,a.children[1].children[t]);return l}addHistory(e){const t=this;e&&(t.grid.storeHistory?(void 0===t.history&&(t.history=[]),t.history.length===t.grid.storeHistoryItems&&t.history.splice(0,1),Array.isArray(t.history)||(t.history=[]),t.history.push(e)):t.history=[])}clearHistory(){this.history=[]}autoSize(){const e=this,t=e.grid._measureRowElement(e.data),i=e.data?t.row._autoSize(e):e.grid.layout.rowMinHeight;e.height=i,t.remove()}getCell(e){const t=this,i=t.grid;if(!i)return null;if("string"!=typeof e&&"number"!=typeof e||(e=i.columnByDataField[e]),!e)return null;if(t["column_"+e.dataField]){const i=t["column_"+e.dataField];return i.column=e,i}{const l=new Smart.Grid.Cell(t,e,i);return t["column_"+e.dataField]=l,l}}get cells(){const e=this;return e._cells&&e.grid&&e._cells.length===e.grid.columns.length||e.createCells(),e._cells}get viewCells(){const e=this,t=[];for(let i=0;i<e.grid.viewColumns.length;i++){const l=e.grid.viewColumns[i];if(e["column_"+l.dataField]){const i=e["column_"+l.dataField];t.push(i)}else{const i=new Smart.Grid.Cell(e,l,e.grid);e["column_"+l.dataField]=i,t.push(i)}}return e._viewCells=t,t}createCells(){const e=this,t=e.grid;e._cells=[];for(let i=0;i<t.viewColumns.length;i++){const l=t.viewColumns[i];if(!l.autoGenerated)if(e["column_"+l.dataField]){const t=e["column_"+l.dataField];e._cells.push(t)}else{const i=new Smart.Grid.Cell(e,l,t);e["column_"+l.dataField]=i,e._cells.push(i)}}}toggle(e){this.element._handleExpandCollapse(!this.expanded,e)}select(){this.setProperty("selected",!0)}unselect(){this.setProperty("selected",!1)}expand(){this.element&&this.element._handleExpandCollapse(!0)}collapse(){this.element&&this.element._handleExpandCollapse(!1)}render(){const e=this;e.element.row=e,e.element._render()}setProperty(e,t){const i=this,l=i.getProperty(e);i[e]=t,l!==t&&(i.canNotify=!1,i.propertyChanged(e,l,t),i.canNotify=!0)}getProperty(e){const t=this;if("selected"===e&&t.grid){let i=!1;t.grid._selection.cells["row"+t.id]&&(i=null),(t.grid&&t.grid._selection.rows[t.id]||t.grid&&t.grid._selection.indexes[t.index])&&(i=!0),t.grid&&t.grid.dataSource.virtualDataSource&&!t.grid.dataSource.id&&(i=void 0!==t.grid._selection.indexes[t.index]);const l=t.grid.rows.canNotify;return t.grid.rows.canNotify=!1,t[e]=i,t.grid.rows.canNotify=l,i}return t[e]}_updateData(){const e=this;if(e.data&&e.data.$&&(["updatedBy","updatedDate","createdDate","createdBy","starred","comments","history","style","index"].forEach((t=>{void 0!==e.data.$[t]?(e[t]=e.data.$[t],"style"===t&&(e._style=e[t],e._style._changed=!0)):"starred"===t?e[t]=!1:"comments"===t||"history"===t?e[t]=[]:"updatedBy"===t?e[t]=-1:"updatedDate"===t?e[t]=null:"style"===t&&(e._addStyle(),e._style._changed=!0)})),e.grid&&!e.grid.rowDetail.dialog.enabled)){const t=void 0!==e.grid._details[e.index]&&e.grid._details[e.index];e.showDetail=t;const i=e.element?e.element.rowDetail:null;i&&(t?(e.element.style.height=e.cellHeight+e.detailHeight+"px",e.element.setAttribute("show-detail",""),i.classList.remove("smart-hidden"),i.style.height!==e.detailHeight+"px"&&(i.style.height=e.detailHeight+"px"),i.style.lineHeight!==e.detailHeight+"px"&&(i.style.lineHeight=e.detailHeight+"px"),i.style.top!==e.cellHeight+"px"&&(i.style.top=e.cellHeight+"px"),e.height=e.cellHeight+e.detailHeight):(i.classList.add("smart-hidden"),e.element.removeAttribute("show-detail"),e.element.style.height=e.cellHeight+"px",e.element.style.lineHeight=e.cellHeight+"px",e.height=e.cellHeight))}}propertyChanged(e,t,i){const l=this;if("updatedBy"!==e&&"createdBy"!==e&&"userData"!==e&&"starred"!==e&&"style"!==e&&"history"!==e&&"updatedDate"!==e&&"createdDate"!==e&&"comments"!==e){if("showDetail"===e){if(l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled&&(l.height=0),l.grid._details[l.index]=i,l.showDetail)if(l.element){if(l.grid._openRowSettingsDialog&&!l.grid.onRowDetailInit&&l.grid.rowDetail.dialog.enabled)return void(l.grid.editing.dialog.visible||(l._settingsDialogRowId=l.id,l.grid.editing.isEditing&&l.grid.cancelEdit(),l.grid._openRowSettingsDialog(l.id)))}else if(l.createElement(),l.grid._openRowSettingsDialog&&!l.grid.onRowDetailInit&&l.grid.rowDetail.dialog.enabled)return void(l.grid.editing.dialog.visible||(l._settingsDialogRowId=l.id,l.grid._openRowSettingsDialog(l.id)));const e=l.element.rowDetail;if(l.grid.appearance.allowRowDetailToggleAnimation&&!l.grid.rowDetail.dialog.enabled){l.grid._resizeHandling=!1;const t=function(e){const t=l.grid._toggledRow;!t||"transform"!==e.propertyName&&"height"!==e.propertyName||a(t)},a=function(e){e.grid.$.content.style.transition="",e.element.rowDetail.removeEventListener("transitionend",t),e.element.rowDetail.removeEventListener("transitioncancel",t),e.grid._toggledRow=null,e.element.removeAttribute("has-detail"),l.grid._refresh(),setTimeout((()=>{l.grid._resizeHandling=!0}),50)};l.grid._toggledRow=l,e.addEventListener("transitionend",t),e.addEventListener("transitioncancel",t),i?(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.element.toggleDetailButton.classList.remove("smart-animate"),setTimeout((()=>{l.element.toggleDetailButton.classList.add("smart-animate"),l.element.toggleDetailButton.setAttribute("toggled",""),l.element.setAttribute("show-detail","")})),l.element.style.height=l.cellHeight+l.detailHeight+"px",l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)+l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),e.classList.remove("smart-hidden"),e.style.height!==l.detailHeight+"px"&&(e.style.height=l.detailHeight+"px"),e.style.lineHeight!==l.detailHeight+"px"&&(e.style.lineHeight=l.detailHeight+"px"),e.style.top!==l.cellHeight+"px"&&(e.style.top=l.cellHeight+"px")):(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)-l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),setTimeout((()=>{l.element.style.height=l.cellHeight+"px",l.element.removeAttribute("show-detail")})))}else l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled?l.grid._refresh():l.grid._recycle()}if("allowCheck"!==e&&"allowSelect"!==e||l.grid._recycle(),"checked"===e&&(l.grid.checkBoxes.hasThreeStates&&l.grid._hasThreeStates(l,l),l.grid._recycle()),"selected"===e){if(!1===l.allowSelect)return;if(i?(l.grid._selection.rows[l.id]=!0,l.grid._selection.indexes[l.index]=l.index):!1===i&&(void 0!==l.grid._selection.rows[l.id]&&delete l.grid._selection.rows[l.id],void 0!==l.grid._selection.indexes[l.index]&&delete l.grid._selection.indexes[l.index]),!l.element)return;i?l.element.setAttribute("aria-selected",!0):l.element.removeAttribute("aria-selected"),l.grid.onRowSelect&&i?l.grid.onRowSelect(l):l.grid.onRowUnselect&&!i&&l.grid.onRowUnselect(l),l.grid._recycle()}if("visible"===e&&l.grid.refresh(),"expanded"===e&&(l.expandHeight||l.grid.refresh()),"height"===e&&(l.expandHeight||l.cellHeight!==i&&(l.cellHeight=i,l.grid.refresh())),"minHeight"===e&&(l.height=null,l.grid.refresh()),"freeze"===e){if(i||l.grid._frozenRowsById[l.id]&&delete l.grid._frozenRowsById[l.id],!0===i||"near"===i){l.grid._frozenNearRows.push(l),l.grid._frozenRowsById[l.id]=!0;const e=[];l.grid._frozenNearRows.forEach((t=>{if(l.grid._frozenRowsById[t.id])e.push(t);else{const e=t.canNotify;t.canNotify=!1,t.freeze=!1,t.canNotify=e}})),l.grid._frozenNearRows.length!==e.length&&(l.grid._frozenNearRows=e,l.grid.layout.isDirty=!0,l.grid._resetCachedLayout(),l.grid._refreshLayout())}else if("far"===i){l.grid._frozenFarRows.push(l),l.grid._frozenRowsById[l.id]=!0;const e=[];l.grid._frozenFarRows.forEach((t=>{l.grid._frozenRowsById[t.id]&&e.push(t)})),l.grid._frozenNearRows.length!==e.length&&(l.grid.layout.isDirty=!0,l.grid._frozenFarRows=e,l.grid._resetCachedLayout(),l.grid._refreshLayout())}else l.grid._frozenNearRows.splice(l.grid._frozenNearRows.indexOf(l),1),l.grid._frozenFarRows.splice(l.grid._frozenFarRows.indexOf(l),1),delete l.grid._frozenRowsById[l.id];l.grid.refresh()}}else l.data&&l.data.$&&(l.data.$[e]=i,"style"===e&&(l._style=i,l._style._changed=!0))}}),Smart("smart-grid-row",class extends Smart.BaseElement{static get properties(){return{}}get isUtilityElement(){return!0}get hasStyleObserver(){return!1}addThemeClass(){}addDefaultClass(){}_initialize(e){const t=this,i=e.grid,l=i._columnElements,a=i._frozenNearColumns,r=i._frozenFarColumns,n=document.createElement("div"),d=document.createElement("div"),o=document.createElement("div"),s=document.createDocumentFragment(),c=document.createDocumentFragment(),g=document.createDocumentFragment();i.rightToLeft?(d.classList.add("far","smart-grid-cell-container"),n.classList.add("center","smart-grid-cell-container"),o.classList.add("near","smart-grid-cell-container")):(d.classList.add("near","smart-grid-cell-container"),n.classList.add("center","smart-grid-cell-container"),o.classList.add("far","smart-grid-cell-container")),t._properties=[],t.row=e,e.createCells(),t._mouseEnter=function(e){if(!i.isScrolling&&!i.editing.isEditing&&(t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.commandColumn.inline&&!t.commandBar)){const e=document.createElement("div"),l=i._getCommandColumnCommandsTemplate();e.classList.add("smart-grid-command-bar"),e.innerHTML=l,n.appendChild(e),requestAnimationFrame((()=>{e.classList.add("show")})),i._updateCommandColumnCommandsVisibility(e,t.row),e.onmousedown=function(e){const l=e.composedPath();let a=null;for(let e=0;e<l.length;e++)if(l[e].classList.contains("smart-grid-command-item")){a=l[e];break}if(a){const l=a.getAttribute("command");i._applyCommand(l,[t.row]),t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),t.removeAttribute("hover"),e.stopPropagation(),e.preventDefault()}},t.commandBar=e}},t._mouseLeave=function(){i.isScrolling||i.editing.isEditing||(t.row.addNewRow&&i.editing.addNewRow._insertButton&&i.editing.addNewRow._insertButton.classList.remove("show"),t.commandBar&&(t.commandBar.classList.remove("show"),t.commandBar.addEventListener("transitionend",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})),t.commandBar.addEventListener("transitioncancel",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)}))))},t.addEventListener("mouseenter",t._mouseEnter),t.addEventListener("mouseleave",t._mouseLeave),i.editing.enabled&&i.editing.addNewRow.visible&&"row"!==i.editing.addNewRow.displayMode&&!e.summaryRow&&(t.onmousemove=e=>{i.isScrolling||i.editing.isEditing||"grid"!==i.view||i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0||i.editing.enabled&&i.editing.addNewRow.visible&&"row"!==i.editing.addNewRow.displayMode&&(t.row.addNewRow&&i.editing.addNewRow._insertButton&&i.editing.addNewRow._insertButton.classList.remove("show"),i.editing.addNewRow._insertButton&&!t.row.addNewRow&&(e.pageX<i.columns[0].computedWidth+i.offset(i).left?(i.editing.addNewRow._insertButton.classList.add("show"),i.editing.addNewRow._insertButton.style.top=i.offset(t).top-i.offset(i).top+e.target.offsetHeight-i.editing.addNewRow._insertButton.offsetHeight/2+"px",i.editing.addNewRow._insertButton.style.left=i.__frozenNearWidth-i.editing.addNewRow._insertButton.offsetWidth+"px",i.editing.addNewRow._insertButton.row=t.row):i.editing.addNewRow._insertButton.classList.remove("show")))});for(let t=0;t<a.length;t++){const i=a[t],l=e.getCell(i).createElement();c.appendChild(l)}for(let t=0;t<r.length;t++){const i=r[t],l=e.getCell(i).createElement();g.appendChild(l)}for(let i=0;i<l.length;i++){const a=l[i],r=a.column;if(!a.parentNode||!r)break;const n=e.getCell(r).createElement();r&&r._treeColumn&&(t.toggleButton=n.toggleButton),s.appendChild(n)}d.appendChild(c),n.appendChild(s),o.appendChild(g);const h=document.createElement("div");h.classList.add("smart-grid-row-detail","smart-hidden","smart-animate");const m=document.createElement("div");m.classList.add("smart-grid-row-sub-container","smart-hidden");const u=document.createElement("div");u.classList.add("smart-grid-row-card-container","smart-hidden"),t._rowFragment=document.createDocumentFragment(),t._rowFragment.appendChild(d),t._rowFragment.appendChild(n),t._rowFragment.appendChild(o),t._rowFragment.appendChild(h),t._rowFragment.appendChild(m),t._rowFragment.appendChild(u),t.appendChild(t._rowFragment),t.cellsNearContainerElement=t.children[0],t.cellsContainerElement=t.children[1],t.cellsFarContainerElement=t.children[2],t.rowDetail=t.children[3],t.rowContainer=t.children[4],t.rowCardContainer=t.children[5],i.layout.rowHeight&&"auto"!==i.layout.rowHeight&&(e.filterRow?t.style.height=i.layout.rowMinHeight+"px":t.style.height=i.layout.rowHeight+"px"),delete t._rowFragment}get enableShadowDOM(){return!1}_handleExpandCollapse(e,t){const i=this,l=i.row,a=l.grid;if(!l.allowToggle)return null;a._toggledRow=l;let r={row:l,id:l.id};t&&(r.originalEvent=t.originalEvent),a.$.fireEvent(e?"rowExpand":"rowCollapse",r);const n=a.dataSource.virtualDataSourceOnExpand&&e&&!0!==l.data._loaded;if(e?a.dataSource._expandedRowIds[l.data.$.id]=!0:delete a.dataSource._expandedRowIds[l.data.$.id],a.stateSettings.autoSave&&a.saveState(null,["expandedRows"]),!a.appearance.allowRowToggleAnimation||n)a.rows.canNotify=!1,l.expanded=e,a.rows.canNotify=!0,l.data.expanded=e,n?(l.data._loaded=!0,l.element.querySelector("button").setAttribute("load",""),a._virtualDataRequest("expand")):(a._toggledRow=null,a._refresh()),n&&a.appearance.allowRowToggleAnimation&&(i.toggleButton.removeAttribute("toggled"),i.toggleButton.classList.remove("smart-animate"),setTimeout((()=>{i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")}),50));else{const t=function(e){e.height=e.cellHeight,a.$.content.style.transition="",e.element.rowContainer.innerHTML="",e.element.rowContainer.classList.add("smart-hidden"),e.element.rowContainer.removeEventListener("transitionend",r),e.element.rowContainer.removeEventListener("transitioncancel",r),e.element.rowContainer.style.height="",e.element.rowContainer.style.transform="",e.element.rowContainer.style.transition="",e.element.rowContainer.classList.remove("smart-animate"),e.element.toggleButton&&e.element.toggleButton.classList.remove("smart-animate"),a._refresh()},r=function(e){const l=a._toggledRow;i._toggleTimer=null,a._toggledRow=null,!l||"transform"!==e.propertyName&&"height"!==e.propertyName||setTimeout((()=>{t(l)}),50)};if(i._toggleTimer){clearTimeout(i._toggleTimer);const e=a._toggledRow;a._toggledRow=null,t(e)}i._toggleTimer=setTimeout((()=>{const t=function(){!function(){const e=a._toggledRow;a._refresh(),a._refreshRowHierarchy();let t=0;for(let e=0;e<a.rowHierarchy.length;e++){const i=a.rowHierarchy[e];let l=i.parent;for(;l;)l.id===a._toggledRow.id&&(t+=i.height),l=l.parent}const i=a._scrollView.scrollTop,l=a._contentHeight-(e.cellHeight+e.top-i);e.expandHeight=Math.min(l,t),e.height=e.cellHeight+e.expandHeight}(),a._recycle(!1),i.style.overflow="hidden",i.style.height="auto",i.style.lineHeight=l.cellHeight+"px"};e?(l.expanded=!0,t(),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",i.toggleButton&&i.toggleButton.removeAttribute("toggled"),a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),setTimeout((function(){i.toggleButton&&(i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")),i.rowContainer.addEventListener("transitionend",r),i.rowContainer.addEventListener("transitioncancel",r),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)"}))):(t(),l.expanded=!1,i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px",a.$.content.style.transition="",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)",i.toggleButton&&(i.toggleButton.setAttribute("toggled",""),i.toggleButton.classList.add("smart-animate")),setTimeout((function(){i.toggleButton&&i.toggleButton.removeAttribute("toggled",""),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),i.rowContainer.addEventListener("transitionend",r),i.rowContainer.addEventListener("transitioncancel",r),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px"}),0))}),50)}}_renderAddNewRow(){const e=this,t=e.row,i=t.grid,l=t.element,a=new Smart.Grid.Cell(t,i.columns[0],i);t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden");let r=i.editing.addNewRow.label;r.indexOf("{{")>=0&&(r=i.localize("addNewRow")),l.innerHTML="<smart-grid-cell><div>"+r+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),l.firstChild.cell=a,i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px"))}_renderFilterRow(){const e=this,t=e.row,i=t.grid,l=t.element;t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),l.innerHTML="<smart-grid-cell><div>"+i.localize("addNewRow")+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")}_renderEmpty(){this.classList.add("smart-hidden")}_renderCell(e,t,i){if(!t)return void i.classList.add("smart-hidden");let l=e.getCell(t);if(l.element!==i&&(l._styleChanged=!0),e._style&&!t.autoGenerated){const t=l._updating;l._updating=!0,e._style._changed&&(l.color=e._style.color,l.background=e._style.background,l.fontFamily=e._style.fontFamily,l.fontSize=e._style.fontSize,l.fontStyle=e._style.fontStyle,l.textDecoration=e._style.textDecoration,l.fontWeight=e._style.fontWeight);const a=i.firstElementChild,r=e=>a._style&&a._style[e]?a._style[e]:"backgroundColor"===e&&null===l.background&&""===a.style[e]||null===l[e]&&""===a.style[e]?null:a.style[e];r("backgroundColor")===l.background&&r("fontFamily")===l.fontFamily&&r("fontSize")===l.fontSize&&r("fontStyle")===l.fontStyle&&r("textDecoration")===l.textDecoration&&r("fontWeight")===l.fontWeight&&r("color")===l.color||(l._styleChanged=!0),l._updating=t}i.cell!==l&&(i.cell.background===l.background&&i.cell.borderColor===l.borderColor&&i.cell.color===l.color&&i.cell.fontSize===l.fontSize&&i.cell.fontFamily===l.fontFamily&&i.cell.textDecoration===l.textDecoration&&i.cell.fontWeight===l.fontWeight&&i.cell.fontStyle===l.fontStyle||(l._styleChanged=!0)),l.element=i,i.cell=l,t._treeColumn&&l.element.isRendered&&!e.filterRow&&l.element._refresh(),l.render(),t&&(t.rowHeaderColumn||t.rowDetailColumn)&&(e.header=i,i.setAttribute("data-id",e.id))}_alternate(){const e=this,t=e.row,i=t.grid;if("card"===i.view)return void e.removeAttribute("alternation-index");const l=i.appearance.alternationStart,a=i.appearance.alternationEnd>0?i.appearance.alternationEnd:1/0;if(!(i.appearance.alternationCount<=0)&&(e.removeAttribute("alternation-index"),t.visibleIndex>=l&&t.visibleIndex<=a)){const a=(t.visibleIndex-l)%i.appearance.alternationCount;e.setAttribute("alternation-index",a)}}_openRowDetailDialog(e){const t=this,i=t.row.grid,l=t.row;if(!i.rowDetail.dialog.enabled||!l.showDetail)return!1;const a=i._dialogRowDetail||i._createDialog(i.rowDetail.dialog);if(!l.detailTemplate&&!i.rowDetail.template&&i._openRowSettingsDialog&&!i.onRowDetailInit)return void(i.editing.dialog.visible||(t._settingsDialogRowId=l.id,i._openRowSettingsDialog(l.id)));if(i.rowDetail.dialog.visible&&a.row!==l)return void(l.showDetail=!1);const r="{{message}}"===i.rowDetail.dialog.header?i.localize("dialogRowDetailHeader",{value:l.visibleIndex+1}):i.rowDetail.dialog.header;!i.rowDetail.dialog.visible||i.rowDetail.dialog.row!==l||l.showDetail?(a.header.innerHTML=r,a.content.innerHTML="",a.content.style.width="100%",a.content.style.height="100%",a.row=l,a.querySelector(".smart-footer").classList.add("smart-hidden"),i._dialogRowDetail||(a.setAttribute("tabindex",0),a.modal=!0,a.btnConfirm.innerHTML=i.localize("dialogRowDetailButtonConfirm"),a.btnCancel.innerHTML=i.localize("dialogRowDetailButtonCancel"),a.btnCancel.classList.add("smart-hidden"),a.onOpen=function(){i.rowDetail.dialog.visible=!0,i.layout.isDirty=!1},a.onClose=function(){i.rowDetail.dialog.visible=!1,a.row.showDetail=!1},a.btnCancel.onclick=function(){i.layout.isDirty=!1,a.close()},a.btnClose.onclick=function(){i.layout.isDirty=!1,a.close()},a.btnConfirm.onclick=function(){i.layout.isDirty=!1,a.close()},a.onkeydown=function(e){"Escape"===e.key&&(i.layout.isDirty=!1,a.close())},i._dialogRowDetail=a),a.open(),setTimeout((function(){a.focus()}),100),e&&a.content.appendChild(e)):a.close()}_renderDetail(e){const t=this,i=t.row.grid,l=t.row;let a=l.id,r=l.detailTemplate||i.rowDetail.template;if(r.startsWith("#")&&(r=document.querySelector(r)),l._detail&&void 0!==l._detail.rowid&&l._detail.rowid===l.id)return e.firstChild===l._detail||(e.firstChild&&e.removeChild(e.firstChild),e.appendChild(l._detail)),void(i.onRowDetailUpdated&&i.onRowDetailUpdated(l.index,l,e.firstChild));if(r instanceof HTMLTemplateElement){const t=r.content.cloneNode(!0).firstElementChild;a=a.toString(),a=a.replace(/'/gi,"\\'"),a=a.replace(/"/gi,'\\"');let i=t.outerHTML.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id);i.indexOf("{{value=")>=0&&(a?(i=i.substring(0,i.indexOf("{{value="))+a+i.substring(i.indexOf("}")),i=i.replace(/}/gi,""),i=i.replace(/{/gi,"")):(i=i.replace(/{{value=/gi,""),i=i.replace(/}}/gi,""))),i="<div>"+i+"</div>";for(let e in l.data)i=i.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==i&&(e.innerHTML=i)}else{let t="<div>"+r.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id)+"</div>";for(let e in l.data)t=t.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==t&&(e.innerHTML=t)}i.onRowDetailInit&&i.onRowDetailInit(l.index,l,e.firstChild),i.rowDetail.dialog.enabled?i.rowDetail.dialog.visible?t._openRowDetailDialog(e.firstChild):t._openRowDetailDialog(e.firstChild.firstElementChild):(l._detail=e.firstChild,l._detail.rowid=l.id)}_renderCards(){const e=this,t=e.row,i=t.grid,l=e.children[1],a=e.children[0],r=e.children[2];e.classList.remove("smart-hidden"),e.removeAttribute("alternation-index"),a.classList.add("smart-hidden"),r.classList.add("smart-hidden"),l.classList.add("smart-hidden");const n=e.children[5];e.style.height=t.height+"px",e.style.width="100%",e.style.lineHeight="";let d=t.visibleIndex;if(i._cardsPerRow||(i._cardsPerRow=1),-1===d&&!1===i.grouping.enabled)return;if(i.grouping.enabled&&t.data&&t.data.$){let e=i.getViewRows();for(let i=0;i<e.length;i++){const l=e[i];if(t.data===l.data){d=i;break}}}if(-1===d||void 0===d)return;let o=i.getViewRows(),s=d*i._cardsPerRow;if(i.paging.enabled){let e=i.paging.pageSize*i.paging.pageIndex;s=e+(d-e)*i._cardsPerRow,i.dataSource&&i.dataSource.virtualDataSource&&!i.dataSource.virtualDataSourceOnExpand&&"infinite"!==i.scrolling&&(s=(d-e)*i._cardsPerRow)}if(n.classList.remove("smart-hidden"),n.hasAttribute("row-index")&&i.isScrolling){const e=n.getAttribute("row-index");if(parseInt(e)===d)return}n.setAttribute("row-index",d),n.innerHTML='<div class="smart-card-layout-view">\n <div class="smart-card-container">\n </div>\n </div>\n ';const c=n.querySelector(".smart-card-container");let g="";const h=[],m=i._conditionalColors;if(o.length)for(let e=0;e<i._cardsPerRow;e++){let t=o[s+e];const l=i.editing.enabled?" editable ":"";if(t){let e=t.label?" smart-card-header":"";t.children&&t.children.length&&(e+=" smart-card-tree-header");const i="<div"+l+' row-id="'+t.id+'" class="smart-card'+e+'"><div class="smart-card-data-container">';if(m)if("border"===m.decorate){const a=m.colors;a&&a[t.id]?g+="<div"+l+' row-id="'+t.id+'" class="smart-card'+e+'" style="border-left-style: solid; border-radius: 5px; border-left-width: 5px; border-left-color: '+a[t.id].color+';"><div class="smart-card-data-container">':g+=i}else g+=i;else g+=i}else g+="<div"+l+' class="smart-visibility-hidden smart-card"><div class="smart-card-data-container">';if(t){t.label&&(g+=`<div style="height: 100%;" class="smart-card-view-cell" role="row"><div class="smart-hidden smart-card-view-label icon" role="rowheader"></div>\n <div class="smart-card-view-value smart-flex" role="gridcell"><span class="smart-grid-icon show ${t.expanded?"smart-icon-ungroup":"smart-icon-group"}"></span><span>${t.label}</span></div></div>`);let e=!1;for(let l=0;l<i.columns.length;l++){const a=i.columns[l];if(!0!==a.visible)continue;const r=new Smart.Grid.Cell(t,a,i);let n=r.value;a.template&&"function"==typeof a.template||a.formatFunction||"image"===a.template?h.push(r):(r.createElement(),r.render(),r.element.style.width="",r.element.style.left="",r.element.setAttribute("data-field",a.dataField),r.element.setAttribute("row-id",t.id),n=r.element.outerHTML);const d=1===i._cardsPerRow||i.layout.cardVertical||!a.label?"vertical":"";let o=a.showIcon?'<div class="smart-flex"><span class="smart-grid-icon show '+a.icon+'"></span><span>'+a.label+"</span></div>":a.label;a.showCardLabel||(o="");const s=a.cardSpan?"span":"",c=a.cardHeight?"min-height: "+i.layout.cardRowMinHeight*a.cardHeight+"px; height: "+i.layout.cardRowMinHeight*a.cardHeight+"px;":"min-height: "+i.layout.cardRowMinHeight+"px; height: "+i.layout.cardRowMinHeight*a.cardHeight+"px;",m=c?"row-span":"",u=t.data.label?"smart-hidden":"";let w="";if(t.children&&t.children.length&&0===l&&(w=`<span class="smart-grid-icon show ${t.expanded?"smart-icon-group":"smart-icon-ungroup"}"></span>`),(e||w||a.template||i.appearance.cardTitleField)&&a.dataField!==i.appearance.cardTitleField)g+=`<div style="${c}" class="smart-card-view-cell ${m} ${d} ${u} ${s}" row-index="${t.index}" data-field="${a.dataField}" role="row"><div class="smart-card-view-label icon ${a.dataField}" role="rowheader">${o}</div>\n<div class="smart-card-view-value" role="gridcell">${w}${n}</div></div>`;else{e=!0,o="";let l=r.value?"":"smart-quiet";r.value||(n=i.localize("blankSummary")),g+=`<div style="${c}" class="smart-card-view-title smart-card-view-cell ${l} ${m} ${d} ${u} 2" row-index="${t.index}" data-field="${a.dataField}" role="row">\n <div class="smart-card-view-value" role="gridcell">${w}${n}</div></div>`}}}g+="</div></div>"}if(c.innerHTML=g,h.length)for(let e=0;e<h.length;e++){const t=h[e],i=c.querySelector(`[data-field="${t.column.dataField}"][row-index="${t.row.index}"]`);i&&(i.lastElementChild.innerHTML="",t.createElement(),t.render(),t.element.style.width="",t.element.style.left="",i.lastElementChild.appendChild(t.element))}}_render(){let e=this;const t=e.row,i=t.grid;if(!i)return;if("card"===i.view)return void e._renderCards();{e.rowCardContainer&&e.rowCardContainer.classList.add("smart-hidden");const t=e.children[1],i=e.children[0],l=e.children[2];i&&i.classList.remove("smart-hidden"),l&&l.classList.remove("smart-hidden"),t&&t.classList.remove("smart-hidden")}const l=t.getProperty("selected");if(!1===l&&e.hasAttribute("selected")?e.removeAttribute("selected"):!0===l?e.setAttribute("selected",""):null===l&&e.setAttribute("selected","indeterminate"),t.allowSelect||e.setAttribute("selected","none"),e.hasAttribute("unbound")&&e.removeAttribute("unbound"),t.unbound&&e.setAttribute("unbound",""),e.removeAttribute("focus"),i._selection.focusedCell&&i._selection.focusedCell.row&&i._selection.focusedCell.row.id===t.id&&e.setAttribute("focus",""),!i._toggledRow&&e.classList.contains("smart-animate"))return e.classList.remove("smart-animate"),e.rowContainer.innerHTML="",e.rowContainer.classList.add("smart-hidden"),i._refreshLayout(),void i._recycle();if(0===i.columns.length)return void e._renderEmpty();if(t.addNewRow&&!t.inline)return void e._renderAddNewRow();let a=!1;if(t.addNewRow&&t.inline&&(a=!0),i._toggledRow&&(t.id===i._toggledRow.id?e.setAttribute("toggle",""):e.hasAttribute("toggle")&&e.removeAttribute("toggle")),i._toggledRow&&i.appearance.allowRowToggleAnimation){let l=t.parent;if(!i._toggledRow.expanded&&i._toggledRow.id===t.id){const t=e.rowContainer;for(let e=0;e<t.children.length;e++){const l=t.children[e],a=l.getAttribute("data-id"),r=i.rowById[a];l.getAttribute("data-rendered")||(l.setAttribute("data-rendered",!0),r.element=l,r.render())}}for(;l;){if(l.id===i._toggledRow.id){const a=l.element.rowContainer;if(i._toggledRow.expanded){e.classList.add("smart-hidden");let l=t.createElement(i);for(let e=0;e<a.children.length;e++){const i=a.children[e];if(i.getAttribute("data-id")===t.id.toString())return void(l=i)}t.element=l,a.appendChild(l),a.classList.remove("smart-hidden"),l.row=t,e=l}break}l=l.parent}}e._alternate();const r=parseFloat(i.$.columnNearContainer.style.width),n=parseFloat(i.$.columnContainer.style.width),d=parseFloat(i.$.columnFarContainer.style.width),o=e.children[1],s=e.children[0],c=e.children[2];if(i.rightToLeft?(s.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&s.classList.add("vscroll")):(c.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&c.classList.add("vscroll")),e.hasAttribute("group")&&e.removeAttribute("group"),e.hasAttribute("tree")&&e.removeAttribute("tree"),e.hasAttribute("level")&&(e.removeAttribute("level"),e.removeAttribute("aria-level")),e.hasAttribute("leaf")&&e.removeAttribute("leaf"),e.hasAttribute("expanded")&&e.removeAttribute("expanded"),e.hasAttribute("summary")&&e.removeAttribute("summary"),e.hasAttribute("filter")&&e.removeAttribute("filter"),null===t.filtered&&e.setAttribute("filter","indeterminate"),i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&"advanced"===i.grouping.renderMode&&!t.filterRow?(e.setAttribute("level",t.level),t.expanded&&e.setAttribute("expanded",""),void 0!==t.label&&t.level===i.dataSource.groupBy.length-1&&e.setAttribute("leaf",""),void 0!==t.label?e.setAttribute("group",""):e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):i.dataSource.boundHierarchy?(e.setAttribute("level",t.level),t.expanded&&e.setAttribute("expanded",""),t.leaf&&e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):(t.canNotify=!1,t.leaf=!0,t.expanded=!1,t.summaryRow=!1,t.data||(t.data={}),t.data.summaryRow&&(t.summaryRow=!0),t.level=0,e.toggleButton&&e.toggleButton.classList.add("smart-hidden"),t.canNotify=!0),e.setAttribute("data-id",t.id),e.visible=t.visible,e.cellsNearContainerElement.classList.remove("smart-visibility-hidden"),e.cellsContainerElement.classList.remove("smart-visibility-hidden"),e.cellsFarContainerElement.classList.remove("smart-visibility-hidden"),e.removeAttribute("rowspan"),t.filterRow&&e.setAttribute("filter-row",""),t.summaryRow&&e.setAttribute("summary-row",""),t.addNewRow&&(t.cellHeight=t.height=i.layout.rowMinHeight),i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")),i.rightToLeft?(o.style.right!==i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"&&(o.style.right=i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"),i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth<=0&&!i._scrollView.scrollWidth&&(o.style.right=-i.offsetWidth+i._computedColumnsWidth+"px")):o.style.left!==-i._scrollView.scrollLeft+"px"&&(o.style.left=-i._scrollView.scrollLeft+"px"),i.rowDetail.enabled){const l=e.rowDetail;e.removeAttribute("show-detail"),t.showDetail?(l.classList.remove("smart-hidden"),e.setAttribute("show-detail",""),i.rowDetail.dialog.enabled?l.classList.add("smart-hidden"):(l.style.height!==t.detailHeight+"px"&&(l.style.height=t.detailHeight+"px"),l.style.lineHeight!==t.detailHeight+"px"&&(l.style.lineHeight=t.detailHeight+"px"),l.style.top!==t.cellHeight+"px"&&(l.style.top=t.cellHeight+"px")),e._renderDetail(l)):l.classList.add("smart-hidden")}else e.rowDetail&&e.rowDetail.classList.add("smart-hidden");if(s.classList.remove("smart-hidden"),c.classList.remove("smart-hidden"),s.style.width!==r+"px"&&(s.style.width=r+"px"),o.style.width!==n+"px"&&(o.style.width=n+"px"),c.style.width!==d+"px"&&(c.style.width=d+"px"),s.style.height=t.cellHeight+"px",o.style.height=t.cellHeight+"px",c.style.height=t.cellHeight+"px",0===d&&c.classList.add("smart-hidden"),0===r&&s.classList.add("smart-hidden"),r>0&&(parseInt(r),parseInt(i._autoGeneratedColumnsNearWidth)),d>0&&parseInt(d)===parseInt(i._autoGeneratedColumnsFarWidth)&&c.classList.add("border-collapse"),t._classNames="",i.onRowClass){const e=i.onRowClass(t.visibleIndex,t.data,t);if(e){const i=e.trim().split(" ");t._classNames=i}}if(i.rowCSSRules){const e=Object.keys(i.rowCSSRules);let l=[];for(let a=0;a<e.length;a++){let r=e[a];const n={index:t.visibleIndex,data:t.data,row:t,api:i};i.rowCSSRules[r](n)&&l.push(r)}t._classNames=l}for(let l=0;l<i._frozenNearColumns.length;l++){const a=i._frozenNearColumns[l];let r=e.children[0].children[l];if(r||(r=t.getCell(a).createElement(),e.children[0].appendChild(r)),0===l&&e.children[0].children.length>i._frozenNearColumns.length)for(let t=i._frozenNearColumns.length;t<e.children[0].children.length;t++){let i=e.children[0].children[t];i&&i.classList.add("smart-hidden")}!1!==a.visbile&&e._renderCell(t,a,r)}for(let l=0;l<i._frozenFarColumns.length;l++){const a=i._frozenFarColumns[l];let r=e.children[2].children[l];r||(r=t.getCell(a).createElement(),e.children[2].appendChild(r)),!1!==a.visbile&&e._renderCell(t,a,r)}for(let l=0;l<o.children.length;l++)if(!i._columnElements[l+i._frozenNearColumns.length]){let i=e.children[1].children[l];e._renderCell(t,null,i)}if(i.enableColumnsCache){let l=0;for(let t=0;t<i._columnElements.length;t++){let i=e.children[1].children[t];i&&(i.isRendered=!1)}for(let a=0;a<i._columnElements.length;a++){const r=i._columnElements[a],n=r.column;let d=e.children[1].children[l++];for(;d&&d.isRendered;)d=e.children[1].children[l++];if(r.parentNode&&n){if(n&&!r.classList.contains("smart-visibility-hidden"))for(let t=0;t<i._columnElements.length;t++){let i=e.children[1].children[t];if((!i||!i.isRendered)&&i&&i.getAttribute("data-field")===n.dataField){d=i,d.isRendered=!0,l=0;break}}!d&&n&&(r.column||(r.column=n),d=t.getCell(n).createElement(),d.isRendered=!0,e.children[1].appendChild(d)),d.isRendered=!0,d.classList.remove("smart-visibility-hidden"),e._renderCell(t,n,d)}}}else for(let l=0;l<i._columnElements.length;l++){const a=i._columnElements[l],r=a.column;if(!a.parentNode||!r){if(a&&!r){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}else if(r&&a&&a.classList.contains("smart-visibility-hidden")){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}continue}let n=e.children[1].children[l];n||(a.column||(a.column=r),n=t.getCell(r).createElement(),e.children[1].appendChild(n)),a.classList.contains("smart-visibility-hidden")?n.classList.add("smart-visibility-hidden"):(n.classList.remove("smart-visibility-hidden"),e._renderCell(t,r,n))}if(a){let t=e.children[1].children[0];i.isScrolling||(e._cachedCenterRect=null,e._cachedNearReact=null);const l=e._cachedCenterRect||o.getBoundingClientRect(),a=e._cachedNearReact||s.getBoundingClientRect();e._cachedCenterRect=l,e._cachedNearReact=a;for(let e=0;e<s.children.length;e++)s.children[e].classList.add("smart-add-new-row");const r='<div style="width: 100%;" class="smart-grid-icon smart-icon-plus show"></div>';s.children.length>0&&(s.children[0].innerHTML!==r&&(s.children[0].innerHTML=r),s.children[0].style.width="50px",s.children[0].style.zIndex=9);const n=i.editing.addNewColumn.visible?i._addNewColumn.width:0;let d=l.width-a.width-n+6,c=0;if((i.appearance.showRowHeaderNumber||i.appearance.showRowHeader)&&(c+=30),i.rowDetail.enabled&&(c+=20),i._frozenColumnsNearWidth&&(d+=i._frozenColumnsNearWidth),t.style.width=d+"px",t.style.left=i._scrollView.scrollLeft+c+"px",i.selection.enabled){const e=d>=250?i.localize("addNewRowAlt"):i.localize("addNewRowAltSmall");e!==t.content.innerHTML&&(t.content.innerHTML=e),s.children[1]&&(t.content.title=s.children[1].title=i.localize("addNewRow")),i.rightToLeft&&(t.style.left="initial",t.style.right=a.width+"px"),!1===i.appearance.showRowHeader&&(i.rightToLeft?t.content.innerHTML='<span style="margin-right: 35px;"></span>'+i.localize("addNewRowAlt"):t.content.innerHTML='<span style="margin-left: 35px;"></span>'+i.localize("addNewRowAlt"))}else t.content.innerHTML=i.localize("addNewRow");t.classList.add("smart-add-new-row"),t.firstElementChild.classList.add("align-left"),t.firstElementChild.classList.remove("align-right"),i.grouping.enabled&&i.dataSource&&(e.visible=!(i.dataSource.groupBy.length>0))}t&&t._style&&(t._style._changed=!1),e.visible?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")}template(){return""}_detach(){const e=this;e.row.headerCell=null,e.row._cells=[],e.row=null,delete e.row,e.element=null,e.removeEventListener("mouseenter",e._mouseEnter),e.removeEventListener("mouseleave",e._mouseLeave),delete e.element,delete e.grid,delete e._mouseEnter,delete e._mouseLeave,delete e.cellsNearContainerElement,delete e.cellsContainerElement,delete e.cellsFarContainerElement,delete e.rowDetail,delete e.rowContainer}onDetached(){this._detach()}});
50
- (()=>{Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,l.format=null,l.formula=null,e._style){const a=e._style;t.autoGenerated||(l.color=void 0!==a.color?a.color:null,l.background=void 0!==a.background?a.background:null,l.fontFamily=void 0!==a.fontFamily?a.fontFamily:null,l.fontSize=void 0!==a.fontSize?a.fontSize:null,l.fontStyle=void 0!==a.fontStyle?a.fontStyle:null,l.textDecoration=void 0!==a.textDecoration?a.textDecoration:null,l.fontWeight=void 0!==a.fontWeight?a.fontWeight:null),a[t.dataField]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[t.dataField][e]&&(l[e]=a[t.dataField][e],l._styleChanged=!0)}))}if(l.grid&&l.grid.formulas){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(a,i){if("value"===i){const a=l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if(l.grid&&l.grid.formulas&&(l.formula||t.formula)){const a=l.grid._formulaParser;if(a){if(l.grid&&l.grid.formulas&&l._formula!==t.formula){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return a.parse(l.formula.slice(1))}}return a}if("editor"===i||"template"===i)return a[i]||l.column[i];if("focused"===i){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===i)return!0===l.row.getProperty("selected")||(!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField]);if("modifiedValue"===i){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const e=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==e?e:a.value}return a[i]},set:function(e,a,i){const r=this.get(e,a);if(r===i)return!0;if(e[a]=i,"element"===a||"isEditing"===a||"oldValue"===a||"_updating"===a||"notifyFn"===a||a.startsWith("_")||"canNotify"===a)return!0;if("error"===a)return!0;if("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||"formula"===a)return"formula"===a&&(l.formula=l._parseFormula(l.formula)),!0;if("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a){void 0===l.oldValue&&(l.oldValue=r),null==i&&delete l._formula;(()=>{if(l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),void 0===i&&(i=null),null!==i&&void 0!==i.label&&void 0!==i.value)l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value;else if(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i,l.column.displayField!==l.column.dataField&&"object"!=typeof i)if(l.column._dataSource){let e=i;for(let t=0;t<l.column._dataSource.length;t++)if(l.column._dataSource[t].value===i){e=l.column._dataSource[t].label;break}l.row.data[l.column.displayField]=e}else l.row.data[l.column.displayField]=i;const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;if(l.grid.dataSource)if(null!==i&&i.label&&i.value&&l.column.displayField!==l.column.dataField)l.grid._sortedColumns&&l.grid._sortedColumns.length>0?(e[l.column.dataField]=i.value,e[l.column.displayField]=i.label):(l.grid.dataSource.boundSource[t][l.column.dataField]=i.value,l.grid.dataSource.boundSource[t][l.column.displayField]=i.label);else if(i!==l.grid.dataSource.boundSource[t][l.column.dataField])if(l.grid._sortedColumns&&l.grid._sortedColumns.length>0)e[l.column.dataField]=i;else if(l.grid.dataSource.boundHierarchy&&l.grid.dataSource.childrenDataField){const t=(e=>function e(t,a){for(let i=0;i<t.length;i++){const r=t[i];if(r.id===a)return r;if(r[l.grid.dataSource.childrenDataField]&&r[l.grid.dataSource.childrenDataField].length>0){const t=e(r[l.grid.dataSource.childrenDataField],a);if(t)return t}}return null}(l.grid.dataSource.boundSource,e))(e.$.id);t&&(t[l.column.dataField]=i),e[l.column.dataField]=i}else l.grid.dataSource.boundSource[t][l.column.dataField]=i}l.grid.dataSource.boundSource.canNotify=!0,l.grid.onCellValueChanged&&i!==r&&l.grid.onCellValueChanged({id:l.row.id,dataField:l.column.dataField,value:i,oldValue:r})})()}return"selected"===a?(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0),l.grid._recycle(!1,!0,!1),l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0):!(!l._updating&&l.canNotify)||(l.grid._recycle(),!l.row.canNotify||(l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0))}})}_parseFormula(e){const t=this.row;if(!e)return e;return"string"!=typeof e&&(e=""+e),!1===e.startsWith("=")&&(e="="+e),e=function(e,t){return e.replace(/COL\(([^)]+)\)/g,((e,l)=>`${l}${t}`))}(e,1+t.index)}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const r=a[e];l+=`${r}: ${i};`},r=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<r.length;e++)i(r[e]);e.getAttribute("style")!==l&&(""===l?e.removeAttribute("style"):e.setAttribute("style",l)),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.grid&&!t.grid.appearance.showSelectionOnTop||t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(l.column.placeholder&&e===l.column.placeholder)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("any"===l.column.dataType||"string"===l.column.dataType&&t&&t.length){let a=!1;const i=""+e;if((i.indexOf("/")>=0||i.indexOf("-")>=0||i.indexOf(":")>=0)&&(t.indexOf("d")>=0&&t.indexOf("M")>=0&&(a=!0),(t.indexOf("d")>=0||t.indexOf("M")>=0||t.indexOf("y")>=0||t.indexOf("h")>=0||t.indexOf("H")>=0||t.indexOf("m")>=0)&&(a=!0)),a){let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{"string"==typeof e&&(e=parseFloat(e));let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat){return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e)}!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const a=t.NumberFormat&&void 0!==t.NumberFormat.maximumFractionDigits?t.NumberFormat.maximumFractionDigits:2,i=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:a,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+i.replace("-","")+")":i}if(l.column.formatSettings.Intl.NumberFormat.locale){return new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,t.NumberFormat).format(e)}{const a=new Intl.NumberFormat(this.grid.locale,t.NumberFormat).format(e);if("percent"===l.column.formatSettings.Intl.NumberFormat.style){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits?l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits:2;return new Intl.NumberFormat(this.grid.locale,{style:"decimal",minimumFractionDigits:t}).format(100*e)+" %"}return"squaremeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m²":"cubicmeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m³":a}}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const r=i.formatNumber(e,t);return void 0===r?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+r+")":r}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let r=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(r=r.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let n=0;n<i._cellsMerge.length;n++){const s=i._cellsMerge[n];let o=[],d=[];if(o.push(s.row),s.rowspan>1){const e=r.indexOf(s.row);if(e>=0)for(let t=e;t<e+s.rowSpan;t++)r[t]&&-1===o.indexOf(r[t])&&o.push(r[t])}if(d.push(s.column.dataField),s.colspan>1){const e=i.columns.indexOf(i.columnByDataField[s.column.dataField]);for(let t=e;t<e+s.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(o.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:s.row.getCell(s.column.dataField),rows:o,columns:d,row:s.row,column:s.column,endRow:o[o.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const r=s.row.getCell(s.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=r,r}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div"),o=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=s,e.appendChild(a),e.appendChild(n),n.setAttribute("content",""),a.setAttribute("indent",""),r.setAttribute("label",""),i.setAttribute("toggle-button",""),i.setAttribute("role","presentation"),i.setAttribute("aria-label","Expand/Collapse Row"),s.setAttribute("checkbox",""),s.setAttribute("role","checkbox"),s.setAttribute("aria-checked","false"),s.setAttribute("aria-label","Select Row"),l.setAttribute("has-toggle-button",""),n.appendChild(i),n.appendChild(s),o.classList.add("smart-input"),s.appendChild(o),d.checkBoxes.visible?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),n.appendChild(r),l.content=r}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let r=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(r=!0,e.row.filterRow&&(r=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(r=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(r=!1)),r)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group",""),e.setAttribute("role","gridcell");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let r=a.label;const n=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&n(e,i.children,l))}return l};let s="";if(void 0!==a.label){let o="",d=[];if(t.grouping.summaryRow.visible){let r=[];const s={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;c.length&&(r=n(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[])),s[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([s],r):null;if(m)for(let r=0;r<c.length;r++){const n=c[r];r>0&&(o+=", ");let u=m[l.dataField][n];const p=l.cellsFormat;if(void 0!==u){if(p&&(u=e.cell.getFormattedValue(u,p)),i){const i=t.columnByDataField[a.groupDataField];if(i){s[i.dataField]=c,m[i.dataField]=m[l.dataField],u=m[i.dataField][n];const t=i.cellsFormat;t&&(u=e.cell.getFormattedValue(u,t))}}o+=t.localize(n,{value:u}),m[l.dataField]&&m[l.dataField][n]&&d.push(m[l.dataField][n])}}}if(t.dataSource.virtualDataSourceOnExpand&&(o=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)r="<div header group-advanced><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let n="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e||t.label===e));t&&t.color?(n=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}else if("object"==typeof e&&e&&e instanceof Date){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,"d")}const s=t.editing.addNewRow.visible?'<span add-row class="smart-grid-icon smart-icon-plus-circled show"></span>':"";if(r=`<div style="${n}" header group-advanced><span group>${s}${i}: </span><span value>${e}</span>`,e=""+e,e&&e.indexOf(",")>=0){let t="";r=`<div style="display: flex;" header group-advanced><span group>${s}${i}: </span>`;let a=e.split(",");for(let e=0;e<a.length;e++){let i=a[e].trim();if(l&&l.editor&&l.editor.dataSource){const e=l.editor.dataSource.find((e=>e.value===i||e.label===i));e&&e.color?(n=`--smart-primary: ${e.color}`,e.label&&(i=e.label)):e&&e.label&&(i=e.label),t+=`<span style="${n}" value>${i}</span>`}}r+=t}o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=""+o,r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)r="<div header><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label;if(l.displayField!==l.dataField&&a.data.data&&(e=a.data.data[l.displayField]),"object"==typeof e&&l.cellsFormat){e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)}r="<div header><span group>"+i+": </span><span value>"+e+"</span>",o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("basic"===t.grouping.renderMode){if(r=a.label,l.displayField!==l.dataField&&a.data.data&&(r=a.data.data[l.displayField]),"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}else if("multipleColumns"===t.grouping.renderMode){if(r=a.label,"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),r=o;s=o}let o=e.firstChild;if(t.dataSource.boundHierarchy&&i){o.children.length<=1&&(e.innerHTML="<div></div>",o=e.firstChild,e._createToggleButton(o,e.cell),o=e.firstChild);const n=o.children[0],s=o.children[1].children[0],d=o.children[1].children[1].firstChild,c=o.children[1].children[2];n.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?s.classList.add("smart-visibility-hidden"):(s.classList.remove("smart-visibility-hidden"),a.expanded?s.setAttribute("toggled",""):s.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",n.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';n.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?s.classList.add("smart-hidden"):(s.classList.remove("smart-hidden"),s.style.marginLeft=""),n.innerHTML=m,c.innerHTML=r,i&&t.grouping.formatFunction){const i={row:a,column:l,groupDataField:a.groupDataField,cell:e.cell,value:r,data:a.data,template:null},n=t.grouping.formatFunction(i);n&&(i.value=n),i.value!==r?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:t._unescapeString(r)):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(o.innerHTML=r,l.summary.length&&t.grouping.summaryRow.inline&&r&&e.classList.remove("smart-hidden"));void 0!==a.label&&t.grouping.enabled&&i&&!l._treeColumn&&l.summary.length&&t.grouping.summaryRow.inline&&r&&(t.rightToLeft||e.style.left!==l.left+"px"&&(e.style.left=l.left+"px"),e.removeAttribute("has-toggle-button",""),r=s,o.innerHTML=r);let d="smart-label";e.style.zIndex="";const c=t.editing.addNewColumn.visible&&t._addNewColumn?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l&&(l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),l.summary.length&&t.grouping.summaryRow.inline&&r&&(e.style.width=l.computedWidth+"px",e.style.zIndex=11,e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign));if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),o.className!==d&&(o.className=d),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,data:null,group:{value:r,template:null}},i=l.formatFunction(t);if(i&&(t.group.value=i),t.group.value!==r)if(l._treeColumn){o.children[1].children[2].innerHTML=t.group.value}else o.innerHTML=t.group.value;null!==t.group.template&&(o.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const r=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:r,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:r,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:r,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:r,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:r,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:r,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:r,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:r,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:r,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:r,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]);const n=l._getFilterDataType(a);i="string"===n?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let s="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition||void 0===a._filterInfo.condition)a._filterInfo.condition="",s="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":s="smart-icon-equals";break;case"starts_with":s="smart-icon-starts-with";break;case"ends_with":s="smart-icon-ends-with";break;case"not_equal":s="smart-icon-not-equal";break;case"less_than":s="smart-icon-less-than";break;case"less_than_or_equal":s="smart-icon-less-than-or-equal";break;case"greater_than":s="smart-icon-greater-than";break;case"greater_than_or_equal":s="smart-icon-greater-than-or-equal";break;case"contains":s="smart-icon-contains";break;case"does_not_contain":s="smart-icon-does-not-contain";break;case"range":s="smart-icon-between";break;default:s="smart-icon-search"}let o=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${s} show"></i></div> `;if("string"===n)o+=`<input class="smart-filter-input-value" data-type="${n}" /> `,e.innerHTML=o;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;o+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=o,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)o+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=o,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const i=document.createElement("div");i.classList.add("smart-input"),i.classList.add("smart-grid-check-box-cell-editor"),i.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),i.setAttribute("checked","indeterminate"),a._filterInfo&&a._filterInfo.value?i.setAttribute("checked",""):a._filterInfo&&!1===a._filterInfo.value&&i.removeAttribute("checked"),o=i.outerHTML,e.innerHTML=o,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const d=e.querySelector("input");if(d&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),d.onpaste=function(e){setTimeout((()=>{l._handleFilterCellKeyUp(this.cell,e)}))}.bind(this),d.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),d.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),d.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),d.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=d,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&d&&(d.value=a._filterInfo.value,"date"===a.dataType&&(d.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),e.removeAttribute("disabled"),a.allowFilter||(d.disabled=!0,e.setAttribute("disabled","")),a.filterEditor||"multi"===a.filterMenuMode)if("multi"===a.filterEditor.template||"multi"===a.filterMenuMode){const t=document.createElement("div");t.className="smart-arrow-down",t.style.fontSize="16px",t.style.marginRight="4px",t.style.marginLeft="4px",t.style.alignSelf="center",t.style.cursor="pointer",t.onclick=function(e){l._handleFilterCellExcelIconClick(this.cell)}.bind(this),e.appendChild(t)}else if(a.filterEditor.template){const t=a.filterEditor.template,i=document.createElement("div");if(a.filterTemplate instanceof HTMLTemplateElement)i.appendChild(t.content.cloneNode(!0));else if(t instanceof HTMLElement)i.appendChild(t);else if("checkList"===t){const e=document.createElement("smart-drop-down-list");e.className="smart-filter-check-list",e.selectionMode="checkBox",e.filterable=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownAppendTo="body",e.dropDownButtonPosition="right",e.dataSource=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField),e.whenRendered((()=>{e.checkAll()})),a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember),e.onchange=()=>{const t=this.cell.column;if(e.selectedValues.length===e.dataSource.length)return t._filterInfo.value=null,e.close(),delete t._filterInfo.excelValues,void l.removeFilter(t.dataField);t._filterInfo.excelValues=e.selectedValues,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else if("list"===t||"dropDownList"===t||"select"===t){const e=document.createElement("smart-input");e.className="smart-filter-list",e.readonly=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownButtonPosition="right",a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember);let t=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField);t=[{label:"-",value:null}].concat(t),e.dataSource=t,e.onchange=()=>{this.cell.column._filterInfo.value=e.selectedValue,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else i.innerHTML=t;e.innerHTML="",e.appendChild(i),i.style.height="100%",i.style.width="100%";const r=e.querySelector("input");r&&(r.onfocus=()=>{e.setAttribute("focus","")},r.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,i)}else void 0!==a.filterEditor.min&&(d.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(d.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(d.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(d.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(d.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(d.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(d.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(d.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(t,l,a){const i=this,r=i.cell.grid,n=i.cell.column;r._cellCachedValues||(r._cellCachedValues=[]);const s=()=>!!r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML!==r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML=r._cellCachedValues[n.dataField+"_"+t]),i.cell._setStyle(a),i.setAttribute("template",i.cell.template),!0);let o=null;switch((!r.editing.enabled||!n.allowEdit||i.cell.readonly||"none"===r.editing.action||r.editing.enabled&&r.editing.commandColumn.visible&&r.editing.editRow!==i.cell.row)&&i.setAttribute("readonly",""),n.placeholder&&t===n.placeholder&&(t=""),l){case"checkBox":case"radioButton":case"switchButton":if(a.firstElementChild&&a.firstElementChild.classList&&a.firstElementChild.classList.contains("smart-input")){if(o=a.firstElementChild,t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),o.setAttribute("color","")}return void i.cell._setStyle(a)}if(o=document.createElement("span"),o.className="smart-input",t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color)}a.innerHTML="",a.appendChild(o),i.cell._setStyle(a);break;case"checklist":if(t&&t.indexOf("[")>=0&&(t=JSON.parse(t)),a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&e===t.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t&&Array.isArray(t)&&t.length>0){const e=t.filter((e=>e.completed)).length,l=["#D50000","#F4511E","#F6BF26","#33B679"],a=e+"/"+t.length;let i=l[0];e===t.length?i=l[3]:e>0&&e<t.length&&(i=l[2]),t=`<div style="display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${i}; width:16px; height: 16px;"><span title="${a}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${a}</span></div>`}else t="";o=document.createElement("span"),o.innerHTML=t,i.setAttribute("template",i.cell.template),o.setAttribute("value",t.length);break;case"createdBy":case"updatedBy":{const e=i.cell.row;let t=null,s=null;if(t="createdBy"===l?e.createdBy:e.updatedBy,e.history&&e.history.length&&(t="createdBy"===l?e.history[0].user:e.history[e.history.length-1].user),a.firstElementChild&&a.firstElementChild.hasAttribute("user-id")){if(t===parseInt(a.firstElementChild.getAttribute("user-id")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const l=a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild?a.firstElementChild.firstElementChild.firstElementChild.firstElementChild:null;if(l){a.firstElementChild.setAttribute("user-id",t);const i="string"==typeof e?e:e.name,r="string"==typeof e?null:e.color;if(("string"==typeof e?null:e.image)&&(l.firstElementChild.style.backgroundImage=`url('${e.image}')`),r){const e=new Smart.Color(r).getInvertedColor();l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",r),l.setAttribute("color",e),l.lastElementChild.textContent=i}else l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",""),l.setAttribute("color","");return}}}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id),d.style.width="100%",d.style.paddingRight="6px";let c='<div class="smart-flex smart-flex-auto smart-tokens-layout">';if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,i=document.createElement("span");if(a&&(i.style.backgroundImage=`url('${e.image}')`,i.className="smart-drop-down-list-selection-image"),l){c+='<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+'; overflow: visible;" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c+='<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c=""}d.innerHTML=c+"</div>";const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),o=m,o.setAttribute("user-id",t),i.setAttribute("template",i.cell.template);break}case"collaborator":case"tags":{let e=[];if("number"==typeof t&&(t=""+t),""===t||null===t||"uncategorized"===t){let e=`\n <div class="smart-multi-combo-input-container tokens smart-flex smart-flex-auto" data-field="${n.dataField}" row-id="${i.cell.row.id}"> \n <div class="smart-multi-combo-input" data-field="${n.dataField}" row-id="${i.cell.row.id}" class="tokens smart-flex smart-flex-auto">\n <div class=" smart-flex-auto smart-flex"></div>\n </div>\n </div>\n `;return a.innerHTML!==e&&(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild&&""===a.firstElementChild.firstElementChild.firstElementChild.textContent?(a.firstElementChild.setAttribute("row-id",i.cell.row.id),a.firstElementChild.firstElementChild.setAttribute("row-id",i.cell.row.id)):a.innerHTML=e),n.placeholder&&a.firstElementChild&&a.firstElementChild.firstElementChild&&(a.firstElementChild.firstElementChild.innerHTML=n.placeholder),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;if(null!==t&&(e=Array.isArray(t)?e.map((e=>e.trim())):t.indexOf("{")>=0||"[]"===t?JSON.parse(t):t.split(",").map((e=>e.trim()))),a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&n.editor._items&&n.editor._items[t]){if(a.firstElementChild.getAttribute("value")===t){i.cell._setStyle(a),i.setAttribute("template",i.cell.template);const e=n.editor.dots;if(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild){if(a.firstElementChild.firstElementChild.firstElementChild.classList.remove("smart-flex-wrap"),a.firstElementChild.firstElementChild.firstElementChild.firstElementChild){const t=a.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild;t&&(e?t.classList.add("dots"):t.classList.remove("dots"))}if(i.cell.row.height>45){a.firstElementChild.firstElementChild.firstElementChild.classList.add("smart-flex-wrap");const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1)for(let t=0;t<e.children.length;t++)e.children[t].style.maxWidth&&(e.children[t].style.maxWidth="")}else if(r.layout.rowHeight<=45&&i.cell.row.height<=45){const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1){const t=parseInt(n.computedWidth/e.children.length)-5;let l=0;for(let t=0;t<e.children.length;t++)l+=e.children[t].textContent.length,e.children[t].style.maxWidth="";if(14*l*.52+20*e.children.length>n.computedWidth)for(let l=0;l<e.children.length;l++)e.children[l].style.maxWidth=t+"px"}}}return}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id);let c='<div class="smart-tokens-layout smart-flex smart-flex-auto">';if(e.length>2&&i.cell.row.height>45){c='<div style="max-width: '+(n.computedWidth-10+"px")+'" class="smart-flex smart-flex-wrap">'}let m=0;if(t)for(let t=0;t<e.length;t++){const a=e[t];let i=null;if("collaborator"===l||n.editor&&n.editor.collaborator)i=r.users.find((e=>{if("string"==typeof a||"number"==typeof a){if(e.value===a||parseInt(e.value)===parseInt(a))return e;if(e.id===a||parseInt(e.id)===parseInt(a))return e}else if("object"==typeof a&&e.value===a.value)return e})),i&&(i.label=i.name);else{const e=n.editor.dataSource||n.options;if(e)if("string"==typeof a&&n.editor._items&&n.editor._items[a])i=n.editor._items[a];else{for(let t=0;t<e.length;t++){const l=e[t];if(void 0!==l.value&&void 0!==a&&void 0!==a.value&&l.value===a.value){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}if(void 0===l.value&&l===a||void 0!==l.value&&""+l.value===a){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}}n.editor.allowItemsAdd&&!i&&a&&(i=a)}else i=a}if(!i)continue;const s="string"==typeof i?i:i.label,o="string"==typeof i?null:i.color,d="string"==typeof i?null:i.image;if(""===s)continue;const u=document.createElement("span");d&&(u.style.backgroundImage=`url('${i.image}')`,u.className="smart-drop-down-list-selection-image");const p="smart-truncate";if(o&&n.editor.colorItems){const e=new Smart.Color(o).getInvertedColor(),t=n.editor.dots?" dots":"";c+='<span title="'+s+'" data-item="'+s+'" style="background: '+o+"; color: "+e+"; --smart-primary-color: "+e+'; overflow: visible;" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label"+t+'\' role="presentation">'+s+"</span>"}else c+='<span title="'+s+'" data-item="'+s+'" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>";m+=s.length;if(n.editor.dataSource||n.options){if(n.editor.singleSelect){c+="</span>";break}c+='<span class=\'smart-hidden smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else c+="</span>"}d.innerHTML=c+"</div>";const u=14*m*.52,p=d.firstElementChild;if(r.layout.rowHeight<=45&&i.cell.row.height<=45&&d&&p.children.length>1&&u+20*p.children.length>n.computedWidth){const e=parseInt(n.computedWidth/p.children.length)-5;for(let t=0;t<p.children.length;t++)p.children[t].style.maxWidth=e+"px"}if(d.style.width="100%",d.style.paddingRight="6px",d.onpointerdown=t=>{if(!r._mobile)if(t.target&&"#text"!==t.target.nodeName&&t.target.classList.contains("smart-drop-down-list-unselect-button")){let l=t.target.parentNode.getAttribute("data-item");const a=n.editor.dataSource||n.options;if(a&&"string"==typeof l&&a)for(let e=0;e<a.length;e++)a[e].label===l&&(l=a[e],l.value&&(l=l.value));if(e[0]&&e[0].label){const a=e.map((e=>e.value)).indexOf(l);if(a>=0){e.splice(a,1);const l=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,JSON.stringify(e)),r.onCellUpdate&&r.onCellUpdate([i.cell],[l],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(e.indexOf(l)>=0){e.splice(e.indexOf(l),1);const a=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,s),r.onCellUpdate&&r.onCellUpdate([i.cell],[a],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(t.target.classList.contains("smart-drop-down-list-selection-label")){if(r.editing.enabled&&r.editing.allowListOpenOnContentClick){const e=t.target.closest(".smart-multi-combo-input"),l=e.getAttribute("data-field"),a=e.getAttribute("row-id");r.beginEdit(a,l)}t.stopPropagation(),t.preventDefault()}},!n.cellsWrap&&n.allowEdit&&r.editing.enabled&&"card"!==r.view){let t=n.editor.dataSource&&n.editor.dataSource.length;n.editor.collaborator&&(t=r.users&&r.users.length);const l=document.createElement("div");t&&l.classList.add("items"),l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),l.appendChild(d),o=l}else if(n.cellsWrap||n.allowEdit){const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),t.appendChild(d),o=t}else d.classList.add("smart-flex-auto","smart-flex","tokens"),o=d;i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break}case"dropdownGrid":case"dropDownList":case"dropdownlist":case"list":{const e=document.createElement("div");if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(a.firstElementChild.getAttribute("value")===t&&!i.cell.column._isDirty)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if("dropdownGrid"!==i.cell.template){if(s()){const e=a.querySelector(".smart-arrow-down");return void(e&&(e.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}))}}if("dropdownGrid"===i.cell.template){const l=i.cell.column.templateSettings.dataFields;let a=i.cell.editor.dataSource?i.cell.editor.dataSource[t]:"";if(i.cell.column.relationId&&i.cell.column.relationField&&i.cell.column._isDirty&&(!i.cell.column.editor.dataSource||i.cell.column.editor.dataSource&&0===i.cell.column.editor.dataSource.length)){const e=r._getRelationData(i.cell.column.relationId,i.cell.column.relationField,i.cell.column.relationCascadingFields),l=r._getRelationColumns(i.cell.column.relationId);e&&(a=e[t]),i.cell.column.editor.columns=l,i.cell.column.editor.dataSource=e}if(e.classList.add("smart-flex","center"),e.style.alignItems="center",e.onmouseenter=()=>{e.querySelectorAll("i").forEach((e=>e.classList.add("show")))},e.onmouseleave=()=>{e.querySelectorAll("i").forEach((e=>e.classList.remove("show")))},a){e.style.justifyContent="space-between";let t="";for(let e=0;e<l.length;e++){const i=a[l[e]];i&&(t+='<span style="" class="smart-truncate smart-token smart-flex middle center ">'+i+"</span>")}e.innerHTML=t}else e.style.justifyContent="",e.innerHTML='<span class="smart-truncate"></span>'}else"card"===r.view?e.textContent=t:e.innerHTML='<span class="smart-truncate">'+t+"</span>";if(n.allowEdit&&r.editing.enabled&&"card"!==r.view){const t=document.createElement("span");t.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),e.classList.add("smart-flex-auto","smart-multi-combo-input"),l.appendChild(e),l.appendChild(t),l.classList.add(i.cell.template.toLowerCase()),o=l,t.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}}else o=e;i.setAttribute("template",i.cell.template.toLowerCase()),o.setAttribute("value",t);break}case"password":a.innerHTML=t?'<span class="smart-truncate">'+t.replace(/./g,"*")+"</span>":"",i.setAttribute("template",i.cell.template);break;case"richText":if(a.innerHTML=t?'<div class="textwrap" style="height: 100%; padding-top: 5px; padding-left: 5px;">'+r._unescapeString(t)+"</div>":"",r.layout.autoWrap&&i.cell.row.height>40&&1===i.cell.colSpan&&"string"===n.dataType){null==t&&(t="");if(14*t.length*.52>n.computedWidth){const e=parseInt(i.cell.row.height/20);a.firstElementChild.style["-webkit-line-clamp"]=e}}a.onpointerdown=e=>{if(!r._mobile&&r.editing.enabled){const t=r.offset(a);if(e.pageX>t.left+a.offsetWidth-20){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),i=l.getAttribute("data-id");delete r._beginEditKey,r.beginEdit(i,a)}}},o=a.firstElementChild,i.setAttribute("template",i.cell.template);break;case"color":a.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${t};"></span>`,i.setAttribute("template",i.cell.template);break;case"autoNumber":o=document.createElement("span"),o.innerHTML=1+i.cell.row.visibleIndex,i.setAttribute("template",i.cell.template);break;case"uuid":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}o=document.createElement("span"),o.style.paddingLeft="7px";const e=r._generateUUID(),l=i.cell.canNotify;i.cell.canNotify=!1,t||(i.cell.value=e,r.onCellUpdate&&!r.editing.editRow&&r.onCellUpdate([i.cell],[e],[e],(function(){r.onCellUpdated&&r.onCellUpdated([i.cell.row.index],[i.cell.row],[i.cell.column],[i.cell.row.data],[i.cell.value],[i.cell.value],i)}),i)),o.textContent=i.cell.value,i.cell.canNotify=l,i.setAttribute("template",i.cell.template),o.setAttribute("value",e);break}case"ai":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=(e,t)=>{const l=r.ai.url,a=r.ai.key;e.stopPropagation(),e.preventDefault();const i=e.target.closest("smart-grid-cell"),n=e.target.closest("smart-grid-row"),s=i.getAttribute("data-field"),d=n.getAttribute("data-id");t?(e.target.classList.remove("smart-icon-reload"),e.target.classList.add("smart-grid-loading")):e.target.classList.add("smart-grid-loading");let c=""+r.columnByDataField[s].AIQuery;r.columnByDataField[c]&&(c=""+r.getCellValue(d,c));for(let e=0;e<r.ai.promptVariables.length;e++){const t=r.ai.promptVariables[e],l=r.getCellValue(d,t.dataField)||"",a=new RegExp(`{{${t.name}}}`,"g");c=c.replace(a,l)}c=c.trim(),c=c.replaceAll("\n"," "),c=c.replaceAll("\r"," "),c=c.replaceAll(" "," "),c=c.substring(0,2e3),c&&l&&a?async function(e){e+="\nRespond in less than "+r.ai.maxResponseLength+" words.",e+="\nOutput always in plain text.";const t=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({model:r.ai.model,messages:[{role:"user",content:e}],max_tokens:r.ai.maxTokens,temperature:r.ai.temperature})});if(!t.ok)throw new Error(`Error: ${t.statusText}`);return(await t.json()).choices[0].message.content.trim()}(c).then((e=>{const t=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");r.setCellValue(d,s,t),o.setAttribute("value",t)})).catch((e=>{console.error("Error:",e)})):(r.setCellValue(d,s,r.localize("noResults")),o.setAttribute("value",r.localize("noResults")))};if(t){o=document.createElement("span"),o.style.paddingLeft="7px",o.classList.add("smart-flex");const l=i.cell.canNotify;i.cell.canNotify=!1,o.textContent=i.cell.value,i.cell.canNotify=l;const a=document.createElement("span");o.appendChild(a),a.classList.add("smart-grid-icon","show","smart-icon-reload"),a.style.position="absolute",a.style.right=a.style.top="0px",a.onpointerdown=t=>{e(t,!0)},i.setAttribute("template",i.cell.template),o.setAttribute("value",t)}else o=document.createElement("div"),o.classList.add("smart-flex","center","middle"),o.style.height="100%",o.innerHTML=`<button style="border-radius: 10px; line-height: 13px; height: 30px; padding-inline: 30px; padding-block: 2px;" class="smart-button" type="button">✨︎ ${r.localize("generate")}</button\n `,o.firstElementChild.onpointerdown=t=>{e(t)},i.setAttribute("template",i.cell.template);break}case"createdDate":case"createdTime":{const e=i.cell.row;let t=e.createdDate;if(s())return;e.history&&e.history[0]&&(t=e.history[0].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("created-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span created-date class="align-left smart-truncate">'+l+" "+r+"</span>";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break}case"updatedDate":case"updatedTime":if(s())return;if(i.cell.row.updatedDate){const e=i.cell.row;let t=e.updatedDate;e.history&&(t=e.history[e.history.length-1].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("updated-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span updated-date class="align-left smart-truncate">'+l+" "+r+"</span>"}else a.innerHTML="";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break;case"progress":{const e=t?parseInt(100*t)+"%":"0%";if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const l="white",r=["#D50000","#F4511E","#F6BF26","#33B679"];let s=r[0];if(s=t<.25?r[0]:t<.5?r[1]:t<.75?r[2]:r[3],n.templateSettings){if(n.templateSettings.getComputedValue){const e=n.templateSettings.getComputedValue(i.cell.row.data,i.cell.row,i.cell.column,t);t=e}if(n.templateSettings.conditions){for(let e=0;e<n.templateSettings.conditions.length;e++){const l=n.templateSettings.conditions[e];null!==l.value&&t>=l.value&&(s=l.color)}let l=0,r=1;void 0!==n.templateSettings.min&&(l=n.templateSettings.min),void 0!==n.templateSettings.max&&(r=n.templateSettings.max);const o=t/(r-l)*100;return a.innerHTML=`\n <div style="height: 40%; top: 30%; position: relative; left: 5%; right:5%; width: 90%; overflow:hidden; border-radius: 8px; background: var(--smart-surface); border: 1px solid var(--smart-border);" class="smart-grid-progress-container" role="progressbar" \n aria-valuemin="0" aria-valuemax="100" aria-valuenow="${t}" \n aria-label="Progress: ${e}" tabindex="0">\n <div class="smart-grid-progress-fill" style="width: ${o}%; background: ${s};">\n <span class="smart-grid-progress-label">${e}</span>\n </div>\n </div>\n `,void i.setAttribute("template",i.cell.template)}}a.innerHTML='<div value="'+e+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+e+';"><div title="'+e+'" style="width: 100%; height: 4px; background: '+s+"; color: "+l+';" class="smart-truncate smart-token"></div></div><span>'+e+"</span></div>",i.setAttribute("template",i.cell.template);break}case"rating":{const e=i.cell.column.editor.max?i.cell.column.editor.max:5,l=t?parseInt(t):0;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(l===parseInt(a.firstElementChild.getAttribute("value")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);a.firstElementChild.setAttribute("value",l);for(let t=0;t<e;t++){const e=a.firstElementChild.children[t];let i="";l>0&&l>t&&(i="value"),i?e.classList.add("value"):e.classList.remove("value")}return void i.setAttribute("template",i.cell.template)}const n=t=>{let l="";for(let a=0;a<e;a++){let e="";t>0&&t>a&&(e="value"),l+=`<div rating-value title="${a+1}" value="${a+1}" class="smart-grid-icon show smart-icon-star ${e}"></div>`}return l};a.innerHTML=`<div value="${l}" class="rating">${n(l)}</div>`;const s=e=>{if(!r._mobile&&e.hasAttribute("rating-value")){const t=e.getAttribute("value"),l=e.closest("smart-grid-cell"),a=e.closest("smart-grid-row");if(l&&a){const e=l.querySelector(".rating"),s=a.getAttribute("data-id"),o=l.getAttribute("data-field"),d=r.rowById[s],c=r.getCellValue(s,o),m=l.cell;let u=null;r.storeHistory&&(u=r._stringifyRow(d)),c===t?(a.row.data[o]=0,e.innerHTML=n(0),e.setAttribute("value",0)):(a.row.data[o]=parseInt(t),e.innerHTML=n(parseInt(t)),e.setAttribute("value",t));const p=a.row.data[o];r._setCellUndoRedo(m,c,p),r.onCellUpdate&&r.onCellUpdate([m],[c],[p],(function(e){r.onCellUpdated&&r.onCellUpdated([m.row.index],[m.row],[m.column],[m.row.data],[c],[p],i),r._onCellUpdated&&r._onCellUpdated(m.row.index,m.row,m.column,m.row.data,c,p)}),i);const g=e=>{if(e!==c&&(d.updatedDate=new Date,d.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(d);t[m.column.dataField]=e,r._updateRowHistory(d,u,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p);const f=l.querySelector(".rating"),h=parseInt(t)-1;f.children[h].classList.add("down"),setTimeout((()=>{f.children[h].classList.remove("down")}),1e3)}}},o=(e,t=!0)=>{if(e&&[...e.querySelectorAll(".smart-icon-star")].forEach((e=>{e.classList.remove("hover")})),e.hasAttribute("value")){const l=[...e.parentElement.children],a=l.indexOf(e);l.forEach(((e,l)=>{e.classList.remove("hover"),l<=a&&t&&e.classList.add("hover")}))}};r.editing.enabled?(r.handleRatingClick||(r._handleRatingMove=o,r._handleRatingClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointermove=e=>{o(e.target)},a.firstElementChild.onpointerleave=e=>{o(e.target)}):a.firstElementChild.style.pointerEvents="none",i.setAttribute("template",i.cell.template);break}case"vote":{let e=t;const l=(e,t)=>{const l=e.firstElementChild.firstElementChild,a=r.users?r.users.length:1,i=t.length*(100/a)+"%",n=t.length>0?"voted":"",s=l.firstElementChild,o=s.children[0];l.children[1].children[0].classList.remove("smart-votes-bar-animate"),r.isScrolling||l.children[1].children[0].classList.add("smart-votes-bar-animate");const d=l.children[1].firstElementChild.children[0],c=l.children[2];s.classList.remove("voted"),o.classList.remove("smart-icon-check"),n&&(o.classList.add("smart-icon-check"),s.classList.add("voted")),c.textContent=t.length,d.style.width=i,e.firstElementChild.setAttribute("value",t)};if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const t=a.firstElementChild.getAttribute("value"),r=a.firstElementChild;return r.removeAttribute("color"),r.style.setProperty("--smart-check-template-color","var(--smart-primary)"),r.style.setProperty("--smart-check-template-forecolor","#ffffff"),i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(r.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),r.setAttribute("color","")),e=e?e.split():[],l(a,e),e===t?(i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)):(a.firstElementChild.setAttribute("value",e),void i.setAttribute("template",i.cell.template))}const n=e=>{e&&!Array.isArray(e)&&(e=e?e.split():[]);const t=r.users?r.users.length:1,l=e.length*(100/t)+"%;";return`<div vote-value class="smart-flex middle center smart-votes-cell-component">\n <div class="smart-flex middle center smart-vote-button ${e.length>0?"voted":""}">\n <span class="smart-icon smart-grid-icon show ${e.length>0?"smart-icon-check":""}"></span>\n </div>\n <div class="smart-votes-bar-container">\n <div class="smart-votes-bar-component">\n <div class="smart-votes-bar" style="width: ${l} opacity: 1;"></div>\n <div class="smart-votes-bar-frame" style="width: 100%; opacity: 0.2;"></div>\n </div>\n </div>\n <div class="smart-voters-info">${e.length}</div>\n </div>`};a.innerHTML=`<div value="${e}" class="vote">${n(e)}</div>`,i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(o=a.firstElementChild,o.style.setProperty("--smart-check-template-forecolor","#ffffff"),o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color));const s=(e,t,a)=>{if(r._mobile)return;const n=e.closest("smart-grid-cell"),s=e.closest("smart-grid-row"),o=(e,t)=>{const a=r.rowById[e],o=r.getCellValue(e,t),d=n.cell;let c=null;r.storeHistory&&(c=r._stringifyRow(a));const m=o?o.split(","):[],u=r._currentUser?""+r._currentUser.info.id:null;if(void 0===u)return;m.indexOf(u)>=0?(m.splice(m.indexOf(u),1),s.row.data[t]=m.toString(),l(n.firstElementChild,m)):(m.push(u),s.row.data[t]=m.toString(),l(n.firstElementChild,m));const p=s.row.data[t];r._setCellUndoRedo(d,o,p),r.onCellUpdate&&r.onCellUpdate([d],[o],[p],(function(){r.onCellUpdated&&r.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[p],i),r._onCellUpdated&&r._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,p)}),i);const g=e=>{if(e!==o&&(a.updatedDate=new Date,a.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(a);t[d.column.dataField]=e,r._updateRowHistory(a,c,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p)};if(n&&s){o(s.getAttribute("data-id"),n.getAttribute("data-field"))}else null!==t&&null!==a&&o(t,a)};r._handleVoteClick||(r._handleVoteClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointerenter=e=>{const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row");if(t&&l){const i=l.getAttribute("data-id"),n=t.getAttribute("data-field");let s=r.getCellValue(i,n);if(s){if(r.users){let e="";s=s.split(),r.users.forEach((t=>{(s.indexOf(""+t.id)>=0||s.indexOf(""+t.value)>=0)&&(e+=t.name||t.label)})),e&&(s=r.localize("votes",{value:e}))}}else s=r.localize("noVotes");r._createTooltip(e,s,a,"top")}},a.firstElementChild.onpointerleave=()=>{r._cellTooltip&&(r._cellTooltip.style.visibility="hidden")},i.setAttribute("template",i.cell.template);break}case"duration":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t){const e=864e5;let l="MMM dd",n="MMM dd";if("string"==typeof t[0]&&(Array.isArray(t)?(t[0]=new Date(t[0]),t[1]=new Date(t[1])):((t=t.split(","))[0]=new Date(t[0]),t[1]=new Date(t[1]))),Array.isArray(t)){t[0]&&"string"==typeof t[0]&&(t[0]=new Date(t[0])),t[1]&&"string"==typeof t[1]&&(t[1]=new Date(t[1])),t[1]&&t[1].getMonth()===t[0].getMonth()&&(n="dd"),t[0]&&t[0].getFullYear()!==(new Date).getFullYear()&&(l+=", yyyy","dd"===n?(l="MMM dd",n+=", yyyy"):n=l);let s=!1;t[0]&&(0===t[0].getHours()&&0===t[0].getHours()||(l+=" hh:mm","dd"===n?n=l:n+=" hh:mm",s=!0));let o=null;o=Math.round(t[1].getTime()-t[0].getTime())/e;const d=o?parseInt(Math.abs(o).toFixed(0)):0;if(d>0){const e=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],n);let s="";s=r.localize("days",{value:d}),a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${e}</span><span style="font-size: 11px;" class="smart-quiet">${s}</span></div>`}else{let e="";if(s){const r=t[1]-t[0],n=Math.floor(r%864e5/36e5);let s=Math.round(r%864e5%36e5/6e4);s<10&&(s+="0"+s),e=n+":"+s;const o=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],"hh:mm");a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${o}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else{const r=i.cell.getFormattedValue(t[0],l);a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${r}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}}}}else a.innerHTML="";i.setAttribute("template",i.cell.template),a.firstElementChild&&a.firstElementChild.setAttribute("value",e);break}case"startDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;let l=t;if(n.cellsFormat?l=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(l=i.cell.getFormattedValue(t,n.formatSettings.Intl)),t){const e=864e5,s="string"==typeof t?new Date(t):t;let o=r.columnByDataField.taskDueDate;n.editor.boundDateField?o=r.columnByDataField[n.editor.boundDateField]:n.relationField&&(o=r.columnByDataField[n.relationField]);let d=o?i.cell.row.data[o.dataField]:"";d&&"string"==typeof d&&(d=new Date(d));let c=null;d&&(c=Math.round(s.getTime()-d.getTime())/e);const m=c?parseInt(Math.abs(c).toFixed(0)):0;if(m>0){let e="";e=r.localize("days",{value:m}),a.innerHTML=`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto 25px"><span style="color: var(--smart-primary);" title="${e}" class="smart-icon-clock smart-grid-icon show"></span><span>${l}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else a.innerHTML='<div style="padding-left: 7px;">'+l+"</div>"}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"dueDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;const l=["#D50000","#F4511E","#F6BF26","#33B679"],o=n.editor.date||(n.templateSettings&&n.templateSettings.date?n.templateSettings.date:new Date)||new Date;o.setHours(0,0,0);let d=t;n.cellsFormat?d=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(d=i.cell.getFormattedValue(t,n.formatSettings.Intl));const c=(e,t)=>{const l=e<=8?e/8:1;return`<div title="${t}" class="smart-element smart-circular-progress-bar" style="background: inherit; padding-left:4px; position: relative; top: calc(50% - 12px); padding-top:4px; width: 20px; height: 20px;">\n <div class="smart-container">\n <svg style="left: 0px; top: 0px; background: var(--smart-background);"width="100%" height="100%" viewPort="0 0 100 100" viewBox="0 0 100 100" role="presentation" aria-hidden="true">\n <circle id="value" class="smart-value-path" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n <circle id="value" style="stroke-dashoffset: ${100*Math.PI-(1-l)*Math.PI*100}; stroke-width: 100%;" class="smart-value" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n </svg>\n </div>\n </div>\n `};if(t){const s=864e5,m="string"==typeof t?new Date(t):t,u=Math.round(m.getTime()-o.getTime())/s,p=parseInt(Math.abs(u).toFixed(0));let g=r.columnByDataField.taskStatus;n.editor.boundDataField?g=r.columnByDataField[n.editor.boundDataField]:n.relationField&&(g=r.columnByDataField[n.relationField]);const f=g?i.cell.row.data[g.dataField]:"";if("done"===f||"complete"===f||"completed"===f||"finished"===f||!0===f||"done"===f.toLowerCase()||"complete"===f.toLowerCase()||"completed"===f.toLowerCase()||"finished"===f.toLowerCase()||1===f||"1"===f){let e=r.localize("done");a.innerHTML=`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${l[3]}; width:16px; height: 16px;"><span title="${e}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${d}</span></div>`}else{let t="";t=0===p?r.localize("today"):1===p?e<o?r.localize("yesterday"):r.localize("tomorrow"):e<o?r.localize("daysOverdue",{value:p}):r.localize("daysLeft",{value:p}),a.innerHTML=e>=o?`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto">${c(p,t)}<span>${d}</span></div>`:`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto"><span title="${t}" style="font-size: 16px; color: ${l[0]}" class="smart-grid-icon show smart-icon-attention-circled"></span>${d}</span></div>`}t=t+"_"+f}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"attachments":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="attachments"><div title="${r.localize("addFiles")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return a.innerHTML!==e&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div");e.classList.add("file-container"),l.classList.add("attachments");let n=t;if(r._findIsFile(n)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}if("string"==typeof n&&(n.indexOf("[{")>=0||n.indexOf("}]")>=0)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}Array.isArray(n)&&n.forEach((t=>{const l=document.createElement("div");l.title=t.label,l.classList.add("item"),l.innerHTML="<div></div>",l.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.label||(t.label=""),t.label.indexOf("png")>=0||t.label.indexOf("jpg")>=0||t.label.indexOf("jpeg")>=0||t.label.indexOf("gif")>=0?l.firstElementChild.classList.add("smart-icon-image"):t.label.indexOf(".pdf")>=0?l.firstElementChild.classList.add("smart-icon-pdf"):t.label.indexOf(".tsv")>=0||t.label.indexOf(".txt")>=0||t.label.indexOf(".csv")>=0?l.firstElementChild.classList.add("smart-icon-text"):t.label.indexOf(".xls")>=0||t.label.indexOf(".xlsx")>=0?l.firstElementChild.classList.add("smart-icon-excel"):t.label.indexOf(".ppt")>=0?l.firstElementChild.classList.add("smart-icon-powerpoint"):t.label.indexOf(".zip")>=0||t.label.indexOf(".rar")>=0||t.label.indexOf(".7z")>=0?l.firstElementChild.classList.add("smart-icon-archive"):t.label.indexOf(".doc")>=0||t.label.indexOf(".docx")>=0?l.firstElementChild.classList.add("smart-icon-word"):t.label.indexOf(".mp3")>=0?l.firstElementChild.classList.add("smart-icon-music"):t.label.indexOf(".mp4")>=0||t.label.indexOf(".avi")>=0||t.label.indexOf(".mov")>=0||t.label.indexOf(".mp4")>=0||t.label.indexOf(".mpeg")>=0||t.label.indexOf(".webm")>=0||t.value&&t.value.indexOf("youtube")>=0?l.firstElementChild.classList.add("smart-icon-video"):l.firstElementChild.classList.add("smart-icon-file"),e.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");d.classList.add("smart-arrow-right","arrowbtn");const c=document.createElement("div");if(c.classList.add("smart-icon-plus","smart-grid-icon","show"),c.title=r.localize("addFiles"),"card"!==r.view&&l.appendChild(c),l.onpointerdown=t=>{if(t.target.classList.contains("attachment")){const e=JSON.parse(i.cell.value),a=[...l.children[1].children],n=a&&a.indexOf?a.indexOf(t.target.parentNode):-1;if(e[n]){const t=document.createElement("a");if(e[n].value.indexOf(window.location.host)>=0)fetch(e[n].value).then((e=>e.blob())).then((l=>{const a=URL.createObjectURL(l);t.download=e[n].label,t.href=a,t.click()}));else{if(e[n].value.indexOf("base64")>=0){const l=r._getFileFromBase64(e[n].value);t.href=URL.createObjectURL(l)}else t.href=e[n].value;t.target="_blank",t.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=s===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.children.length){if(l.appendChild(e),"card"!==r.view){const t=25*n.length;t-i.offsetWidth+30>30&&(l.appendChild(s),l.appendChild(d)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",s.classList.add("smart-hidden"),a<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),a>30&&(l.appendChild(s),l.appendChild(d))}}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):n&&n[0]&&n[0].label?o.setAttribute("value",n[0].label):o.setAttribute("value",t);break}case"images":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="images"><div title="${r.localize("addImages")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return e!==a.innerHTML&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(!r._recycleFiles&&a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div"),s=document.createDocumentFragment();e.classList.add("file-container"),l.classList.add("images");let d=t;if(r._findIsFile(d)){let e="";if(d&&d.indexOf("{")>=0)try{e=JSON.parse(d)}catch(e){console.log(e)}else e=d.split(","),e=e.map((e=>({label:e,value:e})));d=e}if("string"==typeof d&&(d.indexOf("[{")>=0||d.indexOf("}]")>=0)){let e="";if(d)try{e=JSON.parse(d)}catch(e){console.log(e)}d=e}else"string"==typeof d&&d.indexOf("./")>=0&&(d=d.split(","),d=d.map((e=>({label:e,value:e}))));Array.isArray(d)&&d.forEach((e=>{if(e.label||(e.label=""),e.label.indexOf(".mp4")>=0||e.label.indexOf(".avi")>=0||e.label.indexOf(".mov")>=0||e.label.indexOf(".mp4")>=0||e.label.indexOf(".mpeg")>=0||e.label.indexOf(".webm")>=0||e.value&&e.value.indexOf("youtube")>=0){const t=document.createElement("div");t.title=e.label,t.classList.add("item"),t.innerHTML="<div></div>",t.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.firstElementChild.classList.add("smart-icon-video"),s.appendChild(t)}else{const t=document.createElement("img");t.style.display="none";let l="";l=e.label.indexOf(".gif")>=0?e.value:e.small?e.small:e.medium?e.medium:e.large?e.large:e.value,t.onload=()=>{t.style.display=""},l.indexOf("base64")>=0?t.src=l:(r._imagesCache||(r._imagesCache=[]),r.uploadSettings.url?r._imagesCache[l]?r._findUserFile(e)&&(t.src=l):(r._imagesCache[l]=!0,t.style.display="none",r._findUserFile(e)?(t.src=l,t.style.display=""):l&&l.startsWith("https://")&&(t.src=l)):t.src=l,t.onerror=()=>{t.style.display="none"}),t.title=e.label,t.setAttribute("data-url",e.large||e.value),s.appendChild(t)}}));const c=document.createElement("div");c.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const m=document.createElement("div");m.classList.add("smart-arrow-right","arrowbtn");const u=document.createElement("div");u.classList.add("smart-icon-plus","smart-grid-icon","show"),u.title=r.localize("addImages");const p=document.createElement("div");if(p.classList.add("smart-navigation"),"card"!==r.view&&r.editing.enabled&&n.allowEdit&&l.appendChild(u),l.onpointerdown=t=>{if("IMG"===t.target.nodeName&&("card"!==r.view&&[...e.children].forEach((e=>e.classList.remove("smart-hidden"))),r._openImagePreviewDialog(t.target),t.stopPropagation(),t.preventDefault()),t.target.classList.contains("attachment")){const l=JSON.parse(i.cell.value),a=[...e.children].indexOf(t.target.parentNode);if(l[a]){const e=document.createElement("a");if(l[a].value.indexOf(window.location.host)>=0)fetch(l[a].value).then((e=>e.blob())).then((t=>{const i=URL.createObjectURL(t);e.download=l[a].label,e.href=i,e.click()}));else{if(l[a].value.indexOf("base64")>=0){const t=r._getFileFromBase64(l[a].value);e.href=URL.createObjectURL(t)}else e.href=l[a].value;e.target="_blank",e.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("smart-navigation-item")){[...p.children].forEach((e=>e.classList.remove("active"))),t.target.classList.add("active"),[...e.children].forEach((e=>e.classList.add("smart-hidden")));const l=[...p.children].indexOf(t.target);e.children[l].classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=c===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?c.classList.add("smart-hidden"):c.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.appendChild(s),e.children.length){if(l.appendChild(e),"card"===r.view&&l.appendChild(p),"card"!==r.view){const t=25*d.length;t-i.offsetWidth+30>30&&(l.appendChild(c),l.appendChild(m)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",c.classList.add("smart-hidden"),a<0?m.classList.add("smart-hidden"):m.classList.remove("smart-hidden"),a>30&&(l.appendChild(c),l.appendChild(m))}}else{for(let t=0;t<e.children.length;t++){const l=document.createElement("div");l.classList.add("smart-navigation-item"),0===t?l.classList.add("active"):e.children[t].classList.add("smart-hidden"),p.appendChild(l)}1===e.children.length&&p.classList.add("smart-visibility-hidden")}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):d&&d[0]&&d[0].label?o.setAttribute("value",d[0].label):o.setAttribute("value",t);break}case"email":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;o=document.createElement("span"),null===t||""===t?o.innerHTML="":Smart.Validator.email(t)?o.innerHTML=t:(o.className="url center middle",o.innerHTML='<a href="mailto:'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()}))}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"url":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;const l=e=>{e.classList.add("center","middle"),null===t||""===t?e.classList.add("smart-hidden"):Smart.Validator.url(t)?(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="https://'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden")):(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden"))};a.firstElementChild&&a.firstElementChild.classList.contains("url")?(o=a.firstElementChild,l(o)):(o=document.createElement("span"),o.className="url",l(o)),o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()})}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"sparklines":{const l=t,o=""+n.computedWidth;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value"),t=a.firstElementChild.getAttribute("width"),n=a.firstElementChild.getAttribute("height"),s=i.cell.row.cellHeight||r.layout.rowMinHeight;if(l===e&&t===o&&s===n)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const d=(e,t,l)=>{if(!1===c.tooltip)return;const a=e.pageX,i=e.pageY-10;if(!r._sparklineTooltip){const e=document.createElement("smart-button");e.classList.add("secondary"),e.style.boxShadow="var(--smart-elevation-4)",e.style.opacity=.9,e.style.transition="all cubic-bezier(0.6, 0.2, 0, 0.8) 0.2s",document.body.appendChild(e),e.style.position="absolute",e.style.zIndex=999,r._sparklineTooltip=e}const n=r._sparklineTooltip;n.innerHTML===t&&n.element===l||(n.style.top=i+25+"px",n.style.left=a-15+"px"),n.innerHTML=""+t,n.style.display=""},c=n.templateSettings,m=()=>{a.onmousemove=e=>{if("column"!==c.type&&"bar"!==c.type||a.querySelectorAll("rect").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&l.top<=e.clientY&&e.clientY<=l.bottom&&(t.setAttribute("highlight",""),d(e,t.getAttribute("data-title"),t))})),"pie"===c.type){let t=!1;a.querySelectorAll("path").forEach((l=>{var a=l.getBoundingClientRect();l.removeAttribute("highlight"),t||a.left<=e.clientX&&e.clientX<=a.right&&a.top<=e.clientY&&e.clientY<=a.bottom&&(l.setAttribute("highlight",""),t=!0,d(e,l.getAttribute("data-title"),l))}))}"line"===c.type&&a.querySelectorAll("line").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&(t.previousElementSibling&&(t.previousElementSibling.style.display="none"),t.nextElementSibling&&(t.nextElementSibling.style.display="none"),t.setAttribute("highlight",""),l.left+l.width/2>=e.clientX?t.previousElementSibling&&(t.previousElementSibling.style.display="",d(e,t.previousElementSibling.getAttribute("data-title"),t.previousElementSibling)):t.nextElementSibling&&(t.nextElementSibling.style.display="",d(e,t.nextElementSibling.getAttribute("data-title"),t.nextElementSibling)))}))},a.onmouseleave=()=>{r._sparklineTooltip&&(r._sparklineTooltip.style.display="none"),a.querySelectorAll("rect").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("path").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("line").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("circle").forEach((e=>{e.style.display="none"}))}};if(s())return void m();const u=new e,p=i.cell.row.cellHeight||r.layout.rowMinHeight;if(p>=7)if(i._sparklinesRender&&cancelAnimationFrame(i._sparklinesRender),t){const e=u.render({width:o-10,height:Math.max(0,p-7),points:t,colors:c.colors,type:c.type,gap:c.gap,max:c.max,min:c.min,padding:c.padding,roundedCorners:c.roundedCorners,strokeWidth:c.strokeWidth,colorFunction:c.colorFunction,tooltipFormatFunction:c.tooltipFormatFunction});a.innerHTML=`<div height="${p}" width="${o}" value="${l}" style="padding-top: 5px; padding-left: 5px; padding-right: 5px;">${e}</div>`,m()}else a.innerHTML="",a.onmousemove=a.onmouseleave=null;i.setAttribute("template",i.cell.template);break}default:{let e=null;i.setAttribute("template","");const l=i.cell.row,s=a;let o=i.cell.getFormattedValue(t,n.cellsFormat);if(s.style.lineHeight="","function"==typeof i.cell.template){const e={row:l,column:n,cell:i.cell,oldValue:i.cell.oldValue,value:t,data:l.data,template:null},a=i.cell.column.templateSettings.React||r.React,d=i.cell.column.templateSettings.ReactDOM||r.ReactDOM;if(i.cell.column.templateSettings&&a&&d){return void d.createRoot(s).render(a.createElement(i.cell.template,e))}let c=s.querySelector(".smart-grid-cell-template");const m=l.id;r.isHScrolling&&(r._cachedTemplates||(r._cachedTemplates=[]),c&&0===c.innerHTML.length&&(c=null),!c&&r._cachedTemplates&&r._cachedTemplates[n.dataField+"_"+m]&&(0===r._cachedTemplates[n.dataField+"_"+m].innerHTML.length?delete r._cachedTemplates[n.dataField+"_"+m]:e.template=r._cachedTemplates[n.dataField+"_"+m])),c&&c.getAttribute("column")===n.dataField?e.template=c.firstElementChild:c=null,i.formattedValue!==o&&(c=null),i.cell.canNotify=!1,l.canNotify=!1;const u=Object.assign({},{background:i.cell.background,color:i.cell.color,fontSize:i.cell.fontSize,fontFamily:i.cell.fontFamily,fontWeight:i.cell.fontWeight,textDecoration:i.cell.textDecoration,fontStyle:i.cell.fontStyle});if(i.cell.template(e),!c&&e.template)if(e.template instanceof HTMLElement){const t=document.createElement("div");t.classList.add("smart-grid-cell-template"),t.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(t),t.appendChild(e.template)}else s.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+e.template+"</div>";else c||null!==e.template||(s.innerHTML=t);if(r.isHScrolling&&!r._cachedTemplates[n.dataField+"_"+m]&&s.firstElementChild.firstElementChild){const e=s.firstElementChild.firstElementChild;e&&(r._cachedTemplates[n.dataField+"_"+m]=e)}s.style.background===u.background&&s.style.color===u.color&&s.style.fontSize===u.fontSize&&s.style.fontWeight===u.fontWeight&&s.style.fontStyle===u.fontStyle||(i.cell._styleChanged=!0,i.cell._setStyle(s)),i.cell.background!==u.background||i.cell.color!==u.color||i.cell.fontSize!==u.fontSize||i.cell.fontWeight!==u.fontWeight||i.cell.fontStyle!==u.fontStyle?(i.cell._styleChanged=!0,i.cell._setStyle(s)):i.cell._styleChanged&&i.cell._setStyle(s),void 0===i.cell.oldValue&&(i.cell.oldValue=t),i.formattedValue=o,i.cell.canNotify=!0,l.canNotify=!0}else if(Array.isArray(i.cell.template)){const e=document.createElement("div");if(s.firstElementChild&&s.firstElementChild.classList.contains("smart-grid-cell-template"))for(let e=0;e<i.cell.template.length;e++){const t=s.firstElementChild.children[e].firstElementChild,a=i.cell.template[e];if(a.length>1&&t){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t.src&&t.src!==e?(i._imageUpdateTimer&&clearTimeout(i._imageUpdateTimer),i._imageUpdateTimer=setTimeout((()=>{t.src=e}),50)):t.textContent!==e&&(t.textContent=e)}}else{e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(e);let t="";for(let e=0;e<i.cell.template.length;e++){const a=i.cell.template[e];if(a.length>1){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t+='<span class="smart-template-part">'+a[0].replaceAll("{{value}}",e)+"</span>"}}e.innerHTML=t}}else{if(""!==s.textContent&&(s.textContent=""),i.cell.template instanceof HTMLTemplateElement)e=i.cell.template;else if(i.cell.template instanceof HTMLElement){const e=i.cell.template.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);s.innerHTML!==e&&(s.innerHTML=e)}else if("function"==typeof i.cell.template&&i.cell.template.prototype&&"undefined"!=typeof ngApp){const e=ngApp.injector,l=e.get(ComponentFactoryResolver).resolveComponentFactory(i.cell.template),a=s.appendChild(l.create(e));return a.instance.value=t,void a.changeDetectorRef.detectChanges()}if(i.cell.template.startsWith&&i.cell.template.startsWith("#")&&(e=document.querySelector(i.cell.template)),e){let a=e.content.cloneNode(!0).firstElementChild;const d=t;if(t=(t=(t=t.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),a.querySelector("[smart-if]")){const e=a.querySelector("[smart-else]"),l=a.querySelectorAll("[smart-if]");let i=!1;for(let e=0;e<l.length;e++){const r=l[e],s=r.getAttribute("smart-if"),o=s.split(" "),c=o[1].trim();let m=o[2].trim();s.indexOf("'")>=0&&(m=s.substring(s.indexOf("'")+1),m=m.replaceAll("'",""));let u=t;switch("Today"===m&&(m=new Date),"date"===n.dataType&&(t=new Date(d).getTime(),m=new Date(m).getTime()),c){case">":t>parseFloat(m)&&(a=r,i=!0);break;case">=":t>=parseFloat(m)&&(a=r,i=!0);break;case"=":case"==":case"===":t===m&&(a=r,i=!0);break;case"<":t<parseFloat(m)&&(a=r,i=!0);break;case"<=":t<=parseFloat(m)&&(a=r,i=!0)}if(t=u,i)break}!i&&e&&(a=e)}let c=a.outerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);for(c.indexOf("{{value=")>=0&&(t?(c=c.substring(0,c.indexOf("{{value="))+t+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const e=c.indexOf("{{value::"),l=c.substring(e+9,c.indexOf("}}")),a=i.cell.getFormattedValue(t,l);c=c.replace(`{{value::${l}}}`,a)}if(n._treeColumn){const e=s.firstChild;if(e&&e.classList&&i.toggleButton&&n._treeColumn&&s.children[1]){const e=s.children[0],t=s.children[1].children[0],a=s.children[1].children[1].firstChild,i=s.children[1].children[2];let n="";if(r.grouping.enabled){let e=l.level-1;"multipleColumns"!==r.grouping.renderMode&&(n+='<div style="width: '+(1+e)*r.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<l.level;e++)n+="<div class='smart-indent'></div>";l.checked?a.setAttribute("checked",""):!1===l.checked?a.removeAttribute("checked"):null===l.checked&&a.setAttribute("checked","indeterminate"),l.leaf?l.allowCheck?a.classList.remove("smart-visibility-hidden"):a.classList.add("smart-visibility-hidden"):l.allowCheck?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),l.allowCheck?r.checkBoxes.visible?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"):r.checkBoxes.visible||a.classList.add("smart-hidden"),e.innerHTML=n,t.classList.add("smart-visibility-hidden"),l.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),l.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),l.data.isEmpty&&t.classList.add("smart-visibility-hidden"),i.innerHTML=c,r.appearance.showTooltips?i.setAttribute("title",r._unescapeString(o)):i.hasAttribute("title")&&i.removeAttribute("title")}}else s.innerHTML!==c&&(s.innerHTML=c)}else if("string"==typeof i.cell.template){""===t&&(t="&nbsp;");let e=i.cell.template.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);if(e.indexOf("{{"))for(let t=0;t<r.dataSource.dataFields.length;t++){const a=r.dataSource.dataFields[t].name;if(e.indexOf("{{"+a+"}}")>=0&&(e=e.replace("{{"+a+"}}",l.data[a]),-1===e.indexOf("{{")))break}s.innerHTML!==e&&(s.innerHTML=e)}}if("auto"===i.cell.row.height||r.layout.allowCellsWrap||"auto"===r.layout.rowHeight){const e=s.querySelector(".smart-grid-cell-template");if(e){l._templatesHeight||(l._templatesHeight=[]);const t=(e,t)=>{if(e){const l=r.rowById[e.getAttribute("data-id")];l._templatesHeight[n.dataField]=t,l._isDirty=!0;const a=l.canNotify;l.canNotify=!1,l.autoSize(),l.canNotify=a,delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),r.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(o)return a.innerHTML="",a.appendChild(o),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML),i.cell._setStyle(a),o;i.cell._setStyle(a),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML)}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,r=a._isMeasureRow?null:e.cell.format||l.cellsFormat,n=t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0;if(e.setAttribute("data-type",l.dataType),!(!1!==t._recycleValues||n||l.formatFunction||l._treeColumn||a.summaryRow||"grid"!==t.view)){if(e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element&&a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id?a.element.star.classList.remove("smart-hidden"):t.appearance.showRowComments&&!a.element.hasAttribute("focus")&&a.element.toggleDetailButton&&a.element.toggleDetailButton.classList.add("smart-visibility-hidden")),e.cell.background||e.cell.color){e.cell._styleChanged=!0;const t=e.firstChild;e.cell._setStyle(t)}return}if(t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&"card"!==t.view){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return void 0===t&&i.data&&(t=l.displayField?i.data[l.displayField]:i.data[l.dataField]),e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button"),t.dataSource.boundHierarchy||!e.hasAttribute("has-toggle-button")||l._treeColumn||e.removeAttribute("has-toggle-button");let s=l.displayField?i[l.displayField]:i[l.dataField];if(e.removeAttribute("placeholder"),!l.placeholder||""!==s&&null!=s||(s=l.placeholder,e.setAttribute("placeholder","")),l.parentDataField){const e=t.columnByDataField[l.parentDataField];if(e){let i=e.editor.dataSource;e.relationId&&e.relationField&&e._isDirty&&(!e.editor.dataSource||e.editor.dataSource&&0===e.editor.dataSource.length)&&(i=t._getRelationData(e.relationId));const r=i[t.getCellValue(a.id,l.parentDataField)];if(r){s=r[l.cascadingDataField]}}}if(null!==s||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(s=0),"string"===l.dataType&&(s=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(s=!1),"date"===l.dataType&&(s=new Date)),t.formulas&&e.cell.formula&&"string"==typeof e.cell.formula&&e.cell.formula.startsWith("=")&&/=.+/.test(e.cell.formula)){const i=t._formulaParser;if(i){if(t&&t.formulas&&e.cell._formula!==l.formula){let t=a.data[l.dataField];l.formula&&(e.cell.formula=e.cell._parseFormula(l.formula)),t&&(""+t).startsWith("=")&&(e.cell.formula=e.cell._parseFormula(""+t)),e.cell._formula=l.formula}const r=i.parse(e.cell.formula.slice(1));s=isNaN(r)?"#VALUE!"===r?"":"#ERROR!"===r?"#ERROR!":r:r}}t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(s="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row"),t.editing.enabled&&(e.cell.readonly||!l.allowEdit?e.classList.add("smart-readonly"):e.classList.remove("smart-readonly"));const o=t=>{if(t){if((t=""+t).startsWith("off_"))return e.classList.remove(t.substring(4)),!1;if(e.classList.add(t),e.hasAttribute("customCSS")){t=t+" "+e.getAttribute("customCSS")}return e.setAttribute("customCSS",t),!0}return e.setAttribute("highlight",""),!0};if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS");const l=t.split(" ");for(let t=0;t<l.length;t++)e.classList.remove(l[t])}if(l.highlight&&!a.summaryRow&&(o(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]){o(t.highlightedCells[a.id][l.dataField])}if(t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]){o(t.highlightedRows[a.id])}if(t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),s=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,s=e.cell.value),void 0===s&&(s="");let d=s;if(r)d=e.cell.getFormattedValue(s,r);else if(l.formatSettings&&l.formatSettings.Intl)if(""===s)d="";else if(l.editor.decimalPlaces>=0){const t=JSON.parse(JSON.stringify(l.formatSettings.Intl));t.NumberFormat.minimumFractionDigits=l.editor.decimalPlaces,t.NumberFormat.maximumFractionDigits=l.editor.decimalPlaces,d=e.cell.getFormattedValue(s,t)}else d=e.cell.getFormattedValue(s,l.formatSettings.Intl);else l.formatSettings&&l.formatSettings.formatString&&(d=e.cell.getFormattedValue(s,l.formatSettings.formatString));const c=e.firstChild;if(e.content=c,l._isDirty&&(c.innerHTML=""),c.hasAttribute("data-field")&&c.getAttribute("data-field")!==l.dataField&&(c.innerHTML="",a.filterRow&&(l._filterEditorInitialized=!1)),c.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?c.appendChild(t):c.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void c.appendChild(t)}e.cell.value!==s&&(d=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames||e._rowClassNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,s,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,s,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);let r=[];for(let n=0;n<i.length;n++){let o=i[n];const d={index:a.visibleIndex,value:s,dataField:l.dataField,row:a,data:a.data,api:t};l.cellsCSSRules[o](d)&&(e.classList.add(o),r.push(o))}e.__classNames=r}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const m=e._getCellAlignment(a,l),u=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let p="";if(m.align&&(p+=m.align+" "),m.verticalAlign&&(p+=m.verticalAlign+" "),l.cellsWrap)p+="wrap ";else if(t.layout.autoWrap&&a.height>40&&1===e.cell.colSpan&&"string"===l.dataType){if(14*(d||"").length*.52>l.computedWidth){if("url"!==e.cell.template&&"email"!==e.cell.template){p+="textwrap ";const e=parseInt(a.height/20);c.style["-webkit-line-clamp"]=e}}}if(p+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}if(l.grid.appearance.showRowComments&&l.rowHeaderColumn){const a=t.rowDetailColumn,i=a?a.width:0;e.style.width=l.computedWidth+i+"px",e.classList.add("row-number")}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.appearance.showColumnGroupCellLines||l.parent&&!l.element.hasAttribute("column-group-first-child")&&e.classList.add("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let g=l.left;if(t.rightToLeft?e.style.right!==g+"px"&&(e.style.right=g+"px"):e.style.left!==g+"px"&&(e.style.left=g+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),p+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze",""),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command","")),t.appearance.showRowComments&&(a.comments&&a.comments.length>0&&l===t._firstVisibleUserColumn?e.classList.add("row-comments"):e.classList.remove("row-comments")),l.cellsRotationAngle){if(!e._rotateCellContent(c,l,s))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(c));c.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)""!==c.innerHTML&&(c.innerHTML="");else if(l.autoGenerated&&""!==c.innerHTML&&(c.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary&&l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let r in a){if("status"===r)continue;const n=l.cellsFormat;let s=a[r];n&&n.indexOf("p")>=0&&"count"===r?s=a[r]:n&&"date"!==l.dataType&&(s=e.cell.getFormattedValue(s,n)),t.messages&&t.messages[t.locale]&&t.messages[t.locale][r]?i.push(t.localize(r,{value:s})):i.push(r+": "+s)}let r=[],n="";if(a&&a.status&&l.editor){n+='<div style="margin-right: 5px; display: flex; border-radius: 8px; align-items: center;">';const e=l.editor.dataSource,i=a.status,s=t.rows.length,o=l.computedWidth;let d=0;if(e)for(let l=0;l<e.length;l++){const a=e[l];if(i[a.value]){const e=a.label?a.label:t.localize("blankSummary"),l=i[a.value].length,c=new Number(l/s*100).toFixed(2),m=e+" "+l+"/"+s+" "+c+"%",u=o*c/100/2;r.push(m);const p=["#D50000","#F6BF26","#33B679","#039BE5","#3F51B5","#8E24AA"];d>p.length-1&&(d=0);n+='<span class="summary-value-part" title="'+m+'" style="width: '+u+"px; font-size: 11px; padding: 5px; background:"+(a.color||p[d++])+'; color: white;"></span>'}}n+="</div>"}const s=i.join(", "),o=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let d=`<div title = "${s}" class="smart-truncate summary-value" > <span class="label">${s}</span>${o}</div> `;r.length&&(d=`<div title = "${s}" class="smart-truncate summary-value" > <span style="align-items: center; display: flex;" class="label">${n}${s}</span>${o}</div> `);if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;d=`<div title = "${s}" class="smart-truncate summary-value" > ${`<span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> `} <span class="label">${s}</span>${o}</div> `}c.innerHTML!==d&&(c.innerHTML=d)}else if(t.summaryRow.editing&&l.allowSummary){if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value"><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==l&&(c.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value"><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==e&&(c.innerHTML=e)}}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?c.firstElementChild.setAttribute("has-summary",""):c.firstElementChild.removeAttribute("has-summary"),c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c._clickTarget=e.target},c.onpointerup=l=>{!0!==t._mobile&&c._clickTarget!==l.target||(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="",i=t.appearance.showRowStatus||t.appearance.showRowComments?"smart-visibility-hidden":"";if(a.showDetail){l='<button tabindex="-1" class="'+i+' smart-animate" toggled toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}else{l='<button tabindex="-1" class="'+i+" smart-animate"+(t.rowDetail.dialog.enabled?" row-detail":"")+'" toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}if(t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,c.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):c.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(c.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else c.innerHTML!==l&&(c.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)c.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let r="";for(let e=0;e<t;e++)r+="A";return r+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?c.textContent="":c.textContent=l(a)}else if(u)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)c.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)c.innerHTML=s;else switch(c.removeAttribute("title"),e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(s,e.cell.template,c);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(s,e.cell.template,c);break;case"attachment":e._setTemplate(s,"attachments",c);break;case"image":e._setTemplate(s,"images",c);break;case"email":e._setTemplate(s,"email",c);break;case"url":e._setTemplate(s,"url",c);break;case"richText":e._setTemplate(s,"richText",c);break;default:e._setTemplate(s,e.cell.template,c)}else{const i=c.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&c.children[1]){const e=c.children[0],i=c.children[1].children[0],r=c.children[1].children[1].firstChild,n=c.children[1].children[2];let s="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?s="":"multipleColumns"!==t.grouping.renderMode&&(s+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)s+="<div class='smart-indent'></div>";if(a.checked?r.setAttribute("checked",""):!1===a.checked?r.removeAttribute("checked"):null===a.checked&&r.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?r.classList.remove("smart-visibility-hidden"):r.classList.add("smart-visibility-hidden"):a.allowCheck?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(c)}}a.allowCheck?t.checkBoxes.visible?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"):t.checkBoxes.visible||r.classList.add("smart-hidden"),"card"===t.view&&(r.classList.add("smart-hidden"),i.classList.add("smart-hidden")),e.innerHTML=s,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),n.innerHTML=d,t.appearance.showTooltips?n.setAttribute("title",t._unescapeString(d)):n.hasAttribute("title")&&n.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let r=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(r+=l.computedWidth)}e.style.width=r+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let r=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let r=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(r+=l.cellHeight)}e.style.height=r+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const n="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(s,a.visibleIndex,a.data),o=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(o>l[0]&&o<l[1]){d=!0;break}}if(a._rowSpan=n,n&&!d){let s=0;t._cellRowSpan.push([o,o+n,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(n,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=o;e<=o+n-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(s+=l.cellHeight)}e.style.height=s+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",n),i._styleChanged=!0,r=n}}if(1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width=l.computedWidth+"px",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===r&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),c.textContent===d||l.formatFunction||("string"==typeof d&&d.indexOf("&")>=0?"card"===t.view?c.innerHTML=d:t.isScrolling?requestAnimationFrame((()=>{c.innerHTML=d})):c.innerHTML=d:c.textContent=d),i.column.autoGenerated||i._setStyle(c),t.appearance.showTooltips?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),c.setAttribute("title",i.tooltip||t._unescapeString(d))):c.hasAttribute("title")&&c.removeAttribute("title"),t.appearance.showTooltipsOverflow&&(!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title"),d&&d.length)){14*(d||"").length*.52>l.computedWidth?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),"image"!==l.template&&"attachment"===l.template&&c.setAttribute("title",i.tooltip||t._unescapeString(d))):!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title")}}else c.textContent=d}}if(c.className!==p&&(c.className=p),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&c.firstChild&&c.firstChild.classList&&c.firstChild.classList.contains("smart-grid-cell-loading")&&(c.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),c.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const i={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:s,data:a.data,formattedValue:d,template:null};e.cell.canNotify=!1,a.canNotify=!1;const r=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});if(t.hasAttribute("smart-blazor"))await l.formatFunction(i);else{const e=l.formatFunction(i);e&&(i.value=e)}c.style.background===r.background&&c.style.color===r.color&&c.style.fontSize===r.fontSize&&c.style.fontFamily===r.fontFamily&&c.style.textDecoration===r.textDecoration&&c.style.fontWeight===r.fontWeight&&c.style.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c)),e.cell.background===r.background&&e.cell.color===r.color&&e.cell.fontSize===r.fontSize&&e.cell.fontWeight===r.fontWeight&&e.cell.textDecoration===r.textDecoration&&e.cell.fontFamily===r.fontFamily&&e.cell.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c));let n=!0;if(i.value!==s){if(e.toggleButton){c.children[1].children[2].innerHTML=i.value}else c.innerHTML=i.value;n=!1}if(null!==i.template){if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==i.template&&(e.innerHTML=i.template)}}else if(c.innerHTML!==i.template){const e=document.createElement("div");e.innerHTML=i.template,e.innerHTML!==c.innerHTML&&(c.innerHTML=i.template)}n=!1}n&&(l.cellsFormat?c.textContent=d:c.textContent=s),e.cell.canNotify=!0,a.canNotify=!0}if(l.tooltipRenderer&&!a.summaryRow&&!a.autoGenerated){const e=l.tooltipRenderer(a.id,l.dataField,s,d,a.data);null!=e&&""!==e&&(c.setAttribute("data-title",e),c.onmouseenter=function(l){t._createTooltip(l,e,c,"top")},c.onmouseleave=function(){t._cellTooltip&&(t._cellTooltip.style.visibility="hidden")})}if(l.cellsRenderer&&!a.summaryRow){const t=l.cellsRenderer(a.id,l.dataField,s,a.data,c);if(null!=t)if("string"==typeof t)if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==t&&(e.innerHTML=t)}}else c.innerHTML!==t&&(c.innerHTML=t);else t instanceof HTMLElement&&c.firstChild!==t&&(c.innerHTML="",c.appendChild(t))}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,c),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&c.querySelector("[toggle-button]")){const e=c.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),r=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),r.appendChild(l),r.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(r),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const r=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-r.top+"px",i.style.left=a._offsetLeft(l)-r.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,r=e.column,n=e.row,s=e.row.index,o=n._style,d=n.data&&n.data.$?n.data.$.id:null;if(e.column.autoGenerated){const l=t._conditionalColors;if(l&&e.column.rowHeaderColumn)if("border"===l.decorate){const t=l.colors;t&&t[d]?(e.element.classList.add("smart-decorate"),e.element.style.setProperty("--smart-decorate-color",t[d].color)):e.element.classList.remove("smart-decorate")}else e.element.classList.remove("smart-decorate")}else{if(t._conditionalColors){const r=t._conditionalColors,s=()=>{e.row.style&&e.row.style[e.column.dataField]&&(e._styleChanged=!0,e.row.style[e.column.dataField].background&&(e.background=e.row.style[e.column.dataField].background),e.row.style[e.column.dataField].color&&(e.color=e.row.style[e.column.dataField].color))};if("border"!==r.decorate){const t=r.colors;if(t&&t[d]){const o="cell"===r.decorate?t[d][i]:t[d].color;if(o){const t=new Smart.Color(o).getInvertedColor();a.cell.canNotify=!1,n.canNotify=!1,e.background=o,e.color=t,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}if(a.cell._customInlineStyles&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.textDecoration=null,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),r.cellsCSSInlineRules){const e=r.cellsCSSInlineRules;for(let i=0;i<e.length;i++){const r=e[i];if(!r.field)break;const s=r.condition;let o=r.value,d=r.value2,c=n.data[r.field],m=t.columnByDataField[r.field];if("string"==typeof c&&(o=""+o,d=""+d),"date"===m.dataType||"dateTime"===m.dataType){if(o=Smart.Utilities.DateTime.ParseDate(o,m.cellsFormat),void 0!==d){d=Smart.Utilities.DateTime.ParseDate(d,m.cellsFormat)}}"number"!==m.dataType&&"float"!==m.dataType&&"decimal"!==m.dataType&&"currency"!==m.dataType||(o=parseFloat(o),void 0!==d&&(d=parseFloat(d))),"boolean"===m.dataType&&("string"==typeof o&&(o="true"===o.toLowerCase()),"1"===o&&(o=!0),"0"===o&&(o=!1),void 0!==d&&("string"==typeof d&&(d="true"===d.toLowerCase()),"1"===d&&(d=!0),"0"===d&&(d=!1)));let u=!1;switch(s){case">":u=o<c;break;case">=":u=o<=c;break;case"<":u=o>c;break;case"<=":u=o>=c;break;case"=":u=o===c;break;case"<>":u=o!==c;break;case"between":u=c>=o&&c<=d}u&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=r.background,a.cell.color=r.color,a.cell.textDecoration=r.textDecoration,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),a.cell._customInlineStyles=!0}}if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][s];a.cell.canNotify=!1,n.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,n.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,n.canNotify=!1,o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,n.canNotify=!0)}}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const r={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":r.align="align-left";break;case"center":case"middle":r.align="align-center";break;case"right":r.align="align-right"}switch(a){case"top":r.verticalAlign="align-top";break;case"center":case"middle":r.verticalAlign="align-middle";break;case"bottom":r.verticalAlign="align-bottom"}return r}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});class e{render(e){const t=this,l={svg:null,roundedCorners:e.roundedCorners||0,padding:e.padding||null,width:e.width||100,height:e.height||30,gap:e.gap||5,strokeWidth:e.strokeWidth||2,type:e.type||"column",colors:e.colors||["var(--smart-primary)"],points:e.points,labels:e.labels,colorFunction:e.colorFunction,tooltipFormatFunction:e.tooltipFormatFunction,min:e.min,max:e.max};switch(l.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),l.svg.setAttribute("width",l.width),l.svg.setAttribute("height",l.height),function(e){Array.isArray(e.colors)||(e.colors=t.colors.split(",")),e.points&&(Array.isArray(e.points)?e.points=e.points.map((e=>parseInt(e,10))):(e.points&&"number"==typeof e.points&&(e.points=""+e.points),e.points=e.points.split(",").map((e=>parseInt(e,10)))))}(l),l.type){case"column":return t.column(l);case"bar":return t.bar(l);case"line":return t.line(l);case"pie":return t.pie(l);case"stacked":return t.stacked(l)}}colorFunction(e,t){const l=function(e,t){e===t&&(t=e+100);const l=(t-e)/5;return[e+l,e+2*l,e+3*l,e+4*l]}(e,t),a=["#D50000","#F4511E","#F6BF26","#039BE5","#33B679"];return e=>e<l[0]?a[0]:e<l[1]?a[1]:e<l[2]?a[2]:e<l[3]?a[3]:a[4]}column(e){const t=e.gap/e.points.length+e.width/e.points.length-e.gap,l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;return e.colorFunction||(e.colorFunction=this.colorFunction(a,l)),e.points.forEach(((n,s)=>{isNaN(n)&&(n=0);const o=document.createElementNS("http://www.w3.org/2000/svg","rect"),d=Math.abs(n)*i;o.setAttribute("x",s*t+s*e.gap),o.setAttribute("point",n);let c=n>=0?"var(--smart-primary)":"var(--smart-error)";if(l>0&&a<0?n>=0?o.setAttribute("y",e.height-r-1-d):o.setAttribute("y",e.height-r-1):l>=0&&a>=0?o.setAttribute("y",e.height-d):a<=0&&l<=0&&o.setAttribute("y",d),o.setAttribute("width",t),o.setAttribute("height",d),e.colorFunction){const t=e.colorFunction(n);t&&(c=t)}o.setAttribute("fill",c);const m=e.tooltipFormatFunction?e.tooltipFormatFunction(n):n;o.setAttribute("data-title",m),e.svg.appendChild(o)})),e.svg.outerHTML}bar(e){const t=e.padding||0;let l=e.roundedCorners||0;"boolean"==typeof l&&(l=l?3:0);const a=e.height-3-2*t,i=Math.max(5,e.gap/e.points.length+a/e.points.length-e.gap),r=e.max||Math.max(...e.points),n=e.min||Math.min(...e.points);let s=e.width/(Math.abs(n)+Math.abs(r));const o=Math.abs(n)*s;return e.colorFunction||(e.colorFunction=this.colorFunction(n,r)),e.points.forEach(((a,d)=>{isNaN(a)&&(a=0);const c=document.createElementNS("http://www.w3.org/2000/svg","rect"),m=Math.abs(a)*s;c.setAttribute("y",d*i+d*e.gap+t),c.setAttribute("point",a),l>0&&(c.setAttribute("rx",l),c.setAttribute("ry",l));let u=a>=0?"var(--smart-primary)":"var(--smart-error)";if(r>0&&n<0?a>=0?c.setAttribute("x",o):c.setAttribute("x",o-m):(r>=0&&n>=0||n<=0&&r<=0)&&c.setAttribute("x",0),c.setAttribute("width",m),c.setAttribute("height",i),e.colorFunction){const t=e.colorFunction(a);t&&(u=t)}c.setAttribute("fill",u);const p=e.tooltipFormatFunction?e.tooltipFormatFunction(a):a;c.setAttribute("data-title",p),e.svg.appendChild(c)})),e.svg.outerHTML}line(e){const t=e.width/(e.points.length-1),l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;e.colorFunction||(e.colorFunction=this.colorFunction(a,l));let n="var(--smart-primary)",s=[],o=[];e.svg.setAttribute("overflow","visible");for(let l=0;l<e.points.length;l++){let a=e.points[l];isNaN(a)&&(a=0);const n=l*t,d=e.height-r-a*i;o.push({x:n,y:d,point:a}),2===o.length&&(s.push(o),o=[]),s.length>0&&0===o.length&&o.push(s[s.length-1][1])}for(let t=0;t<s.length;t++){const l=s[t];if(e.colorFunction){const t=e.colorFunction(l[0].point);t&&(n=t)}if(0===t){const t=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(t),t.setAttribute("cx",l[0].x),t.setAttribute("cy",l[0].y),t.setAttribute("r",3),t.setAttribute("fill",n);const a=e.tooltipFormatFunction?e.tooltipFormatFunction(l[0].point):l[0].point;t.setAttribute("data-title",a),t.style.display="none"}const a=document.createElementNS("http://www.w3.org/2000/svg","line");e.svg.appendChild(a),a.setAttribute("x1",l[0].x),a.setAttribute("y1",l[0].y),a.setAttribute("x2",l[1].x),a.setAttribute("y2",l[1].y);const i=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(i),i.setAttribute("cx",l[1].x),i.setAttribute("cy",l[1].y),i.setAttribute("r",3),i.setAttribute("fill",n);const r=e.tooltipFormatFunction?e.tooltipFormatFunction(l[1].point):l[1].point;i.setAttribute("data-title",r),i.style.display="none",a.setAttribute("fill","none"),a.setAttribute("stroke-width",e.strokeWidth),a.setAttribute("stroke",n)}return e.svg.outerHTML}pie(e){const t=Math.min(e.width,e.height)/2,l=e.width/2,a=e.height/2,i=e.points.reduce(((e,t)=>e+Math.abs(t)),0);let r=0;const n=e.max||Math.max(...e.points),s=e.min||Math.min(...e.points);return e.colorFunction||(e.colorFunction=this.colorFunction(s,n)),e.points.forEach((n=>{isNaN(n)&&(n=0);let s=e.color;if(e.colorFunction){const t=e.colorFunction(n);t&&(s=t)}const o=Math.abs(n)/i*2*Math.PI,d=r+o,c=l+t*Math.cos(r),m=a+t*Math.sin(r),u=l+t*Math.cos(d),p=a+t*Math.sin(d),g=document.createElementNS("http://www.w3.org/2000/svg","path"),f=o>Math.PI?1:0,h=`M ${l},${a} L ${c},${m} A ${t},${t} 0 ${f} 1 ${u},${p} Z`;g.setAttribute("d",h),g.setAttribute("fill",s);const b=e.tooltipFormatFunction?e.tooltipFormatFunction(n):`${(n/i*100).toFixed(2)}%`;g.setAttribute("data-title",b),e.svg.appendChild(g),r=d})),e.svg.outerHTML}stacked(e){let t=e.points.reduce(((e,t)=>e+t),0),l=(e.points.length-1)*e.gap,a=e.width-l;const i=e.max||Math.max(...e.points),r=e.min||Math.min(...e.points);e.colorFunction||(e.colorFunction=this.colorFunction(r,i));let n=0;return e.points.forEach(((l,i)=>{isNaN(l)&&(l=0);let r=e.colors[i%e.colors.length];if(e.colorFunction){const t=e.colorFunction(l);t&&(r=t)}const s=l/t*a,o=document.createElementNS("http://www.w3.org/2000/svg","rect");o.setAttribute("x",n),o.setAttribute("y",0),o.setAttribute("width",s),o.setAttribute("height",e.height),o.setAttribute("fill",r);const d=document.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=l,o.appendChild(d),e.svg.appendChild(o),n+=s+e.gap})),e.svg.outerHTML}}})();
50
+ (()=>{Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,l.format=null,l.formula=null,e._style){const a=e._style;t.autoGenerated||(l.color=void 0!==a.color?a.color:null,l.background=void 0!==a.background?a.background:null,l.fontFamily=void 0!==a.fontFamily?a.fontFamily:null,l.fontSize=void 0!==a.fontSize?a.fontSize:null,l.fontStyle=void 0!==a.fontStyle?a.fontStyle:null,l.textDecoration=void 0!==a.textDecoration?a.textDecoration:null,l.fontWeight=void 0!==a.fontWeight?a.fontWeight:null),a[t.dataField]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[t.dataField][e]&&(l[e]=a[t.dataField][e],l._styleChanged=!0)}))}if(l.grid&&l.grid.formulas){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(a,i){if("value"===i){const a=l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if(l.grid&&l.grid.formulas&&(l.formula||t.formula)){const a=l.grid._formulaParser;if(a){if(l.grid&&l.grid.formulas&&l._formula!==t.formula){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return a.parse(l.formula.slice(1))}}return a}if("editor"===i||"template"===i)return a[i]||l.column[i];if("focused"===i){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===i)return!0===l.row.getProperty("selected")||(!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField]);if("modifiedValue"===i){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const e=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==e?e:a.value}return a[i]},set:function(e,a,i){const r=this.get(e,a);if(r===i)return!0;if(e[a]=i,"element"===a||"isEditing"===a||"oldValue"===a||"_updating"===a||"notifyFn"===a||a.startsWith("_")||"canNotify"===a)return!0;if("error"===a)return!0;if("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||"formula"===a)return"formula"===a&&(l.formula=l._parseFormula(l.formula)),!0;if("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a){void 0===l.oldValue&&(l.oldValue=r),null==i&&delete l._formula;(()=>{if(l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),void 0===i&&(i=null),null!==i&&void 0!==i.label&&void 0!==i.value)l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value;else if(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i,l.column.displayField!==l.column.dataField&&"object"!=typeof i)if(l.column._dataSource){let e=i;for(let t=0;t<l.column._dataSource.length;t++)if(l.column._dataSource[t].value===i){e=l.column._dataSource[t].label;break}l.row.data[l.column.displayField]=e}else l.row.data[l.column.displayField]=i;const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;if(l.grid.dataSource)if(null!==i&&i.label&&i.value&&l.column.displayField!==l.column.dataField)l.grid._sortedColumns&&l.grid._sortedColumns.length>0?(e[l.column.dataField]=i.value,e[l.column.displayField]=i.label):(l.grid.dataSource.boundSource[t][l.column.dataField]=i.value,l.grid.dataSource.boundSource[t][l.column.displayField]=i.label);else if(i!==l.grid.dataSource.boundSource[t][l.column.dataField])if(l.grid._sortedColumns&&l.grid._sortedColumns.length>0)e[l.column.dataField]=i;else if(l.grid.dataSource.boundHierarchy&&l.grid.dataSource.childrenDataField){const t=(e=>function e(t,a){for(let i=0;i<t.length;i++){const r=t[i];if(r.id===a)return r;if(r[l.grid.dataSource.childrenDataField]&&r[l.grid.dataSource.childrenDataField].length>0){const t=e(r[l.grid.dataSource.childrenDataField],a);if(t)return t}}return null}(l.grid.dataSource.boundSource,e))(e.$.id);t&&(t[l.column.dataField]=i),e[l.column.dataField]=i}else l.grid.dataSource.boundSource[t][l.column.dataField]=i}l.grid.dataSource.boundSource.canNotify=!0,l.grid.onCellValueChanged&&i!==r&&l.grid.onCellValueChanged({id:l.row.id,dataField:l.column.dataField,value:i,oldValue:r})})()}return"selected"===a?(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0),l.grid._recycle(!1,!0,!1),l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0):!(!l._updating&&l.canNotify)||(l.grid._recycle(),!l.row.canNotify||(l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0))}})}_parseFormula(e){const t=this.row;if(!e)return e;return"string"!=typeof e&&(e=""+e),!1===e.startsWith("=")&&(e="="+e),e=function(e,t){return e.replace(/COL\(([^)]+)\)/g,((e,l)=>`${l}${t}`))}(e,1+t.index)}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const r=a[e];l+=`${r}: ${i};`},r=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<r.length;e++)i(r[e]);e.getAttribute("style")!==l&&(""===l?e.removeAttribute("style"):e.setAttribute("style",l)),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.grid&&!t.grid.appearance.showSelectionOnTop||t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(l.column.placeholder&&e===l.column.placeholder)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("any"===l.column.dataType||"string"===l.column.dataType&&t&&t.length){let a=!1;const i=""+e;if((i.indexOf("/")>=0||i.indexOf("-")>=0||i.indexOf(":")>=0)&&(t.indexOf("d")>=0&&t.indexOf("M")>=0&&(a=!0),(t.indexOf("d")>=0||t.indexOf("M")>=0||t.indexOf("y")>=0||t.indexOf("h")>=0||t.indexOf("H")>=0||t.indexOf("m")>=0)&&(a=!0)),a){let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{"string"==typeof e&&(e=parseFloat(e));let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat){return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e)}!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const a=t.NumberFormat&&void 0!==t.NumberFormat.maximumFractionDigits?t.NumberFormat.maximumFractionDigits:2,i=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:a,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+i.replace("-","")+")":i}if(l.column.formatSettings.Intl.NumberFormat.locale){return new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,t.NumberFormat).format(e)}{const a=new Intl.NumberFormat(this.grid.locale,t.NumberFormat).format(e);if("percent"===l.column.formatSettings.Intl.NumberFormat.style){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits?l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits:2;return new Intl.NumberFormat(this.grid.locale,{style:"decimal",minimumFractionDigits:t}).format(100*e)+" %"}return"squaremeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m²":"cubicmeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m³":a}}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const r=i.formatNumber(e,t);return void 0===r?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+r+")":r}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let r=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(r=r.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let n=0;n<i._cellsMerge.length;n++){const s=i._cellsMerge[n];let o=[],d=[];if(o.push(s.row),s.rowspan>1){const e=r.indexOf(s.row);if(e>=0)for(let t=e;t<e+s.rowSpan;t++)r[t]&&-1===o.indexOf(r[t])&&o.push(r[t])}if(d.push(s.column.dataField),s.colspan>1){const e=i.columns.indexOf(i.columnByDataField[s.column.dataField]);for(let t=e;t<e+s.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(o.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:s.row.getCell(s.column.dataField),rows:o,columns:d,row:s.row,column:s.column,endRow:o[o.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const r=s.row.getCell(s.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=r,r}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div"),o=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=s,e.appendChild(a),e.appendChild(n),n.setAttribute("content",""),a.setAttribute("indent",""),r.setAttribute("label",""),i.setAttribute("toggle-button",""),i.setAttribute("role","presentation"),i.setAttribute("aria-label","Expand/Collapse Row"),s.setAttribute("checkbox",""),s.setAttribute("role","checkbox"),s.setAttribute("aria-checked","false"),s.setAttribute("aria-label","Select Row"),l.setAttribute("has-toggle-button",""),n.appendChild(i),n.appendChild(s),o.classList.add("smart-input"),s.appendChild(o),d.checkBoxes.visible?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),n.appendChild(r),l.content=r}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let r=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(r=!0,e.row.filterRow&&(r=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(r=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(r=!1)),r)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group",""),e.setAttribute("role","gridcell");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let r=a.label;const n=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&n(e,i.children,l))}return l};let s="";if(void 0!==a.label){let o="",d=[];if(t.grouping.summaryRow.visible){let r=[];const s={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;c.length&&(r=n(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[])),s[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([s],r):null;if(m)for(let r=0;r<c.length;r++){const n=c[r];r>0&&(o+=", ");let u=m[l.dataField][n];const p=l.cellsFormat;if(void 0!==u){if(p&&(u=e.cell.getFormattedValue(u,p)),i){const i=t.columnByDataField[a.groupDataField];if(i){s[i.dataField]=c,m[i.dataField]=m[l.dataField],u=m[i.dataField][n];const t=i.cellsFormat;t&&(u=e.cell.getFormattedValue(u,t))}}o+=t.localize(n,{value:u}),m[l.dataField]&&m[l.dataField][n]&&d.push(m[l.dataField][n])}}}if(t.dataSource.virtualDataSourceOnExpand&&(o=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)r="<div header group-advanced><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let n="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e||t.label===e));t&&t.color?(n=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}else if("object"==typeof e&&e&&e instanceof Date){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,"d")}const s=t.editing.addNewRow.visible?'<span add-row class="smart-grid-icon smart-icon-plus-circled show"></span>':"";if(r=`<div style="${n}" header group-advanced><span group>${s}${i}: </span><span value>${e}</span>`,e=""+e,e&&e.indexOf(",")>=0){let t="";r=`<div style="display: flex;" header group-advanced><span group>${s}${i}: </span>`;let a=e.split(",");for(let e=0;e<a.length;e++){let i=a[e].trim();if(l&&l.editor&&l.editor.dataSource){const e=l.editor.dataSource.find((e=>e.value===i||e.label===i));e&&e.color?(n=`--smart-primary: ${e.color}`,e.label&&(i=e.label)):e&&e.label&&(i=e.label),t+=`<span style="${n}" value>${i}</span>`}}r+=t}o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=""+o,r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)r="<div header><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label;if(l.displayField!==l.dataField&&a.data.data&&(e=a.data.data[l.displayField]),"object"==typeof e&&l.cellsFormat){e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)}r="<div header><span group>"+i+": </span><span value>"+e+"</span>",o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("basic"===t.grouping.renderMode){if(r=a.label,l.displayField!==l.dataField&&a.data.data&&(r=a.data.data[l.displayField]),"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}else if("multipleColumns"===t.grouping.renderMode){if(r=a.label,"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),r=o;s=o}let o=e.firstChild;if(t.dataSource.boundHierarchy&&i){o.children.length<=1&&(e.innerHTML="<div></div>",o=e.firstChild,e._createToggleButton(o,e.cell),o=e.firstChild);const n=o.children[0],s=o.children[1].children[0],d=o.children[1].children[1].firstChild,c=o.children[1].children[2];n.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?s.classList.add("smart-visibility-hidden"):(s.classList.remove("smart-visibility-hidden"),a.expanded?s.setAttribute("toggled",""):s.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",n.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';n.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?s.classList.add("smart-hidden"):(s.classList.remove("smart-hidden"),s.style.marginLeft=""),n.innerHTML=m,c.innerHTML=r,i&&t.grouping.formatFunction){const i={row:a,column:l,groupDataField:a.groupDataField,cell:e.cell,value:r,data:a.data,template:null},n=t.grouping.formatFunction(i);n&&(i.value=n),i.value!==r?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:t._unescapeString(r)):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(o.innerHTML=r,l.summary.length&&t.grouping.summaryRow.inline&&r&&e.classList.remove("smart-hidden"));void 0!==a.label&&t.grouping.enabled&&i&&!l._treeColumn&&l.summary.length&&t.grouping.summaryRow.inline&&r&&(t.rightToLeft||e.style.left!==l.left+"px"&&(e.style.left=l.left+"px"),e.removeAttribute("has-toggle-button",""),r=s,o.innerHTML=r);let d="smart-label";e.style.zIndex="";const c=t.editing.addNewColumn.visible&&t._addNewColumn?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l&&(l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),l.summary.length&&t.grouping.summaryRow.inline&&r&&(e.style.width=l.computedWidth+"px",e.style.zIndex=11,e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign));if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),o.className!==d&&(o.className=d),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,data:null,group:{value:r,template:null}},i=l.formatFunction(t);if(i&&(t.group.value=i),t.group.value!==r)if(l._treeColumn){o.children[1].children[2].innerHTML=t.group.value}else o.innerHTML=t.group.value;null!==t.group.template&&(o.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const r=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:r,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:r,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:r,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:r,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:r,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:r,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:r,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:r,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:r,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:r,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]);const n=l._getFilterDataType(a);i="string"===n?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let s="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition||void 0===a._filterInfo.condition)a._filterInfo.condition="",s="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":s="smart-icon-equals";break;case"starts_with":s="smart-icon-starts-with";break;case"ends_with":s="smart-icon-ends-with";break;case"not_equal":s="smart-icon-not-equal";break;case"less_than":s="smart-icon-less-than";break;case"less_than_or_equal":s="smart-icon-less-than-or-equal";break;case"greater_than":s="smart-icon-greater-than";break;case"greater_than_or_equal":s="smart-icon-greater-than-or-equal";break;case"contains":s="smart-icon-contains";break;case"does_not_contain":s="smart-icon-does-not-contain";break;case"range":s="smart-icon-between";break;default:s="smart-icon-search"}let o=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${s} show"></i></div> `;if("string"===n)o+=`<input class="smart-filter-input-value" data-type="${n}" /> `,e.innerHTML=o;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;o+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=o,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)o+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=o,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const i=document.createElement("div");i.classList.add("smart-input"),i.classList.add("smart-grid-check-box-cell-editor"),i.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),i.setAttribute("checked","indeterminate"),a._filterInfo&&a._filterInfo.value?i.setAttribute("checked",""):a._filterInfo&&!1===a._filterInfo.value&&i.removeAttribute("checked"),o=i.outerHTML,e.innerHTML=o,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const d=e.querySelector("input");if(d&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),d.onpaste=function(e){setTimeout((()=>{l._handleFilterCellKeyUp(this.cell,e)}))}.bind(this),d.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),d.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),d.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),d.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=d,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&d&&(d.value=a._filterInfo.value,"date"===a.dataType&&(d.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),e.removeAttribute("disabled"),a.allowFilter||(d.disabled=!0,e.setAttribute("disabled","")),a.filterEditor||"multi"===a.filterMenuMode)if("multi"===a.filterEditor.template||"multi"===a.filterMenuMode){const t=document.createElement("div");t.className="smart-arrow-down",t.style.fontSize="16px",t.style.marginRight="4px",t.style.marginLeft="4px",t.style.alignSelf="center",t.style.cursor="pointer",t.onclick=function(e){l._handleFilterCellExcelIconClick(this.cell)}.bind(this),e.appendChild(t)}else if(a.filterEditor.template){const t=a.filterEditor.template,i=document.createElement("div");if(a.filterTemplate instanceof HTMLTemplateElement)i.appendChild(t.content.cloneNode(!0));else if(t instanceof HTMLElement)i.appendChild(t);else if("checkList"===t){const e=document.createElement("smart-drop-down-list");e.className="smart-filter-check-list",e.selectionMode="checkBox",e.filterable=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownAppendTo="body",e.dropDownButtonPosition="right",e.dataSource=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField),e.whenRendered((()=>{e.checkAll()})),a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember),e.onchange=()=>{const t=this.cell.column;if(e.selectedValues.length===e.dataSource.length)return t._filterInfo.value=null,e.close(),delete t._filterInfo.excelValues,void l.removeFilter(t.dataField);t._filterInfo.excelValues=e.selectedValues,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else if("list"===t||"dropDownList"===t||"select"===t){const e=document.createElement("smart-input");e.className="smart-filter-list",e.readonly=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownButtonPosition="right",a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember);let t=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField);t=[{label:"-",value:null}].concat(t),e.dataSource=t,e.onchange=()=>{this.cell.column._filterInfo.value=e.selectedValue,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else i.innerHTML=t;e.innerHTML="",e.appendChild(i),i.style.height="100%",i.style.width="100%";const r=e.querySelector("input");r&&(r.onfocus=()=>{e.setAttribute("focus","")},r.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,i)}else void 0!==a.filterEditor.min&&(d.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(d.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(d.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(d.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(d.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(d.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(d.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(d.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(t,l,a){const i=this,r=i.cell.grid,n=i.cell.column;r._cellCachedValues||(r._cellCachedValues=[]);const s=()=>!!r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML!==r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML=r._cellCachedValues[n.dataField+"_"+t]),i.cell._setStyle(a),i.setAttribute("template",i.cell.template),!0);let o=null;switch((!r.editing.enabled||!n.allowEdit||i.cell.readonly||"none"===r.editing.action||r.editing.enabled&&r.editing.commandColumn.visible&&r.editing.editRow!==i.cell.row)&&i.setAttribute("readonly",""),n.placeholder&&t===n.placeholder&&(t=""),l){case"checkBox":case"radioButton":case"switchButton":if(a.firstElementChild&&a.firstElementChild.classList&&a.firstElementChild.classList.contains("smart-input")){if(o=a.firstElementChild,t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),o.setAttribute("color","")}return void i.cell._setStyle(a)}if(o=document.createElement("span"),o.className="smart-input",t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color)}a.innerHTML="",a.appendChild(o),i.cell._setStyle(a);break;case"checklist":if(t&&t.indexOf("[")>=0&&(t=JSON.parse(t)),a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&e===t.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t&&Array.isArray(t)&&t.length>0){const e=t.filter((e=>e.completed)).length,l=["#D50000","#F4511E","#F6BF26","#33B679"],a=e+"/"+t.length;let i=l[0];e===t.length?i=l[3]:e>0&&e<t.length&&(i=l[2]),t=`<div style="display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${i}; width:16px; height: 16px;"><span title="${a}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${a}</span></div>`}else t="";o=document.createElement("span"),o.innerHTML=t,i.setAttribute("template",i.cell.template),o.setAttribute("value",t.length);break;case"createdBy":case"updatedBy":{const e=i.cell.row;let t=null,s=null;if(t="createdBy"===l?e.createdBy:e.updatedBy,e.history&&e.history.length&&(t="createdBy"===l?e.history[0].user:e.history[e.history.length-1].user),a.firstElementChild&&a.firstElementChild.hasAttribute("user-id")){if(t===parseInt(a.firstElementChild.getAttribute("user-id")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const l=a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild?a.firstElementChild.firstElementChild.firstElementChild.firstElementChild:null;if(l){a.firstElementChild.setAttribute("user-id",t);const i="string"==typeof e?e:e.name,r="string"==typeof e?null:e.color;if(("string"==typeof e?null:e.image)&&(l.firstElementChild.style.backgroundImage=`url('${e.image}')`),r){const e=new Smart.Color(r).getInvertedColor();l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",r),l.setAttribute("color",e),l.lastElementChild.textContent=i}else l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",""),l.setAttribute("color","");return}}}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id),d.style.width="100%",d.style.paddingRight="6px";let c='<div class="smart-flex smart-flex-auto smart-tokens-layout">';if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,i=document.createElement("span");if(a&&(i.style.backgroundImage=`url('${e.image}')`,i.className="smart-drop-down-list-selection-image"),l){c+='<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+'; overflow: visible;" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c+='<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c=""}d.innerHTML=c+"</div>";const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),o=m,o.setAttribute("user-id",t),i.setAttribute("template",i.cell.template);break}case"collaborator":case"tags":{let e=[];if("number"==typeof t&&(t=""+t),""===t||null===t||"uncategorized"===t){let e=`\n <div class="smart-multi-combo-input-container tokens smart-flex smart-flex-auto" data-field="${n.dataField}" row-id="${i.cell.row.id}"> \n <div class="smart-multi-combo-input" data-field="${n.dataField}" row-id="${i.cell.row.id}" class="tokens smart-flex smart-flex-auto">\n <div class=" smart-flex-auto smart-flex"></div>\n </div>\n </div>\n `;return a.innerHTML!==e&&(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild&&""===a.firstElementChild.firstElementChild.firstElementChild.textContent?(a.firstElementChild.setAttribute("row-id",i.cell.row.id),a.firstElementChild.firstElementChild.setAttribute("row-id",i.cell.row.id)):a.innerHTML=e),n.placeholder&&a.firstElementChild&&a.firstElementChild.firstElementChild&&(a.firstElementChild.firstElementChild.innerHTML=n.placeholder),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;if(null!==t&&(e=Array.isArray(t)?e.map((e=>e.trim())):t.indexOf("{")>=0||"[]"===t?JSON.parse(t):t.split(",").map((e=>e.trim()))),a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&n.editor._items&&n.editor._items[t]){if(a.firstElementChild.getAttribute("value")===t){i.cell._setStyle(a),i.setAttribute("template",i.cell.template);const e=n.editor.dots;if(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild){if(a.firstElementChild.firstElementChild.firstElementChild.classList.remove("smart-flex-wrap"),a.firstElementChild.firstElementChild.firstElementChild.firstElementChild){const t=a.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild;t&&(e?t.classList.add("dots"):t.classList.remove("dots"))}if(i.cell.row.height>45){a.firstElementChild.firstElementChild.firstElementChild.classList.add("smart-flex-wrap");const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1)for(let t=0;t<e.children.length;t++)e.children[t].style.maxWidth&&(e.children[t].style.maxWidth="")}else if(r.layout.rowHeight<=45&&i.cell.row.height<=45){const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1){const t=parseInt(n.computedWidth/e.children.length)-5;let l=0;for(let t=0;t<e.children.length;t++)l+=e.children[t].textContent.length,e.children[t].style.maxWidth="";if(14*l*.52+20*e.children.length>n.computedWidth)for(let l=0;l<e.children.length;l++)e.children[l].style.maxWidth=t+"px"}}}return}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id);let c='<div class="smart-tokens-layout smart-flex smart-flex-auto">';if(e.length>2&&i.cell.row.height>45){c='<div style="max-width: '+(n.computedWidth-10+"px")+'" class="smart-flex smart-flex-wrap">'}let m=0;if(t)for(let t=0;t<e.length;t++){const a=e[t];let i=null;if("collaborator"===l||n.editor&&n.editor.collaborator)i=r.users.find((e=>{if("string"==typeof a||"number"==typeof a){if(e.value===a||parseInt(e.value)===parseInt(a))return e;if(e.id===a||parseInt(e.id)===parseInt(a))return e}else if("object"==typeof a&&e.value===a.value)return e})),i&&(i.label=i.name);else{const e=n.editor.dataSource||n.options;if(e)if("string"==typeof a&&n.editor._items&&n.editor._items[a])i=n.editor._items[a];else{for(let t=0;t<e.length;t++){const l=e[t];if(void 0!==l.value&&void 0!==a&&void 0!==a.value&&l.value===a.value){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}if(void 0===l.value&&l===a||void 0!==l.value&&""+l.value===a){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}}n.editor.allowItemsAdd&&!i&&a&&(i=a)}else i=a}if(!i)continue;const s="string"==typeof i?i:i.label,o="string"==typeof i?null:i.color,d="string"==typeof i?null:i.image;if(""===s)continue;const u=document.createElement("span");d&&(u.style.backgroundImage=`url('${i.image}')`,u.className="smart-drop-down-list-selection-image");const p="smart-truncate";if(o&&n.editor.colorItems){const e=new Smart.Color(o).getInvertedColor(),t=n.editor.dots?" dots":"";c+='<span title="'+s+'" data-item="'+s+'" style="background: '+o+"; color: "+e+"; --smart-primary-color: "+e+'; overflow: visible;" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label"+t+'\' role="presentation">'+s+"</span>"}else c+='<span title="'+s+'" data-item="'+s+'" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>";m+=s.length;if(n.editor.dataSource||n.options){if(n.editor.singleSelect){c+="</span>";break}c+='<span class=\'smart-hidden smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else c+="</span>"}d.innerHTML=c+"</div>";const u=14*m*.52,p=d.firstElementChild;if(r.layout.rowHeight<=45&&i.cell.row.height<=45&&d&&p.children.length>1&&u+20*p.children.length>n.computedWidth){const e=parseInt(n.computedWidth/p.children.length)-5;for(let t=0;t<p.children.length;t++)p.children[t].style.maxWidth=e+"px"}if(d.style.width="100%",d.style.paddingRight="6px",d.onpointerdown=t=>{if(!r._mobile)if(t.target&&"#text"!==t.target.nodeName&&t.target.classList.contains("smart-drop-down-list-unselect-button")){let l=t.target.parentNode.getAttribute("data-item");const a=n.editor.dataSource||n.options;if(a&&"string"==typeof l&&a)for(let e=0;e<a.length;e++)a[e].label===l&&(l=a[e],l.value&&(l=l.value));if(e[0]&&e[0].label){const a=e.map((e=>e.value)).indexOf(l);if(a>=0){e.splice(a,1);const l=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,JSON.stringify(e)),r.onCellUpdate&&r.onCellUpdate([i.cell],[l],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(e.indexOf(l)>=0){e.splice(e.indexOf(l),1);const a=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,s),r.onCellUpdate&&r.onCellUpdate([i.cell],[a],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(t.target.classList.contains("smart-drop-down-list-selection-label")){if(r.editing.enabled&&r.editing.allowListOpenOnContentClick){const e=t.target.closest(".smart-multi-combo-input"),l=e.getAttribute("data-field"),a=e.getAttribute("row-id");r.beginEdit(a,l)}t.stopPropagation(),t.preventDefault()}},!n.cellsWrap&&n.allowEdit&&r.editing.enabled&&"card"!==r.view){let t=n.editor.dataSource&&n.editor.dataSource.length;n.editor.collaborator&&(t=r.users&&r.users.length);const l=document.createElement("div");t&&l.classList.add("items"),l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),l.appendChild(d),o=l}else if(n.cellsWrap||n.allowEdit){const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),t.appendChild(d),o=t}else d.classList.add("smart-flex-auto","smart-flex","tokens"),o=d;i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break}case"dropdownGrid":case"dropDownList":case"dropdownlist":case"list":{const e=document.createElement("div");if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(a.firstElementChild.getAttribute("value")===t&&!i.cell.column._isDirty)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if("dropdownGrid"!==i.cell.template){if(s()){const e=a.querySelector(".smart-arrow-down");return void(e&&(e.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}))}}if("dropdownGrid"===i.cell.template){const l=i.cell.column.templateSettings.dataFields;let a=i.cell.editor.dataSource?i.cell.editor.dataSource[t]:"";if(i.cell.column.relationId&&i.cell.column.relationField&&i.cell.column._isDirty&&(!i.cell.column.editor.dataSource||i.cell.column.editor.dataSource&&0===i.cell.column.editor.dataSource.length)){const e=r._getRelationData(i.cell.column.relationId,i.cell.column.relationField,i.cell.column.relationCascadingFields),l=r._getRelationColumns(i.cell.column.relationId);e&&(a=e[t]),i.cell.column.editor.columns=l,i.cell.column.editor.dataSource=e}if(e.classList.add("smart-flex","center"),e.style.alignItems="center",e.onmouseenter=()=>{e.querySelectorAll("i").forEach((e=>e.classList.add("show")))},e.onmouseleave=()=>{e.querySelectorAll("i").forEach((e=>e.classList.remove("show")))},a){e.style.justifyContent="space-between";let t="";for(let e=0;e<l.length;e++){const i=a[l[e]];i&&(t+='<span style="" class="smart-truncate smart-token smart-flex middle center ">'+i+"</span>")}e.innerHTML=t}else e.style.justifyContent="",e.innerHTML='<span class="smart-truncate"></span>'}else"card"===r.view?e.textContent=t:e.innerHTML='<span class="smart-truncate">'+t+"</span>";if(n.allowEdit&&r.editing.enabled&&"card"!==r.view){const t=document.createElement("span");t.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),e.classList.add("smart-flex-auto","smart-multi-combo-input"),l.appendChild(e),l.appendChild(t),l.classList.add(i.cell.template.toLowerCase()),o=l,t.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}}else o=e;i.setAttribute("template",i.cell.template.toLowerCase()),o.setAttribute("value",t);break}case"password":a.innerHTML=t?'<span class="smart-truncate">'+t.replace(/./g,"*")+"</span>":"",i.setAttribute("template",i.cell.template);break;case"richText":if(a.innerHTML=t?'<div class="textwrap" style="height: 100%; padding-top: 5px; padding-left: 5px;">'+r._unescapeString(t)+"</div>":"",r.layout.autoWrap&&i.cell.row.height>40&&1===i.cell.colSpan&&"string"===n.dataType){null==t&&(t="");if(14*t.length*.52>n.computedWidth){const e=parseInt(i.cell.row.height/20);a.firstElementChild.style["-webkit-line-clamp"]=e}}a.onpointerdown=e=>{if(!r._mobile&&r.editing.enabled){const t=r.offset(a);if(e.pageX>t.left+a.offsetWidth-20){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),i=l.getAttribute("data-id");delete r._beginEditKey,r.beginEdit(i,a)}}},o=a.firstElementChild,i.setAttribute("template",i.cell.template);break;case"color":a.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${t};"></span>`,i.setAttribute("template",i.cell.template);break;case"autoNumber":o=document.createElement("span"),o.innerHTML=1+i.cell.row.visibleIndex,i.setAttribute("template",i.cell.template);break;case"uuid":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}o=document.createElement("span"),o.style.paddingLeft="7px";const e=r._generateUUID(),l=i.cell.canNotify;i.cell.canNotify=!1,t||(i.cell.value=e,r.onCellUpdate&&!r.editing.editRow&&r.onCellUpdate([i.cell],[e],[e],(function(){r.onCellUpdated&&r.onCellUpdated([i.cell.row.index],[i.cell.row],[i.cell.column],[i.cell.row.data],[i.cell.value],[i.cell.value],i)}),i)),o.textContent=i.cell.value,i.cell.canNotify=l,i.setAttribute("template",i.cell.template),o.setAttribute("value",e);break}case"ai":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=(e,t)=>{const l=r.ai.url,a=r.ai.key;e.stopPropagation(),e.preventDefault();const i=e.target.closest("smart-grid-cell"),n=e.target.closest("smart-grid-row"),s=i.getAttribute("data-field"),d=n.getAttribute("data-id");t?(e.target.classList.remove("smart-icon-reload"),e.target.classList.add("smart-grid-loading")):e.target.classList.add("smart-grid-loading");let c=""+r.columnByDataField[s].AIQuery;r.columnByDataField[c]&&(c=""+r.getCellValue(d,c));for(let e=0;e<r.ai.promptVariables.length;e++){const t=r.ai.promptVariables[e],l=r.getCellValue(d,t.dataField)||"",a=new RegExp(`{{${t.name}}}`,"g");c=c.replace(a,l)}c=c.trim(),c=c.replaceAll("\n"," "),c=c.replaceAll("\r"," "),c=c.replaceAll(" "," "),c=c.substring(0,2e3),c&&l&&a?async function(e){e+="\nRespond in less than "+r.ai.maxResponseLength+" words.",e+="\nOutput always in plain text.";const t=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({model:r.ai.model,messages:[{role:"user",content:e}],max_tokens:r.ai.maxTokens,temperature:r.ai.temperature})});if(!t.ok)throw new Error(`Error: ${t.statusText}`);return(await t.json()).choices[0].message.content.trim()}(c).then((e=>{const t=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");r.setCellValue(d,s,t),o.setAttribute("value",t)})).catch((e=>{console.error("Error:",e)})):(r.setCellValue(d,s,r.localize("noResults")),o.setAttribute("value",r.localize("noResults")))};if(t){o=document.createElement("span"),o.style.paddingLeft="7px",o.classList.add("smart-flex");const l=i.cell.canNotify;i.cell.canNotify=!1,o.textContent=i.cell.value,i.cell.canNotify=l;const a=document.createElement("span");o.appendChild(a),a.classList.add("smart-grid-icon","show","smart-icon-reload"),a.style.position="absolute",a.style.right=a.style.top="0px",a.onpointerdown=t=>{e(t,!0)},i.setAttribute("template",i.cell.template),o.setAttribute("value",t)}else o=document.createElement("div"),o.classList.add("smart-flex","center","middle"),o.style.height="100%",o.innerHTML=`<button style="border-radius: 10px; line-height: 13px; height: 30px; padding-inline: 30px; padding-block: 2px;" class="smart-button" type="button">✨︎ ${r.localize("generate")}</button\n `,o.firstElementChild.onpointerdown=t=>{e(t)},i.setAttribute("template",i.cell.template);break}case"createdDate":case"createdTime":{const e=i.cell.row;let t=e.createdDate;if(s())return;e.history&&e.history[0]&&(t=e.history[0].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("created-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span created-date class="align-left smart-truncate">'+l+" "+r+"</span>";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break}case"updatedDate":case"updatedTime":if(s())return;if(i.cell.row.updatedDate){const e=i.cell.row;let t=e.updatedDate;e.history&&(t=e.history[e.history.length-1].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("updated-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span updated-date class="align-left smart-truncate">'+l+" "+r+"</span>"}else a.innerHTML="";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break;case"progress":{const e=t?parseInt(100*t)+"%":"0%";if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const l="white",r=["#D50000","#F4511E","#F6BF26","#33B679"];let s=r[0];if(s=t<.25?r[0]:t<.5?r[1]:t<.75?r[2]:r[3],n.templateSettings){if(n.templateSettings.getComputedValue){const e=n.templateSettings.getComputedValue(i.cell.row.data,i.cell.row,i.cell.column,t);t=e}if(n.templateSettings.conditions){for(let e=0;e<n.templateSettings.conditions.length;e++){const l=n.templateSettings.conditions[e];null!==l.value&&t>=l.value&&(s=l.color)}let l=0,r=1;void 0!==n.templateSettings.min&&(l=n.templateSettings.min),void 0!==n.templateSettings.max&&(r=n.templateSettings.max);const o=t/(r-l)*100;return a.innerHTML=`\n <div style="height: 40%; top: 30%; position: relative; left: 5%; right:5%; width: 90%; overflow:hidden; border-radius: 8px; background: var(--smart-surface); border: 1px solid var(--smart-border);" class="smart-grid-progress-container" role="progressbar" \n aria-valuemin="0" aria-valuemax="100" aria-valuenow="${t}" \n aria-label="Progress: ${e}" tabindex="0">\n <div class="smart-grid-progress-fill" style="height: 100%; width: ${o}%; background: ${s};">\n </div>\n </div>\n `,void i.setAttribute("template",i.cell.template)}}a.innerHTML='<div value="'+e+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+e+';"><div title="'+e+'" style="width: 100%; height: 4px; background: '+s+"; color: "+l+';" class="smart-truncate smart-token"></div></div><span>'+e+"</span></div>",i.setAttribute("template",i.cell.template);break}case"rating":{const e=i.cell.column.editor.max?i.cell.column.editor.max:5,l=t?parseInt(t):0;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(l===parseInt(a.firstElementChild.getAttribute("value")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);a.firstElementChild.setAttribute("value",l);for(let t=0;t<e;t++){const e=a.firstElementChild.children[t];let i="";l>0&&l>t&&(i="value"),i?e.classList.add("value"):e.classList.remove("value")}return void i.setAttribute("template",i.cell.template)}const n=t=>{let l="";for(let a=0;a<e;a++){let e="";t>0&&t>a&&(e="value"),l+=`<div rating-value title="${a+1}" value="${a+1}" class="smart-grid-icon show smart-icon-star ${e}"></div>`}return l};a.innerHTML=`<div value="${l}" class="rating">${n(l)}</div>`;const s=e=>{if(!r._mobile&&e.hasAttribute("rating-value")){const t=e.getAttribute("value"),l=e.closest("smart-grid-cell"),a=e.closest("smart-grid-row");if(l&&a){const e=l.querySelector(".rating"),s=a.getAttribute("data-id"),o=l.getAttribute("data-field"),d=r.rowById[s],c=r.getCellValue(s,o),m=l.cell;let u=null;r.storeHistory&&(u=r._stringifyRow(d)),c===t?(a.row.data[o]=0,e.innerHTML=n(0),e.setAttribute("value",0)):(a.row.data[o]=parseInt(t),e.innerHTML=n(parseInt(t)),e.setAttribute("value",t));const p=a.row.data[o];r._setCellUndoRedo(m,c,p),r.onCellUpdate&&r.onCellUpdate([m],[c],[p],(function(e){r.onCellUpdated&&r.onCellUpdated([m.row.index],[m.row],[m.column],[m.row.data],[c],[p],i),r._onCellUpdated&&r._onCellUpdated(m.row.index,m.row,m.column,m.row.data,c,p)}),i);const g=e=>{if(e!==c&&(d.updatedDate=new Date,d.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(d);t[m.column.dataField]=e,r._updateRowHistory(d,u,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p);const f=l.querySelector(".rating"),h=parseInt(t)-1;f.children[h].classList.add("down"),setTimeout((()=>{f.children[h].classList.remove("down")}),1e3)}}},o=(e,t=!0)=>{if(e&&[...e.querySelectorAll(".smart-icon-star")].forEach((e=>{e.classList.remove("hover")})),e.hasAttribute("value")){const l=[...e.parentElement.children],a=l.indexOf(e);l.forEach(((e,l)=>{e.classList.remove("hover"),l<=a&&t&&e.classList.add("hover")}))}};r.editing.enabled?(r.handleRatingClick||(r._handleRatingMove=o,r._handleRatingClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointermove=e=>{o(e.target)},a.firstElementChild.onpointerleave=e=>{o(e.target)}):a.firstElementChild.style.pointerEvents="none",i.setAttribute("template",i.cell.template);break}case"vote":{let e=t;const l=(e,t)=>{const l=e.firstElementChild.firstElementChild,a=r.users?r.users.length:1,i=t.length*(100/a)+"%",n=t.length>0?"voted":"",s=l.firstElementChild,o=s.children[0];l.children[1].children[0].classList.remove("smart-votes-bar-animate"),r.isScrolling||l.children[1].children[0].classList.add("smart-votes-bar-animate");const d=l.children[1].firstElementChild.children[0],c=l.children[2];s.classList.remove("voted"),o.classList.remove("smart-icon-check"),n&&(o.classList.add("smart-icon-check"),s.classList.add("voted")),c.textContent=t.length,d.style.width=i,e.firstElementChild.setAttribute("value",t)};if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const t=a.firstElementChild.getAttribute("value"),r=a.firstElementChild;return r.removeAttribute("color"),r.style.setProperty("--smart-check-template-color","var(--smart-primary)"),r.style.setProperty("--smart-check-template-forecolor","#ffffff"),i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(r.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),r.setAttribute("color","")),e=e?e.split():[],l(a,e),e===t?(i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)):(a.firstElementChild.setAttribute("value",e),void i.setAttribute("template",i.cell.template))}const n=e=>{e&&!Array.isArray(e)&&(e=e?e.split():[]);const t=r.users?r.users.length:1,l=e.length*(100/t)+"%;";return`<div vote-value class="smart-flex middle center smart-votes-cell-component">\n <div class="smart-flex middle center smart-vote-button ${e.length>0?"voted":""}">\n <span class="smart-icon smart-grid-icon show ${e.length>0?"smart-icon-check":""}"></span>\n </div>\n <div class="smart-votes-bar-container">\n <div class="smart-votes-bar-component">\n <div class="smart-votes-bar" style="width: ${l} opacity: 1;"></div>\n <div class="smart-votes-bar-frame" style="width: 100%; opacity: 0.2;"></div>\n </div>\n </div>\n <div class="smart-voters-info">${e.length}</div>\n </div>`};a.innerHTML=`<div value="${e}" class="vote">${n(e)}</div>`,i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(o=a.firstElementChild,o.style.setProperty("--smart-check-template-forecolor","#ffffff"),o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color));const s=(e,t,a)=>{if(r._mobile)return;const n=e.closest("smart-grid-cell"),s=e.closest("smart-grid-row"),o=(e,t)=>{const a=r.rowById[e],o=r.getCellValue(e,t),d=n.cell;let c=null;r.storeHistory&&(c=r._stringifyRow(a));const m=o?o.split(","):[],u=r._currentUser?""+r._currentUser.info.id:null;if(void 0===u)return;m.indexOf(u)>=0?(m.splice(m.indexOf(u),1),s.row.data[t]=m.toString(),l(n.firstElementChild,m)):(m.push(u),s.row.data[t]=m.toString(),l(n.firstElementChild,m));const p=s.row.data[t];r._setCellUndoRedo(d,o,p),r.onCellUpdate&&r.onCellUpdate([d],[o],[p],(function(){r.onCellUpdated&&r.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[p],i),r._onCellUpdated&&r._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,p)}),i);const g=e=>{if(e!==o&&(a.updatedDate=new Date,a.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(a);t[d.column.dataField]=e,r._updateRowHistory(a,c,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p)};if(n&&s){o(s.getAttribute("data-id"),n.getAttribute("data-field"))}else null!==t&&null!==a&&o(t,a)};r._handleVoteClick||(r._handleVoteClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointerenter=e=>{const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row");if(t&&l){const i=l.getAttribute("data-id"),n=t.getAttribute("data-field");let s=r.getCellValue(i,n);if(s){if(r.users){let e="";s=s.split(),r.users.forEach((t=>{(s.indexOf(""+t.id)>=0||s.indexOf(""+t.value)>=0)&&(e+=t.name||t.label)})),e&&(s=r.localize("votes",{value:e}))}}else s=r.localize("noVotes");r._createTooltip(e,s,a,"top")}},a.firstElementChild.onpointerleave=()=>{r._cellTooltip&&(r._cellTooltip.style.visibility="hidden")},i.setAttribute("template",i.cell.template);break}case"duration":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t){const e=864e5;let l="MMM dd",n="MMM dd";if("string"==typeof t[0]&&(Array.isArray(t)?(t[0]=new Date(t[0]),t[1]=new Date(t[1])):((t=t.split(","))[0]=new Date(t[0]),t[1]=new Date(t[1]))),Array.isArray(t)){t[0]&&"string"==typeof t[0]&&(t[0]=new Date(t[0])),t[1]&&"string"==typeof t[1]&&(t[1]=new Date(t[1])),t[1]&&t[1].getMonth()===t[0].getMonth()&&(n="dd"),t[0]&&t[0].getFullYear()!==(new Date).getFullYear()&&(l+=", yyyy","dd"===n?(l="MMM dd",n+=", yyyy"):n=l);let s=!1;t[0]&&(0===t[0].getHours()&&0===t[0].getHours()||(l+=" hh:mm","dd"===n?n=l:n+=" hh:mm",s=!0));let o=null;o=Math.round(t[1].getTime()-t[0].getTime())/e;const d=o?parseInt(Math.abs(o).toFixed(0)):0;if(d>0){const e=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],n);let s="";s=r.localize("days",{value:d}),a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${e}</span><span style="font-size: 11px;" class="smart-quiet">${s}</span></div>`}else{let e="";if(s){const r=t[1]-t[0],n=Math.floor(r%864e5/36e5);let s=Math.round(r%864e5%36e5/6e4);s<10&&(s+="0"+s),e=n+":"+s;const o=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],"hh:mm");a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${o}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else{const r=i.cell.getFormattedValue(t[0],l);a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${r}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}}}}else a.innerHTML="";i.setAttribute("template",i.cell.template),a.firstElementChild&&a.firstElementChild.setAttribute("value",e);break}case"startDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;let l=t;if(n.cellsFormat?l=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(l=i.cell.getFormattedValue(t,n.formatSettings.Intl)),t){const e=864e5,s="string"==typeof t?new Date(t):t;let o=r.columnByDataField.taskDueDate;n.editor.boundDateField?o=r.columnByDataField[n.editor.boundDateField]:n.relationField&&(o=r.columnByDataField[n.relationField]);let d=o?i.cell.row.data[o.dataField]:"";d&&"string"==typeof d&&(d=new Date(d));let c=null;d&&(c=Math.round(s.getTime()-d.getTime())/e);const m=c?parseInt(Math.abs(c).toFixed(0)):0;if(m>0){let e="";e=r.localize("days",{value:m}),a.innerHTML=`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto 25px"><span style="color: var(--smart-primary);" title="${e}" class="smart-icon-clock smart-grid-icon show"></span><span>${l}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else a.innerHTML='<div style="padding-left: 7px;">'+l+"</div>"}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"dueDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;const l=["#D50000","#F4511E","#F6BF26","#33B679"],o=n.editor.date||(n.templateSettings&&n.templateSettings.date?n.templateSettings.date:new Date)||new Date;o.setHours(0,0,0);let d=t;n.cellsFormat?d=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(d=i.cell.getFormattedValue(t,n.formatSettings.Intl));const c=(e,t)=>{const l=e<=8?e/8:1;return`<div title="${t}" class="smart-element smart-circular-progress-bar" style="background: inherit; padding-left:4px; position: relative; top: calc(50% - 12px); padding-top:4px; width: 20px; height: 20px;">\n <div class="smart-container">\n <svg style="left: 0px; top: 0px; background: var(--smart-background);"width="100%" height="100%" viewPort="0 0 100 100" viewBox="0 0 100 100" role="presentation" aria-hidden="true">\n <circle id="value" class="smart-value-path" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n <circle id="value" style="stroke-dashoffset: ${100*Math.PI-(1-l)*Math.PI*100}; stroke-width: 100%;" class="smart-value" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n </svg>\n </div>\n </div>\n `};if(t){const s=864e5,m="string"==typeof t?new Date(t):t,u=Math.round(m.getTime()-o.getTime())/s,p=parseInt(Math.abs(u).toFixed(0));let g=r.columnByDataField.taskStatus;n.editor.boundDataField?g=r.columnByDataField[n.editor.boundDataField]:n.relationField&&(g=r.columnByDataField[n.relationField]);const f=g?i.cell.row.data[g.dataField]:"";if("done"===f||"complete"===f||"completed"===f||"finished"===f||!0===f||"done"===(""+f).toLowerCase()||"complete"===(""+f).toLowerCase()||"completed"===(""+f).toLowerCase()||"finished"===(""+f).toLowerCase()||1===f||"1"===f){let e=r.localize("done");a.innerHTML=`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${l[3]}; width:16px; height: 16px;"><span title="${e}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${d}</span></div>`}else{let t="";t=0===p?r.localize("today"):1===p?e<o?r.localize("yesterday"):r.localize("tomorrow"):e<o?r.localize("daysOverdue",{value:p}):r.localize("daysLeft",{value:p}),a.innerHTML=e>=o?`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto">${c(p,t)}<span>${d}</span></div>`:`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto"><span title="${t}" style="font-size: 16px; color: ${l[0]}" class="smart-grid-icon show smart-icon-attention-circled"></span>${d}</span></div>`}t=t+"_"+f}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"attachments":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="attachments"><div title="${r.localize("addFiles")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return a.innerHTML!==e&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div");e.classList.add("file-container"),l.classList.add("attachments");let n=t;if(r._findIsFile(n)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}if("string"==typeof n&&(n.indexOf("[{")>=0||n.indexOf("}]")>=0)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}Array.isArray(n)&&n.forEach((t=>{const l=document.createElement("div");l.title=t.label,l.classList.add("item"),l.innerHTML="<div></div>",l.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.label||(t.label=""),t.label.indexOf("png")>=0||t.label.indexOf("jpg")>=0||t.label.indexOf("jpeg")>=0||t.label.indexOf("gif")>=0?l.firstElementChild.classList.add("smart-icon-image"):t.label.indexOf(".pdf")>=0?l.firstElementChild.classList.add("smart-icon-pdf"):t.label.indexOf(".tsv")>=0||t.label.indexOf(".txt")>=0||t.label.indexOf(".csv")>=0?l.firstElementChild.classList.add("smart-icon-text"):t.label.indexOf(".xls")>=0||t.label.indexOf(".xlsx")>=0?l.firstElementChild.classList.add("smart-icon-excel"):t.label.indexOf(".ppt")>=0?l.firstElementChild.classList.add("smart-icon-powerpoint"):t.label.indexOf(".zip")>=0||t.label.indexOf(".rar")>=0||t.label.indexOf(".7z")>=0?l.firstElementChild.classList.add("smart-icon-archive"):t.label.indexOf(".doc")>=0||t.label.indexOf(".docx")>=0?l.firstElementChild.classList.add("smart-icon-word"):t.label.indexOf(".mp3")>=0?l.firstElementChild.classList.add("smart-icon-music"):t.label.indexOf(".mp4")>=0||t.label.indexOf(".avi")>=0||t.label.indexOf(".mov")>=0||t.label.indexOf(".mp4")>=0||t.label.indexOf(".mpeg")>=0||t.label.indexOf(".webm")>=0||t.value&&t.value.indexOf("youtube")>=0?l.firstElementChild.classList.add("smart-icon-video"):l.firstElementChild.classList.add("smart-icon-file"),e.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");d.classList.add("smart-arrow-right","arrowbtn");const c=document.createElement("div");if(c.classList.add("smart-icon-plus","smart-grid-icon","show"),c.title=r.localize("addFiles"),"card"!==r.view&&l.appendChild(c),l.onpointerdown=t=>{if(t.target.classList.contains("attachment")){const e=JSON.parse(i.cell.value),a=[...l.children[1].children],n=a&&a.indexOf?a.indexOf(t.target.parentNode):-1;if(e[n]){const t=document.createElement("a");if(e[n].value.indexOf(window.location.host)>=0)fetch(e[n].value).then((e=>e.blob())).then((l=>{const a=URL.createObjectURL(l);t.download=e[n].label,t.href=a,t.click()}));else{if(e[n].value.indexOf("base64")>=0){const l=r._getFileFromBase64(e[n].value);t.href=URL.createObjectURL(l)}else t.href=e[n].value;t.target="_blank",t.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=s===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.children.length){if(l.appendChild(e),"card"!==r.view){const t=25*n.length;t-i.offsetWidth+30>30&&(l.appendChild(s),l.appendChild(d)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",s.classList.add("smart-hidden"),a<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),a>30&&(l.appendChild(s),l.appendChild(d))}}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):n&&n[0]&&n[0].label?o.setAttribute("value",n[0].label):o.setAttribute("value",t);break}case"images":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="images"><div title="${r.localize("addImages")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return e!==a.innerHTML&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(!r._recycleFiles&&a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div"),s=document.createDocumentFragment();e.classList.add("file-container"),l.classList.add("images");let d=t;if(r._findIsFile(d)){let e="";if(d&&d.indexOf("{")>=0)try{e=JSON.parse(d)}catch(e){console.log(e)}else e=d.split(","),e=e.map((e=>({label:e,value:e})));d=e}if("string"==typeof d&&(d.indexOf("[{")>=0||d.indexOf("}]")>=0)){let e="";if(d)try{e=JSON.parse(d)}catch(e){console.log(e)}d=e}else"string"==typeof d&&d.indexOf("./")>=0&&(d=d.split(","),d=d.map((e=>({label:e,value:e}))));Array.isArray(d)&&d.forEach((e=>{if(e.label||(e.label=""),e.label.indexOf(".mp4")>=0||e.label.indexOf(".avi")>=0||e.label.indexOf(".mov")>=0||e.label.indexOf(".mp4")>=0||e.label.indexOf(".mpeg")>=0||e.label.indexOf(".webm")>=0||e.value&&e.value.indexOf("youtube")>=0){const t=document.createElement("div");t.title=e.label,t.classList.add("item"),t.innerHTML="<div></div>",t.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.firstElementChild.classList.add("smart-icon-video"),s.appendChild(t)}else{const t=document.createElement("img");t.style.display="none";let l="";l=e.label.indexOf(".gif")>=0?e.value:e.small?e.small:e.medium?e.medium:e.large?e.large:e.value,t.onload=()=>{t.style.display=""},l.indexOf("base64")>=0?t.src=l:(r._imagesCache||(r._imagesCache=[]),r.uploadSettings.url?r._imagesCache[l]?r._findUserFile(e)&&(t.src=l):(r._imagesCache[l]=!0,t.style.display="none",r._findUserFile(e)?(t.src=l,t.style.display=""):l&&l.startsWith("https://")&&(t.src=l)):t.src=l,t.onerror=()=>{t.style.display="none"}),t.title=e.label,t.setAttribute("data-url",e.large||e.value),s.appendChild(t)}}));const c=document.createElement("div");c.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const m=document.createElement("div");m.classList.add("smart-arrow-right","arrowbtn");const u=document.createElement("div");u.classList.add("smart-icon-plus","smart-grid-icon","show"),u.title=r.localize("addImages");const p=document.createElement("div");if(p.classList.add("smart-navigation"),"card"!==r.view&&r.editing.enabled&&n.allowEdit&&l.appendChild(u),l.onpointerdown=t=>{if("IMG"===t.target.nodeName&&("card"!==r.view&&[...e.children].forEach((e=>e.classList.remove("smart-hidden"))),r._openImagePreviewDialog(t.target),t.stopPropagation(),t.preventDefault()),t.target.classList.contains("attachment")){const l=JSON.parse(i.cell.value),a=[...e.children].indexOf(t.target.parentNode);if(l[a]){const e=document.createElement("a");if(l[a].value.indexOf(window.location.host)>=0)fetch(l[a].value).then((e=>e.blob())).then((t=>{const i=URL.createObjectURL(t);e.download=l[a].label,e.href=i,e.click()}));else{if(l[a].value.indexOf("base64")>=0){const t=r._getFileFromBase64(l[a].value);e.href=URL.createObjectURL(t)}else e.href=l[a].value;e.target="_blank",e.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("smart-navigation-item")){[...p.children].forEach((e=>e.classList.remove("active"))),t.target.classList.add("active"),[...e.children].forEach((e=>e.classList.add("smart-hidden")));const l=[...p.children].indexOf(t.target);e.children[l].classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=c===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?c.classList.add("smart-hidden"):c.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.appendChild(s),e.children.length){if(l.appendChild(e),"card"===r.view&&l.appendChild(p),"card"!==r.view){const t=25*d.length;t-i.offsetWidth+30>30&&(l.appendChild(c),l.appendChild(m)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",c.classList.add("smart-hidden"),a<0?m.classList.add("smart-hidden"):m.classList.remove("smart-hidden"),a>30&&(l.appendChild(c),l.appendChild(m))}}else{for(let t=0;t<e.children.length;t++){const l=document.createElement("div");l.classList.add("smart-navigation-item"),0===t?l.classList.add("active"):e.children[t].classList.add("smart-hidden"),p.appendChild(l)}1===e.children.length&&p.classList.add("smart-visibility-hidden")}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):d&&d[0]&&d[0].label?o.setAttribute("value",d[0].label):o.setAttribute("value",t);break}case"email":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;o=document.createElement("span"),null===t||""===t?o.innerHTML="":Smart.Validator.email(t)?o.innerHTML=t:(o.className="url center middle",o.innerHTML='<a href="mailto:'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()}))}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"url":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;const l=e=>{e.classList.add("center","middle"),null===t||""===t?e.classList.add("smart-hidden"):Smart.Validator.url(t)?(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="https://'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden")):(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden"))};a.firstElementChild&&a.firstElementChild.classList.contains("url")?(o=a.firstElementChild,l(o)):(o=document.createElement("span"),o.className="url",l(o)),o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()})}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"sparklines":{const l=t,o=""+n.computedWidth;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value"),t=a.firstElementChild.getAttribute("width"),n=a.firstElementChild.getAttribute("height"),s=i.cell.row.cellHeight||r.layout.rowMinHeight;if(l===e&&t===o&&s===n)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const d=(e,t,l)=>{if(!1===c.tooltip)return;const a=e.pageX,i=e.pageY-10;if(!r._sparklineTooltip){const e=document.createElement("smart-button");e.classList.add("secondary"),e.style.boxShadow="var(--smart-elevation-4)",e.style.opacity=.9,e.style.transition="all cubic-bezier(0.6, 0.2, 0, 0.8) 0.2s",document.body.appendChild(e),e.style.position="absolute",e.style.zIndex=999,r._sparklineTooltip=e}const n=r._sparklineTooltip;n.innerHTML===t&&n.element===l||(n.style.top=i+25+"px",n.style.left=a-15+"px"),n.innerHTML=""+t,n.style.display=""},c=n.templateSettings,m=()=>{a.onmousemove=e=>{if("column"!==c.type&&"bar"!==c.type||a.querySelectorAll("rect").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&l.top<=e.clientY&&e.clientY<=l.bottom&&(t.setAttribute("highlight",""),d(e,t.getAttribute("data-title"),t))})),"pie"===c.type){let t=!1;a.querySelectorAll("path").forEach((l=>{var a=l.getBoundingClientRect();l.removeAttribute("highlight"),t||a.left<=e.clientX&&e.clientX<=a.right&&a.top<=e.clientY&&e.clientY<=a.bottom&&(l.setAttribute("highlight",""),t=!0,d(e,l.getAttribute("data-title"),l))}))}"line"===c.type&&a.querySelectorAll("line").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&(t.previousElementSibling&&(t.previousElementSibling.style.display="none"),t.nextElementSibling&&(t.nextElementSibling.style.display="none"),t.setAttribute("highlight",""),l.left+l.width/2>=e.clientX?t.previousElementSibling&&(t.previousElementSibling.style.display="",d(e,t.previousElementSibling.getAttribute("data-title"),t.previousElementSibling)):t.nextElementSibling&&(t.nextElementSibling.style.display="",d(e,t.nextElementSibling.getAttribute("data-title"),t.nextElementSibling)))}))},a.onmouseleave=()=>{r._sparklineTooltip&&(r._sparklineTooltip.style.display="none"),a.querySelectorAll("rect").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("path").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("line").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("circle").forEach((e=>{e.style.display="none"}))}};if(s())return void m();const u=new e,p=i.cell.row.cellHeight||r.layout.rowMinHeight;if(p>=7)if(i._sparklinesRender&&cancelAnimationFrame(i._sparklinesRender),t){const e=u.render({width:o-10,height:Math.max(0,p-7),points:t,colors:c.colors,type:c.type,gap:c.gap,max:c.max,min:c.min,padding:c.padding,roundedCorners:c.roundedCorners,strokeWidth:c.strokeWidth,colorFunction:c.colorFunction,tooltipFormatFunction:c.tooltipFormatFunction});a.innerHTML=`<div height="${p}" width="${o}" value="${l}" style="padding-top: 5px; padding-left: 5px; padding-right: 5px;">${e}</div>`,m()}else a.innerHTML="",a.onmousemove=a.onmouseleave=null;i.setAttribute("template",i.cell.template);break}default:{let e=null;i.setAttribute("template","");const l=i.cell.row,s=a;let o=i.cell.getFormattedValue(t,n.cellsFormat);if(s.style.lineHeight="","function"==typeof i.cell.template){const e={row:l,column:n,cell:i.cell,oldValue:i.cell.oldValue,value:t,data:l.data,template:null},a=i.cell.column.templateSettings.React||r.React,d=i.cell.column.templateSettings.ReactDOM||r.ReactDOM;if(i.cell.column.templateSettings&&a&&d){return void d.createRoot(s).render(a.createElement(i.cell.template,e))}let c=s.querySelector(".smart-grid-cell-template");const m=l.id;r.isHScrolling&&(r._cachedTemplates||(r._cachedTemplates=[]),c&&0===c.innerHTML.length&&(c=null),!c&&r._cachedTemplates&&r._cachedTemplates[n.dataField+"_"+m]&&(0===r._cachedTemplates[n.dataField+"_"+m].innerHTML.length?delete r._cachedTemplates[n.dataField+"_"+m]:e.template=r._cachedTemplates[n.dataField+"_"+m])),c&&c.getAttribute("column")===n.dataField?e.template=c.firstElementChild:c=null,i.formattedValue!==o&&(c=null),i.cell.canNotify=!1,l.canNotify=!1;const u=Object.assign({},{background:i.cell.background,color:i.cell.color,fontSize:i.cell.fontSize,fontFamily:i.cell.fontFamily,fontWeight:i.cell.fontWeight,textDecoration:i.cell.textDecoration,fontStyle:i.cell.fontStyle});if(i.cell.template(e),!c&&e.template)if(e.template instanceof HTMLElement){const t=document.createElement("div");t.classList.add("smart-grid-cell-template"),t.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(t),t.appendChild(e.template)}else s.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+e.template+"</div>";else c||null!==e.template||(s.innerHTML=t);if(r.isHScrolling&&!r._cachedTemplates[n.dataField+"_"+m]&&s.firstElementChild.firstElementChild){const e=s.firstElementChild.firstElementChild;e&&(r._cachedTemplates[n.dataField+"_"+m]=e)}s.style.background===u.background&&s.style.color===u.color&&s.style.fontSize===u.fontSize&&s.style.fontWeight===u.fontWeight&&s.style.fontStyle===u.fontStyle||(i.cell._styleChanged=!0,i.cell._setStyle(s)),i.cell.background!==u.background||i.cell.color!==u.color||i.cell.fontSize!==u.fontSize||i.cell.fontWeight!==u.fontWeight||i.cell.fontStyle!==u.fontStyle?(i.cell._styleChanged=!0,i.cell._setStyle(s)):i.cell._styleChanged&&i.cell._setStyle(s),void 0===i.cell.oldValue&&(i.cell.oldValue=t),i.formattedValue=o,i.cell.canNotify=!0,l.canNotify=!0}else if(Array.isArray(i.cell.template)){const e=document.createElement("div");if(s.firstElementChild&&s.firstElementChild.classList.contains("smart-grid-cell-template"))for(let e=0;e<i.cell.template.length;e++){const t=s.firstElementChild.children[e].firstElementChild,a=i.cell.template[e];if(a.length>1&&t){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t.src&&t.src!==e?(i._imageUpdateTimer&&clearTimeout(i._imageUpdateTimer),i._imageUpdateTimer=setTimeout((()=>{t.src=e}),50)):t.textContent!==e&&(t.textContent=e)}}else{e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(e);let t="";for(let e=0;e<i.cell.template.length;e++){const a=i.cell.template[e];if(a.length>1){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t+='<span class="smart-template-part">'+a[0].replaceAll("{{value}}",e)+"</span>"}}e.innerHTML=t}}else{if(""!==s.textContent&&(s.textContent=""),i.cell.template instanceof HTMLTemplateElement)e=i.cell.template;else if(i.cell.template instanceof HTMLElement){const e=i.cell.template.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);s.innerHTML!==e&&(s.innerHTML=e)}else if("function"==typeof i.cell.template&&i.cell.template.prototype&&"undefined"!=typeof ngApp){const e=ngApp.injector,l=e.get(ComponentFactoryResolver).resolveComponentFactory(i.cell.template),a=s.appendChild(l.create(e));return a.instance.value=t,void a.changeDetectorRef.detectChanges()}if(i.cell.template.startsWith&&i.cell.template.startsWith("#")&&(e=document.querySelector(i.cell.template)),e){let a=e.content.cloneNode(!0).firstElementChild;const d=t;if(t=(t=(t=t.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),a.querySelector("[smart-if]")){const e=a.querySelector("[smart-else]"),l=a.querySelectorAll("[smart-if]");let i=!1;for(let e=0;e<l.length;e++){const r=l[e],s=r.getAttribute("smart-if"),o=s.split(" "),c=o[1].trim();let m=o[2].trim();s.indexOf("'")>=0&&(m=s.substring(s.indexOf("'")+1),m=m.replaceAll("'",""));let u=t;switch("Today"===m&&(m=new Date),"date"===n.dataType&&(t=new Date(d).getTime(),m=new Date(m).getTime()),c){case">":t>parseFloat(m)&&(a=r,i=!0);break;case">=":t>=parseFloat(m)&&(a=r,i=!0);break;case"=":case"==":case"===":t===m&&(a=r,i=!0);break;case"<":t<parseFloat(m)&&(a=r,i=!0);break;case"<=":t<=parseFloat(m)&&(a=r,i=!0)}if(t=u,i)break}!i&&e&&(a=e)}let c=a.outerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);for(c.indexOf("{{value=")>=0&&(t?(c=c.substring(0,c.indexOf("{{value="))+t+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const e=c.indexOf("{{value::"),l=c.substring(e+9,c.indexOf("}}")),a=i.cell.getFormattedValue(t,l);c=c.replace(`{{value::${l}}}`,a)}if(n._treeColumn){const e=s.firstChild;if(e&&e.classList&&i.toggleButton&&n._treeColumn&&s.children[1]){const e=s.children[0],t=s.children[1].children[0],a=s.children[1].children[1].firstChild,i=s.children[1].children[2];let n="";if(r.grouping.enabled){let e=l.level-1;"multipleColumns"!==r.grouping.renderMode&&(n+='<div style="width: '+(1+e)*r.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<l.level;e++)n+="<div class='smart-indent'></div>";l.checked?a.setAttribute("checked",""):!1===l.checked?a.removeAttribute("checked"):null===l.checked&&a.setAttribute("checked","indeterminate"),l.leaf?l.allowCheck?a.classList.remove("smart-visibility-hidden"):a.classList.add("smart-visibility-hidden"):l.allowCheck?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),l.allowCheck?r.checkBoxes.visible?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"):r.checkBoxes.visible||a.classList.add("smart-hidden"),e.innerHTML=n,t.classList.add("smart-visibility-hidden"),l.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),l.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),l.data.isEmpty&&t.classList.add("smart-visibility-hidden"),i.innerHTML=c,r.appearance.showTooltips?i.setAttribute("title",r._unescapeString(o)):i.hasAttribute("title")&&i.removeAttribute("title")}}else s.innerHTML!==c&&(s.innerHTML=c)}else if("string"==typeof i.cell.template){""===t&&(t="&nbsp;");let e=i.cell.template.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);if(e.indexOf("{{"))for(let t=0;t<r.dataSource.dataFields.length;t++){const a=r.dataSource.dataFields[t].name;if(e.indexOf("{{"+a+"}}")>=0&&(e=e.replace("{{"+a+"}}",l.data[a]),-1===e.indexOf("{{")))break}s.innerHTML!==e&&(s.innerHTML=e)}}if("auto"===i.cell.row.height||r.layout.allowCellsWrap||"auto"===r.layout.rowHeight){const e=s.querySelector(".smart-grid-cell-template");if(e){l._templatesHeight||(l._templatesHeight=[]);const t=(e,t)=>{if(e){const l=r.rowById[e.getAttribute("data-id")];l._templatesHeight[n.dataField]=t,l._isDirty=!0;const a=l.canNotify;l.canNotify=!1,l.autoSize(),l.canNotify=a,delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),r.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(o)return a.innerHTML="",a.appendChild(o),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML),i.cell._setStyle(a),o;i.cell._setStyle(a),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML)}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,r=a._isMeasureRow?null:e.cell.format||l.cellsFormat,n=t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0;if(e.setAttribute("data-type",l.dataType),!(!1!==t._recycleValues||n||l.formatFunction||l._treeColumn||a.summaryRow||"grid"!==t.view)){if(e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element&&a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id?a.element.star.classList.remove("smart-hidden"):t.appearance.showRowComments&&!a.element.hasAttribute("focus")&&a.element.toggleDetailButton&&a.element.toggleDetailButton.classList.add("smart-visibility-hidden")),e.cell.background||e.cell.color){e.cell._styleChanged=!0;const t=e.firstChild;e.cell._setStyle(t)}return}if(t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&"card"!==t.view){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return void 0===t&&i.data&&(t=l.displayField?i.data[l.displayField]:i.data[l.dataField]),e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button"),t.dataSource.boundHierarchy||!e.hasAttribute("has-toggle-button")||l._treeColumn||e.removeAttribute("has-toggle-button");let s=l.displayField?i[l.displayField]:i[l.dataField];if(e.removeAttribute("placeholder"),!l.placeholder||""!==s&&null!=s||(s=l.placeholder,e.setAttribute("placeholder","")),l.parentDataField){const e=t.columnByDataField[l.parentDataField];if(e){let i=e.editor.dataSource;e.relationId&&e.relationField&&e._isDirty&&(!e.editor.dataSource||e.editor.dataSource&&0===e.editor.dataSource.length)&&(i=t._getRelationData(e.relationId));const r=i[t.getCellValue(a.id,l.parentDataField)];if(r){s=r[l.cascadingDataField]}}}if(null!==s||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(s=0),"string"===l.dataType&&(s=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(s=!1),"date"===l.dataType&&(s=new Date)),t.formulas&&e.cell.formula&&"string"==typeof e.cell.formula&&e.cell.formula.startsWith("=")&&/=.+/.test(e.cell.formula)){const i=t._formulaParser;if(i){if(t&&t.formulas&&e.cell._formula!==l.formula){let t=a.data[l.dataField];l.formula&&(e.cell.formula=e.cell._parseFormula(l.formula)),t&&(""+t).startsWith("=")&&(e.cell.formula=e.cell._parseFormula(""+t)),e.cell._formula=l.formula}const r=i.parse(e.cell.formula.slice(1));s=isNaN(r)?"#VALUE!"===r?"":"#ERROR!"===r?"#ERROR!":r:r}}t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(s="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row"),t.editing.enabled&&(e.cell.readonly||!l.allowEdit?e.classList.add("smart-readonly"):e.classList.remove("smart-readonly"));const o=t=>{if(t){if((t=""+t).startsWith("off_"))return e.classList.remove(t.substring(4)),!1;if(e.classList.add(t),e.hasAttribute("customCSS")){t=t+" "+e.getAttribute("customCSS")}return e.setAttribute("customCSS",t),!0}return e.setAttribute("highlight",""),!0};if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS");const l=t.split(" ");for(let t=0;t<l.length;t++)e.classList.remove(l[t])}if(l.highlight&&!a.summaryRow&&(o(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]){o(t.highlightedCells[a.id][l.dataField])}if(t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]){o(t.highlightedRows[a.id])}if(t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),s=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,s=e.cell.value),void 0===s&&(s="");let d=s;if(r)d=e.cell.getFormattedValue(s,r);else if(l.formatSettings&&l.formatSettings.Intl)if(""===s)d="";else if(l.editor.decimalPlaces>=0){const t=JSON.parse(JSON.stringify(l.formatSettings.Intl));t.NumberFormat.minimumFractionDigits=l.editor.decimalPlaces,t.NumberFormat.maximumFractionDigits=l.editor.decimalPlaces,d=e.cell.getFormattedValue(s,t)}else d=e.cell.getFormattedValue(s,l.formatSettings.Intl);else l.formatSettings&&l.formatSettings.formatString&&(d=e.cell.getFormattedValue(s,l.formatSettings.formatString));const c=e.firstChild;if(e.content=c,l._isDirty&&(c.innerHTML=""),c.hasAttribute("data-field")&&c.getAttribute("data-field")!==l.dataField&&(c.innerHTML="",a.filterRow&&(l._filterEditorInitialized=!1)),c.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?c.appendChild(t):c.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void c.appendChild(t)}e.cell.value!==s&&(d=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames||e._rowClassNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,s,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,s,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);let r=[];for(let n=0;n<i.length;n++){let o=i[n];const d={index:a.visibleIndex,value:s,dataField:l.dataField,row:a,data:a.data,api:t};l.cellsCSSRules[o](d)&&(e.classList.add(o),r.push(o))}e.__classNames=r}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const m=e._getCellAlignment(a,l),u=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let p="";if(m.align&&(p+=m.align+" "),m.verticalAlign&&(p+=m.verticalAlign+" "),l.cellsWrap)p+="wrap ";else if(t.layout.autoWrap&&a.height>40&&1===e.cell.colSpan&&"string"===l.dataType){if(14*(d||"").length*.52>l.computedWidth){if("url"!==e.cell.template&&"email"!==e.cell.template){p+="textwrap ";const e=parseInt(a.height/20);c.style["-webkit-line-clamp"]=e}}}if(p+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}if(l.grid.appearance.showRowComments&&l.rowHeaderColumn){const a=t.rowDetailColumn,i=a?a.width:0;e.style.width=l.computedWidth+i+"px",e.classList.add("row-number")}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.appearance.showColumnGroupCellLines||l.parent&&!l.element.hasAttribute("column-group-first-child")&&e.classList.add("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let g=l.left;if(t.rightToLeft?e.style.right!==g+"px"&&(e.style.right=g+"px"):e.style.left!==g+"px"&&(e.style.left=g+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),p+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze",""),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command","")),t.appearance.showRowComments&&(a.comments&&a.comments.length>0&&l===t._firstVisibleUserColumn?e.classList.add("row-comments"):e.classList.remove("row-comments")),l.cellsRotationAngle){if(!e._rotateCellContent(c,l,s))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(c));c.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)""!==c.innerHTML&&(c.innerHTML="");else if(l.autoGenerated&&""!==c.innerHTML&&(c.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary&&l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let r in a){if("status"===r)continue;const n=l.cellsFormat;let s=a[r];n&&n.indexOf("p")>=0&&"count"===r?s=a[r]:n&&"date"!==l.dataType&&(s=e.cell.getFormattedValue(s,n)),t.messages&&t.messages[t.locale]&&t.messages[t.locale][r]?i.push(t.localize(r,{value:s})):i.push(r+": "+s)}let r=[],n="";if(a&&a.status&&l.editor){n+='<div style="margin-right: 5px; display: flex; border-radius: 8px; align-items: center;">';const e=l.editor.dataSource,i=a.status,s=t.rows.length,o=l.computedWidth;let d=0;if(e)for(let l=0;l<e.length;l++){const a=e[l];if(i[a.value]){const e=a.label?a.label:t.localize("blankSummary"),l=i[a.value].length,c=new Number(l/s*100).toFixed(2),m=e+" "+l+"/"+s+" "+c+"%",u=o*c/100/2;r.push(m);const p=["#D50000","#F6BF26","#33B679","#039BE5","#3F51B5","#8E24AA"];d>p.length-1&&(d=0);n+='<span class="summary-value-part" title="'+m+'" style="width: '+u+"px; font-size: 11px; padding: 5px; background:"+(a.color||p[d++])+'; color: white;"></span>'}}n+="</div>"}const s=i.join(", "),o=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let d=`<div title = "${s}" class="smart-truncate summary-value" > <span class="label">${s}</span>${o}</div> `;r.length&&(d=`<div title = "${s}" class="smart-truncate summary-value" > <span style="align-items: center; display: flex;" class="label">${n}${s}</span>${o}</div> `);if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;d=`<div title = "${s}" class="smart-truncate summary-value" > ${`<span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> `} <span class="label">${s}</span>${o}</div> `}c.innerHTML!==d&&(c.innerHTML=d)}else if(t.summaryRow.editing&&l.allowSummary){if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value"><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==l&&(c.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value"><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==e&&(c.innerHTML=e)}}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?c.firstElementChild.setAttribute("has-summary",""):c.firstElementChild.removeAttribute("has-summary"),c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c._clickTarget=e.target},c.onpointerup=l=>{!0!==t._mobile&&c._clickTarget!==l.target||(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="",i=t.appearance.showRowStatus||t.appearance.showRowComments?"smart-visibility-hidden":"";if(a.showDetail){l='<button tabindex="-1" class="'+i+' smart-animate" toggled toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}else{l='<button tabindex="-1" class="'+i+" smart-animate"+(t.rowDetail.dialog.enabled?" row-detail":"")+'" toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}if(t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,c.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):c.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(c.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else c.innerHTML!==l&&(c.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)c.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let r="";for(let e=0;e<t;e++)r+="A";return r+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?c.textContent="":c.textContent=l(a)}else if(u)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)c.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)c.innerHTML=s;else switch(c.removeAttribute("title"),e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(s,e.cell.template,c);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(s,e.cell.template,c);break;case"attachment":e._setTemplate(s,"attachments",c);break;case"image":e._setTemplate(s,"images",c);break;case"email":e._setTemplate(s,"email",c);break;case"url":e._setTemplate(s,"url",c);break;case"richText":e._setTemplate(s,"richText",c);break;default:e._setTemplate(s,e.cell.template,c)}else{const i=c.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&c.children[1]){const e=c.children[0],i=c.children[1].children[0],r=c.children[1].children[1].firstChild,n=c.children[1].children[2];let s="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?s="":"multipleColumns"!==t.grouping.renderMode&&(s+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)s+="<div class='smart-indent'></div>";if(a.checked?r.setAttribute("checked",""):!1===a.checked?r.removeAttribute("checked"):null===a.checked&&r.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?r.classList.remove("smart-visibility-hidden"):r.classList.add("smart-visibility-hidden"):a.allowCheck?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(c)}}a.allowCheck?t.checkBoxes.visible?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"):t.checkBoxes.visible||r.classList.add("smart-hidden"),"card"===t.view&&(r.classList.add("smart-hidden"),i.classList.add("smart-hidden")),e.innerHTML=s,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),n.innerHTML=d,t.appearance.showTooltips?n.setAttribute("title",t._unescapeString(d)):n.hasAttribute("title")&&n.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let r=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(r+=l.computedWidth)}e.style.width=r+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let r=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let r=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(r+=l.cellHeight)}e.style.height=r+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const n="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(s,a.visibleIndex,a.data),o=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(o>l[0]&&o<l[1]){d=!0;break}}if(a._rowSpan=n,n&&!d){let s=0;t._cellRowSpan.push([o,o+n,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(n,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=o;e<=o+n-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(s+=l.cellHeight)}e.style.height=s+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",n),i._styleChanged=!0,r=n}}if(1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width=l.computedWidth+"px",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===r&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),c.textContent===d||l.formatFunction||("string"==typeof d&&d.indexOf("&")>=0?"card"===t.view?c.innerHTML=d:t.isScrolling?requestAnimationFrame((()=>{c.innerHTML=d})):c.innerHTML=d:c.textContent=d),i.column.autoGenerated||i._setStyle(c),t.appearance.showTooltips?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),c.setAttribute("title",i.tooltip||t._unescapeString(d))):c.hasAttribute("title")&&c.removeAttribute("title"),t.appearance.showTooltipsOverflow&&(!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title"),d&&d.length)){14*(d||"").length*.52>l.computedWidth?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),"image"!==l.template&&"attachment"===l.template&&c.setAttribute("title",i.tooltip||t._unescapeString(d))):!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title")}}else c.textContent=d}}if(c.className!==p&&(c.className=p),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&c.firstChild&&c.firstChild.classList&&c.firstChild.classList.contains("smart-grid-cell-loading")&&(c.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),c.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const i={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:s,data:a.data,formattedValue:d,template:null};e.cell.canNotify=!1,a.canNotify=!1;const r=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});if(t.hasAttribute("smart-blazor"))await l.formatFunction(i);else{const e=l.formatFunction(i);e&&(i.value=e)}c.style.background===r.background&&c.style.color===r.color&&c.style.fontSize===r.fontSize&&c.style.fontFamily===r.fontFamily&&c.style.textDecoration===r.textDecoration&&c.style.fontWeight===r.fontWeight&&c.style.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c)),e.cell.background===r.background&&e.cell.color===r.color&&e.cell.fontSize===r.fontSize&&e.cell.fontWeight===r.fontWeight&&e.cell.textDecoration===r.textDecoration&&e.cell.fontFamily===r.fontFamily&&e.cell.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c));let n=!0;if(i.value!==s){if(e.toggleButton){c.children[1].children[2].innerHTML=i.value}else c.innerHTML=i.value;n=!1}if(null!==i.template){if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==i.template&&(e.innerHTML=i.template)}}else if(c.innerHTML!==i.template){const e=document.createElement("div");e.innerHTML=i.template,e.innerHTML!==c.innerHTML&&(c.innerHTML=i.template)}n=!1}n&&(l.cellsFormat?c.textContent=d:c.textContent=s),e.cell.canNotify=!0,a.canNotify=!0}if(l.tooltipRenderer&&!a.summaryRow&&!a.autoGenerated){const e=l.tooltipRenderer(a.id,l.dataField,s,d,a.data);null!=e&&""!==e&&(c.setAttribute("data-title",e),c.onmouseenter=function(l){const a=l.target.closest("smart-grid-cell");if(a&&a.cell.column){if(!a.cell.column.tooltipRenderer)return}t._createTooltip(l,e,c,"top")},c.onmouseleave=function(){t._cellTooltip&&(t._cellTooltip.style.visibility="hidden")})}if(l.cellsRenderer&&!a.summaryRow){const t=l.cellsRenderer(a.id,l.dataField,s,a.data,c);if(null!=t)if("string"==typeof t)if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==t&&(e.innerHTML=t)}}else c.innerHTML!==t&&(c.innerHTML=t);else t instanceof HTMLElement&&c.firstChild!==t&&(c.innerHTML="",c.appendChild(t))}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,c),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&c.querySelector("[toggle-button]")){const e=c.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),r=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),r.appendChild(l),r.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(r),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const r=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-r.top+"px",i.style.left=a._offsetLeft(l)-r.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,r=e.column,n=e.row,s=e.row.index,o=n._style,d=n.data&&n.data.$?n.data.$.id:null;if(e.column.autoGenerated){const l=t._conditionalColors;if(l&&e.column.rowHeaderColumn)if("border"===l.decorate){const t=l.colors;t&&t[d]?(e.element.classList.add("smart-decorate"),e.element.style.setProperty("--smart-decorate-color",t[d].color)):e.element.classList.remove("smart-decorate")}else e.element.classList.remove("smart-decorate")}else{if(t._conditionalColors){const r=t._conditionalColors,s=()=>{e.row.style&&e.row.style[e.column.dataField]&&(e._styleChanged=!0,e.row.style[e.column.dataField].background&&(e.background=e.row.style[e.column.dataField].background),e.row.style[e.column.dataField].color&&(e.color=e.row.style[e.column.dataField].color))};if("border"!==r.decorate){const t=r.colors;if(t&&t[d]){const o="cell"===r.decorate?t[d][i]:t[d].color;if(o){const t=new Smart.Color(o).getInvertedColor();a.cell.canNotify=!1,n.canNotify=!1,e.background=o,e.color=t,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}if(a.cell._customInlineStyles&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.textDecoration=null,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),r.cellsCSSInlineRules){const e=r.cellsCSSInlineRules;for(let i=0;i<e.length;i++){const r=e[i];if(!r.field)break;const s=r.condition;let o=r.value,d=r.value2,c=n.data[r.field],m=t.columnByDataField[r.field];if("string"==typeof c&&(o=""+o,d=""+d),"date"===m.dataType||"dateTime"===m.dataType){if(o=Smart.Utilities.DateTime.ParseDate(o,m.cellsFormat),void 0!==d){d=Smart.Utilities.DateTime.ParseDate(d,m.cellsFormat)}}"number"!==m.dataType&&"float"!==m.dataType&&"decimal"!==m.dataType&&"currency"!==m.dataType||(o=parseFloat(o),void 0!==d&&(d=parseFloat(d))),"boolean"===m.dataType&&("string"==typeof o&&(o="true"===o.toLowerCase()),"1"===o&&(o=!0),"0"===o&&(o=!1),void 0!==d&&("string"==typeof d&&(d="true"===d.toLowerCase()),"1"===d&&(d=!0),"0"===d&&(d=!1)));let u=!1;switch(s){case">":u=o<c;break;case">=":u=o<=c;break;case"<":u=o>c;break;case"<=":u=o>=c;break;case"=":u=o===c;break;case"<>":u=o!==c;break;case"between":u=c>=o&&c<=d}u&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=r.background,a.cell.color=r.color,a.cell.textDecoration=r.textDecoration,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),a.cell._customInlineStyles=!0}}if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][s];a.cell.canNotify=!1,n.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,n.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,n.canNotify=!1,o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,n.canNotify=!0)}}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const r={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":r.align="align-left";break;case"center":case"middle":r.align="align-center";break;case"right":r.align="align-right"}switch(a){case"top":r.verticalAlign="align-top";break;case"center":case"middle":r.verticalAlign="align-middle";break;case"bottom":r.verticalAlign="align-bottom"}return r}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});class e{render(e){const t=this,l={svg:null,roundedCorners:e.roundedCorners||0,padding:e.padding||null,width:e.width||100,height:e.height||30,gap:e.gap||5,strokeWidth:e.strokeWidth||2,type:e.type||"column",colors:e.colors||["var(--smart-primary)"],points:e.points,labels:e.labels,colorFunction:e.colorFunction,tooltipFormatFunction:e.tooltipFormatFunction,min:e.min,max:e.max};switch(l.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),l.svg.setAttribute("width",l.width),l.svg.setAttribute("height",l.height),function(e){Array.isArray(e.colors)||(e.colors=t.colors.split(",")),e.points&&(Array.isArray(e.points)?e.points=e.points.map((e=>parseInt(e,10))):(e.points&&"number"==typeof e.points&&(e.points=""+e.points),e.points=e.points.split(",").map((e=>parseInt(e,10)))))}(l),l.type){case"column":return t.column(l);case"bar":return t.bar(l);case"line":return t.line(l);case"pie":return t.pie(l);case"stacked":return t.stacked(l)}}colorFunction(e,t){const l=function(e,t){e===t&&(t=e+100);const l=(t-e)/5;return[e+l,e+2*l,e+3*l,e+4*l]}(e,t),a=["#D50000","#F4511E","#F6BF26","#039BE5","#33B679"];return e=>e<l[0]?a[0]:e<l[1]?a[1]:e<l[2]?a[2]:e<l[3]?a[3]:a[4]}column(e){const t=e.gap/e.points.length+e.width/e.points.length-e.gap,l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;return e.colorFunction||(e.colorFunction=this.colorFunction(a,l)),e.points.forEach(((n,s)=>{isNaN(n)&&(n=0);const o=document.createElementNS("http://www.w3.org/2000/svg","rect"),d=Math.abs(n)*i;o.setAttribute("x",s*t+s*e.gap),o.setAttribute("point",n);let c=n>=0?"var(--smart-primary)":"var(--smart-error)";if(l>0&&a<0?n>=0?o.setAttribute("y",e.height-r-1-d):o.setAttribute("y",e.height-r-1):l>=0&&a>=0?o.setAttribute("y",e.height-d):a<=0&&l<=0&&o.setAttribute("y",d),o.setAttribute("width",t),o.setAttribute("height",d),e.colorFunction){const t=e.colorFunction(n);t&&(c=t)}o.setAttribute("fill",c);const m=e.tooltipFormatFunction?e.tooltipFormatFunction(n):n;o.setAttribute("data-title",m),e.svg.appendChild(o)})),e.svg.outerHTML}bar(e){const t=e.padding||0;let l=e.roundedCorners||0;"boolean"==typeof l&&(l=l?3:0);const a=e.height-3-2*t,i=Math.max(5,e.gap/e.points.length+a/e.points.length-e.gap),r=e.max||Math.max(...e.points),n=e.min||Math.min(...e.points);let s=e.width/(Math.abs(n)+Math.abs(r));const o=Math.abs(n)*s;return e.colorFunction||(e.colorFunction=this.colorFunction(n,r)),e.points.forEach(((a,d)=>{isNaN(a)&&(a=0);const c=document.createElementNS("http://www.w3.org/2000/svg","rect"),m=Math.abs(a)*s;c.setAttribute("y",d*i+d*e.gap+t),c.setAttribute("point",a),l>0&&(c.setAttribute("rx",l),c.setAttribute("ry",l));let u=a>=0?"var(--smart-primary)":"var(--smart-error)";if(r>0&&n<0?a>=0?c.setAttribute("x",o):c.setAttribute("x",o-m):(r>=0&&n>=0||n<=0&&r<=0)&&c.setAttribute("x",0),c.setAttribute("width",m),c.setAttribute("height",i),e.colorFunction){const t=e.colorFunction(a);t&&(u=t)}c.setAttribute("fill",u);const p=e.tooltipFormatFunction?e.tooltipFormatFunction(a):a;c.setAttribute("data-title",p),e.svg.appendChild(c)})),e.svg.outerHTML}line(e){const t=e.width/(e.points.length-1),l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;e.colorFunction||(e.colorFunction=this.colorFunction(a,l));let n="var(--smart-primary)",s=[],o=[];e.svg.setAttribute("overflow","visible");for(let l=0;l<e.points.length;l++){let a=e.points[l];isNaN(a)&&(a=0);const n=l*t,d=e.height-r-a*i;o.push({x:n,y:d,point:a}),2===o.length&&(s.push(o),o=[]),s.length>0&&0===o.length&&o.push(s[s.length-1][1])}for(let t=0;t<s.length;t++){const l=s[t];if(e.colorFunction){const t=e.colorFunction(l[0].point);t&&(n=t)}if(0===t){const t=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(t),t.setAttribute("cx",l[0].x),t.setAttribute("cy",l[0].y),t.setAttribute("r",3),t.setAttribute("fill",n);const a=e.tooltipFormatFunction?e.tooltipFormatFunction(l[0].point):l[0].point;t.setAttribute("data-title",a),t.style.display="none"}const a=document.createElementNS("http://www.w3.org/2000/svg","line");e.svg.appendChild(a),a.setAttribute("x1",l[0].x),a.setAttribute("y1",l[0].y),a.setAttribute("x2",l[1].x),a.setAttribute("y2",l[1].y);const i=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(i),i.setAttribute("cx",l[1].x),i.setAttribute("cy",l[1].y),i.setAttribute("r",3),i.setAttribute("fill",n);const r=e.tooltipFormatFunction?e.tooltipFormatFunction(l[1].point):l[1].point;i.setAttribute("data-title",r),i.style.display="none",a.setAttribute("fill","none"),a.setAttribute("stroke-width",e.strokeWidth),a.setAttribute("stroke",n)}return e.svg.outerHTML}pie(e){const t=Math.min(e.width,e.height)/2,l=e.width/2,a=e.height/2,i=e.points.reduce(((e,t)=>e+Math.abs(t)),0);let r=0;const n=e.max||Math.max(...e.points),s=e.min||Math.min(...e.points);return e.colorFunction||(e.colorFunction=this.colorFunction(s,n)),e.points.forEach((n=>{isNaN(n)&&(n=0);let s=e.color;if(e.colorFunction){const t=e.colorFunction(n);t&&(s=t)}const o=Math.abs(n)/i*2*Math.PI,d=r+o,c=l+t*Math.cos(r),m=a+t*Math.sin(r),u=l+t*Math.cos(d),p=a+t*Math.sin(d),g=document.createElementNS("http://www.w3.org/2000/svg","path"),f=o>Math.PI?1:0,h=`M ${l},${a} L ${c},${m} A ${t},${t} 0 ${f} 1 ${u},${p} Z`;g.setAttribute("d",h),g.setAttribute("fill",s);const b=e.tooltipFormatFunction?e.tooltipFormatFunction(n):`${(n/i*100).toFixed(2)}%`;g.setAttribute("data-title",b),e.svg.appendChild(g),r=d})),e.svg.outerHTML}stacked(e){let t=e.points.reduce(((e,t)=>e+t),0),l=(e.points.length-1)*e.gap,a=e.width-l;const i=e.max||Math.max(...e.points),r=e.min||Math.min(...e.points);e.colorFunction||(e.colorFunction=this.colorFunction(r,i));let n=0;return e.points.forEach(((l,i)=>{isNaN(l)&&(l=0);let r=e.colors[i%e.colors.length];if(e.colorFunction){const t=e.colorFunction(l);t&&(r=t)}const s=l/t*a,o=document.createElementNS("http://www.w3.org/2000/svg","rect");o.setAttribute("x",n),o.setAttribute("y",0),o.setAttribute("width",s),o.setAttribute("height",e.height),o.setAttribute("fill",r);const d=document.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=l,o.appendChild(d),e.svg.appendChild(o),n+=s+e.gap})),e.svg.outerHTML}}})();
51
51
  Smart.Utilities.Assign("Grid.Resize",class{autoSizeRows(e){const t=this,o=e||t._recyclingRows;t.rows.canNotify=!1;for(let e=0;e<o.length;e++){const i=o[e];i.element=t._rowElements[1],i.grid=t;const l=i._autoSize(i);i.cellHeight!==l&&(i.cellHeight=l),i.height=l}t.rows.canNotify=!0,t.refresh()}autoSizeColumn(e){const t=this.columnByDataField[e];t&&t.autoSize()}autoSizeColumns(e,t){const o=this,i=t||o.columns;let l=[];if(!e){const e=o._recyclingRows;for(let t=0;t<e.length;t++){const o=e[t];for(let e=0;e<i.length;e++){const t=i[e],n=o.getCell(t.dataField);l[t.dataField]||(l[t.dataField]=t.label);let r=n.value;r&&t.cellsFormat&&(r=n.getFormattedValue(r,t.cellsFormat)),r&&r.toString().length>l[t.dataField].length&&(l[t.dataField]=r)}}}const n=[];for(let e=0;e<i.length;e++){const t=i[e],o=l[t.dataField]?l[t.dataField]:t.label;n.push(o)}const r=i[0]._measureSize(n);o.columns.canNotify=!1;for(let e=0;e<i.length;e++)i[e].width=r[e];o.columns.canNotify=!0,o.refresh()}_doubleClickHandler(e){const t=this;if("none"!==t.behavior.rowResizeMode||"none"!==t.behavior.columnResizeMode){if(t._downTime&&new Date-t._downTime<300){const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(parseInt(e.clientX),parseInt(e.clientY));let i=null,l=null,n=null,r=null;for(let e=0;e<o.length;e++){const t=o[e];if(t.getAttribute("data-field")&&(i=t.getAttribute("data-field"),"smart-grid-column"===t.nodeName.toLowerCase())){l=t;break}if(t.getAttribute("data-id")){n=t.getAttribute("data-id"),r=t;break}}const s=t.columnByDataField[i],a=t.rowById[n];if(t.behavior.allowColumnAutoSizeOnDoubleClick&&s&&s.allowResize&&"none"!==t.behavior.columnResizeMode&&l){const o=l.getBoundingClientRect(),i=o.right,n=10;i-n<=e.clientX&&e.clientX<=i+n&&o.top<=e.clientY&&o.bottom>=e.clientY&&(s.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()),t._columnToResizeElement&&(t._columnToResizeElement.style.borderRight=""))}if(t.behavior.allowRowAutoSizeOnDoubleClick&&a&&a.allowResize&&"none"!==t.behavior.rowResizeMode){const t=r.getBoundingClientRect().bottom,o=10;t-o<=e.clientY&&e.clientY<=t+o&&(a.computedHeight=null,r&&r.cell&&!i&&(i=r.cell.column.dataField),"_rowHeaderColumn"===i&&(a.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation())))}}t._downTime=new Date}}_endResize(){const e=this;e._overlay&&setTimeout((()=>{e._overlay&&(e._overlay.parentNode.removeChild(e._overlay),e._overlay=null)}),100);const t=e.getBoundingRect(e);if(delete e._columnDownPosition,delete e._rowDownPosition,e.classList.remove("smart-grid-resize-mode"),e.$.root.classList.remove("smart-grid-resize-mode"),e.classList.remove("smart-grid-row-resize-mode"),e.classList.remove("smart-grid-column-resize-mode"),e._rowToResize&&e._rowResizeStartLine&&e._rowResizeLine){const t=e.rowById[e._rowToResizeId],o=t.cellHeight+parseFloat(e._rowResizeLine.style.top)-parseFloat(e._rowResizeStartLine.style.top),i=t.cellHeight;if(e.rows.canNotify=!1,t.height=null,"split"===e.behavior.rowResizeMode){const i=e._nextRow(t),l=parseInt(t.height-o+t.cellHeight);t.computedHeight=o,i.computedHeight=parseInt(i.height)+l,i.height=null}else t.computedHeight=o;return e.rows.canNotify=!0,e._rowResizeStartLine.parentNode.removeChild(e._rowResizeStartLine),e._rowResizeLine.parentNode.removeChild(e._rowResizeLine),e.appearance.showResizeTooltips&&e._rowResizeTooltip.parentNode.removeChild(e._rowResizeTooltip),e._rowToResize.header?e._rowToResize.header.style.cursor="":e._rowToResize.style.cursor="",t.header&&(t.header.style.cursor=""),e._rowResizeLine=null,e._rowToResize=null,e._rowToResizeId=null,e._rowResizeStartLine=null,e.refresh(),e.$.fireEvent("rowResize",{row:t,id:t.id,oldHeight:i,height:o}),void(e.onRowResize&&e.onRowResize({row:t,id:t.id,oldHeight:i,height:o}))}if(!e._columnToResizeElement||!e._columnResizeLine)return;const o=e.columnByDataField[e._columnToResizeDataField],i=e._columnToResizeRect;let l=t.left+parseInt(e._columnResizeLine.style.left)-i.left+e.scrollLeft;const n=o.width;if(e.rightToLeft&&(l=t.left-parseFloat(e._columnResizeLine.style.left)+i.right-e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),l<o.minWidth&&(l=o.minWidth),e.columns.canNotify=!1,"split"===e.behavior.columnResizeMode){const t=e._nextColumn(o);if(t){const e=parseInt(o.computedWidth-l);o.width=l,t.width=parseInt(t.computedWidth)+e}}else o.width=l;e.columns.canNotify=!0,e._columnResizeLine.parentNode.removeChild(e._columnResizeLine),e._columnResizeLine=null,e._columnResizeStartLine.parentNode.removeChild(e._columnResizeStartLine),e._columnResizeTooltip.parentNode&&e._columnResizeTooltip.parentNode.removeChild(e._columnResizeTooltip),e._columnResizeStartLine=null,e._columnToResizeElement.style.cursor="",e._columnToResizeElement.sortButton.style.cursor="",e._columnToResizeElement.filterButton.style.cursor="",e._columnToResizeElement.style.borderRight="",e._columnToResizeElement=null,e._columnToResizeRect=null,e._columnToResizeDataField=null,e._columnResizeTooltip=null,e.refresh(),o._state||(o._state={label:o.label,dataField:o.dataField,dataType:o.dataType}),o._state.width=o.width,e.onColumnResize?e.onColumnResize({column:o,dataField:o.dataField,oldWidth:n,width:l}):e.$.fireEvent("columnResize",{column:o,dataField:o.dataField,oldWidth:n,width:l}),e.autoSaveState(),e.closeMenu()}_columnResizePrepare(){const e=this,t=e._columnToResizeRect,o=e.getBoundingRect(e.$.columnHeader),i=e.appearance.showViewBar&&!e.appearance.showViewBarAsDropdown?4+e.layout.viewBarWidth:0,l=e.grouping.groupBar.visible?e.$.groupHeader.offsetHeight:0,n=e.header.visible?e.$.header.offsetHeight:0;if(e._dragDetails)return;const r=function(){const r=document.createElement("div");r.classList.add("smart-grid-resize-line"),e.rightToLeft?r.style.left=-o.left+t.left+"px":r.style.left=i-o.left+t.right+"px",e.header.visible&&!e.header.appendTo?r.style.top=n+l-o.top+t.top+"px":r.style.top=l-o.top+t.top+"px";const s=parseInt(r.style.top)-e.$.horizontalScrollBar.offsetHeight;return r.style.height="calc(100% - "+s+"px)",r.style.cursor="col-resize",r},s=document.createElement("div");s.classList.add("smart-grid-resize-tooltip"),e._columnResizeTooltip=s,e._columnResizeTooltip.style.left=i-o.left+t.right+"px",e.rightToLeft&&(e._columnResizeTooltip.style.left=-o.left+t.left+"px"),e._columnResizeTooltip.innerHTML=e.localize("columnResizeTooltip",{value:t.width}),e._columnResizeLine=r(),e._columnResizeStartLine=r(),e._columnToResizeElement&&(e._columnToResizeElement.style.borderRight=""),"growAndShrink"===e.behavior.columnResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-column-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e.appearance.showResizeTooltips&&e.$.root.appendChild(e._columnResizeTooltip),e.$.root.appendChild(e._columnResizeLine),e.$.root.appendChild(e._columnResizeStartLine),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="col-resize",e.$.root.appendChild(e._overlay)}_columnDownResizeHandler(e){this._columnDownPosition=e.pageX}_columnMoveResizeHandler(e){const t=this;if(t._dragDetails)return;Smart.Utilities.Core.isMobile?t._columnDownPosition&&Math.abs(e.pageX-t._columnDownPosition)>=0&&!t._columnResizeLine&&(t._columnResizePrepare(),e&&(e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))):t._columnDownPosition&&Math.abs(e.pageX-t._columnDownPosition)>=3&&!t._columnResizeLine&&t._columnResizePrepare();const o=function(e){const o=t._columnToResizeRect;let i=e.left+parseFloat(t._columnResizeLine.style.left)-o.left+t.scrollLeft;t.rightToLeft&&(i=e.left-parseFloat(t._columnResizeLine.style.left)+o.right-t.scrollLeft-t._scrollView.vScrollBar.offsetWidth);const l=t.columnByDataField[t._columnToResizeDataField];i<l.minWidth&&(i=l.minWidth),t.appearance.showResizeTooltips&&(t._columnResizeTooltip.innerHTML=t.localize("columnResizeTooltip",{value:parseInt(i)}))};if(t._columnResizeLine){const i=t.columnByDataField[t._columnToResizeDataField],l=t._columnToResizeRect,n=i.minWidth,r=i.maxWidth,s=t._nextColumn(i),a=t.getBoundingRect(t);if(t.rightToLeft){if(e.pageX>a.right)return;if("split"===t.behavior.columnResizeMode&&s&&e.pageX<=t.offsetWidth-t.scrollLeft-s.left-s.computedWidth+s.minWidth)return t._columnResizeLine.style.left=t.offsetWidth-t.scrollLeft-s.left-s.computedWidth+s.minWidth+"px",void o(a);if(l.right-n-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-n-t.scrollLeft+"px",void o(a);if(l.left+r-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-r-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a),Smart.Utilities.Core.isMobile&&(e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}else{if(e.pageX<a.left)return;if("split"===t.behavior.columnResizeMode&&s&&e.pageX>=a.left+s.left+s.computedWidth-s.minWidth-t.scrollLeft)return t._columnResizeLine.style.left=-a.left+a.left+s.computedWidth+s.left-s.minWidth-t.scrollLeft+"px",void o(a);let i=0,d=t.parentElement;for(;d;)i+=d.scrollLeft,d=d.parentElement;if(l.left+n-t.scrollLeft-i>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+n-t.scrollLeft-i+"px",void o(a);if(l.left+r-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+r-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+i+e.pageX+"px",o(a),Smart.Utilities.Core.isMobile&&(e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}}else if(!t._columnDownPosition){const t=this;if(e.originalEvent&&e.originalEvent.composedPath&&-1===e.originalEvent.composedPath().indexOf(this))return;if(!e.originalEvent&&e.composedPath&&-1===e.composedPath().indexOf(this))return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(parseInt(e.clientX),parseInt(e.clientY));let i=null,l=null;if(t._columnResizeLine)return void(t._columnToResizeElement&&(t._columnToResizeElement.style.borderRight=""));for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-field")&&t.hasAttribute("header")){i=t.getAttribute("data-field"),l=t;break}}if(t._columnToResizeElement&&(t._columnToResizeElement.style.cursor="",t._columnToResizeElement.style.borderRight="",t._columnToResizeElement.sortButton&&(t._columnToResizeElement.sortButton.style.cursor=""),t._columnToResizeElement.filterButton&&(t._columnToResizeElement.filterButton.style.cursor=""),t._columnToResizeElement=null),i){const o=t.rightToLeft?l.getBoundingClientRect().left:l.getBoundingClientRect().right;if(l.style.cursor="",l.style.borderRight="",l.style.borderRight="",t._columnToResizeElement&&t._columnToResizeElement.sortButton&&l.sortButton&&(l.sortButton.style.cursor=""),t._columnToResizeElement&&t._columnToResizeElement.filterButton&&l.filterButton&&(l.filterButton.style.cursor=""),o-10<=e.clientX&&e.clientX<=o+10){const e=t.columnByDataField[i];if(!e||e&&!e.allowResize)return;const o=t._isLastVisibleColumn(e);if("split"===t.behavior.columnResizeMode&&o)return;l.style.cursor="col-resize",l.style.borderRight="2px solid var(--smart-primary)",l.sortButton&&(l.sortButton.style.cursor="col-resize"),l.filterButton&&(l.filterButton.style.cursor="col-resize"),t._columnToResizeRect=t.getBoundingRect(l),t._columnToResizeElement=l,t._columnToResizeDataField=i}}}}_rowMoveResizeHandler(e){const t=this;if(t.viewColumns.length&&t.viewColumns[0].rowHeaderColumn&&!t._rowResizeLine){const o=t.offset(t.viewColumns[0].element),i=t.viewColumns[1]&&t.viewColumns[1].rowDetailColumn?t.viewColumns[1].width:0;if(e.pageX<o.left||e.pageX>o.left+t.viewColumns[0].width+i){if(t._rowToResize){const e=t.rowById[t._rowToResizeId];if(e&&e.header&&(e.header.parentElement.style.borderBottom="",e.header.parentElement.style.cursor="",e.header.parentElement.style.zIndex=""),e&&e.header&&e.header.parentElement){const t=[...e.header.parentElement.children];for(let e=0;e<t.length;e++)t[e].style.cursor="",t[e].firstElementChild&&(t[e].firstElementChild.style.cursor=""),t[e].firstElementChild&&t[e].firstElementChild.firstElementChild&&(t[e].firstElementChild.firstElementChild.style.cursor="")}}return}}const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(parseInt(e.clientX),parseInt(e.clientY));let i=null,l=null;if(t._rowToResize){const e=t.rowById[t._rowToResizeId];if(e&&e.header){e.header.parentElement.style.borderBottom="",e.header.style.cursor="",e.header.parentElement.style.cursor="",e.header.parentElement.style.zIndex="";const t=[...e.header.parentElement.children];for(let e=0;e<t.length;e++)t[e].style.cursor="",t[e].firstElementChild&&(t[e].firstElementChild.style.cursor=""),t[e].firstElementChild&&t[e].firstElementChild.firstElementChild&&(t[e].firstElementChild.firstElementChild.style.cursor="")}}if(t._rowDownPosition&&Math.abs(e.pageY-t._rowDownPosition)>=3&&!t._rowResizeLine&&t._rowDownResizeHandler(e),t._rowResizeLine){const o=t._offsetTop(t.$.scrollView),i={top:o,bottom:t.$.scrollView.offsetHeight+o};if(e.pageY<=i.top)return;if(e.pageY>=i.bottom)return;const l=function(){const e=n.cellHeight+parseFloat(t._rowResizeLine.style.top)-parseFloat(t._rowResizeStartLine.style.top);t.appearance.showResizeTooltips&&(t._rowResizeTooltip.innerHTML=t.localize("rowResizeTooltip",{value:parseInt(e)}))},n=t.rowById[t._rowToResizeId],r=t._nextRow(n),s=t._rowToResizeBounds,a=n.minHeight,d=n.maxHeight;return n&&n.header&&(n.header.style.borderBottom=""),"split"===t.behavior.rowResizeMode&&r&&s.bottom+r.height-r.minHeight<=e.pageY?(t._rowResizeLine.style.top=s.bottom+r.height-r.minHeight-o+"px",void l()):s.top+a+3>=e.pageY?(t._rowResizeLine.style.top=s.top+a-o+"px",void l()):s.top+d>=e.pageY-o?(t._rowResizeLine.style.top=s.top+d+3-o+"px",void l()):(t._rowResizeLine.style.top=-o+e.pageY-1+"px",void l())}if(!t._rowDownPosition){for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-id")&&t.hasAttribute("header")){l=t,i=t.getAttribute("data-id");break}}if(t._rowToResize&&(t._rowToResize.style.cursor="",t._rowToResize=null),null!==i){const o=t._offsetTop(l)+l.offsetHeight;if(l.style.cursor="",o-3<=e.clientY&&e.clientY<=o+3){const e=t.rowById[i];if(!e||e&&!e.allowResize)return;if(e.header){e.header.style.cursor="row-resize",e.header.parentElement.style.cursor="row-resize",e.header.parentElement.style.borderBottom="2px solid var(--smart-primary)",e.header.parentElement.style.zIndex=10;const t=[...e.header.parentElement.children];for(let e=0;e<t.length;e++)t[e].style.cursor="row-resize",t[e].firstElementChild&&(t[e].firstElementChild.style.cursor="row-resize"),t[e].firstElementChild&&t[e].firstElementChild.firstElementChild&&(t[e].firstElementChild.firstElementChild.style.cursor="row-resize")}const o=t._offsetTop(l);t._rowToResizeBounds={top:o,bottom:l.offsetHeight+o,height:l.offsetHeight},t._rowToResize=l,t._rowToResizeId=i}}}}_rowDownResizeHandler(){const e=this,t=e._rowToResizeBounds,o=function(){const o=document.createElement("div");return o.classList.add("smart-grid-resize-line","row"),o.style.width=e.$.scrollView.offsetWidth-e._rowToResize.offsetLeft+"px",o.style.left="0px",o.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",o.style.cursor="row-resize",o},i=document.createElement("div");i.classList.add("smart-grid-resize-tooltip"),e._rowResizeTooltip=i,e._rowResizeTooltip.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",e._rowResizeTooltip.innerHTML=e.localize("rowResizeTooltip",{value:t.height}),e._rowResizeTooltip.style.right="20px",e._rowResizeTooltip.style.bottom="initial","growAndShrink"===e.behavior.rowResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-row-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e._rowResizeLine=o(),e._rowResizeStartLine=o(),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="row-resize",e.$.root.appendChild(e._overlay),e.$.scrollView.appendChild(e._rowResizeLine),e.$.scrollView.appendChild(e._rowResizeStartLine),e.appearance.showResizeTooltips&&e.$.scrollView.appendChild(e._rowResizeTooltip)}_rowResizeHandler(e){const t=this;let o=e.clientX,i=e.clientY;void 0!==o&&void 0!==i||(o=e.touches[0].clientX,i=e.touches[0].clientY);const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(parseInt(o),parseInt(i));let n=null;for(let e=0;e<l.length;e++){const t=l[e];t.getAttribute("data-id")&&(n=t.getAttribute("data-id"))}null===n||!t._rowToResize||t._rowResizeLine||(t._rowDownPosition=e.pageY)}});
52
52
  Smart.Utilities.Assign("Grid.Reorder",class{reorderColumns(e,r,t=!1){const o=this;if(void 0===e||void 0===r)return;let a=o.columnByDataField[e];const n=o.columnByDataField[r],d="string"==typeof e?o.columns.indexOf(a):e,i="string"==typeof r?o.columns.indexOf(n):r;"string"==typeof e&&"string"===r?a.columnGroup=n.columnGroup:(a=o.columns[d],a.columnGroup=o.columns[i].columnGroup);const l=a.sortIndex,s=a.sortOrder,c=a.filter;t&&i+1<=o.columns.length?o.columns.move(d,i):o.columns.move(d,i-1),a.sortOrder=s,a.sortIndex=l,a.filter=c}swapColumns(e,r){const t=this;if(void 0===e||void 0===r)return;const o=t.columnByDataField[e],a=t.columnByDataField[r],n="string"==typeof e?t.columns.indexOf(o):e,d="string"==typeof r?t.columns.indexOf(a):r,i="string"==typeof e?o.columnGroup:t.columns[n].columnGroup;"string"==typeof e&&"string"===r?o.columnGroup=a.columnGroup:t.columns[n].columnGroup=t.columns[d].columnGroup;const l=o.sortIndex,s=o.sortOrder,c=o.filter;t.columns.move(n,d),"string"==typeof e&&"string"===r?a.columnGroup=i:t.columns[d-1].columnGroup=i,t.columns.move(d-1,n),o.sortOrder=s,o.sortIndex=l,o.filter=c}_createLine(e){const r=this;return e.classList.contains("smart-breadcrumb-item")||e.column?function(){const t=document.createElement("div"),o=r.getBoundingRect(e),a=r.getBoundingRect(r.$.columnHeader),n=r.getBoundingRect(r),d=r.$.content.offsetHeight-7-r._scrollView.hScrollBar.offsetHeight-o.top+n.top;return t.classList.add("smart-grid-drag-line"),r.rightToLeft?t.style.left=-a.left+o.left+"px":t.style.left=-a.left+o.right+"px",t.style.top=o.top-n.top+"px",t.style.height=d+"px",t.style.opacity=0,t}():function(){const t=document.createElement("div"),o=r.getBoundingRect(e);return t.classList.add("smart-grid-drag-line","row"),t.style.width=r.$.scrollView.offsetWidth-e.offsetLeft-e.row.header.offsetWidth-r._scrollView.vScrollBar.offsetWidth+"px",t.style.left=e.row.header.offsetWidth+"px",t.style.top=o.bottom-r.offsetTop+"px",t.style.opacity=0,t}()}_drag(e){const r=this,t=e.originalEvent;if(r._dialogDragDetails&&r._dragDialog(e,"both"),!r._dragDrop)return;const o=r._dragDrop.dragDetails;if(!o)return;let a=o.feedback;if(!a&&r._dragDrop.showFeedback){if(a=r._dragDrop.createFeedback(t),!a)return void(Smart.Utilities.Core.isMobile&&(t.preventDefault(),t.stopPropagation()));if(r._overlay=document.createElement("div"),r._overlay.classList.add("smart-grid-overlay"),r._overlay.style.cursor="",r.$.root.appendChild(r._overlay),r._dragDrop.column)r._dragLine=r._createLine(r._dragDrop.column.element),r.$.root.appendChild(r._dragLine),requestAnimationFrame((()=>{r._dragLine&&(r._dragLine.style.opacity=1)})),r._dragDrop.feedbackLine=r._dragLine,a.classList.add("smart-grid-column-drag-feedback");else{const e=r._dragDrop.row;let t="<table>";for(let o=0;o<r.columns.length;o++){const a=r.columns[o];let n=e.data[a.dataField];a.cellsFormat&&(n=new Smart.Grid.Cell(r.rows[0],a).getFormattedValue(n,a.cellsFormat)),t+=`<tr><td>${a.label}</td><td>${n}</td></tr>`}r._dragDrop.items=r._rowElements,r._dragDrop.getItemCoordinates(r._rowElements),t+="</table>",a.innerHTML=t,r._dragLine=r._createLine(r._dragDrop.row.element),r.$.root.appendChild(r._dragLine),requestAnimationFrame((()=>{r._dragLine&&(r._dragLine.style.opacity=1)})),a.classList.add("smart-grid-row-drag-feedback"),r._dragDrop.feedbackLine=r._dragLine}}r._dragDrop.drag(e),r._dragDrop.column?r._dragColumn(e):r._dragRow(e),t.preventDefault(),Smart.Utilities.Core.isMobile&&t.stopPropagation()}_dragRow(e){const r=this,t=r._dragDrop.dragDetails,o=r._dragLine,a=e.originalEvent,n=r.getBoundingRect(r);if(e.pageY<n.top||e.pageY>n.bottom||e.pageX<n.left||e.pageX>n.right||t.target&&!t.target.row||!t.target)r._dragDrop.error(),o&&(o.style.opacity=0);else{r._dragDrop.getItemCoordinates(r._dragDrop.items);for(let o=0;o<r._dragDrop._itemCoordinates.coordinates.length;o++){const a=r._dragDrop._itemCoordinates.coordinates[o];if(Array.isArray(a))for(let o=0;o<a.length;o++){let n=a[o];e.pageY>=n.rect.top&&e.pageY<n.rect.bottom&&e.pageX>=n.rect.left&&e.pageX<n.rect.right&&(t.target=r._dragDrop.items[n.index],t.before=!0)}}if(o&&(o.style.opacity=1),r._dragDrop.success(),!t.target)return;let a=r.getBoundingRect(t.target);o&&(o.style.width=r.$.scrollView.offsetWidth-r._dragDrop.row.offsetLeft-r._dragDrop.row.header.offsetWidth-r._scrollView.vScrollBar.offsetWidth+"px",o.style.left=r._dragDrop.row.header.offsetWidth+"px");const d=r.offset(r).top;let i=a.top-d-r.scrollTop;r._recyclingRows[r._recyclingRows.length-1].element===t.target&&e.pageY>n.bottom-10&&(t.before=!1),e.pageY>i+d+a.height-7&&(t.before=!1),r.hasAttribute("tree")?(t.before=null,e.pageY>i+d&&e.pageY<i+d+a.height/3?t.before=!0:e.pageY>i+d+2*a.height/3&&(t.before=!1),o&&null===t.before?o.style.top=i+a.height/2+"px":o&&(o.style.top=t.before?i+"px":i+a.height+"px")):o&&(o.style.top=t.before?i+"px":i+a.height-7+"px")}r.$.fireEvent("rowDragging",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.visibleIndex,data:r._dragDrop,originalEvent:a})}_dragColumn(e){const r=this,t=r._dragDrop.dragDetails,o=r.getBoundingRect(r),a=e.originalEvent;e.pageY<o.top||e.pageY>o.bottom||e.pageX<o.left||e.pageX>o.right?(r._dragDrop.error(),r._dragLine.style.opacity=0):r._dragLine.style.opacity=1;const n=r.$.groupHeader.getBoundingClientRect();if(e.pageY>=n.top&&e.pageY<n.bottom&&e.pageX>=n.left&&e.pageX<n.right&&(!1===r._dragDrop.column.allowGroup?(r._dragLine.style.opacity=0,r._dragDrop.error()):(t.feedback.classList.remove("freeze"),t.feedback.classList.remove("error"))),t.target&&r._dragDrop.feedback&&!r._dragDrop.feedback.classList.contains("error")){r._dragDrop.getItemCoordinates(r._dragDrop.items);for(let o=0;o<r._dragDrop._itemCoordinates.coordinates.length;o++){const a=r._dragDrop._itemCoordinates.coordinates[o];if(Array.isArray(a))for(let o=0;o<a.length;o++){let n=a[o];e.pageY>=n.rect.top&&e.pageY<n.rect.bottom&&e.pageX>=n.rect.left&&e.pageX<n.rect.right&&(t.target=r._dragDrop.items[n.index],t.before=!0)}}const a=r.getBoundingRect(t.target),n=r.getBoundingRect(r.$.content);if(r._dragDrop.column){r._dragLine.style.opacity=1;const d=r.appearance.showViewBar&&!r.appearance.showViewBarAsDropdown?r.layout.viewBarWidth:0;if(!1===t.before?r._dragLine.style.left=d+a.right-n.left+"px":r._dragLine.style.left=d+a.left-n.left+"px",r.behavior.allowColumnFreeze&&r.dataSource&&0===r.dataSource.groupBy.length){const o=r._dragDrop._itemCoordinates.coordinates[0][0].rect;r._dragDrop.column.allowFreeze&&(e.pageX>=o.left&&e.pageX<=o.left+10?t.feedback.classList.add("freeze"):t.feedback.classList.remove("freeze"),t.target&&t.target.hasAttribute("freeze")&&t.feedback.classList.add("freeze"),t.item.column.freeze&&!t.target.hasAttribute("freeze")?t.feedback.classList.add("unfreeze"):t.feedback.classList.remove("unfreeze"))}if(t.target.classList.contains("smart-breadcrumb-item"))r._dragLine.style.top=a.top-o.top-r.scrollTop+"px",r._dragLine.style.height=a.height+"px",r.$.breadcrumb.dataSource.forEach((e=>{e.value===t.item.column.dataField&&(r._dragLine.style.opacity=0,r._dragDrop.error())}));else{r._dragLine.style.top=a.top-o.top-r.scrollTop+"px";const e=r.$.content.offsetHeight-7-r._scrollView.hScrollBar.offsetHeight-a.top+n.top;r._dragLine.style.height=e+"px"}parseInt(r._dragLine.style.left)<3?r._dragLine.style.left="3px":parseInt(r._dragLine.style.left)>=r.offsetWidth-3&&(r._dragLine.style.left=r.offsetWidth-7+"px")}}else r._dragLine.style.opacity=0;r.$.fireEvent("columnDragging",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:r.columns.indexOf(r._dragDrop.column),data:r._dragDrop,originalEvent:a})}_beginRowDrag(e,r){const t=this;let o=!1;t.behavior.allowRowReorder&&r.allowReorder&&(o=!0),o&&(t.$.fireEvent("rowDragStart",{row:r,id:r.id,index:r.visibleIndex,data:null,originalEvent:e.originalEvent}).defaultPrevented||(t._dragDrop=new Smart.Utilities.DragDrop(t),t._dragDrop.capture(r.element,e),t._dragDrop.row=r,t._recycle(!1),t._dragInterval&&clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const e=t._dragDrop.dragDetails;if(!e)return void clearInterval(t._dragInterval);if(!e.feedback)return;const r=parseInt(e.feedback.style.left),o=parseInt(e.feedback.style.top),a=t.getBoundingClientRect();t._dragLine&&a.left<=r&&a.left+a.width>=r&&(o>=a.top&&o<=a.top+20?t.scrollTop-=5:o>=a.top+a.height+5&&o<=a.top+a.height+20&&(t.scrollTop+=5))}),10)))}_beginDrag(e,r){const t=this;if(!r.dataField)return void t._beginRowDrag(e,r);const o=r;if(t.behavior.allowColumnReorder&&o.allowReorder&&!o.autoGenerated){if(t.appearance.showColumnHeaderDragIcon&&!e.originalEvent.target.classList.contains("smart-drag-handle"))return;if(!t.$.fireEvent("columnDragStart",{column:o,dataField:o.dataField,index:t.columns.indexOf(o),data:null,originalEvent:e.originalEvent}).defaultPrevented){t._dragDrop=new Smart.Utilities.DragDrop(t),t._dragDrop.capture(o.element,e),t._dragDrop.column=o;const r=()=>{let e=t.columns.map((e=>e.element));t.behavior.allowColumnFreeze||(e=t.columns.filter((e=>!e.freeze)).map((e=>e.element))),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&-1===t.dataSource.groupBy.indexOf(o.dataField)&&(e=t.columns.filter((e=>{if(t.dataSource&&-1===t.dataSource.groupBy.indexOf(e.dataField))return!0})).map((e=>e.element))),e=e.filter((e=>!e.classList.contains("smart-visibility-hidden"))),t.$.breadcrumb?t._dragDrop.items=e.concat(t.$.breadcrumb._items):t._dragDrop.items=e};r(),t._dragInterval&&clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const e=t._dragDrop.dragDetails;if(!e)return void clearInterval(t._dragInterval);if(!e.feedback)return;r();const o=parseInt(e.feedback.style.left),a=t.getBoundingClientRect();t._dragLine&&a.left<=o&&a.left+a.width>=o&&(o>=a.left&&o<=a.left+20?t.scrollLeft-=5:o>=a.left+a.width-20&&o<=a.left+a.width&&(t.scrollLeft+=5))}),3)}}}_cancelDrag(){const e=this;e._dragLine&&(e._dragLine.parentNode&&e._dragLine.parentNode.removeChild(e._dragLine),e._dragLine=null),e._dragDrop&&(e._dragDrop.removeFeedback(),e._dragDrop=null),e._dragInterval&&clearInterval(e._dragInterval),e._recycle()}_endDrag(e){const r=this;if(r._dialogDragDetails&&(r._dialogDragDetails.started=!1),r._dragDrop){const t=r._dragDrop.dragDetails;if(!t)return void r._cancelDrag();if(!t.feedback||t.feedback&&t.feedback.classList.contains("error")&&!t.feedback.classList.contains("data"))return void r._cancelDrag();if(e.key&&"Escape"===e.key)return r._dragDrop.column?r.$.fireEvent("columnDragCancel",{column:t.item.column,dataField:t.item.column.dataField,index:r.columns.indexOf(r._dragDrop.column),data:r._dragDrop}):r._dragDrop.row&&r.$.fireEvent("rowDragCancel",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.row.visibleIndex,data:r._dragDrop}),void r._cancelDrag();r.beginUpdate();let o=t.target;const a=t.before;if(r._dragDrop.column){if(r.filtering.filterRow&&r.filtering.filterRow.visible)for(let e=0;e<r.columns.length;e++)r.columns[e]._filterEditorInitialized=!1;if(o&&o.column&&"Escape"!==e.key&&!t.feedback.classList.contains("data")){r.columns.indexOf(r._dragDrop.column);let t=r.columns.indexOf(o.column);if(t+=a?0:1,!r.$.fireEvent("columnDragEnd",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:r.columns.indexOf(r._dragDrop.column),newIndex:t,data:r._dragDrop,originalEvent:e.originalEvent}).defaultPrevented){const t=r.columns.indexOf(r._dragDrop.column);let n=r.columns.indexOf(o.column);r._dragDrop.column.freeze,n+=a?0:1,r._dragDrop.column.columnGroup=o.column.columnGroup,r._dragDrop.column.freeze=o.column.freeze,r.behavior.allowColumnFreeze&&(r._dragDrop.feedback.classList.contains("freeze")&&(r._dragDrop.column.freeze=!0),r._dragDrop.feedback.classList.contains("unfreeze")&&(r._dragDrop.column.freeze=!1)),t<n&&n--;const d=r._dragDrop.column,i=d.sortIndex,l=d.sortOrder,s=d.filter,c=r.columns.canNotify;r.columns.canNotify=!1,r.columns.move(t,n),r.columns.canNotify=c;const g=r.context;r.context=document,d.sortOrder=l,d.sortIndex=i,d.filter=s,r.context=g,r._renderColumns(),r.$.fireEvent("columnReorder",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:t,newIndex:n,data:r._dragDrop,originalEvent:e.originalEvent}),r.autoSaveState()}}else r.$.fireEvent("columnDragEnd",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:r.columns.indexOf(r._dragDrop.column),newIndex:-1,data:r._dragDrop,originalEvent:e.originalEvent});if("Escape"!==e.key&&r.$.breadcrumb&&r._dragDrop.column.allowGroup){const t=r.getBoundingRect(r.$.breadcrumb);if(e.originalEvent.pageY>=t.top-r.scrollTop&&e.originalEvent.pageY<=t.bottom-r.scrollTop){const e=r.$.breadcrumb._items.indexOf(o),t=r._dragDrop.dragDetails.item.column,n=r.$.breadcrumb.dataSource.slice(0);n.splice(Math.max(0,e+(a?0:1)),0,{label:t.label,value:t.dataField}),r.$.breadcrumb.dataSource=n;const d=r.$.breadcrumb.dataSource.map((e=>e.value));r.dataSource.groupBy=d,r.refreshFilters(),r.$.fireEvent("group",{groups:r.dataSource.groupBy}),r.autoSaveState()}}}else if(r._dragDrop.row)if(o&&o.row&&"Escape"!==e.key&&!t.feedback.classList.contains("data")){if(!r.$.fireEvent("rowDragEnd",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.row.visibleIndex,newIndex:o.row.visibleIndex,data:r._dragDrop,originalEvent:e.originalEvent}).defaultPrevented){const a=r._dragDrop.row.visibleIndex;let n=o.row.visibleIndex;if(t.before||n++,a<n&&n--,r.hasAttribute("tree")){const e=r._dragDrop.row.data,a=o.row.data,n=[],d=(e,t=null)=>{const o={};for(let t=0;t<r.dataSource.dataFields.length;t++){const a=r.dataSource.dataFields[t];o[a.name]=e[a.name]}delete o[r.dataSource.parentDataField],delete o[r.dataSource.id],delete o[r.dataSource.keyDataField],o[r.dataSource.parentDataField]=t;const a=o[r.dataSource.id]=e[r.dataSource.id];return n.push(o),e.children&&e.children.length>0&&(o.children=e.children.map((e=>d(e,a)))),void 0!==e.expanded&&(o.expanded=e.expanded),o};d(e,a[r.dataSource.parentDataField]),null===t.before?(n[0]?n[0].id||n[0][r.dataSource.id]:-1)!==a.$.id&&(r.addChildRow(n,a.$.id),a.expanded=!0):r.addSiblingRow(n,a.$.id,t.before)}else r.rows.move(a,n);r.$.fireEvent("rowReorder",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:a,newIndex:n,data:r._dragDrop,originalEvent:e.originalEvent})}}else r.$.fireEvent("rowDragEnd",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.row.visibleIndex,newIndex:-1,data:r._dragDrop,originalEvent:e.originalEvent});r._cancelDrag();const n=r.columnGroups&&r.columnGroups.length>0;r.endUpdate(!n),n&&r._renderColumns(!0),r.paging.enabled&&r.grouping.enabled&&r._refreshPagesCount(),r.filtering.enabled&&r.filtering.filterRow.visible&&(r._refreshFilterRowEditors(),r._recycle())}}});
53
53
  Smart.Utilities.Assign("Grid.Menu",class{_openColumnChooserMenu(e){const t=this;if(e||(e=t._commandColumn),!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t._createColumnChooserMenuItems(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e,t._filterContainer&&("none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"));let l=n.right-n.width+window.pageXOffset,i=n.bottom+window.pageYOffset;l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,t.menu.classList.add("smart-open-right"),l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth)),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open")}_openColumnFilterMenu(e){const t=this;if(!e||t.filterRowMenu&&t.filterRowMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t._closeMenu(t.filterRowExcelMenu),t.filterRowMenu||(t.filterRowMenu=document.createElement("div"),t.filterRowMenu.classList.add("smart-grid-column-menu"),t.filterRowMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowMenu.classList.add("smart-animate"):t.filterRowMenu.classList.remove("smart-animate"),t._createColumnFilterMenuItems(e),t.filterRowMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowMenu.column&&t.filterRowMenu.column!==e&&(t.filterRowMenu.column.setProperty("menu",null),t.filterRowMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowMenu):document.body.appendChild(t.filterRowMenu),e.setProperty("filterRowMenu",t.filterRowMenu);const n=e.element.getBoundingClientRect();t.filterRowMenu.column=e;let l=n.left+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowMenu.offsetWidth,l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowMenu.offsetWidth)),t.filterRowMenu.style.left=l+"px",t.filterRowMenu.style.top=i+"px",t.filterRowMenu.classList.remove("smart-hidden"),t.filterRowMenu.classList.add("open"),setTimeout((()=>{t.filterRowMenu.querySelector("smart-menu").focus()}),50),t.filterRowMenu}_openColumnFilterExcelMenu(e){const t=this;if(!e||t.filterRowExcelMenu&&t.filterRowExcelMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t._closeMenu(t.filterRowMenu),t.filterRowExcelMenu||(t.filterRowExcelMenu=document.createElement("div"),t.filterRowExcelMenu.classList.add("smart-grid-column-menu"),t.filterRowExcelMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowExcelMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowExcelMenu.classList.add("smart-animate"):t.filterRowExcelMenu.classList.remove("smart-animate"),t._createColumnFilterExcelMenuItems(e),t.filterRowExcelMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowExcelMenu.column&&t.filterRowExcelMenu.column!==e&&(t.filterRowExcelMenu.column.setProperty("menu",null),t.filterRowExcelMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowExcelMenu):document.body.appendChild(t.filterRowExcelMenu),e.setProperty("filterRowExcelMenu",t.filterRowExcelMenu);const n=e.element.getBoundingClientRect();t.filterRowExcelMenu.column=e;let l=n.left+n.width-t.filterRowExcelMenu.offsetWidth+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowExcelMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowExcelMenu.offsetWidth,l+t.filterRowExcelMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowExcelMenu.offsetWidth)),t.filterRowExcelMenu.style.left=l+"px",t.filterRowExcelMenu.style.top=i+"px",t.filterRowExcelMenu.classList.remove("smart-hidden"),t.filterRowExcelMenu.classList.add("open"),setTimeout((()=>{t.filterRowExcelMenu.querySelector("smart-menu").focus()}),50),t.filterRowExcelMenu}openContextMenu(e,t){const n=this;if(n.contextMenu.selector){const l=document.querySelector(n.contextMenu.selector);l&&setTimeout((()=>{l.open(e,t)}),100)}else n._closeMenu(n._contextMenu),n._contextMenu||(n._contextMenu=document.createElement("div"),n._contextMenu.classList.add("smart-grid-column-menu"),n._contextMenu.setAttribute("theme",n.getAttribute("theme")),n._contextMenu.id=n.id+"_"+n.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.menu=n._contextMenu),n.appearance.allowColumnMenuAnimation?n._contextMenu.classList.add("smart-animate"):n._contextMenu.classList.remove("smart-animate"),n.rightToLeft?n._contextMenu.setAttribute("right-to-left",""):n._contextMenu.removeAttribute("right-to-left"),n.contextMenu.dataField?n._contextMenu.column=n.columnByDataField[n.contextMenu.dataField]:n._contextMenu.column=n.columns[0],n._createContextMenuItems(n._contextMenu),n._contextMenu.style.setProperty("--smart-grid-column-menu-width","auto"),n._contextMenu.style.height=n.contextMenu.height?n.contextMenu.height+"px":"auto",n._contextMenu.style.width=n.contextMenu.width?n.contextMenu.width+"px":"auto",n.isInShadowDOM?n.getRootNode().appendChild(n.menu):document.body.appendChild(n._contextMenu),n._contextMenu.style.left=e+10+"px",n._contextMenu.style.top=t+"px",t+n._contextMenu.offsetHeight>window.innerHeight&&(n._contextMenu.style.top=window.innerHeight-n._contextMenu.offsetHeight-10+"px"),n._contextMenu.classList.remove("smart-hidden"),n._contextMenu.classList.add("open"),setTimeout((()=>{n._contextMenu&&n._contextMenu.querySelector("smart-menu").focus()}),50)}_openMenu(e){const t=this;if(!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls")||!1===t.columnMenu.enabled)return void t.closeMenu();t._closeMenu(t.filterRowMenu),t._closeMenu(t.filterRowExcelMenu),t.$.headerBar&&t.header.visible&&t.$.headerBar.closePanel(),t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t.rightToLeft?t.menu.setAttribute("right-to-left",""):t.menu.removeAttribute("right-to-left"),t._createMenuItems(e),t._createFilterPanel(e),t._filterMenuItemsVisibility(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e;let l=n.right-e.element.actionButton.getBoundingClientRect().width+window.pageXOffset,i=n.bottom+window.pageYOffset;t.menu.classList.remove("smart-open-right"),t.rightToLeft&&(l=n.left+window.pageXOffset-t.menu.offsetWidth+e.element.actionButton.getBoundingClientRect().width,l<0&&(l=n.left+window.pageXOffset)),l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth),t.menu.classList.add("smart-open-right")),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.hasColumnMenu(e)?(t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open"),setTimeout((()=>{t.menu&&(t.menu.querySelector(".smart-filter-panel-input")?t.menu.querySelector(".smart-filter-panel-input").focus():t.menu.querySelector("smart-menu").focus())}),50)):t.closeMenu()}_menuItemClick(e){const t=this,n=e.detail.value;if(n&&n.properties){const e=n.properties.command;"function"==typeof e?e.apply(t,[n.column,n.properties]):t[e]&&t[e].apply(t,[n.column,n.properties]),n.column&&n.column.autoCloseMenu&&t.closeMenu()}}contextMenuItemChartCommand(){}contextMenuItemCutCommand(){const e=this,t=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",ctrlKey:!0,key:"X"});e._clipboardHandler("x",t),e.columnByDataField[e.contextMenu.dataField]||(e.selectRow(e.contextMenu.id),e._createCopyRects())}contextMenuItemCopyCommand(){const e=this,t=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",ctrlKey:!0,key:"C"});e._clipboardHandler("c",t),e.columnByDataField[e.contextMenu.dataField]||(e.selectRow(e.contextMenu.id),e._createCopyRects())}contextMenuItemPasteCommand(){const e=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",ctrlKey:!0,key:"V"});this._clipboardHandler("v",e)}contextMenuItemClearCommand(){const e=this;if(e._selection)if(e._selection.rows&&Object.keys(e._selection.rows).length>0){if(void 0!==e.contextMenu.id){const t=e.getSelectedRows();if(t.length>=1)return void t.map((e=>e[0])).forEach((t=>{requestAnimationFrame((()=>{e.updateRow(t,null,null,!0)}))}))}}else if(e._selection.cells&&Object.keys(e._selection.cells).length>0){const t=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",key:"Delete"});e.closeMenu(),e.$.dispatch(t)}}contextMenuItemInsertRowCommand(){const e=this;if(void 0!==e.contextMenu.id){const t=e.rowById[e.contextMenu.id];t&&requestAnimationFrame((()=>{e.insertRow({},1+t.visibleIndex)}))}}contextMenuItemSelectRowCommand(){const e=this;void 0!==e.contextMenu.id&&e.rowById[e.contextMenu.id]&&requestAnimationFrame((()=>{e.selectRow(e.contextMenu.id),e.$.headerBar&&(e.$.headerBar.refreshTools(),e.$.headerBar._refreshDeleteButton())}))}contextMenuItemCloneRowCommand(){const e=this;if(void 0!==e.contextMenu.id){const t=e.rowById[e.contextMenu.id];t&&requestAnimationFrame((()=>{e.insertRow(e.getRowData(e.contextMenu.id),1+t.visibleIndex),e._recycle(!1,!0)}))}}contextMenuItemAddCommentCommand(){const e=this;void 0!==e.contextMenu.id&&(e._focusCommentInput=!0,e._openRowSettingsDialog(e.contextMenu.id),setTimeout((()=>{delete e._focusCommentInput}),300))}contextMenuItemExpandCommand(){const e=this;void 0!==e.contextMenu.id&&e._openRowSettingsDialog(e.contextMenu.id)}contextMenuItemDeleteCommand(){const e=this;if(void 0!==e.contextMenu.id){const t=e.getSelectedRows();if(t.length>=1){const e=t.map((e=>e[0]));return void this.removeRow(e)}e.deleteRow(e.contextMenu.id)}}contextMenuItemEditCommand(){const e=this;void 0!==e.contextMenu.id&&e.editing.enabled&&("cell"===e.editing.mode?e.beginEdit(e.contextMenu.id,e.contextMenu.dataField):e.beginEdit(e.contextMenu.id))}removeGroupByCommand(e){this.removeGroup(e.dataField),this.autoSaveState()}groupByCommand(e){const t=this;t.dataSource&&(t.$.headerBar?t.header.visible&&t.header.buttons.indexOf("group")>=0&&t.$.headerBar.openGroupPanel(e):t.addGroup(e.dataField),t.autoSaveState())}sortAscCommand(e){this.sortBy(e.dataField,"asc"),this.autoSaveState()}sortDescCommand(e){this.sortBy(e.dataField,"desc"),this.autoSaveState()}removeSortCommand(e){this.sortBy(e.dataField,null),this.autoSaveState()}addSortCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openSortPanel(e)}addFilterCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openFilterPanel(e)}removeFilterCommand(e){this.removeFilter(e.dataField)}customizeTypeCommand(e){this._openAddColumnDialog(e,"rename")}hideColumnCommand(e){e.visible=!1,this.autoSaveState()}deleteColumnCommand(e){const t=this;t.columns.splice(t.columns.indexOf(e),1);for(let n=0;n<t.rows.length;n++)delete t.rows[n].data[e.dataField]}insertRightCommand(e){this._openAddColumnDialog(null,!1,null,e)}duplicateCommand(e,t,n){const l=this,i=new Smart.Grid.Column(e);delete i._state;let o=e.dataField,a=0;if(void 0===n){let t=!1;for(let n=0;n<l.rows.length;n++)if(l.rows[n].data[e.dataField]){t=!0;break}if(t)return void l._openDescriptionDialog(e,"duplicate")}for(let e=0;e<l.columns.length;e++)l.columns[e].dataField.indexOf(o)>=0&&a++;if(i.displayField=i.dataField=e.dataField+"_"+a,"object"==typeof e.editor){const t={};for(let n in e.editor)"instance"!==n&&"cell"!==n&&"column"!==n&&"row"!==n&&"isInitialized"!==n&&(t[n]=e.editor[n]);i.editor=JSON.parse(JSON.stringify(t))}const r=l.columns.indexOf(e);if(n)for(let t=0;t<l.rows.length;t++){const n=l.rows[t],o=n.data[e.dataField];n.data[i.dataField]=o}i.label=e.label+` ${l.localize("copy")} `+a,l.columns.splice(1+r,0,i),l.onColumnClone&&setTimeout((()=>{l.onColumnClone(e.dataField,i.dataField,1+r,n)}),100)}_removeMenu(){const e=this;if(e.menu){const t=e.menu.querySelector("smart-menu");t&&e.menu.removeChild(t)}if(e.filterRowMenu){const t=e.filterRowMenu.querySelector("smart-menu");t&&e.filterRowMenu.removeChild(t)}if(e.filterRowExcelMenu){const t=e.filterRowExcelMenu.querySelector("smart-menu");t&&e.filterRowExcelMenu.removeChild(t)}if(e._contextMenu){const t=e._contextMenu.querySelector("smart-menu");t&&(e._contextMenu.removeChild(t),e._contextMenu.parentNode.removeChild(e._contextMenu))}}_createColumnChooserMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();if(n.mode="vertical",n.dropDownAppendTo="body",n.checkboxes=!0,n.checkable=!0,n.classList.add("smart-grid-column-chooser-menu"),n.rightToLeft=t.rightToLeft,e&&"_addNewColumn"===e.dataField){if(t._kanbanViewColumns&&t._kanbanViewColumns.length>0)for(let e=0;e<t._kanbanViewColumns.length;e++){const n=t._kanbanViewColumns[e],i=t.columnByDataField[n.dataField];if(i&&i.visible)continue;const o=document.createElement("smart-menu-item"),a=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";o.checked=n.visible,n.allowHide&&(n.command=function(e){t.closeMenu();const n=t.columnByDataField[e.dataField];n.visible=!0,delete n._visible;const l=t._kanbanViewColumns.indexOf(e);l>=0&&t._kanbanViewColumns.splice(l,1)},o.label=t.localize(n.label)||n.label||n.dataField,o.value={column:n,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),l.appendChild(o))}const e=document.createElement("smart-menu-item");e.label='<span class="smart-grid-icon smart-icon-plus"></span>'+t.localize("dialogNewColumn"),e.value={properties:{command:()=>{t.closeMenu(),t._openAddColumnDialog()}}},l.appendChild(e)}else for(let e=0;e<t.columns.length;e++){const n=t.columns[e],i=document.createElement("smart-menu-item"),o=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";i.checked=n.visible,n.allowHide&&(n.command=function(e){e.visible=!e.visible},i.label=t.localize(n.label)||n.label||n.dataField,i.value={column:n,properties:n},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),l.appendChild(i))}n.appendChild(l),t.menu.appendChild(n),t.menu.itemCheckChange=t._menuItemClick.bind(t),t.menu.addEventListener("itemCheckChange",t.menu.itemCheckChange),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createFilterListBox(e){const t=this,n=t.columnByDataField[e];if(!n)return null;let l=t.getExcelFilterDataSource(n.dataField);const i=document.createElement("smart-list-box");return i.style.setProperty("--smart-list-item-height","24px"),i.id=t.id+"_"+t.tagName.toLowerCase()+"_filter_listbox_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),i.checkboxes=!0,i.animation="none",i.selectionMode="checkBox",i.dataSource=l,i.displayMember="label",i.valueMember="value",i.style.width="100%",i.filterable=!0,i.autoHeight=!0,i.selectAll=!0,i.rightToLeft=t.rightToLeft,i.theme=t.theme,i.locale=t.locale,i.style.height="200px",i.whenRendered((()=>{if(n.filterEditor&&n.filterEditor.values&&(n._filterInfo||(n._filterInfo={}),n._filterInfo.excelValues=n.filterEditor.values),n._filterInfo&&n._filterInfo.excelValues&&Array.isArray(n._filterInfo.excelValues)){i.clearSelection();let e=[];for(let t=0;t<n._filterInfo.excelValues.length;t++){const l=n._filterInfo.excelValues[t];e.push(l)}i.checkAll(e)}else i.checkAll();setTimeout((()=>{i.focusFilter()}),200)})),i}_createColumnFilterExcelMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu","filter-excel"),n.rightToLeft=t.rightToLeft,n.animation="none",n.preventHover=!0,n.style.setProperty("--smart-list-item-height","27px");const i=document.createElement("smart-menu-item");i.style.paddingLeft=i.style.paddingRight=i.style.paddingTop=i.style.paddingBottom="0px";const o=t._createFilterListBox(e.dataField),a=document.createElement("div");a.classList.add("smart-flex"),a.style.flexDirection="column",a.style.padding="5px",a.appendChild(o);const r=document.createElement("div");r.classList.add("smart-flex"),r.style.marginTop="10px",r.style.marginLeft="5px";const s=document.createElement("smart-button");s.innerHTML=t.localize("filter"),s.classList.add("primary");const m=document.createElement("smart-button");m.innerHTML=t.localize("clear"),m.style.marginLeft="10px",r.appendChild(s),r.appendChild(m),a.appendChild(r),i.appendChild(a),l.appendChild(i),m.onclick=function(){o.clearSelection(),o.checkAll(),e._filterInfo.excelValues=null,t.removeFilter(e.dataField);const n=t.getFilterRowFilter(e.dataField);n&&t.addFilter(e.dataField,n),t.closeMenu()},s.onclick=function(){const n=o.getSelectedValues();if(e._filterInfo.excelValues=n,n.length===o.getItems().length){e._filterInfo.excelValues=null;const n=t.getFilterRowFilter(e.dataField);return n?t.addFilter(e.dataField,n):t.removeFilter(e.dataField),void t.closeMenu()}const l=t.getExcelFilter(e.dataField,n),i=t.getFilterRowFilter(e.dataField);i&&l.addFilter("and",i),t.addFilter(e.dataField,l),t.closeMenu()},n.appendChild(l),t.filterRowExcelMenu.appendChild(n),t.filterRowExcelMenu.itemClick=t._menuItemClick.bind(t),t.filterRowExcelMenu.classList.add("smart-open-right"),t.filterRowExcelMenu.addEventListener("itemClick",t.filterRowExcelMenu.itemClick),t.filterRowExcelMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowExcelMenu)}))}_createColumnFilterMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu"),n.rightToLeft=t.rightToLeft;const i=e._filterInfo.dataSource;for(let t=0;t<i.length;t++){const n=i[t],o=document.createElement("smart-menu-item"),a=n.icon;o.label=n.label,o.value={column:e,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),e._filterInfo.condition===n.value&&o.setAttribute("focus",""),l.appendChild(o)}n.appendChild(l),t.filterRowMenu.appendChild(n),t.filterRowMenu.itemClick=t._menuItemClick.bind(t),t.filterRowMenu.addEventListener("itemClick",t.filterRowMenu.itemClick),t.filterRowMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowMenu)}))}_createMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment(),i=e.menuItems||t.columnMenu.dataSource;n.mode="vertical",n.dropDownAppendTo="body",n.rightToLeft=t.rightToLeft;for(let n in i){const o=i[n],a=document.createElement("smart-menu-item");let r=o.icon;a.label=t.localize(n),a.value={column:e,properties:o};const s=t=>{if(t){if("string"===e.dataType)return"A → Z";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"1 → 9";if("bool"===e.dataType||"boolean"===e.dataType)return"0 → 1"}else{if("string"===e.dataType)return"Z → A";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"9 → 1";if("bool"===e.dataType||"boolean"===e.dataType)return"1 → 0"}};"columnMenuItemSortAsc"===n?(a.label=t.localize(n,{mode:s(!0)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)):"columnMenuItemSortDesc"===n&&(a.label=t.localize(n,{mode:s(!1)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)),r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),l.appendChild(a)}n.appendChild(l),t._filterContainer?t.menu.insertBefore(n,t._filterContainer):t.menu.appendChild(n),t.menu.itemClick=t._menuItemClick.bind(t),t.menu.addEventListener("itemClick",t.menu.itemClick),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createContextMenuItems(){const e=this;e._removeMenu();const t=document.createElement("smart-menu"),n=document.createDocumentFragment();let l=e.contextMenu.dataSource;t.mode="vertical",t.dropDownAppendTo="body",t.rightToLeft=e.rightToLeft;const i=e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2,o=e._getSelectedRows(!0,!1);if(i){let t={};t.contextMenuItemCut=l.contextMenuItemCut,t.contextMenuItemCopy=l.contextMenuItemCopy,t.contextMenuItemPaste=l.contextMenuItemPaste,t.contextMenuItemClear=l.contextMenuItemClear,e.charting.enabled&&(t.contextMenuItemChart=l.contextMenuItemChart),l=t}else if(o.length>1){let t={};t.contextMenuItemCut=l.contextMenuItemCut,t.contextMenuItemCopy=l.contextMenuItemCopy,t.contextMenuItemPaste=l.contextMenuItemPaste,t.contextMenuItemClear=l.contextMenuItemClear,t.contextMenuItemDelete=l.contextMenuItemDelete,e.charting.enabled&&(t.contextMenuItemChart=l.contextMenuItemChart),l=t}if(null!==e.contextMenu.id&&e._newRow&&e._newRow.id===e.contextMenu.id){const t=function(t,n){const l=n.value;requestAnimationFrame((()=>{const t=[];for(let e=0;e<l;e++)t.push({});e.rows.push(t),e._recycle(!1),e.$.verticalScrollBar.value=e.$.verticalScrollBar.max}))},l=[{label:e.localize("contextMenuItemAddRow",{value:5}),value:5,command:t},{label:e.localize("contextMenuItemAddRow",{value:10}),value:10,command:t},{label:e.localize("contextMenuItemAddRow",{value:20}),value:20,command:t}];for(let e in l){const t=l[e],i=document.createElement("smart-menu-item");i.value={properties:t},i.label=t.label,n.appendChild(i)}}else for(let i in l){const o=l[i];let a=document.createElement("smart-menu-item"),r=o.icon;!0===o.visible?a.classList.remove("smart-hidden"):!1===o.visible&&a.classList.add("smart-hidden"),"contextMenuItemEdit"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?"cell"===e.editing.mode?a.label=e.localize("contextMenuItemEditCell"):a.label=e.localize("contextMenuItemEditRow"):a.label=o.label):"contextMenuItemClear"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("clearContents"):a.label=o.label):"contextMenuItemCut"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("cut").substring(0,1).toUpperCase()+e.localize("cut").substring(1):a.label=o.label):"contextMenuItemCopy"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("copy").substring(0,1).toUpperCase()+e.localize("copy").substring(1):a.label=o.label):"contextMenuItemPaste"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("paste"):a.label=o.label):"contextMenuItemExpand"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("expandRecord"):a.label=o.label):"contextMenuItemCloneRow"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("contextMenuItemCloneRow"):a.label=o.label):"contextMenuItemSelectRow"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("contextMenuItemSelectRow"):a.label=o.label):"contextMenuItemComment"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("commentPlaceholder"):a.label=o.label):"contextMenuItemChart"===i?(t.selectionMode="mouseenter",t.preventCloseOnCheck=!0,e.charting.enabled||(a.disabled=!0),a=document.createElement("smart-menu-items-group"),a.label=e.localize("contextMenuItemChart"),a.innerHTML='\n <smart-menu-items-group>\n Column\n <smart-menu-item type="column">Column</smart-menu-item>\n <smart-menu-item type="stackedcolumn">Stacked Column</smart-menu-item>\n <smart-menu-item type="stackedcolumn100">100% Stacked Column</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Bar\n <smart-menu-item type="bar">Bar</smart-menu-item>\n <smart-menu-item type="stackedbar">Stacked Bar</smart-menu-item>\n <smart-menu-item type="stackedbar100" >100% Stacked Bar</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Line\n <smart-menu-item type="line">Line</smart-menu-item>\n <smart-menu-item type="stackedline">Stacked Line</smart-menu-item>\n <smart-menu-item type="stackedline100">100% Stacked Line</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Area\n <smart-menu-item type="area">Area</smart-menu-item>\n <smart-menu-item type="stackedarea">Stacked Area</smart-menu-item>\n <smart-menu-item type="stackedarea100">100% Stacked Area</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Pie\n <smart-menu-item type="pie">Pie</smart-menu-item>\n <smart-menu-item type="donut">Donut</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Scatter\n <smart-menu-item type="scatter">Scatter</smart-menu-item>\n <smart-menu-item type="bubble">Bubble</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Funnel\n <smart-menu-item type="funnel">Funnel</smart-menu-item>\n <smart-menu-item type="pyramid">Pyramid</smart-menu-item>\n </smart-menu-items-group>\n ',a.querySelectorAll("smart-menu-item").forEach((n=>{const l=n.getAttribute("type");n.onpointerdown=n=>{n.stopPropagation(),n.preventDefault(),t.close(),e._closeMenu(e._contextMenu),e.createChart(l)},n.value={properties:{command:()=>{e.createChart(l)}}}}))):"{{messages}}"===o.label?a.label=e.localize(i):a.label=o.label,a.value={properties:o},r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),n.appendChild(a)}if(e.contextMenu.customContextMenuItems)for(let t in e.contextMenu.customContextMenuItems){const l=e.contextMenu.customContextMenuItems[t],i=document.createElement("smart-menu-item");let o=l.icon;!0===l.visible?i.classList.remove("smart-hidden"):!1===l.visible&&i.classList.add("smart-hidden"),i.label=l.label,i.value={properties:l},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),n.appendChild(i)}[...n.querySelectorAll("smart-menu-item")].forEach((e=>{e.style.marginBottom=e.style.marginTop="0px"})),[...n.querySelectorAll("smart-menu-items-group")].forEach((e=>{e.style.marginBottom=e.style.marginTop="0px"})),t.appendChild(n),e._contextMenu.appendChild(t),""!==t.textContent||0!==t.children.length?(e._contextMenu.itemClick=t=>{t.detail.value||(t.detail.value={properties:{command:null}}),t.detail.value.column=t.detail.item.column=e._contextMenu.column;const n=t.detail.value.column;e._menuItemClick(t),e._closeMenu(e._contextMenu),e.$.fireEvent("contextMenuItemClick",{id:e._contextMenu.id,dataField:n?n.dataField:null,command:t.detail.value.properties.command})},e._contextMenu.style.minHeight="30px",e._contextMenu.addEventListener("itemClick",e._contextMenu.itemClick),e._contextMenu.addEventListener("keydown",e._keyDownHandler.bind(e))):e._removeMenu()}_getFilterType(e){const t=this;let n="string";switch(e.dataType.endsWith("?")?e.dataType.substring(0,e.dataType.length-1):e.dataType){case"number":case"int":case"float":case"int64":n="numeric";break;case"bool":case"boolean":n="bool";break;case"date":case"time":case"datetime":n="date";break;case"any":n="string"}return e.displayField!==e.dataField&&(n=t._getFilterDataType(e)),n}_createFilterPanel(e){const t=this;if(Smart.FilterPanel)if(t.filtering.enabled&&t.filtering.filterMenu.visible&&e.allowFilter&&!t.filtering.filterRow.visible&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){const n=t._getFilterType(e);if(t._filterPanel&&t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),t._filterPanel=t._filterPanels[n],!t._filterPanel){const e=document.createElement("smart-filter-panel");e.filterType=n,t._filterPanels[n]=e,t._filterPanel=e}t._filterPanel.dataField=e.dataField,t._filterPanel.rightToLeft=t.rightToLeft,t.filtering.filterMenu.messages?t._filterPanel.messages=t.filtering.filterMenu.messages:t._filterPanel.messages=t.messages,"excel"!==e.filterMenuMode&&"multi"!==e.filterMenuMode||(t._filterPanel.dataField=e.dataField,t._filterPanel._createFilterListBox=t._createFilterListBox.bind(t),t._filterPanel.getExcelFilter=t.getExcelFilter.bind(t),t.dataSource&&t.dataSource.boundSource&&(t._filterPanel.data=t.dataSource.boundSource.toArray?t.dataSource.boundSource.toArray():t.dataSource.boundSource)),e.filterEditor&&e.filterEditor.dataSource&&(t._filterPanel.data=[...e.filterEditor.dataSource]),t._filterPanel.mode=e.filterMenuMode,t._filterPanel.locale=t.locale;const l=t._filterPanel.querySelectorAll(".smart-filter-panel-input");for(let e=0;e<l.length;e++)l[e].onkeydown=e=>{"Enter"===e.key&&t._filterPanel.filter()};if(!t._filterContainer){const e=document.createElement("div");e.classList.add("smart-filter-container"),t._filterContainer=e,requestAnimationFrame((function(){t.menu.appendChild(e)})),t._applyFilterHandler=function(){t.addFilter(t._filterPanel.dataField,t._filterPanel.getFilter()),t.columnByDataField[t._filterPanel.dataField]._filterState=t._filterPanel.getState(),t.autoSaveState()},t._clearFilterHandler=function(){requestAnimationFrame((()=>{t.removeFilter(t._filterPanel.dataField),t.columnByDataField[t._filterPanel.dataField]._filterState=null,t.autoSaveState()}))}}t._filterContainer.appendChild(t._filterPanel),t._filterPanel.classList.remove("smart-hidden"),t._filterPanel.removeEventListener("filter",t._applyFilterHandler),t._filterPanel.removeEventListener("clear",t._clearFilterHandler),t._filterPanel.addEventListener("filter",t._applyFilterHandler),t._filterPanel.addEventListener("clear",t._clearFilterHandler);const i=t._filterContainer.querySelector(".smart-grid-custom-filter-panel");if(i&&t._filterContainer.removeChild(i),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),e.getFilterPanel)if(e._customFilterPanel)e.updateFilterPanel(e._customFilterPanel,e),t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(e._customFilterPanel);else{const n=e.getFilterPanel(e);n&&(n.classList.add("smart-grid-custom-filter-panel"),e._customFilterPanel=n,t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(n))}if(t._filterPanel.reset(),e.filterEditor&&!e.filter&&e.filterEditor.condition){const n=new Smart.FilterGroup,l=t._getFilterType(e),i=n.getConditions(l),o=e.filterEditor.condition?i.indexOf(e.filterEditor.condition.toUpperCase()):-1,a=e.filterEditor.condition2?i.indexOf(e.filterEditor.condition2.toUpperCase()):-1,r=e.filterEditor.value||"",s=e.filterEditor.value2||"",m=e.filterEditor.logicalOperator?["and","or"].indexOf(e.filterEditor.logicalOperator):0;e._filterState={firstFilterComparison:o,firstFilterValue:r,logicalOperator:m,secondFilterComparison:a,secondFilterValue:s},t._filterPanel.loadState(e._filterState)}if(e._filterState)t._filterPanel.loadState(e._filterState);else if(e.filter){const n=e.filter,l=t._getFilterType(e);let i=n.getFilters();for(;i.length>0&&"FilterGroup"===i[0].type;)i=i[0].value;const o=n.getConditions(l),a=i.length>0?o.indexOf(i[0].condition):-1,r=i.length>1?o.indexOf(i[1].condition):-1,s=i.length>0?i[0].value:"",m=i.length>1?i[1].value:"",u=i.length>1?["and","or"].indexOf(i[1].logicalOperator):0;"excel"===e.filterMenuMode?(e._filterState={filters:i},t._filterPanel.loadState(e._filterState)):"multi"===e.filterMenuMode?(e._filterState={filters:i,firstFilterValue:"",secondFilterValue:"",firstFilterComparison:a},t._filterPanel.loadState(e._filterState)):(e._filterState={firstFilterComparison:a,firstFilterValue:s,logicalOperator:u,secondFilterComparison:r,secondFilterValue:m},t._filterPanel.loadState(e._filterState))}}else t._filterPanel&&(t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),e._filterState=null)}hasColumnMenu(e){const t=this;if(!1===t.columnMenu.enabled)return!1;const n=e.menuItems||t.columnMenu.dataSource;let l=0,i=0;for(let o in n){const a=n[o];if(i++,!1===a.visible)l++;else if("auto"===a.visible){if(("columnMenuItemFilter"===o||"columnMenuItemRemoveFilter"===o)&&(t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){l++;continue}if(!("columnMenuItemGroupBy"!==o&&"columnMenuItemRemoveGroupBy"!==o||e.allowGroup&&t.grouping.enabled)){l++;continue}if(!("columnMenuItemSort"!==o||e.allowSort&&t.sorting.enabled)){l++;continue}if(!("columnMenuItemFilter"!==o||e.allowFilter&&t.filtering.enabled)){l++;continue}if(!("columnMenuItemRemoveFilter"!==o||e.allowFilter&&t.filtering.enabled)){l++;continue}if("columnMenuItemGroupBy"===o&&!e.allowGroup){l++;continue}if(!("columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled)){l++;continue}}}return!(!(t.filtering.enabled&&t.filtering.filterMenu.visible&&!t.filtering.filterRow.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))||l>=i)}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0?a.classList.remove("smart-hidden"):"columnMenuItemFilter"===o&&a.classList.add("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"columnMenuItemSort"===o&&(!1===t.sorting.enabled?a.classList.add("smart-hidden"):(a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.remove("smart-hidden"))),"columnMenuItemGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n>=0}if("columnMenuItemRemoveGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("group")>=0&&a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSort"!==o||e.allowSort||a.classList.add("smart-hidden"),"columnMenuItemRemoveFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||(e.allowSort&&t.sorting.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.add("smart-hidden"))}}else a.classList.add("smart-hidden");else a.classList.add("smart-hidden")}}openMenu(e){const t=this.columnByDataField[e];t&&this._openMenu(t)}hasMenu(){const e=this;return!!(e.menu&&e.menu.column&&e.menu.parentNode)}_closeMenu(e){const t=this;(e=>{if(e){e.column&&(e.column.setProperty("menu",null),e.column=null);let n=e.classList.contains("open");if(e.parentNode&&(e.classList.remove("open"),t.appearance.allowColumnMenuAnimation||e.parentNode.removeChild(e)),e.removeEventListener("keydown",t._keyDownHandler.bind(t)),e.removeEventListener("itemClick",e.itemClick),e.removeEventListener("itemCheckChange",e.itemCheckChange),t._filterRowInputOnFocus)return;if(!n)return;t.focus()}})(e)}closeMenu(){const e=this,t=e.menu;if(e._closeMenu(t),e._closeMenu(e.filterRowMenu),e._closeMenu(e.filterRowExcelMenu),e._closeMenu(e._contextMenu),e._filterPanel){const t=e._filterPanel.querySelectorAll("smart-drop-down-list");for(let e=0;e<t.length;e++){const n=t[e];n.opened&&n.close()}}}});
@@ -61,8 +61,8 @@ Smart.Utilities.Assign("Grid.Dialog",class{_createOverlay(){const e=document.cre
61
61
  (()=>{"use strict";class e{_setRowProperty(e,t,a){const r=this,d=r.rowById[e];if(!d)return;d[t]=a;const o=r._recyclingRows;for(let d=0;d<o.length;d++){const s=o[d];if(s.id===e){s[t]=a,"expanded"===t&&r.dataSource&&(a?r.dataSource._expandedRowIds[s.data.$.id]=!0:delete r.dataSource._expandedRowIds[s.data.$.id]),s.data&&void 0!==s.data[t]&&(s.data[t]=a),r.refresh();break}}r.stateSettings.autoSave&&r.stateSettings.current&&!r.stateSettings.loading&&r.saveState()}_setRowsProperty(e,t,a){const r=this;r._refreshLayout(),r._refreshRowHierarchy(!0);const d=r._recyclingRows;r.rows.canNotify=!1;for(let o=0;o<d.length;o++){const s=d[o];a&&-1===a.indexOf(s.id)||(s[e]=t,"expanded"===e&&r.dataSource&&(t?r.dataSource._expandedRowIds[s.data.$.id]=!0:delete r.dataSource._expandedRowIds[s.data.$.id]),s.data&&void 0!==s.data[e]&&(s.data[e]=t))}r.rows.canNotify=!0,r.refresh()}expandRowsToGroupLevel(e){this._expandCollapseGroupsToLevel(!0,e)}_expandCollapseGroupsToLevel(e,t){const a=this;a._refreshLayout(),a._refreshRowHierarchy(!0);const r=a._recyclingRows;a.rows.canNotify=!1;for(let d=0;d<r.length;d++){const o=r[d];o.data.level<t&&(o.expanded=o.data.expanded=e,a.dataSource&&(e?a.dataSource._expandedRowIds[o.data.$.id]=!0:delete a.dataSource._expandedRowIds[o.data.$.id]))}a.rows.canNotify=!0,a.refresh()}_applyThreeStates(e){const t=this,a=e!==t.rowHierarchy;if(!t.rowHierarchy)return;const r=a?e.children:t.rowHierarchy.filter((e=>{if(0===e.level)return e}));let d=0,o=0;for(let s=0;s<r.length;s++){const n=r[s];e.checked&&(n.checked=!0),!1===n.leaf&&t._applyThreeStates(n),a&&(n.checked?d++:null===n.checked&&o++)}a&&(d===e.children.length?e.checked=!0:0===d&&0===o?e.checked=!1:t.checkBoxes.hasThreeStates?e.checked=null:e.checked=!1)}_hasThreeStates(e,t){const a=this;let r=e;for(e!==t&&(e.checked?e.checked=!1:e.checked=!0);r.parent;){const e=r.parent,t=e.children;let d=0,o=0;for(let e=0;e<t.length;e++)t[e].checked?d++:a.checkBoxes.hasThreeStates&&null===t[e].checked&&o++;d===e.children.length?e.checked=!0:0===d&&0===o?e.checked=!1:a.checkBoxes.hasThreeStates?e.checked=null:e.checked=!1,r=e}e.leaf||function e(t,a){const r=t.children;for(let t=0;t<r.length;t++){const d=r[t];d.checked=a,!1===d.leaf&&e(d,a)}}(e,e.checked)}_expandCollapseGroup(e,t){const a=this;if(!a.grouping.enabled||!a.rowHierarchy)return;e&&e.indexOf&&e.indexOf("Item")>=0&&(e=e.replace("Item",""));const r=(""+e).split(".");let d=a.rowHierarchy[r[0]];if(!d)return;const o=a.rows.canNotify;a.rows.canNotify=!1,null===t&&(t=!d.expanded),d.expanded=d.data.expanded=t,a._saveRowState(d.id,!d.expanded);for(let e=1;e<r.length&&(d=d.children[r[e]],d&&!d.leaf);e++)d.expanded=d.data.expanded=t;a.rows.canNotify=o,a._refresh(),a.stateSettings.autoSave&&a.stateSettings.current&&!a.stateSettings.loading&&a.saveState()}_saveRowState(e,t=!1){const a=this,r=a.rowById[e];if(r&&a.dataSource){if(t)return void delete a.dataSource._expandedRowIds[r.data.$.id];a.dataSource._expandedRowIds[r.data.$.id]=!0}}expandRow(e){const t=this;t.grouping.enabled?t._expandCollapseGroup(e,!0):e&&Array.isArray(e)?t._setRowsProperty("expanded",!0,e):(t._setRowProperty(e,"expanded",!0),t._saveRowState(e))}expandAllRows(){const e=this;e.grouping.enabled?e._expandCollapseGroupsToLevel(!0,99):e._setRowsProperty("expanded",!0)}collapseAllRows(){const e=this;e.grouping.enabled?e._expandCollapseGroupsToLevel(!1,99):e._setRowsProperty("expanded",!1)}addChildRow(e,t){const a=this;e&&e[0]&&(e[0][a.dataSource.parentDataField]=t),a.addSiblingRow(e,t,null)}addSiblingRow(e,t,a=!0){const r=this;if(r.dataSource){if(Array.isArray(e)){for(let t=0;t<e.length;t++)if(r.dataSource.id&&(null===e[t][r.dataSource.id]||void 0===e[t][r.dataSource.id])){const a=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};e[t][r.dataSource.id]=a()}}else if(r.dataSource.id&&(null===e[r.dataSource.id]||void 0===e[r.dataSource.id])){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};e[r.dataSource.id]=t()}const d=e=>{Array.isArray(e)||(e=[e]);for(let t=0;t<e.length;t++){const a=e[t];r.dataSource.remove(a),a.children&&a.children.length>0&&d(a.children)}};d(e),a?r.dataSource.insertBefore(e,t):r.dataSource.insertAfter(e,t),r.refresh(!0)}}toggleRow(e){const t=this;if(t.grouping.enabled)return void t._expandCollapseGroup(e,null);const a=t.rowById[e];a&&(a.expanded?a.expanded=!1:a.expanded=!0)}collapseRow(e){const t=this;t.grouping.enabled?t._expandCollapseGroup(e,!1):e&&Array.isArray(e)?t._setRowsProperty("expanded",!1,e):(t._setRowProperty(e,"expanded",!1),t._saveRowState(e,!0))}checkRow(e){const t=this;e&&Array.isArray(e)?t._setRowsProperty("checked",!0,e):t._setRowProperty(e,"checked",!0)}uncheckRow(e){const t=this;e&&Array.isArray(e)?t._setRowsProperty("checked",!1,e):t._setRowProperty(e,"checked",!1)}checkAllRows(){this._setRowsProperty("checked",!0)}uncheckAllRows(){this._setRowsProperty("checked",!1)}}Smart.Utilities.Grid.Tree=e})();
62
62
  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("richText"===r.template){const e=document.createElement("div");e.innerHTML=i,i=e.textContent.trim()}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}});
63
63
  Smart.Utilities.Assign("Grid.Chart",class{_getChartDataFields(t){const e=this,n=t[0];let r,i=!0,a=[];for(let t in n)"$"!==t&&("string"===e.dataSource.dataFields.find((e=>e.name===t)).dataType?0===e.columns.findIndex((e=>e.dataField===t))&&(r=t):(i=!1,a.push({dataField:t,displayText:t})));return{xAxisDataField:r,series:a,stringOnly:i}}getChart(t,e){const n=this,r=n.getSelection(),i=r.rows,a=r.columns,o=r.cells,s=document.createElement("smart-chart"),c=[],l={};let d,h=[],g=[];if(o&&o.length>1&&o.forEach((t=>{-1===h.indexOf(t.row.index)&&h.push(t.row.index),-1===g.indexOf(t.dataField)&&g.push(t.dataField)})),e)c.concat(e);else for(let t=0;t<n.dataSource.length;t++){const e={};if(i){if(!i.find((e=>e.row.index===t)))continue}else{if(a){a.forEach((r=>{e[r.dataField]=n.dataSource[t][r.dataField]})),c.push(e);continue}if(o&&o.length>1){if(-1===h.indexOf(t))continue;g.forEach((r=>{e[r]=n.dataSource[t][r]})),c.push(e);continue}}n.columns.forEach((r=>e[r.dataField]=n.dataSource[t][r.dataField])),c.push(e)}const m=n._getChartDataFields(c);if(!m.stringOnly){if(d=m.series,s.caption="",s.description="",s.clip=!1,s.showLegend=!0,s.showBorderLine=!1,s.padding={left:5,top:10,right:5,bottom:5},s.dataSource=c,s.theme=n.theme||(document.body.hasAttribute("theme")&&"dark"===document.body.getAttribute("theme")?"dark":"")||"",s.xAxis={dataField:m.xAxisDataField,gridLines:{visible:!0}},s.valueAxis={displayValueAxis:!0,description:n.charting.description,axisSize:"auto",formatSettings:n.charting.formatSettings},this.charting.xAxisPosition&&(s.xAxis.position="top"),this.charting.yAxisPosition&&(s.valueAxis.position="right"),this.charting.caption&&(s.caption=this.charting.caption),this.charting.padding&&(s.padding.left=s.padding.right=s.padding.top=s.padding.bottom=this.charting.padding),this.charting.xAxisTitle&&(s.xAxis.title.text=this.charting.xAxisTitle),this.charting.yAxisTitle&&(s.valueAxis.title.text=this.charting.yAxisTitle),this.charting.description&&(s.description=this.charting.description),s.colorScheme=n.charting.colorScheme,s.seriesGroups=[l],l.formatSettings=n.charting.formatSettings,l.series=d,"line"===t||"stackedline"===t||"stackedline100"===t)d.forEach((function(t){t.symbolSize=8,t.symbolType="square"}));else if("pie"===t){const t=d[0].dataField;delete l.formatSettings,l.formatFunction=function(t,e){return isNaN(t)&&"object"==typeof t?e:t},l.showLabels=!0,d.length=0,d.push({dataField:t,displayText:m.xAxisDataField,initialAngle:0,radius:"60%"})}else if("donut"===t){const t=d[0].dataField;delete l.formatSettings,l.formatFunction=function(t,e){return isNaN(t)&&"object"==typeof t?e:t},l.showLabels=!0,d.length=0,d.push({dataField:t,displayText:m.xAxisDataField,initialAngle:0,radius:"60%",innerRadius:"30%"})}else if("bar"===t)t="column",l.orientation="horizontal",s.xAxis.textRotationAngle=90,s.valueAxis.textRotationAngle=30,s.valueAxis.flip=!0;else if("stackedbar"===t)t="stackedcolumn",l.orientation="horizontal",s.xAxis.textRotationAngle=90,s.valueAxis.textRotationAngle=30,s.valueAxis.flip=!0;else if("stackedbar100"===t)t="stackedcolumn100",l.orientation="horizontal",s.xAxis.textRotationAngle=90,s.valueAxis.textRotationAngle=30,s.valueAxis.flip=!0;else if("area"===t||"stackedarea"===t||"stackedarea100"===t){let t=1;for(let e=0;e<d.length;e++)d[e].opacity=t,t-=.2,t=Math.max(.3,t)}else"pyramid"===t?(t="stackedcolumn",l.columnsTopWidthPercent=0,l.columnsBottomWidthPercent=100,l.columnsGapPercent=50,l.seriesGapPercent=0):"funnel"===t&&(t="stackedcolumn",l.columnsTopWidthPercent=100,l.columnsBottomWidthPercent=30,l.columnsGapPercent=50,l.seriesGapPercent=0);return l.type=t,n.onChartInit&&n.onChartInit(s),s}if(n.header.visible&&n.$.header.firstElementChild){const e=n.enableShadowDOM?n.shadowRoot.getElementById(t):n.querySelector("#"+t);n.$.header.firstElementChild.classList.add("warning"),e&&e.classList.add("warning"),setTimeout((function(){n.$.header.firstElementChild.classList.remove("warning"),e&&e.classList.remove("warning")}),1e3)}}createChart(t,e){const n=this;n.charting.type=t;const r=n.getChart(t,e);if(n.charting.appendTo){const t="string"===n.charting.appendTo?document.querySelector(n.charting.appendTo):n.charting.appendTo;t&&t.appendChild(r)}else n._openChartDialog(r,t)}_openChartDialog(t,e){const n=this;if(!n.charting.dialog.enabled)return!1;const r=n._dialogChart||n._createDialog(n.charting.dialog),i=e.substring(0,1).toUpperCase()+e.substring(1),a="{{message}}"===n.charting.dialog.header?n.localize("dialogChartHeader",{value:i}):n.charting.dialog.header;t.style.width="100%",t.style.height="100%",r.header.innerHTML=a;const o=document.createElement("div");r.header.appendChild(o),o.classList.add("smart-icon-button","smart-icon-expand","smart-dialog-expand-button"),r.content.innerHTML="",r.content.style.width="100%",r.content.style.height="100%",r.btnCancel.classList.add("smart-hidden"),r.btnToggle.classList.add("show"),r.edit=()=>{void 0===r.edit?r.edit=!0:r.edit=!r.edit},n._resizable(r,r,"bottom-right-top-left",400,400),n._dialogChart||(r.modal=!0,r.onOpen=function(){n.charting.dialog.visible=!0},r.onClose=function(){n.charting.dialog.visible=!1},r.btnConfirm.onclick=function(){r.close()},r.btnClose.onclick=function(){r.close()},r.onkeydown=function(t){"Escape"===t.key&&r.close()},n._dialogChart=r),r.open(),setTimeout((function(){r.btnConfirm.focus(),r.content.innerHTML='\n <style>\n .smart-grid-chart-container {\n display: flex;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n gap: 20px;\n font-size: var(--smart-font-size);\n overflow: hidden;\n color: var(--smart-background-color);\n background: var(--smart-background);\n }\n\n .smart-grid-chart-main-content {\n flex: 3;\n display: flex;\n }\n\n .smart-icon-download {\n height: 20px;\n align-self: end;\n color:var(--smart-primary);\n }\n\n .smart-grid-chart-sidebar {\n flex: 1;\n width: 190px;\n max-width: 190px;\n display: flex;\n flex-direction: column;\n }\n\n .smart-grid-chart-categoy-container {\n overflow: auto;\n }\n @media (max-width: 768px) {\n .smart-grid-chart-container {\n flex-direction: column;\n }\n\n .smart-grid-chart-sidebar {\n margin-left: 0;\n margin-top: 20px;\n padding: 10px;\n }\n }\n </style>\n </style>\n <div class="smart-grid-chart-container">\n <main class="smart-grid-chart-main-content">\n \n </main>\n <aside class="smart-grid-chart-sidebar">\n \n </aside>\n </div>\n ';const e=r.content.querySelector(".smart-grid-chart-main-content");e.appendChild(t);const i=document.createElement("span");e.appendChild(i),i.classList.add("smart-grid-icon","show","smart-icon-download"),i.title=n.localize("download"),i.onclick=()=>{t.saveAsPNG(t.caption||"chart")};const a=r.content.querySelector(".smart-grid-chart-sidebar"),o=`\n <style>\n .smart-grid-chart-category {\n margin-bottom: 10px;\n }\n .smart-grid-chart-icons {\n display: flex;\n flex-wrap: wrap;\n gap: 5px;\n }\n .smart-grid-chart-icon-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center; \n }\n .smart-grid-chart-icon-container svg:hover {\n transform: scale(1.1);\n }\n .smart-grid-chart-icon-container.selected svg {\n border: 2px solid var(--smart-border);\n }\n \n .smart-grid-chart-icon-container svg {\n width: 48px;\n height: 48px;\n margin-bottom: 10px;\n transition: transform 0.3s ease;\n cursor: pointer;\n }\n .smart-grid-chart-color-selector {\n bottom: 20px;\n left: 50%;\n padding: 10px;\n border-radius: 20px;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);\n display: flex;\n align-items: center;\n width: 100%;\n height: 44px;\n }\n .smart-grid-chart-scroll-button {\n border: none;\n border-radius: 50%;\n width: 12px;\n height: 12px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n transition: background-color 0.3s;\n }\n .smart-grid-chart-scroll-button:hover {\n background-color: var(--smart-surface);\n }\n .smart-grid-chart-scroll-button:disabled {\n cursor: not-allowed;\n }\n .smart-grid-chart-color-container {\n display: flex;\n gap: 10px;\n overflow-x: auto;\n scroll-behavior: smooth;\n flex-grow: 1;\n padding: 0 10px;\n scrollbar-width: none;\n -ms-overflow-style: none;\n }\n .smart-grid-chart-color-container::-webkit-scrollbar {\n display: none;\n }\n .smart-grid-chart-color-circle {\n width: 12px;\n height: 12px;\n border-radius: 50%;\n cursor: pointer;\n border: 2px solid transparent;\n transition: border-color 0.3s ease;\n flex-shrink: 0;\n }\n .smart-grid-chart-color-circle:hover,\n .smart-grid-chart-color-circle.selected {\n border-color: var(--smart-border);\n }\n\n .smart-grid-chart-tab {\n width: 50%;\n padding: 5px 10px;\n cursor: pointer;\n transition: background-color 0.3s, color 0.3s;\n border-bottom: 2px solid transparent;\n text-align: center;\n }\n .smart-grid-chart-tab-content {\n padding: 10px;\n overflow: auto;\n }\n .smart-grid-chart-tabs {\n display: flex;\n border-bottom: 2px solid var(--smart-border);\n background-color: var(--smart-surface);\n }\n .smart-grid-chart-tab.active {\n background-color: var(--smart-background);\n color: var(--smart-primary);\n border-bottom: 2px solid var(--smart-primary);\n }\n .smart-grid-chart-setting {\n display: flex;\n flex-direction: column;\n }\n </style>\n <div class="smart-flex smart-grid-chart-tabs">\n <div class="active smart-grid-chart-tab">\n ${n.localize("dialogAddColumnType")}\n </div>\n <div class="smart-grid-chart-tab">\n ${n.localize("commandBarCustomize")}\n </div>\n </div>\n <div class="smart-grid-chart-tab-content smart-grid-chart-categoy-container">\n \x3c!-- Column Charts --\x3e\n <div class="smart-grid-chart-category">\n <label>Column</h2>\n <div class="smart-grid-chart-icons">\n <div type="column" title="Clustered" class="smart-grid-chart-icon-container">\n \x3c!-- Column Clustered --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="Column clustered">\n <rect x="12" y="28" width="8" height="22" rx="1.5" class="color1"/>\n <rect x="22" y="22" width="8" height="28" rx="1.5" class="color2"/>\n <rect x="32" y="18" width="8" height="32" rx="1.5" class="color3"/>\n </svg>\n </div>\n <div type="stackedcolumn" title="Stacked" class="smart-grid-chart-icon-container">\n \x3c!-- Stacked Column --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="Stacked column">\n <rect x="12" y="38" width="8" height="12" class="color1"/>\n <rect x="12" y="28" width="8" height="10" class="color2"/>\n <rect x="12" y="18" width="8" height="10" class="color3"/>\n <rect x="24" y="34" width="8" height="16" class="color1"/>\n <rect x="24" y="24" width="8" height="10" class="color2"/>\n <rect x="24" y="14" width="8" height="10" class="color3"/>\n <rect x="36" y="30" width="8" height="20" class="color1"/>\n <rect x="36" y="20" width="8" height="10" class="color2"/>\n <rect x="36" y="12" width="8" height="8" class="color3"/>\n </svg>\n </div>\n <div type="stackedcolumn100" title="100% Stacked" class="smart-grid-chart-icon-container">\n \x3c!-- 100% Stacked Column --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="100% stacked column">\n <rect x="12" y="40" width="8" height="10" class="color1"/>\n <rect x="12" y="28" width="8" height="12" class="color2"/>\n <rect x="12" y="18" width="8" height="10" class="color3"/>\n <rect x="24" y="40" width="8" height="10" class="color1"/>\n <rect x="24" y="28" width="8" height="12" class="color2"/>\n <rect x="24" y="18" width="8" height="10" class="color3"/>\n <rect x="36" y="40" width="8" height="10" class="color1"/>\n <rect x="36" y="28" width="8" height="12" class="color2"/>\n <rect x="36" y="18" width="8" height="10" class="color3"/>\n </svg>\n </div>\n </div>\n </div>\n\n \x3c!-- Bar Charts --\x3e\n <div class="smart-grid-chart-category">\n <label>Bar</label>\n <div class="smart-grid-chart-icons">\n <div type="bar" title="Grouped" class="smart-grid-chart-icon-container">\n \x3c!-- Bar Grouped --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="Bar grouped">\n <rect x="10" y="14" width="44" height="6" rx="3" class="color1"/>\n <rect x="10" y="28" width="36" height="6" rx="3" class="color2"/>\n <rect x="10" y="42" width="30" height="6" rx="3" class="color3"/>\n </svg>\n </div>\n <div type="stackedbar" title="Stacked" class="smart-grid-chart-icon-container">\n \x3c!-- Stacked Bar --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="Stacked bar">\n <rect x="10" y="14" width="16" height="6" class="color1"/>\n <rect x="26" y="14" width="14" height="6" class="color2"/>\n <rect x="40" y="14" width="14" height="6" class="color3"/>\n <rect x="10" y="28" width="20" height="6" class="color1"/>\n <rect x="30" y="28" width="12" height="6" class="color2"/>\n <rect x="42" y="28" width="14" height="6" class="color3"/>\n <rect x="10" y="42" width="24" height="6" class="color1"/>\n <rect x="34" y="42" width="10" height="6" class="color2"/>\n <rect x="44" y="42" width="16" height="6" class="color3"/>\n </svg>\n </div>\n <div type="stackedbar100" title="100% Stacked" class="smart-grid-chart-icon-container">\n \x3c!-- 100% Stacked Bar --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="100% stacked bar">\n <rect x="10" y="14" width="20" height="6" class="color1"/>\n <rect x="30" y="14" width="14" height="6" class="color2"/>\n <rect x="44" y="14" width="10" height="6" class="color3"/>\n <rect x="10" y="28" width="20" height="6" class="color1"/>\n <rect x="30" y="28" width="14" height="6" class="color2"/>\n <rect x="44" y="28" width="10" height="6" class="color3"/>\n <rect x="10" y="42" width="20" height="6" class="color1"/>\n <rect x="30" y="42" width="14" height="6" class="color2"/>\n <rect x="44" y="42" width="10" height="6" class="color3"/>\n </svg>\n </div>\n </div>\n </div>\n\n \x3c!-- Line Charts --\x3e\n <div class="smart-grid-chart-category">\n <label>Line</label>\n <div class="smart-grid-chart-icons">\n <div type="line" title="Multi" class="smart-grid-chart-icon-container">\n \x3c!-- Multi Line --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="Line multi">\n <polyline style="fill: none;" points="8,44 18,34 30,38 44,22 56,28" fill="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="color1"/>\n <polyline style="fill: none;" points="8,36 18,28 30,30 44,20 56,24" fill="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="color2"/>\n <polyline style="fill: none;" points="8,48 18,40 30,30 44,34 56,38" fill="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="color3"/>\n </svg>\n </div>\n \n <div type="stackedline" title="Stacked" class="smart-grid-chart-icon-container">\n \x3c!-- Stacked Line --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="Stacked line">\n <polyline style="fill: none;" points="8,48 18,40 30,42 44,32 56,36" fill="none" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="color1"/>\n <polyline style="fill: none;" points="8,44 18,36 30,38 44,26 56,30" fill="none" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="color2"/>\n <polyline style="fill: none;" points="8,40 18,32 30,34 44,20 56,24" fill="none" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="color3"/>\n </svg>\n </div>\n <div type="stackedline100" title="100% Stacked" class="smart-grid-chart-icon-container">\n \x3c!-- 100% Stacked Line --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="100% stacked line">\n <polyline style="fill: none;" points="8,48 18,42 30,44 44,36 56,40" fill="none" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="color1"/>\n <polyline style="fill: none;" points="8,36 18,32 30,34 44,28 56,32" fill="none" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="color2"/>\n <polyline style="fill: none;" points="8,24 18,22 30,24 44,20 56,24" fill="none" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="color3"/>\n </svg>\n </div>\n </div>\n </div>\n\n \x3c!-- Area Charts --\x3e\n <div class="smart-grid-chart-category">\n <label>Area</label>\n <div class="smart-grid-chart-icons">\n <div type="area" title="Area" class="smart-grid-chart-icon-container">\n \x3c!-- Area --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56">\n <polygon points="8,52 8,42 20,34 32,38 44,28 56,32 56,52" class="color1" opacity="0.9"/>\n <polygon points="8,52 8,46 20,38 32,42 44,34 56,36 56,52" class="color2" opacity="0.75"/>\n <polygon points="8,52 8,48 20,42 32,46 44,40 56,44 56,52" class="color3" opacity="0.6"/>\n </svg>\n </div>\n <div type="stackedarea" title="Stacked" class="smart-grid-chart-icon-container">\n \x3c!-- Stacked Area --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56">\n <polygon points="8,52 8,42 20,34 32,38 44,28 56,32 56,52" class="color1" opacity="0.9"/>\n <polygon points="8,52 8,46 20,38 32,42 44,34 56,36 56,52" class="color2" opacity="0.75"/>\n <polygon points="8,52 8,48 20,42 32,46 44,40 56,44 56,52" class="color3" opacity="0.6"/>\n </svg>\n </div>\n <div type="stackedarea100" title="100% Stacked" class="smart-grid-chart-icon-container">\n \x3c!-- 100% Stacked Area --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56">\n <polygon points="8,52 8,44 20,36 32,40 44,32 56,36 56,52" class="color1" opacity="0.9"/>\n <polygon points="8,44 8,36 20,30 32,34 44,28 56,30 56,44" class="color2" opacity="0.75"/>\n <polygon points="8,36 8,28 20,24 32,28 44,24 56,28 56,36" class="color3" opacity="0.6"/>\n </svg>\n </div>\n </div>\n </div>\n\n \x3c!-- Pie Charts --\x3e\n <div class="smart-grid-chart-category">\n <label>Pie</label>\n <div class="smart-grid-chart-icons">\n <div type="pie" title="Pie" class="smart-grid-chart-icon-container">\n \x3c!-- Pie Chart --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56">\n <path d="M32 32 L32 12 A20 20 0 0 1 52 32 Z" class="color1"/>\n <path d="M32 32 L52 32 A20 20 0 0 1 24 50 Z" class="color2"/>\n <path d="M32 32 L24 50 A20 20 0 0 1 32 12 Z" class="color3"/>\n </svg>\n </div>\n <div type="donut" title="Donut" class="smart-grid-chart-icon-container">\n \x3c!-- Donut Chart --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56">\n <path d="M32,12 A20,20 0 0 1 52,32 L42,32 A10,10 0 0 0 32,22 Z" class="color1"/>\n <path d="M52,32 A20,20 0 0 1 24,50 L29,41 A10,10 0 0 0 42,32 Z" class="color2"/>\n <path d="M24,50 A20,20 0 0 1 32,12 L32,22 A10,10 0 0 0 29,41 Z" class="color3"/>\n </svg>\n </div>\n </div>\n </div>\n\n \x3c!-- Scatter/Bubble Charts --\x3e\n <div class="smart-grid-chart-category">\n <label>Scatter / Bubble</label>\n <div class="smart-grid-chart-icons">\n <div type="scatter" title="Scatter" class="smart-grid-chart-icon-container">\n \x3c!-- Scatter --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="Scatter">\n <circle cx="12" cy="44" r="3" class="color1"/>\n <circle cx="24" cy="34" r="3" class="color1"/>\n <circle cx="36" cy="38" r="3" class="color1"/>\n <circle cx="16" cy="28" r="3" class="color2"/>\n <circle cx="28" cy="24" r="3" class="color2"/>\n <circle cx="40" cy="30" r="3" class="color2"/>\n <circle cx="20" cy="50" r="3" class="color3"/>\n <circle cx="32" cy="40" r="3" class="color3"/>\n <circle cx="44" cy="44" r="3" class="color3"/>\n </svg>\n </div>\n <div type="bubble" title="Bubble" class="smart-grid-chart-icon-container">\n \x3c!-- Bubble --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="Bubble chart">\n \n <circle cx="12" cy="44" r="3" class="color1"/>\n <circle cx="24" cy="34" r="5" class="color1"/>\n <circle cx="36" cy="38" r="4" class="color1"/>\n <circle cx="16" cy="28" r="4" class="color2"/>\n <circle cx="28" cy="24" r="3" class="color2"/>\n <circle cx="40" cy="30" r="5" class="color2"/>\n <circle cx="20" cy="50" r="5" class="color3"/>\n <circle cx="32" cy="40" r="3" class="color3"/>\n <circle cx="44" cy="44" r="4" class="color3"/>\n </svg>\n </div>\n </div>\n </div>\n\n \x3c!-- Funnel / Pyramid Charts --\x3e\n <div class="smart-grid-chart-category">\n <label>Funnel / Pyramid</label>\n <div class="smart-grid-chart-icons">\n <div type="funnel" title="Funnel" class="smart-grid-chart-icon-container">\n \x3c!-- Funnel Chart --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="Funnel chart">\n \n <polygon points="12,12 52,12 44,24 20,24" class="color1"/>\n <polygon points="20,24 44,24 38,36 26,36" class="color2"/>\n <polygon points="26,36 38,36 34,48 30,48" class="color3"/>\n </svg>\n </div>\n <div type="pyramid" title="Pyramid" class="smart-grid-chart-icon-container">\n \x3c!-- Pyramid Chart --\x3e\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" aria-label="Pyramid chart">\n \n <polygon points="12,48 52,48 52,44 12,44" class="color1"/>\n <polygon points="20,40 44,40 44,36 20,36" class="color2"/>\n <polygon points="28,32 36,32 36,28 28,28" class="color3"/>\n </svg>\n </div>\n </div>\n </div>\n </div>\n <div class="smart-grid-chart-tab-content">\n <div class="smart-grid-chart-setting">\n Padding\n <input type="number" class="smart-input smart-grid-chart-padding" min="0" max="100" step="1" value="5"/>\n </div>\n <div class="smart-grid-chart-setting" style="margin-top: 10px;">\n Title\n <input type="text" class="smart-input smart-grid-chart-title" value=""/>\n </div>\n <div class="smart-grid-chart-setting" style="margin-top: 10px;">\n Description\n <input type="text" class="smart-input smart-grid-chart-description" value=""/>\n </div>\n <div class="smart-grid-chart-setting" style="margin-top: 10px;">\n X Axis Title\n <input type="text" class="smart-input smart-grid-chart-x-title" value=""/>\n </div>\n <div class="smart-grid-chart-setting" style="margin-top: 10px;">\n Y Axis Title\n <input type="text" class="smart-input smart-grid-chart-y-title" value=""/>\n </div>\n <div class="smart-grid-chart-setting" style="margin-top: 10px;">\n Flip X Axis\n <div class="flip-x-axis"><div></div></div>\n </div>\n <div class="smart-grid-chart-setting" style="margin-top: 10px;">\n Flip Value Axis\n <div class="flip-y-axis"><div></div></div>\n </div>\n <div class="smart-grid-chart-setting" style="margin-top: 10px;">\n Legend\n <div class="show-legend"><div></div></div>\n </div>\n </div>\n \x3c!-- Color Scheme Selector --\x3e\n <div class="smart-grid-chart-color-selector">\n <button class="smart-grid-chart-scroll-button">←</button>\n <div class="smart-grid-chart-color-container"></div>\n <button class="smart-grid-chart-scroll-button">→</button>\n </div>`;a.innerHTML=o;const s=[{name:"scheme01",colors:["#307DD7","#AA4643","#89A54E","#71588F","#4198AF"]},{name:"scheme02",colors:["#7FD13B","#EA157A","#FEB80A","#00ADDC","#738AC8"]},{name:"scheme03",colors:["#E8601A","#FF9639","#F5BD6A","#599994","#115D6E"]},{name:"scheme04",colors:["#D02841","#FF7C41","#FFC051","#5B5F4D","#364651"]},{name:"scheme05",colors:["#25A0DA","#309B46","#8EBC00","#FF7515","#FFAE00"]},{name:"scheme06",colors:["#0A3A4A","#196674","#33A6B2","#9AC836","#D0E64B"]},{name:"scheme07",colors:["#CC6B32","#FFAB48","#FFE7AD","#A7C9AE","#888A63"]},{name:"scheme08",colors:["#3F3943","#01A2A6","#29D9C2","#BDF271","#FFFFA6"]},{name:"scheme09",colors:["#1B2B32","#37646F","#A3ABAF","#E1E7E8","#B22E2F"]},{name:"scheme10",colors:["#5A4B53","#9C3C58","#DE2B5B","#D86A41","#D2A825"]},{name:"scheme11",colors:["#993144","#FFA257","#CCA56A","#ADA072","#949681"]},{name:"scheme12",colors:["#105B63","#EEEAC5","#FFD34E","#DB9E36","#BD4932"]},{name:"scheme13",colors:["#BBEBBC","#F0EE94","#F5C465","#FA7642","#FF1E54"]},{name:"scheme14",colors:["#60573E","#F2EEAC","#BFA575","#A63841","#BFB8A3"]},{name:"scheme15",colors:["#444546","#FFBB6E","#F28D00","#D94F00","#7F203B"]},{name:"scheme16",colors:["#583C39","#674E49","#948658","#F0E99A","#564E49"]},{name:"scheme17",colors:["#142D58","#447F6E","#E1B65B","#C8782A","#9E3E17"]},{name:"scheme18",colors:["#4D2B1F","#635D61","#7992A2","#97BFD5","#BFDCF5"]},{name:"scheme19",colors:["#844341","#D5CC92","#BBA146","#897B26","#55591C"]},{name:"scheme20",colors:["#56626B","#6C9380","#C0CA55","#F07C6C","#AD5472"]},{name:"scheme21",colors:["#96003A","#FF7347","#FFBC7B","#FF4154","#642223"]},{name:"scheme22",colors:["#5D7359","#E0D697","#D6AA5C","#8C5430","#661C0E"]},{name:"scheme23",colors:["#16193B","#35478C","#4E7AC7","#7FB2F0","#ADD5F7"]},{name:"scheme24",colors:["#7B1A25","#BF5322","#9DA860","#CEA457","#B67818"]},{name:"scheme25",colors:["#0081DA","#3AAFFF","#99C900","#FFEB3D","#309B46"]},{name:"scheme26",colors:["#0069A5","#0098EE","#7BD2F6","#FFB800","#FF6800"]},{name:"scheme27",colors:["#FF6800","#A0A700","#FF8D00","#678900","#0069A5"]}];function c(e){const r=`\n .color1 { fill: ${e.colors[0]}; stroke: ${e.colors[0]}; }\n .color2 { fill: ${e.colors[1]}; stroke: ${e.colors[1]}; }\n .color3 { fill: ${e.colors[2]}; stroke: ${e.colors[2]}; }\n `;let i=a.querySelector("#colorSchemeStyle");i||(i=document.createElement("style"),i.id="colorSchemeStyle",document.head.appendChild(i)),i.textContent=r,t.animation="none",t.colorScheme=e.name,n.charting.colorScheme=e.name}function l(){const t=a.querySelector(".smart-grid-chart-color-container"),e=a.querySelector(".smart-grid-chart-scroll-button"),n=a.querySelector(".smart-grid-chart-scroll-button:nth-of-type(2)");0===t.scrollLeft?e.classList.add("smart-hidden"):e.classList.remove("smart-hidden"),t.scrollLeft+t.clientWidth>=t.scrollWidth?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden")}c(s.find((t=>t.name===n.charting.colorScheme))||s[0]),function(){const t=a.querySelector(".smart-grid-chart-color-container");s.forEach(((e,n)=>{const r=document.createElement("div");r.className="smart-grid-chart-color-circle",r.style.backgroundColor=e.colors[0],r.dataset.scheme=e.name,r.title=e.name,0===n&&r.classList.add("selected"),r.addEventListener("click",(()=>{a.querySelectorAll(".smart-grid-chart-color-circle").forEach((t=>t.classList.remove("selected"))),r.classList.add("selected"),c(e)})),t.appendChild(r)}))}(),function(){const t=a.querySelector(".smart-grid-chart-color-container"),e=a.querySelector(".smart-grid-chart-scroll-button"),n=a.querySelector(".smart-grid-chart-scroll-button:nth-of-type(2)");e.addEventListener("click",(()=>{t.scrollBy({left:-100,behavior:"smooth"}),setTimeout(l,300)})),n.addEventListener("click",(()=>{t.scrollBy({left:100,behavior:"smooth"}),setTimeout(l,300)})),t.addEventListener("scroll",l),l()}();const d=a.querySelectorAll(".smart-grid-chart-tab"),h=a.querySelectorAll(".smart-grid-chart-tab-content");d.forEach(((t,e)=>{t.onclick=()=>{d.forEach((t=>t.classList.remove("active"))),t.classList.add("active"),h.forEach((t=>t.style.display="none")),h[e].style.display="block";const n=a.querySelector(".smart-grid-chart-color-selector");n.style.display=1===e?"none":"flex"}})),h.forEach(((t,e)=>t.style.display=0===e?"block":"none")),h[0].querySelectorAll(".smart-grid-chart-icon-container").forEach((e=>{e.getAttribute("type")===n.charting.type&&e.classList.add("selected"),e.onclick=()=>{const r=e.getAttribute("type");n.charting.type=r,h[0].querySelectorAll(".smart-grid-chart-icon-container").forEach((t=>t.classList.remove("selected"))),e.classList.add("selected");const i=n.getChart(r);i&&(i.animation="none",i.colorScheme=t.colorScheme,i.caption=t.caption,i.description=t.description,i.padding=t.padding),i.style.width="100%",i.style.height="100%",t.parentElement.replaceChild(i,t),t=i}}));const g=h[1].querySelector(".flip-x-axis"),m=h[1].querySelector(".flip-y-axis"),p=h[1].querySelector(".show-legend");n._createColumnBooleanEditor(g.firstElementChild,{value:"bottom"!==t.xAxis.position},g,g.parentElement,document.createElement("span")),n._createColumnBooleanEditor(m.firstElementChild,{value:"left"!==t.valueAxis.position},m,m.parentElement,document.createElement("span")),n._createColumnBooleanEditor(p.firstElementChild,{value:t.showLegend},p,p.parentElement,document.createElement("span"));const x=h[1].querySelector(".smart-grid-chart-padding");x.onchange=x.oninput=()=>{t.padding.left=n.charting.padding=t.padding.top=t.padding.right=t.padding.bottom=Math.max(0,Math.min(parseInt(x.value),100)),t.refresh()},x.value=n.charting.padding||5;const v=h[1].querySelector(".smart-grid-chart-title");v.value=t.caption,v.onchange=()=>{t.caption=v.value,n.charting.dialog.header=t.caption,r.header.innerHTML=t.caption,n.charting.caption=t.caption},v.value=n.charting.caption||"";const u=h[1].querySelector(".smart-grid-chart-description");u.onchange=()=>{t.description=u.value,n.charting.description=t.description},u.value=n.charting.description||"";const y=h[1].querySelector(".smart-grid-chart-x-title");y.onchange=()=>{t.xAxis.title.text=y.value,n.charting.xAxisTitle=y.value},y.value=n.charting.xAxisTitle||"";const w=h[1].querySelector(".smart-grid-chart-y-title");w.onchange=()=>{t.valueAxis.title.text=w.value,n.charting.yAxisTitle=w.value},w.value=n.charting.yAxisTitle||"",g.firstElementChild.onchange=e=>{t.xAxis.position=e?"top":"bottom",n.charting.xAxisPosition=e,t.refresh()},!1===n.charting.xAxisPosition&&(g.firstElementChild.setAttribute("checked",""),g.firstElementChild.value=!0),m.firstElementChild.onchange=e=>{t.valueAxis.position=e?"right":"left",n.charting.yAxisPosition=e,t.refresh()},!1===n.charting.yAxisPosition&&(m.firstElementChild.setAttribute("checked",""),m.firstElementChild.value=!0),p.firstElementChild.onchange=e=>{t.showLegend=e,n.charting.showLegend=e},!1===n.charting.showLegend&&(p.firstElementChild.removeAttribute("checked"),p.firstElementChild.value=!1)}),100)}});
64
- Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewStatesButton" class="smart-data-view-header-button smart-data-view-states-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ViewStates"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="aiButton" class="smart-data-view-header-button smart-data-view-ai-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ai"></div>\n <div id="resourceButton" class="smart-data-view-header-button smart-data-view-resource-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Resource"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="labelButton" class="smart-data-view-header-button smart-data-view-label-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Lael"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="colorsButton" class="smart-data-view-header-button smart-data-view-colors-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Colors"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customButton" class="smart-data-view-header-button smart-data-view-custom-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Custom"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="boldButton" class="smart-data-view-header-button smart-data-view-bold-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Bold"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="italicButton" class="smart-data-view-header-button smart-data-view-italic-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Italic">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="underlineButton" class="smart-data-view-header-button smart-data-view-underline-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Underline">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="strikethroughButton" class="smart-data-view-header-button smart-data-view-strikethrough-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Strikethrough">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontFamilyButton" class="smart-data-view-header-button smart-data-view-fontfamily-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Family">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontSizeButton" class="smart-data-view-header-button smart-data-view-fontsize-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Size">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="backgroundButton" class="smart-data-view-header-button smart-data-view-background-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Background">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="colorButton" class="smart-data-view-header-button smart-data-view-textcolor-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Text Color">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="view" class="smart-hidden" role="presentation"></div>\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="ai" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="colors" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}_refreshMobileViewTools(){const e=this;e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden"),e.parentNode.classList.add("mobile")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden"),e.parentNode.classList.remove("mobile")}))}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e._refreshMobileViewTools(),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;const o=t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.colorsButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled"),e.$.resourceButton.classList[a]("smart-disabled"),e.$.labelButton.classList[a]("smart-disabled")};o(e.dataSource&&0===e.dataSource.length),t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&"infinite"!==t.scrolling&&o(!1),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","colors-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),t.$.headerDropDown.addEventListener("close",(()=>{t._dropDownCloseDate=new Date})),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget);const a=t.grid.parentElement,o=a?a.scrollTop:0;if(t.grid.header.appendTo){const e=document.querySelector(t.grid.header.appendTo);t.$.headerDropDown.style.top=t.grid.offset(e).top+e.offsetHeight-o+"px"}else t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight-o+"px";const s=()=>{if(e){const a=t.grid.offset(e);if(a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px",a.top+t.$.headerDropDown.offsetHeight>=document.documentElement.clientHeight-40){let e=t.grid.offset(t.grid).top-t.$.headerDropDown.offsetHeight;if(t.grid.header.appendTo){const a=document.querySelector(t.grid.header.appendTo);e=t.grid.offset(a).top-t.$.headerDropDown.offsetHeight}e<0&&(e=0),t.$.headerDropDown.style.top=e+"px"}}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",s())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;if(s.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),350)}const n=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");n&&s.ai&&s.ai.key&&(n.$.addAIFilterButton.classList.remove("smart-hidden"),n.$.aiFilterPrompt.classList.add("smart-hidden"),n.$.spinner.classList.add("smart-hidden"),n.$.addAIFilterButton.onclick=()=>{n.$.aiFilterPrompt.placeholder=s.localize("dialogFilterHeader"),n.$.aiFilterPrompt.classList.toggle("smart-hidden"),n.$.spinner.classList.remove("smart-hidden"),n.$.aiFilterPrompt.focus(),n.$.aiFilterPrompt.parentElement.style.display="flex",n.$.aiFilterPrompt.parentElement.style.flexDirection="column",n.$.aiFilterPrompt.onchange=n.$.aiFilterPrompt.oninput=e=>{const t=()=>{let e=0;const t=setInterval((()=>{n.$.spinner.innerHTML=`\rThinking${".".repeat(e%4)} `,e++}),500);try{s.filterBy(n.$.aiFilterPrompt.value,null,(e=>{n.$.spinner.innerHTML="",n.$.spinner.classList.add("smart-hidden"),clearInterval(t);const a=[];for(let t in e){const o=e[t].filterGroup;for(let e=0;e<o.filters.length;e++){const s=o.filters[e];a.push([t,s.condition,s.value])}}n.value=a}))}catch(e){n.$.spinner.innerHTML=s.localize("noResults"),clearInterval(t)}};"Enter"===e.key?(n.aiTimer&&clearTimeout(n.aiTimer),t()):(n.aiTimer&&clearTimeout(n.aiTimer),n.aiTimer=setTimeout((()=>{t()}),800))}})}openColorsPanel(){const e=this,t=e.dataSource;e._refreshColumns("colors"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden");const a=this.columns.map((e=>{const a=Object.assign({},e),o=t.dataFields.find((e=>e.name===a.dataField));return o&&(a.dataType=o.dataType),a}));super.openColorsPanel(a,null,e.grid),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.grid.closeMenu()}openViewPanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;if(!1===e.grid.appearance.showViewBarAsDropdown)return;let t;e.$.headerDropDown.classList.add("view-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel","colors-panel"),e.$.view.classList.remove("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.format&&e.$.format.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._viewPartCreated?t=e.$.view.firstElementChild:(t=document.createElement("div"),t.classList.add("smart-view-panel","smart-grid-view-bar"),e.$.view.appendChild(t),e.$.viewPanel=t,e._viewPartCreated=!0,e._updateViews()),e._openHeaderDropDown(e.$.viewStatesButton)}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=t.columns.map((e=>{const o=Object.assign({},e),s=t._appliedSorting.dataFields.indexOf(o.dataField),n=a.dataFields.find((e=>e.name===o.dataField));return n&&(o.dataType=n.dataType,o.sortIndex=s,-1!==s&&(o.sortDirection=t._appliedSorting.orderBy[s])),o})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=o.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(o),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;s.closeMenu();const n=t.$.headerDropDown.querySelector("smart-sort-panel");if(!n)return;n.grid=s,n.$.maintainSortContainer.classList.remove("smart-hidden"),s.sorting.maintainSort?n.$.maintainSortContainer.firstElementChild.setAttribute("active",""):n.$.maintainSortContainer.firstElementChild.removeAttribute("active"),n._changeApplyButtonText();const i=n.$.inputNotSorted,r=()=>{const e=n.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};n.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,s=0,n=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(s++,n.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===s||o===s&&i.toString()!==n.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,s=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let n;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)n=o.querySelector("smart-column-panel"),n.locale=e.locale,n.messages=e._innerElementMessages.columnPanel,n.set("dataSource",s),n.propertyChangedHandler("dataSource",void 0,s),n.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=s,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],s=o[0],n=o[1];a.grid.columnByDataField[s].filter=n}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document,a.grid.autoSaveState()}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document,e.grid.autoSaveState()}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")?t="customize":e.$.headerDropDown.classList.contains("view-panel")?t="view":e.$.headerDropDown.classList.contains("colors-panel")&&(t="colors"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,s=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&s.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();t.$.ai.contains(a)&&t._applyAI(),s.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)?t.addSort(o.sortByInfo):t.$.colors.contains(a)&&t.addColors(o.value,o.decorator,o.filters),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target,o=t.grid?t.grid.$.header:null;if(t.grid&&t.grid.header.appendTo&&(o=document.querySelector(t.grid.header.appendTo)),!o)return;t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]);const s=e.originalEvent.composedPath();for(let e=0;e<s.length;e++){const t=s[e];if(t&&t.classList&&t.classList.contains("smart-menu-item")){const e=t.closest("smart-menu");if(e&&e.classList.contains("smart-grid-views-menu"))return;if(e&&e.classList.contains("smart-grid-download-menu"))return}}if(t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),a!==t.$.colorButton&&a!==t.$.backgroundButton&&t._closeColorMenu(),a!==t.$.fontSizeButton&&t._closeFontSizeMenu(),a!==t.$.fontFamilyButton&&t._closeFontFamilyMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||a!==o&&o.contains(a))){const s=a.closest("smart-scroll-viewer"),n=a.closest(".smart-drop-down");if((!s||!o.contains(s.ownerElement))&&(!n||n.ownerElement&&!o.contains(n.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;if(t._dropDownCloseDate&&new Date-t._dropDownCloseDate<500)return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,s=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((t=>!(!t||!1===t._visible||("filter"===e||"sort"===e)&&("sort"===e&&!t.sortOrder||"filter"===e&&!t.filter)&&!1===t.visible))),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null,options:e.editor&&e.editor.dataSource?e.editor.dataSource:null}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;s.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;s.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),t.grid.appearance.showViewBarAsDropdown||t._updateViews(),e.header.onInit&&e.header.onInit(t)}_removeFontFamilyMenu(){const e=this;if(e.fontFamilyMenu){const t=e.fontFamilyMenu.querySelector("smart-menu");t&&e.fontFamilyMenu.removeChild(t)}}_removeFontSizeMenu(){const e=this;if(e.fontSizeMenu){const t=e.fontSizeMenu.querySelector("smart-menu");t&&e.fontSizeMenu.removeChild(t)}}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeLabelMenu(){const e=this;if(e.labelMenu){const t=e.labelMenu.querySelector("smart-menu");t&&e.labelMenu.removeChild(t);const a=e.labelMenu.querySelector(".label");a&&e.labelMenu.removeChild(a)}}_removeResourceMenu(){const e=this;if(e.resourceMenu){const t=e.resourceMenu.querySelector("smart-menu");t&&e.resourceMenu.removeChild(t);const a=e.resourceMenu.querySelector(".label");a&&e.resourceMenu.removeChild(a)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t);const a=e.viewsMenu.querySelector(".label");a&&e.viewsMenu.removeChild(a)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o)=>{const s=document.createElement("smart-menu-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt","grid"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("gridView");break;case"kanban":n="smart-icon-kanban-alt","kanban"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("kanbanView");break;case"card":n="smart-icon-card-alt","card"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("cardView");break;case"scheduler":n="smart-icon-scheduler","scheduler"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("schedulerView");break;case"timeline":n="smart-icon-timeline","timeline"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("timelineView")}return s.label='<span class="smart-grid-icon '+n+'"></span>'+e,s.value=a,s};o.appendChild(s(t.localize("viewGrid"),"grid",!0)),o.appendChild(s(t.localize("viewKanban"),"kanban",!0)),o.appendChild(s(t.localize("viewCard"),"card",!0)),o.appendChild(s(t.localize("viewScheduler"),"scheduler",!0)),a.appendChild(o),e.viewsMenu.insertBefore(a,e.viewsMenu.children[e.viewsMenu.children.length-1]),e.viewsMenu.onpointerup=()=>!1,a.onItemClick=a=>{e._setView(a.detail.value),e._closeViewsMenu(),t.autoSaveState(),e._updateViews()}}_createResourceMenuItems(){const e=this,t=e.grid;e._removeResourceMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._dateStackedBySelect===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};let n=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.editor&&a.editor.dataSource&&a.editor.singleSelect&&a.editor.dataSource.length&&("collaborator"===a.template||"tags"===a.template)&&(o.appendChild(s(a.label,a.icon,0,a.dataField)),n=!0)}if(a.appendChild(o),n&&e.resourceMenu.insertBefore(a,e.resourceMenu.children[e.resourceMenu.children.length-1]),e.resourceMenu.onpointerup=()=>!1,!n){const a=document.createElement("div");a.classList.add("label","smart-flex","middle","center","smart-quiet"),a.style.minHeight="60px",a.style.height="100%",a.innerHTML=t.localize("noGrouping"),e.resourceMenu.appendChild(a)}a.onItemClick=a=>{t._dateStackedBySelect===a.detail.item.value?delete t._dateStackedBySelect:t._dateStackedBySelect=a.detail.item.value,t._onSort&&t._onSort(),e._closeResourceMenu(),t.autoSaveState()}}_updateViews(){const e=this,t=e.grid;if(t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.removeAttribute("aria-expanded"),t.stateSettings.enabled&&t.appearance.showViewBar){const a=e=>{(!t.users.length||!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser)&&(delete t.stateSettings.storage[e.valueName],t.stateSettings.current===e.valueName&&(t.stateSettings.current=""),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],e.valueName,t.stateSettings.storage,t.stringify_object),e.remove())},o=a=>{const o=document.createElement("input");if(o.value=a.valueName,t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser))return;const s=()=>{if(o.value){if(t.stateSettings.storage[o.value])return;const s=t.stateSettings.storage[a.valueName];t.stateSettings.current===a.valueName&&(t.stateSettings.current=o.value),delete t.stateSettings.storage[s.name],s.name=o.value,t.stateSettings.storage[s.name]=s,t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],s.name,t.stateSettings.storage,t.stringify_object),delete t.stateSettings.storage[a.valueName],o.remove();const n=o.value;a.valueName=n;let i="smart-icon-grid-alt";switch(s.view){case"grid":i="smart-icon-grid-alt";break;case"kanban":i="smart-icon-kanban-alt";break;case"card":i="smart-icon-card-alt";break;case"scheduler":i="smart-icon-scheduler";break;case"timeline":i="smart-icon-timeline"}n===t.stateSettings.current?(a.selected=!0,a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',e._refreshViewsButton()}};o.onselectstart=e=>{e.stopPropagation()},o.onpointerdown=o.onpointerup=e=>{e.stopPropagation()},o.onkeydown=e=>{e.stopPropagation()},o.onkeyup=e=>{"Escape"===e.key&&(o.onchange=o.onblur=null,o.remove()),"Enter"===e.key&&(o.onchange=o.onblur=null,s()),e.stopPropagation()},o.onchange=()=>{o.onblur=null,o.onkeyup=null,s()},o.onblur=()=>{o.remove()},o.style.width="100%",o.style.height="100%",o.style.position="absolute",o.style.left="0px",o.style.top="0px",o.style.zIndex=99,o.classList.add("smart-input"),o.classList.add("underlined"),o.style.backgroundColor="var(--smart-background)",o.style.color="var(--smart-background-color)",a.querySelector(".smart-list-item-label-element").appendChild(o),setTimeout((()=>{o.focus()}),50)},s=(e,a,o)=>{const s=document.createElement("smart-list-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt";break;case"kanban":n="smart-icon-kanban-alt";break;case"card":n="smart-icon-card-alt";break;case"scheduler":n="smart-icon-scheduler";break;case"timeline":n="smart-icon-timeline"}return s.value=o,s.valueName=e,e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>')),s};t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.setAttribute("aria-expanded",!0);let n=t.$.viewBar;if(t.appearance.showViewBarAsDropdown&&(n=e.$.viewPanel),t.appearance.viewBarAppendTo&&(n=document.querySelector(t.appearance.viewBarAppendTo),n&&n.classList.add("smart-grid-view-bar")),n&&!n.querySelector(".smart-grid-view-chooser-container")){const a=document.createElement("div");a.classList.add("smart-grid-view-chooser-container","smart-container");const o=document.createElement("div");o.classList.add("new-view"),!1===t.editing.enabled&&o.classList.add("smart-hidden");const s=(a,o)=>{a.stopPropagation(),a.preventDefault(),t.beginUpdate();let s=0,i=[];if(t.stateSettings.storage){for(;t.stateSettings.storage[t.localize("view")+" "+s];)s++;for(let e in t.stateSettings.storage){const a=t.stateSettings.storage[e];i[a.view]=1+i[a.view]||1}}let r="";switch(o){case"grid":r=t.localize("viewGrid");break;case"kanban":r=t.localize("viewKanban");break;case"card":r=t.localize("viewCard");break;case"scheduler":r=t.localize("viewScheduler");break;case"timeline":r=t.localize("viewTimeline")}if(i[o]||(i[o]=""),t.stateSettings.storage){let e=i[o]?t.localize("view")+" "+i[o]:t.localize("view");for(;t.stateSettings.storage[r+" "+e];)e=t.localize("view")+" "+i[o],i[o]++}const l=i[o]?t.localize("view")+" "+i[o]:t.localize("view");if(!n){let a=t.$.viewBar;t.appearance.showViewBarAsDropdown&&(a=e.$.viewPanel),t.appearance.viewBarAppendTo&&(a=document.querySelector(t.appearance.viewBarAppendTo),a&&a.classList.add("smart-grid-view-bar")),a&&(n=a)}if(!n)return void t.endUpdate();n._input.value=r+" "+l,t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,e._closeViewsMenu(),t.resetState(!1);const d=t.view;t.set("view","grid",!1),t._kanban&&t._kanban._reset(),delete t.columnByDataField.taskStatus,"grid"===o&&"grid"!==d?e._setView("grid",!0):"kanban"===o?e._setView("kanban"):"card"===o?e._setView("card"):"scheduler"===o?e._setView("scheduler"):"timeline"===o&&e._setView("timeline"),t.saveState(),t.endUpdate(),e._updateViews(),t.$.fireEvent("viewChanged",{view:t.view})},i=document.createElement("smart-button");i.classList.add("selected"),i.classList.add("view"),i.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-grid-alt"></span>'+t.localize("newGrid")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',i.title=t.localize("gridView");const r=document.createElement("smart-button");r.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-kanban-alt"></span>'+t.localize("newKanban")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',r.classList.add("view"),r.title=t.localize("kanbanView");const l=document.createElement("smart-button");l.classList.add("selected"),l.classList.add("view"),l.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-card-alt"></span>'+t.localize("newCard")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',l.title=t.localize("cardView");const d=document.createElement("smart-button");d.classList.add("selected"),d.classList.add("view"),d.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-scheduler"></span>'+t.localize("newScheduler")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',d.title=t.localize("schedulerView");const c=document.createElement("smart-button");c.classList.add("selected"),c.classList.add("view"),c.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-timeline"></span>'+t.localize("newTimeline")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',c.title=t.localize("timelineView");const u=document.createElement("div");u.classList.add("smart-grid-view-storage"),a.appendChild(u);const m=document.createElement("smart-input");m.classList.add("underlined"),m.placeholder=t.localize("viewNamePlaceholder"),m.hint=t.localize("viewNamePlaceholder"),m.onselectstart=e=>{e.stopPropagation()};const p=document.createElement("div");p.innerHTML="<span>"+t.localize("settings")+'</span><span class="smart-grid-icon show smart-icon-sort-down"></span>',p.classList.add("view-label"),o.appendChild(p);const h=document.createElement("div");o.appendChild(h),h.classList.add("footer"),t.users&&t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(h.classList.add("smart-hidden"),p.classList.add("smart-hidden"))),h.appendChild(i),h.appendChild(r),h.appendChild(l),h.appendChild(d),p.onclick=()=>{p.classList.toggle("collapsed"),h.classList.toggle("collapsed")};const g=document.createElement("div");g.innerHTML='<span class="smart-grid-icon show smart-icon-plus"></span><span><a href="javascript:void();">'+t.localize("createView")+"</a></span>",g.classList.add("view-button"),g.onclick=e=>{let t="grid";r.classList.contains("selected")&&(t="kanban"),l.classList.contains("selected")&&(t="card"),d.classList.contains("selected")&&(t="scheduler"),c.classList.contains("selected")&&(t="timeline"),s(e,t,o)},r.onpointerdown=()=>{r.classList.add("selected"),i.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},i.onpointerdown=()=>{i.classList.add("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},l.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.add("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},d.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.add("selected"),c.classList.remove("selected"),g.click()},c.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.add("selected"),g.click()};const v=()=>{t.stateSettings.storage&&!t.stateSettings.storage[m.value]||m.value&&!t.stateSettings.storage?g.classList.remove("disabled"):g.classList.add("disabled")};m.update=()=>v(),m.onkeyup=m.onchange=()=>{v()},v(),a.appendChild(o),n._storage=u,n._input=m,n.appendChild(a)}let i=t.stateSettings.storage;(i&&0===Object.keys(i).length||!i)&&(n._input.value||("kanban"===t.view?n._input.value=t.localize("newKanban")+" "+t.localize("view"):"card"===t.view?n._input.value=t.localize("newCard")+" "+t.localize("view"):"scheduler"===t.view?n._input.value=t.localize("newScheduler")+" "+t.localize("view"):n._input.value=t.localize("newGrid")+" "+t.localize("view")),t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,i=t.stateSettings.storage);const r=n?n._storage:document.createElement("div");if(r.innerHTML="",i){let e=1;const l=document.createDocumentFragment();let d=[],c=[];for(let e in i){const t=i[e];c[t.name]||(c[t.name]=t,d.push({name:e,value:t}))}d.sort(((e,t)=>{const a=new Date(e.value.date),o=new Date(t.value.date);if(e.value&&e.value.date&&t.value&&t.value.date){if(!e.value.date||!t.value.date)return-1;if(a<o)return-1;if(a>o)return 1;if(a===o)return 0}else{if(e.name<t.name)return-1;if(e.name>t.name)return 1;if(e.name===t.name)return 0}}));let u=[],m=-1;for(let t in d){const a=d[t],o=a.name,n=a.value;e++,u[n.view]=u[n.view]++||1;const i=s(o,n.view,n);i.selected&&(m=parseInt(t),delete i.selected),l.appendChild(i)}if(e){const e=document.createElement("smart-list-box");e.style.width="100%",e.style.height="100%",e.allowDrag=!0,e.allowDrop=!0,e.itemHeight=32,e.mode="vertical",e.style.borderColor="transparent",e.classList.add("smart-grid-views-menu"),e.checkable=!0,e.checkboxes=!0,e.filterable=!0,e.filterInputPlaceholder=t.localize("commandBarSearch")+" "+t.localize("view"),e.selectionMode="one",e.disableAutoCheck=!0,e.rightToLeft=t.rightToLeft,e.ondragend=e=>{const t=e.detail.item;if(i[t.valueName]){const t=e.detail.target;if(t){const e=i[t.valueName],a=e?e.date:null;if(a){let t=new Smart.Utilities.DateTime(a);const o="top"===Smart.ListBox.DragDrop.DropDetails.position?-10:10;t=t.addSeconds(o),e.date=t.toDate().toJSON()}}}},e.onkeydown=t=>{const a=e.querySelector("smart-list-item[checked]");a&&"F2"===t.key&&o(a)},e.onDoubleClick=e=>{const t=e.target.closest("smart-list-item");o(t)},e.onClick=e=>{if(e.target&&e.target.classList.contains("smart-icon-delete")){const t=e.target.closest("smart-list-item");a(t),e.preventDefault(),e.stopPropagation()}else if(e.target&&e.target.classList.contains("smart-icon-mode-edit")){const t=e.target.closest("smart-list-item");o(t),e.preventDefault(),e.stopPropagation()}else if("INPUT"===e.target.nodeName)return},e.appendChild(l),r.appendChild(e),e.clearSelection(),e.selectedIndexes=[m],e.onchange=a=>{if(a.detail&&a.detail.selected){const o=a.detail.addedItems[0];t.loadState(o.valueName),e.querySelectorAll("smart-list-item").forEach((e=>{e.querySelector(".smart-icon-delete").classList.add("show")})),o.querySelector(".smart-icon-delete").classList.remove("show"),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],o.valueName,t.stateSettings.storage,t.stringify_object)}}}if(t.stateSettings.storage)for(;t.stateSettings.storage[t.localize("view")+" "+e];)e++;let p="";switch(t.view){case"grid":p=t.localize("viewGrid");break;case"kanban":p=t.localize("viewKanban");break;case"card":p=t.localize("viewCard");break;case"scheduler":p=t.localize("viewScheduler");break;case"timeline":p=t.localize("viewTimeline")}if(t.stateSettings.storage)for(;t.stateSettings.storage[p+" "+t.localize("view")+" "+u[t.view]];)u[t.view]++;n&&n._input&&(n._input.value=p+" "+t.localize("view")+" "+u[t.view],n._input.update())}}}_setView(e,t){const a=this,o=a.grid;if(o.view===e&&!0!==t)return;o.view;const s=o.context;if("kanban"===e)if(o.context=o,o.view="kanban",o.context=s,o._kanbanInitialized&&o.columnByDataField.taskStatus)if(o.columnByDataField.taskStatus&&o._stackedBy&&o.columnByDataField.taskStatus.dataField!==o._stackedBy){o.beginUpdate(),delete o.columnByDataField.taskStatus;const e=o.columnByDataField[o._stackedBy];o.columnByDataField.taskStatus=e,o._createKanban(e),o._refreshHeaderBar(),o.endUpdate(!1),o._hideSchedulerView(),o._showKanbanView(),a._refresh()}else o._hideSchedulerView(),o._showKanbanView(),a._refresh();else delete o._kanbanInitialized,o._initKanbanView("dynamic","grid");else"grid"===e?(o.context=o,o.view="grid",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"card"===e?(o.context=o,o.view="card",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"scheduler"!==e&&"timeline"!==e||(o.context=o,o.view=e,o.context=s,t?(o._hideKanbanView(),o._showSchedulerView(),a._refresh()):(o._createScheduler(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()));o.$.fireEvent("viewChanged",{view:e}),a._refresh()}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const s=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const s='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+s+e,a.value=t,a};o.appendChild(s(t.localize("download")+" CSV","csv")),o.appendChild(s(t.localize("download")+" XLSX","xlsx")),o.appendChild(s(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")?e._closeViewsMenu():e.resourceMenu&&e.resourceMenu.classList.contains("open")?e._closeResourceMenu():e.labelMenu&&e.labelMenu.classList.contains("open")?e._closeLabelMenu():e.colorMenu&&e.colorMenu.classList.contains("open")&&e._closeColorMenu()}_closeResourceMenu(){const e=this,t=e.resourceMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.resourceButton.classList.remove("selected"),e.$.resourceButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openResourceMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.resourceMenu&&e.resourceMenu.classList.contains("open"))return void e._closeResourceMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.resourceButton.classList.add("selected"),e.$.resourceButton.setAttribute("aria-expanded",!0),e.resourceMenu||(e.resourceMenu=document.createElement("div"),e.resourceMenu.classList.add("smart-grid-column-menu","smart-grid-resource-menu"),e.resourceMenu.setAttribute("theme",e.getAttribute("theme")),e.resourceMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.resourceMenu.classList.add("smart-animate"),e._createResourceMenuItems(),e.resourceMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.resourceMenu):document.body.appendChild(e.resourceMenu);const t=e.$.resourceButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.resourceMenu.offsetWidth,a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.resourceMenu.offsetWidth)),e.resourceMenu.style.left=a+"px",e.resourceMenu.style.top=o+"px",e.resourceMenu.classList.remove("smart-hidden"),e.resourceMenu.classList.add("open")}_closeLabelMenu(){const e=this,t=e.labelMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.labelButton.classList.remove("selected"),e.$.labelButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_createLabelMenuItems(){const e=this,t=e.grid;e._removeLabelMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._labeledBy===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};for(let e=0;e<t.columns.length;e++){const a=t.columns[e];"string"!==a.dataType||a.relationField||"input"!==a.editor.template&&"textarea"!==a.editor.template||o.appendChild(s(a.label,a.icon,0,a.dataField))}a.appendChild(o),e.labelMenu.insertBefore(a,e.labelMenu.children[e.labelMenu.children.length-1]),e.labelMenu.onpointerup=()=>!1,a.onItemClick=a=>{t._labeledBy===a.detail.item.value?delete t._labeledBy:t._labeledBy=a.detail.item.value,t._onSort&&t._onSort(),e._closeLabelMenu(),t.autoSaveState()}}_closeColorMenu(){const e=this,t=e.colorMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.colorButton.classList.remove("selected"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.classList.remove("selected"),e.$.backgroundButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_closeFontSizeMenu(){const e=this,t=e.fontSizeMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontSizeButton.classList.remove("selected"),e.$.fontSizeButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontSizeMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontSizeMenu&&e.fontSizeMenu.classList.contains("open"))return void e._closeFontSizeMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontSizeButton.classList.add("selected"),e.$.fontSizeButton.setAttribute("aria-expanded",!0),e.fontSizeMenu||(e.fontSizeMenu=document.createElement("div"),e.fontSizeMenu.classList.add("smart-grid-column-menu","smart-grid-fontsize-menu"),e.fontSizeMenu.setAttribute("theme",e.getAttribute("theme")),e.fontSizeMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontSizeMenu.classList.add("smart-animate");const t=e.grid;e._removeFontSizeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","8px","10px","12px","14px","18px","24px"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontSizeMenu.appendChild(a),a.onItemClick=t=>{const a=t.detail.value;e._setStyle("fontSize",a)},e.fontSizeMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontSizeMenu):document.body.appendChild(e.fontSizeMenu);const n=e.$.fontSizeButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontSizeMenu.offsetWidth,i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontSizeButton.offsetWidth)),e.fontSizeMenu.style.width="60px",e.fontSizeMenu.style.left=i+"px",e.fontSizeMenu.style.top=r+"px",e.fontSizeMenu.classList.remove("smart-hidden"),e.fontSizeMenu.classList.add("open")}_closeFontFamilyMenu(){const e=this,t=e.fontFamilyMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontFamilyButton.classList.remove("selected"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontFamilyMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontFamilyMenu&&e.fontFamilyMenu.classList.contains("open"))return void e._closeFontFamilyMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontFamilyButton.classList.add("selected"),e.$.fontFamilyButton.setAttribute("aria-expanded",!0),e.fontFamilyMenu||(e.fontFamilyMenu=document.createElement("div"),e.fontFamilyMenu.classList.add("smart-grid-column-menu","smart-grid-fontfamily-menu"),e.fontFamilyMenu.setAttribute("theme",e.getAttribute("theme")),e.fontFamilyMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontFamilyMenu.classList.add("smart-animate");const t=e.grid;e._removeFontFamilyMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","Roboto","Segoe UI","Arial","Georgia","Tahoma","Times New Roman","Courier New","Verdana"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontFamilyMenu.appendChild(a),a.onItemClick=t=>{e._setStyle("fontFamily",t.detail.value)},e.fontFamilyMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontFamilyMenu):document.body.appendChild(e.fontFamilyMenu);const n=e.$.fontFamilyButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontFamilyMenu.offsetWidth,i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontFamilyButton.offsetWidth)),e.fontFamilyMenu.style.width="140px",e.fontFamilyMenu.style.left=i+"px",e.fontFamilyMenu.style.top=r+"px",e.fontFamilyMenu.classList.remove("smart-hidden"),e.fontFamilyMenu.classList.add("open")}_openColorMenu(e,t){const a=this;if(a.grid.editing.isEditing&&a.grid.cancelEdit(),a.colorMenu&&a.colorMenu.classList.contains("open")){if(a.colorMenu.classList.remove("open"),a.colorMenu.isBackground&&t)return void a._closeColorMenu();if(!a.colorMenu.isBackground&&!t)return void a._closeColorMenu()}a.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),a.$.group.classList.add("smart-hidden"),a.$.filter.classList.add("smart-hidden"),a.$.colors.classList.add("smart-hidden"),a.$.customize.classList.add("smart-hidden"),a.$.sort.classList.add("smart-hidden"),a.$.search.classList.add("smart-hidden"),a.$.format.classList.add("smart-hidden"),a.$.view.classList.add("smart-hidden"),a.$.ai.classList.add("smart-hidden"),a.closePanel(),a.$.colorButton.classList.remove("selected"),a.$.colorButton.removeAttribute("aria-expanded"),a.$.backgroundButton.classList.remove("selected"),a.$.backgroundButton.removeAttribute("aria-expanded"),t?(a.$.backgroundButton.classList.add("selected"),a.$.backgroundButton.setAttribute("aria-expanded",!0)):(a.$.colorButton.classList.add("selected"),a.$.colorButton.setAttribute("aria-expanded",!0)),a.colorMenu||(a.colorMenu=document.createElement("div"),a.colorMenu.className="smart-grid-column-menu smart-grid-color-menu smart-color-input-drop-down-menu smart-color-panel smart-input-drop-down-menu underlined-drop-down-menu smart-grid-color-input-drop-down-menu smart-drop-down-box-drop-down-menu smart-color-picker-drop-down-menu smart-grid-color-input",a.colorMenu.setAttribute("theme",a.getAttribute("theme")),a.colorMenu.id=a.id+"_"+a.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),a.colorMenu.innerHTML=a._getColors()),a.colorMenu.classList.add("smart-animate"),a.colorMenu.isBackground=t,a.colorMenu.style.height="auto",a.isInShadowDOM?a.getRootNode().appendChild(a.colorMenu):document.body.appendChild(a.colorMenu);const o=t?a.$.backgroundButton.getBoundingClientRect():a.$.colorButton.getBoundingClientRect();let s=o.left+window.pageXOffset,n=o.bottom+window.pageYOffset;s+a.colorMenu.offsetWidth>window.innerWidth&&(s=o.right+window.pageXOffset-a.colorMenu.offsetWidth,s+a.colorMenu.offsetWidth>window.innerWidth&&(s=window.innerWidth-a.colorMenu.offsetWidth)),a.colorMenu.style.left=s+"px",a.colorMenu.style.top=n+"px",a.colorMenu.classList.remove("smart-hidden"),a.colorMenu.classList.add("open"),a.colorMenu.querySelectorAll(".color-sample").forEach((t=>{t.classList.remove("selected"),t.getAttribute("value")===e&&t.classList.add("selected")})),a.colorMenu.onpointerup=e=>{const o=e.target.getAttribute("value");void 0!==o&&(a._closeColorMenu(),t?(a.$.backgroundButton.style.setProperty("--smart-surface-color",o),a._setStyle("background",o)):(a.$.colorButton.style.setProperty("--smart-surface-color",o),a._setStyle("color",o)))}}_openLabelMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.labelMenu&&e.labelMenu.classList.contains("open"))return void e._closeLabelMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.labelButton.classList.add("selected"),e.$.labelButton.setAttribute("aria-expanded",!0),e.labelMenu||(e.labelMenu=document.createElement("div"),e.labelMenu.classList.add("smart-grid-column-menu","smart-grid-label-menu"),e.labelMenu.setAttribute("theme",e.getAttribute("theme")),e.labelMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.labelMenu.classList.add("smart-animate"),e._createLabelMenuItems(),e.labelMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.labelMenu):document.body.appendChild(e.labelMenu);const t=e.$.labelButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.labelMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.labelMenu.offsetWidth,a+e.labelMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.labelMenu.offsetWidth)),e.labelMenu.style.left=a+"px",e.labelMenu.style.top=o+"px",e.labelMenu.classList.remove("smart-hidden"),e.labelMenu.classList.add("open")}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu","smart-grid-view-chooser"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_setStyle(e,t){const a=this.grid;if(!a._selection)return;const o=a._selection.cells;if(o&&Object.keys(o).length>0){const o=a.getSelectedCells(!1),s={};for(let n=0;n<o.length;n++){const i=o[n],r=i[0],l=i[1],d=a.rowById[r],c=d.style?JSON.parse(JSON.stringify(d.style)):{};s[r]||(s[r]={});for(let e in c){for(let e=0;e<a.columns.length;e++){const t=a.columns[e].dataField;c[t]&&(s[r][t]=c[t])}c[e]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].indexOf(e)>=0&&(s[r][e]=c[e])}const u=s[r];if(d){const a=d.getCell(l);if(a){const o=a.canNotify;a.canNotify=!1,"textDecoration"===e?(a[e]||(a[e]=""),a[e].indexOf(t)>=0?a[e]=a[e].replace(t,"").trim():a[e]+=" "+t):a[e]===t?a[e]="":a[e]=t,a.canNotify=o;const s=u[a.column.dataField]={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[e]&&(s[e]=a[e])}))}const o=d.canNotify;if(0===Object.keys(u).length){delete s[r];continue}d.canNotify=!1,d.style=u,d.canNotify=o}}if(a.onRowStyle){const e=[],t=[],o=[];Object.keys(s).forEach(((n,i)=>{const r=s[n];e.push(i),t.push(a.rowById[n]),o.push(r)})),a.onRowStyle(e,t,o)}a._recycle(!1,!0)}else{const o=a.getSelectedRowIds(),s=[],n=[],i=[];for(let r=0;r<o.length;r++){const l=o[r],d=a.rowById[l],c=d.style?JSON.parse(JSON.stringify(d.style)):{};if("textDecoration"===e?(c[e]||(c[e]=""),c[e].indexOf(t)>=0?c[e]=c[e].replace(t,"").trim():c[e]+=" "+t):c[e]===t?c[e]="":c[e]=t,a.setRowStyle(l,c),a.onRowStyle){s.push(d.index),n.push(d);const e={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((t=>{c[t]&&(e[t]=c[t])})),i.push(e)}}a.onRowStyle&&a.onRowStyle(s,n,i)}}_updateTools(){const e=this,t=e.grid;if(!t._selection)return;const a=t._selection.cells;if(a&&Object.keys(a).length>0){const a=t.getSelectedCells(!1);for(let o=0;o<a.length;o++){const s=a[o],n=s[0],i=s[1],r=t.rowById[n];if(r){const t=r.getCell(i);if(t){e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),e.$.backgroundButton.style.setProperty("--smart-surface-color","inherit"),e.$.colorButton.style.setProperty("--smart-surface-color","inherit"),e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),t.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),t.background&&e.$.backgroundButton.style.setProperty("--smart-surface-color",t.background),t.color&&e.$.colorButton.style.setProperty("--smart-surface-color",t.color),t.fontStyle&&e.$.italicButton.setAttribute("aria-expanded","true"),t.textDecoration&&(t.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),t.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true")),t.fontSize&&e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontSize&&e.setAttribute("focus","")})),t.fontFamily&&e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontFamily&&e.setAttribute("focus","")}));break}}}}else{const a=t.getSelectedRowIds();for(let o=0;o<a.length;o++){const s=a[o],n=t.rowById[s],i=n.style?JSON.parse(JSON.stringify(n.style)):{};e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),i.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),i.background&&(e.$.backgroundButton.style.color=i.background),i.color&&(e.$.colorButton.style.color=i.color),i.fontStyle&&e.$.fontFamilyButton.setAttribute("aria-expanded","true"),i.textDecoration&&(i.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),i.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true"));break}}}_getColors(){return'<div class="default-samples-container grid-mode-container smart-container" role="presentation" style="">\n <div class="grid-samples-container" role="menu">\n <div id="colorInputca5bItem858b" data-label="#D50000" value="#D50000" role="menuitem" aria-label="#D50000" class="color-sample" style="background-color: rgb(213, 0, 0);"></div>\n <div id="colorInputca5bItem963b" data-label="#E67C73" value="#E67C73" role="menuitem" aria-label="#E67C73" class="color-sample" style="background-color: rgb(230, 124, 115);"></div><div id="colorInputca5bItem2f1f" data-label="#F4511E" value="#F4511E" role="menuitem" aria-label="#F4511E" class="color-sample" style="background-color: rgb(244, 81, 30);"></div><div id="colorInputca5bItem1a87" data-label="#F6BF26" value="#F6BF26" role="menuitem" aria-label="#F6BF26" class="color-sample" style="background-color: rgb(246, 191, 38);"></div><div id="colorInputca5bItem4c44" data-label="#0B8043" value="#0B8043" role="menuitem" aria-label="#0B8043" class="color-sample" style="background-color: rgb(11, 128, 67);"></div><div id="colorInputca5bItem8669" data-label="#33B679" value="#33B679" role="menuitem" aria-label="#33B679" class="color-sample" style="background-color: rgb(51, 182, 121);"></div><div id="colorInputca5bItem488c" data-label="#3F51B5" value="#3F51B5" role="menuitem" aria-label="#3F51B5" class="color-sample" style="background-color: rgb(63, 81, 181);"></div><div id="colorInputca5bItemc3aa" data-label="#039BE5" value="#039BE5" role="menuitem" aria-label="#039BE5" class="color-sample" style="background-color: rgb(3, 155, 229);"></div><div id="colorInputca5bItem4277" data-label="#7986CB" value="#7986CB" role="menuitem" aria-label="#7986CB" class="color-sample" style="background-color: rgb(121, 134, 203);"></div><div id="colorInputca5bItem3b61" data-label="#8C47FF" value="#8C47FF" role="menuitem" aria-label="#8C47FF" class="color-sample" style="background-color: rgb(140, 71, 255);"></div><div id="colorInputca5bItema4a6" data-label="#8E24AA" value="#8E24AA" role="menuitem" aria-label="#8E24AA" class="color-sample" style="background-color: rgb(142, 36, 170);"></div><div id="colorInputca5bItemdd64" data-label="#FF36C2" value="#FF36C2" role="menuitem" aria-label="#FF36C2" class="color-sample" style="background-color: rgb(255, 54, 194);"></div><div id="colorInputca5bItem07d0" data-label="#616161" value="#616161" role="menuitem" aria-label="#616161" class="color-sample" style="background-color: rgb(97, 97, 97);"></div><div id="colorInputca5bItemb2a4" data-label="#454545" value="#454545" role="menuitem" aria-label="#454545" class="color-sample" style="background-color: rgb(69, 69, 69);"></div><div id="colorInputca5bItem8de8" data-label="#949494" value="#949494" role="menuitem" aria-label="#949494" class="color-sample" style="background-color: rgb(148, 148, 148);"></div><div id="colorInputca5bItem75ce" data-label="#000000" value="#000000" role="menuitem" aria-label="#000000" class="color-sample" style="background-color: rgb(0, 0, 0);"></div></div><div class="grid-samples-container" role="menu"><div id="colorInputca5bItem932f" data-label="#FF9EB7" value="#FF9EB7" role="menuitem" aria-label="#FF9EB7" class="color-sample" style="background-color: rgb(255, 158, 183);"></div><div id="colorInputca5bItemc244" data-label="#FFCFC9" value="#FFCFC9" role="menuitem" aria-label="#FFCFC9" class="color-sample" style="background-color: rgb(255, 207, 201);"></div><div id="colorInputca5bItemcfb1" data-label="#FFD66D" value="#FFD66D" role="menuitem" aria-label="#FFD66D" class="color-sample" style="background-color: rgb(255, 214, 109);"></div><div id="colorInputca5bItem2827" data-label="#FFEBB6" value="#FFEBB6" role="menuitem" aria-label="#FFEBB6" class="color-sample" style="background-color: rgb(255, 235, 182);"></div><div id="colorInputca5bItem766c" data-label="#93DF89" value="#93DF89" role="menuitem" aria-label="#93DF89" class="color-sample" style="background-color: rgb(147, 223, 137);"></div><div id="colorInputca5bItem10b3" data-label="#D1F7C4" value="#D1F7C4" role="menuitem" aria-label="#D1F7C4" class="color-sample" style="background-color: rgb(209, 247, 196);"></div><div id="colorInputca5bItemb8a4" data-label="#9DC7FF" value="#9DC7FF" role="menuitem" aria-label="#9DC7FF" class="color-sample" style="background-color: rgb(157, 199, 255);"></div><div id="colorInputca5bItem78ff" data-label="#D0F0FD" value="#D0F0FD" role="menuitem" aria-label="#D0F0FD" class="color-sample" style="background-color: rgb(208, 240, 253);"></div><div id="colorInputca5bItem71b8" data-label="#CDAFFF" value="#CDAFFF" role="menuitem" aria-label="#CDAFFF" class="color-sample" style="background-color: rgb(205, 175, 255);"></div><div id="colorInputca5bIteme4d6" data-label="#ECE1FD" value="#ECE1FD" role="menuitem" aria-label="#ECE1FD" class="color-sample" style="background-color: rgb(236, 225, 253);"></div><div id="colorInputca5bItem3576" data-label="#FA9DE2" value="#FA9DE2" role="menuitem" aria-label="#FA9DE2" class="color-sample" style="background-color: rgb(250, 157, 226);"></div><div id="colorInputca5bItem8136" data-label="#FFDAF6" value="#FFDAF6" role="menuitem" aria-label="#FFDAF6" class="color-sample" style="background-color: rgb(255, 218, 246);"></div><div id="colorInputca5bItem26e5" data-label="#CBCBCB" value="#CBCBCB" role="menuitem" aria-label="#CBCBCB" class="color-sample" style="background-color: rgb(203, 203, 203);"></div><div id="colorInputca5bItemdc8a" data-label="#EDEDED" value="#EDEDED" role="menuitem" aria-label="#EDEDED" class="color-sample" style="background-color: rgb(237, 237, 237);"></div><div id="colorInputca5bItemd895" data-label="#FFFFFF" value="#FFFFFF" role="menuitem" aria-label="#FFFFFF" class="color-sample" style="background-color: rgb(255, 255, 255); border-color: var(--smart-border); border-style: solid; border-width: 1px;"></div><div id="colorInputca5bItem7231" data-label="" value="" role="menuitem" aria-label="" class="color-sample no-color"></div></div>\n </div>'}_boldCommand(){this._setStyle("fontWeight","bold"),this._updateTools()}_italicCommand(){this._setStyle("fontStyle","italic"),this._updateTools()}_underlineCommand(){this._setStyle("textDecoration","underline"),this._updateTools()}_strikethroughCommand(){this._setStyle("textDecoration","line-through"),this._updateTools()}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("colors")>=0?e.$.colorsButton.classList.remove("smart-hidden"):e.$.colorsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0&&t.editing.enabled?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("states")>=0&&t.stateSettings.enabled&&!t.appearance.viewBarAppendTo?e.$.viewStatesButton.classList.remove("smart-hidden"):e.$.viewStatesButton.classList.add("smart-hidden"),t.header.buttons.indexOf("formatting")>=0&&"grid"===t.view?(e.$.boldButton.classList.remove("smart-hidden"),e.$.italicButton.classList.remove("smart-hidden"),e.$.underlineButton.classList.remove("smart-hidden"),e.$.strikethroughButton.classList.remove("smart-hidden"),e.$.colorButton.classList.remove("smart-hidden"),e.$.backgroundButton.classList.remove("smart-hidden"),e.$.fontSizeButton.classList.remove("smart-hidden"),e.$.fontFamilyButton.classList.remove("smart-hidden"),e.$.boldButton.title=t.localize("bold")+" (Ctrl + B)",e.$.italicButton.title=t.localize("italic")+" (Ctrl + I)",e.$.underlineButton.title=t.localize("underline")+" (Ctrl + U)",e.$.strikethroughButton.title=t.localize("strikethrough")+" (Ctrl + Y)",e.$.colorButton.title=t.localize("color"),e.$.backgroundButton.title=t.localize("background"),e.$.fontSizeButton.title=t.localize("fontSize").replace(":",""),e.$.fontFamilyButton.title=t.localize("fontFamily").replace(":",""),e.$.boldButton.onpointerup=()=>{e._boldCommand()},e.$.italicButton.onpointerup=()=>{e._italicCommand()},e.$.underlineButton.onpointerup=()=>{e._underlineCommand()},e.$.strikethroughButton.onpointerup=()=>{e._strikethroughCommand()},e.$.colorButton.onpointerup=()=>{const t=e.$.colorButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t)},e.$.backgroundButton.onpointerup=()=>{const t=e.$.backgroundButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t,!0)},e.$.fontSizeButton.onpointerup=()=>{e._openFontSizeMenu(),e._updateTools()},e.$.fontFamilyButton.onpointerup=()=>{e._openFontFamilyMenu(),e._updateTools()}):(e.$.boldButton.classList.add("smart-hidden"),e.$.italicButton.classList.add("smart-hidden"),e.$.underlineButton.classList.add("smart-hidden"),e.$.strikethroughButton.classList.add("smart-hidden"),e.$.colorButton.classList.add("smart-hidden"),e.$.backgroundButton.classList.add("smart-hidden"),e.$.fontSizeButton.classList.add("smart-hidden"),e.$.fontFamilyButton.classList.add("smart-hidden")),t.users&&t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser)&&(t.stateSettings.storage&&Object.keys(t.stateSettings.storage).length,t.stateSettings.enabled),"scheduler"===t.view||"timeline"===t.view?(e.$.resourceButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.resourceButton.classList.remove("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.labelButton.classList.remove("smart-hidden")):(e.$.labelButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden")),e.$.labelButton.onpointerup=a=>{t.closeMenu(),e._openLabelMenu(),a.stopPropagation()},e.$.resourceButton.onpointerup=a=>{t.closeMenu(),e._openResourceMenu(),a.stopPropagation()},e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},!1===t.appearance.showViewBarAsDropdown&&(e.$.viewStatesButton.onpointerup=a=>{t.closeMenu(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.appearance.showViewBar=!t.appearance.showViewBar,a.stopPropagation(),e._updateViews()}),t._sortedColumns){const a=[],o=[],s=[];for(let e=0;e<t._sortedColumns.length;e++){const n=t._sortedColumns[e];a.push(n.dataField),o.push(n.sortOrder),s.push(n.dataType)}e._appliedSorting={dataFields:a,dataTypes:s,orderBy:o},e._refreshSortButton()}if("scheduler"!==t.view&&"timeline"!==t.view&&"kanban"!==t.view||e.$.sortButton.classList.add("smart-hidden"),"grid"===t.view||"card"===t.view||"scheduler"===t.view||"timeline"===t.view||"kanban"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumnsByDataField();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const s=t.filters[o];a.filters.push([e,s.condition,s.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshCustomButton(),e._refreshAIButton(),e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshResourceButton(),e._refreshLabelButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e._refreshColorsButton(),e.refreshTools(),Smart.Utilities.Core.isMobile,!1===t.editing.enabled&&(e.$.customButton.classList.add("smart-hidden"),e.$.downloadButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.$.viewsButton.classList.add("smart-hidden"))}_refreshCustomButton(){const e=this,t=e.grid;t.header.customButton.visible?(e.$.customButton.style.paddingLeft="0px",e.$.customButton.classList.remove("smart-hidden")):e.$.customButton.classList.add("smart-hidden"),t.header.customButton.enabled?e.$.customButton.classList.remove("smart-disabled"):e.$.customButton.classList.add("smart-disabled"),e.$.customButton.innerHTML=`<span class="smart-grid-icon show ${t.header.customButton.icon}"></span><div class="smart-tool-label" role="presentation">${t.header.customButton.label}</div>`,e.$.customButton.onclick=()=>{t.header.customButton.command&&t.header.customButton.command()};for(let a=0;a<t.header.buttons.length;a++){const o=t.header.buttons[a];if("object"==typeof o){const t=e.$.customButton.cloneNode(!0);t.classList.remove("smart-hidden"),t.style.paddingLeft="0px",e.$.customButton.parentNode.insertBefore(t,e.$.customButton),o.label&&(t.querySelector(".smart-tool-label").innerHTML=o.label),o.icon&&(t.querySelector(".smart-grid-icon").className="smart-grid-icon show "+o.icon),t.onclick=()=>{o.command&&o.command()}}}}_refreshViewsButton(){const e=this;if(!e.grid)return;let t=e.grid.localize("viewGrid");switch(e.$.viewsButton.classList.remove("kanban"),e.$.viewsButton.classList.remove("card"),e.$.viewsButton.classList.remove("scheduler"),e.$.viewsButton.classList.remove("timeline"),e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":t=e.grid.localize("viewGrid");break;case"card":e.$.viewsButton.classList.add("card"),t=e.grid.localize("viewCard");break;case"scheduler":e.$.viewsButton.classList.add("scheduler"),t=e.grid.localize("viewScheduler");break;case"timeline":e.$.viewsButton.classList.add("timeline"),t=e.grid.localize("viewTimeline")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>";let a=this.grid.stateSettings.current||"";if(a.length>30)a=a.substring(0,30)+"...";else if(!a){let e=[],t=this.grid.view,o="";switch(t){case"grid":o=this.grid.localize("viewGrid");break;case"kanban":o=this.grid.localize("viewKanban");break;case"card":o=this.grid.localize("viewCard");break;case"scheduler":o=this.grid.localize("viewScheduler");break;case"timeline":o=this.grid.localize("viewTimeline")}if(this.grid&&this.grid.stateSettings.storage)for(;this.grid.stateSettings.storage[o+" "+this.grid.localize("view")+" "+e[t]];)e[t]++;void 0===e[t]&&(e[t]=""),a=o+" "+this.grid.localize("view")+" "+e[t]}const o=""!==a?a:this.grid.localize("views");e.$.viewStatesButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o+"</div>"}_refreshDownloadButton(){const e=this;e.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation"></div>',e.$.downloadButton.title=e.grid.localize("download")}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.$.headerBar.$.deleteButton,o=a.closest("smart-grid");(!o||o._currentUser&&(!o._currentUser||o._currentUser.info&&"guest"!==o._currentUser.info))&&0!==t?(!0===e.editing.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.$.headerBar._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const o=t.grid;if("kanban"===o.view||"scheduler"===o.view||"timeline"===o.view)return;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.colors.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._refreshColumns("group"),o.closeMenu();const s=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(s.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=s,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=s,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,s=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const n=o.onRowInserted;if(o.onRowInserted=null,o.beginUpdate(),o.grouping.autoHideGroupColumn&&s)for(let e=0;e<s.length;e++){const t=o.columnByDataField[s[e]];t&&(t.visible=!0)}o.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];o.addGroup(t)}t._appliedGrouping.expandAll&&o.expandAllRows(),t._appliedGrouping.collapseAll&&o.collapseAllRows(),o.endUpdate(),o.autoSaveState();const i=[];for(let e=0;e<o.dataSource.groupBy.length;e++)i.push(o.dataSource.groupBy[e]);o.$.fireEvent("group",{groups:i}),o.paging.enabled&&o._refreshPagesCount(),o.onRowInserted=n}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshLabelButton(){const e=this;if(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel")+"</div>",e.$.labelButton.classList.remove("grouped"),e.grid&&e.grid._labeledBy){const t=e.grid.columnByDataField[e.grid._labeledBy];t&&(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:t.label})+"</div>",e.$.labelButton.classList.add("grouped"))}else if(e.grid)for(let t=0;t<e.columns.length;t++){const a=e.columns[t];if("string"===a.dataType){e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:a.label})+"</div>",e.$.labelButton.classList.add("grouped");break}}}_refreshResourceButton(){const e=this;if(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("firstByGroup")+"</div>",e.$.resourceButton.classList.remove("grouped"),e.grid&&e.grid._dateStackedBySelect){const t=e.grid.columnByDataField[e.grid._dateStackedBySelect];t&&(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("groupedBy",{column:t.label})+"</div>",e.$.resourceButton.classList.add("grouped"))}}_refreshAIButton(){const e=this;e.$.aiButton.classList.add("smart-hidden"),-1!==e.grid.header.buttons.indexOf("ai")&&(e.$.aiButton.classList.remove("smart-hidden"),e.$.aiButton.style.paddingLeft="0px",e.$.aiButton.innerHTML='<div class="smart-tool-label" role="presentation" style="padding: 5px;">'+e.grid.localize("addAIFilter")+"</div>")}_applyAI(){const e=this,t=e.grid;e.closePanel();const a=e.$.ai.firstElementChild,o=a.getAIInstructions();if(t.beginUpdate(),o&&o.sort&&o.sort.length>0){t.clearSort();const e=o.sort;for(let a=0;a<e.length;a++){const o=e[a],s=o.field,n=o.order;t.sortBy(s,n)}}if(o&&o.filters&&o.filters.length>0&&t._applyJSONFilters(o.filters),o&&o.group&&o.group.length>0){t.clearGroups();let e=o.group.map((e=>e.field));e.length&&e[0]&&t.addGroup(e)}const s=a.$.aiPrompt.value,n=s.indexOf("column")>=0||s.indexOf("cells")>=0;if(t.ai.includeUserPrompts&&(t.ai.userPrompts||(t.ai.userPrompts=[]),t.ai.userPrompts.push(s)),o&&o.format&&o.format.length>0){const e=o.format;let a={};for(let o=0;o<e.length;o++){const s=e[o],i=s.field;if(i&&n)a[i]||(a[i]=[]),a[i].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration});else for(let e=0;e<t.columns.length;e++){const o=t.columns[e];a[o.dataField]||(a[o.dataField]=[]),a[o.dataField].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration})}}for(let e=0;e<t.columns.length;e++)t.columns[e].cellsCSSInlineRules=null;for(let e in a){const o=t.columnByDataField[e];o&&(o.cellsCSSInlineRules=a[e])}}if(o&&o.edit&&o.edit.length>0){const e=o.edit;for(let a=0;a<e.length;a++){const o=e[a],s=o.row,n=o.value,i=o.field;s>=0&&(t.setCellValue(s,i,n),t.flashCell(s,i))}}t.endUpdate()}openAIPanel(){const e=this,t=e.grid;let a;if(e.$.headerDropDown.classList.add("ai-panel"),e.$.headerDropDown.classList.remove("view-panel","search-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.remove("smart-hidden"),e._aiPartCreated)a=e.$.ai.firstElementChild,a.set("locale",e.locale),a.messages=e._innerElementMessages.multiColumnFilterPanel,a.editorPlaceholder=e.localize("aiPrompt"),a.$.applyButton.classList.add("smart-disabled"),a.$.aiResponse.innerHTML=`${t.localize("noAIResponse")}`,a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[0].classList.add("active"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[1].classList.remove("active"),a.$.aiPrompt.value="",a.$.spinner.innerHTML="",a.$.spinner.classList.add("smart-hidden"),a._applyValue(),a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-grid-ai-panel"),a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.locale=e.locale,a.messages=e._innerElementMessages.multiColumnFilterPanel,a.operator=e._appliedFiltering.operator,a.editorPlaceholder=e.localize("aiPrompt"),a.theme=e.theme,a.value=e._appliedFiltering.filters,e.$.ai.appendChild(a),e._aiPartCreated=!0,a.$.addFilterButton.innerHTML="↑ "+t.localize("send"),a.$.addFilterButton.classList.add("smart-ai-button-send"),a.$.addFilterButton.style.background="var(--smart-ui-state-selected)",a.$.addFilterButton.style.borderRadius="15px",a.$.addFilterButton.style.color="var(--smart-primary)",a.$.addFilterButton.style.padding="6px 14px";const o=a.querySelector(".smart-grid-panel-apply-button");a.$.applyButton=o,o.classList.add("smart-disabled"),a.$.itemsContainer.innerHTML=`<style>\n .smart-ai-tabs {\n display: flex;\n align-items: baseline;\n border-bottom: 1px solid var(--smart-border-color);\n font-family: var(--smart-font-family);\n }\n\n .smart-ai-tab {\n padding: 4px 6px;\n cursor: pointer;\n display: flex;\n color: var(--smart-background-color);\n transition: color 0.2s, border-color 0.2s;\n border-bottom: 2px solid transparent;\n }\n\n .smart-ai-tab:hover {\n color: var(--smart-ui-state-color-hover);\n }\n\n .smart-ai-tab.active {\n color: var(--smart-primary);\n border-bottom-color: var(--smart-primary);\n font-weight: 600;\n }\n\n .smart-ai-response {\n min-height: 80px;\n padding: 10px;\n margin-top: 10px;\n width: 360px;\n user-select: text;\n border-radius: var(--smart-border-radius);\n border: 1px solid var(--smart-border);\n }\n\n </style><div class="smart-ai-tabs">\n <div class="smart-ai-tab active" data-tab="add-filter">\n ${t.localize("addAIFilter")}\n </div>\n <div class="smart-ai-tab" data-tab="response">\n <span class="smart-grid-icon show smart-icon-comment"></span> ${t.localize("aiResponse")}\n </div>\n </div>\n <div class="smart-hidden smart-ai-response">\n ${t.localize("noAIResponse")}\n </div>\n `,a.$.itemsContainer.style.paddingTop="0px",a.$.aiResponse=a.$.itemsContainer.querySelector(".smart-ai-response"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>{e.addEventListener("click",(()=>{a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>e.classList.remove("active"))),e.classList.add("active"),"add-filter"===e.getAttribute("data-tab")?(a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden")):(a.$.addFilterButton.classList.add("smart-hidden"),a.$.aiPrompt.classList.add("smart-hidden"),a.$.aiResponse.classList.remove("smart-hidden"))}))}))}e._openHeaderDropDown(e.$.aiButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu();const o=e.$.headerDropDown.querySelector("smart-grid-ai-panel");if(o&&t.ai&&t.ai.key){o.$.addAIFilterButton.classList.remove("smart-hidden"),o.$.aiPrompt.classList.add("smart-hidden"),o.$.aiPrompt.placeholder=t.localize("aiPrompt"),o.$.aiPrompt.classList.toggle("smart-hidden"),o.$.spinner.classList.remove("smart-hidden"),o.$.aiPrompt.focus(),o.$.aiPrompt.maxRows=5,o.$.aiPrompt.style.minHeight="80px",o.$.aiPrompt.style.resize="none",o.$.aiPrompt.parentElement.style.display="flex",o.$.aiPrompt.parentElement.style.flexDirection="column";const a=t.ai.prompts||[];if(t.ai.includeUserPrompts&&t.ai.userPrompts)for(let e=0;e<t.ai.userPrompts.length;e++){const o=t.ai.userPrompts[e];-1===a.indexOf(o)&&a.unshift(o)}const s=o.$.aiPrompt,n=o.$.suggestions;s.onpointerdown=()=>{e._dropDownCloseDate=new Date},s.onselectionchange=()=>{e._dropDownCloseDate=new Date},n.innerHTML='<style>\n .smart-ai-suggestion {\n padding: 6px 10px;\n border-bottom: 1px solid var(--smart-border-color);\n cursor: pointer;\n max-width: 360px;\n }\n .smart-ai-suggestion:hover {\n background-color: var(--smart-ui-state-hover);\n }\n .smart-ai-suggestions-container {\n max-height: 200px;\n overflow-y: auto;\n border: 1px solid var(--smart-border-color);\n border-radius: var(--smart-border-radius);\n margin-top: 5px;\n }\n </style>\n <div class="smart-ai-suggestions-container">\n \n </div>';const i=n.querySelector(".smart-ai-suggestions-container");a.forEach((e=>{const t=document.createElement("div");t.classList.add("smart-ai-suggestion"),t.innerText=e,t.onclick=()=>{s.value=e,i.classList.add("smart-hidden"),s.focus()},i.appendChild(t)})),s.oninput=()=>{s.value.length>0?i.classList.add("smart-hidden"):i.classList.remove("smart-hidden")},o.$.addFilterButton.onclick=()=>{let a=0;o.$.spinner.classList.remove("smart-hidden");const s=setInterval((()=>{o.$.spinner.innerHTML=`\rThinking${".".repeat(a%4)} `,a++}),500);let n='\nYou are a helpful assistant that converts natural language data manipulation requests\ninto structured JSON instructions for Smart.Grid AND produces a detailed, user-friendly explanation.\n\nImportant:\nThe JSON you produce represents actions that will be applied ONLY AFTER the user clicks "Apply".\nTherefore, all natural-language explanations must describe what *will happen* once the user applies the changes.\nDo not describe the action as already completed.\n\nUse only these columns:\n';for(let t=0;t<e.columns.length;t++){const a=e.columns[t];(a.allowFilter||a.allowSort||a.allowGroup||a.allowFormat)&&(n+="- "+a.label+" ("+a.dataType+") => "+a.dataField+"\\n")}const i=t.getSelection();let r=i.rows||[],l=i.columns||[],d=i.cells||[];d&&(d=d.map((e=>({row:e.row.id,column:e.column.label,value:e.row.data[e.dataField]})))),r&&(r=r.map((e=>e.id))),l&&(l=l.map((e=>t.columnByDataField[e].label)));let c={};t.getColumnStatistics=e=>{const a=t.getData().map((t=>t[e])).filter((e=>null!=e&&""!==e));if(0===a.length)return{};const o=a.filter((e=>"number"==typeof e)),s={count:a.length,uniqueCount:new Set(a).size};if(o.length>0){const e=o.reduce(((e,t)=>e+t),0),t=e/o.length,a=Math.min(...o),n=Math.max(...o);s.sum=e,s.average=t,s.min=a,s.max=n,s.range=n-a}return s};let u={};for(let a=0;a<e.columns.length;a++){const o=e.columns[a],s=t.getColumnStatistics(o.dataField);c[o.label]=s,o.options&&Array.isArray(o.options)&&(u[o.label]=o.options.map((e=>"object"==typeof e&&null!==e?void 0!==e.label?e.label:e.value:e)))}const m=t._rowElements.filter((e=>!e.classList.contains("smart-hidden"))).map((e=>e.row.data)).map((t=>{const a={};for(let o=0;o<e.columns.length;o++){const s=e.columns[o];a[s.label]=t[s.dataField]}return a}));n+=`\n visibleRows: ${JSON.stringify(m)}\n datasetStats: ${JSON.stringify(c)}\n columnOptions: ${JSON.stringify(u)}\n CurrentSelection: rows: ${JSON.stringify(r)}, columns: ${JSON.stringify(l)}, cells: ${JSON.stringify(d)}\n\n If datasetStats lacks the required numbers for a requested metric, the assistant MUST exclude that metric rather than invent numbers.\n\nThe user may request any combination of the following actions: filtering, sorting, grouping, conditional formatting, editing or summarization.`,n+='\nSupported filter operators:\n CONTAINS, EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN,\n GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, STARTS_WITH, ENDS_WITH\n\nRespond in this format for Filtering\n[\n {\n "field": "dataField",\n "operator": "some operator",\n "value": "some value",\n "type": "some type",\n "logic": "AND }\n]\nWhen the user requests to clear or remove or delete the Filtering\nRespond in this format for Filtering\n[\n {\n "field": null,\n "operator": "null,\n "value": null,\n "type": null,\n "logic": null\n }\n]\nSupported types:\n string, number, date, boolean\n\nThe assistant MUST understand and support operations on the user\'s current selection.\nA selection may include rows, columns, or specific cells.\n\nEDIT RULE: \nSupported edit actions include:\n- fill_empty: Fill empty cells using a source (e.g., from selection, constant value, or text).\n- translate: Translate text in the selected cells or columns.\n- replace_values: Replace or modify values inside the selection or target columns.\n- transform_text: Apply transformations such as uppercase, lowercase, trim, etc.\n\nThe assistant MUST check columnOptions when performing edit actions to ensure the requested action is allowed on the target column(s).\n\nOPTION-CONSTRAINT RULE FOR EDITING:\nSome columns contain restricted, predefined allowed values (options list).\n\nWhen performing an edit action (fill_empty, translate, replace_values, transform_text):\n- The assistant MUST verify that the target value is one of the allowed options if the column contains predefined options.\n- The assistant MUST NOT write a value that does not exist in the options list.\n- The assistant MUST NOT invent new options.\n- If a requested value is not part of the options list, the assistant MUST reply in HTML to request clarification rather than performing the edit.\n\n\nWhen the user requests an action involving selected cells, the assistant MUST include \nthe appropriate "edit" instructions in the JSON.\n\nWhen the user requests an edit action (fill, translate, replace, transform), the assistant MUST compute the actual resulting values for the affected cells using the visible data or selection provided.\nThe assistant MUST place these computed results inside the edit object.\nThe assistant MUST NOT output formulas, instructions, or placeholders. Only the final, edited values are allowed.\n\nRespond in this format for Editing\n[\n {\n "field": "dataField",\n "row": "some row id",\n "oldValue": "some old value",\n "value": "some value",\n "type": "some type",\n "editAction": "fill_empty/translate/replace_values/transform_text }\n]\n\nSORT RULE:\nWhen the user requests sorting (“sort by”, “order by”, etc.):\nRespond in this format for Sorting\n[\n {\n "field": "dataField",\n "order": "asc/desc"\n }\n]\nWhen the user requests to clear or remove or delete the sorting\nRespond in this format for Sorting\n[\n {\n "field": null,\n "order": null\n }\n]\nGROUP RULE:\nWhen the user requests grouping (“group by”, “categorize by”, etc.):\nRespond in this format for Grouping\n[\n {\n "field": "dataField"\n }\n]\nWhen the user requests to clear or remove or delete the grouping\nRespond in this format for Grouping\n[\n {\n "field": null\n }\n]\nFORMAT RULE (STRICT):\n\nWhen the user requests conditional formatting (“highlight”, “color code”, “format”, etc.):\nYou MUST respond ONLY in this exact JSON structure:\n\n[\n {\n "field": "dataField",\n "condition": "=/<>/<=/>=/</>/between",\n "value": "STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nif the user requests formatting for a RANGE of values (e.g., "between 10 and 20"):\nYou MUST add condition2 and value2 keys to the JSON structure like this:\n\n[\n {\n "field": "dataField",\n "condition": "between",\n "value": "lower bound STRING or NUMBER or DATE or BOOLEAN",\n "value2": "upper bound STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nCLEARING FORMATTING:\nWhen the user requests to clear, remove, or delete formatting:\nYou MUST respond ONLY in this structure:\n\n[\n {\n "field": null,\n "condition": "=",\n "value": "",\n "background": null,\n "color": null,\n "textDecoration": null,\n }\n]\n\nADDITIONAL STRICT RULES:\n- Do NOT add extra keys.\n- Do NOT omit required keys.\n- Do NOT output explanations, text, or comments — ONLY the JSON.\n- “condition” MUST be one of: =, <>, <, <=, >, >=.\n- “value” MUST be a STRING, NUMBER, DATE, or BOOLEAN literal.\n- Colors MUST be written as strings.\n\nSUMMARY RULE:\nWhen the user requests a summary (“give me a summary”, “summarize my data”,\n“show totals/averages/count”, etc.):\n\n1. You MUST compute actual numeric results using datasetStats and/or selection.\n - Place these results inside the "summary" JSON object.\n - NEVER output formulas or operations.\n\n2. You MUST generate a full natural-language summary report in the "message" field.\n The report MUST:\n - Use PRESENT TENSE (because summary is computed immediately).\n - Describe totals, averages, minimums, maximums, counts, and ranges.\n - Highlight notable patterns IF AND ONLY IF the stats allow it.\n - Be narrative, readable, and helpful.\n - NOT hallucinate any values not present in datasetStats or selection.\n\nYour task:\nConvert user requests about filtering, sorting, grouping, conditional formatting, editing, \nor summarization into a structured JSON format AND produce a verbose, friendly explanation.\n\nRespond ONLY in this structure:\n\n{\n "json": {\n "filters": [...],\n "sort": [...],\n "group": [...],\n "format": [...],\n "summary": {},\n "edit": []\n },\n "message": "A detailed explanation using FUTURE TENSE, describing what the changes will do once applied. The mssage should be in HTML Format. The explanation MUST be a well-structured HTML message with short paragraphs and bullet points when appropriate. It MUST NOT exceed 200 words unless summarization requires more"\n}\n\nGuidelines for the natural-language \'message\':\n- Use future tense: “will filter”, “will highlight”, “will sort”, etc.\n- Summary results are computed immediately and DO NOT depend on the Apply button.\n Therefore, the explanation for summaries may use PRESENT TENSE (e.g., “The total is 2300”).\n- Do NOT imply the action has already happened.\n- Explain clearly what the user should expect AFTER applying the settings.\n- Be helpful, descriptive, and user-friendly.\n- Avoid referencing JSON or internal logic.\n\nThe assistant MUST NOT invent additional JSON keys or structures.\nIf the user requests an unsupported action, the assistant MUST politely decline.\n\nIf the user request is ambiguous, the assistant MUST reply with a polite clarifying question\ninstead of guessing the action.\n\nIf the user asks a general question, tutorial question, or conceptual question that does NOT request\nfiltering, sorting, grouping, conditional formatting, editing, or summarization,\nthe assistant MUST NOT generate JSON.\n\nInstead, the assistant MUST reply with a natural-language explanation in HTML format.\n\nIf the user asks for help, instructions, or examples, the assistant MUST NOT perform actions.\nThe assistant MUST explain concepts in HTML using concise, user-friendly language.\n',t.ai.getAIResponse=async function(e,a){const o=t.ai.key,s=t.ai.url||"https://api.openai.com/v1/chat/completions",n={"Content-Type":"application/json",Authorization:`Bearer ${o}`},i={model:t.ai.model||"gpt-3.5-turbo",messages:[{role:"system",content:e},{role:"user",content:a}],temperature:.7,max_tokens:1e3},r=await fetch(s,{method:"POST",headers:n,body:JSON.stringify(i)});return(await r.json()).choices[0].message.content};try{t.ai.getAIResponse(n,o.$.aiPrompt.value).then((e=>{let a,n=t.localize("noAIResponse");try{const t=e.indexOf("{");a=JSON.parse(e.substring(t)),a.message&&(n=a.message)}catch(e){a={filters:[]}}if(o.$.aiResponse.innerHTML=n,o.$.spinner.innerHTML="",o.$.spinner.classList.add("smart-hidden"),clearInterval(s),o.$.itemsContainer.querySelector('.smart-ai-tab[data-tab="response"]').click(),a.json){const e=a.json.filters,t=a.json.sort,s=a.json.group,n=a.json.format,i=a.json.summary,r=a.json.edit;o.getAIInstructions=()=>({filters:e||[],sort:t||[],group:s||[],format:n||[],summary:i||{},edit:r||[]}),o.$.applyButton.classList.remove("smart-disabled")}}))}catch(e){o.$.spinner.innerHTML=t.localize("noResults"),clearInterval(s)}},o.$.applyButton.onclick=()=>{o.$.applyButton.classList.contains("smart-disabled")||e._applyAI()}}}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(e.grid&&"kanban"===e.grid.view){e.$.groupButton.onclick=()=>{"kanban"===e.grid.view&&e.grid._initKanbanView("dynamic","kanban")};const t=e.grid.columnByDataField[e.grid._stackedBy];return t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("groupedBy",{column:t.label}),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped"),void e.$.groupButton.classList.remove("scheduler")}if(!e.grid||"scheduler"!==e.grid.view&&"timeline"!==e.grid.view){if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}else if(e.$.groupButton.onclick=()=>{"scheduler"!==e.grid.view&&"timeline"!==e.grid.view||e.grid._createScheduler("update")},e.grid._dateStackedBy&&Array.isArray(e.grid._dateStackedBy)){const t=e.grid.columnByDataField[e.grid._dateStackedBy[0]].label,a=e.grid.columnByDataField[e.grid._dateStackedBy[1]].label;e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t+"-"+a}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")}else{const t=e.grid.columnByDataField[e.grid._dateStackedBy];t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t.label}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped")}}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search(this.$.searchInput.value,!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;if(e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu(),"filter"===t.header.searchCommand){const t=e.$.headerDropDown.querySelector(".smart-data-view-search-prev"),a=e.$.headerDropDown.querySelector(".smart-data-view-search-next");t.classList.add("smart-hidden"),a.classList.add("smart-hidden")}const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const s=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:s,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}addColors(e,t,a){const o=this,s=o.grid;let n=[e,t],i=[];if(o.closePanel(),JSON.stringify(n)===JSON.stringify(o._appliedColors))return;o._appliedColors=n;const r=[],l=o.grid.getRows();for(let e=0;e<l.length;e++)r.push(Object.assign(l[e].data));if("conditions"===t.type){const t=new Smart.DataAdapter({id:"id",observable:!1,dataSource:r,dataFields:o.grid.dataSource.dataFields});t._filter(a,"or");const n=[];for(let e=0;e<t.length;e++){const a=t[e];!1!==a.$.filtered&&n.push(a)}const l=e,d=[];for(let e=0;e<l.length;e++){const t=l[e],a=t[0],o=t[1],n=t[3]?t[2]:void 0,i=t[3]?t[3]:t[2],r=s.columnByDataField[a].dataType,c=new Smart.Utilities.FilterGroup,u=c.createFilter(r,n,o);c.addFilter("or",u),d.push({dataField:a,color:i,filterGroup:c})}for(let e=0;e<n.length;e++){const t=n[e];for(let e=0;e<d.length;e++){const a=d[e].dataField,o=d[e].filterGroup,s=d[e].color,n=t[a];o.evaluate(n)&&(void 0===i[t.$.id]&&(i[t.$.id]={}),i[t.$.id].color=s,i[t.$.id][a]=s)}}}else{const e=t.singleSelect,a=s.columnByDataField[e];if(!a)return s._conditionalColors={colors:[],type:t.type,conditions:[],update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(),o._refreshColorsButton(),void(s._onColors&&s._onColors(s._conditionalColors));const n="collaborator"===a.template?s.users:a.editor.dataSource,r={};n.forEach((e=>"collaborator"===a.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color)));for(let t=0;t<l.length;t++){const a=l[t].data,o=a[e],s=r[o];s&&(i[a.$.id]={color:s})}}s._conditionalColors={colors:i,type:t.type,conditions:e,update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(!1),o._refreshColorsButton(),s.autoSaveState(),o.$.fireEvent("colors"),s._onColors&&s._onColors(s._conditionalColors)}_updateConditionalColors(e,t,a){let o=[];const s=t.getRows();if("conditions"===a.type){const a=t._conditionalColors.conditions,n=[];for(let e=0;e<a.length;e++){const o=a[e],s=o[0],i=o[1],r=o[3]?o[2]:void 0,l=o[3]?o[3]:o[2],d=t.columnByDataField[s];if(d){const e=d.dataType,t=new Smart.Utilities.FilterGroup,a=t.createFilter(e,r,i);t.addFilter("or",a),n.push({dataField:s,color:l,filterGroup:t})}}const i=e=>{for(let t=0;t<n.length;t++){const a=n[t].dataField,s=n[t].filterGroup,i=n[t].color,r=e[a];s.evaluate(r)?(void 0===o[e.$.id]&&(o[e.$.id]={}),o[e.$.id].color=i,o[e.$.id][a]=i):delete o[e.$.id]}};if(e)o=t._conditionalColors.colors,i(e.data);else for(let e=0;e<s.length;e++)i(s[e].data)}else{const n=a.singleSelect,i=t.columnByDataField[n];if(i){const a="collaborator"===i.template?t.users:i.editor.dataSource,r={};if(a.forEach((e=>"collaborator"===i.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color))),e){o=t._conditionalColors.colors,o||(o=t._conditionalColors.colors=[]);const a=e.data,s=a[n],i=r[s];i?o[a.$.id]={color:i}:delete o[a.$.id]}else for(let e=0;e<s.length;e++){const t=s[e].data,a=t[n],i=r[a];i&&(o[t.$.id]={color:i})}}}t._conditionalColors.colors=o,t.autoSaveState(),t.summaryRow.visible||t._recycle(!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,a.grid._recycle(!1),void("filter"===a.grid.header.searchCommand&&a.grid.clearFilter());const o=a._searchInfo.source,s=[],n=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),s.push([t,a])})),o._filter(s,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(n.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=n,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,"filter"===a.grid.header.searchCommand){a.grid.beginUpdate();const t=a.grid.filtering.operator;return a.grid.filtering.operator="or",a.grid.clearFilter(),a._searchInfo.stringDataFields.forEach((t=>{const o=new Smart.Utilities.FilterGroup,s=o.createFilter("string",e,"CONTAINS"),n=a.grid.columnByDataField[t];if(n&&n.editor&&n.editor.dataSource)return!1;n&&(o.addFilter("or",s),a.grid.addFilter(t,o),n._filterInfo&&n.filter.filters[0]&&(n._filterInfo.value=n.filter.filters[0].value,n._filterInfo.condition=n.filter.filters[0].condition))})),a.grid.endUpdate(),a.grid.refreshFilters(),void(a.grid.filtering.operator=t)}if(n.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:n.length}),a._searchInfo.highlighted||(a._searchInfo.highlighted=n[0]),a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}isGrid(){const e=this.grid;return!(e&&("kanban"===e.view&&e._kanban||"scheduler"===e.view&&e._scheduler||"timeline"===e.view&&e._scheduler))}_refreshColorsButton(){const e=this,t=e.grid;let a=0;if(a=t._conditionalColors&&t._conditionalColors.conditions?Object.keys(t._conditionalColors.conditions).length:0,t._conditionalColors&&"singleSelect"===t._conditionalColors.type){a=1;const o=t.columnByDataField[t._conditionalColors.singleSelect];return o?(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formatingBy",{value:o.label})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted"),void e._refreshMobileViewTools()):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),void e.$.colorsButton.classList.remove("formatted"))}a>0?(e.$.colorsButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("formatingOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("formatingByMultiple",{n:a})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted")):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),e.$.colorsButton.classList.remove("formatted")),e._refreshMobileViewTools()}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if(!e.isGrid())return t._kanban&&t._kanban.localize&&(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&(o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++))}a>0?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),e._refreshMobileViewTools()}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let s=0,n=[],i=[],r=[];const l=o.onColumnChange;o.onColumnChange=null;for(let t in e){const a=e[t],l=o.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(n.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||s++)}o.onColumnChange=l,o.onColumnChange?o.onColumnChange(n,"visible",i,r):o.$.fireEvent("columnChange",{column:n,propertyName:"visible",oldValue:i,value:r}),s>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n:s})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],s=a.oldIndex,n=a.newIndex,i=o.columns[n+1],r=o.columns[n-1],l=o.columns[s];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(s,n,!0)}if(o.filtering.enabled&&o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized=!1;o.endUpdate();const d=o.grouping.enabled;d&&o._filters&&o.refreshFilters(d),o.autoSaveState()}});
65
- Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{ai:{type:"any",reflectToAttribute:!1,value:{model:{value:"gpt-4.1",type:"string"},maxTokens:{value:200,type:"number"},temperature:{value:.7,type:"number"},url:{value:"https://api.openai.com/v1/chat/completions",type:"string"},key:{value:"",type:"string",reflectToAttribute:!1},maxResponseLength:{value:100,type:"number"},promptVariables:{value:null,type:"any",reflectToAttribute:!1},prompts:{value:null,type:"any",reflectToAttribute:!1},includeUserPrompts:{value:!0,type:"boolean"}}},appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnAutoPlaceholder:{value:!1,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},cardTitleField:{value:"",type:"string"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowEditDialogDetails:{value:!1,type:"boolean"},showRowComments:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!1,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupCellLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showSelectionOnTop:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showTooltipsOverflow:{value:!0,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"},showViewBar:{value:!1,type:"boolean"},showViewBarAsDropdown:{value:!1,type:"boolean"},viewBarAppendTo:{value:null,type:"any"}},type:"object"},behavior:{value:{autoDestroy:{value:!0,type:"boolean"},allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},allowMouseWheel:{value:!0,type:"boolean"},allowRenderCache:{value:!0,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{autoWrap:{value:!0,type:"boolean"},autoWidth:{value:!1,type:"boolean"},autoHeight:{value:!1,type:"boolean"},allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},cardMinWidth:{value:250,type:"any",reflectToAttribute:!1},cardRowMinHeight:{value:45,type:"any",reflectToAttribute:!1},cardsPerRow:{value:"auto",type:"any",reflectToAttribute:!1},cardVertical:{value:!0,type:"boolean",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},dropDownWidth:{value:700,type:"any",reflectToAttribute:!1},dropDownHeight:{value:500,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowMobileHeight:{value:null,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"any"},fileName:{value:"SmartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"},headerContent:{value:null,type:"any",reflectToAttribute:!1},footerContent:{value:null,type:"any",reflectToAttribute:!1},addImageToCell:{value:null,type:"any",reflectToAttribute:!1},setRowHeight:{value:null,type:"any",reflectToAttribute:!1},cellFormatFunction:{value:null,type:"any",reflectToAttribute:!1},autoConvertFormulas:{value:!0,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},onlySelected:{value:!1,type:"boolean"},exportAsTable:{value:!1,type:"boolean"},exportStyles:{value:!0,type:"boolean"},formatData:{value:null,type:"any",reflectToAttribute:!1},getSpreadsheets:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},copyHeadersToClipboard:{value:!1,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:"auto",type:"any"},height:{value:null,type:"any"},customContextMenuItems:{value:null,type:"any"},dataSource:{value:{contextMenuItemChart:{value:{command:{value:"contextMenuItemChartCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-chart",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemSelectRow:{value:{command:{value:"contextMenuItemSelectRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-check-squared",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemExpand:{value:{command:{value:"contextMenuItemExpandCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-resize-full",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemInsertRow:{value:{command:{value:"contextMenuItemInsertRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCloneRow:{value:{command:{value:"contextMenuItemCloneRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCut:{value:{command:{value:"contextMenuItemCutCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-cut",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCopy:{value:{command:{value:"contextMenuItemCopyCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-copy-record",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemPaste:{value:{command:{value:"contextMenuItemPasteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-paste",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemClear:{value:{command:{value:"contextMenuItemClearCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-close",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemComment:{value:{command:{value:"contextMenuItemAddCommentCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-comment",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsert:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:500,type:"any"},width:{value:800,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban","card","scheduler","timeline"],type:"string"},currentUser:{value:null,type:"any",reflectToAttribute:!1},dropDownMode:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeInput:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeDataField:{value:"",type:"string",reflectToAttribute:!1},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array",reflectToAttribute:!1},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},relations:{value:[],type:"any",reflectToAttribute:!1},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object",reflectToAttribute:!1},formulas:{value:!1,type:"boolean"},highlighted:{value:-1,type:"any"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},keys:{value:null,reflectToAttribute:!1,type:"any"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the SmartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",viewCard:"Cards",viewScheduler:"Calendar",viewTimeline:"Timeline",kanbanNone:"Blank",schedulerDescription:"Which date column would you like to use for this view? Your data would be placed based on the dates in this column.",schedulerDescriptionInfo:"A range of data would be displayed when a start date field has an associated due date field.",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',schedulerDateColumn:"Create a new date column",schedulerPromptLabel:"Using date column(s)",schedulerDateRangeColumn:"Create a new date range",schedulerToolLabel:"Using '{{column}}'",toolLabel:"Labeled by '{{column}}'",uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",statusSummary:"Status",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsert:"Insert column",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",contextMenuItemSelectRow:"Select row",contextMenuItemCloneRow:"Clone row",contextMenuItemInsertRow:"Insert row",contextMenuItemChart:"Chart range",contextMenuItemAddRow:"Add {{value}} rows",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Ctrl</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Row: {{value}}",dialogEditHeader:"Row: {{value}}",dialogEditHeaderMenu:"Toggle Sidebar",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonSave:"Save",dialogEditButtonAutoSave:"Auto Save",dialogEditButtonCancel:"Cancel",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnDate:"Choose a date column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeAIQuery:"AI Button",dialogAddColumnTypeSparklines:"Sparklines",dialogAddColumnAIQuery:"AI Query",dialogAddColumnTypeAIQueryInfo:"Example: Write a short description for an article or choose a column to query by it",dialogAddColumnTypeUUID:"UUID",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeTime:"Time",dialogAddColumnTypeRating:"Rating",dialogAddColumnTypeDuration:"Duration",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"User",dialogAddColumnTypeFormula:"Formula",dialogAddColumnTypeFormulaInfo:'Example: COL(Name) & "-" & COL(Price) or IF(COL(Price) * COL(Quantity) > 5, "Yes", "No")',dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeStatus:"Choose a status column",dialogAddColumnTypeStatusInfo:"Connect with the relevant status column",dialogAddColumnTypeAutoNumber:"Auto number",dialogAddColumnTypeRowLink:"Link to table",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeNone:"None",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeDueDateSettings:"Set as a deadline",dialogAddColumnTypeDueDateSettingsInfo:"Set a deadline with start date or due date templates.",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnTypeVote:"Vote",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatMonthYear:"Month & Year",dialogAddColumnDateFormatCasualUS:"Casual US",dialogAddColumnDateFormatWeekdayOnly:"Weekday",dialogAddColumnDateFormatUS:"US",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnNumberFormatDecimalPlaces:"Decimal places",dialogAddColumnNumberFormatSeparator:"Use 1000 Separator (,)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnDotItems:"Show Dots",dialogAddColumnCustomItems:"Custom Items",dialogAddColumnListItems:"List items",dialogAddColumnLinkListItems:"Choose a table to link to",dialogAddColumnLinkField:"Choose a lookup field",dialogAddColumnLinkFieldMore:"Cascading readonly fields",dialogAddColumnLinkSelect:"Allow linking to multiple rows",dialogAddColumnFormula:"Please enter a formula",dialogAddColumnListItemsError:"You cannot delete an item while in use.",dialogAddColumnListItemsEditError:"You cannot edit an item while in use.",dialogAddColumnDefault:"Default value",dialogAddColumnDefaultDateCurrent:"Current Date",dialogAddColumnDefaultDateSpecific:"Specific Date",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnBlankItem:"Blank Item",dialogAddColumnFormatting:"Rich Formatting",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",strikethrough:"Strikethrough",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",commentPlaceholder:"Leave a comment",noComments:"Leave a comment and collaborate with your team.",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Format",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:"Changed {{column}} from {{oldValue}} to {{newValue}}",nullRange:"Changed {{column}} to {{newValue}}",rowCreated:"Row Created",propertyUpdated:"{{value}} updated",propertyRemoved:"{{value}} removed",dropImages:"Drop images here",addImages:"Add images",dropFiles:"Drop files here",addFiles:"Add files",unassigned:"Unassigned",historyDate:"Date",copyURL:"Copy row URL",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",addAIFilter:" ✨︎ Ask AI",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",noOptions:"No options",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",groupedBy:"Grouped by '{{column}}'",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",expandCell:"Expand cell",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'SmartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'SmartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",tomorrow:"Tomorrow",yesterday:"Yesterday",formatColumn:"Format Column",formating:"Color",formatingByMultiple:"{{n}} Colors",formatingOne:"1 color",formatingBy:"Colored by '{{value}}'",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"New View",newGrid:"Grid",newKanban:"Kanban",newCard:"Cards",newScheduler:"Calendar",newTimeline:"Timeline",layout:"Layout",settings:"Create view",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table",cardView:"View your records in a Card view",schedulerView:"View your records in a Calendar view",timelineView:"View your records in a Timeline view",days:"{{value}}d",daysOverdue:"{{value}} days overdue",daysLeft:"{{value}} days left",true:"true",false:"false",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month",hideHiddenColumns:"Hide {{value}} hidden columns",showHiddenColumns:"Show {{value}} hidden columns",less:"Less",more:"More",conditions:"Conditions",colorsSingleSelect:"Which single select field should the row be colored by?",colorRows:"Color rows when they match the conditions",colorSelect:"Color rows the same as a single select value",colorLeftBorderLabel:"Left border",colorRowLabel:"Row",colorCellLabel:"Cell",colorLeftBorder:"Color the left border of a row",colorRow:"Color the background of a row",colorCell:"Color the background of a cell",loadingIndicatorPlaceholder:"Loading...",dropDownPlaceholder:"Please select...",placeholder:"No Rows",columnPlaceholder:"Placeholder",pieChart:"Pie",columnChart:"Column",barChart:"Bar",stackedChart:"Stacked",lineChart:"Line",projectStatus:"Project Status",reviewStatus:"Review Status",taskStatus:"Task Status",priority:"Priority",size:"Size",yesNo:"Yes/No/Maybe",backlog:"Backlog",notStarted:"Not Started",underReview:"Under review",approved:"Approved",rejected:"Rejected",blocked:"Blocked",completedStatus:"Completed",generate:"Generate",aiPrompt:"Enter your prompt for the AI:",agenda:"Agenda",checkStyle:"Style",noVotes:"No votes yet",votes:"Voted by {{value}}",clearContents:"Clear contents",paste:"Paste",minPromptChars:"Enter AI prompt. Min 20 chars.",aiResponse:"Response",noAIResponse:"No response from AI",promptSuggest:"Prompt Suggestions"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellEditRequest:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onCellValueChanged:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onKeyUp:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:800,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},allowListOpenOnContentClick:{value:!0,type:"boolean"},allowDynamicButtons:{value:!1,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},readOnlyEdit:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},customCommandColumns:{value:null,type:"any"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","insertButton","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},sidePanel:{value:!1,type:"boolean"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},appendTo:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},searchCommand:{value:"search",allowedValues:["search","filter"],type:"string"},customButton:{value:{command:{value:null,type:"any",reflectToAttribute:!1},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},stateSettings:{value:{enabled:{value:!0,type:"boolean",reflectToAttribute:!1},current:{value:"",type:"string",reflectToAttribute:!1},storage:{value:null,type:"any",reflectToAttribute:!1},autoSave:{value:!1,type:"boolean",reflectToAttribute:!1},autoLoad:{value:!1,type:"boolean",reflectToAttribute:!1},allowLocalStorage:{value:!0,type:"boolean",reflectToAttribute:!1},options:{value:[],type:"array",reflectToAttribute:!1},onStateChange:{value:null,type:"any",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["Smart.menu.css","Smart.filterpanel.css","Smart.pager.css","Smart.grid.css","Smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' >\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' role='grid' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' style=\"opacity: 0.99\" role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div viewbar class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler","document.paste":"_clipboardPasteHandler",mouseleave:"_mouseLeaveHandler"}}_mouseLeaveHandler(){const e=this;e.editing.addNewRow._insertButton&&e.editing.addNewRow._insertButton.classList.remove("show")}_clipboardPasteHandler(e){if("paste"===e.type){const t=this;if(document.activeElement!==t)return;if(t._selection&&t._selection.focusedCell){const o=t._selection.focusedCell.id,l=t._selection.focusedCell.dataField,a=t.columnByDataField[l];if(!a)return;if(a&&("image"===a.template||"attachment"===a.template||"richText"===a.template)){e.preventDefault();let n=(e.clipboardData||e.originalEvent.clipboardData).items,i=null,r=0,s=0,d=[];for(let e=0;e<n.length;e++)if(0===n[e].type.indexOf("image")&&(i=n[e].getAsFile(),r++,null!==i)){let e={label:i.name,size:i.size},n=new FileReader;n.onload=function(n){s++;const i=n.target.result;e.value=i;let c=!1;for(let o=0;o<t.uploadSettings.userFiles.length;o++){const l=t.uploadSettings.userFiles[o];if(l.name===e.label||l.label===e.label){c=!0;break}}if(c||t.uploadSettings.userFiles.push(e),d.push(e),s===r){let e=t.getCellValue(o,l);e||(e=[]),"string"==typeof e&&(e=JSON.parse(e)),e=[...e,...d];let n=e;if("richText"===a.template){const a=document.createElement("span");for(let t=0;t<e.length;t++){const o=document.createElement("img");o.src=e[t].value,o.title=o.name=e[t].label,a.appendChild(o)}t.setCellValue(o,l,a.outerHTML),n=a.outerHTML}else t.setCellValue(o,l,e);const i=t.rowById[o].getCell(l),r="";t.onCellUpdate&&t.onCellUpdate([i],[r],[e],(function(){t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[r],[e],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,r,e)}),t)}},n.readAsDataURL(i)}}}}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1;this._mobile&&(e.preventDefault(),e.stopPropagation())}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(t.isInShadowDOM){const t=e.getBoundingClientRect();let o=window.pageXOffset,l=window.pageYOffset,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){const e=a.parentNode;null!==a.scrollLeft&&(o+=a.scrollLeft),null!==a.scrollTop&&(l+=a.scrollTop);const t=a.getRootNode?a.getRootNode():null;if(t&&t instanceof ShadowRoot)a=t.host;else{if(!e||1!==e.nodeType)break;a=e}}return o+=window.pageXOffset,l+=window.pageYOffset,{top:t.top+l,left:t.left+o,right:t.right+o,bottom:t.bottom+l,width:t.width,height:t.height}}if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);if(super._upHandler(),t._spinTimeout&&clearTimeout(t._spinTimeout),t._spinInterval&&clearInterval(t._spinInterval),t._tapTimer&&clearTimeout(t._tapTimer),t._mobile&&e.originalEvent&&"pointercancel"===e.originalEvent.type)return;const l=()=>{if(t.editing.isEditing&&!t.editing.dialog.enabled){if(t._hasRichTextEditor)return;setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(o.element&&o.element&&o.element.firstElementChild&&o.element.firstElementChild.hasAttribute("aria-owns")){const t=o.element.firstElementChild.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}else if(t.editing.editRow){const o=t.editing.editRow.cells;for(let t=0;t<o.length;t++){const l=o[t];if(l&&l.editor&&l.editor.instance){if(l.editor.instance.element&&l.editor.instance.element.hasAttribute("aria-owns")){const t=l.editor.instance.element.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(l.editor.instance.element&&l.editor.instance.element.firstElementChild&&l.editor.instance.element.firstElementChild.hasAttribute("aria-owns")){const t=l.editor.instance.element.firstElementChild.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(l.editor.instance.blur(e),e.defaultPrevented)return}}}t.isAttached&&t.endEdit()}}),50)}};if(e.originalEvent&&(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),e.originalEvent.target.closest(".smart-grid-dialog")))t._dialogDragDetails&&(t._dialogDragDetails.started=!1);else{if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;){if(a=a.parentNode,a===t){o=!0;break}if(t.dropDownMode&&t.$.dropDownElement===a){o=!0;break}}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.closeDropDown(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const l=n.querySelectorAll("smart-drop-down-list"),a=n.querySelectorAll("smart-date-time-picker"),i=n.querySelectorAll("smart-date-input"),r=n.querySelectorAll("smart-input");for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.dropDownContainer.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;for(let e=0;e<r.length;e++)if(r[e].$.scrollView.contains(o))return;return t.closeMenu(),t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e)}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(!0!==t._mobile&&t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation())}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._mobile||this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;if(t._mobile)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l),i=t.parentElement,r=i?i.scrollTop:0,s=i?i.scrollLeft:0;if(n.left-s<=e.pageX&&n.left-s+a.width-10>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(l),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(delete t._areAllRowsSelected,t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t._mobile){t._hideActionButtons();const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}}if(t.$.fireEvent("columnClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),i("doubleClick"),t._onColumnDoubleClick(o,e)),Smart.Utilities.Core.isMobile){const o=t.rightToLeft?a.getBoundingClientRect().left:a.getBoundingClientRect().right,n=10;if(o-n<=e.clientX&&e.clientX<=o+n){const o=t.columnByDataField[l];if(!o||o&&!o.allowResize)return;const n=t._isLastVisibleColumn(o);if("split"===t.behavior.columnResizeMode&&n)return;a.style.cursor="col-resize",a.sortButton.style.cursor="col-resize",a.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(a),t._columnToResizeElement=a,t._columnToResizeDataField=l,e.preventDefault(),e.originalEvent&&e.originalEvent.preventDefault()}}if(t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null,d=null,c=null,u=null,m=null;t._lastPointerDownTime=new Date;for(let p=0;p<a.length;p++){const g=a[p];if(g.hasAttribute("toggle-button")&&(i=g),g.hasAttribute("add-row")&&(d=g),g.hasAttribute("checkbox")&&(r=g),"A"===g.nodeName&&e.ctrlKey&&g.click(),g.hasAttribute("rating-value")&&(c=g),g.hasAttribute("vote-value")&&(u=g),!s&&"smart-grid-cell"===g.nodeName.toLowerCase()&&!g.classList.contains("smart-grid-filter-row-cell")){if(s=g,g.hasAttribute("data-type")&&"string"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit&&!s.cell.column.autoGenerated){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id"),n=g.getBoundingClientRect(),i=t.columnByDataField[l];if(o>=n.right-20&&("tags"===i.template||"list"===i.template||"dropdownlist"===i.template||"combobox"===i.template))return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"date"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id");if(o>=g.getBoundingClientRect().right-20)return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"number"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const a=g.getAttribute("data-field"),n=g.closest("smart-grid-row").getAttribute("data-id"),i=g.getBoundingClientRect();if(o>=i.right-20){const o=()=>{let e=t.getCellValue(n,a);null!=e&&""!==e||(e=0);const o=e;let r=1;const s=t.columnByDataField[a];s&&s.formatSettings&&s.formatSettings.Intl&&("percent"===s.formatSettings.Intl.NumberFormat.style&&(r=.01),"currency"===s.formatSettings.Intl.NumberFormat.style&&void 0===s.formatSettings.Intl.NumberFormat.minimumFractionDigits&&(r=.01),s.formatSettings.Intl.NumberFormat.minimumFractionDigits>0&&(r=.01)),l>=i.top&&l<=i.bottom-i.height/2?e+=r:e-=r,s.editor&&(e>s.editor.max&&(e=s.editor.max),e<s.editor.min&&(e=s.editor.min)),t.setCellValue(n,a,e);const d=t.rowById[n].getCell(a);t.onCellUpdate&&t.onCellUpdate([d],[o],[e],(function(){t.onCellUpdated&&t.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[e],t),t._onCellUpdated&&t._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,e)}),t)};return o(),clearTimeout(t._spinTimeout),t._spinTimeout=setTimeout((()=>{clearTimeout(t._spinTimeout),t._spinInterval=setInterval((()=>{t._spinInterval&&o()}),50)}),150),e.stopPropagation(),void e.preventDefault()}}}if(!m&&g.classList.contains("smart-card")&&(m=g),!n&&"smart-grid-row"===g.nodeName.toLowerCase()){n=g;break}}if("card"===t.view){if(m){const o=m.getAttribute("row-id"),l=t.rowById[o];if(l){const a=e.originalEvent?e.originalEvent:e,n=3===a.which;if(l.element||l.createElement(),t.$.fireEvent("rowClick",{row:l,id:l.id,data:t.getRowData(l.id),isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)}),s){const e=s.getAttribute("data-field");if(e){const o=t.columnByDataField[e],i=new Smart.Grid.Cell(l,o,this);s.cell=i,i.element=s,i&&t.$.fireEvent("cellClick",{cell:i,id:l.id,dataField:i.column.dataField,value:i.value,isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)})}}const i=e.originalEvent.target;if(m.classList.contains("smart-card-header"))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(l.children&&l.children.length>0&&(i.classList.contains("smart-icon-ungroup")||i.classList.contains("smart-icon-group")))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(t.editing.enabled){const l=t.editing.dialog.enabled,a=t.editing.mode;if(i.scrollHeight>i.offsetHeight){const o=t.offset(i);if(e.originalEvent.pageX>=o.left+i.offsetWidth-15)return}const n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=o;let r=t._isUpdating;m.setAttribute("edit",""),t.beginEdit(o),t._isUpdating=r,t._endCardRowEdit?(t.removeEventListener("endEdit",t._endCardRowEdit,null),t.removeEventListener("cancelEdit",t._endCardRowEdit,null)):t._endCardRowEdit=()=>{t.context=t,t.editing.dialog.enabled=l,t.editing.mode=a,t.editing.isEditing=!1,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endCardRowEdit),t.addEventListener("cancelEdit",t._endCardRowEdit)}}}return}c&&(t._ratingElement=c),u&&(t._voteElement=u);const p=!!e.originalEvent&&3===e.originalEvent.which;if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn&&!p){const e=n.row;if(t._overlay||e.header&&"row-resize"===e.header.style.cursor||e.header&&"row-resize"===e.header.parentElement.style.cursor)return;t.editing.isEditing&&t.cancelEdit(),e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else if(d){const e=n.row,o=e.data;let l=o.parent;const a={};for(a[o.groupDataField]=null!==e.label?e.label:null,void 0!==e.labelValue&&(a[o.groupDataField]=e.labelValue);l;){let e=null!==l.label?l.label:null;l.labelValue&&void 0!==e&&(e=l.labelValue),a[l.groupDataField]=e,l=l.parent}t.addRow(a),setTimeout((()=>{t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update()}),100)}else{const o=n.row,l=s?s.cell:null;if(l.column._treeColumn&&r)return void(o.checked=!o.checked);l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(t._overlay||o.header&&"row-resize"===o.header.style.cursor||o.header&&"row-resize"===o.header.parentElement.style.cursor)return;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return o.header.style.cursor="",void(t._rowToResize.onpointerup=()=>{const a=t.editing.isEditing;t._rowToResize&&(t._rowToResize.onpointerup=null),t._clickedRow===n&&!a&&!t._rowResizeLine&&l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection&&t._setSelection(o.id,l.column.dataField,e)});o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||e.metaKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else(l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a||l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection)&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,c=e.originalEvent?e.originalEvent:e,u=3===c.which;if(u||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),u&&t.contextMenu.enabled){t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField;const e=t.getSelectedCells();let a=!0;if(t.contextMenu.dataField&&!t.contextMenu.dataField.startsWith("_"))if(e.length){for(let t=0;t<e.length;t++){const n=e[t],i=n[0],r=n[1];if(""+i==""+o.id&&l.column.dataField===r){a=!1;break}}t._focusCell(o.id,l.column.dataField,a),a&&t._selectCellsRange(o,o,l.column.dataField,l.column.dataField)}else{const e=t.getSelectedRowIds();(0===e.length||e.length>1)&&(t._focusCell(o.id,l.column.dataField),t._selectCellsRange(o,o,l.column.dataField,l.column.dataField))}else t._copyRects&&t._copyRects.length&&t.clearSelection(),t.selectRow(o.id);return t.openContextMenu(c.pageX+10,c.pageY+10),void(t.contextMenu.selector&&(c.stopPropagation(),c.preventDefault()))}if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}refreshRelations(){const e=this;if(e.dataSourceSettings&&e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length){for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&(o._isDirty=!0)}e._recycle(!1);for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&delete o._isDirty}}}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){if("object"==typeof e)return o&&o.columns&&(l.__measuredColumnHeight=null),void l.render();switch(l._notify(e,t,o),e){case"dataSourceSettings_relations":return void l.refreshRelations();case"dataSourceSettings_transpose":return void l.render();case"onRowHistory":case"onRowInserted":case"stateSettings_current":return;case"highlighted":"kanban"===l.view&&l._kanban?(l._kanban.selectTask(o),l._kanban.ensureVisible(o)):"scheduler"===l.view&&l._scheduler&&l._scheduler.focusEvent(o);break;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o,!0));case"users":case"currentUser":l._refreshCurrentUser(),l._recycle();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return l._setLoadingIndicatorVisibility(),void l._recycle(!1);case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnGroupLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":if(l.header.visible&&""===l.header.template){let e=l.$.header;l.header.appendTo&&(e=document.querySelector(l.header.appendTo),e?e.onclick=e=>{l._headerClickHandler(e)}:e=l.$.header),e.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=e.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar)}break;case"header_buttons":l.header.visible&&""===l.header.template&&l._refreshHeaderBar();break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection&&(l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index})}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l.grouping.groupBar.visible&&l._renderGroupBar(),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":{l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[];let e=!1;if(t&&t.length)for(let o=0;o<t.length;o++)if(t[o].freeze){e=!0;break}if(l.columns&&l.columns.length)for(let t=0;t<l.columns.length;t++)if(l.columns[t].freeze){e=!0;break}if(e&&l._initializeRowElements(),l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}l._renderColumns(),l._refreshHeaderBar();const o=l._sortedColumns;if(o){l.clearSort();for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;l._refreshSort(o)}if(l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return l.layout.isDirty=!0,l._resetCachedLayout(),void l._refreshLayout()}case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":delete l._isFirstVirtualDataSourceRequest,l._isUpdating&&l.endUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.editor&&(delete t.editor.isInitialized,delete t.editor.dataSource,delete t.editor._items,t.options&&(t.editor.dataSource=t.options),t.editor.isDirty=!0),t._cellsCachedValues=[],delete l._cellCachedValues,l._cellEditors=[]}if("dataSource"===e&&t&&o){const e=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&"infinite"!==l.scrolling,a=e=>Array.isArray(e)&&e.every((e=>Array.isArray(e)));if(o&&a(o)){const e=[];for(let t=0;t<o.length;t++){const a={};for(let e=0;e<l.columns.length;e++){const n=l.columns[e];let i=o[t][e];if(n.options){const e=n.options.find((e=>e.label===i||e.value===i));e&&(i=e.value)}"date"===n.dataType&&null!==i&&(i=new Smart.Utilities.DateTime(i).toDate()),a[n.dataField]=i}e.push(a)}o=e}if(t instanceof Smart.DataAdapter&&!e){if(t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.childrenDataField&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{let e=null;if(t&&l.dataSource&&l.dataSource._expandedRowIds){let t={};for(let e in l.dataSource._expandedRowIds){let o=""+e;o=o.replace("Item","").replace(/_/gi,"."),t[o]=!0}e=t}l.beginUpdate();const a=l._sortedColumns;l._sortedColumns&&l._sortedColumns.length>0&&void 0===l._getId()&&l.clearSort();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e]?l.dataSource[e].$.id:e;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const n=l._filters;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;if(a&&l._refreshSort(a),n&&n.length>0&&(l._filters=null,l.refreshFilters()),l.grouping.enabled)for(let t in e)l._expandCollapseGroup(t,!0);l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}if(l.dataSource&&l.dataSource.url&&l.filtering.enabled&&l.filtering.filterRow.visible){let e=!1;for(let t=0;t<l.columns.length;t++)l.columns[t]._filterEditorInitialized&&(e=!0),l.columns[t]._filterEditorInitialized=!1;e&&setTimeout((()=>{l._refreshFilterRowEditors(),l.refreshFilters(),l._recycle(!1)}),100)}}}return l.dataSource&&l.dataSource.length>1e4?(l.appearance.displayLoadingIndicator=!0,l._setLoadingIndicatorVisibility(),setTimeout((()=>{l.dataBind()}),100),setTimeout((()=>{l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility(),l._recycle(!1)}),200)):(l.dataSource&&l.dataSource instanceof Smart.DataAdapter&&l.columns&&l.dataSource.dataFields&&l.dataSource.dataFields.forEach((e=>{const t=l.columnByDataField[e.name];t&&(t.dataType=e.dataType)})),l.dataBind()),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"showViewBar":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"layout_autoHeight":case"layout_autoWidth":case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"row"!==l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.$.content.removeAttribute("aria-readonly"):l.$.content.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"layout_isDirty":return;case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){const e=this;e.disableSwipeScroll=!0,super.ready(),e._renderInDropDown();const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].loadingIndicatorPlaceholder?e.localize("loadingIndicatorPlaceholder"):e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e._details=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];if(e.filtering.enabled&&0===e._filterPanels.length){if(e.header.visible&&e.header.buttons.indexOf("filter")>=0)return;requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};if(e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this,t="card"===e.view;let o=e._recyclingRows,l=0,a=e._autoRowHeight,n=0,i=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===o.length||0===e.columns.length||!e.hasVisibleColumn())return 0;let r=40,s=1,d=0;if(t){for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&!o.autoGenerated&&(r+=e.layout.cardRowMinHeight,d++,o.cardHeight&&(r-=e.layout.cardRowMinHeight,r+=o.cardHeight*e.layout.cardRowMinHeight))}let t=e.offsetWidth;!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||(t-=e.layout.viewBarWidth+5),s=t<e.layout.cardMinWidth?1:"auto"===e.layout.cardsPerRow?Math.floor(t/e.layout.cardMinWidth):e.layout.cardsPerRow,1===s&&(r+=5*d),e._cardHeight=r}e._cardsPerRow=s,e.rows.canNotify=!1;const c=e._measureRowElement(o[0].data),u=o.length;for(let s=0;s<u;s++){let d=o[s];if(!d.visible||!1===d.filtered){d.height=0,d.cellHeight=0,d.top=l;continue}const u=e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled;let m=!d.height||!d.cellHeight||u||"auto"===d.height||"auto"===d._height||"auto"===e.layout.rowHeight||e.layout.isDirty;if(t&&d.height!==r&&(d.height=d.cellHeight=r),m&&!d.expandHeight){if(d.detailHeight||(d.detailHeight=200),t)d.height=d.cellHeight=r;else if(e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.height=e.layout.rowHeight,d.computedHeight&&(d.height=d.computedHeight),d.minHeight>d.height&&(d.height=d.minHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.element=c,d.grid=e,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a,o=d.canNotify;d.canNotify=!1,d.height=t,d.computedHeight&&(d.height=d.computedHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight),d.canNotify=o}else e.layout.rowHeight(s,d),d.height||(d.height=a),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}else{if("auto"===d.height||"auto"===d._height){d.element=c,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a;d.height=t,d._height="auto"}else d.height=a;void 0===d.label||d.summaryRow||"advanced"!==e.grouping.renderMode||(d.height=e.grouping.groupRowHeight),d.computedHeight&&(d.height=d.computedHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}e._rowGap&&s<e.rows.length-1&&(d.height+=e._rowGap)}!t&&(!0===d.freeze||"near"===d.freeze?d.visible&&(n+=d.height):"far"===d.freeze&&d.visible&&(i+=d.height),d.freeze&&d.visible)?d.top=l:(d.top!==l&&(d.top=l),d.expandHeight?l+=d.cellHeight:l+=d.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(l+=1*a),e.editing.addNewRow&&"row"!==e.editing.addNewRow.displayMode&&(l+=1*a),e.filtering&&e.filtering.filterRow.visible&&(n+=a+1),e.editing.addNewRow&&"button"!==e.editing.addNewRow.displayMode&&e.rowHierarchy&&e.editing.addNewRow.visible&&(l+=a,"far"!==e.editing.addNewRow.position&&(n+=a)),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(l=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return t&&(l=r*Math.ceil(o.length/s)),e.__scrollHeight=l,e.__frozenNearHeight=n,e.__frozenFarHeight=i,e._scrollView.scrollHeight=l-e.$.scrollView.offsetHeight+n+i,l=e.__scrollHeight+n+i-1,e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(l+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=l,c.remove(),o[0]&&delete o[0]._isMeasureRow,e.rows.canNotify=!0,l}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.collapsible&&e._initializeColumnGroupCollapsing(o)}}_initializeColumnGroupCollapsing(e){const t=this;e.collapsed=e.collapsed||!1,e.collapseButton=document.createElement("div"),e.collapseButtonIcon=document.createElement("span"),e.collapseButton.appendChild(e.collapseButtonIcon),e.collapseButton.classList.add("smart-grid-column-group-collapse-button"),e.collapseButtonIcon.classList.add("smart-grid-icon",e.collapsed?"smart-icon-right":"smart-icon-left","show"),e.collapseButton.setAttribute("role","button"),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"));const o=(e,l)=>{if(e.collapsed=l,e.collapseButtonIcon.classList.remove("smart-icon-left"),e.collapseButtonIcon.classList.remove("smart-icon-right"),e.collapsed?e.collapseButtonIcon.classList.add("smart-icon-right"):e.collapseButtonIcon.classList.add("smart-icon-left"),t.beginUpdate(),e.collapsed){const t=e=>{let t=0;for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.allowCollapse&&(l.visible=!1,t++)}t===e.columns.length&&e.columns[0]&&!e.inline&&(e.columns[0]._visible=!0,e.columns[0].visible=!0)};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}else{const t=e=>{for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}t.endUpdate(),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"))};e.collapsed&&requestAnimationFrame((()=>{o(e,e.collapsed)})),e.collapseButton.addEventListener("click",(function(t){t.stopPropagation(),o(e,!e.collapsed)}))}_refreshColumnHeights(){const e=this;if("card"===e.view)return;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,c=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,c+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=c,c+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(a.parent&&n.setAttribute("column-group",a.parent.name),a.parent&&a.parent.columns&&a.parent.columns[0].dataField===a.dataField&&n.setAttribute("column-group-first-child",""),l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this,n.onpointerdown=()=>{if(e.selection.allowColumnHeaderSelection){const t=function(e){let o=new Array;if(e.columnGroup&&o.push(e),e.groups)for(let l=0;l<e.groups.length;l++)if(e.groups[l].columnGroup)o.push(e.groups[l]);else if(e.groups[l].groups){let a=t(e.groups[l]);for(let e=0;e<a.length;e++)o.push(a[e])}return o},o=t(l);e._selectColumnsRange(o[0].dataField,o[o.length-1].dataField)}}}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",!1===e.appearance.showColumnGroupLines&&e.setAttribute("appearance_hide-column-group-lines",""),e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e._autoHeight&&e.paging.enabled&&(e._overflowOffset=Math.max(o,e.paging.pageSize*e.layout.rowMinHeight)),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;if(t.summaryRow.visible)t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{if(!0!==t.editing.isEditing){t._calculateSummary();const o=t.$.headerBar;o&&o._updateTools&&o._updateTools(),!1!==e&&t._recycle(!1,!0,!1)}}),100);else{const e=t.$.headerBar;e&&e._updateTools&&e._updateTools()}}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[],e._frozenRowsById=[];let o=e._createdDate||new Date,l=void 0!==e._createdBy?e._createdBy:e.currentUser;const a=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a&&a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const n=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],i=function(a,i,r){let s=null;if(e.isInitialized&&(o=new Date),s=a?a.grid?a:new Smart.Grid.Row({data:a,index:i,grid:e,createdBy:l,createdDate:o}):new Smart.Grid.Row({data:{},index:i,grid:e,createdBy:l,createdDate:o}),n)for(let e=0;e<n.length;e++){const t=n[e],o=t.getCellValue(s.id,t.dataField,a);void 0!==o&&(s.data[t.dataField]=o)}if(e.rowById[s.id]&&(s.id=e.rows.length,e.rowById[s.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};s.id=e()}if(e.onRowInit){e.onRowInit(i,s,e),30!==s.height&&(s.cellHeight=s.height);for(let t in s)-1!==s.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}));e._details[i]=s.showDetail}if(s.selected&&(e._selection.rows[s.id]=!0,e._selection.indexes[s.index]=s.index),s.freeze&&s.visible){if(!0===s.freeze||"near"===s.freeze){e.rows.splice(t++,0,s);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0)}else if("far"===s.freeze){e.rows.push(s);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&(e._frozenFarRows.push(t),e._frozenRowsById[t.id]=!0)}}else e.rows[i]?(e.rows.splice(i,0,s),e.rows[i].index=e.rows.length):e.rows.push(s),s.data&&s.data.$&&(s.data.$.history=s.history,s.data.$.starred=s.starred,s.data.$.comments=s.comments,s.data.$.style=s.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&(e._recycle(!1,!0),e.grouping.groupBy.length&&e.refresh()),e._onRowInserted&&e._onRowInserted(l),r&&r(l)};if(e._rowInsertedCallback=o,void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:i});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([i],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),r&&r(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([i],[t],o,e)}else{const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i];void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),r&&r(t)}},r=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._onRowRemoved&&e._onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},s=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._onRowRemoved&&e._onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=i,e._removeLastRow=r,e._removeAt=s,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length,c=e.onRowInserted;e.onRowInserted=null,e.$.content.setAttribute("aria-rowcount",d);const u=e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling;if(e.dataSource&&e.dataSource.virtualDataSource&&e.paging.enabled&&!e.dataSource.virtualDataSourceOnExpand)for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource[t],l=t+e.paging.pageIndex*e.paging.pageSize;e.dataSource.id||(o.$.id=l),i(o,l)}else if(u){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];i(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];i(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(a(),e.onRowInserted=c,e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let l=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)i(o[t],e.dataSource.length-o.length+t);else i(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],a=[],n=[];for(let r=0;r<n.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=n[r],o.push(s),a.push(e.rows[s]),n.push(e.rows[s].data)):(i(n[r],n[r].$.index),l=!0)}e.onRowUpdated&&e.onRowUpdated(o,a,n,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:i(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":i(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":s(t.index);break;case"removeLast":r();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),t.$&&o.$.pageSizeSelector&&(t.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0])),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),o.$&&o.$.pageSizeSelector&&(o.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0]))}if(0===d&&0===e.columns.length&&e.dataSource.dataFields.length>0){const t=e.context;e.context=e,e.columns.canNotify=!1,e.columns=[],e._renderColumns(),e._resetCachedLayout(),e.columns.canNotify=!0,e.context=t}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),delete e.onLoad)}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0):"far"===o.freeze&&(e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}if(e.dataSource.id&&(null===l.data[e.dataSource.id]||void 0===l.data[e.dataSource.id])){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.data[e.dataSource.id]=t()}if(o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]){l.data=e.dataSource[o];for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t].name;e.dataSource.id&&o===e.dataSource.id||e.dataSource.keyDataField&&o===e.dataSource.keyDataField||e.dataSource.parentDataField&&o===e.dataSource.parentDataField||e.columnByDataField[o]||delete l.data[o]}void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)}-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l),e._frozenRowsById[l.id]=!0),e._conditionalColors&&e._conditionalColors.update&&setTimeout((()=>{e._conditionalColors.update(),e._recycle(!1)}),100)})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l&&(l.data=o,l.id=o.$.id,e.rowById[l.id]=l)}return e.rows.canNotify=!0,e.refresh(),void e._refreshPaging(!1)}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(!1,o),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}setDropDownLabel(e){const t=this;t.$.dropDownElement&&(t.dropDownModeInput?t.$.dropDownElement.querySelector(".smart-action-button smart-input").value=e:t.$.dropDownElement.querySelector(".smart-action-button").innerHTML=e)}openDropDown(){const e=this;if(!e.dropDownMode)return;if(!e.$.dropDownPopup)return;const t=e.$.dropDownPopup,o=e.$.dropDownElement;o.setAttribute("active",""),o.querySelector(".smart-drop-down-button").setAttribute("active",""),(()=>{const l=0,a=0;if(e.layout.isDirty=!0,window.screen.availWidth<400)return t.open("left","top"),t.style.width=e.offsetWidth+"px",void(t.style.height=e.offsetHeight+"px");{const o={width:e.layout.dropDownWidth,height:e.layout.dropDownHeight};t.style.width="auto"===o.width?o.width:o.width+"px",t.style.height="auto"===o.height?o.height:o.height+"px"}const n=o;if(n){const o=e.offset(n),i=o.left-l,r=l,s=Math.max(r,i);t.open(s,o.top+n.offsetHeight-a)}else t.classList.add("center"),t.open("center","center");e.style.display=""})()}isDropDownOpened(){return!!this.$.dropDownElement.hasAttribute("active")}closeDropDown(){const e=this;e.dropDownMode&&e.$.dropDownPopup&&(e.$.dropDownElement.removeAttribute("active"),e.$.dropDownElement.querySelector(".smart-drop-down-button").removeAttribute("active"),e.$.dropDownPopup.close())}_renderInDropDown(){const e=this;if(e.dropDownMode&&(e.dropDownMode&&(e.style.display="none"),e.dropDownMode&&void 0===e._dropDownMode)){e._dropDownMode=!0;const t=document.createElement("div"),o=e._createPopup();if(o.allowDrag=!1,o.classList.add("smart-grid-drop-down-popup"),e.$.dropDownElement=t,e.$.dropDownPopup=o,t.onmouseenter=()=>{t.hasAttribute("active")||t.setAttribute("hover","")},t.onmouseleave=()=>{t.removeAttribute("hover")},t.classList.add("smart-grid-drop-down-button","smart-drop-down-box"),e.parentNode.insertBefore(t,e),t.innerHTML=`<div class="smart-container" role="presentation">\n <div class="smart-content" role="presentation">\n <div class="smart-buttons-container" role="presentation">\n <span class="smart-action-button">${e.localize("dropDownPlaceholder")}</span>\n <span class="smart-drop-down-button">\n <span class="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n </div>\n </div>`,e.dropDownModeInput){const o=t.querySelector(".smart-action-button");o.innerHTML='<smart-input style="color: var(--smart-background-color); background: var(--smart-background); border-radius: 0px; width: calc(100% - 6px); height: calc(100% - 6px);"></smart-input>';const l=o.firstElementChild;l.onpointerdown=l.onclick=l.onpointerup=e=>{e.stopPropagation()},l.oninput=l.onchange=l.onkeyup=t=>{const o=e.rows||e.dataSource;clearTimeout(e._dropDownInputTimer),e._dropDownInputTimer=setTimeout((()=>{if(l.value.length>=2)for(let a=0;a<o.length;a++){const n=o[a],i=(""+(n.data?n.data:n)[e.dropDownModeDataField]).toLowerCase(),r=(""+l.value).toLowerCase();if(i.indexOf(r)>=0){"Enter"===t.key&&(l.value=i),e.selection.enabled&&(e.isDropDownOpened()||e.openDropDown(),e.rows&&(e.clearSelection(),e.selection.allowCellSelection?e.selectCell(n.id,e.dropDownModeDataField):e.selectRow(n.id),e.ensureVisible(n.id)));break}}}),300)}}if(t.onclick=()=>{o.classList.contains("open")?e.closeDropDown():e.openDropDown()},e.style.height="100%",e.style.width="100%",o.content.appendChild(e),e._cellsMerge=[],e._cellStyles=[],!e._popupDropDown){e._popupDropDown=o,o._refreshPosition=()=>{const l=e.offset(t),a=t.offsetHeight,n=e.offset(e);if(o.style.maxHeight="",o.style.minHeight="",l.top+a+o.offsetHeight>window.innerHeight-n.top){const e=a+l.top+o.offsetHeight-window.innerHeight+n.top;o.style.maxHeight=Math.max(250,o.offsetHeight-e)+"px",o.style.minHeight="250px"}else o.style.maxHeight="",o.style.minHeight=""};const l=()=>{if(e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}};o.onOpen=function(){e._popupDropDown._refreshPosition(),e.$.fireEvent("dropDownGridOpen"),e.$.listen("cellClick",l)},o.onClose=function(){if(e.$.unlisten("cellClick"),e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}e.$.fireEvent("dropDownGridClose")},o.onkeydown=function(e){"Escape"===e.key&&(o.result=!1,o.close())}}}}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||(e._undoRedo=[],e._refreshCurrentUser(),e._render())})),e.$.content.setAttribute("role","grid"),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),void super.render();const o=e.context;e.context=e,e.$.content.setAttribute("role","grid"),"grid"!==e.view&&e.setAttribute("view",e.view),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}transpose(e,t=180,o){const l=this,a=l.dataSource,n=l.columns;if(!a||!n)return null;let i=[],r=[];i=a instanceof Smart.DataAdapter?a.boundSource.toArray():a,r=n.toArray();const s=[],d=[{label:"",dataField:"field",freeze:!0,width:150}];for(let l=0;l<i.length;l++){const a={label:i[l][e]||`Row ${l+1}`,width:t,dataField:String(l)};o&&o(a),d.push(a)}for(let e of r){const t={field:e.label||e.dataField};i.forEach(((o,l)=>{t[l]=o[e.dataField]})),s.push(t)}l.beginUpdate(),l.dataSource=new Smart.DataAdapter({dataSource:s}),l.columns=d,l.endUpdate(),l.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_setupMobile(){const e=this;if(void 0===e._mobile&&(e._mobile=Smart.Utilities.Core.isMobile),e._mobile){e.layout.rowMobileHeight&&(e.layout.rowMinHeight=e.layout.rowHeight=e.layout.columnMinHeight=e.layout.columnHeight=e.layout.rowMobileHeight),e.behavior.rowResizeMode="none",e.behavior.allowRowReorder=!1,e.selection.allowDragSelectionAutoScroll=!1,e._scrollView.vScrollBar.showButtons=!1,e._scrollView.hScrollBar.showButtons=!1,e.style.setProperty("--smart-scroll-bar-size","12px"),document.body.style.setProperty("--smart-data-view-sort-panel-width","345px"),e._scrollContent=document.createElement("div"),e._scrollContent.style.width="100%",e._scrollContent.style.height="100%",e._scrollContent.style.position="absolute",e._scrollContent.style.left="0px",e._scrollContent.style.top="0px",e._scrollContent.style.background="white",e._scrollContent.style.zIndex=9999,e._scrollContent.style.opacity=.1,e._scrollContent.style.overflow="auto",e.addEventListener("viewChange",(()=>{"grid"===e.view?e._scrollContent.classList.remove("smart-hidden"):e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("beginEdit",(()=>{e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("endEdit",(()=>{e._scrollContent.classList.remove("smart-hidden")})),e._scrollContent.ontouchend=()=>{e._mobileDownTime=null},e._scrollContent.ontouchmove=t=>{if(t.stopPropagation(),!e._scrollContentScroll&&e.selection.enabled&&e.selection.allowDragSelection&&e.selection.allowCellSelection&&e._mobileDownDataField&&void 0!==e._mobileDownId&&e._mobileDownTime&&new Date-e._mobileDownTime>=800){const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,pageX:t.changedTouches[0].pageX,pageY:t.changedTouches[0].pageY});e._mobileSelect=!0,e._dragSelection(o("mousemove")),e._mobileSelect=!1,t.preventDefault()}},e._scrollContent.ontouchstart=e=>{e.stopPropagation()},e._scrollContent.onpointerup=t=>{if(e._dragSelectionStartDataField=null,e._dragSelectionStartRow=null,e._mobileDownDataField&&void 0!==e._mobileDownId){let o=null,l=null;const a=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);for(let t=0;t<a.length;t++){const n=a[t];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const t=n.closest("smart-grid-cell").cell;l=t.row.id,o=t.column.dataField;break}}new Date-e._mobileDownTime>=1e3&&e.editing.enabled&&e.selection.enabled&&e.selection.allowCellSelection&&o===e._mobileDownDataField&&l===e._mobileDownId&&e.beginEdit(e._mobileDownId,e._mobileDownDataField),e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null,t.preventDefault(),t.stopPropagation()}},e._scrollContent.onpointerdown=t=>{e._scrollContentScroll=!1;const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY});setTimeout((()=>{if(e._scrollContentScroll)e._hideActionButtons();else{const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);if(l[2]){if(e.selection.enabled&&e.selection.allowCellSelection){const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null;for(let a=0;a<l.length;a++){const n=l[a];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const a=n.closest("smart-grid-cell").cell;return e._mobileDownTime=new Date,e._mobileDownId=a.row.id,e._mobileDownDataField=a.column.dataField,e._dragSelectionStartDataField=a.column.dataField,e._dragSelectionStartRow=a.row,e._mobileSelect=!0,l[2].dispatchEvent(o("pointerdown")),e._mobileSelect=!1,t.stopPropagation(),void t.preventDefault()}}}if(l[2].classList.contains("smart-grid-add-row-button"))e._hideActionButtons(),l[2].dispatchEvent(o("click"));else if(l[2].classList.contains("smart-summary-placeholder")||l[2].classList.contains("summary-value-part"))e._hideActionButtons(),l[2].dispatchEvent(o("pointerup"));else if(l[2].closest("smart-menu-item")){e._hideActionButtons();const t=l[2].closest("smart-menu-item");l[2].closest("smart-menu")._menuItemSelectionHandler(t)}else{if(l[2].dispatchEvent(o("pointerdown")),e._lastMobileClickRange){const o=e._lastMobileClickRange;let l=!0;o.left<=t.pageX&&o.left+o.right>=t.pageX&&(l=!1),l&&e._hideActionButtons()}else e._hideActionButtons();const a=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=e.offset(l);if(n.left<=t.pageX&&n.left+a.width-6>=t.pageX){if(!e.hasColumnMenu(o))return;e._lastMobileClickRange={left:n.left,right:n.left+a.width-6},l._showActionButton()}else l._hideActionButton()}};for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t];a(o.column,o)}}}}}),300),t.stopPropagation()};let t=0;const o=()=>{const t=e._scrollContent.scrollLeft,o=e._scrollContent.scrollTop;e._scrollView.vScrollBar.value=o,e._scrollView.hScrollBar.value=t,e._scrollContentScroll=!0};e._scrollContent.onscroll=()=>{cancelAnimationFrame(t),t=0,t=requestAnimationFrame(o)},e._scrollContentView=document.createElement("div"),e._scrollContentView.style.width=e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e._scrollView.scrollHeight+"px",e._scrollContent.appendChild(e._scrollContentView),e.$.scrollView.appendChild(e._scrollContent)}}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&(e.header.buttons.indexOf("views")>=0||e.header.buttons.indexOf("states")>=0)&&e._updateKanbanTaskFields()),e._setupMobile(),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,id:e.dataSourceSettings.id,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),e._initFormulaParser(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale;let o=e.$.header;e.header.appendTo&&(o=document.querySelector(e.header.appendTo),o?o.onclick=t=>{e._headerClickHandler(t)}:o=e.$.header),o.appendChild(t),e.$.headerBar&&e.$.headerBar.remove(),e.$.headerBar=o.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{let t=!1;if(e.stateSettings.autoLoad){let o=e.stateSettings.current;!o&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,o=e.stateSettings.current);let l=null;e.stateSettings.storage&&(l=e.stateSettings.storage[o]),l&&(t=!0),!l&&e.stateSettings.allowLocalStorage&&(l=window.localStorage.getItem(o),l&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],l=e.filtering.filter[1];let a=null;if(o&&(a=e.dataSource._createFilter(o.dataType,l)),a){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}e.addFilter(t,a,!1)}break}const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}if(a){if(e.filtering.filterRow.visible){const o=e.columnByDataField[t];if(!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}}e.addFilter(t,a,!1)}}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;if(t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let o=0;o<t.filters.length;o++)e.push(t.filters[o].value),o<t.filters.length-1&&e.push(t.logicalOperators[o]);o._filterInfo={condition:t.filters[0].condition,value:e.join(" ")}}e.addFilter(o.dataField,t,!1)}}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e.filtering.enabled&&e.filtering.filterRow.visible&&e._refreshFilterRowEditors(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view?e._initKanbanView():"scheduler"===e.view&&e._initSchedulerView()}_initFormulaParser(){const e=this;if(e.formulas){class t{constructor(e){const t=this;let o;try{o=new formulaParser.Parser}catch(e){throw new Error("Smart.FormulaParser: Missing reference to 'formula-parser.min.js'.")}o.on("callCellValue",t._callCellValue.bind(t)),o.on("callRangeValue",t._callRangeValue.bind(t)),t.dataTable=e,t.parser=o}_getFormula(e){const t=this,o="A".charCodeAt(0);let l=0,a="";const n=e;if(t.dataTable._formulas||(t.dataTable._formulas=[]),t.dataTable._formulas[e])return t.dataTable._formulas[e];for(let n=0;n<t.dataTable.columns.length;n++){const i=t.dataTable.columns[n],r=String.fromCharCode(o+l);l++,l>=26&&(l=0,a+="A"),e.indexOf(i.label)>=0?e=e.replaceAll(i.label,a+r):e.indexOf(i.dataField)>=0&&(e=e.replaceAll(i.dataField,a+r))}return t.dataTable._formulas[n]=e,e}_callCellValue(e,t){const o=this,l=o.dataTable,a=e.column.index,n=e.row.index,i=l.columns[a].dataField;let r=l.dataSource[n][i];const s=l.rows[n];if(s){const e=s.getCell(i);e&&e.formula&&(r=o._getFormula(e.formula))}"string"==typeof r&&/=.+/.test(r)?r=o.parse(r.slice(1)):"string"==typeof r&&"number"===l.columns[a].dataType&&(r=parseFloat(r)),t(r)}_callRangeValue(e,t,o){const l=this.dataTable,a=l.dataSource,n=[];for(let o=e.row.index;o<=t.row.index;o++){const i=a[o],r=[];for(let o=e.column.index;o<=t.column.index;o++){let e=i[l.columns[o].dataField];e=isNaN(e)?0:parseFloat(e),isNaN(e)&&(e=0),r.push(e)}n.push(r)}n&&o(n)}parse(e){const t=this.parser.parse(this._getFormula(e));return null!==t.result?t.result:t.error}}e._formulaParser=new t(e)}}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(e){const t=this,o=t.conditionalFormatting;if(!o||0===o.length)return;if(!t._defaults){const e=getComputedStyle(t);t._defaults={fontFamily:e.fontFamily,fontSize:e.fontSize,text:t._toHex(e.color),highlight:t._toHex(e.backgroundColor)}}t._formatter||(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource)),e&&(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource),delete t._conditionalFormatting);const l=t._defaults,a=t._formatter,n=[],i=function(e){if("all"===e){if(t.columns&&t.columns.map){const e=[];for(let o=0;o<t.columns.length;o++){const l=t.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||e.push(l.dataField)}return e}return[]}return[e]};for(let e=0;e<o.length;e++){o[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},o[e]);const t=o[e],r=i(t.column),s=t.condition;a.color=t.highlight,a.comparator=t.firstValue,a.min=t.firstValue,a.max=t.secondValue;const d=a.format(s,r);for(let e in d){const o=d[e];for(let e in o){const l=o[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=o),0===n.length)return n[0];const r={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){r[e]||(r[e]={});for(let t in o)r[e][t]=Object.assign({},r[e][t],o[t])}}}t._conditionalFormatting=r,e&&t._recycle(!1)}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),e.appearance.showRowComments&&(l=25,t.minWidth=25),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));delete a.grid,delete a.dataType,delete a.index,delete a.visibleIndex,n.grid=e,e.columns.push(n),n._dataField&&(e.columnByDataField[n._dataField]=n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.$.content.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);e.rowDetailColumn=a,"near"===e.rowDetail.position?(e.viewColumns.splice(l,0,a),o.freeze="near",a.freeze="near",e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30});new Smart.Observable(a,a.observables).canNotify=!1;const n=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),i=new Smart.Observable(n,n.observables);i.canNotify=!1,e.editing.commandColumn.visible&&("near"===e.editing.commandColumn.position?(n.freeze="near",i.freeze="near",e.viewColumns.splice(l,0,i),e._frozenNearColumns.splice(l,0,i)):(e.viewColumns.push(i),e._frozenFarColumns.splice(0,0,i))),e._commandColumn=i;const r=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(r,r.observables);if(e.selection.checkBoxes.enabled&&("near"===r.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s))),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}if(t._renderColumns(),t.__columnHeaderHeight=null,e){t.beginUpdate();const o=t.context;t.context=document;for(let o=0;o<e.length;o++){const l=e[o],a=t.columnByDataField[l.dataField];["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","sortIndex","sortOrder","sortComparator","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"].forEach((e=>{void 0!==l[e]&&(a[e]=l[e])}))}t.context=o,t.endUpdate(!1)}t.refresh()}onAttached(){const e=this;if(!e._scrollView){e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar);const t=e._scrollView.hScrollBar;e._scrollView.vScrollBar.onChange=e._verticalScrollbarHandler.bind(e),t.onChange=e._horizontalScrollbarHandler.bind(e)}if(e.isRendered&&e.isCompleted&&(e._isDestroyed||e.behavior.autoDestroy)){if(e.header.visible&&""===e.header.template){let t=e.$.header;e.header.appendTo&&(t=document.querySelector(e.header.appendTo),t?t.onclick=t=>{e._headerClickHandler(t)}:t=e.$.header),t.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',e.$.headerBar=t.firstElementChild;const o=e.$.headerBar;o.messages=e.messages,o.locale=e.locale,e.$.headerBar._init(e),o.render(),e.header.onInit&&e.header.onInit(e.$.headerBar)}e._render()}}destroy(){const e=this;if(!e.isRendered)return;e._isDestroyed=!0,["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.$.headerBar;if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection&&e._selection.selectionRect&&(e._selection.selectionRect.parentNode&&e._selection.selectionRect.parentNode.removeChild(e._selection.selectionRect),e._selection.selectionRect=null),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}onDetached(){const e=this;e.behavior.autoDestroy&&e.destroy()}_observeColumns(){const e=this,t=function(t,o,l,a){if(l!==a||"selected"===o){if(null==l&&null==a)return;if(l&&"object"==typeof l&&Array.isArray(l)&&a&&"object"==typeof a&&Array.isArray(a)&&JSON.stringify(l)===JSON.stringify(a))return;t.propertyChanged(o,l,a),e.onColumnChange?t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a):e.$.fireEvent("columnChange",{column:t,propertyName:o,oldValue:l,value:a})}};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l.grid=e,l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===l.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:l.dataField,dataType:l.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l){if(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),l._dataField){const t=e.columnByDataField[l._dataField];t&&t.dataField===l.dataField&&delete e.columnByDataField[l._dataField]}delete e.columnByDataField[l.dataField]}if(e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),"card"===e.view&&(t=0),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,e._hScrollTimer&&clearTimeout(e._hScrollTimer),e._hScrollTimer=setTimeout((()=>{e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelNative(e,t){const o=this;void 0===o._scrollWheelContent&&(o._scrollWheelContent=document.createElement("div"),o._scrollWheelContent.style.width="100%",o._scrollWheelContent.style.height="100%",o._scrollWheelContent.style.position="absolute",o._scrollWheelContent.style.left="0px",o._scrollWheelContent.style.top="0px",o._scrollWheelContent.style.background="white",o._scrollWheelContent.style.zIndex=9999,o._scrollWheelContent.style.opacity=0,o._scrollWheelContent.style.overflow="auto",o._scrollWheelContent.style.visibility="hidden");let l=0;const a=()=>{if(t){const t=o._scrollWheelContent.scrollLeft;o._scrollView.hScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}else{const t=o._scrollWheelContent.scrollTop;o._scrollView.vScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}};o._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(a)},o._scrollWheelContentView||(o._scrollWheelContentView=document.createElement("div"),o._scrollWheelContent.appendChild(o._scrollWheelContentView)),o._scrollWheelContentView.style.width=o.offsetWidth+o._scrollView.scrollWidth+"px",o._scrollWheelContentView.style.height=o.offsetHeight+o._scrollView.scrollHeight+"px",o.$.scrollView.appendChild(o._scrollWheelContent),o._scrollWheelContent.scrollTop=o._scrollView.vScrollBar.value,o._scrollWheelContent.scrollLeft=o._scrollView.hScrollBar.value,!0===t?o._scrollWheelContent.scrollTo({top:o._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):o._scrollWheelContent.scrollTo({top:e,left:o._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating)return;if(t.editing.isEditing)return;if(!t.behavior.allowMouseWheel)return;const o=t.querySelector("smart-grid-toolbar");if(o&&o.$.headerDropDown.classList.contains("open"))return;let l=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(l=!0):0===e.deltaMode&&(l=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let o=160;const a=0===e.deltaX?e.wheelDelta:e.deltaX;a<0&&(o=-160),Math.abs(a)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+o,!0):t._scrollView.scrollLeft+=a}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=15*t.layout.rowMinHeight;if(e.deltaY<=0&&(a=-15*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+a);else{t._wheelrafId=0;const o=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(o)}}}_refresh(e){const t=this;if(t._isUpdating)return;const o=t.$.verticalScrollBar.offsetWidth;t.removeAttribute("grouped"),t.removeAttribute("tree");let l=!0;t.__autoHeightRows&&(t.__autoHeightRows=null,t._refreshColumnsResponsiveVisibility(),t._recycle(),l=!1),t._groups||(t._groups=[]),t._cellCachedValues=[],t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>=0&&("advanced"===t.grouping.renderMode?t.setAttribute("grouped",""):t.setAttribute("tree",""),t._groups||(t._groups=[].concat(t.dataSource.groupBy.toArray())||[]),t._renderGroupBar()),t.grouping.enabled&&t.dataSource.groupBy&&0===t.dataSource.groupBy.length?t.$.breadcrumb&&(t.$.breadcrumb.dataSource=[]):t.dataSource.boundHierarchy&&(t.setAttribute("tree",""),t.$.content.setAttribute("role","treegrid"),t.$.container.removeAttribute("role")),(t.isInitialized||l)&&t._refreshColumnsResponsiveVisibility(),t._refreshLayout(),o!==t.$.verticalScrollBar.offsetWidth&&(t.__scrollWidth=null,t._refreshColumnsResponsiveVisibility(),t._refreshScrollBars(),0===t.$.verticalScrollBar.offsetWidth&&t.isRendered&&requestAnimationFrame((()=>{t._refreshScrollBars()}))),t._refreshSelection(),t._deleteCopyRects(),t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update(),"add"===e||"remove"===e||"update"===e?(t._rowChangeTimeout&&clearTimeout(t._rowChangeTimeout),"remove"===e?(t._recycle(!1),t._refreshHeaderBar()):t._rowChangeTimeout=setTimeout((()=>{t._recycle(!1),t._refreshHeaderBar()}),100)):(t._recycle(),t._refreshHeaderBar()),t._recyclingRows&&0===t._recyclingRows.length&&(t.$.placeholder.classList.remove("smart-hidden"),t.scrollHeight=0,t.$.placeholder.innerHTML=t.messages[t.locale]&&t.messages[t.locale].placeholder?t.localize("placeholder"):t.appearance.placeholder,t.filtering.filterRow.visible&&(t.$.placeholder.style.top="0px",t.$.placeholder.style.position="relative",t._filters&&t._filters.length&&(t.$.placeholder.style.top="12px")),t._filters&&t._filters.length&&(t.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${t.localize("filteredRecords")}`)),t.dataSource&&t.dataSource.boundHierarchy&&t.conditionalFormatting&&t._renderConditionalFormatting(!1),t.filtering.enabled&&t.filtering.filterRow.visible&&(t._suspendFilterRowRefresh||t._refreshFilterRowEditors(),t._recycle(!1)),requestAnimationFrame((()=>{t._width=t.offsetWidth,t._height=t.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return t._undoRedo=[],t._refreshCurrentUser(),void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return void(!1===t._resizeHandling&&(t.layout.isDirty=!0));t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view&&"card"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,c=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(c+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===c&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=c,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t._mobile&&e.preventDefault(),t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible&&!e.header.appendTo),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1)}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,l){for(let c=0;c<t.length;c++){const u=t[c];let m=o.rowById[u.$.id];if(n&&(m=o.rows[s],m||(m=r(u),o.rows.push(m)),u[i.leaf]?m.id=u.$.id:m.id="Group_"+u.$.id,o.rowById[m.id]=m),m||(m=r(u),o.rowById[m.id]=m),m.data=u,m.leaf=u[i.leaf]||!1,m.level=u[i.level],m.groupDataField=u.groupDataField,o.hasAttribute("tree")&&o.dataSource&&o.dataSource.childrenDataField&&(m.index=s),!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=u.label,m.groupDataField){const e=o.columnByDataField[m.groupDataField];if(e&&e.editor.dataSource)for(let t=0;t<e.editor.dataSource.length;t++){const o=e.editor.dataSource[t];if(""+o.value===m.label){void 0!==o.label?(m.label=o.label,m.labelValue=o.value):void 0!==o.name&&(m.label=o.name,m.labelValue=o.value);break}}}if(m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),u.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),u.parent?(m.parent=o.rowById[u.parent.$.id],m.parentId=u.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(u);e&&(m.expanded=u[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==u[i.expanded]&&(m.expanded=u[i.expanded]);let p=!!e||m.expanded;a&&(p=!0);const g=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(g&&!m.data[g]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];u.parent&&u.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[g])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,p||u[i.leaf])if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let c=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<c.length;o++){let l=c[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;!a&&null!==a||0!==l.level||l.parent||(t(l.children).length,e.push(l))}c=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}const u=o.rows.canNotify;o.rows.canNotify=!1,o.rowHierarchy=d(c,new Array),o.rows.canNotify=u;let m=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&m.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=m),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow){o._initializeRowElements();let e=0,t=o.rows.canNotify;o.rows.canNotify=!1;for(let t=0;t<o.rowHierarchy.length;t++){const l=o.rowHierarchy[t],a=o.layout.rowHeight||o.layout.rowMinHeight;void 0===l.top&&(l.top=e,l.height=l.cellHeight=a),l.height?e+=l.height:e+=a}o.rows.canNotify=t,o._recycle(!1,!0)}if(o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||e.layout.autoHeight||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&!e.header.appendTo&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible&&!e.header.appendTo?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible,e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible&&!e.header.appendTo?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&!e.header.appendTo&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown)e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft="";else{const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e._mobile||(e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px"),e.$.viewBar.style.width=o+"px";let l=0;e.header.visible&&!e.header.appendTo&&(l+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(l+=e.$.groupHeader.offsetHeight),e.pager.visible&&(l+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=l+"px",e.$.viewBar.style.height=t+"px"}}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshAutoSize(){const e=this;if(e.layout.autoWidth){const t=e._isUpdatingScrollBars;e._isUpdatingScrollBars=!0;let o=2;for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];l.visible&&(o+=l.computedWidth)}o+=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,e.style.width=o+"px",requestAnimationFrame((()=>{e._isUpdatingScrollBars=t}))}e.layout.autoHeight&&(e.style.height="auto")}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshAutoSize(),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),"card"===e.view&&(e.__columnHeaderHeight=0),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value,e._refreshLayout(),e._refreshSelection(),e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("pageIndexChange"):(e._recycle(),e._scrollUpdate&&clearTimeout(e._scrollUpdate),e._scrollUpdate=setTimeout((function(){e.isScrolling||(e.$.rowContainer.style.top=parseInt(e.$.rowContainer.style.top)+.01+"px")}),50))})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),c=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=c,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility?(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden"),e.$.scrollView.classList.add("has-vscroll")):e.$.scrollView.classList.remove("has-vscroll"),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px"),e.filtering.enabled&&e.filtering.filterRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||c>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-c+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",c+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",c+e.__scrollBarSize+"px"))),t.refresh(),o.refresh(),e._mobile&&(e._scrollContentView.style.width=e.$.scrollView.offsetWidth+e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e.$.scrollView.offsetHeight+e._scrollView.scrollHeight+"px")}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getData(){const e=this;if(!e.dataSource)return[];const t=[];for(let o=0;o<e.dataSource.length;o++){const l=e.dataSource[o];if(l.$){const o={};for(let t=0;t<e.dataSource.dataFields.length;t++){const a=e.dataSource.dataFields[t].name;o[a]=l[a]}t.push(o)}else t.push(l)}return t}getDataFields(){const e=this;return e.columns?e.columns.map((e=>e.dataField)):[]}getColumns(){const e=this,t=[];if(!e.isInitialized)return t;if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}resetState(e=!0){const t=this;t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border",t._conditionalColors.update=()=>{}),t.$.headerBar&&delete t.$.headerBar._appliedColors,delete t._labeledBy,delete t._dateStackedBySelect,t.highlighted=null,t.columns.canNotify=!1;let o=[],l=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.visible=!0,a.width=180,a.freeze=!1,a.index>=0?o[a.index]=a:o.push(a),a.index!==e&&(l=!0)}l&&(t.columns=o),"grid"!==t.view&&e&&(t.view="grid",t._hideKanbanView(),t._hideSchedulerView()),t.columns.canNotify=!0,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.$.headerBar&&t.$.headerBar._setView&&"grid"===t.view&&t.$.headerBar._setView("grid"),t._kanban&&t._kanban._reset(),t.layout.isDirty=!0,t.endUpdate(),l&&(t._renderColumns(),t._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;t.stateSettings.loading=!0;let l=!1,a=!1,n=!1;if("grid"===e.view||"card"===e.view||void 0===e.view){if(e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const l=[];if(e.groups){t.dataSource.groupBy=e.groups,t._groups=[].concat(t.dataSource.groupBy.toArray())||[],t._refreshRowHierarchy();for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}else if(t.grouping.enabled&&t.dataSource.groupBy.length)for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0);t.dataSource&&(t.dataSource._expandedRowIds=l)}else if(e.groups&&e.groups.length){o=!0,t.beginUpdate();const l=[];t.dataSource&&(t.dataSource._expandedRowIds=l),e.groups&&(t.dataSource.groupBy=e.groups,t._refreshRowHierarchy())}else if(e.groups&&0===e.groups.length&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0){o=!0,t.beginUpdate();const e=[];t.dataSource&&(t.dataSource._expandedRowIds=e),t.dataSource.groupBy=[],t._refreshRowHierarchy(),a=!0}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());let a=[];for(let o=0;o<e.columns.length;o++){const i=e.columns[o];if(i.dataField){const e=t.columnByDataField[i.dataField];if(e){const r=e.canNotify;e.canNotify=!1,i.width?e.width=i.width:e.width=180,e.sortOrder="",e.sorted="",a.push(e),e.index!==o&&(n=!0),e.visible=void 0===i.visible||i.visible,e._state&&(e._state.visible=void 0===i.visible||i.visible,e._state.freeze=void 0!==i.freeze&&i.freeze,e._state.width=i.width?i.width:180);const s=e.freeze;e.freeze=void 0!==i.freeze&&i.freeze,s!==e.freeze&&(l=!0,e.freeze||t._frozenNearColumns.indexOf(e)),e.canNotify=r}}}n&&(t.columns=a)}}if(e.colors&&(t._conditionalColors=JSON.parse(JSON.stringify(e.colors)),t.$.headerBar)){let l=[];if(e.colors.conditions)for(let t=0;t<e.colors.conditions.length;t++){let o=e.colors.conditions[t],a=[];for(let e in o)a.push(o[e]);l.push(a)}o||(o=!0,t.beginUpdate());const a={type:e.colors.type,singleSelect:e.colors.singleSelect,decorate:e.colors.decorate};t.$.headerBar._appliedColors=[l,a],t._conditionalColors.update=e=>{t.$.headerBar._updateConditionalColors(e,t,a)}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const l=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let a=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=a;for(let o in e.sort){const l=e.sort[o];if(l){const e=l.sortOrder,a=l.dataField?l.dataField:o,n=t.columnByDataField[a];n&&t.sortBy(n.dataField,e)}}t.appearance.allowSortAnimation=l}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){let l=o,a=e.filter[l];if(e.filter[0]&&(l=e.filter[o].dataField,a=e.filter[o].filter),a){t.addFilter(l,a,!1);const e=t.columnByDataField[l];e&&e._filterInfo&&e.filter&&e.filter.filters&&e.filter.filters[0]&&(e._filterInfo.value=e.filter.filters[0].value,e._filterInfo.condition=e.filter.filters[0].condition)}}if(t.filtering.filterRow)for(let e=0;e<t.columns.length;e++)t.columns[e]._filterEditorInitialized&&(t.columns[e]._filterEditorInitialized=!1)}if(e.selectedCells&&(o||(o=!0,t.beginUpdate()),t.selectCellsById(e.selectedCells)),e.selectedRows&&t.selectRows(e.selectedRows),e.labeledBy&&(t._labeledBy=e.labeledBy),o){t.endUpdate(!1,!1);let o=!1;e.view&&"kanban"===e.view&&(o=!0),(l||n)&&(o=!1,a=!0,t._renderColumns()),o||(a?t.refresh(!0):t._refresh())}let i=!1;if(e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(i=!0),t._stackedBy=e.kanban.stackedBy),e.scheduler&&e.scheduler.stackedBy&&(void 0===t._dateStackedBy&&(t._dateStackedBy=e.scheduler.stackedBy),t._dateStackedBy!==e.scheduler.stackedBy&&(i=!0),e.scheduler.labeledBy&&(t._labeledBy=e.scheduler.labeledBy),e.scheduler.viewType&&(t._schedulerViewType=e.scheduler.viewType),void 0===t._dateStackedBySelect&&(t._dateStackedBySelect=e.scheduler.groupBy),t._dateStackedBySelect!==e.scheduler.groupBy&&(i=!0),t._dateStackedBy&&Array.isArray(t._dateStackedBy)&&e.scheduler.stackedBy&&Array.isArray(e.scheduler.stackedBy)&&JSON.stringify(t._dateStackedBy)===JSON.stringify(e.scheduler.stackedBy)&&(i=!1),t._dateStackedBy=e.scheduler.stackedBy),(i||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&(e.name&&(t.stateSettings.current=e.name),t.$.headerBar._setView(e.view,!0)),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.selectedCells){const o=[];let l=99999999,a=null,n=99999999,i=null,r=99999999,s=null;for(let l=0;l<e.selectedCells.length;l++){const a=e.selectedCells[l],d=a[0],c=a[1],u=t.columnByDataField[c];if(u&&(n=Math.min(n,u.index),i=Math.max(i,u.index)),!t.rowById[d])continue;const m=t.rowById[d].visibleIndex;m>=0&&(r=Math.min(r,m),s=Math.max(s,m)),o[d]||(o[d]=[]),o[d].push(c)}let d=0,c=!0;for(let e in o){const t=o[e];if(d&&t.length!==d){c=!1;break}d=t.length}if(c){const e=t.getRows(),o=e[r],d=e[s];if(l=o?o.id:-1,a=d?d.id:-1,o){const e=t.columns[n];if(e){const o=t.rowById[l].getCell(e.dataField);t._selection.focusedCell={id:o.row.id,value:o.value,dataField:o.column.dataField,index:o.row.index},setTimeout((()=>{t._selectCellsRange(t.rowById[l],t.rowById[a],t.columns[n].dataField,t.columns[i].dataField)}),50)}}}}e.name&&(t.stateSettings.current=e.name),t._refreshHeaderBar(),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border"),delete t._labeledBy,delete t._dateStackedBySelect,t.$.headerBar&&delete t.$.headerBar._appliedColors,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let l=o.getCurrentState(),a=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",l&&a)for(let e in a)l[a[e]]=n[a[e]];else l=n;function r(e,t=0,o=10){if(t>o)return"Object";const l={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let a in e){let n=e[a];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){l[a]=n;continue}if(n&&Array.isArray(n)&&0===n.length){l[a]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==a&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}l[a]=n}return t?l:JSON.stringify(l)}l.name=i,o.stringify_object=r;const s=r(l);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]&&!l.date&&o.stateSettings.storage[o.stateSettings.current].date?l.date=o.stateSettings.storage[o.stateSettings.current].date:l.date=(new Date).toJSON(),o.stateSettings.storage[o.stateSettings.current]=l,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)||o.stateSettings.onStateChange&&o._forceStateChange?o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r):o.stateSettings.onStateChange&&"grid"!==o.view&&o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r),l}autoSaveState(){const e=this;e._savingState&&clearTimeout(e._savingState),e._savingState=setTimeout((()=>{if(!e.stateSettings.current&&e.stateSettings.autoSave&&!e.stateSettings.loading){const t=e.stateSettings.storage;if(t&&0===Object.keys(t).length||!t){let t=e.localize("newGrid")+" "+e.localize("view");"kanban"===e.view?t=e.localize("newKanban")+" "+e.localize("view"):"card"===e.view?t=e.localize("newCard")+" "+e.localize("view"):"scheduler"===e.view&&(t=e.localize("newScheduler")+" "+e.localize("view")),e.stateSettings.current=t}}e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}),50)}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}setColors(e,t){const o=this;o._conditionalColors={type:t.type,decorate:t.decorate,conditions:e,singleSelect:t.singleSelect},o.$.headerBar.addColors(JSON.parse(JSON.stringify(e)),{type:t.type,singleSelect:t.singleSelect,decorate:t.decorate},[]),o._recycle(!1)}getColors(){const e=this;if(e._conditionalColors){const t=JSON.parse(JSON.stringify(e._conditionalColors));return{type:t.type,conditions:t.conditions,filters:t.filters,colors:t.colors,decorate:t.decorate,singleSelect:t.singleSelect}}return null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,l=!e||e&&e.includes("filter")?t.getFilteredColumns():null,a=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells(!1):null,i=!e||e&&e.includes("selection")?t.getSelectedRowIds():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null,s=!e||e&&e.includes("colors")?t.getColors():null;let d=0;r&&(d=r.pagesCount);const c={count:d,index:t.paging.pageIndex,size:t._pageSize},u={};o&&o.length&&(u.sort=o),l&&l.length&&(u.filter=l),a&&a.length&&(u.groups=a),c&&t.paging.enabled&&(u.paging=c),n&&n.length&&(u.selectedCells=n),i&&i.length&&(u.selectedRows=i),s&&(delete s.colors,u.colors=s),t._labeledBy&&(u.labeledBy=t._labeledBy),(t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"===t.view&&(u.kanban=t.getKanbanState()),"scheduler"===t.view&&(u.scheduler=t.getSchedulerState()),u.view=t.view);const m=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&m.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}u.columns=m}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}Object.values(e).length&&(u.expandedRows=e)}if((t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"!==t.view&&"scheduler"!==t.view||(delete u.expandedRows,delete u.columns,delete u.paging,delete u.selectedCells,delete u.selectedRows)),e){const t={};for(let o in e){const l=e[o];u[l]&&(t[l]=u[l])}return t}return u}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,t,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),o.column.element.setAttribute("level",o.level),0===o.columns.length&&o.column.element.classList.add("smart-hidden");const l=o.collapseButton;l&&o.column.element.appendChild(l),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let o in e._cachedTemplates)t.appendChild(e._cachedTemplates[o]);e._tableCachedTemplates.appendChild(t)}}_recycle(e,t,o,l){const a=this;if(a._layoutSuspended||!1===a.isAttached)return;if(a._isUpdating)return;if(a.editing.isEditing&&(!0===a._disableEndEdit||a.editing.dialog.visible||a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects();const n=a._scrollView.scrollTop;let i,r=l||a._getRowIndexByPosition(n),s=a._recyclingRows,d=s[r],c=d?d.top:0,u=0,m=0,p=0,g=0;if(a._cellRowSpan&&a._cellRowSpan.maxSpan>0){let e=0;if(r>=5?e=5:r>=4?e=4:r>=3?e=3:r>=2?e=2:r>=1&&(e=1),e>0){const t=s[r-e];t&&(d=t,c=d?d.top:0,p=e*d.height,r-=e)}}a._cellRowSpan=[];for(let e=0;e<a._cellsMerge.length;e++){const t=a._cellsMerge[e],o=s.indexOf(t.row);if(r>o&&r<=o+t.rowSpan&&(r=o,d=t.row,p=Math.max(p,c-d.top),c=d.top,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px"),t.colSpan>1)for(let e=0;e<a.viewColumns.length;e++){const o=a.viewColumns[e];let l=o.autoGenerated?o:a.columnByDataField[o.dataField];if(l.visible&&l.left+l.computedWidth-a._scrollView.scrollLeft>=u&&l.left-l.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){let e=a.columnByDataField[t.column.dataField];g=Math.max(g,l.left-e.left+l.computedWidth);break}}}a.isHScrolling&&a._clearCachedTemplates();let h=null;if(!1!==e||a._cellsMerge.length>0){if(a._columnElements)for(let e=0;e<a._columnElements.length;e++){const t=a._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<a._columnGroups.length;e++){const t=a._columnGroups[e],o=t.element;o&&(a.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px")}a._firstVisibleColumn=null,a._firstVisibleUserColumn=null,a._lastVisibleColumn=null;for(let e=0;e<a.viewColumns.length;e++){let t=a.viewColumns[e];if(t.visible&&(a._firstVisibleColumn||(a._firstVisibleColumn=t),a._firstVisibleUserColumn||t.autoGenerated||(a._firstVisibleUserColumn=t),a._lastVisibleColumn=t),t.element&&(t===a._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),!1!==a.appearance.showColumnGroupCellLines&&!1!==a.appearance.showColumnGroupLines||(t.parent&&t.parent.columns&&t.parent.columns[0].dataField===t.dataField?t.element.setAttribute("column-group-first-child",""):t.parent&&t.element.removeAttribute("column-group-first-child")),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-a._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){a._columnElements||(a._columnElements=[]);const o=a._columnElements[m++];o&&(o.set("column",t,!1),o.parentNode||a.$.columnContainer.appendChild(o),h||(h=t,a._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===i&&(i=t.left))}}}if(void 0===i&&(i=0),a.rightToLeft){const e=a._scrollView.scrollWidth-a._scrollView.scrollLeft-a._scrollView.vScrollBar.offsetWidth;a.$.columnContainer.style.right=e+"px",e<=0&&!a._scrollView.scrollWidth&&(a.$.columnContainer.style.right=-a.offsetWidth+a._computedColumnsWidth+"px")}else a.$.columnContainer.style.left=-a._scrollView.scrollLeft+"px";if(a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.isScrolling&&!a.isHScrolling&&(a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!a._rowElements)return;const f=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&a.dataSource.length>a.virtualModeCachedRowsCount&&"infinite"!==a.scrolling;let y=0,w=a.behavior.allowRenderCache&&!f&&"grid"===a.view&&!a.dataSource.virtualDataSourceOnExpand&&!a.rowDetail.template&&!a.rowDetail.enabled&&!a._autoHeight&&!a.pager.visible&&!a._frozenFarColumns.length&&!a.hasAttribute("tree");if("grid"!==a.view)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];t.style.transform="",t.style.top="",t.style.position=""}if(r>=0){m=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;if(f&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(n),c=t*a.rows[0].height,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.paging.enabled||(r=0)),a.paging.enabled&&(t=a.paging.pageIndex*a._pageSize)),"card"===a.view&&a._cardHeight&&(e+=a._cardHeight),w)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];delete t.isRendered,t.classList.remove("smart-hidden"),t.classList.remove("aria-rowindex"),t.style.transform="",t.style.top="",t.style.position=""}if(w){let e=Math.max(a._clientSize.height,a._overflowOffset),o=[],l=c;for(let t=r;t<s.length;t++){const i=s[t];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),l+r>=n-p&&l<=n+e||a._autoHeight){for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];if(t.hasAttribute("data-id")&&t.getAttribute("data-id")===""+i.id){o[i.id]=t,t.isRendered=!0;break}}l+=r}}e=Math.max(a._clientSize.height,a._overflowOffset);for(let l=r;l<s.length;l++){const i=s[l];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),c+r>=n-p&&c<=n+e||a._autoHeight){let e;if(e=a._rowElements[m++],!e)break;for(;e&&e.isRendered;)e=a._rowElements[m++];if(!e){console.log("Did not found a row element during the rendering.");continue}e.setAttribute("aria-rowindex",t+l+1);let n=!1;if(i.element=e,i.grid=a,o[i.id]){const a=o[i.id];a.hasAttribute("data-id")&&a.getAttribute("data-id")===""+i.id&&(a===e&&(a.isRendered=!0,n=!0,m=0),n=!0,m=0,i.element=a,e.style.top="999999px",e.setAttribute("data-id",999999),e.setAttribute("aria-rowindex",t+l+1),e=a,a.isRendered=!0)}e.style.top=y+"px",e.style.position="absolute",i.render(n),e.isRendered=!0,c+=r,y+=r}}}else{a.rowDetail.enabled&&(e+=a.offsetHeight);for(let o=r;o<s.length;o++){const l=s[o];if(0===l.height||!l.visible||!1===l.filtered||l.freeze&&l.visible)continue;const i=l.height;if(l.expandHeight&&(e+=a.offsetHeight+l.expandHeight),!(c+i>=n-p&&c<=n+e||a._autoHeight))break;{let e;if(e=a._rowElements[m++],!e)break;if(e.isRendered&&(e.classList.remove("smart-hidden"),e.classList.remove("aria-rowindex"),e.style.transform="",e.style.top="",e.style.position=""),e.setAttribute("aria-rowindex",t+o+1),l.element=e,l.grid=a,f){if(l.index=o+t,l.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=l.canNotify;l.canNotify=!1,l.selected=e.indexOf(l.index)>=0,l.canNotify=t}a.paging.enabled?(l.data=a.dataSource[r+m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l)):(l.data=a.dataSource[m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l))}l.render(),e.isRendered=!0}c+=i,y+=i}}}a._renderFrozenRows();let _=m;if(m<a._rowElements.length&&!w)for(let e=m;e<a._rowElements.length;e++){const e=a._rowElements[m++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}if(w)for(let e=0;e<a._rowElements.length;e++)if(!a._rowElements[e].isRendered){const t=a._rowElements[e];t.classList.add("smart-hidden"),t.removeAttribute("aria-rowindex")}if(a.editing.addNewRow&&a.editing.addNewRow.visible&&"row"!==a.editing.addNewRow.displayMode&&a._rowElements[_]){a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0}));for(let e=a._rowElements.length-1;e>=0;e--)if(!a._rowElements[e].isRendered){a._newRow.element=a._rowElements[e],a._newRow.element.classList.remove("smart-hidden"),a._newRow.element.style.top=y+"px",a._newRow.element.style.position="absolute",a._newRow.render();break}}f&&(a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects())}_renderFrozenRows(){const e=this;let t=!1,o=!1;if("card"===e.view)return e.$.rowNearContainer.classList.add("smart-hidden"),void e.$.rowFarContainer.classList.add("smart-hidden");0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e.filtering.filterRow.visible&&e.$.rowNearContainer.classList.remove("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||"add"===e||"update"===e||"delete"===e||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo||null,sorting:o.getSortedColumnsByDataField(),filtering:o.getFilteredColumnsByDataField(),filterOperator:o.filtering.operator,grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action){if(t&&t(e.result),o._autoHeight&&o.rows.length>=o._rowElements.length-1&&(o._initializeRows(),o._initializeRowElements(),o.refresh(),o.filtering.filterRow)){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}return}if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling){const e=o._viewRows;for(let t=0;t<e.length;t++){const l=e[t];l.data&&!l.addNewRow&&l.data.$&&(o.rowById[l.data.$.id]||(o.rowById[l.data.$.id]=l))}o._recycle(!1,!1)}else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize));const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;if(o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}localizeString(e,t,o="en"){const l=this;o&&l.messages[o][e]&&(l.messages[o][e]=t,l.refresh())}localizeStrings(e,t="en"){const o=this;t&&(Object.assign(o.messages[t],e),o.refresh())}_createInsertNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus insert",t.title=e.localize("contextMenuItemInsertRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",t.style.boxShadow="var(--smart-elevation-1)",t.style.width="16px",t.style.height="16px",t.style.fontSize="12px",t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0;const o=e.editing.addNewRow._insertButton.row;o?e.insertRow(t,1+o.visibleIndex):e._add(t),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._mobile||(e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}removeColumn(e){const t=this;let o=-1;if(e)for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){o=l;break}o>=0&&t.columns.splice(o,1)}addColumn(e,t,o=!0){const l=this;if(e){let a=-1;if(t)for(let e=0;e<l.columns.length;e++)if(l.columns[e].dataField===t){a=e,!1===o&&(a=e+1);break}if("string"==typeof e){const t=l._getKanbanTaskField(e);if(t){if(a>=0)return void l.columns.splice(a,0,t);l.columns.push(t)}return}if(a>=0&&a<l.columns.length)return void l.columns.splice(a,0,e);l.columns.push(e)}}insertColumnAfter(e,t){e&&this.addColumn(e,t,!1)}insertColumnBefore(e,t){e&&this.addColumn(e,t,!0)}addNewColumn(e){e&&this.addColumn(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.classList.add("smart-hidden"),void t.editing.addNewRow._addButton.classList.remove("show");if("grid"===t.view&&t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("smart-hidden"),"float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)&&"card"!==t.view?t.editing.addNewRow._addButton.classList.remove("float"):(!t.computedVerticalScrollBarVisibility&&t.dataSource&&0===t.dataSource.length||t.computedVerticalScrollBarVisibility&&"float"===e||"card"===t.view)&&t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="",t.grouping.enabled&&t.dataSource)&&(!(t.dataSource.groupBy&&t.dataSource.groupBy.length>0)||t.editing.addNewRow._addButton.classList.remove("show"))};t.editing.addNewRow._addButton&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),!t.editing.addNewRow.visible||"row"===t.editing.addNewRow.displayMode&&t.$.placeholder.classList.contains("smart-hidden")||(t.editing.addNewRow._addButton?requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.style.left=!t.appearance.showViewBar||t.appearance.viewBarAppendTo||t.appearance.showViewBarAsDropdown||t._mobile?"":10+t.layout.viewBarWidth+"px",o(),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),t.editing.addNewRow.visible&&!t.computedVerticalScrollBarVisibility&&t._newRow&&t.editing.addNewRow._addButton.classList.remove("show"),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"))})):(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.editing.addNewRow._insertButton=t._createInsertNewRowButton(),t.appendChild(t.editing.addNewRow._addButton),t.appendChild(t.editing.addNewRow._insertButton),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o(),(t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode||!t.computedVerticalScrollBarVisibility&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden"))&&t.editing.addNewRow._addButton.classList.remove("show"))}))))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollRecycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(!0!==o._disableEndEdit&&o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect(),o._copyRects&&o._copyRects.length&&o._refreshCopyRects();const l=o._recyclingRows;let a=l[t],n=a.top,i=!1;for(let r=0;r<o._cellsMerge.length;r++){const s=o._cellsMerge[r],d=l.indexOf(s.row);t>d&&t<=d+s.rowSpan&&(t=d,a=s.row,n=a.top,o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px",i=!0)}i||(o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px")}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if("virtual"===t.scrolling)t._recycle(!1);else{const e=t._scrollView.scrollTop;let o=t._getRowIndexByPosition(e);o!==t._scrollRowIndex?(t._recycle(!1,!0,!0,o),t._scrollRowIndex=o):t._verticalScrollRecycle(e,o)}if(t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&"card"!==t.view&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"row"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"),"grid"===t.view&&"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")}),0))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}setCellFormula(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;e.canNotify=!1,e.formula=o,e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e,t){const o=this;o.isInitialized&&(e&&(o._initializeRows(),o._initializeRowElements()),o._refresh(t),o._refreshSummary())}refreshView(e=!0){const t=this;if(t._recycleFiles=!0,!e)return t._recycle(!1,!0),void delete t._recycleFiles;t._recycle(),delete t._recycleFiles}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t,o=!0){const l=this;l._isUpdating--,l._isUpdating<0&&(l._isUpdating=0),!1!==e?l.refresh():!1!==t&&l.refreshView(o)}_generateUUID(){const e=window.crypto,t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const o=Array.from(t,(e=>e.toString(16).padStart(2,"0"))).join("");return`${o.substring(0,8)}-${o.substring(8,12)}-${o.substring(12,16)}-${o.substring(16,20)}-${o.substring(20)}`}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
64
+ Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewStatesButton" class="smart-data-view-header-button smart-data-view-states-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ViewStates"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="aiButton" class="smart-data-view-header-button smart-data-view-ai-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ai"></div>\n <div id="resourceButton" class="smart-data-view-header-button smart-data-view-resource-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Resource"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="labelButton" class="smart-data-view-header-button smart-data-view-label-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Lael"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="colorsButton" class="smart-data-view-header-button smart-data-view-colors-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Colors"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customButton" class="smart-data-view-header-button smart-data-view-custom-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Custom"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="boldButton" class="smart-data-view-header-button smart-data-view-bold-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Bold"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="italicButton" class="smart-data-view-header-button smart-data-view-italic-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Italic">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="underlineButton" class="smart-data-view-header-button smart-data-view-underline-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Underline">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="strikethroughButton" class="smart-data-view-header-button smart-data-view-strikethrough-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Strikethrough">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontFamilyButton" class="smart-data-view-header-button smart-data-view-fontfamily-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Family">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontSizeButton" class="smart-data-view-header-button smart-data-view-fontsize-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Size">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="backgroundButton" class="smart-data-view-header-button smart-data-view-background-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Background">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="colorButton" class="smart-data-view-header-button smart-data-view-textcolor-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Text Color">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="view" class="smart-hidden" role="presentation"></div>\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="ai" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="colors" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}_refreshMobileViewTools(){const e=this;e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden"),e.parentNode.classList.add("mobile")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden"),e.parentNode.classList.remove("mobile")}))}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e._refreshMobileViewTools(),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;const o=t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.colorsButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled"),e.$.resourceButton.classList[a]("smart-disabled"),e.$.labelButton.classList[a]("smart-disabled")};o(e.dataSource&&0===e.dataSource.length),t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&"infinite"!==t.scrolling&&o(!1),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","colors-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),t.$.headerDropDown.addEventListener("close",(()=>{t._dropDownCloseDate=new Date})),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget);const a=t.grid.parentElement,o=a?a.scrollTop:0;if(t.grid.header.appendTo){const e=document.querySelector(t.grid.header.appendTo);t.$.headerDropDown.style.top=t.grid.offset(e).top+e.offsetHeight-o+"px"}else t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight-o+"px";const s=()=>{if(e){const a=t.grid.offset(e);if(a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px",a.top+t.$.headerDropDown.offsetHeight>=document.documentElement.clientHeight-40){let e=t.grid.offset(t.grid).top-t.$.headerDropDown.offsetHeight;if(t.grid.header.appendTo){const a=document.querySelector(t.grid.header.appendTo);e=t.grid.offset(a).top-t.$.headerDropDown.offsetHeight}e<0&&(e=0),t.$.headerDropDown.style.top=e+"px"}}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",s())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;if(s.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),350)}const n=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");n&&s.ai&&s.ai.key&&(n.$.addAIFilterButton.classList.remove("smart-hidden"),n.$.aiFilterPrompt.classList.add("smart-hidden"),n.$.spinner.classList.add("smart-hidden"),n.$.addAIFilterButton.onclick=()=>{n.$.aiFilterPrompt.placeholder=s.localize("dialogFilterHeader"),n.$.aiFilterPrompt.classList.toggle("smart-hidden"),n.$.spinner.classList.remove("smart-hidden"),n.$.aiFilterPrompt.focus(),n.$.aiFilterPrompt.parentElement.style.display="flex",n.$.aiFilterPrompt.parentElement.style.flexDirection="column",n.$.aiFilterPrompt.onchange=n.$.aiFilterPrompt.oninput=e=>{const t=()=>{let e=0;const t=setInterval((()=>{n.$.spinner.innerHTML=`\rThinking${".".repeat(e%4)} `,e++}),500);try{s.filterBy(n.$.aiFilterPrompt.value,null,(e=>{n.$.spinner.innerHTML="",n.$.spinner.classList.add("smart-hidden"),clearInterval(t);const a=[];for(let t in e){const o=e[t].filterGroup;for(let e=0;e<o.filters.length;e++){const s=o.filters[e];a.push([t,s.condition,s.value])}}n.value=a}))}catch(e){n.$.spinner.innerHTML=s.localize("noResults"),clearInterval(t)}};"Enter"===e.key?(n.aiTimer&&clearTimeout(n.aiTimer),t()):(n.aiTimer&&clearTimeout(n.aiTimer),n.aiTimer=setTimeout((()=>{t()}),800))}})}openColorsPanel(){const e=this,t=e.dataSource;e._refreshColumns("colors"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden");const a=this.columns.map((e=>{const a=Object.assign({},e),o=t.dataFields.find((e=>e.name===a.dataField));return o&&(a.dataType=o.dataType),a}));super.openColorsPanel(a,null,e.grid),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.grid.closeMenu()}openViewPanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;if(!1===e.grid.appearance.showViewBarAsDropdown)return;let t;e.$.headerDropDown.classList.add("view-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel","colors-panel"),e.$.view.classList.remove("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.format&&e.$.format.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._viewPartCreated?t=e.$.view.firstElementChild:(t=document.createElement("div"),t.classList.add("smart-view-panel","smart-grid-view-bar"),e.$.view.appendChild(t),e.$.viewPanel=t,e._viewPartCreated=!0,e._updateViews()),e._openHeaderDropDown(e.$.viewStatesButton)}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=t.columns.map((e=>{const o=Object.assign({},e),s=t._appliedSorting.dataFields.indexOf(o.dataField),n=a.dataFields.find((e=>e.name===o.dataField));return n&&(o.dataType=n.dataType,o.sortIndex=s,-1!==s&&(o.sortDirection=t._appliedSorting.orderBy[s])),o})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=o.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(o),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;s.closeMenu();const n=t.$.headerDropDown.querySelector("smart-sort-panel");if(!n)return;n.grid=s,n.$.maintainSortContainer.classList.remove("smart-hidden"),s.sorting.maintainSort?n.$.maintainSortContainer.firstElementChild.setAttribute("active",""):n.$.maintainSortContainer.firstElementChild.removeAttribute("active"),n._changeApplyButtonText();const i=n.$.inputNotSorted,r=()=>{const e=n.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};n.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,s=0,n=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(s++,n.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===s||o===s&&i.toString()!==n.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,s=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let n;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)n=o.querySelector("smart-column-panel"),n.locale=e.locale,n.messages=e._innerElementMessages.columnPanel,n.set("dataSource",s),n.propertyChangedHandler("dataSource",void 0,s),n.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=s,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],s=o[0],n=o[1];a.grid.columnByDataField[s].filter=n}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document,a.grid.autoSaveState()}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document,e.grid.autoSaveState()}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")?t="customize":e.$.headerDropDown.classList.contains("view-panel")?t="view":e.$.headerDropDown.classList.contains("colors-panel")&&(t="colors"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,s=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&s.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();t.$.ai.contains(a)&&t._applyAI(),s.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)?t.addSort(o.sortByInfo):t.$.colors.contains(a)&&t.addColors(o.value,o.decorator,o.filters),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target,o=t.grid?t.grid.$.header:null;if(t.grid&&t.grid.header.appendTo&&(o=document.querySelector(t.grid.header.appendTo)),!o)return;t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]);const s=e.originalEvent.composedPath();for(let e=0;e<s.length;e++){const t=s[e];if(t&&t.classList&&t.classList.contains("smart-menu-item")){const e=t.closest("smart-menu");if(e&&e.classList.contains("smart-grid-views-menu"))return;if(e&&e.classList.contains("smart-grid-download-menu"))return}}if(t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),a!==t.$.colorButton&&a!==t.$.backgroundButton&&t._closeColorMenu(),a!==t.$.fontSizeButton&&t._closeFontSizeMenu(),a!==t.$.fontFamilyButton&&t._closeFontFamilyMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||a!==o&&o.contains(a))){const s=a.closest("smart-scroll-viewer"),n=a.closest(".smart-drop-down");if((!s||!o.contains(s.ownerElement))&&(!n||n.ownerElement&&!o.contains(n.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;if(t._dropDownCloseDate&&new Date-t._dropDownCloseDate<500)return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,s=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((t=>!(!t||!1===t._visible||("filter"===e||"sort"===e)&&("sort"===e&&!t.sortOrder||"filter"===e&&!t.filter)&&!1===t.visible))),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null,options:e.editor&&e.editor.dataSource?e.editor.dataSource:null}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;s.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;s.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),t.grid.appearance.showViewBarAsDropdown||t._updateViews(),e.header.onInit&&e.header.onInit(t)}_removeFontFamilyMenu(){const e=this;if(e.fontFamilyMenu){const t=e.fontFamilyMenu.querySelector("smart-menu");t&&e.fontFamilyMenu.removeChild(t)}}_removeFontSizeMenu(){const e=this;if(e.fontSizeMenu){const t=e.fontSizeMenu.querySelector("smart-menu");t&&e.fontSizeMenu.removeChild(t)}}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeLabelMenu(){const e=this;if(e.labelMenu){const t=e.labelMenu.querySelector("smart-menu");t&&e.labelMenu.removeChild(t);const a=e.labelMenu.querySelector(".label");a&&e.labelMenu.removeChild(a)}}_removeResourceMenu(){const e=this;if(e.resourceMenu){const t=e.resourceMenu.querySelector("smart-menu");t&&e.resourceMenu.removeChild(t);const a=e.resourceMenu.querySelector(".label");a&&e.resourceMenu.removeChild(a)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t);const a=e.viewsMenu.querySelector(".label");a&&e.viewsMenu.removeChild(a)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o)=>{const s=document.createElement("smart-menu-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt","grid"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("gridView");break;case"kanban":n="smart-icon-kanban-alt","kanban"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("kanbanView");break;case"card":n="smart-icon-card-alt","card"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("cardView");break;case"scheduler":n="smart-icon-scheduler","scheduler"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("schedulerView");break;case"timeline":n="smart-icon-timeline","timeline"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("timelineView")}return s.label='<span class="smart-grid-icon '+n+'"></span>'+e,s.value=a,s};o.appendChild(s(t.localize("viewGrid"),"grid",!0)),o.appendChild(s(t.localize("viewKanban"),"kanban",!0)),o.appendChild(s(t.localize("viewCard"),"card",!0)),o.appendChild(s(t.localize("viewScheduler"),"scheduler",!0)),a.appendChild(o),e.viewsMenu.insertBefore(a,e.viewsMenu.children[e.viewsMenu.children.length-1]),e.viewsMenu.onpointerup=()=>!1,a.onItemClick=a=>{e._setView(a.detail.value),e._closeViewsMenu(),t.autoSaveState(),e._updateViews()}}_createResourceMenuItems(){const e=this,t=e.grid;e._removeResourceMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._dateStackedBySelect===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};let n=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.editor&&a.editor.dataSource&&a.editor.singleSelect&&a.editor.dataSource.length&&("collaborator"===a.template||"tags"===a.template)&&(o.appendChild(s(a.label,a.icon,0,a.dataField)),n=!0)}if(a.appendChild(o),n&&e.resourceMenu.insertBefore(a,e.resourceMenu.children[e.resourceMenu.children.length-1]),e.resourceMenu.onpointerup=()=>!1,!n){const a=document.createElement("div");a.classList.add("label","smart-flex","middle","center","smart-quiet"),a.style.minHeight="60px",a.style.height="100%",a.innerHTML=t.localize("noGrouping"),e.resourceMenu.appendChild(a)}a.onItemClick=a=>{t._dateStackedBySelect===a.detail.item.value?delete t._dateStackedBySelect:t._dateStackedBySelect=a.detail.item.value,t._onSort&&t._onSort(),e._closeResourceMenu(),t.autoSaveState()}}_updateViews(){const e=this,t=e.grid;if(t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.removeAttribute("aria-expanded"),t.stateSettings.enabled&&t.appearance.showViewBar){const a=e=>{(!t.users.length||!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser)&&(delete t.stateSettings.storage[e.valueName],t.stateSettings.current===e.valueName&&(t.stateSettings.current=""),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],e.valueName,t.stateSettings.storage,t.stringify_object),e.remove())},o=a=>{const o=document.createElement("input");if(o.value=a.valueName,t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser))return;const s=()=>{if(o.value){if(t.stateSettings.storage[o.value])return;const s=t.stateSettings.storage[a.valueName];t.stateSettings.current===a.valueName&&(t.stateSettings.current=o.value),delete t.stateSettings.storage[s.name],s.name=o.value,t.stateSettings.storage[s.name]=s,t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],s.name,t.stateSettings.storage,t.stringify_object),delete t.stateSettings.storage[a.valueName],o.remove();const n=o.value;a.valueName=n;let i="smart-icon-grid-alt";switch(s.view){case"grid":i="smart-icon-grid-alt";break;case"kanban":i="smart-icon-kanban-alt";break;case"card":i="smart-icon-card-alt";break;case"scheduler":i="smart-icon-scheduler";break;case"timeline":i="smart-icon-timeline"}n===t.stateSettings.current?(a.selected=!0,a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',e._refreshViewsButton()}};o.onselectstart=e=>{e.stopPropagation()},o.onpointerdown=o.onpointerup=e=>{e.stopPropagation()},o.onkeydown=e=>{e.stopPropagation()},o.onkeyup=e=>{"Escape"===e.key&&(o.onchange=o.onblur=null,o.remove()),"Enter"===e.key&&(o.onchange=o.onblur=null,s()),e.stopPropagation()},o.onchange=()=>{o.onblur=null,o.onkeyup=null,s()},o.onblur=()=>{o.remove()},o.style.width="100%",o.style.height="100%",o.style.position="absolute",o.style.left="0px",o.style.top="0px",o.style.zIndex=99,o.classList.add("smart-input"),o.classList.add("underlined"),o.style.backgroundColor="var(--smart-background)",o.style.color="var(--smart-background-color)",a.querySelector(".smart-list-item-label-element").appendChild(o),setTimeout((()=>{o.focus()}),50)},s=(e,a,o)=>{const s=document.createElement("smart-list-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt";break;case"kanban":n="smart-icon-kanban-alt";break;case"card":n="smart-icon-card-alt";break;case"scheduler":n="smart-icon-scheduler";break;case"timeline":n="smart-icon-timeline"}return s.value=o,s.valueName=e,e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>')),s};t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.setAttribute("aria-expanded",!0);let n=t.$.viewBar;if(t.appearance.showViewBarAsDropdown&&(n=e.$.viewPanel),t.appearance.viewBarAppendTo&&(n=document.querySelector(t.appearance.viewBarAppendTo),n&&n.classList.add("smart-grid-view-bar")),n&&!n.querySelector(".smart-grid-view-chooser-container")){const a=document.createElement("div");a.classList.add("smart-grid-view-chooser-container","smart-container");const o=document.createElement("div");o.classList.add("new-view"),!1===t.editing.enabled&&o.classList.add("smart-hidden");const s=(a,o)=>{a.stopPropagation(),a.preventDefault(),t.beginUpdate();let s=0,i=[];if(t.stateSettings.storage){for(;t.stateSettings.storage[t.localize("view")+" "+s];)s++;for(let e in t.stateSettings.storage){const a=t.stateSettings.storage[e];i[a.view]=1+i[a.view]||1}}let r="";switch(o){case"grid":r=t.localize("viewGrid");break;case"kanban":r=t.localize("viewKanban");break;case"card":r=t.localize("viewCard");break;case"scheduler":r=t.localize("viewScheduler");break;case"timeline":r=t.localize("viewTimeline")}if(i[o]||(i[o]=""),t.stateSettings.storage){let e=i[o]?t.localize("view")+" "+i[o]:t.localize("view");for(;t.stateSettings.storage[r+" "+e];)e=t.localize("view")+" "+i[o],i[o]++}const l=i[o]?t.localize("view")+" "+i[o]:t.localize("view");if(!n){let a=t.$.viewBar;t.appearance.showViewBarAsDropdown&&(a=e.$.viewPanel),t.appearance.viewBarAppendTo&&(a=document.querySelector(t.appearance.viewBarAppendTo),a&&a.classList.add("smart-grid-view-bar")),a&&(n=a)}if(!n)return void t.endUpdate();n._input.value=r+" "+l,t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,e._closeViewsMenu(),t.resetState(!1);const d=t.view;t.set("view","grid",!1),t._kanban&&t._kanban._reset(),delete t.columnByDataField.taskStatus,"grid"===o&&"grid"!==d?e._setView("grid",!0):"kanban"===o?e._setView("kanban"):"card"===o?e._setView("card"):"scheduler"===o?e._setView("scheduler"):"timeline"===o&&e._setView("timeline"),t.saveState(),t.endUpdate(),e._updateViews(),t.$.fireEvent("viewChanged",{view:t.view})},i=document.createElement("smart-button");i.classList.add("selected"),i.classList.add("view"),i.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-grid-alt"></span>'+t.localize("newGrid")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',i.title=t.localize("gridView");const r=document.createElement("smart-button");r.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-kanban-alt"></span>'+t.localize("newKanban")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',r.classList.add("view"),r.title=t.localize("kanbanView");const l=document.createElement("smart-button");l.classList.add("selected"),l.classList.add("view"),l.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-card-alt"></span>'+t.localize("newCard")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',l.title=t.localize("cardView");const d=document.createElement("smart-button");d.classList.add("selected"),d.classList.add("view"),d.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-scheduler"></span>'+t.localize("newScheduler")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',d.title=t.localize("schedulerView");const c=document.createElement("smart-button");c.classList.add("selected"),c.classList.add("view"),c.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-timeline"></span>'+t.localize("newTimeline")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',c.title=t.localize("timelineView");const u=document.createElement("div");u.classList.add("smart-grid-view-storage"),a.appendChild(u);const m=document.createElement("smart-input");m.classList.add("underlined"),m.placeholder=t.localize("viewNamePlaceholder"),m.hint=t.localize("viewNamePlaceholder"),m.onselectstart=e=>{e.stopPropagation()};const p=document.createElement("div");p.innerHTML="<span>"+t.localize("settings")+'</span><span class="smart-grid-icon show smart-icon-sort-down"></span>',p.classList.add("view-label"),o.appendChild(p);const h=document.createElement("div");o.appendChild(h),h.classList.add("footer"),t.users&&t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(h.classList.add("smart-hidden"),p.classList.add("smart-hidden"))),h.appendChild(i),h.appendChild(r),h.appendChild(l),h.appendChild(d),p.onclick=()=>{p.classList.toggle("collapsed"),h.classList.toggle("collapsed")};const g=document.createElement("div");g.innerHTML='<span class="smart-grid-icon show smart-icon-plus"></span><span><a href="javascript:void();">'+t.localize("createView")+"</a></span>",g.classList.add("view-button"),g.onclick=e=>{let t="grid";r.classList.contains("selected")&&(t="kanban"),l.classList.contains("selected")&&(t="card"),d.classList.contains("selected")&&(t="scheduler"),c.classList.contains("selected")&&(t="timeline"),s(e,t,o)},r.onpointerdown=()=>{r.classList.add("selected"),i.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},i.onpointerdown=()=>{i.classList.add("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},l.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.add("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},d.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.add("selected"),c.classList.remove("selected"),g.click()},c.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.add("selected"),g.click()};const v=()=>{t.stateSettings.storage&&!t.stateSettings.storage[m.value]||m.value&&!t.stateSettings.storage?g.classList.remove("disabled"):g.classList.add("disabled")};m.update=()=>v(),m.onkeyup=m.onchange=()=>{v()},v(),a.appendChild(o),n._storage=u,n._input=m,n.appendChild(a)}let i=t.stateSettings.storage;(i&&0===Object.keys(i).length||!i)&&(n._input.value||("kanban"===t.view?n._input.value=t.localize("newKanban")+" "+t.localize("view"):"card"===t.view?n._input.value=t.localize("newCard")+" "+t.localize("view"):"scheduler"===t.view?n._input.value=t.localize("newScheduler")+" "+t.localize("view"):n._input.value=t.localize("newGrid")+" "+t.localize("view")),t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,i=t.stateSettings.storage);const r=n?n._storage:document.createElement("div");if(r.innerHTML="",i){let e=1;const l=document.createDocumentFragment();let d=[],c=[];for(let e in i){const t=i[e];c[t.name]||(c[t.name]=t,d.push({name:e,value:t}))}d.sort(((e,t)=>{const a=new Date(e.value.date),o=new Date(t.value.date);if(e.value&&e.value.date&&t.value&&t.value.date){if(!e.value.date||!t.value.date)return-1;if(a<o)return-1;if(a>o)return 1;if(a===o)return 0}else{if(e.name<t.name)return-1;if(e.name>t.name)return 1;if(e.name===t.name)return 0}}));let u=[],m=-1;for(let t in d){const a=d[t],o=a.name,n=a.value;e++,u[n.view]=u[n.view]++||1;const i=s(o,n.view,n);i.selected&&(m=parseInt(t),delete i.selected),l.appendChild(i)}if(e){const e=document.createElement("smart-list-box");e.style.width="100%",e.style.height="100%",e.allowDrag=!0,e.allowDrop=!0,e.itemHeight=32,e.mode="vertical",e.style.borderColor="transparent",e.classList.add("smart-grid-views-menu"),e.checkable=!0,e.checkboxes=!0,e.filterable=!0,e.filterInputPlaceholder=t.localize("commandBarSearch")+" "+t.localize("view"),e.selectionMode="one",e.disableAutoCheck=!0,e.rightToLeft=t.rightToLeft,e.ondragend=e=>{const t=e.detail.item;if(i[t.valueName]){const t=e.detail.target;if(t){const e=i[t.valueName],a=e?e.date:null;if(a){let t=new Smart.Utilities.DateTime(a);const o="top"===Smart.ListBox.DragDrop.DropDetails.position?-10:10;t=t.addSeconds(o),e.date=t.toDate().toJSON()}}}},e.onkeydown=t=>{const a=e.querySelector("smart-list-item[checked]");a&&"F2"===t.key&&o(a)},e.onDoubleClick=e=>{const t=e.target.closest("smart-list-item");o(t)},e.onClick=e=>{if(e.target&&e.target.classList.contains("smart-icon-delete")){const t=e.target.closest("smart-list-item");a(t),e.preventDefault(),e.stopPropagation()}else if(e.target&&e.target.classList.contains("smart-icon-mode-edit")){const t=e.target.closest("smart-list-item");o(t),e.preventDefault(),e.stopPropagation()}else if("INPUT"===e.target.nodeName)return},e.appendChild(l),r.appendChild(e),e.clearSelection(),e.selectedIndexes=[m],e.onchange=a=>{if(a.detail&&a.detail.selected){const o=a.detail.addedItems[0];t.loadState(o.valueName),e.querySelectorAll("smart-list-item").forEach((e=>{e.querySelector(".smart-icon-delete").classList.add("show")})),o.querySelector(".smart-icon-delete").classList.remove("show"),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],o.valueName,t.stateSettings.storage,t.stringify_object)}}}if(t.stateSettings.storage)for(;t.stateSettings.storage[t.localize("view")+" "+e];)e++;let p="";switch(t.view){case"grid":p=t.localize("viewGrid");break;case"kanban":p=t.localize("viewKanban");break;case"card":p=t.localize("viewCard");break;case"scheduler":p=t.localize("viewScheduler");break;case"timeline":p=t.localize("viewTimeline")}if(t.stateSettings.storage)for(;t.stateSettings.storage[p+" "+t.localize("view")+" "+u[t.view]];)u[t.view]++;n&&n._input&&(n._input.value=p+" "+t.localize("view")+" "+u[t.view],n._input.update())}}}_setView(e,t){const a=this,o=a.grid;if(o.view===e&&!0!==t)return;o.view;const s=o.context;if("kanban"===e)if(o.context=o,o.view="kanban",o.context=s,o._kanbanInitialized&&o.columnByDataField.taskStatus)if(o.columnByDataField.taskStatus&&o._stackedBy&&o.columnByDataField.taskStatus.dataField!==o._stackedBy){o.beginUpdate(),delete o.columnByDataField.taskStatus;const e=o.columnByDataField[o._stackedBy];o.columnByDataField.taskStatus=e,o._createKanban(e),o._refreshHeaderBar(),o.endUpdate(!1),o._hideSchedulerView(),o._showKanbanView(),a._refresh()}else o._hideSchedulerView(),o._showKanbanView(),a._refresh();else delete o._kanbanInitialized,o._initKanbanView("dynamic","grid");else"grid"===e?(o.context=o,o.view="grid",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"card"===e?(o.context=o,o.view="card",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"scheduler"!==e&&"timeline"!==e||(o.context=o,o.view=e,o.context=s,t?(o._hideKanbanView(),o._showSchedulerView(),a._refresh()):(o._createScheduler(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()));o.$.fireEvent("viewChanged",{view:e}),a._refresh()}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const s=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const s='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+s+e,a.value=t,a};o.appendChild(s(t.localize("download")+" CSV","csv")),o.appendChild(s(t.localize("download")+" XLSX","xlsx")),o.appendChild(s(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")?e._closeViewsMenu():e.resourceMenu&&e.resourceMenu.classList.contains("open")?e._closeResourceMenu():e.labelMenu&&e.labelMenu.classList.contains("open")?e._closeLabelMenu():e.colorMenu&&e.colorMenu.classList.contains("open")&&e._closeColorMenu()}_closeResourceMenu(){const e=this,t=e.resourceMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.resourceButton.classList.remove("selected"),e.$.resourceButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openResourceMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.resourceMenu&&e.resourceMenu.classList.contains("open"))return void e._closeResourceMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.resourceButton.classList.add("selected"),e.$.resourceButton.setAttribute("aria-expanded",!0),e.resourceMenu||(e.resourceMenu=document.createElement("div"),e.resourceMenu.classList.add("smart-grid-column-menu","smart-grid-resource-menu"),e.resourceMenu.setAttribute("theme",e.getAttribute("theme")),e.resourceMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.resourceMenu.classList.add("smart-animate"),e._createResourceMenuItems(),e.resourceMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.resourceMenu):document.body.appendChild(e.resourceMenu);const t=e.$.resourceButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.resourceMenu.offsetWidth,a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.resourceMenu.offsetWidth)),e.resourceMenu.style.left=a+"px",e.resourceMenu.style.top=o+"px",e.resourceMenu.classList.remove("smart-hidden"),e.resourceMenu.classList.add("open")}_closeLabelMenu(){const e=this,t=e.labelMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.labelButton.classList.remove("selected"),e.$.labelButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_createLabelMenuItems(){const e=this,t=e.grid;e._removeLabelMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._labeledBy===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};for(let e=0;e<t.columns.length;e++){const a=t.columns[e];"string"!==a.dataType||a.relationField||"input"!==a.editor.template&&"textarea"!==a.editor.template||o.appendChild(s(a.label,a.icon,0,a.dataField))}a.appendChild(o),e.labelMenu.insertBefore(a,e.labelMenu.children[e.labelMenu.children.length-1]),e.labelMenu.onpointerup=()=>!1,a.onItemClick=a=>{t._labeledBy===a.detail.item.value?delete t._labeledBy:t._labeledBy=a.detail.item.value,t._onSort&&t._onSort(),e._closeLabelMenu(),t.autoSaveState()}}_closeColorMenu(){const e=this,t=e.colorMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.colorButton.classList.remove("selected"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.classList.remove("selected"),e.$.backgroundButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_closeFontSizeMenu(){const e=this,t=e.fontSizeMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontSizeButton.classList.remove("selected"),e.$.fontSizeButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontSizeMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontSizeMenu&&e.fontSizeMenu.classList.contains("open"))return void e._closeFontSizeMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontSizeButton.classList.add("selected"),e.$.fontSizeButton.setAttribute("aria-expanded",!0),e.fontSizeMenu||(e.fontSizeMenu=document.createElement("div"),e.fontSizeMenu.classList.add("smart-grid-column-menu","smart-grid-fontsize-menu"),e.fontSizeMenu.setAttribute("theme",e.getAttribute("theme")),e.fontSizeMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontSizeMenu.classList.add("smart-animate");const t=e.grid;e._removeFontSizeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","8px","10px","12px","14px","18px","24px"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontSizeMenu.appendChild(a),a.onItemClick=t=>{const a=t.detail.value;e._setStyle("fontSize",a)},e.fontSizeMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontSizeMenu):document.body.appendChild(e.fontSizeMenu);const n=e.$.fontSizeButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontSizeMenu.offsetWidth,i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontSizeButton.offsetWidth)),e.fontSizeMenu.style.width="60px",e.fontSizeMenu.style.left=i+"px",e.fontSizeMenu.style.top=r+"px",e.fontSizeMenu.classList.remove("smart-hidden"),e.fontSizeMenu.classList.add("open")}_closeFontFamilyMenu(){const e=this,t=e.fontFamilyMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontFamilyButton.classList.remove("selected"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontFamilyMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontFamilyMenu&&e.fontFamilyMenu.classList.contains("open"))return void e._closeFontFamilyMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontFamilyButton.classList.add("selected"),e.$.fontFamilyButton.setAttribute("aria-expanded",!0),e.fontFamilyMenu||(e.fontFamilyMenu=document.createElement("div"),e.fontFamilyMenu.classList.add("smart-grid-column-menu","smart-grid-fontfamily-menu"),e.fontFamilyMenu.setAttribute("theme",e.getAttribute("theme")),e.fontFamilyMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontFamilyMenu.classList.add("smart-animate");const t=e.grid;e._removeFontFamilyMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","Roboto","Segoe UI","Arial","Georgia","Tahoma","Times New Roman","Courier New","Verdana"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontFamilyMenu.appendChild(a),a.onItemClick=t=>{e._setStyle("fontFamily",t.detail.value)},e.fontFamilyMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontFamilyMenu):document.body.appendChild(e.fontFamilyMenu);const n=e.$.fontFamilyButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontFamilyMenu.offsetWidth,i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontFamilyButton.offsetWidth)),e.fontFamilyMenu.style.width="140px",e.fontFamilyMenu.style.left=i+"px",e.fontFamilyMenu.style.top=r+"px",e.fontFamilyMenu.classList.remove("smart-hidden"),e.fontFamilyMenu.classList.add("open")}_openColorMenu(e,t){const a=this;if(a.grid.editing.isEditing&&a.grid.cancelEdit(),a.colorMenu&&a.colorMenu.classList.contains("open")){if(a.colorMenu.classList.remove("open"),a.colorMenu.isBackground&&t)return void a._closeColorMenu();if(!a.colorMenu.isBackground&&!t)return void a._closeColorMenu()}a.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),a.$.group.classList.add("smart-hidden"),a.$.filter.classList.add("smart-hidden"),a.$.colors.classList.add("smart-hidden"),a.$.customize.classList.add("smart-hidden"),a.$.sort.classList.add("smart-hidden"),a.$.search.classList.add("smart-hidden"),a.$.format.classList.add("smart-hidden"),a.$.view.classList.add("smart-hidden"),a.$.ai.classList.add("smart-hidden"),a.closePanel(),a.$.colorButton.classList.remove("selected"),a.$.colorButton.removeAttribute("aria-expanded"),a.$.backgroundButton.classList.remove("selected"),a.$.backgroundButton.removeAttribute("aria-expanded"),t?(a.$.backgroundButton.classList.add("selected"),a.$.backgroundButton.setAttribute("aria-expanded",!0)):(a.$.colorButton.classList.add("selected"),a.$.colorButton.setAttribute("aria-expanded",!0)),a.colorMenu||(a.colorMenu=document.createElement("div"),a.colorMenu.className="smart-grid-column-menu smart-grid-color-menu smart-color-input-drop-down-menu smart-color-panel smart-input-drop-down-menu underlined-drop-down-menu smart-grid-color-input-drop-down-menu smart-drop-down-box-drop-down-menu smart-color-picker-drop-down-menu smart-grid-color-input",a.colorMenu.setAttribute("theme",a.getAttribute("theme")),a.colorMenu.id=a.id+"_"+a.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),a.colorMenu.innerHTML=a._getColors()),a.colorMenu.classList.add("smart-animate"),a.colorMenu.isBackground=t,a.colorMenu.style.height="auto",a.isInShadowDOM?a.getRootNode().appendChild(a.colorMenu):document.body.appendChild(a.colorMenu);const o=t?a.$.backgroundButton.getBoundingClientRect():a.$.colorButton.getBoundingClientRect();let s=o.left+window.pageXOffset,n=o.bottom+window.pageYOffset;s+a.colorMenu.offsetWidth>window.innerWidth&&(s=o.right+window.pageXOffset-a.colorMenu.offsetWidth,s+a.colorMenu.offsetWidth>window.innerWidth&&(s=window.innerWidth-a.colorMenu.offsetWidth)),a.colorMenu.style.left=s+"px",a.colorMenu.style.top=n+"px",a.colorMenu.classList.remove("smart-hidden"),a.colorMenu.classList.add("open"),a.colorMenu.querySelectorAll(".color-sample").forEach((t=>{t.classList.remove("selected"),t.getAttribute("value")===e&&t.classList.add("selected")})),a.colorMenu.onpointerup=e=>{const o=e.target.getAttribute("value");void 0!==o&&(a._closeColorMenu(),t?(a.$.backgroundButton.style.setProperty("--smart-surface-color",o),a._setStyle("background",o)):(a.$.colorButton.style.setProperty("--smart-surface-color",o),a._setStyle("color",o)))}}_openLabelMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.labelMenu&&e.labelMenu.classList.contains("open"))return void e._closeLabelMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.labelButton.classList.add("selected"),e.$.labelButton.setAttribute("aria-expanded",!0),e.labelMenu||(e.labelMenu=document.createElement("div"),e.labelMenu.classList.add("smart-grid-column-menu","smart-grid-label-menu"),e.labelMenu.setAttribute("theme",e.getAttribute("theme")),e.labelMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.labelMenu.classList.add("smart-animate"),e._createLabelMenuItems(),e.labelMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.labelMenu):document.body.appendChild(e.labelMenu);const t=e.$.labelButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.labelMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.labelMenu.offsetWidth,a+e.labelMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.labelMenu.offsetWidth)),e.labelMenu.style.left=a+"px",e.labelMenu.style.top=o+"px",e.labelMenu.classList.remove("smart-hidden"),e.labelMenu.classList.add("open")}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu","smart-grid-view-chooser"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_setStyle(e,t){const a=this.grid;if(!a._selection)return;const o=a._selection.cells;if(o&&Object.keys(o).length>0){const o=a.getSelectedCells(!1),s={};for(let n=0;n<o.length;n++){const i=o[n],r=i[0],l=i[1],d=a.rowById[r],c=d.style?JSON.parse(JSON.stringify(d.style)):{};s[r]||(s[r]={});for(let e in c){for(let e=0;e<a.columns.length;e++){const t=a.columns[e].dataField;c[t]&&(s[r][t]=c[t])}c[e]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].indexOf(e)>=0&&(s[r][e]=c[e])}const u=s[r];if(d){const a=d.getCell(l);if(a){const o=a.canNotify;a.canNotify=!1,"textDecoration"===e?(a[e]||(a[e]=""),a[e].indexOf(t)>=0?a[e]=a[e].replace(t,"").trim():a[e]+=" "+t):a[e]===t?a[e]="":a[e]=t,a.canNotify=o;const s=u[a.column.dataField]={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[e]&&(s[e]=a[e])}))}const o=d.canNotify;if(0===Object.keys(u).length){delete s[r];continue}d.canNotify=!1,d.style=u,d.canNotify=o}}if(a.onRowStyle){const e=[],t=[],o=[];Object.keys(s).forEach(((n,i)=>{const r=s[n];e.push(i),t.push(a.rowById[n]),o.push(r)})),a.onRowStyle(e,t,o)}a._recycle(!1,!0)}else{const o=a.getSelectedRowIds(),s=[],n=[],i=[];for(let r=0;r<o.length;r++){const l=o[r],d=a.rowById[l],c=d.style?JSON.parse(JSON.stringify(d.style)):{};if("textDecoration"===e?(c[e]||(c[e]=""),c[e].indexOf(t)>=0?c[e]=c[e].replace(t,"").trim():c[e]+=" "+t):c[e]===t?c[e]="":c[e]=t,a.setRowStyle(l,c),a.onRowStyle){s.push(d.index),n.push(d);const e={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((t=>{c[t]&&(e[t]=c[t])})),i.push(e)}}a.onRowStyle&&a.onRowStyle(s,n,i)}}_updateTools(){const e=this,t=e.grid;if(!t._selection)return;const a=t._selection.cells;if(a&&Object.keys(a).length>0){const a=t.getSelectedCells(!1);for(let o=0;o<a.length;o++){const s=a[o],n=s[0],i=s[1],r=t.rowById[n];if(r){const t=r.getCell(i);if(t){e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),e.$.backgroundButton.style.setProperty("--smart-surface-color","inherit"),e.$.colorButton.style.setProperty("--smart-surface-color","inherit"),e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),t.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),t.background&&e.$.backgroundButton.style.setProperty("--smart-surface-color",t.background),t.color&&e.$.colorButton.style.setProperty("--smart-surface-color",t.color),t.fontStyle&&e.$.italicButton.setAttribute("aria-expanded","true"),t.textDecoration&&(t.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),t.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true")),t.fontSize&&e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontSize&&e.setAttribute("focus","")})),t.fontFamily&&e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontFamily&&e.setAttribute("focus","")}));break}}}}else{const a=t.getSelectedRowIds();for(let o=0;o<a.length;o++){const s=a[o],n=t.rowById[s],i=n.style?JSON.parse(JSON.stringify(n.style)):{};e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),i.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),i.background&&(e.$.backgroundButton.style.color=i.background),i.color&&(e.$.colorButton.style.color=i.color),i.fontStyle&&e.$.fontFamilyButton.setAttribute("aria-expanded","true"),i.textDecoration&&(i.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),i.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true"));break}}}_getColors(){return'<div class="default-samples-container grid-mode-container smart-container" role="presentation" style="">\n <div class="grid-samples-container" role="menu">\n <div id="colorInputca5bItem858b" data-label="#D50000" value="#D50000" role="menuitem" aria-label="#D50000" class="color-sample" style="background-color: rgb(213, 0, 0);"></div>\n <div id="colorInputca5bItem963b" data-label="#E67C73" value="#E67C73" role="menuitem" aria-label="#E67C73" class="color-sample" style="background-color: rgb(230, 124, 115);"></div><div id="colorInputca5bItem2f1f" data-label="#F4511E" value="#F4511E" role="menuitem" aria-label="#F4511E" class="color-sample" style="background-color: rgb(244, 81, 30);"></div><div id="colorInputca5bItem1a87" data-label="#F6BF26" value="#F6BF26" role="menuitem" aria-label="#F6BF26" class="color-sample" style="background-color: rgb(246, 191, 38);"></div><div id="colorInputca5bItem4c44" data-label="#0B8043" value="#0B8043" role="menuitem" aria-label="#0B8043" class="color-sample" style="background-color: rgb(11, 128, 67);"></div><div id="colorInputca5bItem8669" data-label="#33B679" value="#33B679" role="menuitem" aria-label="#33B679" class="color-sample" style="background-color: rgb(51, 182, 121);"></div><div id="colorInputca5bItem488c" data-label="#3F51B5" value="#3F51B5" role="menuitem" aria-label="#3F51B5" class="color-sample" style="background-color: rgb(63, 81, 181);"></div><div id="colorInputca5bItemc3aa" data-label="#039BE5" value="#039BE5" role="menuitem" aria-label="#039BE5" class="color-sample" style="background-color: rgb(3, 155, 229);"></div><div id="colorInputca5bItem4277" data-label="#7986CB" value="#7986CB" role="menuitem" aria-label="#7986CB" class="color-sample" style="background-color: rgb(121, 134, 203);"></div><div id="colorInputca5bItem3b61" data-label="#8C47FF" value="#8C47FF" role="menuitem" aria-label="#8C47FF" class="color-sample" style="background-color: rgb(140, 71, 255);"></div><div id="colorInputca5bItema4a6" data-label="#8E24AA" value="#8E24AA" role="menuitem" aria-label="#8E24AA" class="color-sample" style="background-color: rgb(142, 36, 170);"></div><div id="colorInputca5bItemdd64" data-label="#FF36C2" value="#FF36C2" role="menuitem" aria-label="#FF36C2" class="color-sample" style="background-color: rgb(255, 54, 194);"></div><div id="colorInputca5bItem07d0" data-label="#616161" value="#616161" role="menuitem" aria-label="#616161" class="color-sample" style="background-color: rgb(97, 97, 97);"></div><div id="colorInputca5bItemb2a4" data-label="#454545" value="#454545" role="menuitem" aria-label="#454545" class="color-sample" style="background-color: rgb(69, 69, 69);"></div><div id="colorInputca5bItem8de8" data-label="#949494" value="#949494" role="menuitem" aria-label="#949494" class="color-sample" style="background-color: rgb(148, 148, 148);"></div><div id="colorInputca5bItem75ce" data-label="#000000" value="#000000" role="menuitem" aria-label="#000000" class="color-sample" style="background-color: rgb(0, 0, 0);"></div></div><div class="grid-samples-container" role="menu"><div id="colorInputca5bItem932f" data-label="#FF9EB7" value="#FF9EB7" role="menuitem" aria-label="#FF9EB7" class="color-sample" style="background-color: rgb(255, 158, 183);"></div><div id="colorInputca5bItemc244" data-label="#FFCFC9" value="#FFCFC9" role="menuitem" aria-label="#FFCFC9" class="color-sample" style="background-color: rgb(255, 207, 201);"></div><div id="colorInputca5bItemcfb1" data-label="#FFD66D" value="#FFD66D" role="menuitem" aria-label="#FFD66D" class="color-sample" style="background-color: rgb(255, 214, 109);"></div><div id="colorInputca5bItem2827" data-label="#FFEBB6" value="#FFEBB6" role="menuitem" aria-label="#FFEBB6" class="color-sample" style="background-color: rgb(255, 235, 182);"></div><div id="colorInputca5bItem766c" data-label="#93DF89" value="#93DF89" role="menuitem" aria-label="#93DF89" class="color-sample" style="background-color: rgb(147, 223, 137);"></div><div id="colorInputca5bItem10b3" data-label="#D1F7C4" value="#D1F7C4" role="menuitem" aria-label="#D1F7C4" class="color-sample" style="background-color: rgb(209, 247, 196);"></div><div id="colorInputca5bItemb8a4" data-label="#9DC7FF" value="#9DC7FF" role="menuitem" aria-label="#9DC7FF" class="color-sample" style="background-color: rgb(157, 199, 255);"></div><div id="colorInputca5bItem78ff" data-label="#D0F0FD" value="#D0F0FD" role="menuitem" aria-label="#D0F0FD" class="color-sample" style="background-color: rgb(208, 240, 253);"></div><div id="colorInputca5bItem71b8" data-label="#CDAFFF" value="#CDAFFF" role="menuitem" aria-label="#CDAFFF" class="color-sample" style="background-color: rgb(205, 175, 255);"></div><div id="colorInputca5bIteme4d6" data-label="#ECE1FD" value="#ECE1FD" role="menuitem" aria-label="#ECE1FD" class="color-sample" style="background-color: rgb(236, 225, 253);"></div><div id="colorInputca5bItem3576" data-label="#FA9DE2" value="#FA9DE2" role="menuitem" aria-label="#FA9DE2" class="color-sample" style="background-color: rgb(250, 157, 226);"></div><div id="colorInputca5bItem8136" data-label="#FFDAF6" value="#FFDAF6" role="menuitem" aria-label="#FFDAF6" class="color-sample" style="background-color: rgb(255, 218, 246);"></div><div id="colorInputca5bItem26e5" data-label="#CBCBCB" value="#CBCBCB" role="menuitem" aria-label="#CBCBCB" class="color-sample" style="background-color: rgb(203, 203, 203);"></div><div id="colorInputca5bItemdc8a" data-label="#EDEDED" value="#EDEDED" role="menuitem" aria-label="#EDEDED" class="color-sample" style="background-color: rgb(237, 237, 237);"></div><div id="colorInputca5bItemd895" data-label="#FFFFFF" value="#FFFFFF" role="menuitem" aria-label="#FFFFFF" class="color-sample" style="background-color: rgb(255, 255, 255); border-color: var(--smart-border); border-style: solid; border-width: 1px;"></div><div id="colorInputca5bItem7231" data-label="" value="" role="menuitem" aria-label="" class="color-sample no-color"></div></div>\n </div>'}_boldCommand(){this._setStyle("fontWeight","bold"),this._updateTools()}_italicCommand(){this._setStyle("fontStyle","italic"),this._updateTools()}_underlineCommand(){this._setStyle("textDecoration","underline"),this._updateTools()}_strikethroughCommand(){this._setStyle("textDecoration","line-through"),this._updateTools()}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("colors")>=0?e.$.colorsButton.classList.remove("smart-hidden"):e.$.colorsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0&&t.editing.enabled?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("states")>=0&&t.stateSettings.enabled&&!t.appearance.viewBarAppendTo?e.$.viewStatesButton.classList.remove("smart-hidden"):e.$.viewStatesButton.classList.add("smart-hidden"),t.header.buttons.indexOf("formatting")>=0&&"grid"===t.view?(e.$.boldButton.classList.remove("smart-hidden"),e.$.italicButton.classList.remove("smart-hidden"),e.$.underlineButton.classList.remove("smart-hidden"),e.$.strikethroughButton.classList.remove("smart-hidden"),e.$.colorButton.classList.remove("smart-hidden"),e.$.backgroundButton.classList.remove("smart-hidden"),e.$.fontSizeButton.classList.remove("smart-hidden"),e.$.fontFamilyButton.classList.remove("smart-hidden"),e.$.boldButton.title=t.localize("bold")+" (Ctrl + B)",e.$.italicButton.title=t.localize("italic")+" (Ctrl + I)",e.$.underlineButton.title=t.localize("underline")+" (Ctrl + U)",e.$.strikethroughButton.title=t.localize("strikethrough")+" (Ctrl + Y)",e.$.colorButton.title=t.localize("color"),e.$.backgroundButton.title=t.localize("background"),e.$.fontSizeButton.title=t.localize("fontSize").replace(":",""),e.$.fontFamilyButton.title=t.localize("fontFamily").replace(":",""),e.$.boldButton.onpointerup=()=>{e._boldCommand()},e.$.italicButton.onpointerup=()=>{e._italicCommand()},e.$.underlineButton.onpointerup=()=>{e._underlineCommand()},e.$.strikethroughButton.onpointerup=()=>{e._strikethroughCommand()},e.$.colorButton.onpointerup=()=>{const t=e.$.colorButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t)},e.$.backgroundButton.onpointerup=()=>{const t=e.$.backgroundButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t,!0)},e.$.fontSizeButton.onpointerup=()=>{e._openFontSizeMenu(),e._updateTools()},e.$.fontFamilyButton.onpointerup=()=>{e._openFontFamilyMenu(),e._updateTools()}):(e.$.boldButton.classList.add("smart-hidden"),e.$.italicButton.classList.add("smart-hidden"),e.$.underlineButton.classList.add("smart-hidden"),e.$.strikethroughButton.classList.add("smart-hidden"),e.$.colorButton.classList.add("smart-hidden"),e.$.backgroundButton.classList.add("smart-hidden"),e.$.fontSizeButton.classList.add("smart-hidden"),e.$.fontFamilyButton.classList.add("smart-hidden")),t.users&&t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser)&&(t.stateSettings.storage&&Object.keys(t.stateSettings.storage).length,t.stateSettings.enabled),"scheduler"===t.view||"timeline"===t.view?(e.$.resourceButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.resourceButton.classList.remove("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.labelButton.classList.remove("smart-hidden")):(e.$.labelButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden")),e.$.labelButton.onpointerup=a=>{t.closeMenu(),e._openLabelMenu(),a.stopPropagation()},e.$.resourceButton.onpointerup=a=>{t.closeMenu(),e._openResourceMenu(),a.stopPropagation()},e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},!1===t.appearance.showViewBarAsDropdown&&(e.$.viewStatesButton.onpointerup=a=>{t.closeMenu(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.appearance.showViewBar=!t.appearance.showViewBar,a.stopPropagation(),e._updateViews()}),t._sortedColumns){const a=[],o=[],s=[];for(let e=0;e<t._sortedColumns.length;e++){const n=t._sortedColumns[e];a.push(n.dataField),o.push(n.sortOrder),s.push(n.dataType)}e._appliedSorting={dataFields:a,dataTypes:s,orderBy:o},e._refreshSortButton()}if("scheduler"!==t.view&&"timeline"!==t.view&&"kanban"!==t.view||e.$.sortButton.classList.add("smart-hidden"),"grid"===t.view||"card"===t.view||"scheduler"===t.view||"timeline"===t.view||"kanban"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumnsByDataField();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const s=t.filters[o];a.filters.push([e,s.condition,s.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshCustomButton(),e._refreshAIButton(),e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshResourceButton(),e._refreshLabelButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e._refreshColorsButton(),e.refreshTools(),Smart.Utilities.Core.isMobile,!1===t.editing.enabled&&(e.$.customButton.classList.add("smart-hidden"),e.$.downloadButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.$.viewsButton.classList.add("smart-hidden"))}_refreshCustomButton(){const e=this,t=e.grid;t.header.customButton.visible?(e.$.customButton.style.paddingLeft="0px",e.$.customButton.classList.remove("smart-hidden")):e.$.customButton.classList.add("smart-hidden"),t.header.customButton.enabled?e.$.customButton.classList.remove("smart-disabled"):e.$.customButton.classList.add("smart-disabled"),e.$.customButton.innerHTML=`<span class="smart-grid-icon show ${t.header.customButton.icon}"></span><div class="smart-tool-label" role="presentation">${t.header.customButton.label}</div>`,e.$.customButton.onclick=()=>{t.header.customButton.command&&t.header.customButton.command()};for(let a=0;a<t.header.buttons.length;a++){const o=t.header.buttons[a];if("object"==typeof o){const t=e.$.customButton.cloneNode(!0);t.classList.remove("smart-hidden"),t.style.paddingLeft="0px",e.$.customButton.parentNode.insertBefore(t,e.$.customButton),o.label&&(t.querySelector(".smart-tool-label").innerHTML=o.label),o.icon&&(t.querySelector(".smart-grid-icon").className="smart-grid-icon show "+o.icon),t.onclick=()=>{o.command&&o.command()}}}}_refreshViewsButton(){const e=this;if(!e.grid)return;let t=e.grid.localize("viewGrid");switch(e.$.viewsButton.classList.remove("kanban"),e.$.viewsButton.classList.remove("card"),e.$.viewsButton.classList.remove("scheduler"),e.$.viewsButton.classList.remove("timeline"),e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":t=e.grid.localize("viewGrid");break;case"card":e.$.viewsButton.classList.add("card"),t=e.grid.localize("viewCard");break;case"scheduler":e.$.viewsButton.classList.add("scheduler"),t=e.grid.localize("viewScheduler");break;case"timeline":e.$.viewsButton.classList.add("timeline"),t=e.grid.localize("viewTimeline")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>";let a=this.grid.stateSettings.current||"";if(a.length>30)a=a.substring(0,30)+"...";else if(!a){let e=[],t=this.grid.view,o="";switch(t){case"grid":o=this.grid.localize("viewGrid");break;case"kanban":o=this.grid.localize("viewKanban");break;case"card":o=this.grid.localize("viewCard");break;case"scheduler":o=this.grid.localize("viewScheduler");break;case"timeline":o=this.grid.localize("viewTimeline")}if(this.grid&&this.grid.stateSettings.storage)for(;this.grid.stateSettings.storage[o+" "+this.grid.localize("view")+" "+e[t]];)e[t]++;void 0===e[t]&&(e[t]=""),a=o+" "+this.grid.localize("view")+" "+e[t]}const o=""!==a?a:this.grid.localize("views");e.$.viewStatesButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o+"</div>"}_refreshDownloadButton(){const e=this;e.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation"></div>',e.$.downloadButton.title=e.grid.localize("download")}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.$.headerBar.$.deleteButton,o=a.closest("smart-grid");(!o||o._currentUser&&(!o._currentUser||o._currentUser.info&&"guest"!==o._currentUser.info))&&0!==t?(!0===e.editing.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.$.headerBar._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const o=t.grid;if("kanban"===o.view||"scheduler"===o.view||"timeline"===o.view)return;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.colors.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._refreshColumns("group"),o.closeMenu();const s=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(s.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=s,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=s,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,s=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const n=o.onRowInserted;if(o.onRowInserted=null,o.beginUpdate(),o.grouping.autoHideGroupColumn&&s)for(let e=0;e<s.length;e++){const t=o.columnByDataField[s[e]];t&&(t.visible=!0)}o.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];o.addGroup(t)}t._appliedGrouping.expandAll&&o.expandAllRows(),t._appliedGrouping.collapseAll&&o.collapseAllRows(),o.endUpdate(),o.autoSaveState();const i=[];for(let e=0;e<o.dataSource.groupBy.length;e++)i.push(o.dataSource.groupBy[e]);o.$.fireEvent("group",{groups:i}),o.paging.enabled&&o._refreshPagesCount(),o.onRowInserted=n}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshLabelButton(){const e=this;if(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel")+"</div>",e.$.labelButton.classList.remove("grouped"),e.grid&&e.grid._labeledBy){const t=e.grid.columnByDataField[e.grid._labeledBy];t&&(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:t.label})+"</div>",e.$.labelButton.classList.add("grouped"))}else if(e.grid)for(let t=0;t<e.columns.length;t++){const a=e.columns[t];if("string"===a.dataType){e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:a.label})+"</div>",e.$.labelButton.classList.add("grouped");break}}}_refreshResourceButton(){const e=this;if(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("firstByGroup")+"</div>",e.$.resourceButton.classList.remove("grouped"),e.grid&&e.grid._dateStackedBySelect){const t=e.grid.columnByDataField[e.grid._dateStackedBySelect];t&&(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("groupedBy",{column:t.label})+"</div>",e.$.resourceButton.classList.add("grouped"))}}_refreshAIButton(){const e=this;e.$.aiButton.classList.add("smart-hidden"),-1!==e.grid.header.buttons.indexOf("ai")&&(e.$.aiButton.classList.remove("smart-hidden"),e.$.aiButton.style.paddingLeft="0px",e.$.aiButton.innerHTML='<div class="smart-tool-label" role="presentation" style="padding: 5px;">'+e.grid.localize("addAIFilter")+"</div>")}_applyAI(){const e=this,t=e.grid;e.closePanel();const a=e.$.ai.firstElementChild,o=a.getAIInstructions();if(t.beginUpdate(),o&&o.sort&&o.sort.length>0){t.clearSort();const e=o.sort;for(let a=0;a<e.length;a++){const o=e[a],s=o.field,n=o.order;t.sortBy(s,n)}}if(o&&o.filters&&o.filters.length>0&&t._applyJSONFilters(o.filters),o&&o.group&&o.group.length>0){t.clearGroups();let e=o.group.map((e=>e.field));e.length&&e[0]&&t.addGroup(e)}const s=a.$.aiPrompt.value,n=s.indexOf("column")>=0||s.indexOf("cells")>=0;if(t.ai.includeUserPrompts&&(t.ai.userPrompts||(t.ai.userPrompts=[]),t.ai.userPrompts.push(s)),o&&o.format&&o.format.length>0){const e=o.format;let a={};for(let o=0;o<e.length;o++){const s=e[o],i=s.field;if(i&&n)a[i]||(a[i]=[]),a[i].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration});else for(let e=0;e<t.columns.length;e++){const o=t.columns[e];a[o.dataField]||(a[o.dataField]=[]),a[o.dataField].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration})}}for(let e=0;e<t.columns.length;e++)t.columns[e].cellsCSSInlineRules=null;for(let e in a){const o=t.columnByDataField[e];o&&(o.cellsCSSInlineRules=a[e])}}if(o&&o.edit&&o.edit.length>0){const e=o.edit;for(let a=0;a<e.length;a++){const o=e[a],s=o.row,n=o.value,i=o.field;s>=0&&(t.setCellValue(s,i,n),t.flashCell(s,i))}}t.endUpdate()}openAIPanel(){const e=this,t=e.grid;let a;if(e.$.headerDropDown.classList.add("ai-panel"),e.$.headerDropDown.classList.remove("view-panel","search-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.remove("smart-hidden"),e._aiPartCreated)a=e.$.ai.firstElementChild,a.set("locale",e.locale),a.messages=e._innerElementMessages.multiColumnFilterPanel,a.editorPlaceholder=e.localize("aiPrompt"),a.$.applyButton.classList.add("smart-disabled"),a.$.aiResponse.innerHTML=`${t.localize("noAIResponse")}`,a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[0].classList.add("active"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[1].classList.remove("active"),a.$.aiPrompt.value="",a.$.spinner.innerHTML="",a.$.spinner.classList.add("smart-hidden"),a._applyValue(),a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-grid-ai-panel"),a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.locale=e.locale,a.messages=e._innerElementMessages.multiColumnFilterPanel,a.operator=e._appliedFiltering.operator,a.editorPlaceholder=e.localize("aiPrompt"),a.theme=e.theme,a.value=e._appliedFiltering.filters,e.$.ai.appendChild(a),e._aiPartCreated=!0,a.$.addFilterButton.innerHTML="↑ "+t.localize("send"),a.$.addFilterButton.classList.add("smart-ai-button-send"),a.$.addFilterButton.style.background="var(--smart-ui-state-selected)",a.$.addFilterButton.style.borderRadius="15px",a.$.addFilterButton.style.color="var(--smart-primary)",a.$.addFilterButton.style.padding="6px 14px";const o=a.querySelector(".smart-grid-panel-apply-button");a.$.applyButton=o,o.classList.add("smart-disabled"),a.$.itemsContainer.innerHTML=`<style>\n .smart-ai-tabs {\n display: flex;\n align-items: baseline;\n border-bottom: 1px solid var(--smart-border-color);\n font-family: var(--smart-font-family);\n }\n\n .smart-ai-tab {\n padding: 4px 6px;\n cursor: pointer;\n display: flex;\n color: var(--smart-background-color);\n transition: color 0.2s, border-color 0.2s;\n border-bottom: 2px solid transparent;\n }\n\n .smart-ai-tab:hover {\n color: var(--smart-ui-state-color-hover);\n }\n\n .smart-ai-tab.active {\n color: var(--smart-primary);\n border-bottom-color: var(--smart-primary);\n font-weight: 600;\n }\n\n .smart-ai-response {\n min-height: 80px;\n padding: 10px;\n margin-top: 10px;\n width: 360px;\n user-select: text;\n border-radius: var(--smart-border-radius);\n border: 1px solid var(--smart-border);\n }\n\n </style><div class="smart-ai-tabs">\n <div class="smart-ai-tab active" data-tab="add-filter">\n ${t.localize("addAIFilter")}\n </div>\n <div class="smart-ai-tab" data-tab="response">\n <span class="smart-grid-icon show smart-icon-comment"></span> ${t.localize("aiResponse")}\n </div>\n </div>\n <div class="smart-hidden smart-ai-response">\n ${t.localize("noAIResponse")}\n </div>\n `,a.$.itemsContainer.style.paddingTop="0px",a.$.aiResponse=a.$.itemsContainer.querySelector(".smart-ai-response"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>{e.addEventListener("click",(()=>{a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>e.classList.remove("active"))),e.classList.add("active"),"add-filter"===e.getAttribute("data-tab")?(a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden")):(a.$.addFilterButton.classList.add("smart-hidden"),a.$.aiPrompt.classList.add("smart-hidden"),a.$.aiResponse.classList.remove("smart-hidden"))}))}))}e._openHeaderDropDown(e.$.aiButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu();const o=e.$.headerDropDown.querySelector("smart-grid-ai-panel");if(o){o.$.addAIFilterButton.classList.remove("smart-hidden"),o.$.aiPrompt.classList.add("smart-hidden"),o.$.aiPrompt.placeholder=t.localize("aiPrompt"),o.$.aiPrompt.classList.toggle("smart-hidden"),o.$.spinner.classList.remove("smart-hidden"),o.$.aiPrompt.focus(),o.$.aiPrompt.maxRows=5,o.$.aiPrompt.style.minHeight="80px",o.$.aiPrompt.style.resize="none",o.$.aiPrompt.parentElement.style.display="flex",o.$.aiPrompt.parentElement.style.flexDirection="column",t.ai&&!t.ai.key&&o.$.aiPrompt.classList.add("smart-disabled");const a=t.ai.prompts||[];if(t.ai.includeUserPrompts&&t.ai.userPrompts)for(let e=0;e<t.ai.userPrompts.length;e++){const o=t.ai.userPrompts[e];-1===a.indexOf(o)&&a.unshift(o)}const s=o.$.aiPrompt,n=o.$.suggestions;s.onpointerdown=()=>{e._dropDownCloseDate=new Date},s.onselectionchange=()=>{e._dropDownCloseDate=new Date},n.innerHTML='<style>\n .smart-ai-suggestion {\n padding: 6px 10px;\n border-bottom: 1px solid var(--smart-border-color);\n cursor: pointer;\n max-width: 360px;\n }\n .smart-ai-suggestion:hover {\n background-color: var(--smart-ui-state-hover);\n }\n .smart-ai-suggestions-container {\n max-height: 200px;\n overflow-y: auto;\n border: 1px solid var(--smart-border-color);\n border-radius: var(--smart-border-radius);\n margin-top: 5px;\n }\n </style>\n <div class="smart-ai-suggestions-container">\n \n </div>';const i=n.querySelector(".smart-ai-suggestions-container");t.ai&&t.ai.key&&a.forEach((e=>{const t=document.createElement("div");t.classList.add("smart-ai-suggestion"),t.innerText=e,t.onclick=()=>{s.value=e,i.classList.add("smart-hidden"),s.focus()},i.appendChild(t)})),s.oninput=()=>{s.value.length>0?i.classList.add("smart-hidden"):i.classList.remove("smart-hidden")},o.$.addFilterButton.onclick=()=>{let a=0;o.$.spinner.classList.remove("smart-hidden");const s=setInterval((()=>{o.$.spinner.innerHTML=`\rThinking${".".repeat(a%4)} `,a++}),500);let n='\nYou are a helpful assistant that converts natural language data manipulation requests\ninto structured JSON instructions for Smart.Grid AND produces a detailed, user-friendly explanation.\n\nImportant:\nThe JSON you produce represents actions that will be applied ONLY AFTER the user clicks "Apply".\nTherefore, all natural-language explanations must describe what *will happen* once the user applies the changes.\nDo not describe the action as already completed.\n\nUse only these columns:\n';for(let t=0;t<e.columns.length;t++){const a=e.columns[t];(a.allowFilter||a.allowSort||a.allowGroup||a.allowFormat)&&(n+="- "+a.label+" ("+a.dataType+") => "+a.dataField+"\\n")}const i=t.getSelection();let r=i.rows||[],l=i.columns||[],d=i.cells||[];d&&(d=d.map((e=>({row:e.row.id,column:e.column.label,value:e.row.data[e.dataField]})))),r&&(r=r.map((e=>e.id))),l&&(l=l.map((e=>t.columnByDataField[e].label)));let c={};t.getColumnStatistics=e=>{const a=t.getData().map((t=>t[e])).filter((e=>null!=e&&""!==e));if(0===a.length)return{};const o=a.filter((e=>"number"==typeof e)),s={count:a.length,uniqueCount:new Set(a).size};if(o.length>0){const e=o.reduce(((e,t)=>e+t),0),t=e/o.length,a=Math.min(...o),n=Math.max(...o);s.sum=e,s.average=t,s.min=a,s.max=n,s.range=n-a}return s};let u={};for(let a=0;a<e.columns.length;a++){const o=e.columns[a],s=t.getColumnStatistics(o.dataField);c[o.label]=s,o.options&&Array.isArray(o.options)&&(u[o.label]=o.options.map((e=>"object"==typeof e&&null!==e?void 0!==e.label?e.label:e.value:e)))}const m=t._rowElements.filter((e=>!e.classList.contains("smart-hidden"))).map((e=>e.row.data)).map((t=>{const a={};for(let o=0;o<e.columns.length;o++){const s=e.columns[o];a[s.label]=t[s.dataField]}return a}));n+=`\n visibleRows: ${JSON.stringify(m)}\n datasetStats: ${JSON.stringify(c)}\n columnOptions: ${JSON.stringify(u)}\n CurrentSelection: rows: ${JSON.stringify(r)}, columns: ${JSON.stringify(l)}, cells: ${JSON.stringify(d)}\n\n If datasetStats lacks the required numbers for a requested metric, the assistant MUST exclude that metric rather than invent numbers.\n\nThe user may request any combination of the following actions: filtering, sorting, grouping, conditional formatting, editing or summarization.`,n+='\nSupported filter operators:\n CONTAINS, EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN,\n GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, STARTS_WITH, ENDS_WITH\n\nRespond in this format for Filtering\n[\n {\n "field": "dataField",\n "operator": "some operator",\n "value": "some value",\n "type": "some type",\n "logic": "AND }\n]\nWhen the user requests to clear or remove or delete the Filtering\nRespond in this format for Filtering\n[\n {\n "field": null,\n "operator": "null,\n "value": null,\n "type": null,\n "logic": null\n }\n]\nSupported types:\n string, number, date, boolean\n\nThe assistant MUST understand and support operations on the user\'s current selection.\nA selection may include rows, columns, or specific cells.\n\nEDIT RULE: \nSupported edit actions include:\n- fill_empty: Fill empty cells using a source (e.g., from selection, constant value, or text).\n- translate: Translate text in the selected cells or columns.\n- replace_values: Replace or modify values inside the selection or target columns.\n- transform_text: Apply transformations such as uppercase, lowercase, trim, etc.\n\nThe assistant MUST check columnOptions when performing edit actions to ensure the requested action is allowed on the target column(s).\n\nOPTION-CONSTRAINT RULE FOR EDITING:\nSome columns contain restricted, predefined allowed values (options list).\n\nWhen performing an edit action (fill_empty, translate, replace_values, transform_text):\n- The assistant MUST verify that the target value is one of the allowed options if the column contains predefined options.\n- The assistant MUST NOT write a value that does not exist in the options list.\n- The assistant MUST NOT invent new options.\n- If a requested value is not part of the options list, the assistant MUST reply in HTML to request clarification rather than performing the edit.\n\n\nWhen the user requests an action involving selected cells, the assistant MUST include \nthe appropriate "edit" instructions in the JSON.\n\nWhen the user requests an edit action (fill, translate, replace, transform), the assistant MUST compute the actual resulting values for the affected cells using the visible data or selection provided.\nThe assistant MUST place these computed results inside the edit object.\nThe assistant MUST NOT output formulas, instructions, or placeholders. Only the final, edited values are allowed.\n\nRespond in this format for Editing\n[\n {\n "field": "dataField",\n "row": "some row id",\n "oldValue": "some old value",\n "value": "some value",\n "type": "some type",\n "editAction": "fill_empty/translate/replace_values/transform_text }\n]\n\nSORT RULE:\nWhen the user requests sorting (“sort by”, “order by”, etc.):\nRespond in this format for Sorting\n[\n {\n "field": "dataField",\n "order": "asc/desc"\n }\n]\nWhen the user requests to clear or remove or delete the sorting\nRespond in this format for Sorting\n[\n {\n "field": null,\n "order": null\n }\n]\nGROUP RULE:\nWhen the user requests grouping (“group by”, “categorize by”, etc.):\nRespond in this format for Grouping\n[\n {\n "field": "dataField"\n }\n]\nWhen the user requests to clear or remove or delete the grouping\nRespond in this format for Grouping\n[\n {\n "field": null\n }\n]\nFORMAT RULE (STRICT):\n\nWhen the user requests conditional formatting (“highlight”, “color code”, “format”, etc.):\nYou MUST respond ONLY in this exact JSON structure:\n\n[\n {\n "field": "dataField",\n "condition": "=/<>/<=/>=/</>/between",\n "value": "STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nif the user requests formatting for a RANGE of values (e.g., "between 10 and 20"):\nYou MUST add condition2 and value2 keys to the JSON structure like this:\n\n[\n {\n "field": "dataField",\n "condition": "between",\n "value": "lower bound STRING or NUMBER or DATE or BOOLEAN",\n "value2": "upper bound STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nCLEARING FORMATTING:\nWhen the user requests to clear, remove, or delete formatting:\nYou MUST respond ONLY in this structure:\n\n[\n {\n "field": null,\n "condition": "=",\n "value": "",\n "background": null,\n "color": null,\n "textDecoration": null,\n }\n]\n\nADDITIONAL STRICT RULES:\n- Do NOT add extra keys.\n- Do NOT omit required keys.\n- Do NOT output explanations, text, or comments — ONLY the JSON.\n- “condition” MUST be one of: =, <>, <, <=, >, >=.\n- “value” MUST be a STRING, NUMBER, DATE, or BOOLEAN literal.\n- Colors MUST be written as strings.\n\nSUMMARY RULE:\nWhen the user requests a summary (“give me a summary”, “summarize my data”,\n“show totals/averages/count”, etc.):\n\n1. You MUST compute actual numeric results using datasetStats and/or selection.\n - Place these results inside the "summary" JSON object.\n - NEVER output formulas or operations.\n\n2. You MUST generate a full natural-language summary report in the "message" field.\n The report MUST:\n - Use PRESENT TENSE (because summary is computed immediately).\n - Describe totals, averages, minimums, maximums, counts, and ranges.\n - Highlight notable patterns IF AND ONLY IF the stats allow it.\n - Be narrative, readable, and helpful.\n - NOT hallucinate any values not present in datasetStats or selection.\n\nYour task:\nConvert user requests about filtering, sorting, grouping, conditional formatting, editing, \nor summarization into a structured JSON format AND produce a verbose, friendly explanation.\n\nRespond ONLY in this structure:\n\n{\n "json": {\n "filters": [...],\n "sort": [...],\n "group": [...],\n "format": [...],\n "summary": {},\n "edit": []\n },\n "message": "A detailed explanation using FUTURE TENSE, describing what the changes will do once applied. The mssage should be in HTML Format. The explanation MUST be a well-structured HTML message with short paragraphs and bullet points when appropriate. It MUST NOT exceed 200 words unless summarization requires more"\n}\n\nGuidelines for the natural-language \'message\':\n- Use future tense: “will filter”, “will highlight”, “will sort”, etc.\n- Summary results are computed immediately and DO NOT depend on the Apply button.\n Therefore, the explanation for summaries may use PRESENT TENSE (e.g., “The total is 2300”).\n- Do NOT imply the action has already happened.\n- Explain clearly what the user should expect AFTER applying the settings.\n- Be helpful, descriptive, and user-friendly.\n- Avoid referencing JSON or internal logic.\n\nThe assistant MUST NOT invent additional JSON keys or structures.\nIf the user requests an unsupported action, the assistant MUST politely decline.\n\nIf the user request is ambiguous, the assistant MUST reply with a polite clarifying question\ninstead of guessing the action.\n\nIf the user asks a general question, tutorial question, or conceptual question that does NOT request\nfiltering, sorting, grouping, conditional formatting, editing, or summarization,\nthe assistant MUST NOT generate JSON.\n\nInstead, the assistant MUST reply with a natural-language explanation in HTML format.\n\nIf the user asks for help, instructions, or examples, the assistant MUST NOT perform actions.\nThe assistant MUST explain concepts in HTML using concise, user-friendly language.\n',t.ai.getAIResponse=async function(e,a){const o=t.ai.key,s=t.ai.url||"https://api.openai.com/v1/chat/completions",n={"Content-Type":"application/json",Authorization:`Bearer ${o}`},i={model:t.ai.model||"gpt-3.5-turbo",messages:[{role:"system",content:e},{role:"user",content:a}],temperature:.7,max_tokens:1e3},r=await fetch(s,{method:"POST",headers:n,body:JSON.stringify(i)});return(await r.json()).choices[0].message.content};try{t.ai.getAIResponse(n,o.$.aiPrompt.value).then((e=>{let a,n=t.localize("noAIResponse");try{const t=e.indexOf("{");a=JSON.parse(e.substring(t)),a.message&&(n=a.message)}catch(e){a={filters:[]}}if(o.$.aiResponse.innerHTML=n,o.$.spinner.innerHTML="",o.$.spinner.classList.add("smart-hidden"),clearInterval(s),o.$.itemsContainer.querySelector('.smart-ai-tab[data-tab="response"]').click(),a.json){const e=a.json.filters,t=a.json.sort,s=a.json.group,n=a.json.format,i=a.json.summary,r=a.json.edit;o.getAIInstructions=()=>({filters:e||[],sort:t||[],group:s||[],format:n||[],summary:i||{},edit:r||[]}),o.$.applyButton.classList.remove("smart-disabled")}}))}catch(e){o.$.spinner.innerHTML=t.localize("noResults"),clearInterval(s)}},o.$.applyButton.onclick=()=>{o.$.applyButton.classList.contains("smart-disabled")||e._applyAI()}}}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(e.grid&&"kanban"===e.grid.view){e.$.groupButton.onclick=()=>{"kanban"===e.grid.view&&e.grid._initKanbanView("dynamic","kanban")};const t=e.grid.columnByDataField[e.grid._stackedBy];return t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("groupedBy",{column:t.label}),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped"),void e.$.groupButton.classList.remove("scheduler")}if(!e.grid||"scheduler"!==e.grid.view&&"timeline"!==e.grid.view){if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}else if(e.$.groupButton.onclick=()=>{"scheduler"!==e.grid.view&&"timeline"!==e.grid.view||e.grid._createScheduler("update")},e.grid._dateStackedBy&&Array.isArray(e.grid._dateStackedBy)){const t=e.grid.columnByDataField[e.grid._dateStackedBy[0]].label,a=e.grid.columnByDataField[e.grid._dateStackedBy[1]].label;e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t+"-"+a}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")}else{const t=e.grid.columnByDataField[e.grid._dateStackedBy];t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t.label}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped")}}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search(this.$.searchInput.value,!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;if(e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu(),"filter"===t.header.searchCommand){const t=e.$.headerDropDown.querySelector(".smart-data-view-search-prev"),a=e.$.headerDropDown.querySelector(".smart-data-view-search-next");t.classList.add("smart-hidden"),a.classList.add("smart-hidden")}const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const s=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:s,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}addColors(e,t,a){const o=this,s=o.grid;let n=[e,t],i=[];if(o.closePanel(),JSON.stringify(n)===JSON.stringify(o._appliedColors))return;o._appliedColors=n;const r=[],l=o.grid.getRows();for(let e=0;e<l.length;e++)r.push(Object.assign(l[e].data));if("conditions"===t.type){const t=new Smart.DataAdapter({id:"id",observable:!1,dataSource:r,dataFields:o.grid.dataSource.dataFields});t._filter(a,"or");const n=[];for(let e=0;e<t.length;e++){const a=t[e];!1!==a.$.filtered&&n.push(a)}const l=e,d=[];for(let e=0;e<l.length;e++){const t=l[e],a=t[0],o=t[1],n=t[3]?t[2]:void 0,i=t[3]?t[3]:t[2],r=s.columnByDataField[a].dataType,c=new Smart.Utilities.FilterGroup,u=c.createFilter(r,n,o);c.addFilter("or",u),d.push({dataField:a,color:i,filterGroup:c})}for(let e=0;e<n.length;e++){const t=n[e];for(let e=0;e<d.length;e++){const a=d[e].dataField,o=d[e].filterGroup,s=d[e].color,n=t[a];o.evaluate(n)&&(void 0===i[t.$.id]&&(i[t.$.id]={}),i[t.$.id].color=s,i[t.$.id][a]=s)}}}else{const e=t.singleSelect,a=s.columnByDataField[e];if(!a)return s._conditionalColors={colors:[],type:t.type,conditions:[],update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(),o._refreshColorsButton(),void(s._onColors&&s._onColors(s._conditionalColors));const n="collaborator"===a.template?s.users:a.editor.dataSource,r={};n.forEach((e=>"collaborator"===a.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color)));for(let t=0;t<l.length;t++){const a=l[t].data,o=a[e],s=r[o];s&&(i[a.$.id]={color:s})}}s._conditionalColors={colors:i,type:t.type,conditions:e,update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(!1),o._refreshColorsButton(),s.autoSaveState(),o.$.fireEvent("colors"),s._onColors&&s._onColors(s._conditionalColors)}_updateConditionalColors(e,t,a){let o=[];const s=t.getRows();if("conditions"===a.type){const a=t._conditionalColors.conditions,n=[];for(let e=0;e<a.length;e++){const o=a[e],s=o[0],i=o[1],r=o[3]?o[2]:void 0,l=o[3]?o[3]:o[2],d=t.columnByDataField[s];if(d){const e=d.dataType,t=new Smart.Utilities.FilterGroup,a=t.createFilter(e,r,i);t.addFilter("or",a),n.push({dataField:s,color:l,filterGroup:t})}}const i=e=>{for(let t=0;t<n.length;t++){const a=n[t].dataField,s=n[t].filterGroup,i=n[t].color,r=e[a];s.evaluate(r)?(void 0===o[e.$.id]&&(o[e.$.id]={}),o[e.$.id].color=i,o[e.$.id][a]=i):delete o[e.$.id]}};if(e)o=t._conditionalColors.colors,i(e.data);else for(let e=0;e<s.length;e++)i(s[e].data)}else{const n=a.singleSelect,i=t.columnByDataField[n];if(i){const a="collaborator"===i.template?t.users:i.editor.dataSource,r={};if(a.forEach((e=>"collaborator"===i.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color))),e){o=t._conditionalColors.colors,o||(o=t._conditionalColors.colors=[]);const a=e.data,s=a[n],i=r[s];i?o[a.$.id]={color:i}:delete o[a.$.id]}else for(let e=0;e<s.length;e++){const t=s[e].data,a=t[n],i=r[a];i&&(o[t.$.id]={color:i})}}}t._conditionalColors.colors=o,t.autoSaveState(),t.summaryRow.visible||t._recycle(!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,a.grid._recycle(!1),void("filter"===a.grid.header.searchCommand&&a.grid.clearFilter());const o=a._searchInfo.source,s=[],n=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),s.push([t,a])})),o._filter(s,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(n.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=n,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,"filter"===a.grid.header.searchCommand){a.grid.beginUpdate();const t=a.grid.filtering.operator;return a.grid.filtering.operator="or",a.grid.clearFilter(),a._searchInfo.stringDataFields.forEach((t=>{const o=new Smart.Utilities.FilterGroup,s=o.createFilter("string",e,"CONTAINS"),n=a.grid.columnByDataField[t];if(n&&n.editor&&n.editor.dataSource)return!1;n&&(o.addFilter("or",s),a.grid.addFilter(t,o),n._filterInfo&&n.filter.filters[0]&&(n._filterInfo.value=n.filter.filters[0].value,n._filterInfo.condition=n.filter.filters[0].condition))})),a.grid.endUpdate(),a.grid.refreshFilters(),void(a.grid.filtering.operator=t)}if(n.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:n.length}),a._searchInfo.highlighted||(a._searchInfo.highlighted=n[0]),a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}isGrid(){const e=this.grid;return!(e&&("kanban"===e.view&&e._kanban||"scheduler"===e.view&&e._scheduler||"timeline"===e.view&&e._scheduler))}_refreshColorsButton(){const e=this,t=e.grid;let a=0;if(a=t._conditionalColors&&t._conditionalColors.conditions?Object.keys(t._conditionalColors.conditions).length:0,t._conditionalColors&&"singleSelect"===t._conditionalColors.type){a=1;const o=t.columnByDataField[t._conditionalColors.singleSelect];return o?(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formatingBy",{value:o.label})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted"),void e._refreshMobileViewTools()):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),void e.$.colorsButton.classList.remove("formatted"))}a>0?(e.$.colorsButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("formatingOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("formatingByMultiple",{n:a})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted")):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),e.$.colorsButton.classList.remove("formatted")),e._refreshMobileViewTools()}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if(!e.isGrid())return t._kanban&&t._kanban.localize&&(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&(o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++))}a>0?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),e._refreshMobileViewTools()}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let s=0,n=[],i=[],r=[];const l=o.onColumnChange;o.onColumnChange=null;for(let t in e){const a=e[t],l=o.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(n.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||s++)}o.onColumnChange=l,o.onColumnChange?o.onColumnChange(n,"visible",i,r):o.$.fireEvent("columnChange",{column:n,propertyName:"visible",oldValue:i,value:r}),s>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n:s})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],s=a.oldIndex,n=a.newIndex,i=o.columns[n+1],r=o.columns[n-1],l=o.columns[s];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(s,n,!0)}if(o.filtering.enabled&&o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized=!1;o.endUpdate();const d=o.grouping.enabled;d&&o._filters&&o.refreshFilters(d),o.autoSaveState()}});
65
+ Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{ai:{type:"any",reflectToAttribute:!1,value:{model:{value:"gpt-4.1",type:"string"},maxTokens:{value:200,type:"number"},temperature:{value:.7,type:"number"},maxResponseLength:{value:100,type:"number"},promptVariables:{value:null,type:"any",reflectToAttribute:!1},prompts:{value:null,type:"any",reflectToAttribute:!1},includeUserPrompts:{value:!0,type:"boolean"},url:{value:"",type:"string"},key:{value:"",type:"string"}}},appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnAutoPlaceholder:{value:!1,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},cardTitleField:{value:"",type:"string"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowEditDialogDetails:{value:!1,type:"boolean"},showRowComments:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!1,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupCellLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showSelectionOnTop:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showTooltipsOverflow:{value:!0,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"},showViewBar:{value:!1,type:"boolean"},showViewBarAsDropdown:{value:!1,type:"boolean"},viewBarAppendTo:{value:null,type:"any"}},type:"object"},behavior:{value:{autoDestroy:{value:!0,type:"boolean"},allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},allowMouseWheel:{value:!0,type:"boolean"},allowRenderCache:{value:!0,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{autoWrap:{value:!0,type:"boolean"},autoWidth:{value:!1,type:"boolean"},autoHeight:{value:!1,type:"boolean"},allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},cardMinWidth:{value:250,type:"any",reflectToAttribute:!1},cardRowMinHeight:{value:45,type:"any",reflectToAttribute:!1},cardsPerRow:{value:"auto",type:"any",reflectToAttribute:!1},cardVertical:{value:!0,type:"boolean",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},dropDownWidth:{value:700,type:"any",reflectToAttribute:!1},dropDownHeight:{value:500,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowMobileHeight:{value:null,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"any"},fileName:{value:"SmartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"},headerContent:{value:null,type:"any",reflectToAttribute:!1},footerContent:{value:null,type:"any",reflectToAttribute:!1},addImageToCell:{value:null,type:"any",reflectToAttribute:!1},setRowHeight:{value:null,type:"any",reflectToAttribute:!1},cellFormatFunction:{value:null,type:"any",reflectToAttribute:!1},autoConvertFormulas:{value:!0,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},onlySelected:{value:!1,type:"boolean"},exportAsTable:{value:!1,type:"boolean"},exportStyles:{value:!0,type:"boolean"},formatData:{value:null,type:"any",reflectToAttribute:!1},getSpreadsheets:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},copyHeadersToClipboard:{value:!1,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:"auto",type:"any"},height:{value:null,type:"any"},customContextMenuItems:{value:null,type:"any"},dataSource:{value:{contextMenuItemChart:{value:{command:{value:"contextMenuItemChartCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-chart",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemSelectRow:{value:{command:{value:"contextMenuItemSelectRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-check-squared",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemExpand:{value:{command:{value:"contextMenuItemExpandCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-resize-full",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemInsertRow:{value:{command:{value:"contextMenuItemInsertRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCloneRow:{value:{command:{value:"contextMenuItemCloneRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCut:{value:{command:{value:"contextMenuItemCutCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-cut",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCopy:{value:{command:{value:"contextMenuItemCopyCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-copy-record",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemPaste:{value:{command:{value:"contextMenuItemPasteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-paste",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemClear:{value:{command:{value:"contextMenuItemClearCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-close",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemComment:{value:{command:{value:"contextMenuItemAddCommentCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-comment",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsert:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:500,type:"any"},width:{value:800,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban","card","scheduler","timeline"],type:"string"},currentUser:{value:null,type:"any",reflectToAttribute:!1},dropDownMode:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeInput:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeDataField:{value:"",type:"string",reflectToAttribute:!1},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array",reflectToAttribute:!1},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},relations:{value:[],type:"any",reflectToAttribute:!1},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object",reflectToAttribute:!1},formulas:{value:!1,type:"boolean"},highlighted:{value:-1,type:"any"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},keys:{value:null,reflectToAttribute:!1,type:"any"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the SmartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",viewCard:"Cards",viewScheduler:"Calendar",viewTimeline:"Timeline",kanbanNone:"Blank",schedulerDescription:"Which date column would you like to use for this view? Your data would be placed based on the dates in this column.",schedulerDescriptionInfo:"A range of data would be displayed when a start date field has an associated due date field.",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',schedulerDateColumn:"Create a new date column",schedulerPromptLabel:"Using date column(s)",schedulerDateRangeColumn:"Create a new date range",schedulerToolLabel:"Using '{{column}}'",toolLabel:"Labeled by '{{column}}'",uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",statusSummary:"Status",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsert:"Insert column",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",contextMenuItemSelectRow:"Select row",contextMenuItemCloneRow:"Clone row",contextMenuItemInsertRow:"Insert row",contextMenuItemChart:"Chart range",contextMenuItemAddRow:"Add {{value}} rows",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Ctrl</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Row: {{value}}",dialogEditHeader:"Row: {{value}}",dialogEditHeaderMenu:"Toggle Sidebar",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonSave:"Save",dialogEditButtonAutoSave:"Auto Save",dialogEditButtonCancel:"Cancel",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnDate:"Choose a date column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeAIQuery:"AI Button",dialogAddColumnTypeSparklines:"Sparklines",dialogAddColumnAIQuery:"AI Query",dialogAddColumnTypeAIQueryInfo:"Example: Write a short description for an article or choose a column to query by it",dialogAddColumnTypeUUID:"UUID",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeTime:"Time",dialogAddColumnTypeRating:"Rating",dialogAddColumnTypeDuration:"Duration",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"User",dialogAddColumnTypeFormula:"Formula",dialogAddColumnTypeFormulaInfo:'Example: COL(Name) & "-" & COL(Price) or IF(COL(Price) * COL(Quantity) > 5, "Yes", "No")',dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeStatus:"Choose a status column",dialogAddColumnTypeStatusInfo:"Connect with the relevant status column",dialogAddColumnTypeAutoNumber:"Auto number",dialogAddColumnTypeRowLink:"Link to table",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeNone:"None",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeDueDateSettings:"Set as a deadline",dialogAddColumnTypeDueDateSettingsInfo:"Set a deadline with start date or due date templates.",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnTypeVote:"Vote",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatMonthYear:"Month & Year",dialogAddColumnDateFormatCasualUS:"Casual US",dialogAddColumnDateFormatWeekdayOnly:"Weekday",dialogAddColumnDateFormatUS:"US",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnNumberFormatDecimalPlaces:"Decimal places",dialogAddColumnNumberFormatSeparator:"Use 1000 Separator (,)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnDotItems:"Show Dots",dialogAddColumnCustomItems:"Custom Items",dialogAddColumnListItems:"List items",dialogAddColumnLinkListItems:"Choose a table to link to",dialogAddColumnLinkField:"Choose a lookup field",dialogAddColumnLinkFieldMore:"Cascading readonly fields",dialogAddColumnLinkSelect:"Allow linking to multiple rows",dialogAddColumnFormula:"Please enter a formula",dialogAddColumnListItemsError:"You cannot delete an item while in use.",dialogAddColumnListItemsEditError:"You cannot edit an item while in use.",dialogAddColumnDefault:"Default value",dialogAddColumnDefaultDateCurrent:"Current Date",dialogAddColumnDefaultDateSpecific:"Specific Date",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnBlankItem:"Blank Item",dialogAddColumnFormatting:"Rich Formatting",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",strikethrough:"Strikethrough",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",commentPlaceholder:"Leave a comment",noComments:"Leave a comment and collaborate with your team.",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Format",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:"Changed {{column}} from {{oldValue}} to {{newValue}}",nullRange:"Changed {{column}} to {{newValue}}",rowCreated:"Row Created",propertyUpdated:"{{value}} updated",propertyRemoved:"{{value}} removed",dropImages:"Drop images here",addImages:"Add images",dropFiles:"Drop files here",addFiles:"Add files",unassigned:"Unassigned",historyDate:"Date",copyURL:"Copy row URL",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",addAIFilter:" ✨︎ Ask AI",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",noOptions:"No options",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",groupedBy:"Grouped by '{{column}}'",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",expandCell:"Expand cell",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'SmartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'SmartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",tomorrow:"Tomorrow",yesterday:"Yesterday",formatColumn:"Format Column",formating:"Color",formatingByMultiple:"{{n}} Colors",formatingOne:"1 color",formatingBy:"Colored by '{{value}}'",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"New View",newGrid:"Grid",newKanban:"Kanban",newCard:"Cards",newScheduler:"Calendar",newTimeline:"Timeline",layout:"Layout",settings:"Create view",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table",cardView:"View your records in a Card view",schedulerView:"View your records in a Calendar view",timelineView:"View your records in a Timeline view",days:"{{value}}d",daysOverdue:"{{value}} days overdue",daysLeft:"{{value}} days left",true:"true",false:"false",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month",hideHiddenColumns:"Hide {{value}} hidden columns",showHiddenColumns:"Show {{value}} hidden columns",less:"Less",more:"More",conditions:"Conditions",colorsSingleSelect:"Which single select field should the row be colored by?",colorRows:"Color rows when they match the conditions",colorSelect:"Color rows the same as a single select value",colorLeftBorderLabel:"Left border",colorRowLabel:"Row",colorCellLabel:"Cell",colorLeftBorder:"Color the left border of a row",colorRow:"Color the background of a row",colorCell:"Color the background of a cell",loadingIndicatorPlaceholder:"Loading...",dropDownPlaceholder:"Please select...",placeholder:"No Rows",columnPlaceholder:"Placeholder",pieChart:"Pie",columnChart:"Column",barChart:"Bar",stackedChart:"Stacked",lineChart:"Line",projectStatus:"Project Status",reviewStatus:"Review Status",taskStatus:"Task Status",priority:"Priority",size:"Size",yesNo:"Yes/No/Maybe",backlog:"Backlog",notStarted:"Not Started",underReview:"Under review",approved:"Approved",rejected:"Rejected",blocked:"Blocked",completedStatus:"Completed",generate:"Generate",aiPrompt:"Enter your prompt for the AI:",agenda:"Agenda",checkStyle:"Style",noVotes:"No votes yet",votes:"Voted by {{value}}",clearContents:"Clear contents",paste:"Paste",minPromptChars:"Enter AI prompt. Min 20 chars.",aiResponse:"Response",noAIResponse:"No response from AI",promptSuggest:"Prompt Suggestions"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellEditRequest:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onCellValueChanged:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onKeyUp:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:800,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},allowListOpenOnContentClick:{value:!0,type:"boolean"},allowDynamicButtons:{value:!1,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},readOnlyEdit:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},customCommandColumns:{value:null,type:"any"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","insertButton","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},sidePanel:{value:!1,type:"boolean"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},appendTo:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},searchCommand:{value:"search",allowedValues:["search","filter"],type:"string"},customButton:{value:{command:{value:null,type:"any",reflectToAttribute:!1},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},stateSettings:{value:{enabled:{value:!0,type:"boolean",reflectToAttribute:!1},current:{value:"",type:"string",reflectToAttribute:!1},storage:{value:null,type:"any",reflectToAttribute:!1},autoSave:{value:!1,type:"boolean",reflectToAttribute:!1},autoLoad:{value:!1,type:"boolean",reflectToAttribute:!1},allowLocalStorage:{value:!0,type:"boolean",reflectToAttribute:!1},options:{value:[],type:"array",reflectToAttribute:!1},onStateChange:{value:null,type:"any",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["Smart.menu.css","Smart.filterpanel.css","Smart.pager.css","Smart.grid.css","Smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' >\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' role='grid' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' style=\"opacity: 0.99\" role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div viewbar class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler","document.paste":"_clipboardPasteHandler",mouseleave:"_mouseLeaveHandler"}}_mouseLeaveHandler(){const e=this;e.editing.addNewRow._insertButton&&e.editing.addNewRow._insertButton.classList.remove("show")}_clipboardPasteHandler(e){if("paste"===e.type){const t=this;if(document.activeElement!==t)return;if(t._selection&&t._selection.focusedCell){const o=t._selection.focusedCell.id,l=t._selection.focusedCell.dataField,a=t.columnByDataField[l];if(!a)return;if(a&&("image"===a.template||"attachment"===a.template||"richText"===a.template)){e.preventDefault();let n=(e.clipboardData||e.originalEvent.clipboardData).items,i=null,r=0,s=0,d=[];for(let e=0;e<n.length;e++)if(0===n[e].type.indexOf("image")&&(i=n[e].getAsFile(),r++,null!==i)){let e={label:i.name,size:i.size},n=new FileReader;n.onload=function(n){s++;const i=n.target.result;e.value=i;let c=!1;for(let o=0;o<t.uploadSettings.userFiles.length;o++){const l=t.uploadSettings.userFiles[o];if(l.name===e.label||l.label===e.label){c=!0;break}}if(c||t.uploadSettings.userFiles.push(e),d.push(e),s===r){let e=t.getCellValue(o,l);e||(e=[]),"string"==typeof e&&(e=JSON.parse(e)),e=[...e,...d];let n=e;if("richText"===a.template){const a=document.createElement("span");for(let t=0;t<e.length;t++){const o=document.createElement("img");o.src=e[t].value,o.title=o.name=e[t].label,a.appendChild(o)}t.setCellValue(o,l,a.outerHTML),n=a.outerHTML}else t.setCellValue(o,l,e);const i=t.rowById[o].getCell(l),r="";t.onCellUpdate&&t.onCellUpdate([i],[r],[e],(function(){t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[r],[e],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,r,e)}),t)}},n.readAsDataURL(i)}}}}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1;this._mobile&&(e.preventDefault(),e.stopPropagation())}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(t.isInShadowDOM){const t=e.getBoundingClientRect();let o=window.pageXOffset,l=window.pageYOffset,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){const e=a.parentNode;null!==a.scrollLeft&&(o+=a.scrollLeft),null!==a.scrollTop&&(l+=a.scrollTop);const t=a.getRootNode?a.getRootNode():null;if(t&&t instanceof ShadowRoot)a=t.host;else{if(!e||1!==e.nodeType)break;a=e}}return o+=window.pageXOffset,l+=window.pageYOffset,{top:t.top+l,left:t.left+o,right:t.right+o,bottom:t.bottom+l,width:t.width,height:t.height}}if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);if(super._upHandler(),t._spinTimeout&&clearTimeout(t._spinTimeout),t._spinInterval&&clearInterval(t._spinInterval),t._tapTimer&&clearTimeout(t._tapTimer),t._mobile&&e.originalEvent&&"pointercancel"===e.originalEvent.type)return;const l=()=>{if(t.editing.isEditing&&!t.editing.dialog.enabled){if(t._hasRichTextEditor)return;setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(o.element&&o.element&&o.element.firstElementChild&&o.element.firstElementChild.hasAttribute("aria-owns")){const t=o.element.firstElementChild.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}else if(t.editing.editRow){const o=t.editing.editRow.cells;for(let t=0;t<o.length;t++){const l=o[t];if(l&&l.editor&&l.editor.instance){if(l.editor.instance.element&&l.editor.instance.element.hasAttribute("aria-owns")){const t=l.editor.instance.element.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(l.editor.instance.element&&l.editor.instance.element.firstElementChild&&l.editor.instance.element.firstElementChild.hasAttribute("aria-owns")){const t=l.editor.instance.element.firstElementChild.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(l.editor.instance.blur(e),e.defaultPrevented)return}}}t.isAttached&&t.endEdit()}}),50)}};if(e.originalEvent&&(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),e.originalEvent.target.closest(".smart-grid-dialog")))t._dialogDragDetails&&(t._dialogDragDetails.started=!1);else{if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;){if(a=a.parentNode,a===t){o=!0;break}if(t.dropDownMode&&t.$.dropDownElement===a){o=!0;break}}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.closeDropDown(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const l=n.querySelectorAll("smart-drop-down-list"),a=n.querySelectorAll("smart-date-time-picker"),i=n.querySelectorAll("smart-date-input"),r=n.querySelectorAll("smart-input");for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.dropDownContainer.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;for(let e=0;e<r.length;e++)if(r[e].$.scrollView.contains(o))return;return t.closeMenu(),t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e)}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(!0!==t._mobile&&t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation())}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._mobile||this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;if(t._mobile)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l),i=t.parentElement,r=i?i.scrollTop:0,s=i?i.scrollLeft:0;if(n.left-s<=e.pageX&&n.left-s+a.width-10>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(l),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(delete t._areAllRowsSelected,t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t._mobile){t._hideActionButtons();const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}}if(t.$.fireEvent("columnClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),i("doubleClick"),t._onColumnDoubleClick(o,e)),Smart.Utilities.Core.isMobile){const o=t.rightToLeft?a.getBoundingClientRect().left:a.getBoundingClientRect().right,n=10;if(o-n<=e.clientX&&e.clientX<=o+n){const o=t.columnByDataField[l];if(!o||o&&!o.allowResize)return;const n=t._isLastVisibleColumn(o);if("split"===t.behavior.columnResizeMode&&n)return;a.style.cursor="col-resize",a.sortButton.style.cursor="col-resize",a.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(a),t._columnToResizeElement=a,t._columnToResizeDataField=l,e.preventDefault(),e.originalEvent&&e.originalEvent.preventDefault()}}if(t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null,d=null,c=null,u=null,m=null;t._lastPointerDownTime=new Date;for(let p=0;p<a.length;p++){const g=a[p];if(g.hasAttribute("toggle-button")&&(i=g),g.hasAttribute("add-row")&&(d=g),g.hasAttribute("checkbox")&&(r=g),"A"===g.nodeName&&e.ctrlKey&&g.click(),g.hasAttribute("rating-value")&&(c=g),g.hasAttribute("vote-value")&&(u=g),!s&&"smart-grid-cell"===g.nodeName.toLowerCase()&&!g.classList.contains("smart-grid-filter-row-cell")){if(s=g,g.hasAttribute("data-type")&&"string"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit&&!s.cell.column.autoGenerated){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id"),n=g.getBoundingClientRect(),i=t.columnByDataField[l];if(o>=n.right-20&&("tags"===i.template||"list"===i.template||"dropdownlist"===i.template||"combobox"===i.template))return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"date"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id");if(o>=g.getBoundingClientRect().right-20)return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"number"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const a=g.getAttribute("data-field"),n=g.closest("smart-grid-row").getAttribute("data-id"),i=g.getBoundingClientRect();if(o>=i.right-20){const o=()=>{let e=t.getCellValue(n,a);null!=e&&""!==e||(e=0);const o=e;let r=1;const s=t.columnByDataField[a];s&&s.formatSettings&&s.formatSettings.Intl&&("percent"===s.formatSettings.Intl.NumberFormat.style&&(r=.01),"currency"===s.formatSettings.Intl.NumberFormat.style&&void 0===s.formatSettings.Intl.NumberFormat.minimumFractionDigits&&(r=.01),s.formatSettings.Intl.NumberFormat.minimumFractionDigits>0&&(r=.01)),l>=i.top&&l<=i.bottom-i.height/2?e+=r:e-=r,s.editor&&(e>s.editor.max&&(e=s.editor.max),e<s.editor.min&&(e=s.editor.min)),t.setCellValue(n,a,e);const d=t.rowById[n].getCell(a);t.onCellUpdate&&t.onCellUpdate([d],[o],[e],(function(){t.onCellUpdated&&t.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[e],t),t._onCellUpdated&&t._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,e)}),t)};return o(),clearTimeout(t._spinTimeout),t._spinTimeout=setTimeout((()=>{clearTimeout(t._spinTimeout),t._spinInterval=setInterval((()=>{t._spinInterval&&o()}),50)}),150),e.stopPropagation(),void e.preventDefault()}}}if(!m&&g.classList.contains("smart-card")&&(m=g),!n&&"smart-grid-row"===g.nodeName.toLowerCase()){n=g;break}}if("card"===t.view){if(m){const o=m.getAttribute("row-id"),l=t.rowById[o];if(l){const a=e.originalEvent?e.originalEvent:e,n=3===a.which;if(l.element||l.createElement(),t.$.fireEvent("rowClick",{row:l,id:l.id,data:t.getRowData(l.id),isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)}),s){const e=s.getAttribute("data-field");if(e){const o=t.columnByDataField[e],i=new Smart.Grid.Cell(l,o,this);s.cell=i,i.element=s,i&&t.$.fireEvent("cellClick",{cell:i,id:l.id,dataField:i.column.dataField,value:i.value,isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)})}}const i=e.originalEvent.target;if(m.classList.contains("smart-card-header"))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(l.children&&l.children.length>0&&(i.classList.contains("smart-icon-ungroup")||i.classList.contains("smart-icon-group")))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(t.editing.enabled){const l=t.editing.dialog.enabled,a=t.editing.mode;if(i.scrollHeight>i.offsetHeight){const o=t.offset(i);if(e.originalEvent.pageX>=o.left+i.offsetWidth-15)return}const n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=o;let r=t._isUpdating;m.setAttribute("edit",""),t.beginEdit(o),t._isUpdating=r,t._endCardRowEdit?(t.removeEventListener("endEdit",t._endCardRowEdit,null),t.removeEventListener("cancelEdit",t._endCardRowEdit,null)):t._endCardRowEdit=()=>{t.context=t,t.editing.dialog.enabled=l,t.editing.mode=a,t.editing.isEditing=!1,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endCardRowEdit),t.addEventListener("cancelEdit",t._endCardRowEdit)}}}return}c&&(t._ratingElement=c),u&&(t._voteElement=u);const p=!!e.originalEvent&&3===e.originalEvent.which;if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn&&!p){const e=n.row;if(t._overlay||e.header&&"row-resize"===e.header.style.cursor||e.header&&"row-resize"===e.header.parentElement.style.cursor)return;t.editing.isEditing&&t.cancelEdit(),e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else if(d){const e=n.row,o=e.data;let l=o.parent;const a={};for(a[o.groupDataField]=null!==e.label?e.label:null,void 0!==e.labelValue&&(a[o.groupDataField]=e.labelValue);l;){let e=null!==l.label?l.label:null;l.labelValue&&void 0!==e&&(e=l.labelValue),a[l.groupDataField]=e,l=l.parent}t.addRow(a),setTimeout((()=>{t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update()}),100)}else{const o=n.row,l=s?s.cell:null;if(l.column._treeColumn&&r)return void(o.checked=!o.checked);l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(t._overlay||o.header&&"row-resize"===o.header.style.cursor||o.header&&"row-resize"===o.header.parentElement.style.cursor)return;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return o.header.style.cursor="",void(t._rowToResize.onpointerup=()=>{const a=t.editing.isEditing;t._rowToResize&&(t._rowToResize.onpointerup=null),t._clickedRow===n&&!a&&!t._rowResizeLine&&l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection&&t._setSelection(o.id,l.column.dataField,e)});o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||e.metaKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else(l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a||l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection)&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,c=e.originalEvent?e.originalEvent:e,u=3===c.which;if(u||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),u&&t.contextMenu.enabled){t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField;const e=t.getSelectedCells();let a=!0;if(t.contextMenu.dataField&&!t.contextMenu.dataField.startsWith("_"))if(e.length){for(let t=0;t<e.length;t++){const n=e[t],i=n[0],r=n[1];if(""+i==""+o.id&&l.column.dataField===r){a=!1;break}}t._focusCell(o.id,l.column.dataField,a),a&&t._selectCellsRange(o,o,l.column.dataField,l.column.dataField)}else{const e=t.getSelectedRowIds();(0===e.length||e.length>1)&&(t._focusCell(o.id,l.column.dataField),t._selectCellsRange(o,o,l.column.dataField,l.column.dataField))}else t._copyRects&&t._copyRects.length&&t.clearSelection(),t.selectRow(o.id);return t.openContextMenu(c.pageX+10,c.pageY+10),void(t.contextMenu.selector&&(c.stopPropagation(),c.preventDefault()))}if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}refreshRelations(){const e=this;if(e.dataSourceSettings&&e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length){for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&(o._isDirty=!0)}e._recycle(!1);for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&delete o._isDirty}}}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){if("object"==typeof e)return o&&o.columns&&(l.__measuredColumnHeight=null),void l.render();switch(l._notify(e,t,o),e){case"dataSourceSettings_relations":return void l.refreshRelations();case"dataSourceSettings_transpose":return void l.render();case"onRowHistory":case"onRowInserted":case"stateSettings_current":return;case"highlighted":"kanban"===l.view&&l._kanban?(l._kanban.selectTask(o),l._kanban.ensureVisible(o)):"scheduler"===l.view&&l._scheduler&&l._scheduler.focusEvent(o);break;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o,!0));case"users":case"currentUser":l._refreshCurrentUser(),l._recycle();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return l._setLoadingIndicatorVisibility(),void l._recycle(!1);case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnGroupLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":if(l.header.visible&&""===l.header.template){let e=l.$.header;l.header.appendTo&&(e=document.querySelector(l.header.appendTo),e?e.onclick=e=>{l._headerClickHandler(e)}:e=l.$.header),e.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=e.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar)}break;case"header_buttons":l.header.visible&&""===l.header.template&&l._refreshHeaderBar();break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection&&(l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index})}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l.grouping.groupBar.visible&&l._renderGroupBar(),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":{l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[];let e=!1;if(t&&t.length)for(let o=0;o<t.length;o++)if(t[o].freeze){e=!0;break}if(l.columns&&l.columns.length)for(let t=0;t<l.columns.length;t++)if(l.columns[t].freeze){e=!0;break}if(e&&l._initializeRowElements(),l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}l._renderColumns(),l._refreshHeaderBar();const o=l._sortedColumns;if(o){l.clearSort();for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;l._refreshSort(o)}if(l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return l.layout.isDirty=!0,l._resetCachedLayout(),void l._refreshLayout()}case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":delete l._isFirstVirtualDataSourceRequest,l._isUpdating&&l.endUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.editor&&(delete t.editor.isInitialized,delete t.editor.dataSource,delete t.editor._items,t.options&&(t.editor.dataSource=t.options),t.editor.isDirty=!0),t._cellsCachedValues=[],delete l._cellCachedValues,l._cellEditors=[]}if("dataSource"===e&&t&&o){const e=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&"infinite"!==l.scrolling,a=e=>Array.isArray(e)&&e.every((e=>Array.isArray(e)));if(o&&a(o)){const e=[];for(let t=0;t<o.length;t++){const a={};for(let e=0;e<l.columns.length;e++){const n=l.columns[e];let i=o[t][e];if(n.options){const e=n.options.find((e=>e.label===i||e.value===i));e&&(i=e.value)}"date"===n.dataType&&null!==i&&(i=new Smart.Utilities.DateTime(i).toDate()),a[n.dataField]=i}e.push(a)}o=e}if(t instanceof Smart.DataAdapter&&!e){if(t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.childrenDataField&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{let e=null;if(t&&l.dataSource&&l.dataSource._expandedRowIds){let t={};for(let e in l.dataSource._expandedRowIds){let o=""+e;o=o.replace("Item","").replace(/_/gi,"."),t[o]=!0}e=t}l.beginUpdate();const a=l._sortedColumns;l._sortedColumns&&l._sortedColumns.length>0&&void 0===l._getId()&&l.clearSort();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e]?l.dataSource[e].$.id:e;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const n=l._filters;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;if(a&&l._refreshSort(a),n&&n.length>0&&(l._filters=null,l.refreshFilters()),l.grouping.enabled)for(let t in e)l._expandCollapseGroup(t,!0);l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}if(l.dataSource&&l.dataSource.url&&l.filtering.enabled&&l.filtering.filterRow.visible){let e=!1;for(let t=0;t<l.columns.length;t++)l.columns[t]._filterEditorInitialized&&(e=!0),l.columns[t]._filterEditorInitialized=!1;e&&setTimeout((()=>{l._refreshFilterRowEditors(),l.refreshFilters(),l._recycle(!1)}),100)}}}return l.dataSource&&l.dataSource.length>1e4?(l.appearance.displayLoadingIndicator=!0,l._setLoadingIndicatorVisibility(),setTimeout((()=>{l.dataBind()}),100),setTimeout((()=>{l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility(),l._recycle(!1)}),200)):(l.dataSource&&l.dataSource instanceof Smart.DataAdapter&&l.columns&&l.dataSource.dataFields&&l.dataSource.dataFields.forEach((e=>{const t=l.columnByDataField[e.name];t&&(t.dataType=e.dataType)})),l.dataBind()),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"showViewBar":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"layout_autoHeight":case"layout_autoWidth":case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"row"!==l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.$.content.removeAttribute("aria-readonly"):l.$.content.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"layout_isDirty":return;case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){const e=this;e.disableSwipeScroll=!0,super.ready(),e._renderInDropDown();const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].loadingIndicatorPlaceholder?e.localize("loadingIndicatorPlaceholder"):e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e._details=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];if(e.filtering.enabled&&0===e._filterPanels.length){if(e.header.visible&&e.header.buttons.indexOf("filter")>=0)return;requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};if(e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this,t="card"===e.view;let o=e._recyclingRows,l=0,a=e._autoRowHeight,n=0,i=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===o.length||0===e.columns.length||!e.hasVisibleColumn())return 0;let r=40,s=1,d=0;if(t){for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&!o.autoGenerated&&(r+=e.layout.cardRowMinHeight,d++,o.cardHeight&&(r-=e.layout.cardRowMinHeight,r+=o.cardHeight*e.layout.cardRowMinHeight))}let t=e.offsetWidth;!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||(t-=e.layout.viewBarWidth+5),s=t<e.layout.cardMinWidth?1:"auto"===e.layout.cardsPerRow?Math.floor(t/e.layout.cardMinWidth):e.layout.cardsPerRow,1===s&&(r+=5*d),e._cardHeight=r}e._cardsPerRow=s,e.rows.canNotify=!1;const c=e._measureRowElement(o[0].data),u=o.length;for(let s=0;s<u;s++){let d=o[s];if(!d.visible||!1===d.filtered){d.height=0,d.cellHeight=0,d.top=l;continue}const u=e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled;let m=!d.height||!d.cellHeight||u||"auto"===d.height||"auto"===d._height||"auto"===e.layout.rowHeight||e.layout.isDirty;if(t&&d.height!==r&&(d.height=d.cellHeight=r),m&&!d.expandHeight){if(d.detailHeight||(d.detailHeight=200),t)d.height=d.cellHeight=r;else if(e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.height=e.layout.rowHeight,d.computedHeight&&(d.height=d.computedHeight),d.minHeight>d.height&&(d.height=d.minHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.element=c,d.grid=e,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a,o=d.canNotify;d.canNotify=!1,d.height=t,d.computedHeight&&(d.height=d.computedHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight),d.canNotify=o}else e.layout.rowHeight(s,d),d.height||(d.height=a),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}else{if("auto"===d.height||"auto"===d._height){d.element=c,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a;d.height=t,d._height="auto"}else d.height=a;void 0===d.label||d.summaryRow||"advanced"!==e.grouping.renderMode||(d.height=e.grouping.groupRowHeight),d.computedHeight&&(d.height=d.computedHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}e._rowGap&&s<e.rows.length-1&&(d.height+=e._rowGap)}!t&&(!0===d.freeze||"near"===d.freeze?d.visible&&(n+=d.height):"far"===d.freeze&&d.visible&&(i+=d.height),d.freeze&&d.visible)?d.top=l:(d.top!==l&&(d.top=l),d.expandHeight?l+=d.cellHeight:l+=d.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(l+=1*a),e.editing.addNewRow&&"row"!==e.editing.addNewRow.displayMode&&(l+=1*a),e.filtering&&e.filtering.filterRow.visible&&(n+=a+1),e.editing.addNewRow&&"button"!==e.editing.addNewRow.displayMode&&e.rowHierarchy&&e.editing.addNewRow.visible&&(l+=a,"far"!==e.editing.addNewRow.position&&(n+=a)),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(l=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return t&&(l=r*Math.ceil(o.length/s)),e.__scrollHeight=l,e.__frozenNearHeight=n,e.__frozenFarHeight=i,e._scrollView.scrollHeight=l-e.$.scrollView.offsetHeight+n+i,l=e.__scrollHeight+n+i-1,e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(l+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=l,c.remove(),o[0]&&delete o[0]._isMeasureRow,e.rows.canNotify=!0,l}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.collapsible&&e._initializeColumnGroupCollapsing(o)}}_initializeColumnGroupCollapsing(e){const t=this;e.collapsed=e.collapsed||!1,e.collapseButton=document.createElement("div"),e.collapseButtonIcon=document.createElement("span"),e.collapseButton.appendChild(e.collapseButtonIcon),e.collapseButton.classList.add("smart-grid-column-group-collapse-button"),e.collapseButtonIcon.classList.add("smart-grid-icon",e.collapsed?"smart-icon-right":"smart-icon-left","show"),e.collapseButton.setAttribute("role","button"),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"));const o=(e,l)=>{if(e.collapsed=l,e.column&&(e.column.canNotify=!1,e.column.collapsed=l,e.column.canNotify=!0),e.collapseButtonIcon.classList.remove("smart-icon-left"),e.collapseButtonIcon.classList.remove("smart-icon-right"),e.collapsed?e.collapseButtonIcon.classList.add("smart-icon-right"):e.collapseButtonIcon.classList.add("smart-icon-left"),t.beginUpdate(),e.collapsed){const t=e=>{let t=0;for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.allowCollapse&&(l.visible=!1,t++)}t===e.columns.length&&e.columns[0]&&!e.inline&&(e.columns[0]._visible=!0,e.columns[0].visible=!0)};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}else{const t=e=>{for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}t.endUpdate(),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"))};e.collapsed&&requestAnimationFrame((()=>{o(e,e.collapsed)})),e.collapseButton.addEventListener("click",(function(t){t.stopPropagation(),o(e,!e.collapsed)}))}_refreshColumnHeights(){const e=this;if("card"===e.view)return;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,c=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,c+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=c,c+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(a.parent&&n.setAttribute("column-group",a.parent.name),a.parent&&a.parent.columns&&a.parent.columns[0].dataField===a.dataField&&n.setAttribute("column-group-first-child",""),l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this,n.onpointerdown=()=>{if(e.selection.allowColumnHeaderSelection){const t=function(e){let o=new Array;if(e.columnGroup&&o.push(e),e.groups)for(let l=0;l<e.groups.length;l++)if(e.groups[l].columnGroup)o.push(e.groups[l]);else if(e.groups[l].groups){let a=t(e.groups[l]);for(let e=0;e<a.length;e++)o.push(a[e])}return o},o=t(l);e._selectColumnsRange(o[0].dataField,o[o.length-1].dataField)}}}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",!1===e.appearance.showColumnGroupLines&&e.setAttribute("appearance_hide-column-group-lines",""),e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e._autoHeight&&e.paging.enabled&&(e._overflowOffset=Math.max(o,e.paging.pageSize*e.layout.rowMinHeight)),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;if(t.summaryRow.visible)t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{if(!0!==t.editing.isEditing){t._calculateSummary();const o=t.$.headerBar;o&&o._updateTools&&o._updateTools(),!1!==e&&t._recycle(!1,!0,!1)}}),100);else{const e=t.$.headerBar;e&&e._updateTools&&e._updateTools()}}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[],e._frozenRowsById=[];let o=e._createdDate||new Date,l=void 0!==e._createdBy?e._createdBy:e.currentUser;const a=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a&&a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const n=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],i=function(a,i,r){let s=null;if(e.isInitialized&&(o=new Date),s=a?a.grid?a:new Smart.Grid.Row({data:a,index:i,grid:e,createdBy:l,createdDate:o}):new Smart.Grid.Row({data:{},index:i,grid:e,createdBy:l,createdDate:o}),n)for(let e=0;e<n.length;e++){const t=n[e],o=t.getCellValue(s.id,t.dataField,a);void 0!==o&&(s.data[t.dataField]=o)}if(e.rowById[s.id]&&(s.id=e.rows.length,e.rowById[s.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};s.id=e()}if(e.onRowInit){e.onRowInit(i,s,e),30!==s.height&&(s.cellHeight=s.height);for(let t in s)-1!==s.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}));e._details[i]=s.showDetail}if(s.selected&&(e._selection.rows[s.id]=!0,e._selection.indexes[s.index]=s.index),s.freeze&&s.visible){if(!0===s.freeze||"near"===s.freeze){e.rows.splice(t++,0,s);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0)}else if("far"===s.freeze){e.rows.push(s);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&(e._frozenFarRows.push(t),e._frozenRowsById[t.id]=!0)}}else e.rows[i]?(e.rows.splice(i,0,s),e.rows[i].index=e.rows.length):e.rows.push(s),s.data&&s.data.$&&(s.data.$.history=s.history,s.data.$.starred=s.starred,s.data.$.comments=s.comments,s.data.$.style=s.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&(e._recycle(!1,!0),e.grouping.groupBy.length&&e.refresh()),e._onRowInserted&&e._onRowInserted(l),r&&r(l)};if(e._rowInsertedCallback=o,void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:i});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([i],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),r&&r(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([i],[t],o,e)}else{const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i];void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),r&&r(t)}},r=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._onRowRemoved&&e._onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},s=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._onRowRemoved&&e._onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=i,e._removeLastRow=r,e._removeAt=s,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length,c=e.onRowInserted;e.onRowInserted=null,e.$.content.setAttribute("aria-rowcount",d);const u=e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling;if(e.dataSource&&e.dataSource.virtualDataSource&&e.paging.enabled&&!e.dataSource.virtualDataSourceOnExpand)for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource[t],l=t+e.paging.pageIndex*e.paging.pageSize;e.dataSource.id||(o.$.id=l),i(o,l)}else if(u){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];i(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];i(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(a(),e.onRowInserted=c,e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let l=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)i(o[t],e.dataSource.length-o.length+t);else i(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],a=[],n=[];for(let r=0;r<n.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=n[r],o.push(s),a.push(e.rows[s]),n.push(e.rows[s].data)):(i(n[r],n[r].$.index),l=!0)}e.onRowUpdated&&e.onRowUpdated(o,a,n,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:i(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":i(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":s(t.index);break;case"removeLast":r();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),t.$&&o.$.pageSizeSelector&&(t.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0])),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),o.$&&o.$.pageSizeSelector&&(o.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0]))}if(0===d&&0===e.columns.length&&e.dataSource.dataFields.length>0){const t=e.context;e.context=e,e.columns.canNotify=!1,e.columns=[],e._renderColumns(),e._resetCachedLayout(),e.columns.canNotify=!0,e.context=t}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),delete e.onLoad)}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0):"far"===o.freeze&&(e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}if(e.dataSource.id&&(null===l.data[e.dataSource.id]||void 0===l.data[e.dataSource.id])){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.data[e.dataSource.id]=t()}if(o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]){l.data=e.dataSource[o];for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t].name;e.dataSource.id&&o===e.dataSource.id||e.dataSource.keyDataField&&o===e.dataSource.keyDataField||e.dataSource.parentDataField&&o===e.dataSource.parentDataField||e.columnByDataField[o]||delete l.data[o]}void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)}-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l),e._frozenRowsById[l.id]=!0),e._conditionalColors&&e._conditionalColors.update&&setTimeout((()=>{e._conditionalColors.update(),e._recycle(!1)}),100)})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l&&(l.data=o,l.id=o.$.id,e.rowById[l.id]=l)}return e.rows.canNotify=!0,e.refresh(),void e._refreshPaging(!1)}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(!1,o),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}setDropDownLabel(e){const t=this;t.$.dropDownElement&&(t.dropDownModeInput?t.$.dropDownElement.querySelector(".smart-action-button smart-input").value=e:t.$.dropDownElement.querySelector(".smart-action-button").innerHTML=e)}openDropDown(){const e=this;if(!e.dropDownMode)return;if(!e.$.dropDownPopup)return;const t=e.$.dropDownPopup,o=e.$.dropDownElement;o.setAttribute("active",""),o.querySelector(".smart-drop-down-button").setAttribute("active",""),(()=>{const l=0,a=0;if(e.layout.isDirty=!0,window.screen.availWidth<400)return t.open("left","top"),t.style.width=e.offsetWidth+"px",void(t.style.height=e.offsetHeight+"px");{const o={width:e.layout.dropDownWidth,height:e.layout.dropDownHeight};t.style.width="auto"===o.width?o.width:o.width+"px",t.style.height="auto"===o.height?o.height:o.height+"px"}const n=o;if(n){const o=e.offset(n),i=o.left-l,r=l,s=Math.max(r,i);t.open(s,o.top+n.offsetHeight-a)}else t.classList.add("center"),t.open("center","center");e.style.display=""})()}isDropDownOpened(){return!!this.$.dropDownElement.hasAttribute("active")}closeDropDown(){const e=this;e.dropDownMode&&e.$.dropDownPopup&&(e.$.dropDownElement.removeAttribute("active"),e.$.dropDownElement.querySelector(".smart-drop-down-button").removeAttribute("active"),e.$.dropDownPopup.close())}_renderInDropDown(){const e=this;if(e.dropDownMode&&(e.dropDownMode&&(e.style.display="none"),e.dropDownMode&&void 0===e._dropDownMode)){e._dropDownMode=!0;const t=document.createElement("div"),o=e._createPopup();if(o.allowDrag=!1,o.classList.add("smart-grid-drop-down-popup"),e.$.dropDownElement=t,e.$.dropDownPopup=o,t.onmouseenter=()=>{t.hasAttribute("active")||t.setAttribute("hover","")},t.onmouseleave=()=>{t.removeAttribute("hover")},t.classList.add("smart-grid-drop-down-button","smart-drop-down-box"),e.parentNode.insertBefore(t,e),t.innerHTML=`<div class="smart-container" role="presentation">\n <div class="smart-content" role="presentation">\n <div class="smart-buttons-container" role="presentation">\n <span class="smart-action-button">${e.localize("dropDownPlaceholder")}</span>\n <span class="smart-drop-down-button">\n <span class="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n </div>\n </div>`,e.dropDownModeInput){const o=t.querySelector(".smart-action-button");o.innerHTML='<smart-input style="color: var(--smart-background-color); background: var(--smart-background); border-radius: 0px; width: calc(100% - 6px); height: calc(100% - 6px);"></smart-input>';const l=o.firstElementChild;l.onpointerdown=l.onclick=l.onpointerup=e=>{e.stopPropagation()},l.oninput=l.onchange=l.onkeyup=t=>{const o=e.rows||e.dataSource;clearTimeout(e._dropDownInputTimer),e._dropDownInputTimer=setTimeout((()=>{if(l.value.length>=2)for(let a=0;a<o.length;a++){const n=o[a],i=(""+(n.data?n.data:n)[e.dropDownModeDataField]).toLowerCase(),r=(""+l.value).toLowerCase();if(i.indexOf(r)>=0){"Enter"===t.key&&(l.value=i),e.selection.enabled&&(e.isDropDownOpened()||e.openDropDown(),e.rows&&(e.clearSelection(),e.selection.allowCellSelection?e.selectCell(n.id,e.dropDownModeDataField):e.selectRow(n.id),e.ensureVisible(n.id)));break}}}),300)}}if(t.onclick=()=>{o.classList.contains("open")?e.closeDropDown():e.openDropDown()},e.style.height="100%",e.style.width="100%",o.content.appendChild(e),e._cellsMerge=[],e._cellStyles=[],!e._popupDropDown){e._popupDropDown=o,o._refreshPosition=()=>{const l=e.offset(t),a=t.offsetHeight,n=e.offset(e);if(o.style.maxHeight="",o.style.minHeight="",l.top+a+o.offsetHeight>window.innerHeight-n.top){const e=a+l.top+o.offsetHeight-window.innerHeight+n.top;o.style.maxHeight=Math.max(250,o.offsetHeight-e)+"px",o.style.minHeight="250px"}else o.style.maxHeight="",o.style.minHeight=""};const l=()=>{if(e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}};o.onOpen=function(){e._popupDropDown._refreshPosition(),e.$.fireEvent("dropDownGridOpen"),e.$.listen("cellClick",l)},o.onClose=function(){if(e.$.unlisten("cellClick"),e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}e.$.fireEvent("dropDownGridClose")},o.onkeydown=function(e){"Escape"===e.key&&(o.result=!1,o.close())}}}}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||(e._undoRedo=[],e._refreshCurrentUser(),e._render())})),e.$.content.setAttribute("role","grid"),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),void super.render();const o=e.context;e.context=e,e.$.content.setAttribute("role","grid"),"grid"!==e.view&&e.setAttribute("view",e.view),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}transpose(e,t=180,o){const l=this,a=l.dataSource,n=l.columns;if(!a||!n)return null;let i=[],r=[];i=a instanceof Smart.DataAdapter?a.boundSource.toArray():a,r=n.toArray();const s=[],d=[{label:"",dataField:"field",freeze:!0,width:150}];for(let l=0;l<i.length;l++){const a={label:i[l][e]||`Row ${l+1}`,width:t,dataField:String(l)};o&&o(a),d.push(a)}for(let e of r){const t={field:e.label||e.dataField};i.forEach(((o,l)=>{t[l]=o[e.dataField]})),s.push(t)}l.beginUpdate(),l.dataSource=new Smart.DataAdapter({dataSource:s}),l.columns=d,l.endUpdate(),l.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_setupMobile(){const e=this;if(void 0===e._mobile&&(e._mobile=Smart.Utilities.Core.isMobile),e._mobile){e.layout.rowMobileHeight&&(e.layout.rowMinHeight=e.layout.rowHeight=e.layout.columnMinHeight=e.layout.columnHeight=e.layout.rowMobileHeight),e.behavior.rowResizeMode="none",e.behavior.allowRowReorder=!1,e.selection.allowDragSelectionAutoScroll=!1,e._scrollView.vScrollBar.showButtons=!1,e._scrollView.hScrollBar.showButtons=!1,e.style.setProperty("--smart-scroll-bar-size","12px"),document.body.style.setProperty("--smart-data-view-sort-panel-width","345px"),e._scrollContent=document.createElement("div"),e._scrollContent.style.width="100%",e._scrollContent.style.height="100%",e._scrollContent.style.position="absolute",e._scrollContent.style.left="0px",e._scrollContent.style.top="0px",e._scrollContent.style.background="white",e._scrollContent.style.zIndex=9999,e._scrollContent.style.opacity=.1,e._scrollContent.style.overflow="auto",e.addEventListener("viewChange",(()=>{"grid"===e.view?e._scrollContent.classList.remove("smart-hidden"):e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("beginEdit",(()=>{e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("endEdit",(()=>{e._scrollContent.classList.remove("smart-hidden")})),e._scrollContent.ontouchend=()=>{e._mobileDownTime=null},e._scrollContent.ontouchmove=t=>{if(t.stopPropagation(),!e._scrollContentScroll&&e.selection.enabled&&e.selection.allowDragSelection&&e.selection.allowCellSelection&&e._mobileDownDataField&&void 0!==e._mobileDownId&&e._mobileDownTime&&new Date-e._mobileDownTime>=800){const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,pageX:t.changedTouches[0].pageX,pageY:t.changedTouches[0].pageY});e._mobileSelect=!0,e._dragSelection(o("mousemove")),e._mobileSelect=!1,t.preventDefault()}},e._scrollContent.selectstart=e=>{e.stopPropagation(),e.preventDefault()},e._scrollContent.ontouchstart=e=>{e.stopPropagation()},e._scrollContent.onpointerup=t=>{if(e._dragSelectionStartDataField=null,e._dragSelectionStartRow=null,e._mobileDownDataField&&void 0!==e._mobileDownId){let o=null,l=null;const a=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);for(let t=0;t<a.length;t++){const n=a[t];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const t=n.closest("smart-grid-cell").cell;l=t.row.id,o=t.column.dataField;break}}new Date-e._mobileDownTime>=1e3&&e.editing.enabled&&e.selection.enabled&&e.selection.allowCellSelection&&o===e._mobileDownDataField&&l===e._mobileDownId&&e.beginEdit(e._mobileDownId,e._mobileDownDataField),e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null,t.preventDefault(),t.stopPropagation()}},e._scrollContent.onpointerdown=t=>{e._scrollContentScroll=!1;const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY});setTimeout((()=>{if(e._scrollContentScroll)e._hideActionButtons();else{const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);if(l[2]){if(e.selection.enabled&&e.selection.allowCellSelection){const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null;for(let a=0;a<l.length;a++){const n=l[a];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const a=n.closest("smart-grid-cell").cell;return e._mobileDownTime=new Date,e._mobileDownId=a.row.id,e._mobileDownDataField=a.column.dataField,e._dragSelectionStartDataField=a.column.dataField,e._dragSelectionStartRow=a.row,e._mobileSelect=!0,l[2].dispatchEvent(o("pointerdown")),e._mobileSelect=!1,t.stopPropagation(),void t.preventDefault()}}}if(l[2].classList.contains("smart-grid-add-row-button"))e._hideActionButtons(),l[2].dispatchEvent(o("click"));else if(l[2].classList.contains("smart-summary-placeholder")||l[2].classList.contains("summary-value-part"))e._hideActionButtons(),l[2].dispatchEvent(o("pointerup"));else if(l[2].closest("smart-menu-item")){e._hideActionButtons();const t=l[2].closest("smart-menu-item");l[2].closest("smart-menu")._menuItemSelectionHandler(t)}else{if(l[2].dispatchEvent(o("pointerdown")),e._lastMobileClickRange){const o=e._lastMobileClickRange;let l=!0;o.left<=t.pageX&&o.left+o.right>=t.pageX&&(l=!1),l&&e._hideActionButtons()}else e._hideActionButtons();const a=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=e.offset(l);if(n.left<=t.pageX&&n.left+a.width-6>=t.pageX){if(!e.hasColumnMenu(o))return;e._lastMobileClickRange={left:n.left,right:n.left+a.width-6},l._showActionButton()}else l._hideActionButton()}};for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t];a(o.column,o)}}}}}),300),t.stopPropagation()};let t=0;const o=()=>{const t=e._scrollContent.scrollLeft,o=e._scrollContent.scrollTop;e._scrollView.vScrollBar.value=o,e._scrollView.hScrollBar.value=t,e._scrollContentScroll=!0};e._scrollContent.onscroll=()=>{cancelAnimationFrame(t),t=0,t=requestAnimationFrame(o)},e._scrollContentView=document.createElement("div"),e._scrollContentView.style.width=e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e._scrollView.scrollHeight+"px",e._scrollContent.appendChild(e._scrollContentView),e.$.scrollView.appendChild(e._scrollContent)}}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&(e.header.buttons.indexOf("views")>=0||e.header.buttons.indexOf("states")>=0)&&e._updateKanbanTaskFields()),e._setupMobile(),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,id:e.dataSourceSettings.id,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),e._initFormulaParser(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale;let o=e.$.header;e.header.appendTo&&(o=document.querySelector(e.header.appendTo),o?o.onclick=t=>{e._headerClickHandler(t)}:o=e.$.header),o.appendChild(t),e.$.headerBar&&e.$.headerBar.remove(),e.$.headerBar=o.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{let t=!1;if(e.stateSettings.autoLoad){let o=e.stateSettings.current;!o&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,o=e.stateSettings.current);let l=null;e.stateSettings.storage&&(l=e.stateSettings.storage[o]),l&&(t=!0),!l&&e.stateSettings.allowLocalStorage&&(l=window.localStorage.getItem(o),l&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],l=e.filtering.filter[1];let a=null;if(o&&(a=e.dataSource._createFilter(o.dataType,l)),a){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}e.addFilter(t,a,!1)}break}const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}if(a){if(e.filtering.filterRow.visible){const o=e.columnByDataField[t];if(!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}}e.addFilter(t,a,!1)}}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;if(t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let o=0;o<t.filters.length;o++)e.push(t.filters[o].value),o<t.filters.length-1&&e.push(t.logicalOperators[o]);o._filterInfo={condition:t.filters[0].condition,value:e.join(" ")}}e.addFilter(o.dataField,t,!1)}}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e.filtering.enabled&&e.filtering.filterRow.visible&&e._refreshFilterRowEditors(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view?e._initKanbanView():"scheduler"===e.view&&e._initSchedulerView()}_initFormulaParser(){const e=this;if(e.formulas){class t{constructor(e){const t=this;let o;try{o=new formulaParser.Parser}catch(e){throw new Error("Smart.FormulaParser: Missing reference to 'formula-parser.min.js'.")}o.on("callCellValue",t._callCellValue.bind(t)),o.on("callRangeValue",t._callRangeValue.bind(t)),t.dataTable=e,t.parser=o}_getFormula(e){const t=this,o="A".charCodeAt(0);let l=0,a="";const n=e;if(t.dataTable._formulas||(t.dataTable._formulas=[]),t.dataTable._formulas[e])return t.dataTable._formulas[e];for(let n=0;n<t.dataTable.columns.length;n++){const i=t.dataTable.columns[n],r=String.fromCharCode(o+l);l++,l>=26&&(l=0,a+="A"),e.indexOf(i.label)>=0?e=e.replaceAll(i.label,a+r):e.indexOf(i.dataField)>=0&&(e=e.replaceAll(i.dataField,a+r))}return t.dataTable._formulas[n]=e,e}_callCellValue(e,t){const o=this,l=o.dataTable,a=e.column.index,n=e.row.index,i=l.columns[a].dataField;let r=l.dataSource[n][i];const s=l.rows[n];if(s){const e=s.getCell(i);e&&e.formula&&(r=o._getFormula(e.formula))}"string"==typeof r&&/=.+/.test(r)?r=o.parse(r.slice(1)):"string"==typeof r&&"number"===l.columns[a].dataType&&(r=parseFloat(r)),t(r)}_callRangeValue(e,t,o){const l=this.dataTable,a=l.dataSource,n=[];for(let o=e.row.index;o<=t.row.index;o++){const i=a[o],r=[];for(let o=e.column.index;o<=t.column.index;o++){let e=i[l.columns[o].dataField];e=isNaN(e)?0:parseFloat(e),isNaN(e)&&(e=0),r.push(e)}n.push(r)}n&&o(n)}parse(e){const t=this.parser.parse(this._getFormula(e));return null!==t.result?t.result:t.error}}e._formulaParser=new t(e)}}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(e){const t=this,o=t.conditionalFormatting;if(!o||0===o.length)return;if(!t._defaults){const e=getComputedStyle(t);t._defaults={fontFamily:e.fontFamily,fontSize:e.fontSize,text:t._toHex(e.color),highlight:t._toHex(e.backgroundColor)}}t._formatter||(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource)),e&&(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource),delete t._conditionalFormatting);const l=t._defaults,a=t._formatter,n=[],i=function(e){if("all"===e){if(t.columns&&t.columns.map){const e=[];for(let o=0;o<t.columns.length;o++){const l=t.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||e.push(l.dataField)}return e}return[]}return[e]};for(let e=0;e<o.length;e++){o[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},o[e]);const t=o[e],r=i(t.column),s=t.condition;a.color=t.highlight,a.comparator=t.firstValue,a.min=t.firstValue,a.max=t.secondValue;const d=a.format(s,r);for(let e in d){const o=d[e];for(let e in o){const l=o[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=o),0===n.length)return n[0];const r={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){r[e]||(r[e]={});for(let t in o)r[e][t]=Object.assign({},r[e][t],o[t])}}}t._conditionalFormatting=r,e&&t._recycle(!1)}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),e.appearance.showRowComments&&(l=25,t.minWidth=25),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));delete a.grid,delete a.dataType,delete a.index,delete a.visibleIndex,n.grid=e,e.columns.push(n),n._dataField&&(e.columnByDataField[n._dataField]=n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.$.content.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);e.rowDetailColumn=a,"near"===e.rowDetail.position?(e.viewColumns.splice(l,0,a),o.freeze="near",a.freeze="near",e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30});new Smart.Observable(a,a.observables).canNotify=!1;const n=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),i=new Smart.Observable(n,n.observables);i.canNotify=!1,e.editing.commandColumn.visible&&("near"===e.editing.commandColumn.position?(n.freeze="near",i.freeze="near",e.viewColumns.splice(l,0,i),e._frozenNearColumns.splice(l,0,i)):(e.viewColumns.push(i),e._frozenFarColumns.splice(0,0,i))),e._commandColumn=i;const r=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(r,r.observables);if(e.selection.checkBoxes.enabled&&("near"===r.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s))),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}if(t._renderColumns(),t.__columnHeaderHeight=null,e){t.beginUpdate();const o=t.context;t.context=document;for(let o=0;o<e.length;o++){const l=e[o],a=t.columnByDataField[l.dataField];["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","sortIndex","sortOrder","sortComparator","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"].forEach((e=>{void 0!==l[e]&&(a[e]=l[e])}))}t.context=o,t.endUpdate(!1)}t.refresh()}onAttached(){const e=this;if(!e._scrollView){e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar);const t=e._scrollView.hScrollBar;e._scrollView.vScrollBar.onChange=e._verticalScrollbarHandler.bind(e),t.onChange=e._horizontalScrollbarHandler.bind(e)}if(e.isRendered&&e.isCompleted&&(e._isDestroyed||e.behavior.autoDestroy)){if(e.header.visible&&""===e.header.template){let t=e.$.header;e.header.appendTo&&(t=document.querySelector(e.header.appendTo),t?t.onclick=t=>{e._headerClickHandler(t)}:t=e.$.header),t.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',e.$.headerBar=t.firstElementChild;const o=e.$.headerBar;o.messages=e.messages,o.locale=e.locale,e.$.headerBar._init(e),o.render(),e.header.onInit&&e.header.onInit(e.$.headerBar)}e._render()}}destroy(){const e=this;if(!e.isRendered)return;e._isDestroyed=!0,["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.$.headerBar;if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection&&e._selection.selectionRect&&(e._selection.selectionRect.parentNode&&e._selection.selectionRect.parentNode.removeChild(e._selection.selectionRect),e._selection.selectionRect=null),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}onDetached(){const e=this;e.behavior.autoDestroy&&e.destroy()}_observeColumns(){const e=this,t=function(t,o,l,a){if(l!==a||"selected"===o){if(null==l&&null==a)return;if(l&&"object"==typeof l&&Array.isArray(l)&&a&&"object"==typeof a&&Array.isArray(a)&&JSON.stringify(l)===JSON.stringify(a))return;t.propertyChanged(o,l,a),e.onColumnChange?t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a):e.$.fireEvent("columnChange",{column:t,propertyName:o,oldValue:l,value:a})}};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l.grid=e,l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===l.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:l.dataField,dataType:l.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l){if(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),l._dataField){const t=e.columnByDataField[l._dataField];t&&t.dataField===l.dataField&&delete e.columnByDataField[l._dataField]}delete e.columnByDataField[l.dataField]}if(e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),"card"===e.view&&(t=0),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,e._hScrollTimer&&clearTimeout(e._hScrollTimer),e._hScrollTimer=setTimeout((()=>{e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelNative(e,t){const o=this;void 0===o._scrollWheelContent&&(o._scrollWheelContent=document.createElement("div"),o._scrollWheelContent.style.width="100%",o._scrollWheelContent.style.height="100%",o._scrollWheelContent.style.position="absolute",o._scrollWheelContent.style.left="0px",o._scrollWheelContent.style.top="0px",o._scrollWheelContent.style.background="white",o._scrollWheelContent.style.zIndex=9999,o._scrollWheelContent.style.opacity=0,o._scrollWheelContent.style.overflow="auto",o._scrollWheelContent.style.visibility="hidden");let l=0;const a=()=>{if(t){const t=o._scrollWheelContent.scrollLeft;o._scrollView.hScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}else{const t=o._scrollWheelContent.scrollTop;o._scrollView.vScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}};o._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(a)},o._scrollWheelContentView||(o._scrollWheelContentView=document.createElement("div"),o._scrollWheelContent.appendChild(o._scrollWheelContentView)),o._scrollWheelContentView.style.width=o.offsetWidth+o._scrollView.scrollWidth+"px",o._scrollWheelContentView.style.height=o.offsetHeight+o._scrollView.scrollHeight+"px",o.$.scrollView.appendChild(o._scrollWheelContent),o._scrollWheelContent.scrollTop=o._scrollView.vScrollBar.value,o._scrollWheelContent.scrollLeft=o._scrollView.hScrollBar.value,!0===t?o._scrollWheelContent.scrollTo({top:o._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):o._scrollWheelContent.scrollTo({top:e,left:o._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating)return;if(t.editing.isEditing)return;if(!t.behavior.allowMouseWheel)return;const o=t.querySelector("smart-grid-toolbar");if(o&&o.$.headerDropDown.classList.contains("open"))return;let l=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(l=!0):0===e.deltaMode&&(l=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let o=160;const a=0===e.deltaX?e.wheelDelta:e.deltaX;a<0&&(o=-160),Math.abs(a)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+o,!0):t._scrollView.scrollLeft+=a}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=15*t.layout.rowMinHeight;if(e.deltaY<=0&&(a=-15*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+a);else{t._wheelrafId=0;const o=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(o)}}}_refresh(e){const t=this;if(t._isUpdating)return;const o=t.$.verticalScrollBar.offsetWidth;t.removeAttribute("grouped"),t.removeAttribute("tree");let l=!0;t.__autoHeightRows&&(t.__autoHeightRows=null,t._refreshColumnsResponsiveVisibility(),t._recycle(),l=!1),t._groups||(t._groups=[]),t._cellCachedValues=[],t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>=0&&("advanced"===t.grouping.renderMode?t.setAttribute("grouped",""):t.setAttribute("tree",""),t._groups||(t._groups=[].concat(t.dataSource.groupBy.toArray())||[]),t._renderGroupBar()),t.grouping.enabled&&t.dataSource.groupBy&&0===t.dataSource.groupBy.length?t.$.breadcrumb&&(t.$.breadcrumb.dataSource=[]):t.dataSource.boundHierarchy&&(t.setAttribute("tree",""),t.$.content.setAttribute("role","treegrid"),t.$.container.removeAttribute("role")),(t.isInitialized||l)&&t._refreshColumnsResponsiveVisibility(),t._refreshLayout(),o!==t.$.verticalScrollBar.offsetWidth&&(t.__scrollWidth=null,t._refreshColumnsResponsiveVisibility(),t._refreshScrollBars(),0===t.$.verticalScrollBar.offsetWidth&&t.isRendered&&requestAnimationFrame((()=>{t._refreshScrollBars()}))),t._refreshSelection(),t._deleteCopyRects(),t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update(),"add"===e||"remove"===e||"update"===e?(t._rowChangeTimeout&&clearTimeout(t._rowChangeTimeout),"remove"===e?(t._recycle(!1),t._refreshHeaderBar()):t._rowChangeTimeout=setTimeout((()=>{t._recycle(!1),t._refreshHeaderBar()}),100)):(t._recycle(),t._refreshHeaderBar()),t._recyclingRows&&0===t._recyclingRows.length&&(t.$.placeholder.classList.remove("smart-hidden"),t.scrollHeight=0,t.$.placeholder.innerHTML=t.messages[t.locale]&&t.messages[t.locale].placeholder?t.localize("placeholder"):t.appearance.placeholder,t.filtering.filterRow.visible&&(t.$.placeholder.style.top="0px",t.$.placeholder.style.position="relative",t._filters&&t._filters.length&&(t.$.placeholder.style.top="12px")),t._filters&&t._filters.length&&(t.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${t.localize("filteredRecords")}`)),t.dataSource&&t.dataSource.boundHierarchy&&t.conditionalFormatting&&t._renderConditionalFormatting(!1),t.filtering.enabled&&t.filtering.filterRow.visible&&(t._suspendFilterRowRefresh||t._refreshFilterRowEditors(),t._recycle(!1)),requestAnimationFrame((()=>{t._width=t.offsetWidth,t._height=t.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return t._undoRedo=[],t._refreshCurrentUser(),void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return void(!1===t._resizeHandling&&(t.layout.isDirty=!0));t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view&&"card"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,c=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(c+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===c&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=c,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t._mobile&&e.preventDefault(),t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible&&!e.header.appendTo),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1)}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,l){for(let c=0;c<t.length;c++){const u=t[c];let m=o.rowById[u.$.id];if(n&&(m=o.rows[s],m||(m=r(u),o.rows.push(m)),u[i.leaf]?m.id=u.$.id:m.id="Group_"+u.$.id,o.rowById[m.id]=m),m||(m=r(u),o.rowById[m.id]=m),m.data=u,m.leaf=u[i.leaf]||!1,m.level=u[i.level],m.groupDataField=u.groupDataField,o.hasAttribute("tree")&&o.dataSource&&o.dataSource.childrenDataField&&(m.index=s),!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=u.label,m.groupDataField){const e=o.columnByDataField[m.groupDataField];if(e&&e.editor.dataSource)for(let t=0;t<e.editor.dataSource.length;t++){const o=e.editor.dataSource[t];if(""+o.value===m.label){void 0!==o.label?(m.label=o.label,m.labelValue=o.value):void 0!==o.name&&(m.label=o.name,m.labelValue=o.value);break}}}if(m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),u.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),u.parent?(m.parent=o.rowById[u.parent.$.id],m.parentId=u.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(u);e&&(m.expanded=u[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==u[i.expanded]&&(m.expanded=u[i.expanded]);let p=!!e||m.expanded;a&&(p=!0);const g=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(g&&!m.data[g]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];u.parent&&u.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[g])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,p||u[i.leaf])if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let c=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<c.length;o++){let l=c[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;!a&&null!==a||0!==l.level||l.parent||(t(l.children).length,e.push(l))}c=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}const u=o.rows.canNotify;o.rows.canNotify=!1,o.rowHierarchy=d(c,new Array),o.rows.canNotify=u;let m=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&m.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=m),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow){o._initializeRowElements();let e=0,t=o.rows.canNotify;o.rows.canNotify=!1;for(let t=0;t<o.rowHierarchy.length;t++){const l=o.rowHierarchy[t],a=o.layout.rowHeight||o.layout.rowMinHeight;void 0===l.top&&(l.top=e,l.height=l.cellHeight=a),l.height?e+=l.height:e+=a}o.rows.canNotify=t,o._recycle(!1,!0)}if(o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||e.layout.autoHeight||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&!e.header.appendTo&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible&&!e.header.appendTo?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible,e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible&&!e.header.appendTo?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&!e.header.appendTo&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown)e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft="";else{const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e._mobile||(e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px"),e.$.viewBar.style.width=o+"px";let l=0;e.header.visible&&!e.header.appendTo&&(l+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(l+=e.$.groupHeader.offsetHeight),e.pager.visible&&(l+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=l+"px",e.$.viewBar.style.height=t+"px"}}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshAutoSize(){const e=this;if(e.layout.autoWidth){const t=e._isUpdatingScrollBars;e._isUpdatingScrollBars=!0;let o=2;for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];l.visible&&(o+=l.computedWidth)}o+=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,e.style.width=o+"px",requestAnimationFrame((()=>{e._isUpdatingScrollBars=t}))}e.layout.autoHeight&&(e.style.height="auto")}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshAutoSize(),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),"card"===e.view&&(e.__columnHeaderHeight=0),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value,e._refreshLayout(),e._refreshSelection(),e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("pageIndexChange"):(e._recycle(),e._scrollUpdate&&clearTimeout(e._scrollUpdate),e._scrollUpdate=setTimeout((function(){e.isScrolling||(e.$.rowContainer.style.top=parseInt(e.$.rowContainer.style.top)+.01+"px")}),50))})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),c=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=c,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility?(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden"),e.$.scrollView.classList.add("has-vscroll")):e.$.scrollView.classList.remove("has-vscroll"),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px"),e.filtering.enabled&&e.filtering.filterRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||c>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-c+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",c+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",c+e.__scrollBarSize+"px"))),t.refresh(),o.refresh(),e._mobile&&(e._scrollContentView.style.width=e.$.scrollView.offsetWidth+e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e.$.scrollView.offsetHeight+e._scrollView.scrollHeight+"px")}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getData(){const e=this;if(!e.dataSource)return[];const t=[];for(let o=0;o<e.dataSource.length;o++){const l=e.dataSource[o];if(l.$){const o={};for(let t=0;t<e.dataSource.dataFields.length;t++){const a=e.dataSource.dataFields[t].name;o[a]=l[a]}t.push(o)}else t.push(l)}return t}getDataFields(){const e=this;return e.columns?e.columns.map((e=>e.dataField)):[]}getColumns(){const e=this,t=[];if(!e.isInitialized)return t;if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}resetState(e=!0){const t=this;t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border",t._conditionalColors.update=()=>{}),t.$.headerBar&&delete t.$.headerBar._appliedColors,delete t._labeledBy,delete t._dateStackedBySelect,t.highlighted=null,t.columns.canNotify=!1;let o=[],l=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.visible=!0,a.width=180,a.freeze=!1,a.index>=0?o[a.index]=a:o.push(a),a.index!==e&&(l=!0)}l&&(t.columns=o),"grid"!==t.view&&e&&(t.view="grid",t._hideKanbanView(),t._hideSchedulerView()),t.columns.canNotify=!0,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.$.headerBar&&t.$.headerBar._setView&&"grid"===t.view&&t.$.headerBar._setView("grid"),t._kanban&&t._kanban._reset(),t.layout.isDirty=!0,t.endUpdate(),l&&(t._renderColumns(),t._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;t.stateSettings.loading=!0;let l=!1,a=!1,n=!1;if("grid"===e.view||"card"===e.view||void 0===e.view){if(e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const l=[];if(e.groups){t.dataSource.groupBy=e.groups,t._groups=[].concat(t.dataSource.groupBy.toArray())||[],t._refreshRowHierarchy();for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}else if(t.grouping.enabled&&t.dataSource.groupBy.length)for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0);t.dataSource&&(t.dataSource._expandedRowIds=l)}else if(e.groups&&e.groups.length){o=!0,t.beginUpdate();const l=[];t.dataSource&&(t.dataSource._expandedRowIds=l),e.groups&&(t.dataSource.groupBy=e.groups,t._refreshRowHierarchy())}else if(e.groups&&0===e.groups.length&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0){o=!0,t.beginUpdate();const e=[];t.dataSource&&(t.dataSource._expandedRowIds=e),t.dataSource.groupBy=[],t._refreshRowHierarchy(),a=!0}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());let a=[];for(let o=0;o<e.columns.length;o++){const i=e.columns[o];if(i.dataField){const e=t.columnByDataField[i.dataField];if(e){const r=e.canNotify;e.canNotify=!1,i.width?e.width=i.width:e.width=180,e.sortOrder="",e.sorted="",a.push(e),e.index!==o&&(n=!0),e.visible=void 0===i.visible||i.visible,e._state&&(e._state.visible=void 0===i.visible||i.visible,e._state.freeze=void 0!==i.freeze&&i.freeze,e._state.width=i.width?i.width:180);const s=e.freeze;e.freeze=void 0!==i.freeze&&i.freeze,s!==e.freeze&&(l=!0,e.freeze||t._frozenNearColumns.indexOf(e)),e.canNotify=r}}}n&&(t.columns=a)}}if(e.colors&&(t._conditionalColors=JSON.parse(JSON.stringify(e.colors)),t.$.headerBar)){let l=[];if(e.colors.conditions)for(let t=0;t<e.colors.conditions.length;t++){let o=e.colors.conditions[t],a=[];for(let e in o)a.push(o[e]);l.push(a)}o||(o=!0,t.beginUpdate());const a={type:e.colors.type,singleSelect:e.colors.singleSelect,decorate:e.colors.decorate};t.$.headerBar._appliedColors=[l,a],t._conditionalColors.update=e=>{t.$.headerBar._updateConditionalColors(e,t,a)}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const l=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let a=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=a;for(let o in e.sort){const l=e.sort[o];if(l){const e=l.sortOrder,a=l.dataField?l.dataField:o,n=t.columnByDataField[a];n&&t.sortBy(n.dataField,e)}}t.appearance.allowSortAnimation=l}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){let l=o,a=e.filter[l];if(e.filter[0]&&(l=e.filter[o].dataField,a=e.filter[o].filter),a){t.addFilter(l,a,!1);const e=t.columnByDataField[l];e&&e._filterInfo&&e.filter&&e.filter.filters&&e.filter.filters[0]&&(e._filterInfo.value=e.filter.filters[0].value,e._filterInfo.condition=e.filter.filters[0].condition)}}if(t.filtering.filterRow)for(let e=0;e<t.columns.length;e++)t.columns[e]._filterEditorInitialized&&(t.columns[e]._filterEditorInitialized=!1)}if(e.selectedCells&&(o||(o=!0,t.beginUpdate()),t.selectCellsById(e.selectedCells)),e.selectedRows&&t.selectRows(e.selectedRows),e.labeledBy&&(t._labeledBy=e.labeledBy),o){t.endUpdate(!1,!1);let o=!1;e.view&&"kanban"===e.view&&(o=!0),(l||n)&&(o=!1,a=!0,t._renderColumns()),o||(a?t.refresh(!0):t._refresh())}let i=!1;if(e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(i=!0),t._stackedBy=e.kanban.stackedBy),e.scheduler&&e.scheduler.stackedBy&&(void 0===t._dateStackedBy&&(t._dateStackedBy=e.scheduler.stackedBy),t._dateStackedBy!==e.scheduler.stackedBy&&(i=!0),e.scheduler.labeledBy&&(t._labeledBy=e.scheduler.labeledBy),e.scheduler.viewType&&(t._schedulerViewType=e.scheduler.viewType),void 0===t._dateStackedBySelect&&(t._dateStackedBySelect=e.scheduler.groupBy),t._dateStackedBySelect!==e.scheduler.groupBy&&(i=!0),t._dateStackedBy&&Array.isArray(t._dateStackedBy)&&e.scheduler.stackedBy&&Array.isArray(e.scheduler.stackedBy)&&JSON.stringify(t._dateStackedBy)===JSON.stringify(e.scheduler.stackedBy)&&(i=!1),t._dateStackedBy=e.scheduler.stackedBy),(i||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&(e.name&&(t.stateSettings.current=e.name),t.$.headerBar._setView(e.view,!0)),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.selectedCells){const o=[];let l=99999999,a=null,n=99999999,i=null,r=99999999,s=null;for(let l=0;l<e.selectedCells.length;l++){const a=e.selectedCells[l],d=a[0],c=a[1],u=t.columnByDataField[c];if(u&&(n=Math.min(n,u.index),i=Math.max(i,u.index)),!t.rowById[d])continue;const m=t.rowById[d].visibleIndex;m>=0&&(r=Math.min(r,m),s=Math.max(s,m)),o[d]||(o[d]=[]),o[d].push(c)}let d=0,c=!0;for(let e in o){const t=o[e];if(d&&t.length!==d){c=!1;break}d=t.length}if(c){const e=t.getRows(),o=e[r],d=e[s];if(l=o?o.id:-1,a=d?d.id:-1,o){const e=t.columns[n];if(e){const o=t.rowById[l].getCell(e.dataField);t._selection.focusedCell={id:o.row.id,value:o.value,dataField:o.column.dataField,index:o.row.index},setTimeout((()=>{t._selectCellsRange(t.rowById[l],t.rowById[a],t.columns[n].dataField,t.columns[i].dataField)}),50)}}}}e.name&&(t.stateSettings.current=e.name),t._refreshHeaderBar(),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border"),delete t._labeledBy,delete t._dateStackedBySelect,t.$.headerBar&&delete t.$.headerBar._appliedColors,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let l=o.getCurrentState(),a=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",l&&a)for(let e in a)l[a[e]]=n[a[e]];else l=n;function r(e,t=0,o=10){if(t>o)return"Object";const l={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let a in e){let n=e[a];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){l[a]=n;continue}if(n&&Array.isArray(n)&&0===n.length){l[a]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==a&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}l[a]=n}return t?l:JSON.stringify(l)}l.name=i,o.stringify_object=r;const s=r(l);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]&&!l.date&&o.stateSettings.storage[o.stateSettings.current].date?l.date=o.stateSettings.storage[o.stateSettings.current].date:l.date=(new Date).toJSON(),o.stateSettings.storage[o.stateSettings.current]=l,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)||o.stateSettings.onStateChange&&o._forceStateChange?o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r):o.stateSettings.onStateChange&&"grid"!==o.view&&o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r),l}autoSaveState(){const e=this;e._savingState&&clearTimeout(e._savingState),e._savingState=setTimeout((()=>{if(!e.stateSettings.current&&e.stateSettings.autoSave&&!e.stateSettings.loading){const t=e.stateSettings.storage;if(t&&0===Object.keys(t).length||!t){let t=e.localize("newGrid")+" "+e.localize("view");"kanban"===e.view?t=e.localize("newKanban")+" "+e.localize("view"):"card"===e.view?t=e.localize("newCard")+" "+e.localize("view"):"scheduler"===e.view&&(t=e.localize("newScheduler")+" "+e.localize("view")),e.stateSettings.current=t}}e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}),50)}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}setColors(e,t){const o=this;o._conditionalColors={type:t.type,decorate:t.decorate,conditions:e,singleSelect:t.singleSelect},o.$.headerBar.addColors(JSON.parse(JSON.stringify(e)),{type:t.type,singleSelect:t.singleSelect,decorate:t.decorate},[]),o._recycle(!1)}getColors(){const e=this;if(e._conditionalColors){const t=JSON.parse(JSON.stringify(e._conditionalColors));return{type:t.type,conditions:t.conditions,filters:t.filters,colors:t.colors,decorate:t.decorate,singleSelect:t.singleSelect}}return null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,l=!e||e&&e.includes("filter")?t.getFilteredColumns():null,a=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells(!1):null,i=!e||e&&e.includes("selection")?t.getSelectedRowIds():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null,s=!e||e&&e.includes("colors")?t.getColors():null;let d=0;r&&(d=r.pagesCount);const c={count:d,index:t.paging.pageIndex,size:t._pageSize},u={};o&&o.length&&(u.sort=o),l&&l.length&&(u.filter=l),a&&a.length&&(u.groups=a),c&&t.paging.enabled&&(u.paging=c),n&&n.length&&(u.selectedCells=n),i&&i.length&&(u.selectedRows=i),s&&(delete s.colors,u.colors=s),t._labeledBy&&(u.labeledBy=t._labeledBy),(t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"===t.view&&(u.kanban=t.getKanbanState()),"scheduler"===t.view&&(u.scheduler=t.getSchedulerState()),u.view=t.view);const m=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&m.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}u.columns=m}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}Object.values(e).length&&(u.expandedRows=e)}if((t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"!==t.view&&"scheduler"!==t.view||(delete u.expandedRows,delete u.columns,delete u.paging,delete u.selectedCells,delete u.selectedRows)),e){const t={};for(let o in e){const l=e[o];u[l]&&(t[l]=u[l])}return t}return u}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,t,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),o.column.element.setAttribute("level",o.level),0===o.columns.length&&o.column.element.classList.add("smart-hidden");const l=o.collapseButton;l&&o.column.element.appendChild(l),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let o in e._cachedTemplates)t.appendChild(e._cachedTemplates[o]);e._tableCachedTemplates.appendChild(t)}}_recycle(e,t,o,l){const a=this;if(a._layoutSuspended||!1===a.isAttached)return;if(a._isUpdating)return;if(a.editing.isEditing&&(!0===a._disableEndEdit||a.editing.dialog.visible||a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects();const n=a._scrollView.scrollTop;let i,r=l||a._getRowIndexByPosition(n),s=a._recyclingRows,d=s[r],c=d?d.top:0,u=0,m=0,p=0,g=0;if(a._cellRowSpan&&a._cellRowSpan.maxSpan>0){let e=0;if(r>=5?e=5:r>=4?e=4:r>=3?e=3:r>=2?e=2:r>=1&&(e=1),e>0){const t=s[r-e];t&&(d=t,c=d?d.top:0,p=e*d.height,r-=e)}}a._cellRowSpan=[];for(let e=0;e<a._cellsMerge.length;e++){const t=a._cellsMerge[e],o=s.indexOf(t.row);if(r>o&&r<=o+t.rowSpan&&(r=o,d=t.row,p=Math.max(p,c-d.top),c=d.top,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px"),t.colSpan>1)for(let e=0;e<a.viewColumns.length;e++){const o=a.viewColumns[e];let l=o.autoGenerated?o:a.columnByDataField[o.dataField];if(l.visible&&l.left+l.computedWidth-a._scrollView.scrollLeft>=u&&l.left-l.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){let e=a.columnByDataField[t.column.dataField];g=Math.max(g,l.left-e.left+l.computedWidth);break}}}a.isHScrolling&&a._clearCachedTemplates();let h=null;if(!1!==e||a._cellsMerge.length>0){if(a._columnElements)for(let e=0;e<a._columnElements.length;e++){const t=a._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<a._columnGroups.length;e++){const t=a._columnGroups[e],o=t.element;o&&(a.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px")}a._firstVisibleColumn=null,a._firstVisibleUserColumn=null,a._lastVisibleColumn=null;for(let e=0;e<a.viewColumns.length;e++){let t=a.viewColumns[e];if(t.visible&&(a._firstVisibleColumn||(a._firstVisibleColumn=t),a._firstVisibleUserColumn||t.autoGenerated||(a._firstVisibleUserColumn=t),a._lastVisibleColumn=t),t.element&&(t===a._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),!1!==a.appearance.showColumnGroupCellLines&&!1!==a.appearance.showColumnGroupLines||(t.parent&&t.parent.columns&&t.parent.columns[0].dataField===t.dataField?t.element.setAttribute("column-group-first-child",""):t.parent&&t.element.removeAttribute("column-group-first-child")),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-a._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){a._columnElements||(a._columnElements=[]);const o=a._columnElements[m++];o&&(o.set("column",t,!1),o.parentNode||a.$.columnContainer.appendChild(o),h||(h=t,a._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===i&&(i=t.left))}}}if(void 0===i&&(i=0),a.rightToLeft){const e=a._scrollView.scrollWidth-a._scrollView.scrollLeft-a._scrollView.vScrollBar.offsetWidth;a.$.columnContainer.style.right=e+"px",e<=0&&!a._scrollView.scrollWidth&&(a.$.columnContainer.style.right=-a.offsetWidth+a._computedColumnsWidth+"px")}else a.$.columnContainer.style.left=-a._scrollView.scrollLeft+"px";if(a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.isScrolling&&!a.isHScrolling&&(a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!a._rowElements)return;const f=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&a.dataSource.length>a.virtualModeCachedRowsCount&&"infinite"!==a.scrolling;let y=0,w=a.behavior.allowRenderCache&&!f&&"grid"===a.view&&!a.dataSource.virtualDataSourceOnExpand&&!a.rowDetail.template&&!a.rowDetail.enabled&&!a._autoHeight&&!a.pager.visible&&!a._frozenFarColumns.length&&!a.hasAttribute("tree");if("grid"!==a.view)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];t.style.transform="",t.style.top="",t.style.position=""}if(r>=0){m=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;if(f&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(n),c=t*a.rows[0].height,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.paging.enabled||(r=0)),a.paging.enabled&&(t=a.paging.pageIndex*a._pageSize)),"card"===a.view&&a._cardHeight&&(e+=a._cardHeight),w)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];delete t.isRendered,t.classList.remove("smart-hidden"),t.classList.remove("aria-rowindex"),t.style.transform="",t.style.top="",t.style.position=""}if(w){let e=Math.max(a._clientSize.height,a._overflowOffset),o=[],l=c;for(let t=r;t<s.length;t++){const i=s[t];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),l+r>=n-p&&l<=n+e||a._autoHeight){for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];if(t.hasAttribute("data-id")&&t.getAttribute("data-id")===""+i.id){o[i.id]=t,t.isRendered=!0;break}}l+=r}}e=Math.max(a._clientSize.height,a._overflowOffset);for(let l=r;l<s.length;l++){const i=s[l];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),c+r>=n-p&&c<=n+e||a._autoHeight){let e;if(e=a._rowElements[m++],!e)break;for(;e&&e.isRendered;)e=a._rowElements[m++];if(!e){console.log("Did not found a row element during the rendering.");continue}e.setAttribute("aria-rowindex",t+l+1);let n=!1;if(i.element=e,i.grid=a,o[i.id]){const a=o[i.id];a.hasAttribute("data-id")&&a.getAttribute("data-id")===""+i.id&&(a===e&&(a.isRendered=!0,n=!0,m=0),n=!0,m=0,i.element=a,e.style.top="999999px",e.setAttribute("data-id",999999),e.setAttribute("aria-rowindex",t+l+1),e=a,a.isRendered=!0)}e.style.top=y+"px",e.style.position="absolute",i.render(n),e.isRendered=!0,c+=r,y+=r}}}else{a.rowDetail.enabled&&(e+=a.offsetHeight);for(let o=r;o<s.length;o++){const l=s[o];if(0===l.height||!l.visible||!1===l.filtered||l.freeze&&l.visible)continue;const i=l.height;if(l.expandHeight&&(e+=a.offsetHeight+l.expandHeight),!(c+i>=n-p&&c<=n+e||a._autoHeight))break;{let e;if(e=a._rowElements[m++],!e)break;if(e.isRendered&&(e.classList.remove("smart-hidden"),e.classList.remove("aria-rowindex"),e.style.transform="",e.style.top="",e.style.position=""),e.setAttribute("aria-rowindex",t+o+1),l.element=e,l.grid=a,f){if(l.index=o+t,l.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=l.canNotify;l.canNotify=!1,l.selected=e.indexOf(l.index)>=0,l.canNotify=t}a.paging.enabled?(l.data=a.dataSource[r+m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l)):(l.data=a.dataSource[m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l))}l.render(),e.isRendered=!0}c+=i,y+=i}}}a._renderFrozenRows();let _=m;if(m<a._rowElements.length&&!w)for(let e=m;e<a._rowElements.length;e++){const e=a._rowElements[m++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}if(w)for(let e=0;e<a._rowElements.length;e++)if(!a._rowElements[e].isRendered){const t=a._rowElements[e];t.classList.add("smart-hidden"),t.removeAttribute("aria-rowindex")}if(a.editing.addNewRow&&a.editing.addNewRow.visible&&"row"!==a.editing.addNewRow.displayMode&&a._rowElements[_]){a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0}));for(let e=a._rowElements.length-1;e>=0;e--)if(!a._rowElements[e].isRendered){a._newRow.element=a._rowElements[e],a._newRow.element.classList.remove("smart-hidden"),a._newRow.element.style.top=y+"px",a._newRow.element.style.position="absolute",a._newRow.render();break}}f&&(a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects())}_renderFrozenRows(){const e=this;let t=!1,o=!1;if("card"===e.view)return e.$.rowNearContainer.classList.add("smart-hidden"),void e.$.rowFarContainer.classList.add("smart-hidden");0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e.filtering.filterRow.visible&&e.$.rowNearContainer.classList.remove("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||"add"===e||"update"===e||"delete"===e||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo||null,sorting:o.getSortedColumnsByDataField(),filtering:o.getFilteredColumnsByDataField(),filterOperator:o.filtering.operator,grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action){if(t&&t(e.result),o._autoHeight&&o.rows.length>=o._rowElements.length-1&&(o._initializeRows(),o._initializeRowElements(),o.refresh(),o.filtering.filterRow)){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}return}if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling){const e=o._viewRows;for(let t=0;t<e.length;t++){const l=e[t];l.data&&!l.addNewRow&&l.data.$&&(o.rowById[l.data.$.id]||(o.rowById[l.data.$.id]=l))}o._recycle(!1,!1)}else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize));const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;if(o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}localizeString(e,t,o="en"){const l=this;o&&l.messages[o][e]&&(l.messages[o][e]=t,l.refresh())}localizeStrings(e,t="en"){const o=this;t&&(Object.assign(o.messages[t],e),o.refresh())}_createInsertNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus insert",t.title=e.localize("contextMenuItemInsertRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",t.style.boxShadow="var(--smart-elevation-1)",t.style.width="16px",t.style.height="16px",t.style.fontSize="12px",t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0;const o=e.editing.addNewRow._insertButton.row;o?e.insertRow(t,1+o.visibleIndex):e._add(t),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._mobile||(e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}removeColumn(e){const t=this;let o=-1;if(e)for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){o=l;break}o>=0&&t.columns.splice(o,1)}addColumn(e,t,o=!0){const l=this;if(e){let a=-1;if(t)for(let e=0;e<l.columns.length;e++)if(l.columns[e].dataField===t){a=e,!1===o&&(a=e+1);break}if("string"==typeof e){const t=l._getKanbanTaskField(e);if(t){if(a>=0)return void l.columns.splice(a,0,t);l.columns.push(t)}return}if(a>=0&&a<l.columns.length)return void l.columns.splice(a,0,e);l.columns.push(e)}}insertColumnAfter(e,t){e&&this.addColumn(e,t,!1)}insertColumnBefore(e,t){e&&this.addColumn(e,t,!0)}addNewColumn(e){e&&this.addColumn(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.classList.add("smart-hidden"),void t.editing.addNewRow._addButton.classList.remove("show");if("grid"===t.view&&t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("smart-hidden"),"float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)&&"card"!==t.view?t.editing.addNewRow._addButton.classList.remove("float"):(!t.computedVerticalScrollBarVisibility&&t.dataSource&&0===t.dataSource.length||t.computedVerticalScrollBarVisibility&&"float"===e||"card"===t.view)&&t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="",t.grouping.enabled&&t.dataSource)&&(!(t.dataSource.groupBy&&t.dataSource.groupBy.length>0)||t.editing.addNewRow._addButton.classList.remove("show"))};t.editing.addNewRow._addButton&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),!t.editing.addNewRow.visible||"row"===t.editing.addNewRow.displayMode&&t.$.placeholder.classList.contains("smart-hidden")||(t.editing.addNewRow._addButton?requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.style.left=!t.appearance.showViewBar||t.appearance.viewBarAppendTo||t.appearance.showViewBarAsDropdown||t._mobile?"":10+t.layout.viewBarWidth+"px",o(),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),t.editing.addNewRow.visible&&!t.computedVerticalScrollBarVisibility&&t._newRow&&t.editing.addNewRow._addButton.classList.remove("show"),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"))})):(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.editing.addNewRow._insertButton=t._createInsertNewRowButton(),t.appendChild(t.editing.addNewRow._addButton),t.appendChild(t.editing.addNewRow._insertButton),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o(),(t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode||!t.computedVerticalScrollBarVisibility&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden"))&&t.editing.addNewRow._addButton.classList.remove("show"))}))))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollRecycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(!0!==o._disableEndEdit&&o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect(),o._copyRects&&o._copyRects.length&&o._refreshCopyRects();const l=o._recyclingRows;let a=l[t],n=a.top,i=!1;for(let r=0;r<o._cellsMerge.length;r++){const s=o._cellsMerge[r],d=l.indexOf(s.row);t>d&&t<=d+s.rowSpan&&(t=d,a=s.row,n=a.top,o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px",i=!0)}i||(o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px")}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if("virtual"===t.scrolling)t._recycle(!1);else{const e=t._scrollView.scrollTop;let o=t._getRowIndexByPosition(e);o!==t._scrollRowIndex?(t._recycle(!1,!0,!0,o),t._scrollRowIndex=o):t._verticalScrollRecycle(e,o)}if(t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&"card"!==t.view&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"row"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"),"grid"===t.view&&"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")}),0))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}setCellFormula(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;e.canNotify=!1,e.formula=o,e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e,t){const o=this;o.isInitialized&&(e&&(o._initializeRows(),o._initializeRowElements()),o._refresh(t),o._refreshSummary())}refreshView(e=!0){const t=this;if(t._recycleFiles=!0,!e)return t._recycle(!1,!0),void delete t._recycleFiles;t._recycle(),delete t._recycleFiles}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t,o=!0){const l=this;l._isUpdating--,l._isUpdating<0&&(l._isUpdating=0),!1!==e?l.refresh():!1!==t&&l.refreshView(o)}_generateUUID(){const e=window.crypto,t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const o=Array.from(t,(e=>e.toString(16).padStart(2,"0"))).join("");return`${o.substring(0,8)}-${o.substring(8,12)}-${o.substring(12,16)}-${o.substring(16,20)}-${o.substring(20)}`}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
66
66
  Smart("smart-menu-item",class extends Smart.BaseElement{static get properties(){return{checked:{value:!1,type:"boolean"},label:{value:"",type:"any"},level:{value:null,type:"number?"},separator:{value:!1,type:"boolean"},shortcut:{value:"",type:"string"},value:{value:null,type:"any"}}}get enableShadowDOM(){return!1}template(){return""}ready(){const e=this;if(super.ready(),e.$.addClass("smart-unselectable"),e.setAttribute("role","menuitem"),e.checked&&e.setAttribute("aria-checked",!0),!1===e.isDirty)return;const t=e.closest("smart-menu, smart-tree");t&&t.isRendered&&(cancelAnimationFrame(Smart.Menu.processTimer),Smart.Menu.processTimer=requestAnimationFrame((()=>{t._lazyInitItems()})))}propertyChangedHandler(e,t,n){const o=this;if(super.propertyChangedHandler(e,t,n),"smart-tree-item"===o.tagName.toLowerCase())return;const i=o.menu,r=o.parentItem,a=r||i;if("label"===e)return""===n?void(o.label=t):(o.setAttribute("aria-label",n),void(i&&i._setItemLabel(o,n)));if(!i)return;if("separator"===e)return void i._refreshCheckableItems(a);if("disabled"!==e||!1===n||!o.checked)return;super.propertyChangedHandler(e,t,n),o.checked=!1;const s=a.checkMode;"radioButton"===s?i._validateRadioButtonSelection(r,o.level,[]):"checkbox"!==s&&i._refreshCheckableItems(a)}}),Smart("smart-menu-items-group",class extends Smart.BaseElement{static get properties(){return{checkable:{value:!1,type:"boolean"},checked:{value:!1,type:"boolean"},checkMode:{value:"checkbox",type:"string"},dropDownHeight:{value:null,type:"number?"},expanded:{value:!1,type:"boolean"},label:{value:"",type:"any"},level:{value:null,type:"number?"},separator:{value:!1,type:"boolean"},value:{value:null,type:"any"}}}get enableShadowDOM(){return!1}template(){return""}ready(){const e=this;if(super.ready(),e.$.addClass("smart-unselectable"),e.setAttribute("role","menuitem"),e.setAttribute("aria-haspopup",!0),e.setAttribute("aria-expanded",e.expanded),e.checked&&e.setAttribute("aria-checked",!0),!1===e.isDirty)return;const t=e.closest("smart-menu, smart-tree");t&&t.isRendered&&(cancelAnimationFrame(Smart.Menu.processTimer),Smart.Menu.processTimer=requestAnimationFrame((()=>{t._lazyInitItems()})))}propertyChangedHandler(e,t,n){const o=this;if(super.propertyChangedHandler(e,t,n),"smart-tree-items-group"===o.tagName.toLowerCase())return;const i=o.menu,r=o.parentItem,a=r||i;if("label"===e)return""===n?void(o.label=t):(o.setAttribute("aria-label",n),void(i&&i._setItemLabel(o,n)));if(i&&-1!==["checkable","checkMode","disabled","separator"].indexOf(e))switch(e){case"checkable":n?o.itemContainer.setAttribute("checkable",""):o.itemContainer.removeAttribute("checkable"),i._isContainerOpened(o.container.level,o.container)&&"tree"!==i.mode&&!i._minimized&&i._closeSubContainers(o.level+2),i._updateItemRoles(o);break;case"checkMode":o.itemContainer.setAttribute("check-mode",n),i._changeToRadioButtonMode(n,o.itemContainer,o),i._updateItemRoles(o);break;case"disabled":{if(Smart.ListMenu&&i instanceof Smart.ListMenu){if(i._view)for(;o.contains(i._view);)i._backButtonClickHandler()}else i._isContainerOpened(o.container.level,o.container)&&i._closeSubContainers(o.level+1,o.container);if(!o.checked)return;o.checked=!1;const e=a.checkMode;"radioButton"===e?i._validateRadioButtonSelection(r,o.level,[]):"checkbox"!==e&&i._refreshCheckableItems(a);break}case"separator":i._refreshCheckableItems(a)}}}),Smart("smart-menu",class extends Smart.BaseElement{static get properties(){return{autoCloseDelay:{value:100,type:"number"},autoFocusOnMouseenter:{value:!1,type:"boolean"},checkable:{value:!1,type:"boolean"},checkboxes:{value:!1,type:"boolean"},checkMode:{value:"checkbox",type:"string"},closeAction:{value:"up",allowedValues:["up","down","none"],type:"string"},disableAutoCheck:{value:!1,type:"boolean"},dataSource:{value:null,type:"array?",reflectToAttribute:!1},displayMember:{value:"label",type:"string"},dropDownAppendTo:{value:null,type:"any?"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPosition:{value:"auto",allowedValues:["top-left","top-right","bottom-left","bottom-right","overlay-left","overlay-right","auto"],type:"string"},dropDownAnchor:{value:null,type:"any?"},enableMouseWheelAction:{value:!1,type:"boolean"},innerHTML:{type:"string",reflectToAttribute:!1},itemsMember:{value:"items",type:"string"},minimizeIconTemplate:{value:null,type:"string?"},minimizeWidth:{value:null,type:"number?"},mode:{value:"horizontal",allowedValues:["horizontal","vertical","dropDown","tree"],type:"string"},opened:{value:!1,type:"boolean"},overflow:{value:"auto",allowedValues:["auto","hidden","scroll"],type:"string"},preventCloseOnCheck:{value:!1,type:"boolean"},preventHover:{value:!1,type:"boolean"},selectionMode:{value:"click",allowedValues:["click","mouseenter"],type:"string"},valueMember:{value:"value",type:"string"}}}static get listeners(){return{"container.click":"_selectionHandler",keydown:"_keydownHandler",mouseenter:"_mouseenterHandler",mouseleave:"_mouseleaveHandler","container.mouseout":"_mouseoutMouseoverHandler","container.mouseover":"_mouseoutMouseoverHandler",resize:"_resizeHandler",transitionend:"_transitionendHandler","hamburgerIcon.click":"_hamburgerIconClickHandler","mainContainer.click":"_mainContainerHandler","mainContainer.mouseleave":"_mainContainerHandler","mainContainer.mouseout":"_mainContainerHandler","mainContainer.mouseover":"_mainContainerHandler","document.down":"_documentDownHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.RepeatButton":"smart.button.js"}}static get styleUrls(){return["smart.button.css","smart.menu.css"]}get items(){return this._menuItems}template(){return'<div id="container" role="presentation">\n <div id="minimizedHeader" class="smart-header smart-minimized-header smart-hidden" role="presentation">\n <div id="hamburgerIcon" class="smart-hamburger-icon smart-hidden" role="button" aria-label="Toggle minimized menu" aria-haspopup="true">\n <div id="hamburgerIconLineTop" class="smart-hamburger-icon-line smart-hamburger-icon-line-top" role="presentation"></div>\n <div id="hamburgerIconLineCenter" class="smart-hamburger-icon-line smart-hamburger-icon-line-center" role="presentation"></div>\n <div id="hamburgerIconLineBottom" class="smart-hamburger-icon-line smart-hamburger-icon-line-bottom" role="presentation"></div>\n <div id="customIconContainer" class="smart-hamburger-icon-custom-container smart-hidden" role="presentation"></div>\n </div>\n </div>\n <smart-repeat-button id="scrollButtonNear" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable right-to-left="[[rightToLeft]]">\n <div id="arrowNear" class="smart-arrow" aria-hidden="true"></div>\n </smart-repeat-button>\n <div id="mainContainer" class="smart-menu-main-container" role="presentation">\n <content></content>\n </div>\n <smart-repeat-button id="scrollButtonFar" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable right-to-left="[[rightToLeft]]">\n <div id="arrowFar" class="smart-arrow" aria-hidden="true"></div>\n </smart-repeat-button>\n </div>'}attached(){const e=this;if(super.attached(),!e.isCompleted||!e.isRendered||"tree"===e._element||Smart.ListMenu&&e instanceof Smart.ListMenu)return;const t=e._scrollInfo;if(null!==e.dropDownAppendTo){if(e._minimized)e._dropDownParent.appendChild(e.$.mainContainer);else for(let t=0;t<e._containersInBody.length;t++)e._dropDownParent.appendChild(e._containersInBody[t]);"dropDown"===e.mode&&(e._dropDownParent===e.parentElement?e._dynamicallyReparented?delete e._dynamicallyReparented:e._positionRelativeTo=null:(e._positionRelativeTo=e.parentElement,e._dynamicallyReparented=!0,setTimeout((function(){e._dropDownParent.appendChild(e)}),0)))}t&&t.forEach((function(e,t){t.scrollLeft=e.left,t.scrollTop=e.top}))}detached(){const e=this;super.detached(),"tree"===e._element||Smart.ListMenu&&e instanceof Smart.ListMenu||(e._close(),null!==e.dropDownAppendTo&&(e._minimized?e._dropDownParent.removeChild(e.$.mainContainer):e._removeContainersInBody()))}ready(){super.ready()}render(){const e=this;e._element="menu",e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._containers=[],e._containersInBody=[],e._openedContainers=[],e._containersFixedHeight=[],e._menuItemsGroupsToExpand=[],e._additionalScrollButtons=[],e._scrollInfo=new Map,e._createElement(),super.render()}addItem(e,t){const n=this;if(!(e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup))if("string"==typeof e){const t=document.createElement("smart-menu-item");t.label=e,e=t}else{if(!e||!e.label)return;{const t=document.createElement("smart-menu-item");t.label=e.label,e=t}}let o,i,r;if(e.isDirty=!1,void 0===t)o=n,i=1,r=t=n.$.mainContainer;else{if((t=n.getItem(t))instanceof Smart.MenuItemsGroup==0)return;o=t,i=t.level+1,r=t.itemContainer}if(n._createItemHTMLStructure(e,i,t,r.childElementCount,0),e instanceof Smart.MenuItemsGroup&&(n._processHTML(e,i+1),n._checkContainersLength()),r.appendChild(e),n._checkOverflowAddRemove(e.level,r),e instanceof Smart.MenuItemsGroup&&("tree"===n.mode||n._minimized)){const t=e.getElementsByClassName("smart-menu-items-group-arrow");for(let e=0;e<t.length;e++)t[e].className="smart-menu-items-group-arrow down smart-arrow-down";n._expandItemsByDefault()}n._checkOverflow(n.$.mainContainer,"horizontal"===n.mode,[n.$.scrollButtonNear,n.$.scrollButtonFar]),n._refreshCheckableItems(o)}checkItem(e){void 0===(e=this.getItem(e))||e.checked||e.disabled||e.templateApplied||this._toggleItem(e)}clear(){const e=this;e.$.mainContainer.innerHTML="",e._removeContainersInBody(),e._menuItems={},e._containers=[],e._containersInBody=[],e._openedContainers=[],e._containersFixedHeight=[],e._menuItemsGroupsToExpand=[],e._additionalScrollButtons=[]}clickItem(e){const t=this;"string"==typeof e&&(e=t.getItem(e)),e&&e.nodeName&&t._selectionHandler({type:"click",isTrusted:!0,target:e,stopPropagation:()=>{},preventDefault:()=>{}})}close(){const e=this;"dropDown"!==e.mode||!1===e.opened&&e.$.hasClass("smart-visibility-hidden")||(e.$.fireEvent("closing",arguments[0]||{trigger:"programmatic"}).defaultPrevented?e.opened=!0:(e.opened=!1,e.$.addClass("smart-visibility-hidden"),e._close(),e.$.fireEvent("close")))}collapseItem(e,t){const n=this,o=n.animation,i=!1===t&&n.hasAnimation;if(void 0===e)return i&&(n.animation="none"),n._close(),void(i&&setTimeout((function(){n.animation=o}),0));if(void 0===(e=n.getItem(e))||e instanceof Smart.MenuItem)return;const r=e.level;if(n._openedContainers[r+1]&&n._isContainerOpened(r+1,e.container)){const t=n.mode;i&&(n.animation="none"),n._closeSubContainers(r+1,e.container,void 0,!1!==arguments[2]),1!==r&&"tree"!==t||n._checkOverflow(n.$.mainContainer,"horizontal"===t,[n.$.scrollButtonNear,n.$.scrollButtonFar]),i&&(n.animation=o)}}expandItem(e,t){const n=this;if(void 0===(e=n.getItem(e))||e instanceof Smart.MenuItemsGroup&&n._isContainerOpened(e.level+1,e.container)&&n._isBranchExpanded(e))return;void 0!==Smart.Menu.processTimer&&n._lazyInitItems();const o=[e],i=n.animation,r=!1===t&&n.hasAnimation;let a=e.parentItem;for(r&&(n.animation="none"),n._discardKeyboardHover();a;)o.unshift(a),a=a.parentItem;for(let e=0;e<o.length;e++){const t=o[e];if(e===o.length-1&&t instanceof Smart.MenuItem){t.disabled||t.templateApplied||n._hoverViaKeyboard(t);break}n._isContainerOpened(t.container.level,t.container)||n._menuItemsGroupSelectionHandler(t,{target:t,type:"expand",isTrusted:!0},arguments[2])}r&&(n.animation=i)}getItem(e){const t=this;let n;if(null!=e&&t._menuItems){if("string"==typeof e){if(/^[0-9]*([.]?[0-9]*)*$/gm.test(e))return t._menuItems[e];if(n=t.$.mainContainer.querySelector('[id="'+e+'"]'),null===n)return t._menuItems[e]}else{if(!isNaN(e))return t._menuItems[e.toString()];n=e}if((n instanceof Smart.MenuItem||n instanceof Smart.MenuItemsGroup)&&(t.contains(n)||t.$.mainContainer.contains(n)||n.parentElement.parentElement.ownerElement===t))return n}}maximize(){const e=this;if(!e._minimized)return;const t=e.animation;if(e.$.mainContainer.style.marginTop="",e.$.mainContainer.style.marginLeft="",e.enableShadowDOM&&!e.$.mainContainer.id&&(e.$.mainContainer.id=e.$.mainContainer.getAttribute("smart-id")),"none"!==t&&(e.animation="none"),e._positionDetection.removeOverlay(),e._closeSubContainers(2),e.$minimizedHeader.addClass("smart-hidden"),e._minimized=!1,e._minimizedDropDownOpened&&(e.$hamburgerIcon.removeClass("smart-close-button"),e._minimizedDropDownOpened=!1),null!==e.dropDownAppendTo&&e._appendMinimizedContainerToMenu(e.$.mainContainer,e.$.scrollButtonFar),"tree"!==e.mode){e.$mainContainer.addClass("smart-menu-main-container"),e.$mainContainer.removeClass("smart-menu-minimized-items-container");const t=e.$.mainContainer.getElementsByClassName("smart-menu-items-group-arrow");for(let n=0;n<t.length;n++)e._setArrowDirection(t[n],t[n].parentElement.parentElement.level+1);null!==e.dropDownAppendTo&&e._moveDropDownsToExternalContainer(),e._applyContainerFixedHeight()}e.$mainContainer.removeClass("smart-visibility-hidden"),e.$hamburgerIcon.addClass("smart-hidden"),e.removeAttribute("minimized"),e._checkOverflow(e.$.mainContainer,"horizontal"===e.mode,[e.$.scrollButtonNear,e.$.scrollButtonFar]),"none"!==t&&setTimeout((function(){e.animation=t}),0),e.$.mainContainer.removeAttribute("drop-down"),e.$.hamburgerIcon.removeAttribute("aria-expanded"),e.$.hamburgerIcon.removeAttribute("aria-owns"),e.$.mainContainer.setAttribute("role","presentation"),e.$.mainContainer.removeAttribute("aria-orientation"),e.setAttribute("role","menu"),e.setAttribute("aria-orientation","horizontal"===e.mode?"horizontal":"vertical")}minimize(){const e=this;if(e._minimized||"dropDown"===e.mode)return;e.$minimizedHeader.removeClass("smart-hidden");const t=null!==e.dropDownAppendTo,n=e.animation,o=e.hasAnimation;if(o&&(e.animation="none"),e._positionDetection.removeOverlay(),e._closeSubContainers(2),o&&t&&(e.animation=n),"tree"!==e.mode&&(t&&e._moveDropDownsToMenu(),e._removeContainerFixedHeight()),e._hideMainContainerScrollButtons(),e.$mainContainer.removeClass("smart-menu-main-container"),e.$mainContainer.addClass("smart-visibility-hidden"),e.enableShadowDOM&&e.$.mainContainer.removeAttribute("id"),e._edgeMacFF&&(e.$.mainContainer.style.left="",e.$.mainContainer.style.top="",e.$mainContainer.addClass("not-in-view")),e.$hamburgerIcon.removeClass("smart-hidden"),t&&e._appendMinimizedContainerToExternalElement(e.$.mainContainer),setTimeout((function(){e.$mainContainer.addClass("smart-menu-minimized-items-container"),o&&!t&&(e.animation=n)}),0),e._minimized=!0,e.setAttribute("minimized",""),"tree"!==e.mode)for(let t=0;t<e._containers.length;t++){const n=e._containers[t];n.level>2&&e._setArrowDirection(n.menuItemsGroup.children[0].children[1],n.level)}e.$.mainContainer.setAttribute("drop-down",""),e.setAttribute("role","presentation"),e.removeAttribute("aria-orientation"),e.$.hamburgerIcon.setAttribute("aria-expanded",!1),e.$.hamburgerIcon.setAttribute("aria-owns",e.$.mainContainer.id),e.$.mainContainer.setAttribute("role","menu"),e.$.mainContainer.setAttribute("aria-orientation","vertical")}open(e,t){const n=this;if("dropDown"!==n.mode)return;if(n.$.fireEvent("opening").defaultPrevented)return void(n.opened=!1);let o;if(n.opened=!0,n._positionRelativeTo){const i=n._positionRelativeTo.getBoundingClientRect();e+=i.left,t+=i.top,n._positionedParent?(o=n._positionedParent.getBoundingClientRect(),e-=o.left,t-=o.top):(e+=window.pageXOffset,t+=window.pageYOffset)}let i=e+n.offsetWidth-document.documentElement.clientWidth,r=t+n.offsetHeight-document.documentElement.clientHeight;if(o?(i+=o.left,r+=o.top):(i-=window.pageXOffset,r-=window.pageYOffset),i>0?e-=i:e=o?Math.max(e,-o.left):Math.max(e,window.pageXOffset),r>0?t-=r:t=o?Math.max(t,-o.top):Math.max(t,window.pageYOffset),n.dropDownAnchor){const o="string"==typeof n.dropDownAnchor?document.querySelector(n.dropDownAnchor):n.dropDownAnchor;n.style.marginLeft="0px";const i=n.offset(o);switch(n.dropDownPosition){case"top-left":e=i.left,t=i.top-n.offsetHeight;break;case"top-right":t=i.top-n.offsetHeight,e=i.left+o.offsetWidth-n.offsetWidth;break;case"bottom-left":t=i.top+o.offsetHeight,e=i.left;break;case"bottom-right":e=i.left+o.offsetWidth-n.offsetWidth,t=i.top+o.offsetHeight;break;case"overlay-left":e=i.left,t=i.top+o.offsetHeight;break;case"overlay-right":e=i.left+o.offsetWidth-n.offsetWidth,t=i.top+o.offsetHeight;break;case"auto":{const i=o.getBoundingClientRect(),r=n.getBoundingClientRect();i.top+i.height+r.height<=document.documentElement.clientHeight?(t=i.top+i.height,e=i.left):i.top-r.height>=0?(t=i.top-r.height,e=i.left):i.left+i.width+r.width<=document.documentElement.clientWidth?(e=i.left+i.width,t=i.top):i.left-r.width>=0?(e=i.left-r.width,t=i.top):(e=0,t=0);break}}}n.style.right="",isNaN(e)||(n.rightToLeft&&(n.style.right="initial"),n.style.left=e+"px"),isNaN(t)||(n.style.top=t+"px"),n.$.removeClass("smart-visibility-hidden"),n.$.fireEvent("open"),n.hasAnimation||(n._checkOverflowOnOpen&&(n._checkOverflow(n.$.mainContainer,!1,[n.$.scrollButtonNear,n.$.scrollButtonFar]),delete n._checkOverflowOnOpen),n._noAutoFocus||n.focus())}_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)}}removeItem(e){const t=this;if(void 0===(e=t.getItem(e)))return;const n=e.parentElement,o=e.parentItem||t;if(e instanceof Smart.MenuItemsGroup){const n=e.container;if(t._isContainerOpened(n.level,n)&&t._closeSubContainers(n.level,n),1===e.level){const e=t._containersInBody.indexOf(n);-1!==e&&(t._containersInBody.splice(e,1),null===t.dropDownAppendTo||"tree"===t.mode||t._minimized||t._dropDownParent.removeChild(n))}}n.removeChild(e),t._refreshContainersArrays(),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0),t._checkOverflowAddRemove(e.level,n),t._refreshCheckableItems(o)}uncheckItem(e){void 0===(e=this.getItem(e))||!e.checked||e.disabled||e.templateApplied||this._toggleItem(e)}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const o=this;if("tree"!==o._element)switch(e){case"animation":o.$.mainContainer.setAttribute("animation",n),o._additionalScrollButtons.forEach((function(e){e[0].animation=n,e[1].animation=n})),null!==o._dropDownParent&&o._containers.forEach((function(e){e.setAttribute("animation",n)}));break;case"checkable":"tree"===o.mode||o._minimized?o._minimized&&null!==o.dropDownAppendTo&&r("checkable",o.$.mainContainer,n):o._closeSubContainers(2),o._updateItemRoles(o);break;case"checkboxes":if(o._close(),null!==o.dropDownAppendTo){for(let e=0;e<o._containers.length;e++)r("checkboxes",o._containers[e],n);o._minimized&&r("checkboxes",o.$.mainContainer,n)}o._updateItemRoles();break;case"checkMode":o._changeToRadioButtonMode(n,o.$.mainContainer),o._minimized&&null!==o.dropDownAppendTo&&o.$.mainContainer.setAttribute("check-mode",n),o._updateItemRoles(o);break;case"dataSource":{let e=!1;o._minimized&&(o.maximize(),e=!0),o._removeContainersInBody(),o._containersInBody=[],o._menuItems={},o._processDataSource(),o._checkContainersLength(),e?o.minimize():i(),o._expandItemsByDefault(),o._refreshCheckableItems(),o._suppressResizeHandler=!0,setTimeout((()=>delete o._suppressResizeHandler),500);break}case"innerHTML":o.$.mainContainer.innerHTML=n,o._lazyInitItems();break;case"dropDownAppendTo":{const e=o._dropDownParent;if(o._positionDetection.getDropDownParent(),o._dropDownParent===e||"tree"===o.mode&&!o._minimized)return;if(o._close(),o._minimized)return void(null===n?o._appendMinimizedContainerToMenu(o.$.mainContainer,o.$.scrollButtonFar):o._appendMinimizedContainerToExternalElement(o.$.mainContainer));if(null!==o._dropDownParent&&null===e)o._moveDropDownsToExternalContainer();else if(null===o._dropDownParent&&null!==e)o._moveDropDownsToMenu();else if(null!==o._dropDownParent&&null!==e)for(let e=0;e<o._containersInBody.length;e++)o._dropDownParent.appendChild(o._containersInBody[e]);null!==n||o.$mainContainer.hasClass("simple")?o._checkOverflow(o.$.mainContainer,"horizontal"===o.mode,[o.$.scrollButtonNear,o.$.scrollButtonFar]):o._hideMainContainerScrollButtons();for(let e=0;e<o._containersFixedHeight.length;e++)o._containersFixedHeight[e].itemContainer.checkOverflow=!0;"dropDown"===o.mode&&(o.close({trigger:"internal"}),o._reparentMenu(!0,e));break}case"dropDownOverlay":n||o._positionDetection.removeOverlay();break;case"disabled":n&&o._close(),o._setFocusable(),o.$.scrollButtonNear.disabled=n,o.$.scrollButtonFar.disabled=n,n||null===o.dropDownAppendTo&&!o.$mainContainer.hasClass("simple")&&"tree"!==o.mode||o._updateScrollButtonVisibility(o.$.mainContainer,"horizontal"===o.mode,[o.$.scrollButtonNear,o.$.scrollButtonFar]);break;case"dropDownPosition":case"mode":{if("mode"===e){if(delete o._dynamicallyReparented,"tree"===t||o._minimized?(o._closeSubContainersTreeMode(2,void 0,void 0,void 0,!0),o._openedContainers=[]):o._closeSubContainersDefaultMode(2),o._discardKeyboardHover(!0),o._minimized&&o._minimizedDropDownOpened&&(o.$mainContainer.addClass("smart-visibility-hidden"),o.$hamburgerIcon.removeClass("smart-close-button"),o.$.hamburgerIcon.setAttribute("aria-expanded",!1),o._minimizedDropDownOpened=!1),"horizontal"!==n&&"horizontal"!==t||o._changeScrollButtonsArrows(),o._minimized)return void("dropDown"===n&&(o.mode=t));o.setAttribute("aria-orientation","horizontal"===o.mode?"horizontal":"vertical"),!1===o.opened&&("dropDown"===n?o.$.addClass("smart-visibility-hidden"):"dropDown"===t&&o.$.removeClass("smart-visibility-hidden")),"tree"===t?(null!==o.dropDownAppendTo&&o._moveDropDownsToExternalContainer(),o.$mainContainer.addClass("smart-menu-main-container"),o.$mainContainer.removeClass("smart-menu-minimized-items-container"),o._applyContainerFixedHeight()):"tree"===n&&(null!==o.dropDownAppendTo&&o._moveDropDownsToMenu(),o._applyTreeMode()),"auto"===o.overflow&&o._hideMainContainerScrollButtons(),i()}if("tree"===o.mode||o._minimized)return o._minimizedDropDownOpened&&o._close(),void(o._minimized&&null!==o.dropDownAppendTo&&o.$.mainContainer.setAttribute(o.properties[e].attributeName,n));"dropDownPosition"===e&&o._close();const r=o._containers.map((e=>e.menuItemsGroup));for(let e=0;e<r.length;e++){const t=r[e];o._setArrowDirection(t.children[0].children[1],t.level+1)}if(null!==o.dropDownAppendTo)for(let t=0;t<o._containers.length;t++){const i=o._containers[t];i.setAttribute(Smart.Utilities.Core.toDash(e),n),i.level>2&&o._setArrowDirection(i.menuItemsGroup.children[0].children[1],i.level)}break}case"minimizeIconTemplate":o._applyMinimizeIconTemplate(n,t);break;case"minimizeWidth":o._resizeHandler();break;case"opened":n?o.open():o.close({trigger:"internal"});break;case"overflow":o._handleOverflowChange();break;case"rightToLeft":if("tree"!==o.mode){const e=o._containers.map((e=>e.menuItemsGroup));for(let t=0;t<e.length;t++){const n=e[t];o._setArrowDirection(n.children[0].children[1],n.level+1)}if(null!==o.dropDownAppendTo){n?o.$.mainContainer.setAttribute("right-to-left",""):o.$.mainContainer.removeAttribute("right-to-left");for(let e=0;e<o._containers.length;e++){const t=o._containers[e];n?t.setAttribute("right-to-left",""):t.removeAttribute("right-to-left"),t.level>2&&o._setArrowDirection(t.menuItemsGroup.children[0].children[1],t.level)}}}break;case"theme":if(null===o.dropDownAppendTo||Smart.ListMenu&&o instanceof Smart.ListMenu)return;if(o._minimized)""!==t&&o.$mainContainer.removeClass(t),""!==n&&o.$mainContainer.addClass(n);else for(let e=0;e<o._containers.length;e++){const i=o._containers[e];""!==t&&i.classList.remove(t),""!==n&&i.classList.add(n)}break;case"unfocusable":o._setFocusable()}function i(){null===o.dropDownAppendTo&&"tree"!==o.mode||o._checkOverflow(o.$.mainContainer,"horizontal"===o.mode,[o.$.scrollButtonNear,o.$.scrollButtonFar])}function r(e,t,n){n?t.setAttribute(e,""):t.removeAttribute(e)}}_addOpenedContainer(e,t){const n=this;if("tree"===n.mode||n._minimized){n._openedContainers[e]||(n._openedContainers[e]=[]);const o=t.menuItemsGroup;return o.set("expanded",!0),o.setAttribute("aria-expanded",!0),n._updateState&&n._updateState("expanded",o.id,!0),n._openedContainers[e].push(t)}n._openedContainers[e]=t}_appendMinimizedContainerToExternalElement(e){const t=this;e.ownerElement=t,t._dropDownParent.appendChild(e),e.setAttribute("animation",t.animation),""!==t.theme&&e.$.addClass(t.theme),e.$.addClass("smart-menu-drop-down smart-drop-down"),e.$.addClass("smart-drop-down-repositioned"),e.setAttribute("check-mode",t.checkMode),e.setAttribute("drop-down-position",t.dropDownPosition),e.setAttribute("mode",t.mode),e.setAttribute("loading-indicator-position",t.loadingIndicatorPosition),t.rightToLeft&&e.setAttribute("right-to-left",""),t.checkable&&e.setAttribute("checkable",""),t.checkboxes&&e.setAttribute("checkboxes",""),t.$.view&&t.detachedChildren.indexOf(t.$.view)&&t.detachedChildren.push(t.$.view)}_appendMinimizedContainerToMenu(e,t){const n=this;delete e.ownerElement,n.$.container.insertBefore(e,t),e.removeAttribute("animation"),""!==n.theme&&e.$.removeClass(n.theme),e.$.removeClass("smart-menu-drop-down smart-drop-down"),e.$.removeClass("smart-drop-down-repositioned"),e.removeAttribute("checkable"),e.removeAttribute("checkboxes"),e.removeAttribute("check-mode"),e.removeAttribute("drop-down-position"),e.removeAttribute("mode"),e.removeAttribute("loading-indicator-position"),e.removeAttribute("style"),e.removeAttribute("right-to-left")}_applyContainerFixedHeight(){const e=this;for(let t=0;t<e._containers.length;t++){const n=e._containers[t];-1!==e._containersFixedHeight.indexOf(n)?(n.style.height=n.menuItemsGroup.dropDownHeight+"px",n.itemContainer.checkOverflow=!0):n.style.height=""}}_applyGrouping(e,t){const n=this;let o;o=e===n.$.mainContainer?Array.from(e.children):Array.from(e.container.firstElementChild.children);for(let e=0;e<o.length;e++){const i=o[e];i.originalIndex=e,i instanceof Smart.MenuItemsGroup&&void 0===t&&n._applyGrouping(i)}n._sortItems(e)}_applyMinimizeIconTemplate(e,t){const n=this;if(null===e){if(null===t)return;n.$customIconContainer.addClass("smart-hidden"),n.$.customIconContainer.innerHTML="",n.$hamburgerIconLineTop.removeClass("smart-hidden"),n.$hamburgerIconLineCenter.removeClass("smart-hidden"),n.$hamburgerIconLineBottom.removeClass("smart-hidden")}else{const o=document.getElementById(e);if(null!==o&&"template"===o.tagName.toLowerCase()){const e=document.importNode(o.content,!0);n.$hamburgerIconLineTop.addClass("smart-hidden"),n.$hamburgerIconLineCenter.addClass("smart-hidden"),n.$hamburgerIconLineBottom.addClass("smart-hidden"),n.$.customIconContainer.innerHTML="",n.$.customIconContainer.appendChild(e),n.$customIconContainer.removeClass("smart-hidden")}else n.minimizeIconTemplate=t}}_applyTreeMode(){const e=this,t=e.$.mainContainer.getElementsByClassName("smart-menu-items-group-arrow");if(e.$mainContainer.removeClass("smart-menu-main-container"),e.$mainContainer.addClass("smart-menu-minimized-items-container"),e.isCompleted&&e.isRendered)for(let e=0;e<t.length;e++)t[e].className="smart-menu-items-group-arrow down";e._removeContainerFixedHeight()}_arrowLeftHandler(e,t,n,o){const i=this;1===e?"horizontal"===t&&i._levelOneNavigate("_getLastEnabledChild",n,o):2===e?i._levelOneNavigateFromLowerLevel("_getPreviousEnabledChild",n):i._escapeHandler(n,e,o)}_arrowRightHandler(e,t,n,o){const i=this;1===e?"horizontal"===t?i._levelOneNavigate("_getFirstEnabledChild",n,o):i._levelOneOpenDropDown(n):n instanceof Smart.MenuItemsGroup?i._selectionHandler({target:n,isTrusted:!0}):i._levelOneNavigateFromLowerLevel("_getNextEnabledChild",n)}_browserBoundsDetection(e){const t=this;if("tree"===t.mode&&!t._minimized)return;if(e.style.marginTop="",e.style.marginLeft="","auto"!==t.dropDownPosition)return;const n=1===window.devicePixelRatio?document.documentElement.clientWidth:window.innerWidth,o=1===window.devicePixelRatio?document.documentElement.clientHeight:window.innerHeight,i=e.getBoundingClientRect(),r=n-i.left-e.offsetWidth,a=o-i.top-e.offsetHeight;r<10&&(e.style.marginLeft=Math.min(r-10,-10)+"px"),a<10&&(e.style.marginTop=Math.min(a-10,-10)+"px")}_changeScrollButtonsArrows(){const e=this;"horizontal"===e.mode?(e.$.scrollButtonNear.setAttribute("aria-label","Scroll left"),e.$.scrollButtonFar.setAttribute("aria-label","Scroll right"),e.$arrowNear.removeClass("smart-arrow-up"),e.$arrowFar.removeClass("smart-arrow-down"),e.$arrowNear.addClass("smart-arrow-left"),e.$arrowFar.addClass("smart-arrow-right")):(e.$.scrollButtonNear.setAttribute("aria-label","Scroll up"),e.$.scrollButtonFar.setAttribute("aria-label","Scroll down"),e.$arrowNear.removeClass("smart-arrow-left"),e.$arrowFar.removeClass("smart-arrow-right"),e.$arrowNear.addClass("smart-arrow-up"),e.$arrowFar.addClass("smart-arrow-down"))}_changeToRadioButtonMode(e,t,n){if("radioButton"===e){const e=[];for(let n=0;n<t.childElementCount;n++){const o=t.children[n];!o.checked||o.disabled||o.templateApplied||e.push(o)}this._validateRadioButtonSelection(n,n?n.level+1:1,e)}}_checkContainersLength(e){const t=this;0===t._containers.length?(t.$mainContainer.addClass("simple"),e||t._checkOverflow(t.$.mainContainer,"horizontal"===t.mode,[t.$.scrollButtonNear,t.$.scrollButtonFar])):e||(t.$mainContainer.removeClass("simple"),null===t.dropDownAppendTo&&"tree"!==t.mode&&t.$mainContainer.removeClass("scroll-buttons-shown one-button-shown"))}_checkOverflow(e,t,n){const o=this,i=o.$.mainContainer,r=e===i?o.overflow:"auto";if(o._minimized||"hidden"===r||null===o.dropDownAppendTo&&"tree"!==o.mode&&e===i&&!i.classList.contains("simple"))return;if("dropDown"===o.mode&&!o.opened)return void(o._checkOverflowOnOpen=!0);const a=e.scrollLeft,s=a/(e.scrollWidth-e.offsetWidth),l=e.scrollTop,d=l/(e.scrollHeight-e.offsetHeight);let c,m,u;"auto"===r&&(e.classList.remove("scroll-buttons-shown"),e.classList.remove("one-button-shown"),n[0].$.addClass("smart-hidden"),n[1].$.addClass("smart-hidden")),t?(c=Math.round(e.scrollWidth)>Math.round(e.offsetWidth),m=s>0,u=s<1):(c=Math.round(e.scrollHeight)>Math.round(e.offsetHeight),m=d>0,u=d<1),c?"auto"===r?(e.classList.add("scroll-buttons-shown"),m&&n[0].$.removeClass("smart-hidden"),u&&n[1].$.removeClass("smart-hidden"),!1===(m&&u)&&e.classList.add("one-button-shown"),o.disabled||(n[0].disabled=!1,n[1].disabled=!1),e.scrollLeft=a,e.scrollTop=l):(n[0].$.removeClass("smart-hidden"),n[1].$.removeClass("smart-hidden"),o.disabled?(n[0].disabled=!0,n[1].disabled=!0):(n[0].disabled=!m,n[1].disabled=!u)):"scroll"===r&&(n[0].disabled=!0,n[1].disabled=!0),e===i&&"tree"!==o.mode&&o._close(),o._scrollInfo.set(e,{left:e.scrollLeft,top:e.scrollTop})}_checkOverflowAddRemove(e,t){const n=this;1===e&&null!==n.dropDownAppendTo||"tree"===n.mode?n._checkOverflow(n.$.mainContainer,"horizontal"===n.mode,[n.$.scrollButtonNear,n.$.scrollButtonFar]):e>1&&t.dropDownHeightSet&&(n._isContainerOpened(e,t.container)?n._checkOverflow(t,!1,[t.container.children[0],t.container.children[2]]):t.checkOverflow=!0)}_close(){const e=this;e._positionDetection.removeOverlay(),e._closeSubContainers(2),e._discardKeyboardHover(!0),e._minimized&&e._minimizedDropDownOpened&&(e.$mainContainer.addClass("smart-visibility-hidden"),e._edgeMacFF&&(e.$.mainContainer.style.left="",e.$.mainContainer.style.top="",e.$mainContainer.addClass("not-in-view")),e.$hamburgerIcon.removeClass("smart-close-button"),e.$.hamburgerIcon.setAttribute("aria-expanded",!1),e._minimizedDropDownOpened=!1)}_closeSubContainers(e,t,n,o){const i=this;"tree"===i.mode||i._minimized?i._closeSubContainersTreeMode(e,t,n,o):i._closeSubContainersDefaultMode(e,t,n)}_closeSubContainersDefaultMode(e,t,n){const o=this,i=o._openedContainers;function r(t){const r=i[t].menuItemsGroup;n&&t===e||(r.$.removeClass("focus"),r.removeAttribute("focus"),r.$.removeClass("hover"),r.removeAttribute("hover")),r.$.removeClass("smart-menu-items-group-opened"),r.$.removeClass("smart-menu-items-group-expanded"),r.setAttribute("aria-expanded",!1),i[t].$.addClass("smart-visibility-hidden"),o._edgeMacFF&&2===t&&!o.hasAnimation&&(i[t].style.left="",i[t].style.top="",i[t].$.addClass("not-in-view")),o._minimized&&o._browserBoundsDetection(o.$.mainContainer),o.$.fireEvent("collapse",{item:r,label:r.label,path:r.path,value:r.value,children:r.itemContainer.children}),i[t]=void 0}for(let t=i.length-1;t>=e;t--)void 0!==i[t]&&r(t)}_closeSubContainersTreeMode(e,t,n,o,i){const r=this;if(o){const e=t.menuItemsGroup;if(r.$.fireEvent("collapsing",{item:e,label:e.label,path:e.path,value:e.value,children:t.itemContainer.children}).defaultPrevented)return}if(void 0===t)return void r._collapseAll(!1,i);const a=t.menuItemsGroup;if(a.set("expanded",!1),a.setAttribute("aria-expanded",!1),"menu"===r._element)if(n){const e=r.$.mainContainer.getElementsByClassName("focus")[0];e&&(e.$.removeClass("focus"),e.removeAttribute("focus")),a.$.addClass("focus"),a.setAttribute("focus",""),r._focusedViaKeyboard=a}else a.$.removeClass("focus"),a.removeAttribute("focus");else r._updateState("expanded",a.id,!1);if(a.$.removeClass("smart-"+r._element+"-items-group-opened"),i||!r.hasAnimation?(a.$.removeClass("smart-"+r._element+"-items-group-expanded"),a.setAttribute("aria-expanded",!1),t.$.addClass("smart-visibility-hidden"),r._minimized&&r._browserBoundsDetection(r.$.mainContainer)):r._collapseSection(t),o){const e={item:a,label:a.label,path:a.path,value:a.value,children:a.itemContainer.children};r.toggleCallback?(e.type="collapse",r.toggleCallback(e)):r.$.fireEvent("collapse",e)}if(!r._openedContainers[e])return;const s=r._openedContainers[e].indexOf(t);-1!==s&&r._openedContainers[e].splice(s,1)}_collapseAll(e,t){const n=this;for(let o=n._openedContainers.length-1;o>=2&&void 0!==n._openedContainers[o];o--)for(let i=n._openedContainers[o].length-1;i>=0;i--)n._closeSubContainersTreeMode(o,n._openedContainers[o][i],void 0,e,t);n.hasAnimation||n._checkOverflow(n.$.mainContainer,!1,[n.$.scrollButtonNear,n.$.scrollButtonFar]);for(let e=n._openedContainers.length-1;e>=2;e--){const t=n._openedContainers[e];if(void 0!==t&&0!==t.length)break;n._openedContainers.splice(e,1)}2===n._openedContainers.length&&(n._openedContainers=[])}_collapseSection(e){const t=this,n=e.scrollHeight+"px";t._treeAnimationInProgress=e,e.style.transition="none",requestAnimationFrame((function(){"tree"===t.mode||t._minimized?(e.style.height=n,e.style.transition="",requestAnimationFrame((function(){e.style.height="0px","smart-tree"===t.tagName.toLowerCase()&&e.$.addClass("smart-visibility-hidden"),"0px"===n&&t._transitionendHandlerCollapse(t,e)}))):e.style.transition=""})),e.addEventListener("transitionend",t._transitionendHandlerCollapse)}_createElement(){const e=this,t=e.mode;e.setAttribute("role","menu"),e.$.mainContainer.id=e.id+"MainContainer",e.setAttribute("aria-orientation","horizontal"===e.mode?"horizontal":"vertical"),e._positionDetection=new Smart.Utilities.PositionDetection(e),e._positionDetection.getDropDownParent(),e._reparentMenu(),e.disabled&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList();const n=(e.shadowRoot||e).querySelectorAll("smart-menu-item, smart-menu-items-group"),o=function(){const n=e.animation;e._changeScrollButtonsArrows(),e._setFocusable(),"dropDown"===t&&!1===e.opened&&(e.hasAnimation?(e.animation="none",e.$.addClass("smart-visibility-hidden"),e.animation=n):e.$.addClass("smart-visibility-hidden")),e._menuItems={},e.$.mainContainer.setAttribute("animation",n),null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource(),e._checkContainersLength(!0),null===e.dropDownAppendTo&&!e.$mainContainer.hasClass("simple")&&"tree"!==e.mode||"scroll"!==e.overflow||(e.$mainContainer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility(e.$.mainContainer,"horizontal"===t,[e.$.scrollButtonNear,e.$.scrollButtonFar])),e._applyMinimizeIconTemplate(e.minimizeIconTemplate,null),"tree"===t&&e._applyTreeMode(),null!==e.minimizeWidth&&e.offsetWidth<=e.minimizeWidth?e.minimize():e._checkOverflow(e.$.mainContainer,"horizontal"===t,[e.$.scrollButtonNear,e.$.scrollButtonFar]),e._expandItemsByDefault(),e._refreshCheckableItems(),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===n.length||e.enableShadowDOM||e.isInShadowDOM?o():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(n,o))}_ensureItemsReady(e,t){const n=this,o=function(){const n=function(t){for(let n=0;n<e.length;n++)e[n].context="node"===t?e[n]:document};n("node"),t(),n()};if(0===e.length)o();else{n._nodesReadyListeners=0;for(let t=0;t<e.length;t++){const i=e[t],r=function(){const e=n.context;n.context=n,n._nodesReadyListeners--,0===n._nodesReadyListeners&&(o(),delete n._nodesReadyListeners),n.context=e}.bind(n);i.isCompleted||(n._nodesReadyListeners++,i.completeHandlers=[],i._onCompleted=r)}0===n._nodesReadyListeners&&o()}}_createItemHTMLStructure(e,t,n,o){const i=this,r="smart-"+i._element+"-item-label-container",a="smart-"+i._element+"-item-label-element",s=document.createDocumentFragment(),l=e.children;let d,c,m,u;for(let e=0;e<l.length;e++){const t=l[e];if(t.classList&&(t.classList&&t.classList.contains(r)?d=t:t.classList&&t.classList.contains(a)&&(c=t),d&&c))break}if(d){const t=d.querySelector("."+a);if(null!==t){e.insertBefore(t.firstElementChild,e.children[0]);const n="smart-"+i._element+"-drop-down",o="smart-"+i._element+"-item-container",r=e.querySelector("."+n);if(r){const t=e.querySelector("."+o);for(;t.childNodes.length;)e.appendChild(t.firstChild);r.remove()}}d.remove()}c&&c.remove(),d=document.createElement("div"),c=document.createElement("div");let p=document.createElement("span");e.menu=i,t>1?(e.originalIndex=o,m=n.path+"."+e.originalIndex,e.parentItem=n,u=n):(e.originalIndex=o,m=""+o,u=i),i.checkboxes&&u.checkable&&("checkbox"===u.checkMode?e.setAttribute("role","menuitemcheckbox"):"radioButton"===u.checkMode&&e.setAttribute("role","menuitemradio")),e.path=m,i._menuItems[m]=e,d.className=r,c.className=a,"tree"===i._element&&i._setIndentation(d,t,i.rightToLeft?"paddingRight":"paddingLeft");const h=Array.from(e.childNodes);for(let e=0;e<h.length;e++){const t=h[e];if(t instanceof Smart.MenuItem||t instanceof Smart.MenuItemsGroup)break;p.appendChild(t)}if(""===p.innerHTML.trim()){const t=e.label||e.getAttribute("label");t&&""!==t?i._setLabel(t,p,e,!0):(e.set("label","Item "+o),p.innerHTML="Item "+o)}else e.set("label",p.innerHTML.trim());if(e.setAttribute("aria-label",e.label),e instanceof Smart.MenuItemsGroup&&void 0===e.titleLabel&&(e.titleLabel=e.label),c.appendChild(p),s.appendChild(c),e.set("level",t),e.set("shortcut",e.shortcut||e.getAttribute("shortcut")||""),e.shortcut&&e instanceof Smart.MenuItem){const t=document.createElement("div");t.id=e.id+"Shortcut",t.className="smart-"+i._element+"-item-shortcut",t.innerHTML=e.shortcut,s.appendChild(t),e.setAttribute("aria-describedby",t.id)}d.appendChild(s),e.insertBefore(d,e.children[0]),e.id||(e.id=i.id+"ItemP"+e.path.replace(/\./g,"_")+"L"+e.label.replace(/[^a-zA-Z0-9\-\_]/g,""))}_createMenuItemsGroupContainer(e,t){const n=this,o=e.children,i="smart-"+n._element+"-drop-down",r="smart-"+n._element+"-item-container";let a,s;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList&&(t.classList&&t.classList.contains(i)?a=t:t.classList&&t.classList.contains(r)&&(s=t),a&&s))break}if(a||(a=document.createElement("div")),s||(s=document.createElement("div")),a.innerHTML=s.innerHTML="",a.id=e.id+"Container",a.className="smart-"+n._element+"-drop-down smart-visibility-hidden",n._edgeMacFF&&2===t&&"tree"!==n.mode&&(a.className+=" not-in-view"),a.$||(a.$=Smart.Utilities.Extend(a)),a.level=t,a.setAttribute("level",t),"menu"===n._element?(e.setAttribute("aria-owns",a.id),a.setAttribute("role","menu")):a.setAttribute("role","group"),a.menuItemsGroup=e,s.className=r,s.$||(s.$=Smart.Utilities.Extend(s)),s.container=a,s.menuItemsGroup=e,e.checkable&&s.setAttribute("checkable",""),s.setAttribute("check-mode",e.checkMode),s.setAttribute("role","presentation"),a.itemContainer=s,a.contains(s)||a.appendChild(s),null!==e.dropDownHeight){let t=a.querySelector(".smart-spin-button.smart-scroll-button-near"),o=a.querySelector(".smart-spin-button.smart-scroll-button-far");t||(t=document.createElement("smart-repeat-button")),o||(o=document.createElement("smart-repeat-button")),t.className="smart-menu-scroll-button smart-spin-button smart-scroll-button-near smart-hidden",t.setAttribute("aria-label","Scroll up"),t.innerHTML='<div class="smart-arrow smart-arrow-up" aria-hidden="true"></div>',t.animation=n.animation,t.unfocusable=!0,t.rightToLeft=n.rightToLeft,o.className="smart-menu-scroll-button smart-spin-button smart-scroll-button-far smart-hidden",o.setAttribute("aria-label","Scroll down"),o.innerHTML='<div class="smart-arrow smart-arrow-down" aria-hidden="true"></div>',o.animation=n.animation,o.unfocusable=!0,o.rightToLeft=n.rightToLeft,a.contains(t)||a.insertBefore(t,s),a.contains(o)||a.appendChild(o),a.$.addClass("drop-down-height-set"),s.dropDownHeightSet=!0,s.checkOverflow=!0,a.style.height=e.dropDownHeight+"px",n._containersFixedHeight.push(a),n._additionalScrollButtons.push([t,o])}return a}_discardKeyboardHover(e){const t=this;t._focusedViaKeyboard&&(!e&&t._focusedViaKeyboard instanceof Smart.MenuItemsGroup&&t._isContainerOpened(t._focusedViaKeyboard.level+1,t._focusedViaKeyboard.container)||(t._focusedViaKeyboard.$.removeClass("focus"),t._focusedViaKeyboard.removeAttribute("focus"),t._focusedViaKeyboard.$.removeClass("hover"),t._focusedViaKeyboard.removeAttribute("hover"),t._focusedViaKeyboard=void 0))}_documentDownHandler(e){const t=this;"down"===t.closeAction&&t._closeOnDocumentInteraction(e.originalEvent)}_documentUpHandler(e){const t=this,n=e.originalEvent.target;if(t.disabled||t.displayLoadingIndicator||!n.closest)return;const o="up"===t.closeAction&&t._closeOnDocumentInteraction(e.originalEvent);if(o)return;let i,r;if(t.isInShadowDOM?(i=t.isInShadowDOM?t.getRootNode().activeElement:t.shadowRoot&&t.shadowRoot.activeElement||document.activeElement,r=t.$.container.contains(e.originalEvent.composedPath()[0])):(i=document.activeElement,r=t.contains(n)),!o&&t!==i&&null===i.closest("[template-applied]")){if(r||n.closest(".smart-list-menu-view")===t.$.view)return void t.focus();const e=n.closest(".smart-drop-down-repositioned");e&&e.ownerElement===t&&t.focus()}}_closeOnDocumentInteraction(e){const t=this,n=e.target;let o,i;if(t.isInShadowDOM?(o=e.composedPath()[0],i=t.$.container.contains(o)):i=t.contains(n),"dropDown"===t.mode&&t.opened){const e=n.closest(".smart-drop-down-repositioned");if(!(i||e&&e.ownerElement===t))return t.close({trigger:"interaction",target:t.isInShadowDOM?o:n}),!0}const r=(o||n).closest(".smart-input-drop-down-menu");return(!r||!t.contains(r.ownerElement))&&(!i&&null===n.closest(".smart-menu-drop-down")||o&&o===t.$.mainContainer||n===t.$.mainContainer?("tree"===t.mode||t._close(),!0):void 0)}_ensureVisible(e){const t=this;if(t._minimized)return;const n=t.mode,o=t.$.mainContainer;let i,r;if("tree"!==n&&e.parentElement!==o){if(null===e.dropDownHeight)return;i=e.parentElement,r=[i.container.children[0],i.container.children[2]]}else i=o,r=[t.$.scrollButtonNear,t.$.scrollButtonFar];if(i===o&&(null===t.dropDownAppendTo&&"tree"!==t.mode&&!o.classList.contains("simple")||!i.$.hasClass("scroll-buttons-shown")&&"hidden"!==t.overflow))return;const a=i.getBoundingClientRect(),s=e.getBoundingClientRect();function l(t,n,o){let r=e.firstElementChild[o]+t-i[o];r<0&&(r=t),i["scroll"+n]=r}function d(n,a){let s=e["offset"+n],d=i[a];"Top"!==n||i===o||r[0].$.hasClass("smart-hidden")||(s-=r[0][a]),l(s,n,a),t._updateScrollButtonVisibility(i,"Left"===n,r),d!==i[a]&&l(s,n,a)}"tree"!==n?(i===o&&"horizontal"===n&&(a.left>s.left||a.right<s.right)?d("Left","offsetWidth"):(a.top>s.top||a.bottom<s.bottom)&&d("Top","offsetHeight"),t._scrollInfo.set(i,{left:i.scrollLeft,top:i.scrollTop})):t._ensureVisibleTreeMode(e,s,i,a,0)}_ensureVisibleTreeMode(e,t,n,o,i){const r=this;if(("menu"===r._element||"scrollButtons"===r.scrollMode)&&!n.$.hasClass("scroll-buttons-shown")&&"hidden"!==r.overflow)return;const a=n.offsetHeight,s=r.$scrollButtonNear.hasClass("smart-hidden");let l;if(o.top>t.top)l=r._getOffsetTop(e);else{let n=e.expanded?e.firstElementChild.offsetHeight+parseInt(window.getComputedStyle(e.children[1]).marginTop,10):e.offsetHeight;if("tree"===r._element&&(n+=parseFloat(getComputedStyle(r).getPropertyValue("--smart-tree-item-vertical-offset"))||0),!(o.bottom<t.top+n))return;l=r._getOffsetTop(e)-a+n+i}"tree"===r._element&&"0"===e.path&&(l-=parseFloat(getComputedStyle(r).getPropertyValue("--smart-tree-item-vertical-offset"))),n.scrollTop=l,"menu"!==r._element&&"scrollButtons"!==r.scrollMode||r._updateScrollButtonVisibility(n,!1,[r.$.scrollButtonNear,r.$.scrollButtonFar]),"auto"===r.overflow&&s&&!r.$scrollButtonNear.hasClass("smart-hidden")&&(n.scrollTop+=a-n.offsetHeight),r._scrollInfo.set(n,{left:n.scrollLeft,top:n.scrollTop})}_escapeHandler(e,t,n){e&&(e.$.removeClass("focus"),e.removeAttribute("focus")),this._closeSubContainers(t,void 0,void 0,!0),this._hoverViaKeyboard(n.menuItemsGroup)}_expandItemsByDefault(e){const t=this;if(0===t._menuItemsGroupsToExpand.length&&!e||"tree"!==t.mode&&!t._minimized)return;const n=t.hasAnimation,o=t.animation;n&&(t.animation="none"),e&&t._collapseAll(!1);for(let e=0;e<t._menuItemsGroupsToExpand.length;e++)t.expandItem(t._menuItemsGroupsToExpand[e].path,void 0,!1);n&&(t.animation=o),t._menuItemsGroupsToExpand=[]}_expandSection(e){const t=this,n=e.style.height,o=e.scrollHeight+"px";e.style.height=o,t._treeAnimationInProgress=e,n!==o&&(parseFloat(n)||parseFloat(o))?e.addEventListener("transitionend",t._transitionendHandlerExpand):t._transitionendHandlerExpand(t,e)}_filterInputKeyupHandler(){const e=this;e._filterTimer&&clearTimeout(e._filterTimer),e._filterTimer=setTimeout((function(){const t=e.context;e.context=e,e._applyFilter(e.$.filterInput.value,e._view),e._checkOverflow(),e.context=t}),300)}_findItem(e,t){if(""===t)return e;const n=e[this.filterMember||"label"];if("string"!=typeof n)return null;switch(this.filterMode){case"startsWith":if(0===n.indexOf(t))return e;break;case"startsWithIgnoreCase":if(0===n.toLowerCase().indexOf(t.toLowerCase()))return e;break;case"doesNotContain":if(n.indexOf(t)<0)return e;break;case"doesNotContainIgnoreCase":if(n.toLowerCase().indexOf(t.toLowerCase())<0)return e;break;case"contains":if(n.indexOf(t)>-1)return e;break;case"containsIgnoreCase":if(n.toLowerCase().indexOf(t.toLowerCase())>-1)return e;break;case"equals":if(0===n.localeCompare(t))return e;break;case"equalsIgnoreCase":if(0===n.toLowerCase().localeCompare(t.toLowerCase()))return e;break;case"endsWith":if(n.endsWith(t))return e;break;case"endsWithIgnoreCase":if(n.toLowerCase().endsWith(t.toLowerCase()))return e}return null}_getFirstEnabledChild(e){const t=e.children;for(let e=0;e<t.length;e++)if(this._isChildEnabled(t[e]))return t[e]}_getLastEnabledChild(e){const t=e.children;for(let e=t.length-1;e>=0;e--)if(this._isChildEnabled(t[e]))return t[e]}_getNextEnabledChild(e){if(e)for(;e.nextElementSibling;){const t=e.nextElementSibling;if(this._isChildEnabled(t))return t;e=t}}_getOffsetTop(e){if(!e)return 0;let t=e.offsetTop;for(;e.offsetParent!==this.$.mainContainer;){if(!(e=e.offsetParent))return t;t+=e.offsetTop}return t}_getPreviousEnabledChild(e){if(e)for(;e.previousElementSibling;){const t=e.previousElementSibling;if(this._isChildEnabled(t))return t;e=t}}_hamburgerIconClickHandler(e,t){e&&e.stopPropagation();const n=this;if(void 0===t&&(t=Smart.ListMenu&&n instanceof Smart.ListMenu?n.$.view:n.$.mainContainer),!n.disabled)if(n._minimizedDropDownOpened)n._close();else{if(n._positionDetection.placeOverlay(),null!==n.dropDownAppendTo){const e=n.dropDownPosition,o=n.getBoundingClientRect(),i=n._positionDetection.getDropDownOffset();-1!==e.indexOf("right")||"auto"===e?n.rightToLeft?(t.style.right="initial",t.style.left=o.left+o.width-t.offsetWidth-i.x+"px"):(t.style.left=o.left+i.x+"px",t.style.right="initial"):-1!==e.indexOf("left")&&(t.style.left=o.right-t.offsetWidth+i.x+"px",t.style.right="initial"),-1!==e.indexOf("bottom")||-1!==e.indexOf("overlay")||"auto"===e?t.style.top=o.bottom+i.y+"px":-1!==e.indexOf("top")&&(t.style.top=o.top+i.y+"px")}else t.style.right="";n._edgeMacFF&&t.$.removeClass("not-in-view"),t.$.removeClass("smart-visibility-hidden"),n.$hamburgerIcon.addClass("smart-close-button"),n.$.hamburgerIcon.setAttribute("aria-expanded",!0),n._minimizedDropDownOpened=!0,n._browserBoundsDetection(t)}}_handleOverflowChange(){const e=this,t=e.$.mainContainer;if((e._minimized||null===e.dropDownAppendTo&&!t.classList.contains("simple")&&"tree"!==e.mode)&&!(Smart.ListMenu&&e instanceof Smart.ListMenu))return;const n=e.overflow;let o;"horizontal"===e.mode?(o=!0,t.scrollLeft=0):(o=!1,t.scrollTop=0),"hidden"===n?(t.classList.remove("scroll-buttons-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden")):(e.$.scrollButtonNear.disabled=e.disabled,e.$.scrollButtonFar.disabled=e.disabled,"auto"===n?(e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"),e._checkOverflow(t,o,[e.$.scrollButtonNear,e.$.scrollButtonFar])):(t.classList.add("scroll-buttons-shown"),t.classList.remove("one-button-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility(t,o,[e.$.scrollButtonNear,e.$.scrollButtonFar]))),e._scrollInfo.set(t,{left:t.scrollLeft,top:t.scrollTop})}_hideMainContainerScrollButtons(){const e=this;e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"),e.$mainContainer.removeClass("scroll-buttons-shown"),e.$mainContainer.removeClass("one-button-shown")}_hoverViaKeyboard(e){e&&(e.$.addClass("focus"),e.setAttribute("focus",""),this._focusedViaKeyboard=e,this._ensureVisible(e))}_isBranchExpanded(e){if("tree"!==this.mode)return!0;let t=!0;for(;e.parentItem;)t=t&&e.parentItem.expanded,e=e.parentItem;return t}_isChildEnabled(e){return!(e.disabled||e.templateApplied||e.hidden||e instanceof HTMLDivElement||0===e.offsetHeight)}_isContainerOpened(e,t){const n=this;return"tree"===n.mode||n._minimized?(n._openedContainers[e]||(n._openedContainers[e]=[]),-1!==n._openedContainers[e].indexOf(t)):n._openedContainers[e]===t}_keydownHandler(e){const t=this;let n=e.key;if(t.getRootNode().activeElement!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","Escape","Home"," "].indexOf(n)||t.disabled)return;e.preventDefault();const o=t.mode;if("tree"===o||t._minimized)return void t._keydownHandlerTreeMode(n);const i=t.dropDownPosition,r=-1!==i.indexOf("left"),a="top-left"===i||"top-right"===i,s=t._openedContainers;let l,d=t.$.mainContainer,c=1;for(let e=s.length-1;e>=0;e--)if(void 0!==s[e]){d=s[e],c=d.level,d=d.itemContainer;break}switch(l=d.querySelector('[focus][level="'+c+'"]'),t.rightToLeft&&("ArrowLeft"===n?n="ArrowRight":"ArrowRight"===n&&(n="ArrowLeft")),n){case"ArrowDown":1===c?"horizontal"!==o||a?"horizontal"!==o&&t._levelOneNavigate("_getFirstEnabledChild",l,d):t._levelOneOpenDropDown(l):t._navigate("_getNextEnabledChild",l,d);break;case"ArrowLeft":r?1===c?"horizontal"===o?t._levelOneNavigate("_getLastEnabledChild",l,d):t._levelOneOpenDropDown(l):l instanceof Smart.MenuItemsGroup?t._selectionHandler({target:l,isTrusted:!0}):t._levelOneNavigateFromLowerLevel("_getPreviousEnabledChild",l):t._arrowLeftHandler(c,o,l,d);break;case"ArrowRight":r?1===c?"horizontal"===o&&t._levelOneNavigate("_getFirstEnabledChild",l,d):2===c?t._levelOneNavigateFromLowerLevel("_getNextEnabledChild",l):t._escapeHandler(l,c,d):t._arrowRightHandler(c,o,l,d);break;case"ArrowUp":1===c?"horizontal"===o&&a?t._levelOneOpenDropDown(l):"horizontal"!==o&&t._levelOneNavigate("_getLastEnabledChild",l,d):t._navigate("_getPreviousEnabledChild",l,d);break;case"End":case"Home":{const e="End"===n?t._getLastEnabledChild(d):t._getFirstEnabledChild(d);if(!e||l===e)return;l&&(l.$.removeClass("focus"),l.removeAttribute("focus")),t._hoverViaKeyboard(e);break}case"Enter":l&&t._selectionHandler({target:l,isTrusted:!0});break;case"Escape":c>1?(2===c&&t._positionDetection.removeOverlay(),t._escapeHandler(l,c,d)):"dropDown"===o&&t.opened&&t.close({trigger:"interaction",target:"Escape"});break;case" ":l&&t._toggleItem(l)}}_keydownHandlerTreeMode(e){const t=this,n=Array.from(t.$.mainContainer.querySelectorAll("smart-menu-item, smart-menu-items-group")),o=t.$.mainContainer.getElementsByClassName("focus")[0];function i(e){const n=e.level;return!1===e.disabled&&!0!==e.templateApplied&&(1===n||n>1&&t._isContainerOpened(n,e.parentElement.container)&&e.getBoundingClientRect().height>0)}function r(e){for(let r=e;r<n.length;r++){const e=n[r];if(i(e)){if(o){if(o===e)break;o.$.removeClass("focus"),o.removeAttribute("focus")}t._hoverViaKeyboard(e);break}}}function a(e){for(let r=e;r>=0;r--){const e=n[r];if(i(e)){if(o){if(o===e)break;o.$.removeClass("focus"),o.removeAttribute("focus")}t._hoverViaKeyboard(e);break}}}function s(){o.level>1&&(o.$.removeClass("focus"),o.removeAttribute("focus"),t._hoverViaKeyboard(o.parentItem))}let l;switch(e){case"ArrowDown":l=o?n.indexOf(o)+1:0,r(l);break;case"ArrowLeft":if(!o)return;if(o instanceof Smart.MenuItem)s();else{if(t._isContainerOpened(o.level+1,o.container))return void t._closeSubContainers(o.level+1,o.container,!0,!0);s()}break;case"ArrowRight":if(!o||o instanceof Smart.MenuItem)return;t._isContainerOpened(o.level+1,o.container)?(o.$.removeClass("focus"),o.removeAttribute("focus"),t._hoverViaKeyboard(t._getFirstEnabledChild(o.itemContainer))):t._selectionHandler({target:o,type:"keydown",isTrusted:!0},o);break;case"ArrowUp":l=o?n.indexOf(o)-1:n.length-1,a(l);break;case"End":a(n.length-1);break;case"Enter":t._minimized&&!t._minimizedDropDownOpened?t._hamburgerIconClickHandler(void 0,t.$.mainContainer):o&&t._selectionHandler({target:o,type:"keydown",isTrusted:!0});break;case"Escape":t._minimized&&t._minimizedDropDownOpened&&t._close();break;case"Home":r(0);break;case" ":o&&t._toggleItem(o)}}_lazyInitItems(){const e=this;e._inLazyInit||(e._inLazyInit=!0,e._menuItems={},e._processHTML(e.$.mainContainer,1),e._expandItemsByDefault(),e._refreshCheckableItems(),cancelAnimationFrame(Smart.Menu.processTimer),delete Smart.Menu.processTimer,e._inLazyInit=!1,e.$.scrollViewer&&e.$.scrollViewer.refresh())}_levelOneNavigate(e,t,n){const o=this;if(t)"_getLastEnabledChild"===e?o._navigate("_getPreviousEnabledChild",t,n):o._navigate("_getNextEnabledChild",t,n);else{const t=o[e](n);t&&o._hoverViaKeyboard(t)}}_levelOneNavigateFromLowerLevel(e,t){const n=this,o=n[e](n._openedContainers[2].menuItemsGroup);o&&(t&&(t.$.removeClass("focus"),t.removeAttribute("focus")),n._closeSubContainers(2),o instanceof Smart.MenuItemsGroup?n._selectionHandler({target:o,isTrusted:!0}):n._hoverViaKeyboard(o))}_levelOneOpenDropDown(e){e&&e instanceof Smart.MenuItemsGroup&&this._selectionHandler({target:e,isTrusted:!0})}_mainContainerHandler(e){const t=this;if(t._minimized&&null!==t.dropDownAppendTo)switch(e.type){case"click":t._selectionHandler(e);break;case"mouseleave":t._mouseleaveHandler(e);break;case"mouseout":case"mouseover":t._mouseoutMouseoverHandler(e)}}_menuItemSelectionHandler(e,t){const n=this;function o(){n.enableShadowDOM&&(n.shadowRoot.activeElement||document.activeElement)!==n&&null!==n.dropDownAppendTo&&"click"===t.type&&!n.shadowRoot.contains(e)?n.focus():document.activeElement===n||null===n.dropDownAppendTo||"click"!==t.type||n.contains(e)||n.focus()}if(e.disabled||e.templateApplied)o();else{if(!n._toggleItem(e)){if(n.$.fireEvent("itemClick",{item:e,label:e.label,value:e.value}),t.target&&"A"!==t.target.nodeName){const t=e.querySelector("a");t&&t.click()}if("tree"!==n.mode&&(n._close(),"dropDown"===n.mode))return n._ripple(e,t),void n.close({trigger:"interaction",target:e})}n._ripple(e,t),o()}}_menuItemsGroupSelectionHandler(e,t,n){const o=this,i=o.mode,r=e.container,a=r.level,s="tree"!==i&&!o._minimized;if(o._treeAnimationInProgress===r)return;if(o._discardKeyboardHover(),o.getRootNode().activeElement===o||null===o.dropDownAppendTo||"click"!==t.type||o.contains(t.target)||o.focus(),"click"===t.type&&(!t.target.classList.contains("smart-"+o._element+"-items-group-arrow")&&o._toggleItem(e)||"mouseenter"===o.selectionMode&&"tree"!==i&&!o._minimized))return;let l=o.hasAnimation;if(o._isContainerOpened(a,r))o._closeSubContainers(a,r,!0,!1!==n),s&&e.hasAttribute("focus")&&(o._focusedViaKeyboard=e);else{if(o.$.fireEvent("expanding",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children}).defaultPrevented)return;if(o._positionDetection.placeOverlay(),s&&o._closeSubContainers(a),l&&!s&&("expand"!==t.type&&(o._ensureVisibleOnTransitionend=e),o._expandSection(r)),o._edgeMacFF&&2===a&&s&&r.$.removeClass("not-in-view"),r.$.removeClass("smart-visibility-hidden"),s||"expand"!==t.type){if(s)"keydown"===t.type&&(o._focusedViaKeyboard=e);else{const t=o.$.mainContainer.getElementsByClassName("focus")[0];t&&(t.$.removeClass("focus"),t.removeAttribute("focus")),o._focusedViaKeyboard=e}e.$.addClass("focus"),e.setAttribute("focus","")}if(e.$.addClass("smart-"+o._element+"-items-group-opened"),e.$.addClass("smart-"+o._element+"-items-group-expanded"),e.setAttribute("aria-expanded",!0),o._addOpenedContainer(a,r),s){if(o._ensureVisible(e),e.level>1&&e.parentElement.dropDownHeightSet){const t=o.dropDownPosition,n=e.getBoundingClientRect().top-e.parentElement.container.getBoundingClientRect().top;-1!==t.indexOf("bottom")||"auto"===t?r.style.top=n+"px":-1!==t.indexOf("top")?r.style.top=n+e.offsetHeight+"px":r.style.top=n+e.offsetHeight/2+"px"}r.itemContainer.checkOverflow&&r.itemContainer.dropDownHeightSet&&(o._checkOverflow(r.itemContainer,!1,[r.children[0],r.children[2]]),delete r.itemContainer.checkOverflow)}o._positionExternalContainer(r,e),"tree"===i||o._minimized?l||o._browserBoundsDetection(o.$.mainContainer):o._browserBoundsDetection(r),void 0===t.type&&o._hoverViaKeyboard(o._getFirstEnabledChild(e.itemContainer)),!1!==n&&o.$.fireEvent("expand",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children})}s?o._ripple(e,t):"tree"!==i||l||(o._checkOverflow(o.$.mainContainer,!1,[o.$.scrollButtonNear,o.$.scrollButtonFar]),o._minimized||"expand"===t.type||o._ensureVisible(e))}_mouseenterHandler(){const e=this;e.autoFocusOnMouseenter&&e.getRootNode().activeElement!==e&&e.focus()}_mouseleaveHandler(e){const t=this;if("mouseenter"===t.selectionMode&&"tree"!==t.mode&&!t._minimized){if(null!==t.dropDownAppendTo&&e.relatedTarget)if(t.contains(e.target)){const n=e.relatedTarget.closest(".smart-menu-drop-down");if(n&&n.ownerElement===t)return}else if(t.contains(e.relatedTarget))return;t._isElementHovered=!1,t._autoCloseTimeout=setTimeout((function(){const e=t.context;clearTimeout(t._autoCloseTimeout),t._isElementHovered||(t.context=t,t._close(),t.context=e)}),t.autoCloseDelay)}}_mouseoutMouseoverHandler(e){const t=this;if(t.disabled||t.displayLoadingIndicator)return;let n=e.target.closest("smart-menu-item")||e.target.closest("smart-menu-items-group");if(t.enableShadowDOM&&(n=e.composedPath()[0].closest("smart-menu-item")||e.composedPath()[0].closest("smart-menu-items-group")||n),"mouseover"===e.type&&(t._isElementHovered=!0),null!==n&&!n.disabled&&!n.templateApplied&&("tree"!==t.mode&&!t._minimized||!n.hasAttribute("focus")||!e.relatedTarget||e.target.parentElement!==e.relatedTarget&&e.relatedTarget.parentElement!==e.target))if(t._discardKeyboardHover(!1),"mouseover"===e.type){"mouseenter"!==t.selectionMode||"tree"===t.mode||t._minimized||(n instanceof Smart.MenuItemsGroup&&!n.hasAttribute("hover")?t._selectionHandler(e,n):n instanceof Smart.MenuItem&&t._closeSubContainers(n.level+1));const o=e.target.closest(".smart-menu-drop-down");(!o||o&&!n.contains(o))&&(t.preventHover||(n.$.addClass("hover"),n.setAttribute("hover",""),t._discardKeyboardHover(!0)))}else{if("tree"!==t.mode&&!t._minimized&&("mouseenter"===t.selectionMode&&e.relatedTarget===t.$.mainContainer&&t._close(),n instanceof Smart.MenuItemsGroup&&n.container&&!n.container.$.hasClass("smart-visibility-hidden")))return;n.$.removeClass("hover"),n.removeAttribute("hover")}}_moveDropDownsToExternalContainer(){const e=this;for(let t=0;t<e._containersInBody.length;t++){const n=e._containersInBody[t];e._dropDownParent.appendChild(n),n.$.listen("click",e._selectionHandler.bind(e)),n.$.listen("mouseleave",e._mouseleaveHandler.bind(e)),n.$.listen("mouseout",e._mouseoutMouseoverHandler.bind(e)),n.$.listen("mouseover",e._mouseoutMouseoverHandler.bind(e))}for(let t=0;t<e._containers.length;t++){const n=e._containers[t];n.ownerElement=e,""!==e.theme&&n.classList.add(e.theme),e.rightToLeft&&n.setAttribute("right-to-left",""),n.classList.add("smart-drop-down-repositioned"),n.setAttribute("mode",e.mode),n.setAttribute("drop-down-position",e.dropDownPosition),e.checkboxes&&n.setAttribute("checkboxes","")}}_moveDropDownsToMenu(){const e=this;for(let t=0;t<e._containersInBody.length;t++){const n=e._containersInBody[t];n.$.unlisten("click"),n.$.unlisten("mouseleave"),n.$.unlisten("mouseout"),n.$.unlisten("mouseover"),n.style.left="",n.style.right="",n.style.top="",n.style.marginLeft="",n.style.marginTop="",n.menuItemsGroup.appendChild(n)}for(let t=0;t<e._containers.length;t++){const n=e._containers[t];""!==e.theme&&n.classList.remove(e.theme),n.classList.remove("smart-drop-down-repositioned"),n.removeAttribute("mode"),n.removeAttribute("drop-down-position"),n.removeAttribute("checkboxes"),n.removeAttribute("right-to-left")}}_navigate(e,t,n){const o=this;if(!t)return void("_getNextEnabledChild"===e?o._hoverViaKeyboard(o._getFirstEnabledChild(n)):o._hoverViaKeyboard(o._getLastEnabledChild(n)));const i=o[e](t);i&&(t.$.removeClass("focus"),t.removeAttribute("focus"),o._hoverViaKeyboard(i))}_positionExternalContainer(e,t){const n=this;if(null===n.dropDownAppendTo||2!==e.level)return;const o=n.dropDownPosition,i=n.mode,r=t.getBoundingClientRect(),a=n._positionDetection.getDropDownOffset(),s=r.top+a.y,l=r.bottom+a.y;let d=r.left+a.x,c=r.right+a.x;switch(e.style.top=e.style.left=e.style.right="",n.rightToLeft&&(e.style.right="initial"),-1!==o.indexOf("left")?(d-=e.offsetWidth,"horizontal"!==i&&"overlay-left"!==o||(d+=r.width),e.style.left=d+"px",e.style.right="initial"):"horizontal"===i||"overlay-right"===o?e.style.left=d+"px":n.rightToLeft?e.style.left=c-e.offsetWidth+"px":e.style.left=d+r.width+"px",o){case"bottom-right":case"bottom-left":case"auto":e.style.top="horizontal"===i?l+"px":s+"px";break;case"top-right":case"top-left":e.style.top="horizontal"===i?s-e.offsetHeight+"px":l-e.offsetHeight+"px";break;case"overlay-right":case"overlay-left":e.style.top=s+r.height/2+"px"}}_processDataSource(){const e=this,t=e.dataSource,n=e.displayMember,o=e.itemsMember,i=e.valueMember,r=e.$.mainContainer,a=document.createDocumentFragment();function s(t,r){let a;if(Array.isArray(t[o])&&t[o].length>0){a=document.createElement("smart-"+e._element+"-items-group"),!0===t.checkable&&a.set("checkable",!0),"string"==typeof t.checkMode&&a.set("checkMode",t.checkMode),t.dropDownHeight&&a.set("dropDownHeight",t.dropDownHeight),!0===t.expanded&&"tree"===e.mode&&(a.set("expanded",!0),a.setAttribute("aria-expanded",!0));for(let e=0;e<t[o].length;e++)s(t[o][e],a)}else a=document.createElement("smart-"+e._element+"-item"),void 0!==t.shortcut&&a.set("shortcut",t.shortcut),t.customAttribute&&a.setAttribute(t.customAttribute,"");a.isDirty=!1,void 0!==t.id&&/^[A-Za-z]+[\w\-\:\.]*$/.test(t.id)&&(a.id=t.id),!0===t.checked&&(a.set("checked",!0),a.setAttribute("aria-checked",!0)),!0===t.disabled&&a.set("disabled",!0),void 0!==t[n]?a.set("label",t[n]):"string"==typeof t[o]&&a.set("label",t[o]),!0===t.selected&&a.set("selected",!0),!0===t.separator&&a.set("separator",!0),void 0!==t[i]&&a.set("value",t[i]),r.appendChild(a)}r.innerHTML="",r instanceof Smart.ScrollViewer&&r.removeAll();for(let e=0;e<t.length;e++)s(t[e],a);e.$.mainContainer.appendChild(a),e._processHTML(e.$.mainContainer,1)}_processHTML(e,t,n){const o=this;let i,r;t>1&&(i=o._createMenuItemsGroupContainer(e,t),r=i.itemContainer,(e.expanded||e.hasAttribute("expanded"))&&"tree"===o.mode?o._menuItemsGroupsToExpand.push(e):(e.set("expanded",!1),e.removeAttribute("expanded"),e.setAttribute("aria-expanded",!1)));const a=Array.from(e.children),s=[],l=document.createDocumentFragment();let d=0;for(let n=0;n<a.length;n++){if(t>1&&0===n){d++;continue}const i=a[n];i instanceof Smart.MenuItem||i instanceof Smart.MenuItemsGroup?(o._createItemHTMLStructure(i,t,e,n-d),(i.checked||i.hasAttribute("checked"))&&(i.disabled||i.hasAttribute("disabled")||i.templateApplied?(i.set("checked",!1),i.removeAttribute("checked"),i.removeAttribute("aria-checked")):s.push(i)),t>1&&l.appendChild(i),i instanceof Smart.MenuItemsGroup&&o._processHTML(i,t+1)):(i.parentElement.removeChild(i),d++)}if(t>1){if(r.appendChild(l),e.container=i,e.itemContainer=r,e instanceof Smart.MenuItemsGroup){const n=document.createElement("div");n.className="smart-"+o._element+"-items-group-arrow","menu"===o._element?n.setAttribute("role","presentation"):(n.setAttribute("role","button"),n.setAttribute("aria-label","Toggle")),o._setArrowDirection(n,t),e.firstElementChild.appendChild(n)}o._containers.push(i),2===t&&(o._containersInBody.push(i),o._edgeMacFF&&i.addEventListener("transitionend",(function(e){e.target===this&&this.$.hasClass("smart-visibility-hidden")&&(this.style.left="",this.style.top="",this.$.addClass("not-in-view"))}))),null===o.dropDownAppendTo||"tree"===o.mode||o._minimized?e.appendChild(i):(i.ownerElement=o,o.rightToLeft?i.setAttribute("right-to-left",""):i.removeAttribute("right-to-left"),i.classList.add("smart-drop-down-repositioned"),i.setAttribute("mode",o.mode),i.setAttribute("drop-down-position",o.dropDownPosition),o.checkboxes&&i.setAttribute("checkboxes",""),""!==o.theme&&i.$.addClass(o.theme),i.setAttribute("animation",o.animation),2===t?(o._dropDownParent.appendChild(i),i.$.listen("click",o._selectionHandler.bind(o)),i.$.listen("mouseleave",o._mouseleaveHandler.bind(o)),i.$.listen("mouseout",o._mouseoutMouseoverHandler.bind(o)),i.$.listen("mouseover",o._mouseoutMouseoverHandler.bind(o))):e.appendChild(i))}o._validateRadioButtonSelection(e,t,s),o._sortItems&&!1!==n&&o._sortItems(e)}_processUList(){const e=this,t=new RegExp(/<li>(.(?!<\/li>)|\n)*?<ul>/),n=new RegExp(/<\/ul>(.|\n)*?<\/li>/);let o=e.$.mainContainer.firstElementChild.innerHTML;for(o=o.replace(/\r?\n|\r/g,""),o=o.replace(/<li(.|\n)*?>/g,"<li>"),o=o.replace(/<li><\/li>/g,"<li> </li>"),o=o.replace(/<ul(.|\n)*?>/g,"<ul>");t.test(o);){const n=t.exec(o),i="<smart-"+e._element+"-items-group>"+n[0].slice(4,n[0].length-4);o=o.replace(n[0],i)}for(;n.test(o);){const t=n.exec(o),i="</smart-"+e._element+"-items-group>";o=o.replace(t[0],i)}o=o.replace(/li>/g,"smart-"+e._element+"-item>"),e.$.mainContainer.innerHTML=o}_refreshContainersArrays(){const e=this;for(let t=e._containers.length-1;t>=0;t--){const n=e._containers[t];if(!document.body.contains(n)){e._containers.splice(t,1);const o=e._containersFixedHeight.indexOf(n);o>-1&&(e._containersFixedHeight.splice(o,1),e._additionalScrollButtons.splice(o,1))}}e._checkContainersLength()}_refreshItemPaths(e,t,n,o){const i=this;let r;r=t?e:e.container.itemContainer;const a=n?n(e):r.children;for(let r=0;r<a.length;r++){const s=a[r];let l;o&&(s.originalIndex=r),l=t?""+r:e.path+"."+r,s.path=l,i._menuItems[l]=s,s instanceof Smart.MenuItemsGroup&&i._refreshItemPaths(s,void 0,n,o)}}_removeContainerFixedHeight(){const e=this;for(let t=0;t<e._containersFixedHeight.length;t++){const n=e._containersFixedHeight[t];n.style.height="",n.itemContainer.$.removeClass("scroll-buttons-shown"),n.itemContainer.$.removeClass("one-button-shown"),n.children[0].$.addClass("smart-hidden"),n.children[2].$.addClass("smart-hidden"),n.itemContainer.checkOverflow=!0}}_removeContainersInBody(){const e=this;if(null!==e.dropDownAppendTo&&!e._minimized)for(let t=0;t<e._containersInBody.length;t++)e._containersInBody[t].remove()}_reparentMenu(e,t){const n=this;if("dropDown"===n.mode&&(null!==n._dropDownParent||e)&&n._dropDownParent!==n.parentElement){if(e&&null!==t){if(null===n._dropDownParent)return n._positionRelativeTo.appendChild(n),void(n._positionRelativeTo=null)}else n._positionRelativeTo=n.parentElement;n._dropDownParent.appendChild(n)}}refresh(){const e=this;if(e._suppressResizeHandler)return void delete e._suppressResizeHandler;const t=e.minimizeWidth,n=e.mode;if(null!==t&&"dropDown"!==n){if(e.offsetWidth<=t&&!e._minimized)return void e.minimize();e.offsetWidth>t&&e.maximize()}(null!==e.dropDownAppendTo||"tree"===n||e.$mainContainer.hasClass("simple"))&&e._checkOverflow(e.$.mainContainer,"horizontal"===n,[e.$.scrollButtonNear,e.$.scrollButtonFar])}_resizeHandler(){this.refresh()}_ripple(e,t){if(this.hasRippleAnimation&&"click"===t.type)return Smart.Utilities.Animation.Ripple.animate(e,t.pageX,t.pageY),!0}_scroll(e){if(e.closest("[template-applied]"))return;const t=this,n=t.$.mainContainer,o=t.mode,i=e.classList.contains("smart-scroll-button-near")?-1:1;let r;if(e.parentElement===t.$.container)r=n,"tree"!==o&&t._closeSubContainers(2),"horizontal"===t.mode?(n.scrollLeft=n.scrollLeft+10*i,t._updateScrollButtonVisibility(n,!0,[t.$.scrollButtonNear,t.$.scrollButtonFar])):(n.scrollTop=n.scrollTop+10*i,t._updateScrollButtonVisibility(n,!1,[t.$.scrollButtonNear,t.$.scrollButtonFar]));else{const n=e.parentElement,o=n.itemContainer;r=o,t._closeSubContainers(n.level+1),o.scrollTop=o.scrollTop+10*i,t._updateScrollButtonVisibility(o,!1,[n.children[0],n.children[2]])}t._scrollInfo.set(r,{left:r.scrollLeft,top:r.scrollTop})}_selectionHandler(e,t){const n=this,o=e.target;if(o.closest("[template-applied]")&&e.stopPropagation(),!n.disabled&&!n.displayLoadingIndicator){if(void 0===t){if("click"===e.type){const t=o.closest("smart-repeat-button");if(t)return void n._scroll(t,e)}if(!e.isTrusted)return;const i=o.closest("smart-"+n._element+"-item");if(i)return void n._menuItemSelectionHandler(i,e);if((t=o.closest("smart-"+n._element+"-items-group"))&&(o===t.container||o===t.container.firstElementChild))return}t&&!t.disabled&&n._menuItemsGroupSelectionHandler(t,e)}}_setArrowDirection(e,t){const n=this,o=n.mode;"tree"===o||n._minimized?e.className="smart-"+n._element+"-items-group-arrow down smart-arrow-down":"overlay"!==n.dropDownPosition.slice(0,7)?2===t&&"horizontal"===o?"top"!==n.dropDownPosition.slice(0,3)?e.className="smart-menu-items-group-arrow down smart-arrow-down":e.className="smart-menu-items-group-arrow up smart-arrow-up":e.className="smart-menu-items-group-arrow "+(n.rightToLeft?"left smart-arrow-left":"right smart-arrow-right"):e.className="smart-menu-items-group-arrow minus"}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return void e.removeAttribute("tabindex");const t=e.getAttribute("tabindex");(null===t||t<0)&&e.setAttribute("tabindex",0)}_setItemLabel(e,t){const n=this,o=n.context,i=e.querySelector(".smart-menu-item-label-element>span");n.context=n,n._setLabel(t,i,e,!0),n._checkOverflow(n.$.mainContainer,"horizontal"===n.mode,[n.$.scrollButtonNear,n.$.scrollButtonFar]),n.context=o}_setLabel(e,t,n,o){const i=document.getElementById(e);if(null!==i&&"template"===i.tagName.toLowerCase()){const r=document.importNode(i.content,!0);if(n instanceof Smart.MenuItem)t.appendChild(r),o&&(n.setAttribute("template-applied",""),n.templateApplied=!0);else if(Smart.ListMenu&&this instanceof Smart.ListMenu){const e=new RegExp(/{{title="(.*)"}}/);for(let t=0;t<r.childNodes.length;t++)e.test(r.childNodes[t].innerHTML)?(n.titleLabel=e.exec(r.childNodes[t].innerHTML)[1],r.childNodes[t].innerHTML=r.childNodes[t].innerHTML.replace(e,"")):e.test(r.childNodes[t].textContent)&&(n.titleLabel=e.exec(r.childNodes[t].textContent)[1],r.childNodes[t].textContent=r.childNodes[t].textContent.replace(e,""));void 0===n.titleLabel&&(n.titleLabel=r.textContent),t.appendChild(r)}else t.innerHTML=e,n.titleLabel=e}else t.innerHTML=e,n instanceof Smart.MenuItemsGroup&&(n.titleLabel=e)}_toggleItem(e){const t=this;if(t.checkboxes){const n=1===e.level?t:e.parentItem;if(n.checkable){const o=t._getItemCheckableInfo(e,n);let i=!1;return"none"!==o.checkMode&&("checkbox"===o.checkMode?(i=!0,e.set("checked",!e.checked),e.checked?e.setAttribute("aria-checked",!0):e.removeAttribute("aria-checked"),t.$.fireEvent("itemCheckChange",{item:e,label:e.label,value:e.value,checked:e.checked})):"radioButton"!==o.checkMode||e.checked||(i=!0,e.set("checked",!0),e.setAttribute("aria-checked",!0),t._uncheckSiblings(e,o.siblings),t.$.fireEvent("itemCheckChange",{item:e,label:e.label,value:e.value,checked:!0})),e instanceof Smart.MenuItem&&i&&t.$.fireEvent("itemClick",{item:e,label:e.label,value:e.value}),"tree"===t.mode||"ListMenu"===t.elementName||t.preventCloseOnCheck||(t._close(),t.close()),!0)}}return!1}_getItemCheckableInfo(e,t){const n=Array.from(e.parentElement.children),o=t.checkMode.replace(/\s/g,"").split(",");let i,r;if(1===o.length)i=o[0],r=n;else{let t=0,a=!1;r=[];for(let o=0;o<n.length;o++){const i=n[o];if(r.push(i),i===e&&(a=!0),i.separator){if(!0===a)break;t++,r=[]}}i=o[t]}return{checkMode:i,siblings:r}}_refreshCheckableItems(e){const t=this,n=!t.checkboxes;(e?[e]:[t].concat(t._containers.map((e=>e.menuItemsGroup)))).forEach((e=>{const o=Array.from((e===t?t.$.mainContainer:e.itemContainer).children);let i=e.checkMode.replace(/\s/g,"").split(",");if(n||!e.checkable||1===i.length)return void o.forEach((e=>e.removeAttribute("check-type")));let r=0;i=i.map((e=>-1===["checkbox","radioButton","none"].indexOf(e)?"none":e));let a=[],s=[];for(let e=0;e<o.length;e++){const n=o[e];let l=i[r];if(void 0===l&&(l=i[r]="none"),"none"!==l&&t._isChildEnabled(n)||(n.checked=!1,n.removeAttribute("aria-checked")),"none"===l?n.setAttribute("role","menuitem"):"checkbox"===l?n.setAttribute("role","menuitemcheckbox"):"radioButton"===l&&(n.setAttribute("role","menuitemradio"),a.push(n),n.checked&&s.push(n)),n.setAttribute("check-type",l),n.separator){if(a.length>0)if(s.length>1)for(let e=0;e<s.length-1;e++)s[e].checked=!1;else if(0===s.length)for(let e=0;e<a.length;e++)if(t._isChildEnabled(a[e])){a[e].checked=!0;break}a=[],s=[],r++}}e.checkMode=i.join(", ")}))}_transitionendHandler(e){const t=this;"dropDown"===t.mode&&t.opened&&e.target===t&&"opacity"===e.propertyName&&(t._checkOverflowOnOpen&&(t._checkOverflow(t.$.mainContainer,!1,[t.$.scrollButtonNear,t.$.scrollButtonFar]),delete t._checkOverflowOnOpen),t.getRootNode().activeElement===t||t._noAutoFocus||t.focus())}_transitionendHandlerCollapse(){let e,t;if(1===arguments.length){if("visibility"===arguments[0].propertyName)return;t=this,e=t.menuItemsGroup.menu}else e=arguments[0],t=arguments[1];t.menuItemsGroup.$.removeClass("smart-"+e._element+"-items-group-expanded"),t.menuItemsGroup.setAttribute("aria-expanded",!1),t.removeEventListener("transitionend",e._transitionendHandlerCollapse),t.style.height=null,t.$.addClass("smart-visibility-hidden"),e._checkOverflow(e.$.mainContainer,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar]),e._minimized&&e._browserBoundsDetection(e.$.mainContainer),delete e._treeAnimationInProgress}_transitionendHandlerExpand(){let e,t;if(1===arguments.length){if("visibility"===arguments[0].propertyName)return;t=this,e=t.menuItemsGroup.menu}else e=arguments[0],t=arguments[1];t.removeEventListener("transitionend",e._transitionendHandlerExpand),t.style.height=null,e._checkOverflow(e.$.mainContainer,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar]),e._minimized&&e._browserBoundsDetection(e.$.mainContainer),e._ensureVisibleOnTransitionend&&(e._ensureVisible(e._ensureVisibleOnTransitionend),delete e._ensureVisibleOnTransitionend),delete e._treeAnimationInProgress}_uncheckSiblings(e,t){for(let n=0;n<t.length;n++){const o=t[n];o!==e&&o.checked&&(o.set("checked",!1),o.removeAttribute("aria-checked"),this.$.fireEvent("itemCheckChange",{item:o,label:o.label,value:o.value,checked:!1}))}}_unsortItems(e,t){const n=this;let o,i,r=[];e===n.$.mainContainer?(i=e,o=e.children):(i=e.container.firstElementChild,o=i.children);for(let e=0;e<o.length;e++){const i=o[e];r[i.originalIndex]=i,i instanceof Smart.MenuItemsGroup&&void 0===t&&n._unsortItems(i)}if(!(r.length<2))for(let e=0;e<r.length;e++)i.appendChild(r[e])}_updateItemRoles(e){const t=this;for(let n in t._menuItems){const o=t._menuItems[n],i=o.parentItem||t;e&&i!==e||(t.checkboxes&&i.checkable?o.setAttribute("role","checkbox"===i.checkMode?"menuitemcheckbox":"menuitemradio"):o.setAttribute("role","menuitem"))}t._refreshCheckableItems(e)}_updateScrollButtonVisibility(e,t,n){const o=this,i=o.overflow,r=e===o.$.mainContainer;if(r&&"hidden"===i)return;let a,s,l,d=!0,c=!0;if(t?(a="scrollLeft",s="offsetWidth",l="scrollWidth"):(a="scrollTop",s="offsetHeight",l="scrollHeight"),0===Math.round(e[a])&&(d=!1),Math.round(e[s]+e[a])>=Math.round(e[l])&&(c=!1),r&&"auto"!==i)"scroll"!==i||o.disabled||(n[0].disabled=!d,n[1].disabled=!c);else{if(d&&c)return n[0].$.removeClass("smart-hidden"),n[1].$.removeClass("smart-hidden"),void e.classList.remove("one-button-shown");d?n[0].$.removeClass("smart-hidden"):n[0].$.addClass("smart-hidden"),c?n[1].$.removeClass("smart-hidden"):n[1].$.addClass("smart-hidden"),e.classList.add("one-button-shown")}}_validateRadioButtonSelection(e,t,n){const o=this;if(o.checkboxes){let i,r;if(1===t?(i=o,r=o.$.mainContainer):(i=e,r=e.itemContainer),"radioButton"===i.checkMode&&i.checkable)if(n.length>1)for(let e=n.length-2;e>=0;e--)n[e].set("checked",!1),n[e].removeAttribute("aria-checked");else if(0===n.length){const e=o._getFirstEnabledChild(r);e&&!o.disableAutoCheck&&(e.set("checked",!0),e.setAttribute("aria-checked",!0))}}}});
67
67
  (()=>{class e extends HTMLElement{constructor(){super(),this._properties={min:50,label:"Item",modifiers:["resize","drag","close"],size:null}}_setProperty(e,t){const i=this;if(i._properties[e]===t)return;if(i._properties[e]=t,i._updating=!0,"disabled"===e||"modifiers"===e?t?i.setAttribute(e,t):i.removeAttribute(e):null===t?i.removeAttribute(e):i.setAttribute(e,t),!i.isCompleted)return;const r=i.closest("smart-layout");r&&(r._resizeDetails||r._updating||!r.isRendered||r.refresh()),i._updating=!1}get label(){return this._properties.label}set label(e){this._setProperty("label",e)}get modifiers(){return this._properties.modifiers}set modifiers(e){this._setProperty("modifiers",e)}get min(){return this._properties.min}set min(e){this._setProperty("min",e)}get size(){return this._properties.size}set size(e){null!==e?"string"==typeof e?this._setProperty("size",e):this._setProperty("size",Math.max(this.min,e)):this._setProperty("size",e)}static get observedAttributes(){return["min","size","label","modifiers"]}attributeChangedCallback(e,t,i){const r=this;if(t!==i&&r.isCompleted)if("size"===e){if(!r._updating){if(null===i)return void(this[e]=null);r[e]=Math.max(r.min,parseInt(i))}}else r[e]=i}connectedCallback(){this.isCompleted||this.render()}whenRendered(e){const t=this;t.isRendered?e():(t.whenRenderedCallbacks||(t.whenRenderedCallbacks=[]),t.whenRenderedCallbacks.push(e))}render(){const e=this;e.hasAttribute("data-id")||e.setAttribute("data-id","id"+Math.random().toString(16).slice(2)),e.hasAttribute("label")||e.setAttribute("label",e.label),e.hasAttribute("min")||e.setAttribute("min",e.min),e.hasAttribute("label")||e.setAttribute("label",e.label),e.hasAttribute("modifiers")||e.setAttribute("modifiers",e.modifiers);for(let t=0;t<e.attributes.length;t++){const i=e.attributes[t],r=i.name,s=i.value;isNaN(s)||"min"!==r&&"size"!==r?e._properties[r]=s:e._properties[r]=parseInt(s)}if(e.classList.add("smart-layout-item"),e.isCompleted=!0,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}}}class t extends e{constructor(){super(),this._properties.label="Group",this._properties.orientation="vertical"}get orientation(){return this._properties.orientation}set orientation(e){this._setProperty("orientation",e)}static get observedAttributes(){return["min","size","modifiers","orientation","position"]}render(){const e=this;super.render(),e.className="smart-layout-group",e.hasAttribute("orientation")?e._properties.orientation=e.getAttribute("orientation"):e.setAttribute("orientation",e._properties.orientation)}}class i extends t{constructor(){super(),this._properties.position="top",this._properties.label="TabGroup"}get position(){return this._properties.position}set position(e){this._setProperty("position",e)}render(){const e=this;super.render(),!e.hasAttribute("position")&&e.position&&e.setAttribute("position","top")}static get observedAttributes(){return["min","size","modifiers","orientation","position"]}}class r extends t{constructor(){super(),this._properties.label="TabItem"}}customElements.define("smart-layout-group",t),customElements.define("smart-layout-item",e),customElements.define("smart-tab-layout-group",i),customElements.define("smart-tab-layout-item",r),Smart("smart-layout",class extends Smart.ContentElement{static get properties(){return{allowLiveSplit:{value:!1,type:"boolean"},allowContextMenu:{value:!1,type:"boolean"},contextMenuDataSource:{value:["select","delete"],type:"any"},dataSource:{reflectToAttribute:!1,value:null,type:"any"},messages:{value:{en:{select:"Select Parent",delete:"Delete"}},type:"object",extend:!0},orientation:{value:"vertical",type:"string"},selectedIndex:{value:null,type:"any"}}}static get listeners(){return{contextmenu:"_contextMenuHandler","document.down":"_documentDownHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","document.selectstart":"_documentSelectStartHandler",mouseleave:"_leaveHandler",mouseenter:"_enterHandler",dragStart:"_dragStart","document.keyup":"_keyUpHandler"}}_dragStart(e){e.stopPropagation(),e.preventDefault()}_leaveHandler(){const e=this;e._resizeDetails||(e._handleButtonsVisibility(null),e._hideSplitter(),requestAnimationFrame((()=>{e.classList.remove("outline")})))}_enterHandler(){const e=this;e._resizeDetails||(e._handleButtonsVisibility(e._selectedItem),e._updateSplitter(),requestAnimationFrame((()=>{e.classList.add("outline")})))}template(){return'<div id="container" role="presentation"><smart-layout-group data-id="root" id="itemsContainer"><content></content></smart-layout-group><div root-splitter id="splitter" class="smart-layout-splitter"></div>'}propertyChangedHandler(e,t,i){const r=this;switch(e){case"contextMenuDataSource":r._contextMenu&&(r._closeContextMenu(),r._contextMenu.innerHTML="");break;case"orientation":r.$.itemsContainer&&(r.$.itemsContainer.orientation=r.orientation);break;case"dataSource":r.dataBind();break;case"selectedIndex":r._handleItemClick(r.getItem(i+""),!0);break;default:super.propertyChangedHandler(e,t,i)}}dataBind(){const e=this;e.$.itemsContainer.innerHTML="";let t="";const i=(e,r)=>{for(let s=0;s<e.length;s++){const n=e[s],o=n.size,a=n.min,l=n.modifiers,d=n.type,c=n.position,u=n.orientation?n.orientation:"vertical";let p="";if(void 0!==o&&(p+=`size="${o}" `),void 0!==a&&(p+=`min="${a}" `),void 0!==l&&(p+=`modifiers="${l}" `),void 0!==c&&(p+=`position="${c}" `),n.items)p+=`orientation=${u} `,"tabs"===d?(t+=`<smart-tab-layout-group ${p}>`,i(n.items,!0),t+="</smart-tab-layout-group>"):(t+=`<smart-layout-group ${p}>`,i(n.items),t+="</smart-layout-group>");else{const e=n.content||"";t+=r?`<smart-tab-layout-item ${p}>`+e+"</smart-tab-layout-item>":`<smart-layout-item ${p}>`+e+"</smart-layout-item>"}}};i(e.dataSource),e.$.itemsContainer.innerHTML=t,e.refresh()}render(){const e=this;e.setAttribute("role","group"),e.selectedIndex&&e._handleItemClick(e.getItem(e.selectedIndex+""),!0),e.checkLicense();const t=()=>{e.dataSource?e.dataBind():e.dataSource=e._getDataSource(e._getLayout()),e.$.itemsContainer.orientation=e.orientation,super.render(),e.refresh(),e._updateSplitter()};"complete"===document.readyState?t():window.addEventListener("load",(()=>{t()}))}getItem(e){if(null==e)return;e=(e+"").split(".");let t,i=this._getDataSource(this._getLayout());for(let r=0;r<e.length&&(t=i[e[r]],t);r++)i=t.items;return t}_contextMenuHandler(e){const i=this;let r=e.target;if(i.allowContextMenu&&r.closest){if(r.closest(".smart-layout-context-menu"))return void e.preventDefault();let s=i.querySelector("[selected][data-id]");if(s||(s=r.closest(".smart-layout-item")||r.closest(".smart-layout-group")),!s)return;e.preventDefault(),i._createContextMenu();const n=i._contextMenu.children;for(let e=0;e<n.length;e++){const i=n[e];"delete"===i.getAttribute("value")?s.hasAttribute("index")&&"0"===s.getAttribute("index")?i.setAttribute("disabled",""):i.removeAttribute("disabled"):"select"===i.getAttribute("value")&&(s.hasAttribute("index")&&"0"===s.getAttribute("index")||!(s.parentElement instanceof t)?i.setAttribute("disabled",""):i.removeAttribute("disabled"))}i._openContextMenu(s,e.pageX,e.pageY)}}_createContextMenu(){const e=this;let t=e._contextMenu;if(t||(t=document.createElement("div"),t.classList.add("smart-layout-context-menu","smart-visibility-hidden"),e._contextMenu=t),!t.innerHTML){const i=e.contextMenuDataSource;for(let r=0;r<i.length;r++){const s=i[r];let n,o;"object"==typeof s?(n=s.label,o=s.value):o=n=s+"",t.innerHTML+=`<div class="smart-layout-context-menu-item" value="${o}">${e.localize(n)||n}</div>`}}}_openContextMenu(e,t,i){const r=this,s=r._contextMenu;if(!s||!s.classList.contains("smart-visibility-hidden"))return;r.$.fireEvent("opening").defaultPrevented||e.parentElement&&(s._target=e,r._opening=!0,r.$.container.appendChild(s),r._positionContextMenu(t,i),s.classList.remove("smart-visibility-hidden"),r.$.fireEvent("open"))}_closeContextMenu(){const e=this,t=e._contextMenu;if(!t||t.classList.contains("smart-visibility-hidden"))return;e.$.fireEvent("closing").defaultPrevented||(delete e._opening,e.hasAnimation&&t.addEventListener("transitionend",e._contextMenuTransitionEndHandler.bind(e),{once:!0}),t.classList.add("smart-visibility-hidden"),e.$.fireEvent("close"))}_contextMenuTransitionEndHandler(){const e=this,t=e._contextMenu;t&&!e._opening&&t.parentElement&&e.$.container.removeChild(t)}_positionContextMenu(e,t){const i=this._contextMenu;if(!i)return;const r=this.$.container.getBoundingClientRect();e-=r.left+window.pageXOffset,t-=r.top+window.pageYOffset,e+i.offsetWidth>r.width&&(e-=e+i.offsetWidth-r.width),t+i.offsetHeight>r.height&&(t-=t+i.offsetHeight-r.height),i.style.left=e+"px",i.style.top=t+"px"}_documentDownHandler(e){const t=this,i=e.originalEvent.target;t.contains(i)&&i.closest&&(t._target=i,t._updateSplitter())}_documentMoveHandler(e){const t=this,s=e.originalEvent.target,n=t._contextMenu;if(n&&!Smart.Utilities.Core.isMobile){if(n.querySelector(".smart-layout-context-menu-item[hover]")){const e=n.children;for(let t=0;t<e.length;t++)e[t].removeAttribute("hover")}n.contains(s)&&s.closest&&s.closest(".smart-layout-context-menu-item")&&s.setAttribute("hover","")}if(t._dragDetails){const s=Math.abs(t._dragDetails.pageX-e.pageX);if(Math.abs(t._dragDetails.pageY-e.pageY)<=5&&s<=5)return;t._dragDetails.feedback.parentElement||(document.body.appendChild(t._dragDetails.feedback),document.body.appendChild(t._dragDetails.overlay),setTimeout((()=>{t._dragDetails.feedback.classList.add("dragging")}),100)),t._dragDetails.dragging=!0,t._dragDetails.feedback.style.left=e.pageX-t._dragDetails.feedback.offsetWidth/2-5+"px",t._dragDetails.feedback.style.top=e.pageY-t._dragDetails.feedback.offsetHeight/2-5+"px";const n=document.elementsFromPoint(e.pageX,e.pageY);let o=null,a=!1;for(let e=0;e<n.length;e++){const s=n[e];if(!t._dragDetails.feedback.contains(s)){if(s.classList.contains("smart-layout-tab-strip")){if(t._dragDetails.element.contains(s))continue;o=s.parentElement,a=!0;break}if((s.parentElement!==t._dragDetails.parent&&s!==t._dragDetails.parent||1!==t._dragDetails.layoutGroup.items.length)&&!t._dragDetails.element.contains(s)){if(s instanceof r){o=s.parentElement;break}if(s instanceof i){o=s;break}}}}const l=(i,r)=>{const s=t.offset(i);let n=null,o=50,a=r,l=r;r?o=0:(l=i.offsetWidth/3,a=i.offsetHeight/3);const d=[{left:s.left,top:s.top,right:s.left+o,bottom:s.top+o,position:"top"},{left:s.left+o,top:s.top,right:s.left+i.offsetWidth-o,bottom:s.top+a-o,position:"top"},{left:s.left+i.offsetWidth-o,top:s.top,right:s.left+i.offsetWidth,bottom:s.top+o,position:"top"},{left:s.left,top:s.top+o,right:s.left+l,bottom:s.top+i.offsetHeight-o,position:"left"},{left:s.left+i.offsetWidth-l,top:s.top+o,right:s.left+i.offsetWidth,bottom:s.top+i.offsetHeight-o,position:"right"},{left:s.left,top:s.top+i.offsetHeight-o,right:s.left+o,bottom:s.top+i.offsetHeight,position:"bottom"},{left:s.left+o,top:s.top+i.offsetHeight-a+o,right:s.left+i.offsetWidth-o,bottom:s.top+i.offsetHeight,position:"bottom"},{left:s.left+i.offsetWidth-o,top:s.top+i.offsetHeight-o,right:s.left+i.offsetWidth,bottom:s.top+i.offsetHeight,position:"bottom"}];for(let t=0;t<d.length;t++){const i=d[t];if(i.left<=e.pageX&&e.pageX<=i.right&&i.top<=e.pageY&&e.pageY<=i.bottom){n=i.position;break}}return n},d=t.querySelector("smart-layout-group");let c=l(d,10),u=null;c?u=d:o?a?o!==t._dragDetails.parent&&(c="center",u=o):(c=l(o)||"center",u=o):t._handleDropArea(null),u&&(t._dragDetails.current=u,t._dragDetails.position=c,t._handleDropArea(u,c))}if(t._resizeDetails){const i=Math.abs(t._resizeDetails.clientX-e.clientX),r=Math.abs(t._resizeDetails.clientY-e.clientY),s=t._resizeDetails.splitter,n=t._resizeDetails.item,o=t._resizeDetails.itemRect,a=t._resizeDetails.previousItemRect,l=t._resizeDetails.previousItem,d=t._resizeDetails.nextItemRect,c=t._resizeDetails.nextItem,u=parseInt(n.getAttribute("min")),p=e=>{e.classList.contains("smart-visibility-hidden")||(e.style.right="",e.style.top="",e.style.left="",e.style.bottom="")};if(p(s),p(t.$.splitter),s.classList.remove("error"),s.classList.add("active"),!t._resizeDetails.dragging){if(s.classList.contains("horizontal")&&r<=5)return;if(s.classList.contains("vertical")&&i<=5)return;t._resizeDetails.dragging=!0}let m={clientPos:"clientX",pos:"x",size:"width",near:"left",far:"right",offsetSize:"offsetWidth"};s.classList.contains("horizontal")&&(m={clientPos:"clientY",pos:"y",size:"height",near:"top",far:"bottom",offsetSize:"offsetHeight"});const f=e=>{const i=t.offset(e),r=t.offset(t);t.$.splitter.style.width=e.offsetWidth+"px",t.$.splitter.style.height=e.offsetHeight+"px",t.$.splitter.className=e.className,t.$.splitter.style.left=i.left-r.left+"px",t.$.splitter.style.top=i.top-r.top+"px",e.setAttribute("drag",""),t.$.splitter.setAttribute("drag","")};if(s.classList.contains("last")){let i=e[m.clientPos]-t._resizeDetails.splitterRect[m.pos],r=o[m.size]-u;if(i>r&&(i=r,s.classList.add("error")),a){const e=parseInt(l.getAttribute("min"));let t=a[m.size]-e;i<-t&&(i=-t,s.classList.add("error"))}s.style[m.near]=i+"px";const d=n[m.offsetSize]-i;if(n.setAttribute("size",d),l){const e=n[m.offsetSize]+l[m.offsetSize]-d;l.setAttribute("size",e)}}else{let i=-e[m.clientPos]+t._resizeDetails.splitterRect[m.pos],r=o[m.size]-u;if(i>r&&(i=r,s.classList.add("error")),d){const e=parseInt(c.getAttribute("min"));let t=-d[m.size]+e;i<t&&(i=t,s.classList.add("error"))}s.style[m.far]=i+"px";const a=n[m.offsetSize]-i;if(n.setAttribute("size",a),c){const e=c[m.offsetSize]+n[m.offsetSize]-a;c.setAttribute("size",e)}}f(s)}}_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)}}_keyUpHandler(e){const t=this;if("Escape"===e.key){if(t._dragDetails&&(t._dragDetails.feedback.remove(),t._dragDetails.overlay.remove(),t._dragDetails=null,t._handleDropArea(null)),t._resizeDetails){const e=t._resizeDetails;return e.splitter.classList.contains("last")?e.previousItem.size=e.previousItemSize:e.nextItem.size=e.nextItem.previousItemSize,e.item.size=e.itemSize,t.refresh(),t._handleItemClick(e.item),void(t._resizeDetails=null)}}else"Delete"===e.key&&(e.ctrlKey||e.metaKey)&&t._selectedItem&&t._removeLayoutItem(t._selectedItem)}_endDrag(){const e=this;if(e._handleDropArea(null),!e._dragDetails.dragging)return void(e._dragDetails=null);const t=e._dragDetails.current,i=e._dragDetails.element,r=e._dragDetails.position;if(e._handleDropArea(null),t){if(e._addTabLayoutItem(t,r,i),e._removeLayoutItem(i),t.parentElement&&1===Array.from(t.parentElement.parentElement.children).filter((e=>!!e.classList.contains("smart-layout-group"))).length){const i=t.parentElement,r=i.parentElement,s=r.parentElement;if("root"!==r.getAttribute("data-id")&&"root"!==s.getAttribute("data-id")&&s!==e){const e=Array.from(s.children).indexOf(i.parentElement);e>=0?s.insertBefore(i,s.children[e]):s.appendChild(i),r.remove()}}e.refresh(),e._updateSplitter(),requestAnimationFrame((()=>{e.classList.add("outline"),e.querySelectorAll(".smart-element").forEach((e=>{e.$.fireEvent("resize")}))}))}e.$.fireEvent("stateChange",{type:"insert",item:i}),e._dragDetails.feedback.remove(),e._dragDetails.overlay.remove(),e._dragDetails=null}_documentUpHandler(e){const t=this,i=Smart.Utilities.Core.isMobile,s=i?document.elementFromPoint(e.pageX-window.pageXOffset,e.pageY-window.pageYOffset):e.originalEvent.target;if(2!==e.button){if(t._dragDetails&&t._endDrag(e),t._resizeDetails){const e=t._resizeDetails;return e.item&&(e.item.style.overflow=""),e.previousItem&&(e.previousItem.style.overflow=""),e.nextItem&&(e.nextItem.style.overflow=""),t.refresh(),t._handleItemClick(e.item),t._resizeDetails=null,void t.querySelectorAll(".smart-element").forEach((e=>{e.$.fireEvent("resize")}))}if(t.contains(s)&&(t.classList.add("outline"),t._target&&!s.item&&(s instanceof r?t._handleItemClick(s):t._handleItemClick(s.closest(".smart-layout-item"))),t._target)){if(t._target!==s)return void delete t._target;if(!e.button&&s.closest(".smart-layout-buttons-container")){const i=e.originalEvent.target;t._handleButtonClick(i.item,i.position)}else s.closest(".smart-layout-context-menu")&&(!i&&!e.button||i)&&t._handleMenuItemClick(s.closest(".smart-layout-context-menu-item"));delete t._target}}}_documentSelectStartHandler(e){this._target&&e.preventDefault()}_getDataSource(i,r,s){const n=this;let o=[];s||(s=0),r||(r="");for(let a=0;a<i.length;a++){const l=i[a],d={label:l.label,id:l.getAttribute("data-id"),orientation:l.orientation,size:l.size,min:l.min,type:l.type,modifiers:l.modifiers,position:l.position};if(l.removeAttribute("index"),l instanceof t){if(o.push(d),d.index=""!==r?r+"."+s:s.toString(),l.setAttribute("index",d.index),l.items){const e=n._getDataSource(l.items,d.index,0);d.items=e}}else if(l instanceof e)if(l.items){const e=n._getDataSource(l.items,r,s);o=o.concat(e)}else d.index=""!==r?r+"."+s:s.toString(),l.setAttribute("index",d.index),o.push(d);s++}return o}_getLayout(){const e=this,i=arguments.length?arguments[0]:e.$.itemsContainer;e._buttons&&e._buttons.remove(),e._dropArea&&e._dropArea.remove();const r=e.querySelectorAll(".smart-layout-splitter");for(let t=0;t<r.length;t++){const i=r[t];i!==e.$.splitter&&i.remove()}i.items=Array.from(i.children),i.items=i.items.filter((e=>e!==i.tabs&&e.hasAttribute("data-id")));const s=i.items.map((function(i){if(i.classList.contains("smart-layout-tab-strip"))return null;const r=i,s=i instanceof t?i:null;return s&&(r.items=e._getLayout(s)),r}));if(i!==e.$.itemsContainer)return s.filter((e=>null!==e&&e!==i.tabs));const n=[],o=i;return o.items=s.filter((e=>null!==e&&e!==i.tabs)),n.push(o),n}_updateSplitter(){const e=this;e._buttons&&e._dragDetails&&e._buttons.remove(),e._removeSplitter();const t=e.querySelectorAll("[data-id]");for(let i=0;i<t.length;i++){const r=t[i];if("root"!==r.getAttribute("data-id")){if(r.hasAttribute("role")){const e=r.getAttribute("role");if("gridcell"===e||"row"===e||"columnheader"===e||"rowheader"===e)continue}r.setAttribute("hover",""),e._handleSplitter(r)}}}_hideSplitter(){const e=this.querySelectorAll("[data-id]");for(let t=0;t<e.length;t++){e[t].removeAttribute("hover")}}_removeSplitter(){const e=this,t=e.querySelectorAll(".smart-layout-splitter");for(let i=0;i<t.length;i++){const r=t[i];r!==e.$.splitter&&r.remove()}e._hideSplitter()}_handleItemClick(e){const t=this,i=t.selectedIndex;let r=null;return e?(r=e instanceof HTMLElement?e:t.querySelector("[data-id="+e.id+"]"),r&&r.readonly?(t._closeContextMenu(),void(t.selectedIndex=null)):(t.querySelectorAll("[data-id]").forEach((e=>e.removeAttribute("selected"))),t._closeContextMenu(),void(r?(t.selectedIndex=r.getAttribute("index"),r.setAttribute("selected",""),r.setAttribute("hover",""),t._selectedItem=r,r.classList.contains("smart-hidden")&&t.refresh(),t._handleButtonsVisibility(r),i!==t.selectedIndex&&t.$.fireEvent("change",{selectedIndex:t.selectedIndex,oldSelectedIndex:i}),t._updateSplitter()):t.refresh()))):(t._closeContextMenu(),t.selectedIndex=null,t.querySelectorAll("[data-id]").forEach((e=>e.removeAttribute("selected"))),void(t._selectedItem=null))}_handleButtonClick(e,t){const i=this,r=i._addLayoutItem(e,t);i.$.fireEvent("stateChange",{type:"insert",item:r}),i._handleItemClick(r,!0)}_handleMenuItemClick(e){const t=this;if(!e||e.hasAttribute("disabled"))return;const i=e.getAttribute("value"),r=t._contextMenu;t.$.fireEvent("menuItemClick",{target:r?r._target:null,item:e,label:e.textContent,value:i});const s=r._target;s&&("select"===i&&t._handleItemClick(s.parentElement?s.parentElement:s),"delete"===i&&t._removeLayoutItem(s))}_removeLayoutItem(t){const i=this;if("root"!==t.getAttribute("data-id")){if(t instanceof e&&1===t.parentElement.items.length){let e=t.parentElement,r=e;for(;e&&e.items&&1===e.items.length&&"root"!==e.getAttribute("data-id");)r=e,e=e.parentElement;"root"!==r.getAttribute("data-id")?r.remove():i.allowLiveSplit&&r.appendChild(document.createElement("smart-layout-item"))}else t.remove();i.refresh(),i.$.fireEvent("stateChange",{type:"delete",item:t})}}refresh(){const e=this;if(e._isUpdating)return;e.dataSource=e._getDataSource(e._getLayout()),e.$.splitter.className="smart-visibility-hidden smart-layout-splitter";const t=t=>{const s=e.getItem(t.getAttribute("index"));if(!s)return;t.style.gridTemplateColumns="",t.style.gridTemplateRows="";let n="",o=0,a=0;if(t instanceof i){t.tabs&&t.tabs.remove();const i=document.createElement("div");i.classList.add("smart-layout-tab-strip"),e._selectedItem&&t.contains(e._selectedItem)&&e._selectedItem instanceof r&&(t.selectedIndex=Math.max(0,t.items.indexOf(e._selectedItem))),t.selectedIndex>=t.children.length&&(t.selectedIndex=0);for(let r=0;r<t.children.length;r++){const n=t.children[r],o=e.getItem(n.getAttribute("index"));if(!o)continue;const a=document.createElement("div");a.classList.add("smart-layout-tab"),a.innerHTML="<label>"+o.label+'</label><span class="smart-close-button"></span>',i.appendChild(a),n.setAttribute("tab",""),n.classList.add("smart-hidden"),a.content=n,a.item=o,a.group=s,n.modifiers?-1===n.modifiers.indexOf("close")&&a.querySelector(".smart-close-button").classList.add("smart-hidden"):a.querySelector(".smart-close-button").classList.add("smart-hidden"),void 0!==t.selectedIndex&&r!==t.selectedIndex||(a.classList.add("selected"),n.classList.remove("smart-hidden"),t.selectedIndex=r),a.onpointerup=function(i){i.target.classList.contains("smart-close-button")&&a.close&&(t.selectedIndex=0,e._removeLayoutItem(e._selectedItem),e._handleItemClick(parent))},a.onpointerdown=function(t){const i=this.closest(".smart-layout-group");e._handleItemClick(this.content),a.close=!1,t.target.classList.contains("smart-close-button")?a.close=!0:o.modifiers&&o.modifiers.indexOf("drag")>=0&&e._beginDrag(i,this,t)}}t.tabs=i,"top"===s.position||"left"===s.position?t.insertBefore(i,t.firstChild):t.appendChild(i)}else{for(var l=0;l<t.children.length;l++){var d=t.children[l];if(d.hasAttribute("size")){var c=d.getAttribute("size"),u=parseFloat(c),p="vertical"===t.orientation?t.offsetWidth:t.offsetHeight,m=c.indexOf("%")>=0?parseFloat(c):parseFloat(u/p*100);if(o+=m,a++,a===t.children.length){if(o<100){n+="1fr ",o=100;continue}o>100&&(o-=m,m=100-o,o=100)}else if(o>100||0===m){a=t.children.length,o=0;break}n+=m+"% "}else n+="1fr "}if(a===t.children.length&&(o<99||o>100)){n="";for(let e=0;e<t.children.length;e++){t.children[e].removeAttribute("size"),n+="1fr "}}"vertical"===t.orientation?t.style.gridTemplateColumns=n:t.style.gridTemplateRows=n}t.items=Array.from(t.children),t.items=t.items.filter((e=>e!==t.tabs))},s=e.querySelectorAll(".smart-layout-group");for(let e=0;e<s.length;e++)t(s[e])}_beginDrag(e,t,i){const r=this;r._dragDetails&&r._dragDetails.feedback.remove();const s=document.createElement("div"),n=document.createElement("div"),o=e.querySelector(".smart-layout-tab-strip");let a="";if(o)for(let t=0;t<Array.from(o.children).length;t++)t===e.selectedIndex&&(a=o.children[t].innerText);s.innerHTML=`<smart-layout><smart-tab-layout-group><smart-tab-layout-item label="${a}"></smart-tab-layout-item></smart-tab-layout-group></smart-layout>`,r._feedback=s,r._feedback.classList.add("smart-layout-feedback","smart-layout"),n.classList.add("smart-layout-overlay"),r._dragDetails={element:t.content,item:t.item,layoutGroup:t.group,parent:e,overlay:n,feedback:s,pageX:i.pageX,pageY:i.pageY}}moveChildren(e,t){t.innerHTML="";let i=e;for(;i.firstChild;){const e=i.firstChild;t.appendChild(e)}}createLayoutItem(e,t){const i=this;return"layoutItem"!==e&&e?"tabLayoutItem"!==e&&e?"tabLayoutGroup"===e?(e=>{const t=document.createElement("smart-tab-layout-group"),r="top"===e||"bottom"===e?"horizontal":"vertical";return t.setAttribute("orientation",r),t.orientation=r,i.$.fireEvent("createGroup",{item:t,type:"tabLayoutGroup"}),t})(t):(e=>{const t=document.createElement("smart-layout-group"),r="top"===e||"bottom"===e?"horizontal":"vertical";return i.$.fireEvent("createGroup",{item:t,type:"layoutGroup"}),t.setAttribute("orientation",r),t.orientation=r,t})(t):(()=>{const e=document.createElement("smart-tab-layout-item");return e.innerHTML="",i.$.fireEvent("createItem",{item:e,type:"tabLayoutItem"}),e})():(()=>{const e=document.createElement("smart-layout-item");return e.innerHTML="",i.$.fireEvent("createItem",{item:e,type:"layoutItem"}),e})()}_addTabLayoutItem(s,n,o){const a=this,l=a.createLayoutItem("tabLayoutItem"),d=s.closest("smart-tab-layout-group");let c;o&&(l.label=o.label,l.modifiers=o.modifiers,a.moveChildren(o,l));const u=e=>{for(let t=0;t<e.children.length;t++){e.children[t].removeAttribute("size")}e.removeAttribute("size")},p=e=>{if(s.removeAttribute("size"),s.querySelector("smart-layout-group"))a._addLayoutItem(s.querySelector("smart-layout-group"),e);else{c=a.createLayoutItem("layoutGroup",e);const t=a.createLayoutItem();a.moveChildren(s,t),"top"===e||"left"===e?(c.appendChild(a.createLayoutItem()),c.appendChild(t)):(c.appendChild(t),c.appendChild(a.createLayoutItem())),s.appendChild(c)}},m=(e,t)=>{const i=s.parentElement,r=s,n=a.createLayoutItem("layoutGroup",t);i.insertBefore(n,r),"top"===t||"left"===t?(n.append(e),n.appendChild(r)):(n.appendChild(r),n.append(e)),"root"===r.getAttribute("data-id")&&(r.setAttribute("data-id",n.getAttribute("data-id")),n.setAttribute("data-id","root"),a.$.itemsContainer=n),u(r),u(i)};if(o)switch(n){case"center":if(s instanceof i||s instanceof r)d.appendChild(l);else{const i=a.createLayoutItem("tabLayoutGroup","top");i.appendChild(l),s instanceof t&&!(s instanceof r)?(s.appendChild(i),u(s)):s instanceof e&&(c=a.createLayoutItem("layoutGroup"),s.parentElement.insertBefore(c,s),c.appendChild(s),c.appendChild(i),u(c))}break;case"left":case"right":{const e=a.createLayoutItem("tabLayoutGroup","top");e.appendChild(l),"root"===s.getAttribute("data-id")?(e.position=n,m(e,n)):m(e,n)}break;case"top":case"bottom":{const e=a.createLayoutItem("tabLayoutGroup","top");e.appendChild(l),"root"===s.getAttribute("data-id")?(e.position=n,m(e,n)):m(e,n);break}}else{switch(n){case"center":s instanceof i||s instanceof r?d.appendChild(l):p();break;case"left":case"right":if(s instanceof i){const e=s.querySelector("smart-tab-layout-item");e&&"left"===n?s.insertBefore(l,e):s.appendChild(l)}else if(s instanceof r){const e=a.createLayoutItem("tabLayoutGroup","top"),t=s.parentElement;e.appendChild(l),c=a.createLayoutItem("layoutGroup"),t.parentElement.insertBefore(c,t),"right"===n?(c.appendChild(t),c.appendChild(e)):"left"===n&&(c.appendChild(e),c.appendChild(t))}else if(o){const i=a.createLayoutItem("tabLayoutGroup","top");i.appendChild(l),s instanceof t?s.insertBefore(s.firstChild,i):s instanceof e&&(c=a.createLayoutItem("layoutGroup"),c.orientation=d.orientation,c.setAttribute("orientation",d.orientation),s.removeAttribute("size"),s.parentElement.insertBefore(c,s),c.appendChild(s),c.appendChild(i))}else p(n);break;case"top":case"bottom":s instanceof i?(c=a.createLayoutItem("layoutGroup","top"),s.removeAttribute("size"),s.parentElement.insertBefore(c,s),"top"===n?(c.appendChild(a.createLayoutItem()),c.appendChild(s)):(c.appendChild(s),c.appendChild(a.createLayoutItem()))):p(n)}a.refresh()}}_addLayoutItem(s,n,o){const a=this;if(!s)return;const l=e=>{for(let t=0;t<e.children.length;t++){e.children[t].removeAttribute("size")}e.removeAttribute("size")};if(s instanceof r||s instanceof i||o&&o instanceof r)return a._addTabLayoutItem(s,n,o);const d=a.createLayoutItem(),c=s.closest(".smart-layout-group");let u;if(o&&a.moveChildren(o,d),"center"===n){if(s instanceof t)return u=c,u.appendChild(d),l(u),a.refresh(),d;if(s instanceof e)return u=a.createLayoutItem("layoutGroup"),u.orientation=c.orientation,u.setAttribute("orientation",c.orientation),s.removeAttribute("size"),s.parentElement.insertBefore(u,s),u.appendChild(s),u.appendChild(d),a.refresh(),u}if("vertical"===c.orientation&&("left"===n||"right"===n)||"horizontal"===c.orientation&&("top"===n||"bottom"===n))if(u=c,s instanceof t)"left"===n||"top"===n?u.insertBefore(d,u.children[0]):u.appendChild(d),l(s);else{const e=u.items,t=Math.max(0,e.indexOf(s)+("top"===n||"left"===n?0:1));u.insertBefore(d,e[t]),l(u)}else if(s instanceof t){const e=s.parentElement,t=s,i=a.createLayoutItem("layoutGroup",n);e.insertBefore(i,t),"top"===n||"left"===n?(i.append(d),i.appendChild(t)):(i.appendChild(t),i.append(d)),"root"===t.getAttribute("data-id")&&(t.setAttribute("data-id",i.getAttribute("data-id")),i.setAttribute("data-id","root"),a.$.itemsContainer=i),l(e)}else u=a.createLayoutItem("layoutGroup",n),c.insertBefore(u,s),"top"===n||"left"===n?(u.appendChild(d),u.appendChild(s)):(u.appendChild(s),u.appendChild(d)),l(u);return a.refresh(),d}_handleButtonsVisibility(e){const t=this;if(t._buttons||(t._buttons=document.createElement("div"),t._buttons.classList.add("smart-layout-buttons-container"),t._buttons.innerHTML='<div role="button" position="top"></div>\n <div role="button" position="bottom"></div>\n <div role="button" position="center"></div>\n <div role="button" position="left"></div>\n <div role="button" position="right"></div>'),e||!t._buttons.parentElement){if(e){const i=e._buttonPosition||[],r=t._buttons.children;for(let t=0;t<r.length;t++){const s=r[t];s.position=s.getAttribute("position"),s.item=e,i.length&&i.indexOf(s.getAttribute("position"))<0?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),s.onmouseenter=()=>{s.setAttribute("hover","")},s.onmouseleave=()=>{s.removeAttribute("hover")}}t.allowLiveSplit&&t._buttons.parentElement!==e&&e.appendChild(t._buttons)}}else t._buttons.parentElement.removeChild(t._buttons)}_handleDropArea(e,t="center"){const i=this,r=e=>{switch(e){case"left":i._dropArea.style.top="0px",i._dropArea.style.left="0px",i._dropArea.style.width="50%",i._dropArea.style.height="100%";break;case"right":i._dropArea.style.top="0px",i._dropArea.style.left="calc(100% - 50%)",i._dropArea.style.width="50%",i._dropArea.style.height="100%";break;case"top":i._dropArea.style.top="0px",i._dropArea.style.left="0px",i._dropArea.style.width="100%",i._dropArea.style.height="50%";break;case"bottom":i._dropArea.style.top="calc(100% - 50%)",i._dropArea.style.left="0px",i._dropArea.style.width="100%",i._dropArea.style.height="50%";break;case"center":i._dropArea.style.top="0px",i._dropArea.style.left="0px",i._dropArea.style.width="100%",i._dropArea.style.height="100%"}};i._dropArea&&i._dropArea.parentElement===e?r(t):(i._dropArea&&i._dropArea.remove(),i._dragDetails&&e&&(i._dropArea=document.createElement("div"),i._dropArea.classList.add("smart-layout-drop-area"),e.appendChild(i._dropArea),i._dropArea.style.opacity=1,r(t)))}_handleSplitter(e){const t=this;if(!e)return;if(e.hasAttribute("tab")&&(e=e.parentElement),e._splitter&&e._splitter.remove(),e._splitter||(e._splitter=document.createElement("div")),t._dragDetails&&t._dragDetails.dragging)return void e._splitter.remove();if(-1===e.modifiers.indexOf("resize"))return;e.appendChild(e._splitter);const i=e.parentElement;if(i){e._splitter.className="smart-layout-splitter",e._splitter.item=e,e._splitter.removeAttribute("drag");const r=i.orientation;e.nextElementSibling&&e.nextElementSibling.hasAttribute("data-id")?e._splitter.classList.add(r):e.previousElementSibling&&e.previousElementSibling.hasAttribute("data-id")&&(e._splitter.classList.add(r),e._splitter.classList.add("last"));(e=>{e.style.top="",e.style.left="",e.style.bottom="",e.style.right="",e.onpointerdown=e=>{const i=e.target.item;i.style.overflow="hidden",t._resizeDetails={splitter:e.target,splitterRect:e.target.getBoundingClientRect(),itemRect:i.getBoundingClientRect(),item:i,itemSize:i.size,group:i.parentElement,clientX:e.clientX,clientY:e.clientY},t._selectedItem!==i&&(t.querySelectorAll("[data-id]").forEach((e=>e.removeAttribute("selected"))),t.selectedIndex=i.getAttribute("index"),i.setAttribute("selected",""),t._selectedItem=i,t._handleButtonsVisibility(i)),i.previousElementSibling&&i.previousElementSibling.hasAttribute("data-id")?(t._resizeDetails.previousItemRect=i.previousElementSibling.getBoundingClientRect(),t._resizeDetails.previousItem=i.previousElementSibling,t._resizeDetails.previousItemSize=i.previousElementSibling.size,t._resizeDetails.previousItem.style.overflow="hidden"):(t._resizeDetails.previousItemRect=null,t._resizeDetails.previousItem=null),i.nextElementSibling&&i.nextElementSibling.hasAttribute("data-id")?(t._resizeDetails.nextItemRect=i.nextElementSibling.getBoundingClientRect(),t._resizeDetails.nextItem=i.nextElementSibling,t._resizeDetails.nextItemSize=i.nextElementSibling.size,t._resizeDetails.nextItem.style.overflow="hidden"):(t._resizeDetails.nextItemRect=null,t._resizeDetails.nextItem=null)}})(e._splitter)}}})})();
68
68
  Smart("smart-list-menu",class extends Smart.Menu{static get properties(){return{displayLoadingIndicator:{value:!1,type:"boolean"},dropDownPosition:{value:"auto",allowedValues:["top-left","top-right","bottom-left","bottom-right","auto"],type:"string"},enableMouseWheelAction:{value:!0,type:"boolean"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterMember:{value:"label",type:"string"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},grouped:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},scrollMode:{value:"scrollButtons",allowedValues:["scrollbar","scrollButtons"],type:"string"}}}static get listeners(){return{resize:"_resizeHandler","backButton.click":"_backButtonClickHandler","filterInput.keyup":"_filterInputKeyupHandler","mainContainer.down":"_mainContainerDownHandler","mainContainer.move":"_mainContainerMoveHandler","mainContainer.swipeleft":"_mainContainerSwipeHandler","mainContainer.swiperight":"_mainContainerSwipeHandler","mainContainer.touchmove":"_mainContainerTouchmoveHandler","mainContainer.touchstart":"_mainContainerTouchstartHandler","view.click":"_viewHandler","view.mouseout":"_viewHandler","view.mouseover":"_viewHandler","view.transitionend":"_viewHandler"}}static get styleUrls(){return["smart.listmenu.css"]}template(){return`<div id="container" role="presentation">\n <div id="hamburgerIcon" class="smart-hamburger-icon smart-hidden" role="button" aria-label="Toggle minimized menu" aria-haspopup="true">\n <div id="hamburgerIconLineTop" class="smart-hamburger-icon-line smart-hamburger-icon-line-top" role="presentation"></div>\n <div id="hamburgerIconLineCenter" class="smart-hamburger-icon-line smart-hamburger-icon-line-center" role="presentation"></div>\n <div id="hamburgerIconLineBottom" class="smart-hamburger-icon-line smart-hamburger-icon-line-bottom" role="presentation"></div>\n <div id="customIconContainer" class="smart-hamburger-icon-custom-container smart-hidden" role="presentation"></div>\n </div>\n <div id="view" class="smart-list-menu-view" role="presentation">\n <div id="header" class="smart-header smart-hidden" role="heading" aria-level="1">\n <smart-button id="backButton" animation="[[animation]]" disabled="[[disabled]]" unfocusable right-to-left="[[rightToLeft]]" aria-label="Back">\n <div id="backButtonArrow" class="smart-arrow ${this.rightToLeft?"smart-arrow-right":"smart-arrow-left"}" aria-hidden="true"></div>\n </smart-button>\n <div id="title" class="smart-title"></div>\n </div>\n <div class="smart-list-menu-filter-input-container smart-hidden" id="filterInputContainer" role="presentation"><input id="filterInput" class="smart-filter-input" disabled="[[disabled]]" placeholder="[[filterInputPlaceholder]]" type="text" role="searchbox" aria-label="[[filterInputPlaceholder]]" /></div>\n <smart-repeat-button id="scrollButtonNear" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll up">\n <div id="arrowNear" class="smart-arrow smart-arrow-up" right-to-left="[[rightToLeft]]"></div>\n </smart-repeat-button>\n <smart-scroll-viewer id="mainContainer" class="smart-menu-main-container" horizontal-scroll-bar-visibility="hidden" right-to-left="[[rightToLeft]]" role="presentation">\n <content></content>\n </smart-scroll-viewer>\n <smart-repeat-button id="scrollButtonFar" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable right-to-left="[[rightToLeft]]" aria-label="Scroll down">\n <div id="arrowFar" class="smart-arrow smart-arrow-down"></div>\n </smart-repeat-button>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n </div>\n </div>`}attached(){const e=this;super.attached(),e.isCompleted&&null!==e.dropDownAppendTo&&e._minimized&&e._dropDownParent.appendChild(e.$.view)}detached(){const e=this;super.detached(),e._close(),null!==e.dropDownAppendTo&&e._minimized&&e._dropDownParent.removeChild(e.$.view)}addItem(e,t){const i=this;if(!(e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup))return;let r,n,o,a;if(void 0===t)r=void 0,n=1,o=t=i.$.mainContainer,a=i._topLevelFilter;else{if("string"==typeof t&&(t=i.getItem(t)),void 0===t||!(t instanceof Smart.MenuItemsGroup)||!i.contains(t)&&t.closest(".smart-list-menu-view")!==i.$.view)return;r=t,n=t.level+1,o=t.itemContainer,a=t.filter}if(i._createItemHTMLStructure(e,n,t,i._getCurrentViewItems(r).length,0),e instanceof Smart.MenuItemsGroup&&i._processHTML(e,n+1),i._view!==t&&!t.$.hasClass("smart-hidden")&&t.offsetHeight>0&&t.offsetWidth>0&&(!i._view&&!i.$.mainContainer.contains(t)||i._view&&!i._view.contains(t))&&e.$.addClass("smart-hidden"),i.grouped){let e;e=o instanceof Smart.ScrollViewer&&o.isRendered?Array.from(o.$.scrollViewerContentContainer.children):Array.from(o.children);for(let t=e.length-1;t>=0;t--)e[t].$.hasClass("smart-list-menu-group-label")&&o.removeChild(e[t]);i._unsortItems(t,!0)}if(o.appendChild(e),i.grouped){const e=i._view;i._applyGrouping(t,!0),i._home(),e&&i.changePage(e.path)}i.filterable&&void 0!==a&&""!==a&&null===i._findItem(e,a)&&(e.$.addClass("smart-hidden"),e.hidden=!0),i._toggleFilterInputGroupLabelVisibility(),i._checkOverflow()}back(e){const t=this,i=t.animation,r=!1===e&&"none"!==i;r&&(t.animation="none"),t._backButtonClickHandler(),r&&(t.animation=i)}changePage(e){const t=this,i=t.getItem(e);if(void 0===i||i instanceof Smart.MenuItem||i.hidden)return;const r=[i];let n=i.parentItem,o=0;for(t._discardKeyboardHover();n;)r.unshift(n),n=n.parentItem;if(t._view){const e=r.indexOf(t._view);-1===e?t._home():o=e+1}for(let e=o;e<r.length&&!r[e].disabled&&!r[e].hidden;e++)t._menuItemsGroupSelectionHandler(r[e],{type:"expand"},!0)}maximize(){const e=this;if(e._minimized){if(e._positionDetection.removeOverlay(),e._minimized=!1,e._minimizedDropDownOpened&&(e.$hamburgerIcon.removeClass("smart-close-button"),e._minimizedDropDownOpened=!1),null!==e.dropDownAppendTo&&e._appendMinimizedContainerToMenu(e.$.view,null),e.$view.removeClass("smart-visibility-hidden"),e.$view.removeClass("smart-list-menu-view-minimized"),e.$hamburgerIcon.addClass("smart-hidden"),e.removeAttribute("minimized"),e.enableShadowDOM){e.$.view.id=e.$.view.getAttribute("smart-id");const t=e.$.view.querySelectorAll("[smart-id]");for(let e=0;e<t.length;e++)t[e].id=t[e].getAttribute("smart-id")}e.$.mainContainer.scrollTop=0,e._checkOverflow(),e.$.hamburgerIcon.removeAttribute("aria-expanded"),e.$.hamburgerIcon.removeAttribute("aria-owns"),e.$.view.setAttribute("role","presentation"),e.$.view.removeAttribute("aria-orientation"),e.setAttribute("role","menu")}}minimize(){const e=this;if(!e._minimized){if(e.$view.addClass("smart-visibility-hidden"),e.enableShadowDOM){e.$.view.removeAttribute("id");const t=e.$.view.querySelectorAll("[smart-id]");for(let e=0;e<t.length;e++)t[e].removeAttribute("id")}e._edgeMacFF&&e.$view.addClass("not-in-view"),e.$hamburgerIcon.removeClass("smart-hidden"),setTimeout((function(){null!==e.dropDownAppendTo&&e._appendMinimizedContainerToExternalElement(e.$.view),e.$view.addClass("smart-list-menu-view-minimized"),e.$.mainContainer.scrollTop=0,e._checkOverflow()}),0),e._minimized=!0,e.setAttribute("minimized",""),e.setAttribute("role","presentation"),e.removeAttribute("aria-orientation"),e.$.hamburgerIcon.setAttribute("aria-expanded",!1),e.$.hamburgerIcon.setAttribute("aria-owns",e.$.view.id),e.$.view.setAttribute("role","menu"),e.$.view.setAttribute("aria-orientation","vertical")}}removeItem(e){const t=this;if("string"==typeof e&&(e=t.getItem(e)),void 0===e||!(e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup)||!t.contains(e)&&e.closest(".smart-list-menu-view")!==t.$.view)return;const i=e.parentElement;for(;e.contains(t._view);)t._backButtonClickHandler(void 0,!0);const r=t._view;t.grouped&&(t._home(),t._discardGrouping()),i.removeChild(e),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,(function(e){return t._getCurrentViewItems(e===t.$.mainContainer?void 0:e)})),t.grouped&&(t._applyGrouping(t.$.mainContainer),r&&t.changePage(r.path)),t._toggleFilterInputGroupLabelVisibility(),t._checkOverflow()}propertyChangedHandler(e,t,i){if("disabled"===e||"dropDownOverlay"===e||"minimizeIconTemplate"===e||"minimizeWidth"===e||"unfocusable"===e)return void super.propertyChangedHandler(e,t,i);const r=this;switch(e){case"animation":r.$.view.setAttribute("animation",i);break;case"checkable":case"checkboxes":r._minimized&&null!==r.dropDownAppendTo&&(i?r.$.view.setAttribute(e,""):r.$.view.removeAttribute(e));break;case"checkMode":{const e=r.$.mainContainer;r._changeToRadioButtonMode(i,e.isRendered?e.$.scrollViewerContentContainer:e),r._minimized&&null!==r.dropDownAppendTo&&r.$.view.setAttribute("check-mode",i);break}case"dataSource":{r.$header.addClass("smart-hidden"),r.$mainContainer.removeClass("header-shown"),r._view=void 0;const e=r.querySelectorAll("smart-menu-items-group");e.length>0&&e.forEach((e=>{e.remove()})),r._menuItems={},r._topLevelFilter="",r._processDataSource(),r._toggleFilterInputGroupLabelVisibility(),r._checkOverflow();break}case"displayLoadingIndicator":if(i){const e=r.$.mainContainer.querySelector("[hover]");e&&e.removeAttribute("hover"),r._discardKeyboardHover(),r.$loadingIndicatorContainer.removeClass("smart-hidden")}else r.$loadingIndicatorContainer.addClass("smart-hidden");break;case"dropDownAppendTo":{const e=r._dropDownParent;if(r._positionDetection.getDropDownParent(),r._dropDownParent===e||!r._minimized)return;r._close(),null===i?r._appendMinimizedContainerToMenu(r.$.view,null):r._appendMinimizedContainerToExternalElement(r.$.view),r.$.mainContainer.scrollTop=0,r._checkOverflow();break}case"dropDownPosition":r._close(),r._minimized&&null!==r.dropDownAppendTo&&r.$.view.setAttribute("drop-down-position",i);break;case"filterable":if(r._toggleFilterInputGroupLabelVisibility(!0),!1===i){""!==r._topLevelFilter&&r._applyFilter("");for(let e=r._filteredLowerLevelGroups.length-1;e>=0;e--)r._applyFilter("",r._filteredLowerLevelGroups[e])}r._checkOverflow();break;case"filterMode":if(!r.filterable)return;""!==r._topLevelFilter&&r._applyFilter(r._topLevelFilter);for(let e=r._filteredLowerLevelGroups.length-1;e>=0;e--)r._applyFilter(r._filteredLowerLevelGroups[e].filter,r._filteredLowerLevelGroups[e]);break;case"grouped":r._home(),i?r._applyGrouping(r.$.mainContainer):r._discardGrouping(),r._toggleFilterInputGroupLabelVisibility(!1,!0),r._checkOverflow();break;case"loadingIndicatorPosition":null!==r.dropDownAppendTo&&r._minimized&&r.$.view.setAttribute("loading-indicator-position",i),"center"===i?r.$loadingIndicatorPlaceHolder.addClass("smart-hidden"):r.$loadingIndicatorPlaceHolder.removeClass("smart-hidden");break;case"overflow":r.$.mainContainer.verticalScrollBarVisibility="scroll"===i?"visible":i,r._handleOverflowChange();break;case"rightToLeft":i?(r.$backButtonArrow.removeClass("smart-arrow-left"),r.$backButtonArrow.addClass("smart-arrow-right")):(r.$backButtonArrow.removeClass("smart-arrow-right"),r.$backButtonArrow.addClass("smart-arrow-left")),i?r.$.view.setAttribute("right-to-left",""):r.$.view.removeAttribute("right-to-left"),Array.prototype.forEach.call(r.$.mainContainer.querySelectorAll(".smart-menu-items-group-arrow"),(e=>e.className="smart-menu-items-group-arrow "+(r.rightToLeft?"smart-arrow-left left":"smart-arrow-right right")));break;case"scrollMode":r.$.mainContainer.verticalScrollBarVisibility="scrollButtons"===i?"hidden":"scroll"===r.overflow?"visible":r.overflow,r._checkOverflow();break;case"theme":super.propertyChangedHandler(e,t,i),null!==r.dropDownAppendTo&&r._minimized&&(""!==t&&r.$view.removeClass(t),i&&r.$view.addClass(i))}}_appendGroupLabels(e,t){for(let i=0;i<e.length;i++){const r=document.createElement("div");r.$=Smart.Utilities.Extend(r),r.className="smart-list-menu-group-label",r.setAttribute("role","heading"),r.setAttribute("aria-level",1),r.innerHTML=e[i],r.groupChildren=t[i],t[i][0].parentElement.insertBefore(r,t[i][0]);for(let e=0;e<t[i].length;e++)t[i][e].groupLabel=r}}_applyFilter(e,t){const i=this,r=i._getCurrentViewItems(t);for(let n=0;n<r.length;n++){const o=i._findItem(r[n],e);o&&o.hidden?(o.hidden=!1,(t===i._view||void 0!==i._view&&void 0!==t&&!t.contains(i._view)||void 0===i._view)&&o.$.removeClass("smart-hidden")):o||(r[n].hidden=!0,r[n].$.addClass("smart-hidden"))}if(t){t.filter=e;const r=i._filteredLowerLevelGroups.indexOf(t);""===e?-1!==r&&i._filteredLowerLevelGroups.splice(r,1):-1===r&&i._filteredLowerLevelGroups.push(t)}else i._topLevelFilter=e}_backButtonClickHandler(e,t){const i=this,r=i._view;if(e&&e.stopPropagation(),!r||i.disabled&&e||i.displayLoadingIndicator||i._inTransition)return;let n=i.hasAnimation,o=i.animation,a=!1;n&&t&&(n=!1,a=!0,i.animation="none"),i._discardKeyboardHover(),i.$scrollButtonNear.addClass("smart-hidden"),i.$scrollButtonFar.addClass("smart-hidden"),i.$mainContainer.removeClass("scroll-buttons-shown"),r.firstElementChild.classList.remove("smart-hidden"),n?(i._inTransition=!0,r.container.$.addClass("no-transition"),r.container.$.addClass("smart-hidden"),r.$.addClass("right"),r.$.removeClass("right"),r.container.$.removeClass("no-transition")):(r.$.removeClass("smart-menu-items-group-opened"),r.container.$.addClass("smart-hidden")),i._showHideMenuItemsGroupSiblings(r,"removeClass",n),n?setTimeout((function(){r.container.style.top=r.parentElement.getBoundingClientRect().top-r.getBoundingClientRect().top+"px"}),0):a&&(i.animation=o),1===r.level?(i.$header.addClass("smart-hidden"),i.$mainContainer.removeClass("header-shown"),i._view=void 0):(i.$.title.innerHTML=r.parentItem.titleLabel,i._view=r.parentItem),i._toggleFilterInputGroupLabelVisibility(),i.$.mainContainer.scrollTop=0,n||i._checkOverflow(),e&&i.focus()}_bounceBottom(e){const t=this,i=t.$.mainContainer;function r(){i.scrollTop-=5,i.scrollTop>e?window.requestAnimationFrame(r):t.$mainContainer.removeClass("bounce-bottom")}t.$mainContainer.addClass("bounce-bottom"),window.requestAnimationFrame((function e(){i.scrollTop+=5,i.scrollTop!==i.scrollHeight-i.offsetHeight?window.requestAnimationFrame(e):window.requestAnimationFrame(r)}))}_bounceTop(){const e=this,t=e.$.mainContainer;function i(){t.scrollTop+=5,50!==t.scrollTop?window.requestAnimationFrame(i):(t.scrollTop=0,e.$mainContainer.removeClass("bounce-top"))}e.$mainContainer.addClass("bounce-top"),window.requestAnimationFrame((function e(){t.scrollTop-=5,t.scrollTop>0?window.requestAnimationFrame(e):window.requestAnimationFrame(i)}))}_checkOverflow(){const e=this,t=e.overflow,i=e.$.mainContainer,r=i instanceof Smart.ScrollViewer?i.$.content:i;if(r){if("hidden"!==t&&"scrollButtons"===e.scrollMode){const n=Math.round(r.scrollHeight)>Math.round(i.offsetHeight),o=Math.round(i.scrollTop)>0,a=Math.round(i.offsetHeight+i.scrollTop)<Math.round(r.scrollHeight);e.$.mainContainer.verticalScrollBarVisibility="hidden",n?"auto"===t?(e.$mainContainer.hasClass("scroll-buttons-shown")||e.$mainContainer.addClass("scroll-buttons-shown"),o?e.$scrollButtonNear.removeClass("smart-hidden"):e.$scrollButtonNear.addClass("smart-hidden"),a?e.$scrollButtonFar.removeClass("smart-hidden"):e.$scrollButtonFar.addClass("smart-hidden"),!1===(o&&a)?e.$mainContainer.addClass("one-button-shown"):e.$mainContainer.removeClass("one-button-shown"),e.disabled||(e.$.scrollButtonNear.disabled=!1,e.$.scrollButtonFar.disabled=!1)):(e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.disabled?(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0):(e.$.scrollButtonNear.disabled=!o,e.$.scrollButtonFar.disabled=!a)):!n&&"auto"===t&&e.$mainContainer.hasClass("scroll-buttons-shown")?(e.$mainContainer.removeClass("scroll-buttons-shown"),e.$mainContainer.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden")):n||"scroll"!==t||(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0)}else"scrollbar"===e.scrollMode&&(e.$mainContainer.removeClass("scroll-buttons-shown"),e.$mainContainer.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"));i.refresh()}}_updateScrollButtonVisibility(e,t,i){const r=this,n=r.overflow,o=r.$.mainContainer,a=e===r.$.mainContainer,s=a?o.$.content:e;if(a&&"hidden"===n)return void o.refresh();let l,d,c,m=!0,u=!0;if(t?(l="scrollLeft",d="offsetWidth",c="scrollWidth"):(l="scrollTop",d="offsetHeight",c="scrollHeight"),0===Math.round(e[l])&&(m=!1),Math.round(e[d]+e[l])>=Math.round(s[c])&&(u=!1),a&&"auto"!==n)"scroll"!==n||r.disabled||(i[0].disabled=!m,i[1].disabled=!u);else{if(m&&u)return i[0].$.removeClass("smart-hidden"),i[1].$.removeClass("smart-hidden"),e.classList.remove("one-button-shown"),void o.refresh();m?i[0].$.removeClass("smart-hidden"):i[0].$.addClass("smart-hidden"),u?i[1].$.removeClass("smart-hidden"):i[1].$.addClass("smart-hidden"),e.classList.add("one-button-shown")}o.refresh()}_close(){const e=this;e._discardKeyboardHover(!0),e._minimized&&e._minimizedDropDownOpened&&(e._positionDetection.removeOverlay(),e.$view.addClass("smart-visibility-hidden"),e._edgeMacFF&&(e.$.view.style.left="",e.$.view.style.top="",e.$view.addClass("not-in-view")),e.$hamburgerIcon.removeClass("smart-close-button"),e._minimizedDropDownOpened=!1,e.$.hamburgerIcon.setAttribute("aria-expanded",!1))}_createElement(){const e=this,t=e.$.mainContainer;e.$.title.id||(e.$.title.id=e.id+"Title"),e.$.view.id||(e.$.view.id=e.id+"View"),e.setAttribute("role","menu"),e.setAttribute("aria-labelledby",e.$.title.id),e.setAttribute("aria-orientation","vertical"),e.$.header.setAttribute("aria-labelledby",e.$.title.id),e.mode="vertical",t.verticalScrollBarVisibility="scroll"===e.overflow?"visible":e.overflow,t.refresh=e._scrollViewerRefresh,t._mouseWheelHandler=e._mouseWheelHandler.bind(e),t.onVerticalChange=()=>{"scrollButtons"===e.scrollMode&&e._updateScrollButtonVisibility(t,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar]),t.scrollTop===t.scrollHeight&&e.$.fireEvent("scrollBottomReached")},e._positionDetection=new Smart.Utilities.PositionDetection(e),e._positionDetection.getDropDownParent(),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList();const i=e.getElementsByTagName("smart-menu-item"),r=function(){e._setFocusable(),e._menuItems={},e._topLevelFilter="",e._filteredLowerLevelGroups=[],e.$.view.setAttribute("animation",e.animation),null===e.dataSource?e._processHTML(void 0,1):e._processDataSource(),e._toggleFilterInputGroupLabelVisibility(),"scroll"===e.overflow&&(e.$mainContainer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility(e.$.mainContainer,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar])),e._applyMinimizeIconTemplate(e.minimizeIconTemplate,null),null!==e.minimizeWidth&&e.offsetWidth<=e.minimizeWidth?e.minimize():e._checkOverflow(),e.displayLoadingIndicator&&e.$loadingIndicatorContainer.removeClass("smart-hidden"),"center"!==e.loadingIndicatorPosition&&e.$loadingIndicatorPlaceHolder.removeClass("smart-hidden"),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===i.length?r():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(i,r))}_createMenuItemsGroupContainer(e,t){const i=document.createElement("div"),r=document.createElement("div");return i.className="smart-menu-drop-down smart-hidden",i.$=Smart.Utilities.Extend(i),i.level=t,i.setAttribute("level",t),i.setAttribute("role","menu"),i.menuItemsGroup=e,r.className="smart-menu-item-container",r.$=Smart.Utilities.Extend(r),r.container=i,r.menuItemsGroup=e,e.checkable&&r.setAttribute("checkable",""),r.setAttribute("check-mode",e.checkMode),i.itemContainer=r,i.appendChild(r),i}_discardGrouping(){const e=this,t=Array.from(e.$.view.getElementsByClassName("smart-list-menu-group-label"));for(let e=0;e<t.length;e++){let i=t[e];i.parentElement.removeChild(i)}e._unsortItems(e.$.mainContainer)}_discardKeyboardHover(){const e=this;e._focusedViaKeyboard&&(e._focusedViaKeyboard===e.$.backButton?(e.$.backButton.removeAttribute("hover"),e.$.backButton.$.button.removeAttribute("hover")):(e._focusedViaKeyboard.removeAttribute("focus"),e._focusedViaKeyboard.removeAttribute("hover")),e._focusedViaKeyboard=void 0)}_documentUpHandler(e){const t=this,i=e.originalEvent.target,r=e=>{"right"===e&&!t.rightToLeft||"left"===e&&t.rightToLeft?t._backButtonClickHandler():t._swipeDetails.target&&t._selectionHandler({target:t._swipeDetails.target},t._swipeDetails.target,!0)};if(delete t._dragStartDetails,t._swipeDetails){const i="pointercancel"===e.originalEvent.type;return"left"===t._swipeDetails.direction?(i||t._swipeDetails.start>e.pageX&&t._swipeDetails.start-e.pageX>t.offsetWidth/4)&&r(t._swipeDetails.direction):(i||t._swipeDetails.start<e.pageX&&e.pageX-t._swipeDetails.start>t.offsetWidth/4)&&r(t._swipeDetails.direction),void delete t._swipeDetails}i===t.$.filterInput||t.disabled||t.displayLoadingIndicator||!i.closest||(t.contains(i)||i.closest(".smart-list-menu-view")===t.$.view?!t.contains(i)&&i.closest(".smart-list-menu-view")!==t.$.view||t===document.activeElement||t.focus():t._close())}_ensureVisible(e){const t=this,i=t.$.mainContainer;if(!i.$.hasClass("scroll-buttons-shown")&&"hidden"!==t.overflow)return;const r=i.getBoundingClientRect(),n=e.getBoundingClientRect(),o=[t.$.scrollButtonNear,t.$.scrollButtonFar],a=i.scrollTop;(r.top>n.top||r.bottom<n.bottom)&&(i.scrollTop=e.offsetTop,t._updateScrollButtonVisibility(i,!1,o)),t._fireScrollBottomReachedEvent(a)}_fireScrollBottomReachedEvent(e){const t=this.$.mainContainer,i=t.scrollTop;e!==i&&i===t.scrollHeight-t.offsetHeight&&this.$.fireEvent("scrollBottomReached")}_getCurrentViewItems(e){const t=this;let i;if(void 0===e&&(i=t.$.mainContainer,i instanceof Smart.ScrollViewer&&(i=i.isRendered?i.$.scrollViewerContentContainer:i)),t.grouped){if(void 0===e)return Array.from(i.children).filter((e=>e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup));{const t=e.container.firstElementChild.children,i=[];for(let e=0;e<t.length;e++){let r=t[e];(r instanceof Smart.MenuItem||r instanceof Smart.MenuItemsGroup)&&i.push(r)}return i}}return void 0===e?i.children:e.container.firstElementChild.children}_sortItems(e){const t=this;if(!t.grouped)return;const i=[],r=t.$.mainContainer,n=[];let o;e instanceof Smart.MenuItemsGroup?o=e.container.firstElementChild:e===t.$.mainContainer&&(o=r instanceof Smart.ScrollViewer?r.$.content:r);const a=Array.from(o.children);a.sort((function(e,t){return e.label.localeCompare(t.label)}));for(let e=a.length-1;e>=0;e--)o.insertBefore(a[e],o.firstElementChild);for(let e=0;e<a.length;e++){const t=a[e],r=t.label.charAt(0),o=i.indexOf(r.toUpperCase());-1===o?(i.push(r.toUpperCase()),n.push([t])):n[o].push(t)}t._appendGroupLabels(i,n)}_home(){const e=this;for(;e._view;)e._backButtonClickHandler(void 0,!0)}_keydownHandler(e){const t=this,i=e.key;if(((t.shadowRoot||t.getRootNode()).activeElement||document.activeElement)!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","Escape","Home"," "].indexOf(i)||t.disabled||t.displayLoadingIndicator)return;e.preventDefault();const r=t._view,n=t.$.mainContainer;let o;o=r?r.itemContainer:n.isRendered?n.$.scrollViewerContentContainer:n;const a=t.$.backButton.hasAttribute("hover")?t.$.backButton:o.querySelector("[focus]");switch(i){case"ArrowDown":t._navigate("_getNextEnabledChild",a,o);break;case"ArrowLeft":case"ArrowRight":if("ArrowLeft"===i&&!t.rightToLeft||"ArrowRight"===i&&t.rightToLeft){t._backButtonClickHandler();break}("ArrowRight"===i&&!t.rightToLeft||"ArrowLeft"===i&&t.rightToLeft)&&a&&a instanceof Smart.MenuItemsGroup&&t._menuItemsGroupSelectionHandler(a,{type:"keydown"});break;case"ArrowUp":t._navigate("_getPreviousEnabledChild",a,o);break;case"End":case"Home":{if(r&&"Home"===i)return t.$.mainContainer.scrollTop=0,t._checkOverflow(),t.$.backButton.setAttribute("hover",""),t.$.backButton.$.button.setAttribute("hover",""),t._focusedViaKeyboard=t.$.backButton,void(a&&a.removeAttribute("focus"));const e="End"===i?t._getLastEnabledChild(o):t._getFirstEnabledChild(o);if(!e||a===e)return;a&&(a===t.$.backButton?(t.$.backButton.removeAttribute("hover"),t.$.backButton.$.button.removeAttribute("hover")):a.removeAttribute("focus")),t._hoverViaKeyboard(e);break}case"Enter":t._minimized&&!t._minimizedDropDownOpened?t._hamburgerIconClickHandler(void 0,t.$.view):a&&(a===t.$.backButton?t._backButtonClickHandler():t._selectionHandler({target:a}));break;case"Escape":t._minimized&&t._minimizedDropDownOpened&&!t._view?t._close():t._backButtonClickHandler();break;case" ":a&&(a===t.$.backButton?t._backButtonClickHandler():t._toggleItem(a))}}_mainContainerDownHandler(e){const t=this;!Smart.Utilities.Core.isMobile||t.disabled||t.displayLoadingIndicator||(t._dragStartDetails={startY:e.pageY,x:e.pageX,y:e.pageY,startTime:Date.now(),target:e.originalEvent.target})}_mainContainerHandler(){}_mainContainerMoveHandler(){}_mainContainerSwipeHandler(e){const t=this;if(!Smart.Utilities.Core.isMobile||t.disabled||t.displayLoadingIndicator||Math.abs(t._dragStartDetails.startY-e.pageY)>2)return;const i=e.originalEvent.target,r=i.closest("smart-menu-item"),n=i.closest("smart-menu-items-group");if("swiperight"===e.type&&!t.rightToLeft||"swipeleft"===e.type&&t.rightToLeft){const i=r||n;i&&(delete t._dragStartDetails,t._swipeDetails={direction:e.type.replace("swipe",""),start:e.pageX,target:i})}else("swipeleft"===e.type&&!t.rightToLeft||"swiperight"===e.type&&t.rightToLeft&&n&&null===r)&&(delete t._dragStartDetails,t._swipeDetails={direction:e.type.replace("swipe",""),start:e.pageX,target:n})}_mainContainerTouchmoveHandler(){}_mainContainerTouchstartHandler(){}_getRootDetails(e,t){const i=this;if(!e)return;if(!i.enableShadowDOM)return{activeElement:e.activeElement,isInsideElement:i.contains(t.target)};let r,n;for(;e&&(!r&&e.activeElement&&(r=e.activeElement),e.host===i&&(n=!0),e!==document);)e=e.host?e.host.getRootNode():e.getRootNode();return{activeElement:r,isInsideElement:n}}_menuItemsGroupSelectionHandler(e,t,i){const r=this,n=e.container,o=n.level,a=r._getRootDetails(t.target?t.target.getRootNode():null,t);if(r._view===e)return;if(r._discardKeyboardHover(),a&&a.activeElement!==r&&null!==r.dropDownAppendTo&&"click"===t.type&&!a.isInsideElement&&r.focus(),r._inTransition)return;if("click"===t.type&&!t.target.classList.contains("smart-menu-items-group-arrow")&&r._toggleItem(e))return void r._ripple(e,t);let s=r.hasAnimation,l=r.animation,d=!1;s&&i&&(s=!1,d=!0,r.animation="none"),2===o&&(r.$header.removeClass("smart-hidden"),r.$mainContainer.addClass("header-shown")),r.$.title.innerHTML=e.titleLabel,r._view=e,r._toggleFilterInputGroupLabelVisibility(),e.removeAttribute("hover"),e.removeAttribute("focus"),e.$.addClass("smart-menu-items-group-opened"),r._showHideMenuItemsGroupSiblings(e,"addClass",s),s?(r._inTransition=!0,e.firstElementChild.classList.add("animate"),setTimeout((function(){n.style.top=e.parentElement.getBoundingClientRect().top-e.getBoundingClientRect().top+"px"}),0)):e.firstElementChild.classList.add("smart-hidden"),n.$.removeClass("smart-hidden"),d&&(r.animation=l),r.$.mainContainer.scrollTop=0,s||r._checkOverflow(),r.$.fireEvent("expand",{item:e,label:e.label,path:e.path,value:e.value})}_mouseoutMouseoverHandler(e){const t=this;if(t.disabled||t.displayLoadingIndicator)return;const i=e.target.closest("smart-menu-item")||e.target.closest("smart-menu-items-group");null===i||t._view&&i.level<=t._view.level||i.disabled||i.templateApplied||(t._discardKeyboardHover(),"mouseover"===e.type?(i.setAttribute("hover",""),t._discardKeyboardHover(!0)):i.removeAttribute("hover"))}_navigate(e,t,i){const r=this;if(!t)return void("_getNextEnabledChild"===e?r._view?(r.$.backButton.setAttribute("hover",""),r.$.backButton.$.button.setAttribute("hover",""),r._focusedViaKeyboard=r.$.backButton):r._hoverViaKeyboard(r._getFirstEnabledChild(i)):r._hoverViaKeyboard(r._getLastEnabledChild(i)));let n;if("_getNextEnabledChild"===e&&t===r.$.backButton){if(n=r._getFirstEnabledChild(i),!n)return;r.$.backButton.removeAttribute("hover"),r.$.backButton.$.button.removeAttribute("hover")}else{if("_getPreviousEnabledChild"===e&&r._view&&t===r._getFirstEnabledChild(i))return r.$.backButton.setAttribute("hover",""),r.$.backButton.$.button.setAttribute("hover",""),r._focusedViaKeyboard=r.$.backButton,void t.removeAttribute("focus");n=r[e](t)}n&&(t.removeAttribute("focus"),r._hoverViaKeyboard(n))}_processHTML(e,t){const i=this,r=i.$.mainContainer;let n,o,a;void 0===e&&(e=i.$.mainContainer),t>1&&(n=i._createMenuItemsGroupContainer(e,t),o=n.itemContainer),a=e===r?Array.from((r instanceof Smart.ScrollViewer?r.$.content:r).children):Array.from(e.children);const s=[];let l=0;for(let r=0;r<a.length;r++){if(t>1&&0===r){l++;continue}const n=a[r];n instanceof Smart.MenuItem||n instanceof Smart.MenuItemsGroup?(i._createItemHTMLStructure(n,t,e,r-l),n.checked&&(n.disabled||n.templateApplied?n.checked=!1:s.push(n)),t>1&&o.appendChild(n),n instanceof Smart.MenuItemsGroup&&i._processHTML(n,t+1)):(n.parentElement.removeChild(n),l++)}if(t>1){if(e.container=n,e.itemContainer=o,e instanceof Smart.MenuItemsGroup){const t=document.createElement("div");t.className="smart-menu-items-group-arrow "+(i.rightToLeft?"smart-arrow-left left":"smart-arrow-right right"),e.children[0].appendChild(t)}e.appendChild(n)}i._validateRadioButtonSelection(e,t,s),i._sortItems(e)}_resizeHandler(){this.refresh()}refresh(){const e=this,t=e.minimizeWidth;if(null!==t){if(!e._minimized&&e.offsetWidth<=t)return void e.minimize();if(e._minimized&&e.offsetWidth>t)return void e.maximize()}e._checkOverflow()}_scroll(e){const t=this,i=t.$.mainContainer,r=e.classList.contains("smart-scroll-button-near")?-1:1,n=i.scrollTop;i.scrollTop=i.scrollTop+10*r,"scrollbar"!==t.scrollMode&&n!==i.scrollTop&&(t._updateScrollButtonVisibility(i,!1,[t.$.scrollButtonNear,t.$.scrollButtonFar]),t._fireScrollBottomReachedEvent(n))}_selectionHandler(e,t,i){const r=this,n=e.target;if(!r.disabled&&!r.displayLoadingIndicator){if(r._swipeDetails&&!i)return delete r._dragStartDetails,void delete r._swipeDetails;if(void 0===t){if("click"===e.type){const t=n.closest("smart-repeat-button");if(t)return void r._scroll(t,e)}const i=n.closest("smart-menu-item");if(i)return i.disabled||i.templateApplied||(r._toggleItem(i)||r.$.fireEvent("itemClick",{item:i,label:i.label,value:i.value}),r._ensureVisible(i),r._ripple(i,e)),void o();if((t=n.closest("smart-menu-items-group"))&&(n===t.container||n===t.container.firstElementChild))return}t&&!t.disabled&&r._menuItemsGroupSelectionHandler(t,e)}function o(){const t=r._getRootDetails(n.getRootNode(),e);t&&t.activeElement!==r&&null!==r.dropDownAppendTo&&"click"===e.type&&!t.isInsideElement&&r.focus()}}_showHideMenuItemsGroupSiblings(e,t,i){const r=e.parentElement.children;for(let n=0;n<r.length;n++){const o=r[n];o!==e&&(o.hidden||(i?"addClass"===t?o.$.addClass("animate"):(o.$.removeClass("smart-hidden"),o.$.addClass("right"),setTimeout((function(){o.$.removeClass("right")}),0)):o.$[t]("smart-hidden")))}}_toggleFilterInputGroupLabelVisibility(e,t){const i=this,r=i._getCurrentViewItems(i._view).length;if(!0!==t){const e=!i.$filterInputContainer.hasClass("smart-hidden");i.filterable&&r>1?(e||(i.$mainContainer.addClass("filter-input-shown"),i.$filterInputContainer.removeClass("smart-hidden")),i._view?i.$.filterInput.value=i._view.filter||"":i.$.filterInput.value=i._topLevelFilter):e&&(i.$mainContainer.removeClass("filter-input-shown"),i.$filterInputContainer.addClass("smart-hidden"))}if(!e&&i.grouped&&r>0){const e=i._view?i._view.container.firstElementChild.firstElementChild.$:i.$.mainContainer.$.content.firstElementChild.$;1===r?e.addClass("smart-hidden"):e.removeClass("smart-hidden")}}_viewHandler(e){const t=this;if("transitionend"===e.type){const i=e.target;if(i===t.$.view||t.$.backButton.contains(i))return;return i.classList.contains("animate")&&(i.classList.remove("animate"),i.classList.add("smart-hidden")),i.classList.contains("smart-menu-drop-down")&&(i.style.top=""),i.classList.contains("smart-menu-items-group-opened")&&i.classList.remove("smart-menu-items-group-opened"),cancelAnimationFrame(t._refreshScroll),t._refreshScroll=requestAnimationFrame((()=>{t._checkOverflow(),cancelAnimationFrame(t._refreshScroll),delete t._refreshScroll})),void(t._inTransition=!1)}if(t._minimized&&null!==t.dropDownAppendTo)switch(e.type){case"click":t._selectionHandler(e);break;case"mouseout":case"mouseover":t._mouseoutMouseoverHandler(e)}}_mouseWheelHandler(e){let t=this;if(t.enableMouseWheelAction&&!t.disabled&&!t.displayLoadingIndicator&&(t=t.$.mainContainer,t.scrollHeight>0)){const i=t.scrollTop;if(0===i&&e.deltaY<0||i===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault(),t.scrollTo(t.scrollTop+t._getScrollCoefficient(e,t.offsetHeight))}}_scrollViewerRefresh(){const e=this;e.$.scrollViewerContentContainer&&(e.scrollWidth=0,e.scrollHeight=function(){let t;const i=e.$.scrollViewerContainer.classList.contains("hscroll");if(e.$.scrollViewerContainer.classList.remove("hscroll"),Smart.Utilities.Core.Browser.Safari){const i=e.$.scrollViewerContentContainer.getBoundingClientRect().height,r=e.$.scrollViewerContainer.getBoundingClientRect().height;t=i&&r?parseInt(i)-parseInt(r):e.$.scrollViewerContentContainer.scrollHeight-e.$.scrollViewerContainer.offsetHeight}else t=e.$.scrollViewerContentContainer.scrollHeight-e.$.scrollViewerContainer.offsetHeight;return t>0&&"hidden"!==e.verticalScrollBarVisibility||"visible"===e.verticalScrollBarVisibility?e.$.scrollViewerContainer.classList.add("vscroll"):e.$.scrollViewerContainer.classList.remove("vscroll"),i&&e.$.scrollViewerContainer.classList.add("hscroll"),t}(),e.computedVerticalScrollBarVisibility&&(e.scrollHeight+=e._scrollView.hScrollBar.offsetHeight))}});