smart-webcomponents-react 13.1.1 → 13.1.26

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 (278) hide show
  1. package/alertwindow/alertwindow.d.ts +10 -0
  2. package/alertwindow/alertwindow.esm.js +23 -1
  3. package/alertwindow/alertwindow.umd.js +23 -1
  4. package/barcode/barcode.d.ts +4 -2
  5. package/datetimepicker/datetimepicker.d.ts +8 -0
  6. package/datetimepicker/datetimepicker.esm.js +55 -0
  7. package/datetimepicker/datetimepicker.umd.js +860 -805
  8. package/dialogwindow/dialogwindow.d.ts +10 -0
  9. package/dialogwindow/dialogwindow.esm.js +23 -1
  10. package/dialogwindow/dialogwindow.umd.js +23 -1
  11. package/dockinglayout/dockinglayout.d.ts +6 -0
  12. package/dockinglayout/dockinglayout.esm.js +15 -0
  13. package/dockinglayout/dockinglayout.umd.js +15 -0
  14. package/grid/grid.d.ts +16 -1
  15. package/grid/grid.esm.js +29 -0
  16. package/grid/grid.umd.js +29 -0
  17. package/index.d.ts +225 -7
  18. package/kanban/kanban.d.ts +26 -1
  19. package/kanban/kanban.esm.js +56 -1
  20. package/kanban/kanban.umd.js +56 -1
  21. package/layout/dockinglayout.d.ts +6 -0
  22. package/multilinewindow/multilinewindow.d.ts +10 -0
  23. package/multilinewindow/multilinewindow.esm.js +23 -1
  24. package/multilinewindow/multilinewindow.umd.js +23 -1
  25. package/package.json +1 -1
  26. package/progresswindow/progresswindow.d.ts +10 -0
  27. package/progresswindow/progresswindow.esm.js +23 -1
  28. package/progresswindow/progresswindow.umd.js +23 -1
  29. package/promptwindow/promptwindow.d.ts +10 -0
  30. package/promptwindow/promptwindow.esm.js +23 -1
  31. package/promptwindow/promptwindow.umd.js +23 -1
  32. package/qrcode/package.json +7 -0
  33. package/qrcode/qrcode.d.ts +141 -0
  34. package/qrcode/qrcode.esm.js +376 -0
  35. package/qrcode/qrcode.umd.js +387 -0
  36. package/source/modules/smart.accordion.js +1 -1
  37. package/source/modules/smart.array.js +1 -1
  38. package/source/modules/smart.barcode.js +2 -2
  39. package/source/modules/smart.breadcrumb.js +1 -1
  40. package/source/modules/smart.button.js +1 -1
  41. package/source/modules/smart.buttongroup.js +1 -1
  42. package/source/modules/smart.calendar.js +2 -2
  43. package/source/modules/smart.card.js +1 -1
  44. package/source/modules/smart.cardview.js +5 -5
  45. package/source/modules/smart.carousel.js +1 -1
  46. package/source/modules/smart.chart.js +2 -2
  47. package/source/modules/smart.checkbox.js +1 -1
  48. package/source/modules/smart.checkinput.js +1 -1
  49. package/source/modules/smart.chip.js +1 -1
  50. package/source/modules/smart.colorinput.js +1 -1
  51. package/source/modules/smart.colorpanel.js +1 -1
  52. package/source/modules/smart.colorpicker.js +1 -1
  53. package/source/modules/smart.combobox.js +1 -1
  54. package/source/modules/smart.common.js +3 -3
  55. package/source/modules/smart.countryinput.js +1 -1
  56. package/source/modules/smart.dateinput.js +3 -3
  57. package/source/modules/smart.daterangeinput.js +3 -3
  58. package/source/modules/smart.datetimepicker.js +3 -3
  59. package/source/modules/smart.dockinglayout.js +4 -4
  60. package/source/modules/smart.dropdownbutton.js +1 -1
  61. package/source/modules/smart.dropdownlist.js +1 -1
  62. package/source/modules/smart.editor.js +3 -3
  63. package/source/modules/smart.element.js +1 -1
  64. package/source/modules/smart.fileupload.js +1 -1
  65. package/source/modules/smart.form.js +1 -1
  66. package/source/modules/smart.formulaparser.js +1 -1
  67. package/source/modules/smart.ganttchart.js +7 -7
  68. package/source/modules/smart.gauge.js +2 -2
  69. package/source/modules/smart.grid.js +16 -16
  70. package/source/modules/smart.gridpanel.js +5 -5
  71. package/source/modules/smart.input.js +1 -1
  72. package/source/modules/smart.kanban.js +6 -6
  73. package/source/modules/smart.layout.js +1 -1
  74. package/source/modules/smart.led.js +1 -1
  75. package/source/modules/smart.listbox.js +1 -1
  76. package/source/modules/smart.listmenu.js +1 -1
  77. package/source/modules/smart.map.js +1 -1
  78. package/source/modules/smart.maskedtextbox.js +1 -1
  79. package/source/modules/smart.menu.js +1 -1
  80. package/source/modules/smart.multicomboinput.js +1 -1
  81. package/source/modules/smart.multiinput.js +1 -1
  82. package/source/modules/smart.multilinetextbox.js +1 -1
  83. package/source/modules/smart.multisplitbutton.js +1 -1
  84. package/source/modules/smart.numberinput.js +1 -1
  85. package/source/modules/smart.numerictextbox.js +1 -1
  86. package/source/modules/smart.pager.js +1 -1
  87. package/source/modules/smart.passwordinput.js +1 -1
  88. package/source/modules/smart.passwordtextbox.js +1 -1
  89. package/source/modules/smart.path.js +1 -1
  90. package/source/modules/smart.phoneinput.js +1 -1
  91. package/source/modules/smart.pivottable.js +6 -6
  92. package/source/modules/smart.progressbar.js +1 -1
  93. package/source/modules/smart.qrcode.js +117 -0
  94. package/source/modules/smart.querybuilder.js +3 -3
  95. package/source/modules/smart.radiobutton.js +1 -1
  96. package/source/modules/smart.rating.js +1 -1
  97. package/source/modules/smart.router.js +2 -2
  98. package/source/modules/smart.scheduler.js +5 -5
  99. package/source/modules/smart.scrollbar.js +1 -1
  100. package/source/modules/smart.slider.js +2 -2
  101. package/source/modules/smart.sortable.js +1 -1
  102. package/source/modules/smart.splitter.js +1 -1
  103. package/source/modules/smart.switchbutton.js +1 -1
  104. package/source/modules/smart.table.js +5 -5
  105. package/source/modules/smart.tabs.js +2 -2
  106. package/source/modules/smart.tank.js +2 -2
  107. package/source/modules/smart.textarea.js +1 -1
  108. package/source/modules/smart.textbox.js +1 -1
  109. package/source/modules/smart.timeinput.js +1 -1
  110. package/source/modules/smart.timepicker.js +1 -1
  111. package/source/modules/smart.toast.js +1 -1
  112. package/source/modules/smart.tooltip.js +1 -1
  113. package/source/modules/smart.tree.js +2 -2
  114. package/source/modules/smart.validator.js +1 -1
  115. package/source/modules/smart.window.js +2 -2
  116. package/source/smart.accordion.js +1 -1
  117. package/source/smart.ajax.js +1 -1
  118. package/source/smart.array.js +1 -1
  119. package/source/smart.barcode.js +2 -2
  120. package/source/smart.bootstrap.js +1 -1
  121. package/source/smart.breadcrumb.js +1 -1
  122. package/source/smart.button.js +1 -1
  123. package/source/smart.buttongroup.js +1 -1
  124. package/source/smart.calendar.js +1 -1
  125. package/source/smart.card.js +1 -1
  126. package/source/smart.cardview.js +1 -1
  127. package/source/smart.carousel.js +1 -1
  128. package/source/smart.chart.annotations.js +1 -1
  129. package/source/smart.chart.api.js +1 -1
  130. package/source/smart.chart.core.js +1 -1
  131. package/source/smart.chart.js +1 -1
  132. package/source/smart.chart.rangeselector.js +1 -1
  133. package/source/smart.chart.waterfall.js +1 -1
  134. package/source/smart.checkbox.js +1 -1
  135. package/source/smart.checkinput.js +1 -1
  136. package/source/smart.chip.js +1 -1
  137. package/source/smart.colorinput.js +1 -1
  138. package/source/smart.colorpanel.js +1 -1
  139. package/source/smart.colorpicker.js +1 -1
  140. package/source/smart.combobox.js +1 -1
  141. package/source/smart.complex.js +1 -1
  142. package/source/smart.core.js +1 -1
  143. package/source/smart.countryinput.js +1 -1
  144. package/source/smart.data.js +2 -2
  145. package/source/smart.date.js +2 -2
  146. package/source/smart.dateformatpanel.js +1 -1
  147. package/source/smart.dateinput.js +2 -2
  148. package/source/smart.daterangeinput.js +1 -1
  149. package/source/smart.datetimepicker.js +2 -2
  150. package/source/smart.dockinglayout.js +2 -2
  151. package/source/smart.draw.js +1 -1
  152. package/source/smart.dropdownbutton.js +1 -1
  153. package/source/smart.dropdownlist.js +1 -1
  154. package/source/smart.editor.js +2 -2
  155. package/source/smart.element.js +1 -1
  156. package/source/smart.elements.js +21 -21
  157. package/source/smart.export.js +1 -1
  158. package/source/smart.fileupload.js +1 -1
  159. package/source/smart.filter.js +1 -1
  160. package/source/smart.filterbuilder.js +1 -1
  161. package/source/smart.filterpanel.js +1 -1
  162. package/source/smart.form.js +1 -1
  163. package/source/smart.format.js +1 -1
  164. package/source/smart.formulaparser.js +1 -1
  165. package/source/smart.ganttchart.js +1 -1
  166. package/source/smart.gauge.js +1 -1
  167. package/source/smart.grid.cell.js +2 -2
  168. package/source/smart.grid.chart.js +1 -1
  169. package/source/smart.grid.column.js +2 -2
  170. package/source/smart.grid.core.js +2 -2
  171. package/source/smart.grid.dialog.js +2 -2
  172. package/source/smart.grid.edit.js +2 -2
  173. package/source/smart.grid.export.js +1 -1
  174. package/source/smart.grid.filter.js +2 -2
  175. package/source/smart.grid.group.js +1 -1
  176. package/source/smart.grid.js +1 -1
  177. package/source/smart.grid.menu.js +1 -1
  178. package/source/smart.grid.pager.js +1 -1
  179. package/source/smart.grid.reorder.js +2 -2
  180. package/source/smart.grid.resize.js +1 -1
  181. package/source/smart.grid.row.js +1 -1
  182. package/source/smart.grid.select.js +2 -2
  183. package/source/smart.grid.sort.js +2 -2
  184. package/source/smart.grid.toolbar.js +1 -1
  185. package/source/smart.grid.tree.js +1 -1
  186. package/source/smart.grid.view.js +2 -2
  187. package/source/smart.gridpanel.js +1 -1
  188. package/source/smart.input.js +1 -1
  189. package/source/smart.kanban.js +2 -2
  190. package/source/smart.layout.js +1 -1
  191. package/source/smart.led.js +1 -1
  192. package/source/smart.listbox.js +1 -1
  193. package/source/smart.listmenu.js +1 -1
  194. package/source/smart.map.js +1 -1
  195. package/source/smart.maskedtextbox.js +1 -1
  196. package/source/smart.math.js +1 -1
  197. package/source/smart.menu.js +1 -1
  198. package/source/smart.multicomboinput.js +1 -1
  199. package/source/smart.multiinput.js +1 -1
  200. package/source/smart.multilinetextbox.js +1 -1
  201. package/source/smart.multisplitbutton.js +1 -1
  202. package/source/smart.numberformatpanel.js +1 -1
  203. package/source/smart.numberinput.js +1 -1
  204. package/source/smart.numeric.js +1 -1
  205. package/source/smart.numerictextbox.js +1 -1
  206. package/source/smart.pager.js +1 -1
  207. package/source/smart.passwordinput.js +1 -1
  208. package/source/smart.passwordtextbox.js +1 -1
  209. package/source/smart.path.js +1 -1
  210. package/source/smart.phoneinput.js +1 -1
  211. package/source/smart.pivottable.js +1 -1
  212. package/source/smart.powerbutton.js +1 -1
  213. package/source/smart.progressbar.js +1 -1
  214. package/source/smart.qrcode.js +6 -0
  215. package/source/smart.radiobutton.js +1 -1
  216. package/source/smart.rating.js +1 -1
  217. package/source/smart.router.js +1 -1
  218. package/source/smart.scheduler.js +1 -1
  219. package/source/smart.scrollbar.js +1 -1
  220. package/source/smart.slider.js +1 -1
  221. package/source/smart.sortable.js +1 -1
  222. package/source/smart.splitter.js +1 -1
  223. package/source/smart.switchbutton.js +1 -1
  224. package/source/smart.table.js +2 -2
  225. package/source/smart.tabs.js +2 -2
  226. package/source/smart.tank.js +1 -1
  227. package/source/smart.textarea.js +1 -1
  228. package/source/smart.textbox.js +1 -1
  229. package/source/smart.tickintervalhandler.js +1 -1
  230. package/source/smart.timeinput.js +1 -1
  231. package/source/smart.timepicker.js +1 -1
  232. package/source/smart.toast.js +1 -1
  233. package/source/smart.tooltip.js +1 -1
  234. package/source/smart.tree.js +2 -2
  235. package/source/smart.validationpanel.js +1 -1
  236. package/source/smart.validator.js +1 -1
  237. package/source/smart.window.js +2 -2
  238. package/source/styles/components/smart.base.css +1 -1
  239. package/source/styles/components/smart.grid.css +1 -1
  240. package/source/styles/components/smart.kanban.css +1 -1
  241. package/source/styles/default/scss/smart.grid.scss +13 -17
  242. package/source/styles/default/scss/smart.kanban.scss +289 -233
  243. package/source/styles/default/scss/smart.qrcode.scss +6 -0
  244. package/source/styles/default/smart.grid.css +15 -16
  245. package/source/styles/default/smart.kanban.css +247 -200
  246. package/source/styles/default/smart.qrcode.css +6 -0
  247. package/source/styles/default/smart.variables.css +2 -2
  248. package/source/styles/smart.default.css +3 -3
  249. package/source/typescript/smart.barcode.d.ts +4 -2
  250. package/source/typescript/smart.datetimepicker.d.ts +10 -0
  251. package/source/typescript/smart.dockinglayout.d.ts +7 -0
  252. package/source/typescript/smart.elements.d.ts +225 -7
  253. package/source/typescript/smart.grid.d.ts +18 -1
  254. package/source/typescript/smart.kanban.d.ts +27 -2
  255. package/source/typescript/smart.qrcode.d.ts +134 -0
  256. package/source/typescript/smart.tree.d.ts +17 -2
  257. package/source/typescript/smart.window.d.ts +10 -0
  258. package/tabs/tabswindow.d.ts +10 -0
  259. package/tabswindow/tabswindow.d.ts +10 -0
  260. package/tabswindow/tabswindow.esm.js +23 -1
  261. package/tabswindow/tabswindow.umd.js +23 -1
  262. package/timepicker/datetimepicker.d.ts +8 -0
  263. package/tree/tree.d.ts +14 -2
  264. package/tree/tree.esm.js +45 -2
  265. package/tree/tree.umd.js +45 -2
  266. package/waitwindow/waitwindow.d.ts +10 -0
  267. package/waitwindow/waitwindow.esm.js +23 -1
  268. package/waitwindow/waitwindow.umd.js +23 -1
  269. package/window/alertwindow.d.ts +10 -0
  270. package/window/dialogwindow.d.ts +10 -0
  271. package/window/multilinewindow.d.ts +10 -0
  272. package/window/progresswindow.d.ts +10 -0
  273. package/window/promptwindow.d.ts +10 -0
  274. package/window/tabswindow.d.ts +10 -0
  275. package/window/waitwindow.d.ts +10 -0
  276. package/window/window.d.ts +10 -0
  277. package/window/window.esm.js +23 -1
  278. package/window/window.umd.js +23 -1
@@ -772,14 +772,14 @@ Smart("smart-button",class extends Smart.ContentElement{static get properties(){
772
772
  /***/ 6057:
773
773
  /***/ (() => {
774
774
 
775
- (()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};"string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0?(t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0?(t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0?(t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0?(t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType)?(t._bindToICS(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType)?(t._bindToXML(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType)?(t._bindToCSV(),a()):"array"===t.dataSourceType?(t._bindToArray(),a()):"json"===t.dataSourceType&&(t._bindToJSON(),a())}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={},l=i[t].split(a);for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{switch(t.condition){case"EQUAL":return e+" = "+t.value;case"NOT_EQUAL":return e+" != "+t.value;case"GREATER_THAN":return e+" > "+t.value;case"GREATER_THAN_OR_EQUAL":return e+" >= "+t.value;case"LESS_THAN":return e+" < "+t.value;case"LESS_THAN_OR_EQUAL":return e+" <= "+t.value;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+t.value+" and "+e+" <= "+t.valueTo+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1===o.logicalOperators[t]&&(s=" OR ")}r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e)}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n]+"'");d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),e.push("'"+t.edit.row[n]+"'"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id])),t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=Object.assign({},e.boundSource[n]);if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let f=new Array;for(let t=0;t<e.length;t++)f[t]=u();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const h=new Array,p=new Array;let g=0;const S=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};let y=!1;for(let n=0;n<d.length;n++){let m=Object.assign({},S(d[n]));m[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=m[a];null!=n?((""===n||void 0===n&&0===t)&&(y=!0),T[b++]={value:n,group:a,hash:f[t]}):(T[b++]={value:null,group:a,hash:f[t]},0===t&&(y=!0))}if(T.length!==e.length)break;let v=null,E="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(E=E+"_"+T[e].hash+"_"+n,void 0===p[E]||null===p[E]){if(null===v){v={$:{}},v[c.level]=0,v[c.leaf]=!1,v[o]=null,v[a]=n,v[r]=m,v.groupDataField=d,v[d]||(v[d]=v.data[d]),void 0!==m[c.expanded]?v[c.expanded]=m[c.expanded]:(v[c.expanded]=!1,s.expandHierarchy&&(v[c.expanded]=!0)),i&&(v[i]=m[i]),v[t]=new Array;let e=h.length+l;this.id&&"number"!=typeof m.$.id&&!isFinite(m.$.id)||(e="Item"+e),void 0===v.$.id&&(v.$.id=e),s._expandedRowIds[v.$.id]&&(v[c.expanded]=!0),h[g++]=v}else{const e={$:{}};e[c.level]=v[c.level]+1,e[o]=v,e[a]=n,e[t]=new Array,e[r]=m,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==m[c.expanded]?e[c.expanded]=m[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=m[i]),void 0===e.$.id&&(e.$.id=v.$.id+"_"+v[t].length),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),v[t][v[t].length]=e,v=e}p[E]=v}else v=p[E]}m&&(m[c.leaf]=!0),null!==v?(null===this.id?void 0===m.$.id&&(m.$.id=v.$.id+"_"+v[t].length):void 0===m.$.id&&-1===m.$.id.toString().indexOf(v.$.id)&&(m.$.id=v.$.id+"_"+m.$.id),m[o]=v,m[c.level]=v[c.level]+1,v[t][v[t].length]=m):void 0===m.$.id&&(m.$.id=u())}if(y){let e=null,t=!1;for(let a=0;a<h.length;a++){const n=h[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),h.splice(a,1);break}}if(e&&(h.push(e),t))for(let e=0;e<h.length;e++){h[e].$.id="Item"+e}}return h}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType]?o=a._cachedValues[o+"_"+r.dataType]:("bool"===r.dataType||"boolean"===r.dataType?"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1):"number"===r.dataType?(-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0)):"any"!==r.dataType&&(o=a.$document.deserialize(""+o,r.dataType,!0)),"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)),"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];""!==t&&" "!==t&&i.push(t.trim())}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n="and",i=0;for(let o=0;o<r.length;o++){let d=r[o];if("and"!==d&&"or"!==d){if(i++,2===i){let l=a[r[o-1]];l||(l=r[o-1]),"number"===e&&(d=parseFloat(d)),"date"===e&&(d=new Date(d));const s=t.createFilter(e,d,l);i=0,n&&t.addFilter(n,s)}}else n=d}o.push(t)}else{const e=r[0];if("and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy)throw new Error("sort: Missing or Invalid arguments!");"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let o=e[0][t[r]];if(void 0===o&&e[0]&&e[0].children&&e[0].data&&(o=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}s[r]=c(o,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
775
+ (()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};"string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0?(t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0?(t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0?(t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0?(t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType)?(t._bindToICS(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType)?(t._bindToXML(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType)?(t._bindToCSV(),a()):"array"===t.dataSourceType?(t._bindToArray(),a()):"json"===t.dataSourceType&&(t._bindToJSON(),a())}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={},l=i[t].split(a);for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{switch(t.condition){case"EQUAL":return e+" = "+t.value;case"NOT_EQUAL":return e+" != "+t.value;case"GREATER_THAN":return e+" > "+t.value;case"GREATER_THAN_OR_EQUAL":return e+" >= "+t.value;case"LESS_THAN":return e+" < "+t.value;case"LESS_THAN_OR_EQUAL":return e+" <= "+t.value;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+t.value+" and "+e+" <= "+t.valueTo+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1===o.logicalOperators[t]&&(s=" OR ")}r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e)}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n]+"'");d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),e.push("'"+t.edit.row[n]+"'"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id])),t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=Object.assign({},e.boundSource[n]);if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let f=new Array;for(let t=0;t<e.length;t++)f[t]=u();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const h=new Array,p=new Array;let g=0;const S=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};let y=!1;for(let n=0;n<d.length;n++){let m=Object.assign({},S(d[n]));m[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=m[a];null!=n?((""===n||void 0===n&&0===t)&&(y=!0),T[b++]={value:n,group:a,hash:f[t]}):(T[b++]={value:null,group:a,hash:f[t]},0===t&&(y=!0))}if(T.length!==e.length)break;let v=null,E="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(E=E+"_"+T[e].hash+"_"+n,void 0===p[E]||null===p[E]){if(null===v){v={$:{}},v[c.level]=0,v[c.leaf]=!1,v[o]=null,v[a]=n,v[r]=m,v.groupDataField=d,v[d]||(v[d]=v.data[d]),void 0!==m[c.expanded]?v[c.expanded]=m[c.expanded]:(v[c.expanded]=!1,s.expandHierarchy&&(v[c.expanded]=!0)),i&&(v[i]=m[i]),v[t]=new Array;let e=h.length+l;this.id&&"number"!=typeof m.$.id&&!isFinite(m.$.id)||(e="Item"+e),void 0===v.$.id&&(v.$.id=e),s._expandedRowIds[v.$.id]&&(v[c.expanded]=!0),h[g++]=v}else{const e={$:{}};e[c.level]=v[c.level]+1,e[o]=v,e[a]=n,e[t]=new Array,e[r]=m,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==m[c.expanded]?e[c.expanded]=m[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=m[i]),void 0===e.$.id&&(e.$.id=v.$.id+"_"+v[t].length),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),v[t][v[t].length]=e,v=e}p[E]=v}else v=p[E]}m&&(m[c.leaf]=!0),null!==v?(null===this.id?void 0===m.$.id&&(m.$.id=v.$.id+"_"+v[t].length):void 0===m.$.id&&-1===m.$.id.toString().indexOf(v.$.id)&&(m.$.id=v.$.id+"_"+m.$.id),m[o]=v,m[c.level]=v[c.level]+1,v[t][v[t].length]=m):void 0===m.$.id&&(m.$.id=u())}if(y){let e=null,t=!1;for(let a=0;a<h.length;a++){const n=h[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),h.splice(a,1);break}}if(e&&(h.push(e),t))for(let e=0;e<h.length;e++){h[e].$.id="Item"+e}}return h}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType)if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0);else"any"!==r.dataType&&(o=a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];""!==t&&" "!==t&&i.push(t.trim())}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n="and",i=0;for(let o=0;o<r.length;o++){let d=r[o];if("and"!==d&&"or"!==d){if(i++,2===i){let l=a[r[o-1]];l||(l=r[o-1]),"number"===e&&(d=parseFloat(d)),"date"===e&&(d=new Date(d));const s=t.createFilter(e,d,l);i=0,n&&t.addFilter(n,s)}}else n=d}o.push(t)}else{const e=r[0];if("and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy)throw new Error("sort: Missing or Invalid arguments!");"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let o=e[0][t[r]];if(void 0===o&&e[0]&&e[0].children&&e[0].data&&(o=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}s[r]=c(o,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
776
776
 
777
777
  /***/ }),
778
778
 
779
779
  /***/ 2052:
780
780
  /***/ (() => {
781
781
 
782
- (()=>{const e=-1*(new Date).getTimezoneOffset(),t=[{id:"Local",offset:e,offsetHours:e/60,displayName:"",supportsDaylightSavingTime:!1},{id:"Dateline Standard Time",offset:-720,offsetHours:-12,displayName:"(UTC-12:00) International Date Line West",supportsDaylightSavingTime:!1},{id:"UTC-11",offset:-660,offsetHours:-11,displayName:"(UTC-11:00) Coordinated Universal Time-11",supportsDaylightSavingTime:!1},{id:"Hawaiteratoran Standard Time",offset:-600,offsetHours:-10,displayName:"(UTC-10:00) Hawaiterator",supportsDaylightSavingTime:!1},{id:"Alaskan Standard Time",offset:-540,offsetHours:-9,displayName:"(UTC-09:00) Alaska",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time (Mexico)",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Baja California",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Pacific Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Arizona",supportsDaylightSavingTime:!1},{id:"Mountain Standard Time (Mexico)",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",supportsDaylightSavingTime:!0},{id:"Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Mountain Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central America Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central America",supportsDaylightSavingTime:!1},{id:"Canada Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Saskatchewan",supportsDaylightSavingTime:!1},{id:"Central Standard Time (Mexico)",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",supportsDaylightSavingTime:!0},{id:"SA Pacific Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Bogota, Lima, Quito, Rio Branco",supportsDaylightSavingTime:!1},{id:"Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Eastern Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Indiana (East)",supportsDaylightSavingTime:!0},{id:"Venezuela Standard Time",offset:-270,offsetHours:-4.5,displayName:"(UTC-04:30) Caracas",supportsDaylightSavingTime:!1},{id:"Atlantic Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Atlantic Time (Canada)",supportsDaylightSavingTime:!0},{id:"Paraguay Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Asuncion",supportsDaylightSavingTime:!0},{id:"Central Brazilian Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Cuiaba",supportsDaylightSavingTime:!0},{id:"Pacific SA Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Santiago",supportsDaylightSavingTime:!0},{id:"SA Western Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",supportsDaylightSavingTime:!1},{id:"Newfoundland Standard Time",offset:-210,offsetHours:-3.5,displayName:"(UTC-03:30) Newfoundland",supportsDaylightSavingTime:!0},{id:"SA Eastern Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Cayenne, Fortaleza",supportsDaylightSavingTime:!1},{id:"Argentina Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Buenos Aires",supportsDaylightSavingTime:!0},{id:"E. South America Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Brasilia",supportsDaylightSavingTime:!0},{id:"Bahia Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Salvador",supportsDaylightSavingTime:!0},{id:"Montevideo Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Montevideo",supportsDaylightSavingTime:!0},{id:"Greenland Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Greenland",supportsDaylightSavingTime:!0},{id:"UTC-02",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Coordinated Universal Time-02",supportsDaylightSavingTime:!1},{id:"Mid-Atlantic Standard Time",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Mid-Atlantic - Old",supportsDaylightSavingTime:!0},{id:"Azores Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Azores",supportsDaylightSavingTime:!0},{id:"Cape Verde Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Cape Verde Is.",supportsDaylightSavingTime:!1},{id:"Morocco Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Casablanca",supportsDaylightSavingTime:!0},{id:"UTC",offset:0,offsetHours:0,displayName:"(UTC) Coordinated Universal Time",supportsDaylightSavingTime:!1},{id:"GMT Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Dublin, Edinburgh, Lisbon, London",supportsDaylightSavingTime:!0},{id:"Greenwich Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Monrovia, Reykjavik",supportsDaylightSavingTime:!1},{id:"Central European Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",supportsDaylightSavingTime:!0},{id:"Namibia Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Windhoek",supportsDaylightSavingTime:!0},{id:"W. Central Africa Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) West Central Africa",supportsDaylightSavingTime:!1},{id:"W. Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",supportsDaylightSavingTime:!0},{id:"Central Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",supportsDaylightSavingTime:!0},{id:"Romance Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",supportsDaylightSavingTime:!0},{id:"FLE Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",supportsDaylightSavingTime:!0},{id:"South Africa Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Harare, Pretoria",supportsDaylightSavingTime:!1},{id:"Turkey Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Istanbul",supportsDaylightSavingTime:!0},{id:"GTB Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Athens, Bucharest",supportsDaylightSavingTime:!0},{id:"Libya Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Tripoli",supportsDaylightSavingTime:!0},{id:"E. Europe Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) E. Europe",supportsDaylightSavingTime:!0},{id:"Jordan Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Amman",supportsDaylightSavingTime:!0},{id:"Middle East Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Beirut",supportsDaylightSavingTime:!0},{id:"Egypt Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Cairo",supportsDaylightSavingTime:!0},{id:"Syria Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Damascus",supportsDaylightSavingTime:!0},{id:"Israel Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Jerusalem",supportsDaylightSavingTime:!0},{id:"Arab Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kuwait, Riyadh",supportsDaylightSavingTime:!1},{id:"E. Africa Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Nairobi",supportsDaylightSavingTime:!1},{id:"Arabic Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Baghdad",supportsDaylightSavingTime:!0},{id:"Kaliningrad Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kaliningrad, Minsk",supportsDaylightSavingTime:!0},{id:"Iran Standard Time",offset:210,offsetHours:3.5,displayName:"(UTC+03:30) Tehran",supportsDaylightSavingTime:!0},{id:"Mauritius Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Port Louis",supportsDaylightSavingTime:!0},{id:"Georgian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Tbilisi",supportsDaylightSavingTime:!1},{id:"Caucasus Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Yerevan",supportsDaylightSavingTime:!0},{id:"Arabian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Abu Dhabi, Muscat",supportsDaylightSavingTime:!1},{id:"Azerbaijan Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Baku",supportsDaylightSavingTime:!0},{id:"Russian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Moscow, St. Petersburg, Volgograd",supportsDaylightSavingTime:!0},{id:"Afghanistan Standard Time",offset:270,offsetHours:4.5,displayName:"(UTC+04:30) Kabul",supportsDaylightSavingTime:!1},{id:"Pakistan Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Islamabad, Karachi",supportsDaylightSavingTime:!0},{id:"West Asia Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Ashgabat, Tashkent",supportsDaylightSavingTime:!1},{id:"India Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",supportsDaylightSavingTime:!1},{id:"Sri Lanka Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Sri Jayawardenepura",supportsDaylightSavingTime:!1},{id:"Nepal Standard Time",offset:345,offsetHours:5.75,displayName:"(UTC+05:45) Kathmandu",supportsDaylightSavingTime:!1},{id:"Central Asia Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Astana",supportsDaylightSavingTime:!1},{id:"Bangladesh Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Dhaka",supportsDaylightSavingTime:!0},{id:"Ekaterinburg Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Ekaterinburg",supportsDaylightSavingTime:!0},{id:"Myanmar Standard Time",offset:390,offsetHours:6.5,displayName:"(UTC+06:30) Yangon (Rangoon)",supportsDaylightSavingTime:!1},{id:"SE Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Bangkok, Hanoi, Jakarta",supportsDaylightSavingTime:!1},{id:"N. Central Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Novosibirsk",supportsDaylightSavingTime:!0},{id:"Ulaanbaatar Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Ulaanbaatar",supportsDaylightSavingTime:!1},{id:"China Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",supportsDaylightSavingTime:!1},{id:"Singapore Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Kuala Lumpur, Singapore",supportsDaylightSavingTime:!1},{id:"North Asia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Krasnoyarsk",supportsDaylightSavingTime:!0},{id:"Taipei Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Taipei",supportsDaylightSavingTime:!1},{id:"W. Australia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Perth",supportsDaylightSavingTime:!0},{id:"Korea Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Seoul",supportsDaylightSavingTime:!1},{id:"North Asia East Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Irkutsk",supportsDaylightSavingTime:!0},{id:"Tokyo Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Osaka, Sapporo, Tokyo",supportsDaylightSavingTime:!1},{id:"AUS Central Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Darwin",supportsDaylightSavingTime:!1},{id:"Cen. Australia Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Adelaide",supportsDaylightSavingTime:!0},{id:"West Pacific Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Guam, Port Moresby",supportsDaylightSavingTime:!1},{id:"Tasmania Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Hobart",supportsDaylightSavingTime:!0},{id:"E. Australia Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Brisbane",supportsDaylightSavingTime:!1},{id:"AUS Eastern Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Canberra, Melbourne, Sydney",supportsDaylightSavingTime:!0},{id:"Yakutsk Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Yakutsk",supportsDaylightSavingTime:!0},{id:"Vladivostok Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Vladivostok",supportsDaylightSavingTime:!0},{id:"Central Pacific Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Solomon Is., New Caledonia",supportsDaylightSavingTime:!1},{id:"Magadan Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Magadan",supportsDaylightSavingTime:!0},{id:"Kamchatka Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",supportsDaylightSavingTime:!0},{id:"Fiji Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Fiji",supportsDaylightSavingTime:!0},{id:"New Zealand Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Auckland, Wellington",supportsDaylightSavingTime:!0},{id:"UTC+12",offset:720,offsetHours:12,displayName:"(UTC+12:00) Coordinated Universal Time+12",supportsDaylightSavingTime:!1},{id:"Tonga Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Nuku'alofa",supportsDaylightSavingTime:!1},{id:"Samoa Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Samoa",supportsDaylightSavingTime:!0}],a=[0,31,59,90,120,151,181,212,243,273,304,334,365],s=[0,31,60,91,121,152,182,213,244,274,305,335,366];Smart.Utilities.Assign("TimeSpan",class{constructor(){const e=this;if(e.ticksPerMillisecond=1e4,e.millisecondsPerTick=1e-4,e.ticksPerSecond=1e7,e.secondsPerTick=1e-7,e.ticksPerMinute=6e8,e.minutesPerTick=1/6e8,e.ticksPerHour=36e9,e.hoursPerTick=1/36e9,e.ticksPerDay=864e9,e.daysPerTick=1/864e9,e.millisPerSecond=1e3,e.millisPerMinute=6e4,e.millisPerHour=36e5,e.millisPerDay=864e5,e._ticks=0,1===arguments.length){if(isNaN(arguments[0]))throw new Error("Argument must be a number.");e._ticks=arguments[0]}else if(3===arguments.length)e._ticks=e.timeToMS(arguments[0],arguments[1],arguments[2],0);else if(4===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+0;e._ticks=t*e.ticksPerMillisecond}else if(5===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+arguments[4];e._ticks=t*e.ticksPerMillisecond}}ticks(){return this._ticks}days(){return parseInt(this._ticks/this.ticksPerDay)}timeToMS(e,t,a,s){return parseInt((3600*e+60*t+a+s/1e3)*this.ticksPerSecond)}hours(){return parseInt(this._ticks/this.ticksPerHour)%24}milliseconds(){return parseInt(this._ticks/this.ticksPerMillisecond)%1e3}minutes(){return parseInt(this._ticks/this.ticksPerMinute)%60}seconds(){return parseInt(this._ticks/this.ticksPerSecond)%60}totalDays(){return parseInt(this._ticks*this.daysPerTick)}totalHours(){return parseInt(this._ticks*this.hoursPerTick)}totalMilliseconds(){const e=this._ticks*this.millisecondsPerTick;return parseInt(e)}totalMinutes(){return parseInt(this._ticks*this.minutesPerTick)}totalSeconds(){return parseInt(this._ticks*this.secondsPerTick)}add(e){const t=this._ticks+e._ticks;return new Smart.Utilities.TimeSpan(t)}subtract(e){const t=this._ticks-e._ticks;return new Smart.Utilities.TimeSpan(t)}duration(){const e=this;return e._ticks>=0?new Smart.Utilities.TimeSpan(e._ticks):new Smart.Utilities.TimeSpan(-e._ticks)}equals(e){return this._ticks===e._ticks}valueOf(){return this._ticks}compare(e,t){return e._ticks>t._ticks?1:e._ticks<t._ticks?-1:0}interval(e,t){const a=e*t+(e>=0?.5:-.5);return new Smart.Utilities.TimeSpan(a*this.ticksPerMillisecond)}fromDays(e){return this.interval(e,this.millisPerDay)}fromHours(e){return this.interval(e,this.millisPerHour)}fromMilliseconds(e){return this.interval(e,1)}fromMinutes(e){return this.interval(e,this.millisPerMinute)}fromSeconds(e){return this.interval(e,this.millisPerSecond)}fromTicks(e){return new Smart.Utilities.TimeSpan(e)}toString(){return this.totalMilliseconds().toString()}negate(){return new Smart.Utilities.TimeSpan(-this._ticks)}}),Smart.Utilities.Assign("DateTime",class{constructor(){function e(e){const t=i.regexISOString.exec(e);n=new Smart.Utilities.DateTime(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]),parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]),parseFloat(t[7]),0,0,0,0,0,0,0,"UTC")}const i=this;let n;if(i.ticksPerMillisecond=1e4,i.millisecondsPerTick=1e-4,i.ticksPerSecond=1e7,i.secondsPerTick=1e-7,i.ticksPerMinute=6e8,i.minutesPerTick=1/6e8,i.ticksPerHour=36e9,i.hoursPerTick=1/36e9,i.ticksPerDay=864e9,i.daysPerTick=1/864e9,i.millisPerSecond=1e3,i.millisPerMinute=6e4,i.millisPerHour=36e5,i.millisPerDay=864e5,i.daysPerYear=365,i.daysPer4Years=1461,i.daysPer100Years=36524,i.daysPer400Years=146097,i.daysTo1601=584388,i.daysTo1899=693593,i.daysTo10000=3652059,i.minTicks=0,i.maxTicks=3155378976e9,i.maxMillis=3155378976e5,i.datePartYear=0,i.datePartDayOfYear=1,i.datePartMonth=2,i.datePartDay=3,i.daysToMonth365=a,i.daysToMonth366=s,i.minValue=new Date(0),i.maxValue=new Date(3155378976e9),i.ticksMask=0x4000000000000000,i.flagsMask=0xc000000000000000,i.localMask=0x8000000000000000,i.ticksCeiling=0x4000000000000000,i.kindUnspecified=0,i.kindUtc=0x4000000000000000,i.kindLocal=0x8000000000000000,i.kindLocalAmbiguousDst=0xc000000000000000,i.kindShift=62,i.regexTrim=/^\s+|\s+$/g,i.regexInfinity=/^[+-]?infinity$/i,i.regexHex=/^0x[a-f0-9]+$/i,i.regexParseFloat=/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/,i.regexISOString=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})Z$/,i.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}],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",FP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",FPA:"yyyy/MM/dd HH:mm:ss:fffuunnppeeaaxxoo",FPA2:"yyyy-MM-dd HH:mm:ss:fffuunnppeeaaxxoo",FT:"HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",PP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp",PT:"HH:mm:ss:fff:uu:nn:pp"},percentsymbol:"%",currencysymbol:"$",currencysymbolposition:"before",decimalseparator:".",thousandsseparator:","},i.dateData=0,i.timeZone=null,i.timeZones=t,i._codeToUnit={u:"_microsecond",uu:"_microsecond",n:"_nanosecond",nn:"_nanosecond",p:"_picosecond",pp:"_picosecond",e:"_femtosecond",ee:"_femtosecond",a:"_attosecond",aa:"_attosecond",x:"_zeptosecond",xx:"_zeptosecond",o:"_yoctosecond",oo:"_yoctosecond"},i._smallUnits=["_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"],i._microsecond=0,i._nanosecond=0,i._picosecond=0,i._femtosecond=0,i._attosecond=0,i._zeptosecond=0,i._yoctosecond=0,0===arguments.length){const e=new Date;i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else if(1===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}}else if(2===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}i.validateTimeZone(arguments[1])}else if(arguments.length>2)if("string"==typeof arguments[0]){const e=i.tryparseDate(arguments[0],arguments[2],arguments[1]);i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else{const e=arguments[0],t=arguments[7]||0,a=arguments[8]||0,s=arguments[9]||0,n=arguments[10]||0,r=arguments[11]||0,o=arguments[12]||0,d=arguments[13]||0,l=new Date(e,arguments[1]-1,arguments[2],arguments[3]||0,arguments[4]||0,arguments[5]||0,arguments[6]||0);e<1970&&l.setFullYear(e),i.dateData=i.dateToMS(l.getFullYear(),l.getMonth()+1,l.getDate())+i.timeToMS(l.getHours(),l.getMinutes(),l.getSeconds(),l.getMilliseconds()),i._microsecond=t,i._nanosecond=a,i._picosecond=s,i._femtosecond=n,i._attosecond=r,i._zeptosecond=o,i._yoctosecond=d,arguments[14]&&i.validateTimeZone(arguments[14])}if(i.timeZone||i.validateTimeZone("Local"),n){const e=n.toTimeZone(i.timeZone);i.dateData=e.dateData}}static isValidDate(e){const t=this.validateDate(e);return!(!t||t&&!t.dateData)}static validateDate(e,t,a){if(e instanceof Smart.Utilities.DateTime)return e;if(e instanceof Date)return new Smart.Utilities.DateTime(e);try{if("string"==typeof e&&a)return this.parseDateString(e,t,a);if(new RegExp(/^\d{1,2}\/\d{1,2}\/\d{4}(, \d{1,2}:\d{2}:\d{1,2} [A|P]M)?$/).test(e)){const t=new Date(e);if(!isNaN(t.getTime()))return new Smart.Utilities.DateTime(t)}if("string"==typeof e)return this.parseDateString(e,t,a);if("number"==typeof e)return new Smart.Utilities.DateTime(new Date(e))}catch(e){}return t}static parseDateString(e,t,a){const s=new Date(e);if(!isNaN(s.getTime()))return e&&"string"==typeof e&&a?new Smart.Utilities.DateTime(e,a,null):new Smart.Utilities.DateTime(s);const i=e.indexOf("Date("),n=e.indexOf("DateTime("),r=e.lastIndexOf(")");let o=e;if(-1===i&&-1===n||-1===r){const t=new Smart.Utilities.DateTime,s=t.parseDate(e,a);if(s)return o=new Smart.Utilities.DateTime(s),t.copySmallTimePartValues(o),o}else{if(o=-1!==i?e.slice(i+5,r):e.slice(n+9,r),o=o.replace(/'/g,"").replace(/"/g,"").replace(/^\s+|\s+$|\s+(?=\s)/g,""),""===o.trim())return new Smart.Utilities.DateTime;if(new RegExp(/(^(\d+)(\s*,\s*\d+)+(\s*,\s*[a-zA-Z ]+)?$)/g).test(o))return o=o.split(","),o.map((function(e,t){isNaN(o[t])?o[t]=e.trim():o[t]=parseInt(e)})),-1!==i&&o[1]++,o.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,o)),o}if(""===o.trim())return t;if(!isNaN(o))return o=new Date(parseInt(o,10)),new Smart.Utilities.DateTime(o);try{const e=o.split(",");2===e.length?(e[1]=e[1].trim(),e.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,e))):o=new Smart.Utilities.DateTime(o)}catch(e){o=t}return o}static fromFullTimeStamp(e){e=e.toString();const t=new Smart.Utilities.DateTime(parseFloat(e.slice(0,e.length-21)));let a=e.slice(e.length-21),s=0;for(;a.length>0;)t[t._smallUnits[s]]=parseInt(a.slice(0,3),10),a=a.slice(3),s++;return t}static getConstructorParameters(e){return[e.year(),e.month(),e.day(),e.hour(),e.minute(),e.second(),e.millisecond(),e._microsecond,e._nanosecond,e._picosecond,e._femtosecond,e._attosecond,e._zeptosecond,e._yoctosecond,e.timeZone]}static detectDisplayMode(e,t,a){if(e.calendar.patterns[t])return-1!==["d","D","M","Y","d1","d2"].indexOf(t)?"calendar":-1!==["t","T","FT","PT"].indexOf(t)?"timePicker":"default";const s=["d","M","y"],i=["h","H","m","s","t","f","u","n","p","e","a","x","o"],n=a.groups;let r=!1,o=!1;for(let e=0;e<n.length;e++){const t=n[e].charAt(0);if(-1!==s.indexOf(t)?r=!0:-1!==i.indexOf(t)&&(o=!0),r&&o)break}return r===o?"default":r?"calendar":"timePicker"}static getLocalizedNames(e){const t={names:[],namesAbbr:[],namesShort:[]},a={names:[],namesAbbr:[]};if(this[e])return this[e];for(let a=23;a<30;a++){const s=new Date(2017,6,a),i=s.toLocaleString(e,{weekday:"long"});t.names.push(i),t.namesAbbr.push(s.toLocaleString(e,{weekday:"short"})),t.namesShort.push(i.substring(0,2))}for(let t=0;t<12;t++){const s=new Date(2017,t,1).toLocaleString(e,{month:"long"});a.names.push(s),a.namesAbbr.push(s.substring(0,3))}return a.names.push(""),a.namesAbbr.push(""),this[e]={days:t,months:a},this[e]}internalMS(){return this.dateData}getDatePart(e){const t=this,a=t.internalMS();let s=parseInt(a/t.millisPerDay);const i=parseInt(s/t.daysPer400Years);s-=i*t.daysPer400Years;let n=parseInt(s/t.daysPer100Years);4===n&&(n=3),s-=n*t.daysPer100Years;const r=parseInt(s/t.daysPer4Years);s-=r*t.daysPer4Years;let o=parseInt(s/t.daysPerYear);if(4===o&&(o=3),e===t.datePartYear)return parseInt(400*i+100*n+4*r+o+1);if(s-=o*t.daysPerYear,e===t.datePartDayOfYear)return parseInt(s+1);const d=3===o&&(24!==r||3===n)?t.daysToMonth366:t.daysToMonth365;let l=s>>6;for(;s>=d[l];)l++;return e===t.datePartMonth?parseInt(l):parseInt(s-d[l-1]+1)}dayOfWeek(){const e=this.dateData;return parseInt(e/this.millisPerDay+1)%7}dayOfYear(){return this.getDatePart(this.datePartDayOfYear)}weekOfYear(e){const t=this.toDate(),a=e||this.calendar.firstDay,s=new Date(t.getFullYear(),0,1),i=Math.floor((t.getTime()-s.getTime()-6e4*(t.getTimezoneOffset()-s.getTimezoneOffset()))/864e5)+1;let n,r=s.getDay()-a;if(r=r>=0?r:r+7,r<4){if(n=Math.floor((i+r-1)/7)+1,n>52){let e=new Date(t.getFullYear()+1,0,1).getDay()-a;e=e>=0?e:e+7,n=e<4?1:53}}else n=Math.floor((i+r-1)/7);return n}subtract(e){const t=this;return new Smart.Utilities.TimeSpan(t.dateData*t.ticksPerMillisecond-e.dateData*t.ticksPerMillisecond)}dateToMS(e,t,a){const s=this;if(e>=1&&e<=9999&&t>=1&&t<=12){e=parseInt(e);const i=s.isLeapYear(e)?s.daysToMonth366:s.daysToMonth365;if(a>=1&&a<=i[t]-i[t-1]){const n=e-1;return(365*n+parseInt(n/4)-parseInt(n/100)+parseInt(n/400)+i[t-1]+a-1)*s.millisPerDay}}}isLeapYear(e){if(e<1||e>9999)throw new Error("Year out of Range");return e%4==0&&(e%100!=0||e%400==0)}timeToMS(e,t,a,s){const i=this;if(e>=0&&e<24&&t>=0&&t<60&&a>=0&&a<60){const n=parseInt(3600*e+60*t+a);return s>0&&s<1e3?n*i.millisPerSecond+s:n*i.millisPerSecond}}daysInMonth(e,t){if(t<1||t>12)throw new Error("Month out of Range");const a=this,s=a.isLeapYear(e)?a.daysToMonth366:a.daysToMonth365;return s[t]-s[t-1]}arrayIndexOf(e,t){return e.indexOf(t)}startsWith(e,t){return 0===e.indexOf(t)}endsWith(e,t){return e.substr(e.length-t.length)===t}trim(e){return(e+"").replace(this.regexTrim,"")}expandFormat(e,t){t=t||"F";let a,s=e.patterns,i=t.length;if(s[t])return s[t];if(1===i){if(a=s[t],!a)throw"Invalid date format string '"+t+"'.";t=a}else 2===i&&"%"===t.charAt(0)&&(t=t.charAt(1));return t}getEra(e,t){if(!t)return 0;if("string"==typeof e)return 0;let a,s=e.getTime();for(let e=0,i=t.length;e<i;e++)if(a=t[e].start,null===a||s>=a)return e;return 0}toUpper(e){return e.split(" ").join(" ").toUpperCase()}toUpperArray(e){const t=[];for(let a=0,s=e.length;a<s;a++)t[a]=this.toUpper(e[a]);return t}getEraYear(e,t,a,s){let i=e.getFullYear();return!s&&t.eras&&(i-=t.eras[a].offset),i}getDayIndex(e,t,a){const s=this,i=e.days;let n,r=e._upperDays;return r||(e._upperDays=r=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr),s.toUpperArray(i.namesShort)]),t=t.toUpperCase(),a?(n=s.arrayIndexOf(r[1],t),-1===n&&(n=s.arrayIndexOf(r[2],t))):n=s.arrayIndexOf(r[0],t),n}getMonthIndex(e,t,a){const s=this;let i=e.months,n=e.monthsGenitive||e.months,r=e._upperMonths,o=e._upperMonthsGen;r||(e._upperMonths=r=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr)],e._upperMonthsGen=o=[s.toUpperArray(n.names),s.toUpperArray(n.namesAbbr)]),t=s.toUpper(t);let d=s.arrayIndexOf(a?r[1]:r[0],t);return d<0&&(d=s.arrayIndexOf(a?o[1]:o[0],t)),d}appendPreOrPostMatch(e,t){let a=0,s=!1;for(let i=0,n=e.length;i<n;i++){const n=e.charAt(i);switch(n){case"'":s?t.push("'"):a++,s=!1;break;case"\\":s&&t.push("\\"),s=!s;break;default:t.push(n),s=!1}}return a}getTokenRegExp(){return/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyyy|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|uu|u|nn|n|pp|p|ee|e|aa|a|xx|x|oo|o|i{1,24}|zzz|zz|z|gg|g/g}tryparseDate(e,t,a){const s=this;if(null==t&&(t=s.calendar),void 0!==a){if(Array.isArray(a))for(let i=0;i<a.length;i++){const n=s.parseDate(e,a[i],t);if(n)return n}const i=s.parseDate(e,a,t);if(i)return i}if(""===e)return null;if(null==e||e.substring||(e=e.toString()),null!=e&&"/Date("===e.substring(0,6)){const t=/^\/Date\((-?\d+)(\+|-)?(\d+)?\)\/$/;let a=new Date(+e.replace(/\/Date\((\d+)\)\//,"$1"));if("Invalid Date"===a){const t=e.match(/^\/Date\((\d+)([-+]\d\d)(\d\d)\)\/$/);a=null,t&&(a=new Date(1*t[1]+36e5*t[2]+6e4*t[3]))}if(null==a||"Invalid Date"===a||isNaN(a)){const a=t.exec(e);if(a){const e=new Date(parseInt(a[1]));if(a[2]){let t=parseInt(a[3]);"-"===a[2]&&(t=-t);const s=e.getUTCMinutes();e.setUTCMinutes(s-t)}if(!isNaN(e.valueOf()))return e}}return a}const i={smartdate:"yyyy-MM-dd HH:mm:ss",d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",d3:"MM-dd-yyyy",d4:"MM.dd.yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",iso:"yyyy-MM-ddTHH:mm:ssZ",iso_date1:"yyyy-MM-dd",iso_date2:"yyyy-MM-dd",iso_date3:"yyyy-ddd",iso_date4:"yyyy-MM-dd HH:mm",iso_date5:"yyyy-MM-dd HH:mm Z",iso_date6:"yyyy-MMM-dd",iso_date7:"yyyy-MM",iso_date8:"yyyy-MMM",iso_date9:"yyyy-MMMM",iso_date10:"yyyy-MMMM-dd",iso_time1:"HH:mm:ss.tttt",iso_time2:"HH:mm:ss",iso_time3:"HH:mm",iso_time4:"HH",iso_time5:"yyyyyy-MM-dd",iso_time6:"yyyyyy-MM-dd"};for(let a in i){const n=s.parseDate(e,i[a],t);if(n)return n}const n=t.patterns;for(let a in n){const i=s.parseDate(e,n[a],t);if(i){if("ISO"===a){const a=s.parseDate(e,n.ISO2,t);if(a)return a}return i}}let r;if("string"==typeof e){const a=[":","/","-"," ",","];let i="",n=e=function(e,t,a){return a.replace(new RegExp(e,"g"),t)}(", ",",",e=s.trim(e));e.indexOf(":")>=0?(i=e.substring(e.indexOf(":")-2),i=s.trim(i),n=e.substring(0,e.indexOf(":")-2)):e.toUpperCase().indexOf("AM")>=0?(i=e.substring(e.toUpperCase().indexOf("AM")-2),i=s.trim(i),n=e.substring(0,e.toUpperCase().indexOf("AM")-2)):e.toUpperCase().indexOf("PM")>=0&&(i=e.substring(e.toUpperCase().indexOf("PM")-2),i=s.trim(i),n=e.substring(0,e.toUpperCase().indexOf("PM")-2));let o=new Date,d=!1;if(n){for(let e=0;e<a.length;e++)if(n.indexOf(a[e])>=0){r=n.split(a[e]);break}if(!r)return null;let e=new Array,i=new Array,l=new Array,f=null,m=null;for(let a=0;a<r.length;a++){const i=r[a],n=s.parseDate(i,"d",t)||s.parseDate(i,"dd",t)||s.parseDate(i,"ddd",t)||s.parseDate(i,"dddd",t);if(n&&(e.push(n.getDate()),i.length>2)){f=a;break}}for(let e=0;e<r.length;e++){const a=r[e],n=s.parseDate(a,"M",t)||s.parseDate(a,"MM",t)||s.parseDate(a,"MMM",t)||s.parseDate(a,"MMMM",t);if(n){if(null!=f&&f===e)continue;if(i.push(n.getMonth()),a.length>2){m=e;break}}}for(let e=0;e<r.length;e++){const a=r[e],i=s.parseDate(a,"yyyy",t);if(i){if(null!=f&&f===e)continue;if(null!=m&&m===e)continue;l.push(i.getFullYear())}}const c=new Array;for(let t=e.length-1;t>=0;t--)for(let a=0;a<i.length;a++)for(let s=0;s<l.length;s++){const n=new Date(l[s],i[a],e[t]);l[s]<1970&&n.setFullYear(l[s]),isNaN(n.getTime())||c.push(n)}c.length>0&&(o=c[0],d=!0)}if(i){const e=i.indexOf(":")>=0?i.split(":"):i,a=s.parseDate(i,"h:mm tt",t)||s.parseDate(i,"HH:mm:ss.fff",t)||s.parseDate(i,"HH:mm:ss.ff",t)||s.parseDate(i,"h:mm:ss tt",t)||s.parseDate(i,"HH:mm:ss.tttt",t)||s.parseDate(i,"HH:mm:ss",t)||s.parseDate(i,"HH:mm",t)||s.parseDate(i,"HH",t);let n=0,r=0,l=0,f=0;a&&!isNaN(a.getTime())?(n=a.getHours(),r=a.getMinutes(),l=a.getSeconds(),f=a.getMilliseconds()):(1===e.length&&(n=parseInt(e[0])),2===e.length&&(n=parseInt(e[0]),r=parseInt(e[1])),3===e.length&&(n=parseInt(e[0]),r=parseInt(e[1]),e[2].indexOf(".")>=0?(l=parseInt(e[2].toString().split(".")[0]),f=parseInt(e[2].toString().split(".")[1])):l=parseInt(e[2])),4===e.length&&(n=parseInt(e[0]),r=parseInt(e[1]),l=parseInt(e[2]),f=parseInt(e[3]))),!o||isNaN(n)||isNaN(r)||isNaN(l)||isNaN(f)||(o.setHours(n,r,l,f),d=!0)}if(d)return o}if(null!=e){r=[":","/","-"];let t=!0;for(let a=0;a<r.length;a++)-1!==e.indexOf(r[a])&&(t=!1);if(t){const t=new Number(e);if(!isNaN(t))return new Date(t)}}return null}getParseRegExp(e,t){const a=this;let s=e._parseRegExp;if(s){const e=s[t];if(e)return e}else e._parseRegExp=s={};let i,n=a.expandFormat(e,t).replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1"),r=["^"],o=[],d=0,l=0,f=a.getTokenRegExp();for(;null!==(i=f.exec(n));){const e=n.slice(d,i.index);if(d=f.lastIndex,l+=a.appendPreOrPostMatch(e,r),l%2){r.push(i[0]);continue}let t,s=i[0],m=s.length;switch(s){case"dddd":case"ddd":case"MMMM":case"MMM":case"gg":case"g":t="(\\D+)";break;case"tt":case"t":t="(\\D*)";break;case"yyyyy":t="(\\d{1,4})";break;case"yyyy":t="(\\d{"+m+"})";break;case"fff":case"ff":case"f":t="(\\d{1,"+m+"})";break;case"dd":case"d":case"MM":case"M":case"yy":case"y":case"HH":case"H":case"hh":case"h":case"mm":case"m":case"ss":case"s":t="(\\d\\d?)";break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":t="(\\d{1,3})";break;case"zzz":t="([+-]?\\d\\d?:\\d{2})";break;case"zz":case"z":t="([+-]?\\d\\d?)";break;case"/":t="/";break;default:if(!/i{1,24}/.test(s))throw"Invalid date format pattern '"+s+"'.";t="(\\d{"+s.length+"})"}t&&r.push(t),"/"!==s&&o.push(i[0])}a.appendPreOrPostMatch(n.slice(d),r),r.push("$");const m={regExp:r.join("").replace(/\s+/g,"\\s+"),groups:o};return s[t]=m}outOfRange(e,t,a){return e<t||e>a}expandYear(e,t){const a=this,s=new Date,i=a.getEra(s);if(t<100){let n=e.twoDigitYearMax;n="string"==typeof n?(new Date).getFullYear()%100+parseInt(n,10):n;const r=a.getEraYear(s,e,i);(t+=r-r%100)>n&&(t-=100)}return t}padZeros(e,t){let a,s=e+"";return t>1&&s.length<t?(a=["0","00","000"][t-2]+s,a.substr(a.length-t,t)):(a=s,a)}parseDate(e,t,a){const s=this;null==a&&(a=s.calendar),e=s.trim(e);const i=a,n=s.getParseRegExp(i,t),r=new RegExp(n.regExp).exec(e);if(null===r)return null;let o,d=n.groups,l=null,f=null,m=null,c=null,u=null,p=0,y=0,g=0,h=0,T=null,S=!1;for(let e=0,t=d.length;e<t;e++){const t=r[e+1];if(t){const a=d[e],n=a.length,r=parseInt(t,10);switch(a){case"dd":case"d":if(c=r,s.outOfRange(c,1,31))return null;break;case"MMM":case"MMMM":case"MMMMM":case"MMMMMM":case"MMMMMMM":case"MMMMMMMM":if(m=s.getMonthIndex(i,t,3===n),s.outOfRange(m,0,11))return null;break;case"M":case"MM":if(m=r-1,s.outOfRange(m,0,11))return null;break;case"y":case"yy":case"yyyy":if(f=n<4?s.expandYear(i,r):r,s.outOfRange(f,0,9999))return null;break;case"h":case"hh":if(p=r,12===p&&(p=0),s.outOfRange(p,0,11))return null;break;case"H":case"HH":if(p=r,s.outOfRange(p,0,23))return null;break;case"m":case"mm":if(y=r,s.outOfRange(y,0,59))return null;break;case"s":case"ss":if(g=r,s.outOfRange(g,0,59))return null;break;case"tt":case"t":if(S=i.PM&&(t===i.PM[0]||t===i.PM[1]||t===i.PM[2]),!S&&(!i.AM||t!==i.AM[0]&&t!==i.AM[1]&&t!==i.AM[2]))return null;break;case"f":case"ff":case"fff":if(h=r*Math.pow(10,3-n),s.outOfRange(h,0,999))return null;break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":if(s.outOfRange(r,0,1e3))return null;s[s._codeToUnit[a]]=r;break;case"ddd":case"dddd":if(u=s.getDayIndex(i,t,3===n),s.outOfRange(u,0,6))return null;break;case"zzz":{const e=t.split(/:/);if(2!==e.length)return null;if(o=parseInt(e[0],10),s.outOfRange(o,-12,13))return null;const a=parseInt(e[1],10);if(s.outOfRange(a,0,59))return null;T=60*o+(s.startsWith(t,"-")?-a:a);break}case"z":case"zz":if(o=r,s.outOfRange(o,-12,13))return null;T=60*o;break;case"g":case"gg":{let e=t;if(!e||!i.eras)return null;e=this.trim(e.toLowerCase());for(let t=0,a=i.eras.length;t<a;t++)if(e===i.eras[t].nathat.toLowerCase()){l=t;break}if(null===l)return null;break}default:{let e=t;e.length%3==1?e+="00":e.length%3==2&&(e+="0"),h=parseInt(e.slice(0,3),10),e=e.slice(3);let a=0;for(;e.length>0;)s[s._smallUnits[a]]=parseInt(e.slice(0,3),10),e=e.slice(3),a++}}}}let M,D=new Date,H=i.convert;if(M=D.getFullYear(),null===f?f=M:i.eras&&(f+=i.eras[l||0].offset),null===m&&(m=0),null===c&&(c=1),H){if(D=H.toGregorian(f,m,c),null===D)return null}else{if(D.setFullYear(f,m,c),D.getDate()!==c)return null;if(null!==u&&D.getDay()!==u)return null}if(S&&p<12&&(p+=12),D.setHours(p,y,g,h),null!==T){const e=D.getMinutes()-(T+D.getTimezoneOffset());D.setHours(D.getHours()+parseInt(e/60,10),e%60)}return D}toString(e,t){const a=this;void 0===e&&(e="yyyy-MM-dd HH:mm:ss");const s=a.dateData.toString()+a.getFractionsOfSecondStamp()+e+(a.timeZone||"");if(Smart.Utilities.DateTime.cache&&Smart.Utilities.DateTime.cache[s])return Smart.Utilities.DateTime.cache[s];const i=a.toDate();if(null==t&&(t=a.calendar),"string"==typeof i)return i;if(!e||!e.length||"i"===e){let e;return e=a.formatDate(i,t.patterns.F,t),e}const n=t.eras,r="s"===e;e=a.expandFormat(t,e);const o=[];let d,l=0,f=a.getTokenRegExp();function m(e,t){if(void 0!==e.getMonth)switch(t){case 0:return e.getFullYear();case 1:return e.getMonth();case 2:return e.getDate()}}for(;;){const s=f.lastIndex,c=f.exec(e),u=e.slice(s,c?c.index:e.length);if(l+=a.appendPreOrPostMatch(u,o),!c)break;if(l%2){o.push(c[0]);continue}const p=c[0],y=p.length;let g;if(/i{1,24}/.test(p))o.push(a.getFirstNDigitsOfPrecision(p.length));else switch(p){case"ddd":case"dddd":{const e=3===y?t.days.namesAbbr:t.days.names;o.push(e[i.getDay()]);break}case"d":case"dd":o.push(a.padZeros(m(i,2),y));break;case"MMM":case"MMMM":g=m(i,1),o.push(t.months[3===y?"namesAbbr":"names"][g]);break;case"M":case"MM":o.push(a.padZeros(m(i,1)+1,y));break;case"y":case"yy":case"yyyy":g=a.getEraYear(i,t,a.getEra(i,n),r),y<4&&(g%=100),o.push(a.padZeros(g,y));break;case"h":case"hh":d=i.getHours()%12,0===d&&(d=12),o.push(a.padZeros(d,y));break;case"H":case"HH":o.push(a.padZeros(i.getHours(),y));break;case"m":case"mm":o.push(a.padZeros(i.getMinutes(),y));break;case"s":case"ss":o.push(a.padZeros(i.getSeconds(),y));break;case"t":case"tt":g=i.getHours()<12?t.AM?t.AM[0]:" ":t.PM?t.PM[0]:" ",o.push(1===y?g.charAt(0):g);break;case"f":case"ff":case"fff":o.push(a.padZeros(i.getMilliseconds(),3).substr(0,y));break;case"u":case"n":case"p":case"e":case"a":case"x":case"o":o.push(a[a._codeToUnit[p]]);break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":o.push(a.padZeros(a[a._codeToUnit[p]],3));break;case"z":case"zz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),y));break;case"zzz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),2)+":"+a.padZeros(60*Math.abs(a.timeZoneOffsetHours%1),2));break;case"g":case"gg":t.eras&&o.push(t.eras[a.getEra(i,n)].name);break;case"/":o.push(t["/"]);break;default:throw"Invalid date format pattern '"+p+"'."}}let c=o.join("");return Smart.Utilities.DateTime.cache||(Smart.Utilities.DateTime.cache=new Array),a._today||(a._today=new Date),a.calendar&&a.calendar.today&&-1===e.indexOf(":")&&i.getFullYear()===a._today.getFullYear()&&i.getDate()===a._today.getDate()&&i.getMonth()===a._today.getMonth()&&(c=a.calendar.today),Smart.Utilities.DateTime.cache[s]=c,c}getFractionsOfSecondStamp(){const e=this;return e._microsecond.toString()+e._nanosecond+e._picosecond+e._femtosecond+e._attosecond+e._zeptosecond+e._yoctosecond}getFirstNDigitsOfPrecision(e,t){const a=this;return(""+(!0!==t?a.padZeros(a.millisecond(),3):"")+a.padZeros(a._microsecond,3)+a.padZeros(a._nanosecond,3)+a.padZeros(a._picosecond,3)+a.padZeros(a._femtosecond,3)+a.padZeros(a._attosecond,3)+a.padZeros(a._zeptosecond,3)+a.padZeros(a._yoctosecond,3)).slice(0,e)}copySmallTimePartValues(e){const t=this;e._microsecond=t._microsecond,e._nanosecond=t._nanosecond,e._picosecond=t._picosecond,e._femtosecond=t._femtosecond,e._attosecond=t._attosecond,e._zeptosecond=t._zeptosecond,e._yoctosecond=t._yoctosecond}add(e,t,a){const s=this,i=s.internalMS();if(void 0===t){if(!1===a)return s.dateData=i+parseInt(e._ticks/s.ticksPerMillisecond),s;const t=new Smart.Utilities.DateTime(i+parseInt(e._ticks/s.ticksPerMillisecond));return s.copyTimeZone(t),s.copySmallTimePartValues(t),t}const n=e*t;if(n<=-s.maxMillis||n>=s.maxMillis)throw new Error("Out of Range");if(!1===a)return s.dateData=i+n,s;const r=new Smart.Utilities.DateTime(i+n);return s.copyTimeZone(r),s.copySmallTimePartValues(r),r}addDays(e,t){return this.add(e,this.millisPerDay,t)}clone(){const e=this,t=new Smart.Utilities.DateTime(e.dateData);return e.copyTimeZone(t),e.copySmallTimePartValues(t),t}clearTime(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s,0,0,0,0);return e.copyTimeZone(i),i}addHours(e,t){return this.add(e,this.millisPerHour,t)}addDeciseconds(e,t){return this.add(100*e,1,t)}addCentiseconds(e,t){return this.add(10*e,1,t)}addMilliseconds(e,t){return this.add(e,1,t)}addMinutes(e,t){return this.add(e,this.millisPerMinute,t)}addMonths(e,t){const a=this;if(e<-12e4||e>12e4)throw new Error("Invalid Months Value");let s=parseInt(a.getDatePart(a.datePartYear)),i=parseInt(a.getDatePart(a.datePartMonth)),n=parseInt(a.getDatePart(a.datePartDay));if(e%12==0)s+=e/12;else{const t=i-1+e;t>=0?(i=t%12+1,s+=t/12):(i=12+(t+1)%12,s+=(t-11)/12),s=parseInt(s)}if(s<1||s>9999)throw new Error("Year out of range");const r=a.daysInMonth(s,i);if(n>r&&(n=r),!1===t)return a.dateData=a.dateToMS(s,i,n)+a.internalMS()%a.millisPerDay,a;const o=new Smart.Utilities.DateTime(a.dateToMS(s,i,n)+a.internalMS()%a.millisPerDay);return a.copyTimeZone(o),a.copySmallTimePartValues(o),o}addSeconds(e,t){return this.add(e,this.millisPerSecond,t)}addYears(e,t){return this.addMonths(12*e,t)}addMicroseconds(e,t){if(0===e)return;const a=this;let s,i;e<0&&0===a.hour()&&0===a.minute()&&0===a.second()&&0===a.millisecond()&&0===a._microsecond&&(s=parseInt(e/1e3,10)-1,i=1e3+e%1e3);const n=1e3*a.timeToMS(a.hour(),a.minute(),a.second(),a.millisecond())+a._microsecond,r=n+e;let o;if(void 0===s&&(s=parseInt(r/1e3,10)-parseInt(n/1e3,10)),void 0===i&&(i=parseInt(r%1e3,10)),0!==s&&(o=a.addMilliseconds(s,t)),!1!==t)return o||(o=a.clone()),o._microsecond=i,o;a._microsecond=i}addFractionsOfSecond(e,t,a,s,i){if(0===e)return;const n=this,r=1e3*n[s]+n[a],o=e+r;let d,l=parseInt(o/1e3,10)-parseInt(r/1e3,10),f=parseInt(o%1e3,10);if(e<0&&o<0&&f<0&&(l--,f=1e3+f),0!==l&&(d=n[i](l,t)),!1!==t)return d||(d=n.clone()),d[a]=f,d;n[a]=f}addNanoseconds(e,t){return this.addFractionsOfSecond(e,t,"_nanosecond","_microsecond","addMicroseconds")}addPicoseconds(e,t){return this.addFractionsOfSecond(e,t,"_picosecond","_nanosecond","addNanoseconds")}addFemtoseconds(e,t){return this.addFractionsOfSecond(e,t,"_femtosecond","_picosecond","addPicoseconds")}addAttoseconds(e,t){return this.addFractionsOfSecond(e,t,"_attosecond","_femtosecond","addFemtoseconds")}addZeptoseconds(e,t){return this.addFractionsOfSecond(e,t,"_zeptosecond","_attosecond","addAttoseconds")}addYoctoseconds(e,t){return this.addFractionsOfSecond(e,t,"_yoctosecond","_zeptosecond","addZeptoseconds")}getTimeZoneOffset(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1),s=e.getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset());return{offset:-e.getTimezoneOffset()/60,dst:+s}}isInDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return this.date().getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset())}supportsDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return t.getTimezoneOffset()!==a.getTimezoneOffset()}date(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s);return e.copyTimeZone(i),i}isWeekend(){return 0===this.dayOfWeek()||6===this.dayOfWeek()}toDate(e){const t=this,a=t.month(),s=t.year(),i=t.day(),n=t.hour(),r=t.minute(),o=t.second(),d=t.millisecond();let l=new Date(s,a-1,i);if(s<1970&&l.setFullYear(s),l.setHours(n,r,o,d),e){const a=t.timeZones.filter((function(t){return t.id===e}));if(a.length){let e=a[0].offset;const s=l.getTime();let i=60*l.getTimezoneOffset()*1e3;if(t.timeZone){const e=t.timeZones.filter((function(e){return e.id===t.timeZone}));e.length&&(i=60*-e[0].offset*1e3)}l=new Date(s+i+6e4*e)}}return l}toTimeZone(e){const t=this;let a=e;if(null==a&&(a="Local"),t.timeZone===a)return t.clone();const s=t.timeZones.filter((function(e){return e.id===a}));if(0===s.length)return t.clone();const i=this.toDate(a),n=new Smart.Utilities.DateTime(i);return n.timeZone=a,n.timeZoneOffset=s[0].offset,n.timeZoneOffsetHours=s[0].offsetHours,t.copySmallTimePartValues(n),n}day(){return this.getDatePart(this.datePartDay)}month(){return this.getDatePart(this.datePartMonth)}year(){return this.getDatePart(this.datePartYear)}millisecond(){return parseInt(this.internalMS()%1e3)}hour(){return parseInt(Math.floor(this.internalMS()/this.millisPerHour)%24)}minute(){return parseInt(this.internalMS()/this.millisPerMinute%60)}second(){return parseInt(this.internalMS()/this.millisPerSecond%60)}microsecond(){return this._microsecond}nanosecond(){return this._nanosecond}picosecond(){return this._picosecond}femtosecond(){return this._femtosecond}attosecond(){return this._attosecond}zeptosecond(){return this._zeptosecond}yoctosecond(){return this._yoctosecond}valueOf(){return this.dateData}equals(e){const t=this;return t.dateData===e.dateData&&t._microsecond===e._microsecond&&t._nanosecond===e._nanosecond&&t._picosecond===e._picosecond&&t._femtosecond===e._femtosecond&&t._attosecond===e._attosecond&&t._zeptosecond===e._zeptosecond&&t._yoctosecond===e._yoctosecond}equalDateParts(e){const t=this;return t.year()===e.year()&&t.month()===e.month()&&t.day()===e.day()}compare(e){const t=this;if(t.equals(e))return 0;const a=["dateData","_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"];for(let s=0;s<a.length;s++){const i=a[s];if(t[i]>e[i])return 1;if(t[i]<e[i])return-1}return 0}toDateString(){return this.toDate().toDateString()}toLocaleDateString(){return this.toDate().toLocaleDateString(this.calendar.locale)}toLocaleString(){return this.toDate().toLocaleString(this.calendar.locale)}toLocaleTimeString(){return this.toDate().toLocaleTimeString(this.calendar.locale)}validateTimeZone(e){const t=this;if("string"!=typeof e)return;const a=t.timeZones.filter((function(t){return t.id===e}));0!==a.length&&(t.timeZone=e,t.timeZoneOffset=a[0].offset,t.timeZoneOffsetHours=a[0].offsetHours)}copyTimeZone(e){const t=this;e.timeZone=t.timeZone,e.timeZoneOffset=t.timeZoneOffset,e.timeZoneOffsetHours=t.timeZoneOffsetHours}getTimeStamp(){return new Smart.Utilities.BigNumber(this.dateData.toString()+this.getFirstNDigitsOfPrecision(void 0,!0))}})})();
782
+ (()=>{const e=-1*(new Date).getTimezoneOffset(),t=[{id:"Local",offset:e,offsetHours:e/60,displayName:"",supportsDaylightSavingTime:!1},{id:"Dateline Standard Time",offset:-720,offsetHours:-12,displayName:"(UTC-12:00) International Date Line West",supportsDaylightSavingTime:!1},{id:"UTC-11",offset:-660,offsetHours:-11,displayName:"(UTC-11:00) Coordinated Universal Time-11",supportsDaylightSavingTime:!1},{id:"Hawaiteratoran Standard Time",offset:-600,offsetHours:-10,displayName:"(UTC-10:00) Hawaiterator",supportsDaylightSavingTime:!1},{id:"Alaskan Standard Time",offset:-540,offsetHours:-9,displayName:"(UTC-09:00) Alaska",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time (Mexico)",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Baja California",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Pacific Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Arizona",supportsDaylightSavingTime:!1},{id:"Mountain Standard Time (Mexico)",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",supportsDaylightSavingTime:!0},{id:"Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Mountain Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central America Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central America",supportsDaylightSavingTime:!1},{id:"Canada Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Saskatchewan",supportsDaylightSavingTime:!1},{id:"Central Standard Time (Mexico)",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",supportsDaylightSavingTime:!0},{id:"SA Pacific Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Bogota, Lima, Quito, Rio Branco",supportsDaylightSavingTime:!1},{id:"Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Eastern Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Indiana (East)",supportsDaylightSavingTime:!0},{id:"Venezuela Standard Time",offset:-270,offsetHours:-4.5,displayName:"(UTC-04:30) Caracas",supportsDaylightSavingTime:!1},{id:"Atlantic Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Atlantic Time (Canada)",supportsDaylightSavingTime:!0},{id:"Paraguay Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Asuncion",supportsDaylightSavingTime:!0},{id:"Central Brazilian Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Cuiaba",supportsDaylightSavingTime:!0},{id:"Pacific SA Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Santiago",supportsDaylightSavingTime:!0},{id:"SA Western Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",supportsDaylightSavingTime:!1},{id:"Newfoundland Standard Time",offset:-210,offsetHours:-3.5,displayName:"(UTC-03:30) Newfoundland",supportsDaylightSavingTime:!0},{id:"SA Eastern Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Cayenne, Fortaleza",supportsDaylightSavingTime:!1},{id:"Argentina Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Buenos Aires",supportsDaylightSavingTime:!0},{id:"E. South America Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Brasilia",supportsDaylightSavingTime:!0},{id:"Bahia Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Salvador",supportsDaylightSavingTime:!0},{id:"Montevideo Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Montevideo",supportsDaylightSavingTime:!0},{id:"Greenland Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Greenland",supportsDaylightSavingTime:!0},{id:"UTC-02",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Coordinated Universal Time-02",supportsDaylightSavingTime:!1},{id:"Mid-Atlantic Standard Time",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Mid-Atlantic - Old",supportsDaylightSavingTime:!0},{id:"Azores Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Azores",supportsDaylightSavingTime:!0},{id:"Cape Verde Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Cape Verde Is.",supportsDaylightSavingTime:!1},{id:"Morocco Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Casablanca",supportsDaylightSavingTime:!0},{id:"UTC",offset:0,offsetHours:0,displayName:"(UTC) Coordinated Universal Time",supportsDaylightSavingTime:!1},{id:"GMT Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Dublin, Edinburgh, Lisbon, London",supportsDaylightSavingTime:!0},{id:"Greenwich Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Monrovia, Reykjavik",supportsDaylightSavingTime:!1},{id:"Central European Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",supportsDaylightSavingTime:!0},{id:"Namibia Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Windhoek",supportsDaylightSavingTime:!0},{id:"W. Central Africa Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) West Central Africa",supportsDaylightSavingTime:!1},{id:"W. Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",supportsDaylightSavingTime:!0},{id:"Central Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",supportsDaylightSavingTime:!0},{id:"Romance Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",supportsDaylightSavingTime:!0},{id:"FLE Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",supportsDaylightSavingTime:!0},{id:"South Africa Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Harare, Pretoria",supportsDaylightSavingTime:!1},{id:"Turkey Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Istanbul",supportsDaylightSavingTime:!0},{id:"GTB Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Athens, Bucharest",supportsDaylightSavingTime:!0},{id:"Libya Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Tripoli",supportsDaylightSavingTime:!0},{id:"E. Europe Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) E. Europe",supportsDaylightSavingTime:!0},{id:"Jordan Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Amman",supportsDaylightSavingTime:!0},{id:"Middle East Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Beirut",supportsDaylightSavingTime:!0},{id:"Egypt Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Cairo",supportsDaylightSavingTime:!0},{id:"Syria Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Damascus",supportsDaylightSavingTime:!0},{id:"Israel Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Jerusalem",supportsDaylightSavingTime:!0},{id:"Arab Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kuwait, Riyadh",supportsDaylightSavingTime:!1},{id:"E. Africa Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Nairobi",supportsDaylightSavingTime:!1},{id:"Arabic Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Baghdad",supportsDaylightSavingTime:!0},{id:"Kaliningrad Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kaliningrad, Minsk",supportsDaylightSavingTime:!0},{id:"Iran Standard Time",offset:210,offsetHours:3.5,displayName:"(UTC+03:30) Tehran",supportsDaylightSavingTime:!0},{id:"Mauritius Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Port Louis",supportsDaylightSavingTime:!0},{id:"Georgian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Tbilisi",supportsDaylightSavingTime:!1},{id:"Caucasus Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Yerevan",supportsDaylightSavingTime:!0},{id:"Arabian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Abu Dhabi, Muscat",supportsDaylightSavingTime:!1},{id:"Azerbaijan Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Baku",supportsDaylightSavingTime:!0},{id:"Russian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Moscow, St. Petersburg, Volgograd",supportsDaylightSavingTime:!0},{id:"Afghanistan Standard Time",offset:270,offsetHours:4.5,displayName:"(UTC+04:30) Kabul",supportsDaylightSavingTime:!1},{id:"Pakistan Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Islamabad, Karachi",supportsDaylightSavingTime:!0},{id:"West Asia Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Ashgabat, Tashkent",supportsDaylightSavingTime:!1},{id:"India Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",supportsDaylightSavingTime:!1},{id:"Sri Lanka Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Sri Jayawardenepura",supportsDaylightSavingTime:!1},{id:"Nepal Standard Time",offset:345,offsetHours:5.75,displayName:"(UTC+05:45) Kathmandu",supportsDaylightSavingTime:!1},{id:"Central Asia Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Astana",supportsDaylightSavingTime:!1},{id:"Bangladesh Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Dhaka",supportsDaylightSavingTime:!0},{id:"Ekaterinburg Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Ekaterinburg",supportsDaylightSavingTime:!0},{id:"Myanmar Standard Time",offset:390,offsetHours:6.5,displayName:"(UTC+06:30) Yangon (Rangoon)",supportsDaylightSavingTime:!1},{id:"SE Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Bangkok, Hanoi, Jakarta",supportsDaylightSavingTime:!1},{id:"N. Central Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Novosibirsk",supportsDaylightSavingTime:!0},{id:"Ulaanbaatar Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Ulaanbaatar",supportsDaylightSavingTime:!1},{id:"China Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",supportsDaylightSavingTime:!1},{id:"Singapore Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Kuala Lumpur, Singapore",supportsDaylightSavingTime:!1},{id:"North Asia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Krasnoyarsk",supportsDaylightSavingTime:!0},{id:"Taipei Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Taipei",supportsDaylightSavingTime:!1},{id:"W. Australia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Perth",supportsDaylightSavingTime:!0},{id:"Korea Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Seoul",supportsDaylightSavingTime:!1},{id:"North Asia East Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Irkutsk",supportsDaylightSavingTime:!0},{id:"Tokyo Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Osaka, Sapporo, Tokyo",supportsDaylightSavingTime:!1},{id:"AUS Central Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Darwin",supportsDaylightSavingTime:!1},{id:"Cen. Australia Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Adelaide",supportsDaylightSavingTime:!0},{id:"West Pacific Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Guam, Port Moresby",supportsDaylightSavingTime:!1},{id:"Tasmania Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Hobart",supportsDaylightSavingTime:!0},{id:"E. Australia Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Brisbane",supportsDaylightSavingTime:!1},{id:"AUS Eastern Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Canberra, Melbourne, Sydney",supportsDaylightSavingTime:!0},{id:"Yakutsk Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Yakutsk",supportsDaylightSavingTime:!0},{id:"Vladivostok Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Vladivostok",supportsDaylightSavingTime:!0},{id:"Central Pacific Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Solomon Is., New Caledonia",supportsDaylightSavingTime:!1},{id:"Magadan Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Magadan",supportsDaylightSavingTime:!0},{id:"Kamchatka Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",supportsDaylightSavingTime:!0},{id:"Fiji Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Fiji",supportsDaylightSavingTime:!0},{id:"New Zealand Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Auckland, Wellington",supportsDaylightSavingTime:!0},{id:"UTC+12",offset:720,offsetHours:12,displayName:"(UTC+12:00) Coordinated Universal Time+12",supportsDaylightSavingTime:!1},{id:"Tonga Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Nuku'alofa",supportsDaylightSavingTime:!1},{id:"Samoa Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Samoa",supportsDaylightSavingTime:!0}],a=[0,31,59,90,120,151,181,212,243,273,304,334,365],s=[0,31,60,91,121,152,182,213,244,274,305,335,366];Smart.Utilities.Assign("TimeSpan",class{constructor(){const e=this;if(e.ticksPerMillisecond=1e4,e.millisecondsPerTick=1e-4,e.ticksPerSecond=1e7,e.secondsPerTick=1e-7,e.ticksPerMinute=6e8,e.minutesPerTick=1/6e8,e.ticksPerHour=36e9,e.hoursPerTick=1/36e9,e.ticksPerDay=864e9,e.daysPerTick=1/864e9,e.millisPerSecond=1e3,e.millisPerMinute=6e4,e.millisPerHour=36e5,e.millisPerDay=864e5,e._ticks=0,1===arguments.length){if(isNaN(arguments[0]))throw new Error("Argument must be a number.");e._ticks=arguments[0]}else if(3===arguments.length)e._ticks=e.timeToMS(arguments[0],arguments[1],arguments[2],0);else if(4===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+0;e._ticks=t*e.ticksPerMillisecond}else if(5===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+arguments[4];e._ticks=t*e.ticksPerMillisecond}}ticks(){return this._ticks}days(){return parseInt(this._ticks/this.ticksPerDay)}timeToMS(e,t,a,s){return parseInt((3600*e+60*t+a+s/1e3)*this.ticksPerSecond)}hours(){return parseInt(this._ticks/this.ticksPerHour)%24}milliseconds(){return parseInt(this._ticks/this.ticksPerMillisecond)%1e3}minutes(){return parseInt(this._ticks/this.ticksPerMinute)%60}seconds(){return parseInt(this._ticks/this.ticksPerSecond)%60}totalDays(){return parseInt(this._ticks*this.daysPerTick)}totalHours(){return parseInt(this._ticks*this.hoursPerTick)}totalMilliseconds(){const e=this._ticks*this.millisecondsPerTick;return parseInt(e)}totalMinutes(){return parseInt(this._ticks*this.minutesPerTick)}totalSeconds(){return parseInt(this._ticks*this.secondsPerTick)}add(e){const t=this._ticks+e._ticks;return new Smart.Utilities.TimeSpan(t)}subtract(e){const t=this._ticks-e._ticks;return new Smart.Utilities.TimeSpan(t)}duration(){const e=this;return e._ticks>=0?new Smart.Utilities.TimeSpan(e._ticks):new Smart.Utilities.TimeSpan(-e._ticks)}equals(e){return this._ticks===e._ticks}valueOf(){return this._ticks}compare(e,t){return e._ticks>t._ticks?1:e._ticks<t._ticks?-1:0}interval(e,t){const a=e*t+(e>=0?.5:-.5);return new Smart.Utilities.TimeSpan(a*this.ticksPerMillisecond)}fromDays(e){return this.interval(e,this.millisPerDay)}fromHours(e){return this.interval(e,this.millisPerHour)}fromMilliseconds(e){return this.interval(e,1)}fromMinutes(e){return this.interval(e,this.millisPerMinute)}fromSeconds(e){return this.interval(e,this.millisPerSecond)}fromTicks(e){return new Smart.Utilities.TimeSpan(e)}toString(){return this.totalMilliseconds().toString()}negate(){return new Smart.Utilities.TimeSpan(-this._ticks)}}),Smart.Utilities.Assign("DateTime",class{constructor(){function e(e){const t=i.regexISOString.exec(e);r=new Smart.Utilities.DateTime(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]),parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]),parseFloat(t[7]),0,0,0,0,0,0,0,"UTC")}const i=this;let r;if(i.ticksPerMillisecond=1e4,i.millisecondsPerTick=1e-4,i.ticksPerSecond=1e7,i.secondsPerTick=1e-7,i.ticksPerMinute=6e8,i.minutesPerTick=1/6e8,i.ticksPerHour=36e9,i.hoursPerTick=1/36e9,i.ticksPerDay=864e9,i.daysPerTick=1/864e9,i.millisPerSecond=1e3,i.millisPerMinute=6e4,i.millisPerHour=36e5,i.millisPerDay=864e5,i.daysPerYear=365,i.daysPer4Years=1461,i.daysPer100Years=36524,i.daysPer400Years=146097,i.daysTo1601=584388,i.daysTo1899=693593,i.daysTo10000=3652059,i.minTicks=0,i.maxTicks=3155378976e9,i.maxMillis=3155378976e5,i.datePartYear=0,i.datePartDayOfYear=1,i.datePartMonth=2,i.datePartDay=3,i.daysToMonth365=a,i.daysToMonth366=s,i.minValue=new Date(0),i.maxValue=new Date(3155378976e9),i.ticksMask=0x4000000000000000,i.flagsMask=0xc000000000000000,i.localMask=0x8000000000000000,i.ticksCeiling=0x4000000000000000,i.kindUnspecified=0,i.kindUtc=0x4000000000000000,i.kindLocal=0x8000000000000000,i.kindLocalAmbiguousDst=0xc000000000000000,i.kindShift=62,i.regexTrim=/^\s+|\s+$/g,i.regexInfinity=/^[+-]?infinity$/i,i.regexHex=/^0x[a-f0-9]+$/i,i.regexParseFloat=/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/,i.regexISOString=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})Z$/,i.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}],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",FP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",FPA:"yyyy/MM/dd HH:mm:ss:fffuunnppeeaaxxoo",FPA2:"yyyy-MM-dd HH:mm:ss:fffuunnppeeaaxxoo",FT:"HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",PP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp",PT:"HH:mm:ss:fff:uu:nn:pp"},percentsymbol:"%",currencysymbol:"$",currencysymbolposition:"before",decimalseparator:".",thousandsseparator:","},i.dateData=0,i.timeZone=null,i.timeZones=t,i._codeToUnit={u:"_microsecond",uu:"_microsecond",n:"_nanosecond",nn:"_nanosecond",p:"_picosecond",pp:"_picosecond",e:"_femtosecond",ee:"_femtosecond",a:"_attosecond",aa:"_attosecond",x:"_zeptosecond",xx:"_zeptosecond",o:"_yoctosecond",oo:"_yoctosecond"},i._smallUnits=["_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"],i._microsecond=0,i._nanosecond=0,i._picosecond=0,i._femtosecond=0,i._attosecond=0,i._zeptosecond=0,i._yoctosecond=0,0===arguments.length){const e=new Date;i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else if(1===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}}else if(2===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}i.validateTimeZone(arguments[1])}else if(arguments.length>2)if("string"==typeof arguments[0]){const e=i.tryparseDate(arguments[0],arguments[2],arguments[1]);i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else{const e=arguments[0],t=arguments[7]||0,a=arguments[8]||0,s=arguments[9]||0,r=arguments[10]||0,n=arguments[11]||0,o=arguments[12]||0,d=arguments[13]||0,l=new Date(e,arguments[1]-1,arguments[2],arguments[3]||0,arguments[4]||0,arguments[5]||0,arguments[6]||0);e<1970&&l.setFullYear(e),i.dateData=i.dateToMS(l.getFullYear(),l.getMonth()+1,l.getDate())+i.timeToMS(l.getHours(),l.getMinutes(),l.getSeconds(),l.getMilliseconds()),i._microsecond=t,i._nanosecond=a,i._picosecond=s,i._femtosecond=r,i._attosecond=n,i._zeptosecond=o,i._yoctosecond=d,arguments[14]&&i.validateTimeZone(arguments[14])}if(i.timeZone||i.validateTimeZone("Local"),r){const e=r.toTimeZone(i.timeZone);i.dateData=e.dateData}}static isValidDate(e){const t=this.validateDate(e);return!(!t||t&&!t.dateData)}static validateDate(e,t,a){if(e instanceof Smart.Utilities.DateTime)return e;if(e instanceof Date)return new Smart.Utilities.DateTime(e);try{if("string"==typeof e&&a)return this.parseDateString(e,t,a);if(new RegExp(/^\d{1,2}\/\d{1,2}\/\d{4}(, \d{1,2}:\d{2}:\d{1,2} [A|P]M)?$/).test(e)){const t=new Date(e);if(!isNaN(t.getTime()))return new Smart.Utilities.DateTime(t)}if("string"==typeof e)return this.parseDateString(e,t,a);if("number"==typeof e)return new Smart.Utilities.DateTime(new Date(e))}catch(e){}return t}static parseDateString(e,t,a){const s=new Date(e);if(!isNaN(s.getTime()))return e&&"string"==typeof e&&a?new Smart.Utilities.DateTime(e,a,null):new Smart.Utilities.DateTime(s);const i=e.indexOf("Date("),r=e.indexOf("DateTime("),n=e.lastIndexOf(")");let o=e;if(-1===i&&-1===r||-1===n){const t=new Smart.Utilities.DateTime,s=t.parseDate(e,a);if(s)return o=new Smart.Utilities.DateTime(s),t.copySmallTimePartValues(o),o}else{if(o=-1!==i?e.slice(i+5,n):e.slice(r+9,n),o=o.replace(/'/g,"").replace(/"/g,"").replace(/^\s+|\s+$|\s+(?=\s)/g,""),""===o.trim())return new Smart.Utilities.DateTime;if(new RegExp(/(^(\d+)(\s*,\s*\d+)+(\s*,\s*[a-zA-Z ]+)?$)/g).test(o))return o=o.split(","),o.map((function(e,t){isNaN(o[t])?o[t]=e.trim():o[t]=parseInt(e)})),-1!==i&&o[1]++,o.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,o)),o}if(""===o.trim())return t;if(!isNaN(o))return o=new Date(parseInt(o,10)),new Smart.Utilities.DateTime(o);try{const e=o.split(",");2===e.length?(e[1]=e[1].trim(),e.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,e))):o=new Smart.Utilities.DateTime(o)}catch(e){o=t}return o}static fromFullTimeStamp(e){e=e.toString();const t=new Smart.Utilities.DateTime(parseFloat(e.slice(0,e.length-21)));let a=e.slice(e.length-21),s=0;for(;a.length>0;)t[t._smallUnits[s]]=parseInt(a.slice(0,3),10),a=a.slice(3),s++;return t}static getConstructorParameters(e){return[e.year(),e.month(),e.day(),e.hour(),e.minute(),e.second(),e.millisecond(),e._microsecond,e._nanosecond,e._picosecond,e._femtosecond,e._attosecond,e._zeptosecond,e._yoctosecond,e.timeZone]}static detectDisplayMode(e,t,a){if(e.calendar.patterns[t])return-1!==["d","D","M","Y","d1","d2"].indexOf(t)?"calendar":-1!==["t","T","FT","PT"].indexOf(t)?"timePicker":"default";const s=["d","M","y"],i=["h","H","m","s","t","f","u","n","p","e","a","x","o"],r=a.groups;let n=!1,o=!1;for(let e=0;e<r.length;e++){const t=r[e].charAt(0);if(-1!==s.indexOf(t)?n=!0:-1!==i.indexOf(t)&&(o=!0),n&&o)break}return n===o?"default":n?"calendar":"timePicker"}static getLocalizedNames(e){const t={names:[],namesAbbr:[],namesShort:[]},a={names:[],namesAbbr:[]};if(this[e])return this[e];for(let a=23;a<30;a++){const s=new Date(2017,6,a),i=s.toLocaleString(e,{weekday:"long"});t.names.push(i),t.namesAbbr.push(s.toLocaleString(e,{weekday:"short"})),t.namesShort.push(i.substring(0,2))}for(let t=0;t<12;t++){const s=new Date(2017,t,1).toLocaleString(e,{month:"long"});a.names.push(s),a.namesAbbr.push(s.substring(0,3))}return a.names.push(""),a.namesAbbr.push(""),this[e]={days:t,months:a},this[e]}internalMS(){return this.dateData}getDatePart(e){const t=this,a=t.internalMS();let s=parseInt(a/t.millisPerDay);const i=parseInt(s/t.daysPer400Years);s-=i*t.daysPer400Years;let r=parseInt(s/t.daysPer100Years);4===r&&(r=3),s-=r*t.daysPer100Years;const n=parseInt(s/t.daysPer4Years);s-=n*t.daysPer4Years;let o=parseInt(s/t.daysPerYear);if(4===o&&(o=3),e===t.datePartYear)return parseInt(400*i+100*r+4*n+o+1);if(s-=o*t.daysPerYear,e===t.datePartDayOfYear)return parseInt(s+1);const d=3===o&&(24!==n||3===r)?t.daysToMonth366:t.daysToMonth365;let l=s>>6;for(;s>=d[l];)l++;return e===t.datePartMonth?parseInt(l):parseInt(s-d[l-1]+1)}dayOfWeek(){const e=this.dateData;return parseInt(e/this.millisPerDay+1)%7}dayOfYear(){return this.getDatePart(this.datePartDayOfYear)}weekOfYear(e){const t=this.toDate(),a=e||this.calendar.firstDay,s=new Date(t.getFullYear(),0,1),i=Math.floor((t.getTime()-s.getTime()-6e4*(t.getTimezoneOffset()-s.getTimezoneOffset()))/864e5)+1;let r,n=s.getDay()-a;if(n=n>=0?n:n+7,n<4){if(r=Math.floor((i+n-1)/7)+1,r>52){let e=new Date(t.getFullYear()+1,0,1).getDay()-a;e=e>=0?e:e+7,r=e<4?1:53}}else r=Math.floor((i+n-1)/7);return r}subtract(e){const t=this;return new Smart.Utilities.TimeSpan(t.dateData*t.ticksPerMillisecond-e.dateData*t.ticksPerMillisecond)}dateToMS(e,t,a){const s=this;if(e>=1&&e<=9999&&t>=1&&t<=12){e=parseInt(e);const i=s.isLeapYear(e)?s.daysToMonth366:s.daysToMonth365;if(a>=1&&a<=i[t]-i[t-1]){const r=e-1;return(365*r+parseInt(r/4)-parseInt(r/100)+parseInt(r/400)+i[t-1]+a-1)*s.millisPerDay}}}isLeapYear(e){if(e<1||e>9999)throw new Error("Year out of Range");return e%4==0&&(e%100!=0||e%400==0)}timeToMS(e,t,a,s){const i=this;if(e>=0&&e<24&&t>=0&&t<60&&a>=0&&a<60){const r=parseInt(3600*e+60*t+a);return s>0&&s<1e3?r*i.millisPerSecond+s:r*i.millisPerSecond}}daysInMonth(e,t){if(t<1||t>12)throw new Error("Month out of Range");const a=this,s=a.isLeapYear(e)?a.daysToMonth366:a.daysToMonth365;return s[t]-s[t-1]}arrayIndexOf(e,t){return e.indexOf(t)}startsWith(e,t){return 0===e.indexOf(t)}endsWith(e,t){return e.substr(e.length-t.length)===t}trim(e){return(e+"").replace(this.regexTrim,"")}expandFormat(e,t){t=t||"F";let a,s=e.patterns,i=t.length;if(s[t])return s[t];if(1===i){if(a=s[t],!a)throw"Invalid date format string '"+t+"'.";t=a}else 2===i&&"%"===t.charAt(0)&&(t=t.charAt(1));return t}getEra(e,t){if(!t)return 0;if("string"==typeof e)return 0;let a,s=e.getTime();for(let e=0,i=t.length;e<i;e++)if(a=t[e].start,null===a||s>=a)return e;return 0}toUpper(e){return e.split(" ").join(" ").toUpperCase()}toUpperArray(e){const t=[];for(let a=0,s=e.length;a<s;a++)t[a]=this.toUpper(e[a]);return t}getEraYear(e,t,a,s){let i=e.getFullYear();return!s&&t.eras&&(i-=t.eras[a].offset),i}getDayIndex(e,t,a){const s=this,i=e.days;let r,n=e._upperDays;return n||(e._upperDays=n=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr),s.toUpperArray(i.namesShort)]),t=t.toUpperCase(),a?(r=s.arrayIndexOf(n[1],t),-1===r&&(r=s.arrayIndexOf(n[2],t))):r=s.arrayIndexOf(n[0],t),r}getMonthIndex(e,t,a){const s=this;let i=e.months,r=e.monthsGenitive||e.months,n=e._upperMonths,o=e._upperMonthsGen;n||(e._upperMonths=n=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr)],e._upperMonthsGen=o=[s.toUpperArray(r.names),s.toUpperArray(r.namesAbbr)]),t=s.toUpper(t);let d=s.arrayIndexOf(a?n[1]:n[0],t);return d<0&&(d=s.arrayIndexOf(a?o[1]:o[0],t)),d}appendPreOrPostMatch(e,t){let a=0,s=!1;for(let i=0,r=e.length;i<r;i++){const r=e.charAt(i);switch(r){case"'":s?t.push("'"):a++,s=!1;break;case"\\":s&&t.push("\\"),s=!s;break;default:t.push(r),s=!1}}return a}getTokenRegExp(){return/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyyy|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|uu|u|nn|n|pp|p|ee|e|aa|a|xx|x|oo|o|i{1,24}|zzz|zz|z|gg|g/g}static ParseDate(e,t){return(new Smart.Utilities.DateTime).tryparseDate(e,null,t)}tryparseDate(e,t,a){const s=this;if(null==t&&(t=s.calendar),void 0!==a){if(Array.isArray(a))for(let i=0;i<a.length;i++){const r=s.parseDate(e,a[i],t);if(r)return r}const i=s.parseDate(e,a,t);if(i)return i}if(""===e)return null;if(null==e||e.substring||(e=e.toString()),null!=e&&"/Date("===e.substring(0,6)){const t=/^\/Date\((-?\d+)(\+|-)?(\d+)?\)\/$/;let a=new Date(+e.replace(/\/Date\((\d+)\)\//,"$1"));if("Invalid Date"===a){const t=e.match(/^\/Date\((\d+)([-+]\d\d)(\d\d)\)\/$/);a=null,t&&(a=new Date(1*t[1]+36e5*t[2]+6e4*t[3]))}if(null==a||"Invalid Date"===a||isNaN(a)){const a=t.exec(e);if(a){const e=new Date(parseInt(a[1]));if(a[2]){let t=parseInt(a[3]);"-"===a[2]&&(t=-t);const s=e.getUTCMinutes();e.setUTCMinutes(s-t)}if(!isNaN(e.valueOf()))return e}}return a}const i={smartdate:"yyyy-MM-dd HH:mm:ss",d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",d3:"MM-dd-yyyy",d4:"MM.dd.yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",iso:"yyyy-MM-ddTHH:mm:ssZ",iso_date1:"yyyy-MM-dd",iso_date2:"yyyy-MM-dd",iso_date3:"yyyy-ddd",iso_date4:"yyyy-MM-dd HH:mm",iso_date5:"yyyy-MM-dd HH:mm Z",iso_date6:"yyyy-MMM-dd",iso_date7:"yyyy-MM",iso_date8:"yyyy-MMM",iso_date9:"yyyy-MMMM",iso_date10:"yyyy-MMMM-dd",iso_time1:"HH:mm:ss.tttt",iso_time2:"HH:mm:ss",iso_time3:"HH:mm",iso_time4:"HH",iso_time5:"yyyyyy-MM-dd",iso_time6:"yyyyyy-MM-dd"};for(let a in i){const r=s.parseDate(e,i[a],t);if(r)return r}const r=t.patterns;for(let a in r){const i=s.parseDate(e,r[a],t);if(i){if("ISO"===a){const a=s.parseDate(e,r.ISO2,t);if(a)return a}return i}}let n;if("string"==typeof e){const a=[":","/","-"," ",","];let i="",r=e=function(e,t,a){return a.replace(new RegExp(e,"g"),t)}(", ",",",e=s.trim(e));e.indexOf(":")>=0?(i=e.substring(e.indexOf(":")-2),i=s.trim(i),r=e.substring(0,e.indexOf(":")-2)):e.toUpperCase().indexOf("AM")>=0?(i=e.substring(e.toUpperCase().indexOf("AM")-2),i=s.trim(i),r=e.substring(0,e.toUpperCase().indexOf("AM")-2)):e.toUpperCase().indexOf("PM")>=0&&(i=e.substring(e.toUpperCase().indexOf("PM")-2),i=s.trim(i),r=e.substring(0,e.toUpperCase().indexOf("PM")-2));let o=new Date,d=!1;if(r){for(let e=0;e<a.length;e++)if(r.indexOf(a[e])>=0){n=r.split(a[e]);break}if(!n)return null;let e=new Array,i=new Array,l=new Array,f=null,m=null;for(let a=0;a<n.length;a++){const i=n[a],r=s.parseDate(i,"d",t)||s.parseDate(i,"dd",t)||s.parseDate(i,"ddd",t)||s.parseDate(i,"dddd",t);if(r&&(e.push(r.getDate()),i.length>2)){f=a;break}}for(let e=0;e<n.length;e++){const a=n[e],r=s.parseDate(a,"M",t)||s.parseDate(a,"MM",t)||s.parseDate(a,"MMM",t)||s.parseDate(a,"MMMM",t);if(r){if(null!=f&&f===e)continue;if(i.push(r.getMonth()),a.length>2){m=e;break}}}for(let e=0;e<n.length;e++){const a=n[e],i=s.parseDate(a,"yyyy",t);if(i){if(null!=f&&f===e)continue;if(null!=m&&m===e)continue;l.push(i.getFullYear())}}const c=new Array;for(let t=e.length-1;t>=0;t--)for(let a=0;a<i.length;a++)for(let s=0;s<l.length;s++){const r=new Date(l[s],i[a],e[t]);l[s]<1970&&r.setFullYear(l[s]),isNaN(r.getTime())||c.push(r)}c.length>0&&(o=c[0],d=!0)}if(i){const e=i.indexOf(":")>=0?i.split(":"):i,a=s.parseDate(i,"h:mm tt",t)||s.parseDate(i,"HH:mm:ss.fff",t)||s.parseDate(i,"HH:mm:ss.ff",t)||s.parseDate(i,"h:mm:ss tt",t)||s.parseDate(i,"HH:mm:ss.tttt",t)||s.parseDate(i,"HH:mm:ss",t)||s.parseDate(i,"HH:mm",t)||s.parseDate(i,"HH",t);let r=0,n=0,l=0,f=0;a&&!isNaN(a.getTime())?(r=a.getHours(),n=a.getMinutes(),l=a.getSeconds(),f=a.getMilliseconds()):(1===e.length&&(r=parseInt(e[0])),2===e.length&&(r=parseInt(e[0]),n=parseInt(e[1])),3===e.length&&(r=parseInt(e[0]),n=parseInt(e[1]),e[2].indexOf(".")>=0?(l=parseInt(e[2].toString().split(".")[0]),f=parseInt(e[2].toString().split(".")[1])):l=parseInt(e[2])),4===e.length&&(r=parseInt(e[0]),n=parseInt(e[1]),l=parseInt(e[2]),f=parseInt(e[3]))),!o||isNaN(r)||isNaN(n)||isNaN(l)||isNaN(f)||(o.setHours(r,n,l,f),d=!0)}if(d)return o}if(null!=e){n=[":","/","-"];let t=!0;for(let a=0;a<n.length;a++)-1!==e.indexOf(n[a])&&(t=!1);if(t){const t=new Number(e);if(!isNaN(t))return new Date(t)}}return null}getParseRegExp(e,t){const a=this;let s=e._parseRegExp;if(s){const e=s[t];if(e)return e}else e._parseRegExp=s={};let i,r=a.expandFormat(e,t).replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1"),n=["^"],o=[],d=0,l=0,f=a.getTokenRegExp();for(;null!==(i=f.exec(r));){const e=r.slice(d,i.index);if(d=f.lastIndex,l+=a.appendPreOrPostMatch(e,n),l%2){n.push(i[0]);continue}let t,s=i[0],m=s.length;switch(s){case"dddd":case"ddd":case"MMMM":case"MMM":case"gg":case"g":t="(\\D+)";break;case"tt":case"t":t="(\\D*)";break;case"yyyyy":t="(\\d{1,4})";break;case"yyyy":t="(\\d{"+m+"})";break;case"fff":case"ff":case"f":t="(\\d{1,"+m+"})";break;case"dd":case"d":case"MM":case"M":case"yy":case"y":case"HH":case"H":case"hh":case"h":case"mm":case"m":case"ss":case"s":t="(\\d\\d?)";break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":t="(\\d{1,3})";break;case"zzz":t="([+-]?\\d\\d?:\\d{2})";break;case"zz":case"z":t="([+-]?\\d\\d?)";break;case"/":t="/";break;default:if(!/i{1,24}/.test(s))throw"Invalid date format pattern '"+s+"'.";t="(\\d{"+s.length+"})"}t&&n.push(t),"/"!==s&&o.push(i[0])}a.appendPreOrPostMatch(r.slice(d),n),n.push("$");const m={regExp:n.join("").replace(/\s+/g,"\\s+"),groups:o};return s[t]=m}outOfRange(e,t,a){return e<t||e>a}expandYear(e,t){const a=this,s=new Date,i=a.getEra(s);if(t<100){let r=e.twoDigitYearMax;r="string"==typeof r?(new Date).getFullYear()%100+parseInt(r,10):r;const n=a.getEraYear(s,e,i);(t+=n-n%100)>r&&(t-=100)}return t}padZeros(e,t){let a,s=e+"";return t>1&&s.length<t?(a=["0","00","000"][t-2]+s,a.substr(a.length-t,t)):(a=s,a)}parseDate(e,t,a){const s=this;null==a&&(a=s.calendar),e=s.trim(e);const i=a,r=s.getParseRegExp(i,t),n=new RegExp(r.regExp).exec(e);if(null===n)return null;let o,d=r.groups,l=null,f=null,m=null,c=null,u=null,p=0,y=0,g=0,h=0,T=null,S=!1;for(let e=0,t=d.length;e<t;e++){const t=n[e+1];if(t){const a=d[e],r=a.length,n=parseInt(t,10);switch(a){case"dd":case"d":if(c=n,s.outOfRange(c,1,31))return null;break;case"MMM":case"MMMM":case"MMMMM":case"MMMMMM":case"MMMMMMM":case"MMMMMMMM":if(m=s.getMonthIndex(i,t,3===r),s.outOfRange(m,0,11))return null;break;case"M":case"MM":if(m=n-1,s.outOfRange(m,0,11))return null;break;case"y":case"yy":case"yyyy":if(f=r<4?s.expandYear(i,n):n,s.outOfRange(f,0,9999))return null;break;case"h":case"hh":if(p=n,12===p&&(p=0),s.outOfRange(p,0,11))return null;break;case"H":case"HH":if(p=n,s.outOfRange(p,0,23))return null;break;case"m":case"mm":if(y=n,s.outOfRange(y,0,59))return null;break;case"s":case"ss":if(g=n,s.outOfRange(g,0,59))return null;break;case"tt":case"t":if(S=i.PM&&(t===i.PM[0]||t===i.PM[1]||t===i.PM[2]),!S&&(!i.AM||t!==i.AM[0]&&t!==i.AM[1]&&t!==i.AM[2]))return null;break;case"f":case"ff":case"fff":if(h=n*Math.pow(10,3-r),s.outOfRange(h,0,999))return null;break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":if(s.outOfRange(n,0,1e3))return null;s[s._codeToUnit[a]]=n;break;case"ddd":case"dddd":if(u=s.getDayIndex(i,t,3===r),s.outOfRange(u,0,6))return null;break;case"zzz":{const e=t.split(/:/);if(2!==e.length)return null;if(o=parseInt(e[0],10),s.outOfRange(o,-12,13))return null;const a=parseInt(e[1],10);if(s.outOfRange(a,0,59))return null;T=60*o+(s.startsWith(t,"-")?-a:a);break}case"z":case"zz":if(o=n,s.outOfRange(o,-12,13))return null;T=60*o;break;case"g":case"gg":{let e=t;if(!e||!i.eras)return null;e=this.trim(e.toLowerCase());for(let t=0,a=i.eras.length;t<a;t++)if(e===i.eras[t].nathat.toLowerCase()){l=t;break}if(null===l)return null;break}default:{let e=t;e.length%3==1?e+="00":e.length%3==2&&(e+="0"),h=parseInt(e.slice(0,3),10),e=e.slice(3);let a=0;for(;e.length>0;)s[s._smallUnits[a]]=parseInt(e.slice(0,3),10),e=e.slice(3),a++}}}}let M,D=new Date,H=i.convert;if(M=D.getFullYear(),null===f?f=M:i.eras&&(f+=i.eras[l||0].offset),null===m&&(m=0),null===c&&(c=1),H){if(D=H.toGregorian(f,m,c),null===D)return null}else{if(D.setFullYear(f,m,c),D.getDate()!==c)return null;if(null!==u&&D.getDay()!==u)return null}if(S&&p<12&&(p+=12),D.setHours(p,y,g,h),null!==T){const e=D.getMinutes()-(T+D.getTimezoneOffset());D.setHours(D.getHours()+parseInt(e/60,10),e%60)}return D}toString(e,t){const a=this;void 0===e&&(e="yyyy-MM-dd HH:mm:ss");const s=a.dateData.toString()+a.getFractionsOfSecondStamp()+e+(a.timeZone||"");if(Smart.Utilities.DateTime.cache&&Smart.Utilities.DateTime.cache[s])return Smart.Utilities.DateTime.cache[s];const i=a.toDate();if(null==t&&(t=a.calendar),"string"==typeof i)return i;if(!e||!e.length||"i"===e){let e;return e=a.formatDate(i,t.patterns.F,t),e}const r=t.eras,n="s"===e;e=a.expandFormat(t,e);const o=[];let d,l=0,f=a.getTokenRegExp();function m(e,t){if(void 0!==e.getMonth)switch(t){case 0:return e.getFullYear();case 1:return e.getMonth();case 2:return e.getDate()}}for(;;){const s=f.lastIndex,c=f.exec(e),u=e.slice(s,c?c.index:e.length);if(l+=a.appendPreOrPostMatch(u,o),!c)break;if(l%2){o.push(c[0]);continue}const p=c[0],y=p.length;let g;if(/i{1,24}/.test(p))o.push(a.getFirstNDigitsOfPrecision(p.length));else switch(p){case"ddd":case"dddd":{const e=3===y?t.days.namesAbbr:t.days.names;o.push(e[i.getDay()]);break}case"d":case"dd":o.push(a.padZeros(m(i,2),y));break;case"MMM":case"MMMM":g=m(i,1),o.push(t.months[3===y?"namesAbbr":"names"][g]);break;case"M":case"MM":o.push(a.padZeros(m(i,1)+1,y));break;case"y":case"yy":case"yyyy":g=a.getEraYear(i,t,a.getEra(i,r),n),y<4&&(g%=100),o.push(a.padZeros(g,y));break;case"h":case"hh":d=i.getHours()%12,0===d&&(d=12),o.push(a.padZeros(d,y));break;case"H":case"HH":o.push(a.padZeros(i.getHours(),y));break;case"m":case"mm":o.push(a.padZeros(i.getMinutes(),y));break;case"s":case"ss":o.push(a.padZeros(i.getSeconds(),y));break;case"t":case"tt":g=i.getHours()<12?t.AM?t.AM[0]:" ":t.PM?t.PM[0]:" ",o.push(1===y?g.charAt(0):g);break;case"f":case"ff":case"fff":o.push(a.padZeros(i.getMilliseconds(),3).substr(0,y));break;case"u":case"n":case"p":case"e":case"a":case"x":case"o":o.push(a[a._codeToUnit[p]]);break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":o.push(a.padZeros(a[a._codeToUnit[p]],3));break;case"z":case"zz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),y));break;case"zzz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),2)+":"+a.padZeros(60*Math.abs(a.timeZoneOffsetHours%1),2));break;case"g":case"gg":t.eras&&o.push(t.eras[a.getEra(i,r)].name);break;case"/":o.push(t["/"]);break;default:throw"Invalid date format pattern '"+p+"'."}}let c=o.join("");return Smart.Utilities.DateTime.cache||(Smart.Utilities.DateTime.cache=new Array),a._today||(a._today=new Date),a.calendar&&a.calendar.today&&-1===e.indexOf(":")&&i.getFullYear()===a._today.getFullYear()&&i.getDate()===a._today.getDate()&&i.getMonth()===a._today.getMonth()&&(c=a.calendar.today),Smart.Utilities.DateTime.cache[s]=c,c}getFractionsOfSecondStamp(){const e=this;return e._microsecond.toString()+e._nanosecond+e._picosecond+e._femtosecond+e._attosecond+e._zeptosecond+e._yoctosecond}getFirstNDigitsOfPrecision(e,t){const a=this;return(""+(!0!==t?a.padZeros(a.millisecond(),3):"")+a.padZeros(a._microsecond,3)+a.padZeros(a._nanosecond,3)+a.padZeros(a._picosecond,3)+a.padZeros(a._femtosecond,3)+a.padZeros(a._attosecond,3)+a.padZeros(a._zeptosecond,3)+a.padZeros(a._yoctosecond,3)).slice(0,e)}copySmallTimePartValues(e){const t=this;e._microsecond=t._microsecond,e._nanosecond=t._nanosecond,e._picosecond=t._picosecond,e._femtosecond=t._femtosecond,e._attosecond=t._attosecond,e._zeptosecond=t._zeptosecond,e._yoctosecond=t._yoctosecond}add(e,t,a){const s=this,i=s.internalMS();if(void 0===t){if(!1===a)return s.dateData=i+parseInt(e._ticks/s.ticksPerMillisecond),s;const t=new Smart.Utilities.DateTime(i+parseInt(e._ticks/s.ticksPerMillisecond));return s.copyTimeZone(t),s.copySmallTimePartValues(t),t}const r=e*t;if(r<=-s.maxMillis||r>=s.maxMillis)throw new Error("Out of Range");if(!1===a)return s.dateData=i+r,s;const n=new Smart.Utilities.DateTime(i+r);return s.copyTimeZone(n),s.copySmallTimePartValues(n),n}addDays(e,t){return this.add(e,this.millisPerDay,t)}clone(){const e=this,t=new Smart.Utilities.DateTime(e.dateData);return e.copyTimeZone(t),e.copySmallTimePartValues(t),t}clearTime(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s,0,0,0,0);return e.copyTimeZone(i),i}addHours(e,t){return this.add(e,this.millisPerHour,t)}addDeciseconds(e,t){return this.add(100*e,1,t)}addCentiseconds(e,t){return this.add(10*e,1,t)}addMilliseconds(e,t){return this.add(e,1,t)}addMinutes(e,t){return this.add(e,this.millisPerMinute,t)}addMonths(e,t){const a=this;if(e<-12e4||e>12e4)throw new Error("Invalid Months Value");let s=parseInt(a.getDatePart(a.datePartYear)),i=parseInt(a.getDatePart(a.datePartMonth)),r=parseInt(a.getDatePart(a.datePartDay));if(e%12==0)s+=e/12;else{const t=i-1+e;t>=0?(i=t%12+1,s+=t/12):(i=12+(t+1)%12,s+=(t-11)/12),s=parseInt(s)}if(s<1||s>9999)throw new Error("Year out of range");const n=a.daysInMonth(s,i);if(r>n&&(r=n),!1===t)return a.dateData=a.dateToMS(s,i,r)+a.internalMS()%a.millisPerDay,a;const o=new Smart.Utilities.DateTime(a.dateToMS(s,i,r)+a.internalMS()%a.millisPerDay);return a.copyTimeZone(o),a.copySmallTimePartValues(o),o}addSeconds(e,t){return this.add(e,this.millisPerSecond,t)}addYears(e,t){return this.addMonths(12*e,t)}addMicroseconds(e,t){if(0===e)return;const a=this;let s,i;e<0&&0===a.hour()&&0===a.minute()&&0===a.second()&&0===a.millisecond()&&0===a._microsecond&&(s=parseInt(e/1e3,10)-1,i=1e3+e%1e3);const r=1e3*a.timeToMS(a.hour(),a.minute(),a.second(),a.millisecond())+a._microsecond,n=r+e;let o;if(void 0===s&&(s=parseInt(n/1e3,10)-parseInt(r/1e3,10)),void 0===i&&(i=parseInt(n%1e3,10)),0!==s&&(o=a.addMilliseconds(s,t)),!1!==t)return o||(o=a.clone()),o._microsecond=i,o;a._microsecond=i}addFractionsOfSecond(e,t,a,s,i){if(0===e)return;const r=this,n=1e3*r[s]+r[a],o=e+n;let d,l=parseInt(o/1e3,10)-parseInt(n/1e3,10),f=parseInt(o%1e3,10);if(e<0&&o<0&&f<0&&(l--,f=1e3+f),0!==l&&(d=r[i](l,t)),!1!==t)return d||(d=r.clone()),d[a]=f,d;r[a]=f}addNanoseconds(e,t){return this.addFractionsOfSecond(e,t,"_nanosecond","_microsecond","addMicroseconds")}addPicoseconds(e,t){return this.addFractionsOfSecond(e,t,"_picosecond","_nanosecond","addNanoseconds")}addFemtoseconds(e,t){return this.addFractionsOfSecond(e,t,"_femtosecond","_picosecond","addPicoseconds")}addAttoseconds(e,t){return this.addFractionsOfSecond(e,t,"_attosecond","_femtosecond","addFemtoseconds")}addZeptoseconds(e,t){return this.addFractionsOfSecond(e,t,"_zeptosecond","_attosecond","addAttoseconds")}addYoctoseconds(e,t){return this.addFractionsOfSecond(e,t,"_yoctosecond","_zeptosecond","addZeptoseconds")}getTimeZoneOffset(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1),s=e.getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset());return{offset:-e.getTimezoneOffset()/60,dst:+s}}isInDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return this.date().getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset())}supportsDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return t.getTimezoneOffset()!==a.getTimezoneOffset()}date(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s);return e.copyTimeZone(i),i}isWeekend(){return 0===this.dayOfWeek()||6===this.dayOfWeek()}toDate(e){const t=this,a=t.month(),s=t.year(),i=t.day(),r=t.hour(),n=t.minute(),o=t.second(),d=t.millisecond();let l=new Date(s,a-1,i);if(s<1970&&l.setFullYear(s),l.setHours(r,n,o,d),e){const a=t.timeZones.filter((function(t){return t.id===e}));if(a.length){let e=a[0].offset;const s=l.getTime();let i=60*l.getTimezoneOffset()*1e3;if(t.timeZone){const e=t.timeZones.filter((function(e){return e.id===t.timeZone}));e.length&&(i=60*-e[0].offset*1e3)}l=new Date(s+i+6e4*e)}}return l}toTimeZone(e){const t=this;let a=e;if(null==a&&(a="Local"),t.timeZone===a)return t.clone();const s=t.timeZones.filter((function(e){return e.id===a}));if(0===s.length)return t.clone();const i=this.toDate(a),r=new Smart.Utilities.DateTime(i);return r.timeZone=a,r.timeZoneOffset=s[0].offset,r.timeZoneOffsetHours=s[0].offsetHours,t.copySmallTimePartValues(r),r}day(){return this.getDatePart(this.datePartDay)}month(){return this.getDatePart(this.datePartMonth)}year(){return this.getDatePart(this.datePartYear)}millisecond(){return parseInt(this.internalMS()%1e3)}hour(){return parseInt(Math.floor(this.internalMS()/this.millisPerHour)%24)}minute(){return parseInt(this.internalMS()/this.millisPerMinute%60)}second(){return parseInt(this.internalMS()/this.millisPerSecond%60)}microsecond(){return this._microsecond}nanosecond(){return this._nanosecond}picosecond(){return this._picosecond}femtosecond(){return this._femtosecond}attosecond(){return this._attosecond}zeptosecond(){return this._zeptosecond}yoctosecond(){return this._yoctosecond}valueOf(){return this.dateData}equals(e){const t=this;return t.dateData===e.dateData&&t._microsecond===e._microsecond&&t._nanosecond===e._nanosecond&&t._picosecond===e._picosecond&&t._femtosecond===e._femtosecond&&t._attosecond===e._attosecond&&t._zeptosecond===e._zeptosecond&&t._yoctosecond===e._yoctosecond}equalDateParts(e){const t=this;return t.year()===e.year()&&t.month()===e.month()&&t.day()===e.day()}compare(e){const t=this;if(t.equals(e))return 0;const a=["dateData","_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"];for(let s=0;s<a.length;s++){const i=a[s];if(t[i]>e[i])return 1;if(t[i]<e[i])return-1}return 0}toDateString(){return this.toDate().toDateString()}toLocaleDateString(){return this.toDate().toLocaleDateString(this.calendar.locale)}toLocaleString(){return this.toDate().toLocaleString(this.calendar.locale)}toLocaleTimeString(){return this.toDate().toLocaleTimeString(this.calendar.locale)}validateTimeZone(e){const t=this;if("string"!=typeof e)return;const a=t.timeZones.filter((function(t){return t.id===e}));0!==a.length&&(t.timeZone=e,t.timeZoneOffset=a[0].offset,t.timeZoneOffsetHours=a[0].offsetHours)}copyTimeZone(e){const t=this;e.timeZone=t.timeZone,e.timeZoneOffset=t.timeZoneOffset,e.timeZoneOffsetHours=t.timeZoneOffsetHours}getTimeStamp(){return new Smart.Utilities.BigNumber(this.dateData.toString()+this.getFirstNDigitsOfPrecision(void 0,!0))}})})();
783
783
 
784
784
  /***/ }),
785
785
 
@@ -863,14 +863,14 @@ Smart("smart-scroll-bar",class extends Smart.BaseElement{static get properties()
863
863
  /***/ 5523:
864
864
  /***/ (() => {
865
865
 
866
- Smart("smart-table",class extends Smart.ContentElement{static get properties(){return{autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},columnGroups:{value:null,type:"array?"},columnMinWidth:{value:"50px",type:"any"},columnReorder:{value:!1,type:"boolean"},columnResize:{value:!1,type:"boolean"},columnResizeFeedback:{value:!1,type:"boolean"},columnResizeNormalize:{value:!1,type:"boolean"},columns:{value:[],type:"any?",reflectToAttribute:!1},columnSizeMode:{value:"default",allowedValues:["auto","default"],type:"string"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},conditionalFormattingButton:{value:!1,type:"boolean"},deferredScrollDelay:{value:1,type:"number"},dataRowId:{value:null,type:"string?"},dataSource:{value:null,type:"any?",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},sanitizeHTMLRender:{value:"text",allowedValues:["text","html"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},dataTransform:{value:null,type:"function?",reflectToAttribute:!1},editing:{value:!1,type:"boolean"},editMode:{value:"cell",allowedValues:["cell","row"],type:"string"},expandHierarchy:{value:!1,type:"boolean"},filtering:{value:!1,type:"boolean"},columnMenu:{value:!1,type:"boolean"},filterRow:{value:!1,type:"boolean"},filterTemplate:{value:null,type:"string?"},filterOperator:{value:"and",type:"string?"},footerRow:{value:null,type:"string?"},formulas:{value:!1,type:"boolean"},freezeFooter:{value:!1,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},grouping:{value:!1,type:"boolean"},groupFormatFunction:{value:null,type:"any"},headerRow:{value:null,type:"any"},hideSelectionColumn:{value:!1,type:"boolean"},keyboardNavigation:{value:!1,type:"boolean"},loadColumnStateBehavior:{value:"implementationOnly",allowedValues:["stateOnly","implementationOnly","intersection"],type:"string"},messages:{value:{en:{add:"Add condition",all:"All columns",apply:"Apply",between:"Between",cancel:"Cancel",clearFilter:"Clear filter",close:"Close",column:"Column:",condition:"Condition:",conditionalFormatting:"Conditional Formatting",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",equal:"Equal To",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filterCondition:"Filter condition",filterPlaceholder:"Filter",firstButton:"First",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",formatColumn:"Format Column",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",greaterThan:"Greater Than",highlight:"Highlight",invalidValue:"Invalid value",itemsPerPage:"Items per page:",lastButton:"Last",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",lessThan:"Less Than",nextButton:"Next",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",notEqual:"Not Equal To",NULL:"null",ok:"OK",previousButton:"Previous",remove:"Remove condition",secondValue:"Second value:",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",summaryPrefix:"of",text:"Text",value:"Value:",with:"with",columnMenuItemSortAsc:"Sort Ascending",columnMenuItemSortDesc:"Sort Descending",columnMenuItemReset:"Reset",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Show rows where:",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemColumns:"Columns",grouping:"Group field name is not found in the dataFields collection!"}},type:"object",extend:!0},onCellRender:{value:null,type:"function?",reflectToAttribute:!1},onColumnRender:{value:null,type:"function?",reflectToAttribute:!1},onInit:{value:null,type:"function?",reflectToAttribute:!1},pageSize:{value:10,allowedValues:[10,25,50],type:"int"},pageIndex:{value:0,type:"int"},paging:{value:!1,type:"boolean"},rowDetailTemplate:{value:null,type:"string?"},selected:{value:[],type:"array",reflectToAttribute:!1},selection:{value:!1,type:"boolean"},selectionMode:{value:"many",type:"string",allowedValues:["one","many","extended"]},selectionByHierarchy:{value:!0,type:"boolean"},sort:{value:null,type:"function?",reflectToAttribute:!1},sortMode:{value:"none",type:"string",allowedValues:["none","one","many"]},stateSettings:{value:["columns","expanded","filtered","grouped","selected","sorted"],type:"array"},tooltip:{value:!1,type:"boolean"},virtualization:{value:!1,type:"boolean"}}}static get listeners(){return{resize:"_resizeHandler","conditionalFormattingButton.click":"_conditionalFormattingButtonClickHandler","filterInput.keyup":"_filterInputKeyupHandler","pager.change":"_pagerChangeHandler","pager.pageSizeChanged":"_pagerPageSizeChanged","tableContainer.change":"_tableContainerChangeHandler","tableContainer.click":"_tableContainerClickHandler","tableContainer.down":"_tableContainerDownHandler","tableContainer.focus":"_tableContainerFocusHandler","tableContainer.pointerover":"_tableContainerPointeroverHandler","document.down":"_documentDownHandler","document.keydown":"_tableContainerKeydownHandler","document.keyup":"_tableContainerKeyupHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler"}}template(){return Smart.Templates[this.nodeName]&&delete Smart.Templates[this.nodeName],this.virtualization?'<div id="container" class="smart-container" role="presentation">\n <div id="header" class="smart-table-header" role="toolbar">\n <smart-input id="filterInput" class="underlined" animation="[[animation]]" locale="[[locale]]" right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-input>\n <div id="filterTemplateContainer" class="smart-table-filter-template-container smart-hidden"></div>\n <smart-button id="conditionalFormattingButton" class="smart-table-toolbar-button conditional-formatting" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" aria-label="Conditional Formatting"></smart-button>\n </div>\n <smart-scroll-viewer style="opacity: 0.99" id="virtualizationContainer" class="smart-table-virtualization-container" right-to-left="[[rightToLeft]]" theme="[[theme]]">\n <table id="tableContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-table-container">\n <content></content>\n </table>\n </smart-scroll-viewer>\n <smart-pager id="pager" animation="[[animation]]" locale="[[locale]]" page-index="[[pageIndex]]" page-size="[[pageSize]]" pages-count="null" show-first-last-navigation-buttons show-page-size-selector show-prev-next-navigation-buttons show-summary right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-pager>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" aria-label="Loading">\n <span id="loadingIndicator" class="smart-loader" role="presentation"></span>\n </div>\n </div>':'<div id="container" class="smart-container" role="presentation">\n <div id="header" class="smart-table-header" role="toolbar">\n <smart-input id="filterInput" class="underlined" animation="[[animation]]" locale="[[locale]]" right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-input>\n <div id="filterTemplateContainer" class="smart-table-filter-template-container smart-hidden"></div>\n <smart-button id="conditionalFormattingButton" class="smart-table-toolbar-button conditional-formatting" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" aria-label="Conditional Formatting"></smart-button>\n </div>\n <table id="tableContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-table-container">\n <content></content>\n </table>\n <smart-pager id="pager" animation="[[animation]]" locale="[[locale]]" page-index="[[pageIndex]]" page-size="[[pageSize]]" pages-count="null" show-first-last-navigation-buttons show-page-size-selector show-prev-next-navigation-buttons show-summary right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-pager>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" aria-label="Loading">\n <span id="loadingIndicator" class="smart-loader" role="presentation"></span>\n </div>\n </div>'}resetState(e){const t=this;switch(e){case"expanded":t._expandedIds=[],t._state.expanded=[];break;case"selected":t._selectedIds=[],t._disabledSelection=[],t._selectableGroupRecords=[],t.set("selected",[]),t._state.selected=[];break;default:t._dblclickObject={numberOfClicks:0},t._expandedIds=[],t._selectedIds=[],t._disabledSelection=[],t._selectableGroupRecords=[],t._state={expanded:[],selected:[],sorted:[]},t.set("selected",[])}}render(){this._render(),super.render()}_render(){const e=this,t=getComputedStyle(e);if(e.setAttribute("role","presentation"),e.$.tableContainer.id=e.id+"TableContainer",e._cachedWidth=e.offsetWidth,e._cachedHeight=e.offsetHeight,e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)},e._isMobile=Smart.Utilities.Core.isMobile,e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?8:Smart.Utilities.Core.Browser.Edge?16:4,e._dblclickObject={numberOfClicks:0},e._expandedIds=[],e._selectedIds=[],e._disabledSelection=[],e._selectableGroupRecords=[],e._state={expanded:[],selected:[],sorted:[]},e._rowHeight=parseFloat(t.getPropertyValue("--smart-table-row-height")),e._rowDetailHeight=parseFloat(t.getPropertyValue("--smart-table-row-detail-height")),e._animation=e.animation,e._setFocusable(),e.selection&&e.$.tableContainer.setAttribute("aria-multiselectable",!0),e.virtualization){const t=e.$.virtualizationContainer,a=e;t&&(t._mouseWheelHandler=function(e){const l=t;if(!l.disabled&&(l.computedHorizontalScrollBarVisibility||l.computedVerticalScrollBarVisibility)){if(e.shiftKey&&l.computedHorizontalScrollBarVisibility){const t=l.scrollLeft;if(0===t&&e.deltaX<0||t===l.scrollHeight&&e.deltaX>0)return;return e.stopPropagation(),e.preventDefault(),void(l.scrollWidth>0&&l.scrollTo(void 0,l.scrollLeft+l._getScrollCoefficient(e,l.offsetWidth)))}if(l.computedVerticalScrollBarVisibility){const t=l.scrollTop;if(0===t&&e.deltaY<0||t===l.scrollHeight&&e.deltaY>0)return;if(e.stopPropagation(),e.preventDefault(),l.scrollHeight>0){let t=3*a._rowHeight;e.deltaY<=0&&(t=-3*a._rowHeight),Math.abs(e.deltaY)>=100?l.scrollTop+=t:l.scrollTop+=e.deltaY}}}},t._verticalScrollbarHandler=function(t){0===e.deferredScrollDelay?e._onVerticalChange(t):(e._verticalScrollTimer&&(clearTimeout(e._verticalScrollTimer),delete e._verticalScrollTimer),e._verticalScrollTimer=setTimeout((()=>{e._onVerticalChange(t),delete e._verticalScrollTimer}),e.deferredScrollDelay))}),t.hasStyleObserver=!1,t.$.verticalScrollBar.hasStyleObserver=!1,t.$.horizontalScrollBar.hasStyleObserver=!1,e.freezeHeader=!0,e.freezeFooter=!0}e.isRendered?e.innerHTML&&e.innerHTML.trim().length>1?e._initDataSourceFromHTML():e._fullRefresh():(e._createElement(),setTimeout((()=>{const t=e.querySelectorAll("tr[row-id]");if(t.length>0){let a=!1;for(let l=0;l<t.length;l++){const i=t[l];e._rowHeight<i.offsetHeight&&(e._rowHeight=i.offsetHeight,a=!0)}a&&(e.style.setProperty("--smart-table-row-height",e._rowHeight+"px"),e._refreshDataRows())}}),500),e.columnMenu&&(e._initialState=e.getState()),super.render())}_initDataSourceFromHTML(){const e=this,t=e.context;e.context=e,e.hasAttribute("smart-blazor")&&(e.$.tableContainer.innerHTML="");const a=e.columns;e.dataSource=null,e.rows=null,e.columns=null;const l=e.querySelectorAll("th");let i=[],n=[],r=[];for(let e=0;e<l.length;e++){const t=l[e].innerHTML.trim();let a={label:t,dataField:t,dataType:"string"};i.push(a),n.push(t)}if(0===l.length&&a&&a.length>0)for(let e=0;e<a.length;e++){const t=a[e];let l={label:t.label,dataField:t.dataField,dataType:t.dataType};t.width&&(l.width=t.width),t.allowResize&&(l.allowResize=t.allowResize),t.allowFilter&&(l.allowFilter=t.allowFilter),t.allowSort&&(l.allowSort=t.allowSort),t.allowHide&&(l.allowHide=t.allowHide),t.allowMenu&&(l.allowMenu=t.allowMenu),t.freeze&&(l.freeze=t.freeze),t.responsivePriority&&(l.responsivePriority=t.responsivePriority),t.columnGroup&&(l.columnGroup=t.columnGroup),i.push(l),n.push({name:t.dataField,dataType:t.dataType})}const o=e.querySelectorAll("tr");for(let e=0;e<o.length;e++){const t={},a=o[e].querySelectorAll("td");if(a.length>0){for(let e=0;e<i.length;e++)t[i[e].dataField]=a[e].innerHTML.trim();r.push(t)}}const s=new Smart.DataAdapter({dataSource:r,expandHierarchy:e.expandHierarchy,dataFields:n,id:e.dataRowId});e.$.tableContainer.innerHTML="",e.columns=i,e.context=t,e.dataSource=s}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog)),e.isRendered&&e.isCompleted&&e.endUpdate()}detached(){const e=this;if(super.detached(),e._focusedCell&&!e.$.tableContainer.contains(e._focusedCell)&&delete e._focusedCell,!e._dialog)return;e._detachCachedTemplates();const t=e._dialog;t.removeEventListener("change",e._dialogEventHandler),t.removeEventListener("clear",e._dialogEventHandler),t.removeEventListener("click",e._dialogEventHandler),t.removeEventListener("close",e._dialogEventHandler),t.removeEventListener("filter",e._dialogEventHandler),t.remove()}addFilter(e,t){const a=this,l=a.columnByDataField[e];l&&!1!==l.allowFilter&&t instanceof Smart.Utilities.FilterGroup!=0&&(e=l.dataField,a._clearSortByRow&&a._clearSortByRow(!0),a._designerFiltersApplied&&a._clearDesignerFilters(),a._filterInfo.appliedFilters||(a._filterInfo.appliedFilters={}),a._filterInfo.appliedFilters[e]=t,a._refreshFilters("add"),a.$.filterInput&&t&&!a.filterRow&&!a.columnMenu&&(a.$.filterInput.value=t.filters[t.filters.length-1].value,a._filterInfo.query=a.$.filterInput.value),a._originalDynamicColumnsOrder&&(a._originalDynamicColumnsOrder=a._dynamicColumns.map((e=>e.id))))}addGroup(e){const t=this;if(!t.grouping)return;const a=t.columnByDataField[e];if(!a||!1===a.allowGroup)return;const l=t.dataSource,i=l.groupBy;e=a.dataField,-1===i.indexOf(e)&&(i.push(e),l.refreshHierarchy(),t._getSelectableGroupRecords(),t._fullRefresh(),t._updateState("grouped"),t._doNotFireEvent||t.$.fireEvent("group",{action:"add",dataField:e}))}beginEdit(e,t){const a=this;if(!a.editing)return;const l=a.columnByDataField[t];if(t=l?l.dataField:void 0,"cell"===a.editMode&&!t||l&&!1===l.allowEdit)return;const i=a.rowById[e];if(!i)return;const n=i.data.$.id;a._editing&&a.endEdit(),a._beginEdit({rowId:n,rowObject:i,dataField:t})}cancelEdit(){const e=this,t=e._editing;if(t){for(let a=0;a<t.cells.length;a++){const l=t.cells[a];l.editor.contains(e.getRootNode().activeElement)&&e._focusCell(l.element),l.editor.remove(),e._setCellContent(l.element,e._formatCellValue(t.row,e.columnByDataField[l.dataField],l.element)),l.element.classList.remove("editing")}delete e._editing}}clearFilters(e=null){const t=this,a=t._filterInfo;(a.inputFilters||a.rowFilters||a.appliedFilters)&&(t._clearFilterInput(),t._clearRowFilters(e),delete t._filterInfo.appliedFilters,t.dataSource.virtualDataSource||t.dataSource.clearFilter(),t._fullRefresh("filter"),t._updateState("filtered"),t._doNotFireEvent||t.$.fireEvent("filter",{action:"remove"}))}clearGrouping(){const e=this,t=e.dataSource;0!==t.groupBy.length&&(t.groupBy=[],t.refreshHierarchy(),e._getSelectableGroupRecords(),e._fullRefresh(),e._updateState("grouped"),e.$.fireEvent("group",{action:"remove"}))}clearSelection(){this._clearSelection(!0)}collapseAllRows(){const e=this;e._isExpandCollapseForbidden()||function t(a){for(let l=0;l<a.length;l++){const i=a[l];i.leaf||(i.children&&t(i.children),i.expanded&&e.collapseRow(i.$.id))}}(e["smart-table"===e.nodeName.toLowerCase()?"dataSource":"rows"].boundHierarchy)}collapseGroup(e){const t=this;if(!t.grouping||0===t.dataSource.groupBy.length)return;const a=t._getGroupByIndex(e);if(!a||!a.expanded)return;const l=t.$.tableContainer.querySelector(`tr[row-id="${a.$.id}"]:not([unused])`);if(!l){a.expanded=!1;let e=a.$.id;return e=e.replace("Item","").replace(/_/gi,"."),void t.$.fireEvent("group",{action:"collapse",path:e,dataField:a.groupDataField,label:a.label})}if(t._isCollapsed(a))return l.setAttribute("aria-expanded",!1),l.classList.remove("expanded"),void(a.expanded=!1);t._hierarchyArrowClickHandler(l)}collapseRow(e){const t=this;if(t._isExpandCollapseForbidden())return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e],l=a.data||a;if(!a||l.leaf||!l.expanded)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);return i?t._isCollapsed(l)?(i.setAttribute("aria-expanded",!1),i.classList.remove("expanded"),l.expanded=!1,t._expandedIds=t._expandedIds.filter((e=>e!==l.$.id)),t._updateState("expanded"),void t.$.fireEvent("collapse",{record:l})):void t._hierarchyArrowClickHandler(i):(l.expanded=!1,t._expandedIds=t._expandedIds.filter((e=>e!==l.$.id)),void t._updateState("expanded"))}collapseRowDetails(e){const t=this;if(!t.rowDetailTemplate)return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e],l=a.data||a;if(!a||!l)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);if(!i)return;const n=i.nextElementSibling;n&&n.classList.contains("smart-table-row-detail")&&!n.classList.contains("collapsed")&&t._toggleRowDetail(i,l.$.id)}collapseAllRowDetails(){const e=this;if(!e.rowDetailTemplate||!e.dataSource)return;let t=e.dataSource.boundSource;t||(t=e.$.tableContainer.querySelectorAll("tr[row-id]:not([unused])"));for(let a=0;a<t.length;a++)e.collapseRowDetails(t[a].$.id)}expandAllRowDetails(){const e=this;if(!e.rowDetailTemplate||!e.dataSource)return;let t=e.dataSource.boundSource;t||(t=e.$.tableContainer.querySelectorAll("tr[row-id]:not([unused])"));for(let a=0;a<t.length;a++)e.expandRowDetails(t[a].$.id)}updateRow(e,t,a){const l=this,i=l.rowById?l.rowById[e]:l.rows.dataItemById[e];if(!i)return;const n=l._selectedIds.slice(0);l._editing=!0,l.__updatedRows=!0;let r=[];l.dataSource&&l.dataSource.groupBy&&l.dataSource.groupBy.toArray&&(r=l.dataSource.groupBy.toArray().slice(0));const o=l.dataSource.boundSource.canNotify;l.dataSource.boundSource.canNotify=!1;const s=e=>{if(i.data[e]=t[e],l.dataSource.id&&i&&i.data&&i.data.$&&(i.data.$.id=t[l.dataSource.id]),i&&i.data.$&&void 0!==i.data.$.index){const a=i.data.$.index,n=l.dataSource.dataSource,o=()=>{const a=t[e];if(null==a){const t=l.columnByDataField[e];return t?"number"===t.dataType?0:"boolean"!==t.dataType&&("date"===t.dataType?new Date:""):""}return a};if(n&&n[a]&&(n[a][e]=o()),l.dataSource[a]){if(r.length>0&&!l._dirtyHierarchy&&l.dataSource[a][e]!==o()&&r.indexOf(e)>=0){const e=l._getExpandedGroups(l.dataSource.boundHierarchy);l._dirtyHierarchy=e}l.dataSource[a][e]=o()}}};for(let e=0;e<l.columns.length;e++){const a=l.columns[e];void 0!==t[a.dataField]&&s(a.dataField)}if(a){const e=l.dataSource.dataFields;if(e)for(let t=0;t<e.length;t++)e[t].map?s(e[t].map):s(e[t].name)}l._editing=!1,l.dataSource.boundSource.canNotify=o,l.__updating||(l.dataSource.refreshHierarchy(),l._fullRefresh(void 0,n,"update"))}addRow(e){const t=this;let a=[];const l=t.dataSource.boundSource.canNotify;if(t.dataSource.boundSource.canNotify=!1,t._editing=!0,t.__updatedRows=!0,t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.toArray&&(a=t.dataSource.groupBy.toArray().slice(0),a.length>0&&t.dataSource.beginUpdate()),a.length>0)t.dataSource?t.dataSource.add(e,!0):t._addNewRow(e,0);else if(t.dataSource)if(t.dataSource.boundHierarchy&&t.$.tableContainer&&"treegrid"===t.$.tableContainer.getAttribute("role")){const a=e[t.dataSource.parentDataField];t.dataSource.add(e,a)}else t.dataSource.add(e,!0);else t._addNewRow(e,0);t.dataSource.boundSource.canNotify=l,t._editing=!1,a.length>0||t.dataSource.boundHierarchy&&t.$.tableContainer&&"treegrid"===t.$.tableContainer.getAttribute("role")?(t._dataSourceUpdatingTimer&&clearTimeout(t._dataSourceUpdatingTimer),t._dataSourceUpdatingTimer=setTimeout((()=>{t._doNotFireEvent=!0;const e=t._getExpandedGroups(t.dataSource.boundHierarchy);a.forEach((e=>t.addGroup(e))),t.dataSource.endUpdate(),t._restoreExpandedGroups(e),t._fullRefresh("update"),t._doNotFireEvent=!1}),50)):(t._dataSourceUpdatingTimer&&clearTimeout(t._dataSourceUpdatingTimer),t._dataSourceUpdatingTimer=setTimeout((()=>{t._doNotFireEvent=!0,t._fullRefresh("update"),t._doNotFireEvent=!1})))}removeRow(e){const t=this,a=t.rowById?t.rowById[e]:t.rows.dataItemById[e];if(!a){if(t.dataSource&&t.dataSource.dataItemById){const a=t.dataSource.dataItemById[e];if(a){const l=void 0!==a.$?a.$.index:0;t.dataSource.removeAt(l),t._selectedIds.indexOf(e)>=0&&(t._selectedIds.splice(t._selectedIds.indexOf(e),1),t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:"remove"})),t.virtualization&&t.__updating||t._fullRefresh("update")}}return}const l=a.data||a,i=void 0!==l.$?l.$.index:0,n=t.dataSource.boundSource.canNotify;t.dataSource.boundSource.canNotify=!1,t._editing=!0,t.__updatedRows=!0;let r=[];t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.toArray&&(r=t.dataSource.groupBy.toArray().slice(0),r.length>0&&t.dataSource.beginUpdate()),t._doNotFireEvent=!0,t._sortColumns&&t._sortColumns.length?t.dataSource.remove(l):t.dataSource.removeAt(i),t._selectedIds.indexOf(e)>=0&&(t._selectedIds.splice(t._selectedIds.indexOf(e),1),t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:"remove"})),t._doNotFireEvent=!1,t.dataSource.boundSource.canNotify=n,t._editing=!1,r.length>0&&(t._dataSourceUpdatingTimer&&clearTimeout(t._dataSourceUpdatingTimer),t._dataSourceUpdatingTimer=setTimeout((()=>{const e=t._getExpandedGroups(t.dataSource.boundHierarchy);r.forEach((e=>t.addGroup(e))),t.dataSource.endUpdate(),t._restoreExpandedGroups(e),t._fullRefresh("update")}),50)),t.virtualization&&t.__updating||t._fullRefresh("update")}expandRowDetails(e){const t=this;if(!t.rowDetailTemplate)return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e];if(!a)return;const l=a.data||a;if(!a||!l)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);if(!i)return;const n=i.nextElementSibling;!n&&!t.virtualization||n&&n.classList.contains("smart-table-row-detail")&&!n.classList.contains("collapsed")||t._toggleRowDetail(i,l.$.id)}endEdit(){const e=this,t=e._editing;if(!t)return;const a=t.row,l=a.data,i=[];let n=!0;for(let a=0;a<t.cells.length;a++){const l=t.cells[a],r=e.columnByDataField[l.dataField],o=l.element,s=l.editor;let d;if(r.editor&&r.editor.template?r.editor.getValue&&(d=r.editor.getValue(s)):(d=s.value,s instanceof HTMLInputElement&&("number"===s.type?d=parseFloat(d):"date"===s.type&&(d=new Date(d),isNaN(d.getTime())&&(d=null)))),r.validation){const t=r.validation(d),a=void 0!==t&&!0!==t;if(a){let a;a="object"==typeof t&&t.message?t.message:e.localize("invalidValue"),o.setAttribute("validation-message",a)}else o.removeAttribute("validation-message");o.classList.toggle("invalid",a),n=n&&!a}i.push({column:r,newValue:d})}if(n){if(e.dataSource.virtualDataSource){const a=Object.assign({},l);for(let e=0;e<t.cells.length;e++){const l=t.cells[e],n=i[e],r=n.column;a[l.dataField]=n.newValue,r.transform&&(a[r.dataField]=r.transform(n.newValue))}for(const t of e._columns)a[t.dataField]instanceof Date&&(a[t.dataField]=a[t.dataField].toISOString().slice(0,10));e._editing.row.data=a,e._requestVirtualDataSource("update",(function(t){return t?r(!1,a):(e._editing.row.data=l,e.cancelEdit()),t}))}else r(!0,l);delete e._editing}function r(l,n){for(let r=0;r<t.cells.length;r++){const o=t.cells[r],s=i[r],d=s.column,c=o.editor;c.contains(e.getRootNode().activeElement)&&e._focusCell(o.element),c.remove(),l&&(n[o.dataField]=s.newValue,d.transform&&(n[d.dataField]=d.transform(s.newValue))),e._setCellContent(o.element,e._formatCellValue(a,d,o.element)),o.element.classList.remove("editing"),e.$.fireEvent("cellEndEdit",{id:n.$.id,row:n,value:n[o.dataField],dataField:o.dataField})}e._updateCellsWithFormulas(),"row"===e.editMode&&e.$.fireEvent("rowEndEdit",{id:n.$.id,row:n})}}expandAllRows(){const e=this;if(e._isExpandCollapseForbidden())return;e.beginUpdate();const t=e["smart-table"===e.nodeName.toLowerCase()?"dataSource":"rows"].boundHierarchy;if(t)for(let e=0;e<t.length;e++){const a=t[e],l=e=>{if(!e.leaf&&(e.expanded=!0,e.children))for(let t=0;t<e.children.length;t++){const a=e.children[t];l(a)}};l(a)}e.endUpdate()}isGroupExpanded(e){const t=this,a=t.dataSource;if(!t.grouping||0===a.groupBy.length)return;const l=t._getGroupByIndex(e);return!!l&&l.expanded}expandGroup(e){const t=this,a=t.dataSource;if(!t.grouping||0===a.groupBy.length)return;const l=t._getGroupByIndex(e);if(!l)return;const i=t._doNotFireEvent,n=t.animation,r=t.$.tableContainer.querySelector(`tr[row-id="${l.$.id}"]:not([unused])`);let o=!1;if(i&&(t.animation="none"),r){if(t._isCollapsed(l))if(i)o=!0;else{let e=l.parent;e&&!e.expanded&&t.expandGroup(l.parent.$.id.replace("Item","").replace(/_/g,"."))}l.expanded||(o||i?(l.expanded=!0,r.setAttribute("aria-expanded",!0),r.classList.add("expanded")):t._hierarchyArrowClickHandler(r,i)),i&&(l.expanded=!0,r.setAttribute("aria-expanded",!0),r.classList.add("expanded"),requestAnimationFrame((()=>t.animation=n)))}else if(l.expanded=!0,!l.expanded&&!i){let e=l.$.id;e=e.replace("Item","").replace(/_/gi,"."),t.$.fireEvent("group",{action:"expand",path:e,dataField:l.groupDataField,label:l.label})}}expandAllRootGroups(){const e=this;if(!e.grouping)return;e.beginUpdate();const t=e.dataSource.boundHierarchy;if(t)for(let e=0;e<t.length;e++)t[e].expanded=!0;e.endUpdate()}expandAllGroups(){const e=this;if(!e.grouping)return;e.beginUpdate();const t=e.dataSource.boundHierarchy;if(t)for(let e=0;e<t.length;e++){const a=t[e],l=e=>{if(e.expanded=!0,e.children)for(let t=0;t<e.children.length;t++){const a=e.children[t];l(a)}};l(a)}e.endUpdate()}collapseAllGroups(){const e=this;if(!e.grouping)return;e.beginUpdate();const t=e.dataSource.boundHierarchy;if(t)for(let e=0;e<t.length;e++)t[e].expanded=!1;e.endUpdate()}expandRow(e){const t=this;if(t._isExpandCollapseForbidden())return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e],l=a.data||a;if(!a||l.leaf)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);if(!i)return l.expanded=!0,-1===t._expandedIds.indexOf(l.$.id)&&t._expandedIds.push(l.$.id),t._updateState("expanded"),void t.$.fireEvent("expand",{id:l.$.id,record:l});if(t._isCollapsed(l)){let e=l.parent;e&&!e.expanded&&t.expandRow(e.$.id)}l.expanded||t._hierarchyArrowClickHandler(i)}exportData(e,t,a,l){const i=this,n=i._columns.filter((e=>e.visible)),r=i.columnGroups,o=i.dataSource,s=getComputedStyle(i),d=s.borderRightColor,c=new Smart.Utilities.DataExporter(void 0,o.groupBy.toArray()),u={};let f,m=Array.from(i.$.tableContainer.firstElementChild.querySelectorAll("th"));if(o.virtualDataSource){f=[];for(let e=0;e<i.rows.length;e++)f.push(i.rows[e].data)}else o.boundHierarchy&&!i.grouping?(c.hierarchical=!0,f=function e(t){const l=[];return t.forEach((t=>{a&&!1===t.$.filtered||(l.push(t),t.leaf||(t._expanded=t.expanded,t.children&&(t.children=e(t.children),0===t.children.length&&(t._expanded=void 0,t.children=void 0,t.leaf=!0))))})),l}(JSON.parse(JSON.stringify(o.boundHierarchy,((e,t)=>{if("parent"!==e)return t}))))):(f=Array.from(o.toArray()),a&&(f=f.filter((e=>!1!==e.$.filtered))));c.style={border:"1px solid "+d,borderCollapse:"collapse",backgroundColor:s.backgroundColor,color:s.color,fontFamily:"Helvetica",header:{border:"1px solid "+d,fontWeight:"bold"},columns:{border:"1px solid "+d}},m=m.filter((e=>!1===e.classList.contains("smart-table-select-all")));for(let e=0;e<n.length;e++){const t=n[e],a={},l={};let i=m[e].offsetWidth+"px";u[t.dataField]=t.label,"date"===t.dataType&&(l.format="d"),a.width=i,c.style.header[t.dataField]=a,c.style.columns[t.dataField]=l}return r?c.header={columns:n,columngroups:r}:f.unshift(u),c.exportData(f,e,t,l)}getRowIndexById(e){const t=this.rowById[e];return this.dataSource&&t&&t.data&&t.data.$?t.data.$.index:-1}getSelection(){const e=this;return 0===e._selectableGroupRecords.length?e._selectedIds.filter((e=>!(""+e).startsWith("Item"))):e._selectedIds.filter((t=>-1===e._selectableGroupRecords.indexOf(t)&&!(""+t).startsWith("Item")))}getState(){return JSON.parse(this._stringifyState())}getValue(e,t){const a=this,l=a.columnByDataField[t];if(!l)return;let i=a.rowById[e];return i?i.data[l.dataField]:(i=a.dataSource.dataItemById[e],i?i[l.dataField]:void 0)}loadState(e){const t=this;if(!e&&!(e=window.localStorage.getItem("smartTable"+t.id)))return;const a=t.stateSettings;let l=!1;if(t._loadingState=!0,"string"==typeof e&&(e=JSON.parse(e)),-1!==a.indexOf("columns")){const a=t.loadColumnStateBehavior,i=t._columns,n=[],r=e.columns;for(let e=0;e<r.length;e++){let t=Object.assign({},r[e]);const l=i.find((e=>e.dataField===t.dataField));if(!l){"implementationOnly"!==a&&n.push(t);continue}const o=l.label,s=["editor","formatFunction","templateElement","templateElementSettings","transform","validation"];"stateOnly"!==a&&s.push("label");for(let e in l)-1===s.indexOf(e)&&delete l[e];t=Object.assign(l,t),"stateOnly"!==a&&o&&(t.label=o),n.push(t)}if("stateOnly"!==a)for(let e=0;e<i.length;e++){const t=i[e];n.find((e=>e.dataField===t.dataField))||n.push(t)}t.columns=n,t._initColumns(!0),l=!0,t._formattingPanel&&(t._formattingPanel.columns=t._columns)}if(t.grouping){const a=t.dataSource,i=t.dataSource.groupBy;e.grouped=e.grouped||[],JSON.stringify(i._array)!==JSON.stringify(e.grouped)&&(t.dataSource.groupBy=e.grouped,a.refreshHierarchy(),l=!0)}else t.hasAttribute("hierarchy")&&-1!==a.indexOf("expanded")&&JSON.stringify(t._expandedIds.slice(0).sort())!==JSON.stringify(e.expanded.slice(0).sort())&&(t.collapseAllRows(),t._expandedIds=e.expanded,l=!0);-1!==a.indexOf("selected")&&e.selected.slice&&JSON.stringify(t._selectedIds.slice(0).sort())!==JSON.stringify(e.selected.slice(0).sort())&&(t._selectedIds=e.selected,l=!0),l&&(t._initRows(),t.refresh());e:if(-1!==a.indexOf("filtered")){const a=t.filtering,l=e.filtered;if(t.clearFilters(),!l)break e;if(a&&t.filterRow&&l.rowFilters){const a=t.$.tableContainer.querySelector(".smart-table-filter-row"),l=Number(t.selection),i=e.filtered.filterRowValues;for(let e=0;e<t._columns.length;e++){const n=i[e];if(!n)continue;const r=t._columns[e].dataType,o=a.children[e+l].firstElementChild,s=t._filterInfo["string"===r?"stringConditions":"numberAndDateConditions"].find((e=>e.value===n.condition));if(-1===["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(s.value))if("date"===r){const e=new Date(n.value),t=(e.getMonth()+1).toString(),a=e.getDate().toString();o.children[0].value=`${e.getFullYear()}-${"0".repeat(2-t.length)}${t}-${"0".repeat(2-a.length)}${a}`}else o.children[0].value=n.value;o.children[1].value=s.label,o.children[1].$.input.dataValue=s.value}t._applyRowFilters()}else if(a&&l.inputFilters)t.$.filterInput.value=l.query,t._filterByAll(l.query);else if(l.appliedFilters){t._filterInfo.appliedFilters||(t._filterInfo.appliedFilters={});for(let e in l.appliedFilters){const a=l.appliedFilters[e],i=new window.Smart.Utilities.FilterGroup;a.filters.forEach(((e,t)=>{const l=i.createFilter(e.type.replace("Filter",""),e.value,e.condition);i.addFilter(a.logicalOperators[t],l)})),t._filterInfo.appliedFilters[e]=i}t._refreshFilters("add")}}-1!==a.indexOf("sorted")&&(t.clearSort(),e.sorted.forEach&&e.sorted.forEach((e=>{t.sortBy(e.dataField,e.direction)}))),a.forEach((e=>t._updateState(e,!1))),t.autoSaveState&&window.localStorage.setItem("smartTable"+t.id,t._stringifyState()),delete t._loadingState}navigateTo(e){const t=this;if(isNaN(e)||null===e)return;const a=t.pageIndex;t.pageIndex=Math.max(Math.min(Math.round(e),t.$.pager.pagesCount-1),0),t.paging&&t.pageIndex!==a&&(t._fullRefresh("pageIndexChange"),t.$.fireEvent("page",{action:"pageIndexChange"}))}removeFilter(e){const t=this,a=t.columnByDataField[e];a&&t.filterRow&&t.clearFilters(e),t._filterInfo.appliedFilters&&a&&(e=a.dataField,t._clearSortByRow&&t._clearSortByRow(!0),t._designerFiltersApplied&&t._clearDesignerFilters(e),delete t._filterInfo.appliedFilters[e],t._refreshFilters("remove"),t._originalDynamicColumnsOrder&&(t._originalDynamicColumnsOrder=t._dynamicColumns.map((e=>e.id))))}removeGroup(e){const t=this,a=t.columnByDataField[e];if(!t.grouping||!a)return;e=a.dataField;const l=t.dataSource,i=l.groupBy,n=i.indexOf(e);-1!==n&&(i.splice(n,1),l.refreshHierarchy(),t._getSelectableGroupRecords(),t._fullRefresh(),t._updateState("grouped"),t.$.fireEvent("group",{action:"remove",dataField:e}))}saveState(){const e=this._stringifyState();return window.localStorage.setItem("smartTable"+this.id,e),JSON.parse(e)}enableSelect(e){const t=this;t.selection&&t._disabledSelection.indexOf(e)>=0&&(t._disabledSelection.splice(t._disabledSelection.indexOf(e),1),t._fullRefresh("update"))}disableSelect(e){const t=this;t.selection&&(t._disabledSelection.push(e),t._fullRefresh("update"))}select(e){const t=this;t.selection&&(Array.isArray(e)?t._changeSelectionOfMultiple(e,"select"):t._selectSingle(e)&&(t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:t._interaction?"interaction":"programmatic"})))}setValue(e,t,a){const l=this,i=l.columnByDataField[t];if(!i)return;let n,r=l.rowById[e];if(r)n=r.data;else{if(r=l.dataSource.dataItemById[e],!r)return;n=r}t=i.dataField,l.dataSource._updating=!0,i.transform?(n[i.originalDataField]=a,n[t]=i.transform(a)):n[t]=a;const o=l.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused]) td[data-field="${t}"]`);o&&l._setCellContent(o,l._formatCellValue(r,i,o),o.classList.contains("tree-cell")),l._updateCellsWithFormulas(),delete l.dataSource._updating}unselect(e){const t=this;t.selection&&(Array.isArray(e)?t._changeSelectionOfMultiple(e,"unselect"):t._unselectSingle(e)&&(t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:t._interaction&&-1===t._disabledSelection.indexOf(e)?"interaction":"programmatic"})))}set scrollTop(e){const t=this;t.isRendered&&(e=parseInt(e),isNaN(e)||((t.virtualization?t.$.virtualizationContainer:t.$.container).scrollTop=e))}get scrollTop(){const e=this;return e.isRendered?(e.virtualization?e.$.virtualizationContainer:e.$.container).scrollTop:0}set scrollLeft(e){const t=this;t.isRendered&&(e=parseInt(e),isNaN(e)||((t.virtualization?t.$.virtualizationContainer:t.$.container).scrollLeft=e))}get scrollLeft(){const e=this;return e.isRendered?(e.virtualization?e.$.virtualizationContainer:e.$.container).scrollLeft:0}clearContent(){const e=this;for(;e.$.tableContainer.firstChild;)e.$.tableContainer.removeChild(e.$.tableContainer.firstChild)}applyContent(){const e=this;if(void 0===e.content)return void(e.content=e.$.tableContainer);if(""===e.content||null===e.content)return void e.clearContent();if(e.content instanceof HTMLElement)return e.clearContent(),void e.$.content.appendChild(e.content);const t=document.createDocumentFragment();let a=document.createElement("div");t.appendChild(a),e.content instanceof HTMLElement?a.appendChild(e.content):a.innerHTML=e.content;let l=Array.from(a.childNodes);a.parentNode.removeChild(a);for(let e=0;e<l.length;e++)t.appendChild(l[e]);e.clearContent(),e.$.tableContainer.appendChild(t)}propertyChangedHandler(e,t,a){const l=this;if(super.propertyChangedHandler(e,t,a),"innerHTML"!==e)switch(e){case"animation":case"theme":if("theme"===e){const e=getComputedStyle(l);l._defaults.text=l._toHex(e.color),l._defaults.highlight=l._toHex(e.backgroundColor)}if(l.filterRow){const t=l.$.tableContainer.querySelector(".smart-table-filter-row");Array.from(t.querySelectorAll("smart-input, smart-button")).forEach((t=>t[e]=a))}i(e,a);break;case"autoSaveState":a&&window.localStorage.setItem("smartTable"+l.id,l._stringifyState());break;case"columnGroups":a&&(l.columnResize&&(l.columnResize=!1),"auto"===l.columnSizeMode&&(l.removeAttribute("resize-max-reached"),l.columnSizeMode="default")),l.refresh();break;case"columnMinWidth":if(isNaN(parseFloat(a)))return void(l.columnMinWidth=t);l._handleAutoSizeMode(),l._handleFrozenColumnPositions(),l._refreshHorizontalScrollbar();break;case"columnResize":a&&l.columnGroups&&(l.columnResize=!1);break;case"columnResizeNormalize":l._columns&&l._columns.length>0&&""===l._columns[l._columns.length-1].dataField&&(l._columns.pop(),l.columns.pop()),l._initColumns(!0),l.refresh();break;case"columns":{l._conditionalFormatting&&delete l._conditionalFormatting;const e=l._sortColumns,t=l._filterInfo;if(l._clearFilterInput(),l._clearRowFilters(),delete l._filterInfo.appliedFilters,l._sortColumns=[],l._initColumns(!0),l.refresh(),l._formattingPanel&&(l._formattingPanel.columns=l._columns),l.dataSource.dataFields){let a=l.dataSource.dataFields||[];const i=l.columns;let n=!1;if(i.forEach((e=>{if(e.dataType){const t=a.find((t=>t.name===e.dataField));t?t.dataType=e.dataType:e.map?a.find((t=>e.map.indexOf(t.name)>=0?t:null))&&(l.dataSource.dataFields.push({name:e.dataField,map:e.map,dataType:e.dataType}),n=!0):(l.dataSource.dataFields.push({name:e.dataField,dataType:e.dataType}),n=!0)}})),n&&l.dataSource.dataBind){let a=[],i=[];if(l.dataSource&&l.dataSource.groupBy&&l.dataSource.groupBy.toArray&&(a=l.dataSource.groupBy.toArray().slice(0)),a.length>0&&(i=l._getExpandedGroups(l.dataSource.boundHierarchy)),l.dataSource.bindingCompleted=!1,l.dataSource.dataBind(),l._doNotFireEvent=!0,a.length>0&&(a.forEach((e=>l.addGroup(e))),l.dataSource.boundHierarchy&&l.dataSource.refreshHierarchy(),l._restoreExpandedGroups(i)),t.inputFilters?l._filterByAll(t.query):t.rowFilters?l._applyRowFilters():t.appliedFilters&&l._refreshFilters(),e&&(l._sortColumns=[],e.forEach((e=>{l.columnByDataField[e.dataField].sortOrder=null,l.sortBy(e.dataField,e.direction)}))),l._selectedIds.length>0){const e=JSON.stringify(l._selectedIds.slice(0).sort()),t=l.dataSource;l._selectedIds=l._selectedIds.filter((e=>void 0!==t.dataItemById[e]||-1!==l._selectableGroupRecords.indexOf(e))),e!==JSON.stringify(l._selectedIds.slice(0).sort())&&(l._updateSelectAllState(),l._updateState("selected"),l.$.fireEvent("change",{type:"remove"}))}l.virtualization&&setTimeout((()=>{const e=l.columns&&l.columns.length>0?l.columns[0].dataField:"";if(e){const t=l.querySelector('td[data-field="'+e+'"]');t&&l._rowHeight<t.offsetHeight&&(l._rowHeight=t.offsetHeight,l.style.setProperty("--smart-table-row-height",l._rowHeight+"px"),l._refreshDataRows())}}),300),delete l._doNotFireEvent}else t.inputFilters?l._filterByAll(t.query):t.rowFilters?l._applyRowFilters():t.appliedFilters&&l._refreshFilters(),e&&(l._sortColumns=[],e.forEach((e=>{l.columnByDataField[e.dataField].sortOrder=null,l.sortBy(e.dataField,e.direction)})))}break}case"columnSizeMode":if("auto"===a){if(l.columnGroups)return void(l.columnSizeMode="default");l._handleAutoSizeMode()}else l.removeAttribute("resize-max-reached"),l._columns.forEach((e=>{e.visible&&(e._isResponsive?e.headerCellElement.style.width=e.width||e._manualPercentageWidth?l._getColumnWidth(e.width||e._manualPercentageWidth,!0,e):null:e.headerCellElement.style.width=e.width||e._manualWidth?l._getColumnWidth(e.width||e._manualWidth,!0,e):null)}));l._handleFrozenColumnPositions(),l._refreshHorizontalScrollbar();break;case"conditionalFormatting":l._applyInitialConditionalFormatting(l.dataSource),l._refreshDataRows();break;case"conditionalFormattingButton":l.$.header.classList.toggle("smart-hidden",(!l.filtering||l.filterRow)&&!a),!a&&l._dialog&&l._dialog.close();break;case"dataSource":case"dataSourceSettings":{const i=l._sortColumns,n=l._filterInfo;if("dataSource"===e&&null===a&&(l.dataSource=[]),"dataSource"===e&&t&&a&&l.virtualization&&t instanceof Smart.DataAdapter&&t.length===a.length&&t.length>0&&a.length>0&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===a)return;l.beginUpdate();for(let e=0;e<a.length;e++){const t=a[e],i=l.dataSource[e].$.id;l.updateRow(i,t,!0)}return l.endUpdate(void 0,!0),void(l._cachedDataSource=a)}const r=l.$.virtualizationContainer?l.$.virtualizationContainer.scrollTop:0,o=void 0!==l.$.virtualizationContainer&&l.$.virtualizationContainer.$?l.$.virtualizationContainer.$.verticalScrollBar:null;o&&o.beginUpdate();let s=[];if(t&&t.groupBy&&t.groupBy.toArray&&(s=t.groupBy.toArray().slice(0)),l._dataBind(!0),l._doNotFireEvent=!0,s.length>0){const e=l._getExpandedGroups(t.boundHierarchy);if(l.__updating=!0,l.dataSource._groupBy&&(l.dataSource._groupBy.canNotify=!1),l._selectedIds.length>0){const e=JSON.stringify(l._selectedIds.slice(0).sort()),t=l.dataSource;l._selectedIds=l._selectedIds.filter((e=>void 0!==t.dataItemById[e]||-1!==l._selectableGroupRecords.indexOf(e))),s.forEach((e=>l.addGroup(e))),e!==JSON.stringify(l._selectedIds.slice(0).sort())&&(l._updateSelectAllState(),l._updateState("selected"),l.$.fireEvent("change",{type:"remove"}))}else s.forEach((e=>l.addGroup(e)));l.dataSource.boundHierarchy&&l.dataSource.refreshHierarchy(),l.dataSource._groupBy&&(l.dataSource._groupBy.canNotify=!0),l.__updating=!1,l._restoreExpandedGroups(e),l._fullRefresh("update")}if(n.inputFilters?l._filterByAll(n.query):n.rowFilters?l._applyRowFilters():n.appliedFilters&&l._refreshFilters(),i&&(l._sortColumns=[],i.forEach((e=>{l.columnByDataField[e.dataField].sortOrder=null,l.sortBy(e.dataField,e.direction)}))),l._selectedIds.length>0){const e=JSON.stringify(l._selectedIds.slice(0).sort()),t=l.dataSource;l._selectedIds=l._selectedIds.filter((e=>void 0!==t.dataItemById[e]||-1!==l._selectableGroupRecords.indexOf(e))),e!==JSON.stringify(l._selectedIds.slice(0).sort())&&(l._updateSelectAllState(),l._updateState("selected"),l.$.fireEvent("change",{type:"remove"}))}l.virtualization&&(setTimeout((()=>{const e=l.columns&&l.columns.length>0?l.columns[0].dataField:"";if(e){const t=l.querySelector('td[data-field="'+e+'"]');t&&l._rowHeight<t.offsetHeight&&(l._rowHeight=t.offsetHeight,l.style.setProperty("--smart-table-row-height",l._rowHeight+"px"),l._refreshDataRows())}}),300),l.$.virtualizationContainer.scrollTop=r,o&&(o.endUpdate(),l._onVerticalChange({detail:{value:o.value}},!0))),delete l._doNotFireEvent;break}case"disabled":case"unfocusable":case"keyboardNavigation":l._setFocusable(),i("unfocusable",l.disabled||l.unfocusable||!l.keyboardNavigation),"disabled"===e&&l._dialog&&l._dialog.close();break;case"hideSelectionColumn":l.refresh();break;case"columnMenu":l.$.header.classList.toggle("smart-hidden",(!l.filtering||l.filterRow||l.columnMenu)&&!l.conditionalFormattingButton),l.columnMenu&&(l._initialState=l.getState()),l.refresh();break;case"editing":a?l.$.tableContainer.removeAttribute("aria-readonly"):l.$.tableContainer.setAttribute("aria-readonly",!0);break;case"filtering":l.columnMenu||l.$.header.classList.toggle("smart-hidden",(!a||l.filterRow)&&!l.conditionalFormattingButton),a&&l.filterRow?l._createFilterRow():!1===a&&(l.filterRow&&l.$.tableContainer.querySelector(".smart-table-filter-row").remove(),(l._filterInfo.query||l._filterInfo.rowFilters||l._filterInfo.appliedFilters)&&l.clearFilters()),l.virtualization&&l.refresh();break;case"filterRow":if(l.$.header.classList.toggle("smart-hidden",(!l.filtering||a)&&!l.conditionalFormattingButton),!l.filtering)return;a?l._createFilterRow():(l.$.tableContainer.querySelector(".smart-table-filter-row").remove(),l._filterInfo.rowFilters&&l.clearFilters());break;case"filterTemplate":l._applyFilterTemplate();break;case"footerRow":{const e=l.$.tableContainer.querySelector("tfoot");e&&e.remove(),a&&l._createFooterRow();break}case"formulas":a?l._formulaParser=new Smart.FormulaParser(l):delete l._formulaParser,l._updateCellsWithFormulas(!0);break;case"freezeHeader":case"freezeFooter":l.virtualization&&(l[e]=!0);break;case"grouping":a||l.clearGrouping();break;case"headerRow":{const e=Array.from(l.$.tableContainer.firstElementChild.children);for(let t=1;t<e.length;t++)e[t].remove();a&&l._createCustomHeaderRow();break}case"locale":case"messages":{const e=l._dialog;if(l._localize(),l.filterRow){const e=l.$.tableContainer.querySelector(".smart-table-filter-row"),t=Array.from(e.querySelectorAll("smart-input.string-filter")),a=Array.from(e.querySelectorAll("smart-input.num-date-filter")),i=Array.from(e.querySelectorAll("smart-button"));t.concat(a).forEach((e=>e.title=l.localize("filterCondition"))),t.forEach((e=>{e.dataSource=l._filterInfo.stringConditions,void 0===e.$.input.dataValue?e.value=l.localize("CONTAINS"):e.value=l._filterInfo.stringConditions.find((t=>t.value===e.$.input.dataValue)).label})),a.forEach((e=>{e.dataSource=l._filterInfo.numberAndDateConditions,void 0===e.$.input.dataValue?e.value=l.localize("EQUAL"):e.value=l._filterInfo.numberAndDateConditions.find((t=>t.value===e.$.input.dataValue)).label})),i.forEach((e=>e.title=l.localize("clearFilter")))}e&&(e.$.footer.firstElementChild.innerHTML=l.localize("ok"),e.$.footer.children[1].innerHTML=l.localize("cancel"),e.classList.contains("conditional-formatting")?e.label=l.localize("conditionalFormatting"):e.classList.contains("drill-down")&&(e.label=l.localize("details"))),l._formattingPanel&&(l._formattingPanel.messages=l.messages,l._formattingPanel.locale=l.locale),Array.from(l.$.tableContainer.querySelectorAll(".group-label-value>.placeholder")).forEach((e=>{e.textContent=l.localize("EMPTY")}));break}case"pageIndex":l.pageIndex=Math.max(Math.min(Math.round(a),l.$.pager.pagesCount-1),0),l.paging&&l.pageIndex!==t&&(l._fullRefresh("pageIndexChange"),l.$.fireEvent("page",{action:"pageIndexChange"}));break;case"pageSize":l.paging&&(l._fullRefresh("pageSizeChange"),l.$.fireEvent("page",{action:"pageSizeChange"}));break;case"paging":if(!1===a){if(l.dataSource.virtualDataSource)return void(l.paging=!0);if(1===l.$.pager.pagesCount)return}l._fullRefresh();break;case"rowDetailTemplate":l._fullRefresh();break;case"rightToLeft":Array.from(l.$.tableContainer.querySelectorAll(".freeze-near, .freeze-far")).forEach((e=>{e.style.left=null,e.style.right=null,e.style.zIndex=null})),l._handleFrozenColumnPositions(),i("rightToLeft",a);break;case"selected":{const e=l._selectedIds.slice(0);l._clearSelection(),l._changeSelectionOfMultiple(a,"select","programmatic",e);break}case"selection":if(l.filterRow){const e=l.$.tableContainer.querySelector(".smart-table-filter-row");a?e.insertBefore(document.createElement("td"),e.firstElementChild):e.firstElementChild.remove()}l.refresh(),a?(l.$.tableContainer.setAttribute("aria-multiselectable",!0),l._updateSelectAllState()):l.$.tableContainer.removeAttribute("aria-multiselectable");break;case"selectionMode":{l.$.tableContainer.classList.remove("smart-unselectable");const e=l.querySelector(".smart-table-select-all");e&&("one"===l.selectionMode?e.classList.add("smart-visibility-hidden"):e.classList.remove("smart-visibility-hidden"));break}case"sortMode":"none"===a&&l.clearSort();break;case"tooltip":if(!a){const e=l.$.tableContainer.querySelector(".tooltip");e&&(e.classList.remove("tooltip"),e.removeAttribute("title"))}break;case"virtualization":l.virtualization=t}else l._initDataSourceFromHTML();function i(e,t){const a=[];l._dialog&&a.push(l._dialog,l._dialog.$.footer.firstElementChild,l._dialog.$.footer.children[1]),l._formattingPanel&&a.push(l._formattingPanel),a.forEach((a=>a[e]=t))}}_createElement(){const e=this;if(e._expandedRowDetailIds=[],e._editors={},isNaN(parseFloat(e.columnMinWidth))&&(e.columnMinWidth="50px"),e.columnGroups&&(e.columnResize=!1,e.columnSizeMode="default"),e.formulas&&(e._formulaParser=new Smart.FormulaParser(e)),e._setupPagingAndFiltering(),e._localize(),e._selectedIds=e.selected.slice(0),"one"===e.selectionMode){e._selectedIds=e._selectedIds.slice(0,1);const t=e.querySelector(".smart-table-select-all");t&&t.classList.add("smart-visibility-hidden")}e._dataBind(),e.editing||e.$.tableContainer.setAttribute("aria-readonly",!0),e.autoLoadState&&e.loadState(),e.autoSaveState&&window.localStorage.setItem("smartTable"+e.id,e._stringifyState())}_initColumns(e){const t=this,a=t.columns;if(!t.isRendered&&t.dataSource.length>0&&(!a||Array.isArray(a)&&0===a.length)&&(t.columns=t.dataSource.dataFields.map((e=>({label:e.name,dataField:e.name,dataType:e.dataType})))),t._filterInfo.stringDataFields=[],t._columns=[],t.columnByDataField={},t.columns.canNotify=!1,t.columns instanceof Smart.ObservableArray){const e=[];for(let a=0;a<t.columns.length;a++){let l=t.columns[a],i={};for(let e in l)i[e]=l[e];e.push(i)}t.columns=e}for(let a=0;a<t.columns.length;a++){let l=t.columns[a];if("string"==typeof l&&t.dataSource.dataFields){const e=t.dataSource.dataFields.find((e=>{if(e.name===l)return e}));l={label:l,dataField:l,dataType:e&&e.dataType||"string"}}void 0===l.label&&void 0===l.dataField||(void 0===l.label&&(l.label=l.dataField),void 0===l.dataField&&(l.dataField=l.label),l.dataType||(l.dataType="string"),"string"!==l.dataType&&"number"!==l.dataType||!1===l.allowFilter||!l.dataField||t._filterInfo.stringDataFields.push(l.dataField),l.visible=void 0===l.visible||!!l.visible,l.allowResize=void 0===l.allowResize||!!l.allowResize,t._transformColumnDataField(l,e),l.thHierarchy=[],t._columns.push(l),t.columnByDataField[l.dataField]=l)}if("default"===t.columnSizeMode&&t.selection){let e=!0;for(let a=0;a<t._columns.length;a++){const l=t._columns[a];if(!l.width){e=!1,l._isResponsive=!0,l._isFillRemainingWidth=!0;break}}!t.columnResizeNormalize&&e&&t._columns.push({dataField:"",label:"",visible:!0,allowResize:!1,allowFilter:!1,allowSort:!1})}t.columns=new Smart.ObservableArray(t._columns),t._updateState("columns"),t.columns.notify((function(e){if(!t.columns.canNotify)return;if("length"===e.action||"update"===e.action&&-1!==["allowGroup","allowSort","sortOrder"].indexOf(e.propertyName))return void t._updateState("columns");const a=e.target;if("update"===e.action){const l=a.dataField;if("allowEdit"===e.propertyName)return Array.from(t.$.tableContainer.querySelectorAll(`td[data-field="${l}"]`)).forEach((t=>{t.classList.toggle("no-edit",!1===e.newValue),!1===e.newValue?t.setAttribute("aria-readonly",!0):t.removeAttribute("aria-readonly")})),void t._updateState("columns");if("allowFilter"===e.propertyName)return"string"!==a.dataType&&"number"!==a.dataType||!l||(!1===e.newValue?t._filterInfo.stringDataFields=t._filterInfo.stringDataFields.filter((e=>e!==l)):!1===e.oldValue&&t._filterInfo.stringDataFields.push(l)),t.filterRow&&t.$.tableContainer.querySelector(`.smart-table-filter-row td[filter-for="${l}"]`).classList.toggle("no-filter",!1===e.newValue),"smart-pivot-table"===t.nodeName.toLowerCase()&&t._columnNotify(e),void t._updateState("columns");if("transform"===e.propertyName)a.sortOrder&&t.sortBy(a.dataField,null),t._transformColumnDataField(a,!0);else{if(-1!==["allowPivot","allowRowGroup","pivot","rowGroup","summary"].indexOf(e.propertyName)&&"smart-pivot-table"===t.nodeName.toLowerCase())return t._columnNotify(e),void t._updateState("columns");if("visible"===e.propertyName){const e=t._expandedRowDetailIds,a=t.$.tableContainer;let l;return t.filterRow&&(l=a.querySelector(".smart-table-filter-row"),l&&l.remove()),e&&e.length&&!t._columns.some((e=>e.visible))&&e.forEach((e=>t._toggleRowDetail(a.querySelector(`[row-id="${e}"]`),e))),t.$.tableContainer.setAttribute("aria-colcount",t._columns.filter((e=>e.visible)).length+ +t.selection),t.refresh(),void t._updateState("columns")}}}"add"===e.action&&(t.columns[t.columns.length-1].visible=!0),t._columns=t.columns._array,t.columnByDataField=[],t._columns.forEach((e=>{t.columnByDataField[e.dataField]=e,e.originalDataField&&(t.columnByDataField[e.originalDataField]=e)})),t.refresh(!0),t._updateState("columns")})),t.$.tableContainer.setAttribute("aria-colcount",t._columns.filter((e=>e.visible)).length+ +t.selection)}_transformColumnDataField(e,t){const a=this;if("function"==typeof e.transform){if(!a.isRendered||t){const l=a.dataSource,i=a.columns.canNotify;i&&(a.columns.canNotify=!1),t&&e.originalDataField&&(delete a.columnByDataField[e.dataField],e.dataField=e.originalDataField);const n=e.dataField,r=n+"Transformed";a.columnByDataField[n]=e,e.originalDataField=n,e.dataField=r,l.canNotify=!1;for(let t=0;t<l.length;t++){const a=l[t];a[r]=e.transform(a[n])}i&&(a.columns.canNotify=!0),l.canNotify=!0}}else e.transform&&(e.transform=void 0)}_initRows(){const e=this,t=e.dataSource,a=e.context;if(e.context=e,e.rows=[],e.rowById=[],t.virtualDataSource)return e._initRowsVirtualDataSource(),void(e.context=a);if(t.boundHierarchy)return e.$.tableContainer.setAttribute("role","treegrid"),e.setAttribute("hierarchy",""),e._initHierarchicalRows(),void(e.context=a);e.$.tableContainer.setAttribute("role","grid");let l=0,i=t.length,n=!1;if(e.removeAttribute("hierarchy"),e.paging){const a=e.pageSize;if(e._filterInfo.query||e._filterInfo.rowFilters||e._filterInfo.appliedFilters){let e=0;for(let a=0;a<i;a++)!1!==t[a].$.filtered&&e++;i=e,n=!0}const r=Math.max(Math.ceil(i/a),1);e.$.pager.pagesCount=r,e.$.pager.totalRecords=i,e.pageIndex=Math.max(Math.min(e.pageIndex,r-1),0),l=e.pageIndex*a,i=l+a}if(n){let a=-1;for(let n=0;n<t.length;n++){const r=t[n];if(r&&!1!==r.$.filtered){if(a++,a<l)continue;if(a>=i)break;e._addNewRow(r,n)}}}else for(let a=l;a<i;a++){const l=t[a];l&&!1!==l.$.filtered&&e._addNewRow(l,a)}e._observeRows(),e.context=a}_initRowsVirtualDataSource(){const e=this,t=e.dataSource;if(t.boundHierarchy)e.$.tableContainer.setAttribute("role","treegrid"),e.setAttribute("hierarchy",""),e._processHierarchy(t.boundHierarchy,0,t.boundHierarchy.length);else for(let a=0;a<t._dataSource.length;a++){const l=t[a];l&&!1!==l.$.filtered&&e._addNewRow(l,a)}if(e.paging){const a=t.length,l=e.pageSize,i=Math.max(Math.ceil(a/l),1),n=e.$.pager.pagesCount;if(e.$.pager.pagesCount=i,e.$.pager.totalRecords=a,e.pageIndex=Math.max(Math.min(e.pageIndex,i-1),0),null!==n&&n!==i)return void e._fullRefresh()}e._observeRows()}_initHierarchicalRows(){const e=this,t=e.dataSource.boundHierarchy;let a=0,l=t.length,i=!1;if(e.paging){const n=e.pageSize;if(e._filterInfo.query||e._filterInfo.rowFilters||e._filterInfo.appliedFilters){let e=0;for(let a=0;a<l;a++)!1!==t[a].$.filtered&&e++;l=e,i=!0}const r=Math.max(Math.ceil(l/n),1);e.$.pager.pagesCount=r,e.$.pager.totalRecords=l,e.pageIndex=Math.max(Math.min(e.pageIndex,r-1),0),a=e.pageIndex*n,l=a+n}if(i){let i=-1;for(let n=0;n<t.length;n++){const r=t[n];if(r&&!1!==r.$.filtered){if(i++,i<a)continue;if(i>=l)break;e._processHierarchy(t,n,n+1)}}}else e._processHierarchy(t,a,l);e._observeRows()}_processHierarchy(e,t,a){const l=this;for(let i=t;i<a;i++){const t=e[i];if(!t)break;t.leaf?t&&!1!==t.$.filtered&&l._addNewRow(t,i):(-1!==l._expandedIds.indexOf(t.$.id)?t.expanded=!0:void 0===t.expanded&&(t.expanded=!1),!1!==t.$.filtered&&l._addNewRow(t,i),t.children.length&&!1!==t.$.filtered&&l._processHierarchy(t.children,0,t.children.length))}}_observeRows(){const e=this;e.rows=new Smart.ObservableArray(e.rows),e.rows.notify((function(t){if(!e.rows.canNotify||t.path||!e.dataSource)return;e.rows.canNotify=!1;const a=t.action,l=e._selectedIds.slice(0);switch(e.dataSource.canNotify=!1,a){case"add":{const a={};e.dataSource.dataFields.forEach((e=>a[e.name]=""));const l=Object.assign(a,e.rows[t.index]);e.dataSource.add(e.rows[t.index]),e._editing={row:{data:l}};break}case"update":e.dataSource.update(t.index,e.rows[t.index]),e._editing={row:{data:e.rows[t.index]}};break;case"remove":{const a=t.removed[0].data,l=a.$.id,i=e._selectedIds.indexOf(l);e.dataSource.removeAt(a.$.index),delete e.rowById[l],-1!==i&&e._selectedIds.splice(i,1),e._editing={row:t.removed[0]},e._updateSelectAllState();break}}e._fullRefresh(a,l,a),delete e._editing,e.dataSource.canNotify=!0,e.rows.canNotify=!0}))}beginUpdate(){const e=this;if("smart-table"!==e.nodeName.toLowerCase())return;e.__updating=!0,e.__updatedRows=!1;const t=window.__karma__||window.karma;document.hidden&&!t||(e._dirtyHierarchy=!1,e.__updatingOldSelectedIds=e._selectedIds.slice(0),e.__updatingSortColumns=e._sortColumns,e.dataSource&&e.dataSource.clearSort&&e.dataSource.clearSort())}endUpdate(e,t){const a=this;if("smart-table"!==a.nodeName.toLowerCase())return;a.__updating=!1;const l=window.__karma__||window.karma;if(document.hidden&&!l)return;if(!1===e)return;l&&(t=!0);const i=()=>{const t=a.__updatingOldSelectedIds?a.__updatingOldSelectedIds:a._selectedIds.slice(0);a.__updatingOldSelectedIds&&delete a.__updatingOldSelectedIds,a._dirtyHierarchy&&a.dataSource.refreshHierarchy();const l=a._sortColumns,i=a._filterInfo,n=a.dataSource.groupBy._array.slice(0),r=void 0!==a.$.virtualizationContainer&&a.$.virtualizationContainer.$?a.$.virtualizationContainer.$.verticalScrollBar:null;if(r&&r.beginUpdate(),a._doNotFireEvent=!0,a._fullRefresh("update",t,"update"),n.length>0){let e=a._getExpandedGroups(a.dataSource.boundHierarchy);a._dirtyHierarchy&&(e=a._dirtyHierarchy),n.forEach((e=>a.addGroup(e))),a._restoreExpandedGroups(e)}i.inputFilters?a._filterByAll(i.query):i.rowFilters?a._applyRowFilters():i.appliedFilters&&a._refreshFilters(),l&&(a.__updatingSortColumns&&JSON.stringify(a.__updatingSortColumns)!==JSON.stringify(l)||0===n.length||!0===e||!1===a.__updatedRows)&&(a._sortColumns=[],l.forEach((e=>{a.columnByDataField[e.dataField].sortOrder=null,a.sortBy(e.dataField,e.direction)}))),r&&(r.endUpdate(),a._onVerticalChange({detail:{value:r.value}},!0),a._dirtyHierarchy&&(a._rowsInDOM.length<a.rows.length&&0===a.$.virtualizationContainer.$.verticalScrollBar.max&&a._refreshDataRows(),a._dirtyHierarchy=!1)),delete a._doNotFireEvent};if(a._verticalScrollTimer)return a._scheduleUpdate&&clearInterval(a._scheduleUpdate),void(a._scheduleUpdate=setInterval((function(){a._verticalScrollTimer||(i(),clearInterval(a._scheduleUpdate),delete a._scheduleUpdate)}),100));t?i():requestAnimationFrame((()=>{i()}))}_addNewRow(e,t){const a=this,l=e.$.id,i=new Smart.Observable({data:e,boundIndex:t});-1!==a._disabledSelection.indexOf(l)&&(i.allowSelect=!1),i.canNotify=!0,i.notify((function(t){if(a._editing||a._hierarchyChange)return;const i=a.selection;if("allowSelect"===t.propertyName){const n=a._disabledSelection.indexOf(l);if(a._hierarchyChange=!0,t.newValue||-1!==n)t.newValue&&-1!==n&&function e(t){const l=t.$.id,n=a.$.tableContainer.querySelector(`[row-id="${l}"]:not([unused])`),r=a.rowById[l];if(t.parent&&-1!==a._disabledSelection.indexOf(t.parent.$.id))r.allowSelect=!1;else if(a._disabledSelection.splice(a._disabledSelection.indexOf(l),1),n&&(n.classList.remove("disable-select"),i&&(n.setAttribute("aria-selected",!1),n.firstElementChild.firstElementChild.removeAttribute("aria-disabled"))),r&&(r.allowSelect=!0),t.children)for(let a=0;a<t.children.length;a++)e(t.children[a])}(e);else{const t=[];!function e(t,l){const n=t.$.id,r=a.$.tableContainer.querySelector(`[row-id="${n}"]:not([unused])`),o=a.rowById[n];if(l.push(n),r&&(r.removeAttribute("aria-selected"),r.classList.add("disable-select"),i&&r.firstElementChild.firstElementChild.setAttribute("aria-disabled",!0)),o&&(o.allowSelect=!1),t.children)for(let a=0;a<t.children.length;a++)e(t.children[a],l)}(e,t),a._disabledSelection=a._disabledSelection.concat(t),a.unselect(t)}delete a._hierarchyChange}})),a.rowById[l]=i,a.rows.push(i)}refresh(){const e=this;if(e.__updating)return;const t=e._columns.filter((e=>e.visible)),a=e.$.tableContainer,l=a.querySelector(".smart-table-filter-row"),i=a.querySelector("tfoot"),n=document.createElement("tbody"),r=e._getFractionOfMax(),o=e.virtualization?e.$.virtualizationContainer:e.$.tableContainer.parentElement,s={top:o.scrollTop,left:o.scrollLeft};for(e.columns.canNotify=!1;a.childNodes.length>0;)a.childNodes[0].remove();e._createTableHeader(),e.isRendered||!e.onInit||e._loadingState||e.onInit(),e._createCustomHeaderRow(),e._createFooterRow(i),e._createDataRows(n),e._createFilterRow(l);const d=a.querySelectorAll("th[data-field]");for(let a=0;a<t.length;a++){const l=t[a];l.headerCellElement=d[a],l.headerCellElement&&(l.headerCellElement.onclick=function(){const t=this.dataField;e.$.fireEvent("columnClick",{dataField:t}),e.closeColumnMenu(),"none"===e.sortMode||!1===l.allowSort||e._preventClickSort||(e._addSortIconContainer(this),e._sortOnClick=!0,this.headerCellElement.sortIconContainerElement.classList.contains("asc")?e.sortBy(t,"desc"):this.headerCellElement.sortIconContainerElement.classList.contains("desc")?e.sortBy(t,null):e.sortBy(t,"asc"),e._sortOnClick=!1)}.bind(l))}if(e._sortColumns&&e._sortColumns.length>0)for(let t=0;t<e._sortColumns.length;t++){const a=e._sortColumns[t],l=e.columnByDataField[a.dataField];e._addSortIconContainer(l,a.direction,t+1)}e._handleAutoSizeMode(),e._handleFrozenColumnPositions(),e._refreshHorizontalScrollbar(),e.isRendered&&(e.selection&&e._updateSelectAllState(),e._setFractionOfMax(r)),[o.scrollTop,o.scrollLeft]=[s.top,s.left],e.columns.canNotify=!0}_createTableHeader(){const e=this,t=e.selection,a=document.createElement("thead"),l=e._columns.filter((e=>e.visible)),i=e._getColumnHeaderStructure(),n=window.innerWidth,r={};for(let o=0;o<i;o++){const s=document.createElement("tr"),d=document.createDocumentFragment();t&&(s.innerHTML=o<i-1?'<th class="empty"></th>':'<th class="smart-table-select-all freeze-near" scope="col" aria-colindex="1"><div role="checkbox" aria-checked="false" aria-label="Toggle selection of all rows"></div></th>',e.virtualization&&Smart.Utilities.Core.Browser.Safari&&s.querySelector("th").classList.add("sticky")),o<i-1&&s.classList.add("column-groups-header");for(let a=0;a<l.length;a++){const s=l[a];if(0===o&&(s.width&&isNaN(parseFloat(s.width))&&delete s.width,s.responsivePriority&&("number"!=typeof s.responsivePriority&&(s.responsivePriority=1),s.responsivePriority=Math.max(Math.min(Math.round(s.responsivePriority),5),1),i>1&&(r[a]=e._isColumnHidden(s.responsivePriority,n)))),o<i-1){if(r[a])continue;const t=l[a],i=t.headerStructure[o];if(a>0){let r=a-1,s=l[r];for(;s&&e._isColumnHidden(s.responsivePriority,n);)r--,s=l[r];if(s&&i===s.headerStructure[o]&&e._areColumnsWithSameFreezeSettings(t,s))continue}const s=document.createElement("th");if(s.includes=[t],a<l.length-1){let r=1,d=a+1,c=l[d];for(;c;){if(!e._isColumnHidden(c.responsivePriority,n)){if(i!==c.headerStructure[o]||!e._areColumnsWithSameFreezeSettings(t,c))break;r++,s.includes.push(c)}d++,c=l[d]}s.colSpan=r}0!==o&&t.headerStructure[o-1]===i||(s.textContent=i),s.includes.forEach((e=>e.thHierarchy[o]=s)),s.classList.add("column-header"),t.freeze&&s.classList.add("freeze-"+("far"===t.freeze?"far":"near")),e.virtualization&&Smart.Utilities.Core.Browser.Safari&&s.classList.add("sticky"),d.appendChild(s)}else e._setupColumnHeaderCell(t,d,a,s)}s.appendChild(d),a.appendChild(s),e._tableHeader=a}if(e.$.tableContainer.appendChild(a),"default"===e.columnSizeMode){for(let t=0;t<e.columns.length;t++){const l=e.columns[t];if(!l.width){const t=a.querySelector('[data-field="'+l.dataField+'"]');t&&t.offsetWidth<5&&(t.style.width=parseInt(l.minWidth||e.columnMinWidth)+"px")}}if(t){const t=e.columns.filter((e=>e.visible));if(1===t.length){const e=t[0],l=a.querySelector('[data-field="'+e.dataField+'"]');l&&(l.style.width="")}}}}_getColumnHeaderStructure(){const e=this._columns,t=this.columnGroups;if(!t)return 1;let a=1;for(const l of e){let e=l.columnGroup;if(l.headerStructure=[],e&&(e=t.find((t=>t.name===e)),e))for(l.headerStructure.push(e.label||e.name);e.parentGroup&&(e=t.find((t=>t.name===e.parentGroup)),e);)l.headerStructure.unshift(e.label||e.name);l.headerStructure.push(l.label),a=Math.max(a,l.headerStructure.length)}for(const t of e){const e=t.headerStructure,l=e[0];for(;e.length<a;)e.unshift(l)}return a}_isColumnHidden(e,t){return!(!e||1===e||t>1280)&&(t<=640&&2===e||t<=800&&3===e||t<=1024&&4===e||t<=1280&&5===e)}_areColumnsWithSameFreezeSettings(e,t){return!e.freeze&&!t.freeze||e.freeze===t.freeze||!0===e.freeze&&"near"===t.freeze||"near"===e.freeze&&!0===t.freeze}getColumnProperty(e,t){const a=this,l=a.columnByDataField[e];if(!l)return null;switch(t){case"width":return l.width?a._getColumnWidth(l.width,!0,l):l._isResponsive&&l._manualPercentageWidth?a._getColumnWidth(l._manualPercentageWidth+"%",!0,l):a._getColumnWidth(l._manualWidth,!0,l);default:return l[t]}}setColumnProperty(e,t,a){const l=this;if(!l.columnByDataField[e])return null;l.columns.forEach(((i,n)=>{i.dataField===e&&(l.columns[n][t]=a)}))}_getTableRemainingWidth(){const e=this;let t=e.offsetWidth;if(e.selection){const a=e.$.tableContainer.querySelector(".smart-table-select-all");a&&(t=e.offsetWidth-a.offsetWidth),""===e.columns[e.columns.length-1].dataField&&(t-=e.columnMinWidth)}e.virtualization&&e.$.virtualizationContainer&&e.$.virtualizationContainer.computedVerticalScrollBarVisibility&&(t-=20);let a=0;for(let t=0;t<e.columns.length;t++){const l=e.columns[t];l.visible&&l.width&&!(""+l.width).endsWith("%")&&(a+=e._getColumnWidth(l.width))}return t-=a,t}_getColumnWidth(e,t,a){const l=this,i=parseFloat(e);if((e=(e+"").trim()).endsWith("%")){let e=l.offsetWidth;if(l.selection){const t=l.$.tableContainer.querySelector(".smart-table-select-all");t&&(e=l.offsetWidth-t.offsetWidth),""===l.columns[l.columns.length-1].dataField&&(e-=l.columnMinWidth)}l.virtualization&&l.$.virtualizationContainer&&l.$.virtualizationContainer.computedVerticalScrollBarVisibility&&(e-=20);let n=0;for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.visible&&t.width&&!(""+t.width).endsWith("%")&&(n+=l._getColumnWidth(t.width))}e-=n;const r=a&&a.minWidth||l._getNumericMinWidth(),o=t?i+"%":e*(i/100);return r>o?r:o}return isNaN(i)?"auto":t?i+"px":i}_setupColumnHeaderCell(e,t,a,l){const i=this,n=document.createElement("th");if(n.setAttribute("aria-colindex",a+1+ +e),l.width){let e=l.width;"number"==typeof e&&l.minWidth&&(e=Math.max(e,l.minWidth)),n.style.width=i._getColumnWidth(e,!0,l)}else l._manualWidth&&(l._isResponsive?n.style.width=l._manualPercentageWidth+"%":n.style.width=l._manualWidth+"px");if(1!==i._columns.length&&l.allowResize||n.setAttribute("locked",""),l.freeze&&n.classList.add("freeze-"+("far"===l.freeze?"far":"near")),l.responsivePriority&&n.classList.add("priority-"+l.responsivePriority),i.virtualization&&Smart.Utilities.Core.Browser.Safari&&n.classList.add("sticky"),n.setAttribute("data-field",l.dataField),n.innerHTML=`<div class="wrapper" role="presentation"><div class="label">${l.label}</div></div>`,i.columnMenu){const e=document.createElement("div");e.classList.add("column-menu"),e.setAttribute("aria-hidden",!0),n.firstElementChild.appendChild(e),e.onclick=e=>{i.activeColumnMenu&&i.activeColumnMenu.dataField===l.dataField?i.closeColumnMenu():i.openColumnMenu(l.dataField),e.preventDefault(),e.stopPropagation()}}i.onColumnRender&&i.onColumnRender(l.dataField,n),t.appendChild(n)}_refreshDataRows(){const e=this,t=window.scrollY,a=window.scrollX,l=e.$.tableContainer.children[1],i=Array.from(l.querySelectorAll("tr:not(.smart-table-filter-row)"));if(e._clearCachedTemplates(),e.filterRow||e.footerRow||e.headerRow)for(let e=0;e<i.length;e++)i[e].remove();else l.innerHTML="";e._createDataRows(l),e._handleAutoSizeMode(),e._handleFrozenColumnPositions(),e._refreshHorizontalScrollbar(),(a||t)&&window.scroll(a,t)}_createDataRows(e){const t=this;if(t.virtualization)return void t._createVirtualDataRows(e);const a=t.rowDetailTemplate,l=t.selection,i=document.createDocumentFragment(),n=t.hasAttribute("hierarchy");for(let e=0;e<t.rows.length;e++){const r=t.rows[e],o=r.data;o.groupDataField?t._createGroupHeader(o,i):t._createDataRow(r,i,{hierarchical:n,rowDetailTemplate:a,selection:l,virtualization:!1})}i.appendChild(t._createLastRow()),e.appendChild(i),t._updateState("expanded"),e.parentElement||t.$.tableContainer.insertBefore(e,t.$.tableContainer.querySelector("tfoot")),t.getRootNode().activeElement===t.$.tableContainer&&t._tableContainerFocusHandler()}_createDataRow(e,t,a){const l=this,i=l._columns.filter((e=>e.visible)),n=e.data,r=n.$.id,o=document.createElement("tr"),s={row:o,detail:null};let d=0;o.setAttribute("aria-rowindex",n.$.index+1),l._processAndRenderSelection(n,o,a.hierarchical),a.selection&&d++;for(let t=0;t<i.length;t++){const s=document.createElement("td"),c=i[t];s.setAttribute("data-field",c.dataField),s.setAttribute("aria-colindex",t+1+ +a.selection);let u,f=l._formatCellValue(e,c,s);if(c.freeze&&s.classList.add("freeze-"+("far"===c.freeze?"far":"near")),c.responsivePriority&&s.classList.add("priority-"+c.responsivePriority),!1===c.allowEdit&&(s.classList.add("no-edit"),s.setAttribute("aria-readonly",!0)),0===t&&a.hierarchical){const e=l._areChildrenFiltered(n);n.leaf||(s.classList.add("tree-cell"),u=e),n.level&&(s.classList.add("outline-level-"+Math.min(n.level,10)),!n.leaf&&e||s.classList.add("tree-leaf"))}if(a.virtualization&&c.templateElement){const e=c.templateElement+"";u&&l._setCellContent(s,f,u);const t=u?s.children[0].children[1]:s;e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+n[c.dataField]+"</div>"):t.innerHTML=e,c.templateElementSettings&&(l._cachedTemplates&&l._cachedTemplates[c.dataField+"_"+r]&&(0===l._cachedTemplates[c.dataField+"_"+r].innerHTML.length?delete l._cachedTemplates[c.dataField+"_"+r]:(t.innerHTML="",t.appendChild(l._cachedTemplates[c.dataField+"_"+r]))),c.templateElementSettings(n[c.dataField],r,t.firstElementChild),l._cachedTemplates||(l._cachedTemplates=[]),l._cachedTemplates[c.dataField+"_"+r]||(l._cachedTemplates[c.dataField+"_"+r]=t.firstElementChild))}else l._setCellContent(s,f,u);l.onCellRender&&l.onCellRender(n,c.dataField,n[c.dataField],s),l._applyConditionalFormattingToCell(s,c.dataField,n.$.index),o.appendChild(s),d++}if(o.data=n,o.setAttribute("row-id",r),-1!==l._disabledSelection.indexOf(r)&&(o.removeAttribute("aria-selected"),o.classList.add("disable-select"),a.selection&&o.firstElementChild.firstElementChild.setAttribute("aria-disabled",!0)),n.expanded?(-1===l._expandedIds.indexOf(r)&&l._expandedIds.push(r),o.setAttribute("aria-expanded",!0),o.classList.add("expanded")):!1===n.expanded&&o.setAttribute("aria-expanded",!1),n.level&&l._isCollapsed(n)&&(o.setAttribute("aria-hidden",!0),o.classList.add("collapsed","smart-hidden")),t.appendChild(o),a.rowDetailTemplate){const i=document.createElement("tr");if(-1===l._expandedRowDetailIds.indexOf(r)){if(a.virtualization)return s;i.setAttribute("aria-hidden",!0),i.classList.add("collapsed")}else s.detail=i;i.data=Object.assign(n,{detail:!0}),i.classList.add("smart-table-row-detail"),i.innerHTML=`<td colspan="${d}"><div class="smart-table-detail-container">${l._applyRowDetailTemplate(e)}</div></td>`,t.appendChild(i)}return s}_processAndRenderSelection(e,t,a,l){const i=this,n=e.$.id,r=i._getChildCheckState(e).state;if(a&&i.selectionByHierarchy){const e=i._selectedIds.indexOf(n);!0===r&&-1===e?i._selectedIds.push(n):r||-1===e||i._selectedIds.splice(e,1)}if(!i.selection)return;let o,s;l?(o=t.firstElementChild,s=o.firstElementChild):(o=document.createElement("td"),s=document.createElement("div")),s.className="selection-checkbox",s.setAttribute("role","checkbox"),s.setAttribute("aria-checked",!!r||null===r&&"mixed"),s.setAttribute("aria-label","Toggle row selection"),o.className="smart-table-select-row freeze-near"+(r?" selected":null===r?" indeterminate":""),o.setAttribute("aria-colindex",1),l||(o.appendChild(s),t.appendChild(o)),t.setAttribute("aria-selected",!0===r)}_applyConditionalFormattingToCell(e,t,a){const l=this;if(l._conditionalFormatting&&l._conditionalFormatting[t]){const i=l._conditionalFormatting[t][a];i&&(e.style.backgroundColor=i.background,e.style.color=i.color,e.style.fontFamily=i.fontFamily,e.style.fontSize=i.fontSize)}}_createLastRow(){const e=document.createElement("tr");e.setAttribute("aria-hidden",!0),e.classList.add("last-visible");try{new ResizeObserver((t=>{try{e.classList.toggle("sized",t[0].contentRect.height>0&&null!==e.previousSibling)}catch(e){}})).observe(e)}catch(e){}return e}_createGroupHeader(e,t,a){const l=this;l.columnByDataField[e.groupDataField]||console.error(l.localize("grouping"));const i=l.columnByDataField[e.groupDataField]?l.columnByDataField[e.groupDataField].label:`${l.localize("EMPTY")}`,n=a||document.createElement("tr"),r=document.createElement("td"),o=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div");let c=e.label;if(/<.+?>/.test(c)&&c.replace&&("all"===l.dataSourceSettings.sanitizeHTML?c=c.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===l.dataSourceSettings.sanitizeHTML&&(c=window.Smart.Utilities.Core.sanitizeHTML(c))),""!==c&&c||(c=`<em class="placeholder">${l.localize("EMPTY")}</em>`),n.removeAttribute("aria-rowindex"),n.data=e,s.classList.add("hierarchy-arrow","smart-arrow","smart-arrow-down"),s.setAttribute("role","button"),s.setAttribute("aria-label","Toggle row"),d.classList.add("group-label"),d.innerHTML=`<span class="group-label-name">${i}: </span>\n <span class="group-label-value">${c}</span>\n <span class="group-label-count">(${l._getLeafCount(e)})</span>`,r.colSpan=l._columns.filter((e=>e.visible)).length,r.classList.add("group-header"),e.level&&(r.classList.add("outline-level-"+Math.min(e.level,10)),l._isCollapsed(e)&&(n.setAttribute("aria-hidden",!0),n.classList.add("collapsed","smart-hidden"))),n.setAttribute("row-id",e.$.id),n.setAttribute("role","group"),n.setAttribute("aria-level",e.level),o.appendChild(s),o.appendChild(d),r.appendChild(o),l._processAndRenderSelection(e,n,!0),n.appendChild(r),n.setAttribute("aria-expanded",e.expanded),n.classList.toggle("expanded",e.expanded),e&&e.$&&!1===e.$.filtered&&n.classList.add("smart-hidden"),l.groupFormatFunction){const t={value:c,row:e.$.id,column:e.groupDataField,data:e,template:null};l.groupFormatFunction(t),c!==t.value&&(d.innerHTML=`<span class="group-label-name">${i}: </span>\n <span class="group-label-value">${t.value}</span>\n <span class="group-label-count">(${l._getLeafCount(e)})</span>`),t.template instanceof HTMLElement&&(d.innerHTML="",d.appendChild(t.template));const a=t.template;let n="";if(a&&a.startsWith("#")){const e=document.querySelector(a);let t=c;if(e&&e instanceof HTMLTemplateElement){const a=e.content.cloneNode(!0),l=document.createElement("div");l.appendChild(a),t=t.toString(),t=t.replace(/'/gi,"\\'"),t=t.replace(/"/gi,'\\"'),n=l.innerHTML.replace(/{{value}}/gi,t),n.indexOf("{{value=")>=0&&(t?(n=n.substring(0,n.indexOf("{{value="))+t+n.substring(n.indexOf("}")),n=n.replace(/}/gi,""),n=n.replace(/{/gi,"")):(n=n.replace(/{{value=/gi,""),n=n.replace(/}}/gi,""))),d.innerHTML=n}}else a&&"string"==typeof a&&(n=a.replace(/{{value}}/gi,c),d.innerHTML=n)}const u=l.selection?1:0;for(let e=0;e<l.columns.length;e++){const t=document.createElement("td"),a=l.columns[e];a.visible&&(t.setAttribute("data-field",a.dataField),t.setAttribute("aria-colindex",e+1+u),t.classList.add("smart-hidden"),n.appendChild(t))}return a||t.appendChild(n),n}_getLeafCount(e){let t=0;return function e(a){for(const l of a)l.leaf?t++:l.children&&l.children.length>0&&e(l.children)}(e.children),t}_isCollapsed(e){let t=e.parent;for(;t;){if(!t.expanded)return!0;t=t.parent}return!1}_areChildrenFiltered(e){if(!e.leaf){if(0===e.children.length&&this.dataSource.virtualDataSource)return!0;for(let t=0;t<e.children.length;t++)if(!1!==e.children[t].$.filtered)return!0;return!1}}_applyRowDetailTemplate(e){const t=this,a=t.dataSource.dataFields;let l=t.rowDetailTemplate;for(let i=0;i<a.length;i++){const n=a[i].name,r=new RegExp(`{{${n}}}`,"g");let o=t.columnByDataField[n]||{dataField:n};if(r.test(l)){let a=t._formatCellValue(e,o,document.createElement("td"));"string"!=typeof a&&(a=e.data[o.dataField]),l=l.replace(r,a)}}return l}_handleFrozenColumnPositions(){const e=this,t=e.rightToLeft,a=e._columns.filter((e=>e.visible));let l=[],i=[],n=0;function r(t,l,i,r,o){const s=a[l-n],d=[s.headerCellElement];for(const e of s.thHierarchy)e.includes[0].dataField===s.dataField&&d.push(e);Array.from(e.$.tableContainer.querySelectorAll(`td:nth-child(${l+1})`)).concat(d).forEach((e=>{e.style[t]=i+"px",o&&(e.style.zIndex=2+r)}))}e.selection&&(t?i.push(0):l.push(0),n=1);for(let e=0+n;e<a.length+n;e++){const r=a[e-n];r.freeze&&(!t&&"far"===r.freeze||t&&"far"!==r.freeze?i.push(e):l.push(e))}if(l.length<2&&i.length<2)return;const o=[];for(const e of a){let t=e.width;t||(t=e.headerCellElement.offsetWidth),e.minWidth&&(t=Math.max(e.minWidth,t)),o.push(t)}if(t){for(let e=0;e<l.length-1;e++){const t=l[e];let a=0;for(let e=t+1;e<o.length;e++)-1!==l.indexOf(e)&&(a+=o[e]);r("left",t,a,e,!0)}for(let e=1;e<i.length;e++){const t=i[e];let a=0;for(let e=0;e<t;e++)-1!==i.indexOf(e)&&(a+=o[e]);r("right",t,a,e,!1)}}else{for(let e=1;e<l.length;e++){const t=l[e];let a=0;for(let e=0;e<t;e++)-1!==l.indexOf(e)&&(a+=o[e]);r("left",t,a,e,!1)}for(let e=0;e<i.length-1;e++){const t=i[e];let a=0;for(let e=t+1;e<o.length;e++)-1!==i.indexOf(e)&&(a+=o[e]);r("right",t,a,e,!0)}}}_formatCellValue(e,t,a,l){const i=this;let n=e&&e.data?e.data.$.id:e;if(void 0===l&&(l=e.data[t.dataField]),"string"==typeof l&&l.indexOf(">")>=0&&/<.+?>/.test(l)&&l.replace&&("all"===i.dataSourceSettings.sanitizeHTML?l=l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===i.dataSourceSettings.sanitizeHTML&&(l=window.Smart.Utilities.Core.sanitizeHTML(l))),i._cellsWithFormulas){const e=t.dataField+":"+n;if("string"==typeof l&&/=.+/.test(l)){const t=i._formulaParser;i._cellsWithFormulas[e]=!0,t&&(l=t.parse(l.slice(1)))}else delete i._cellsWithFormulas[e]}if(t.formatFunction){const i={value:l,row:n,column:t.dataField,data:e.data,cell:a,template:null};if(t.formatFunction(i),l=i.value,i.template instanceof HTMLElement)return i.template;if(null===i.template||"string"!=typeof i.template)return l;const r=i.template;let o="";if(r.startsWith("#")){const e=document.querySelector(r);if(e&&e instanceof HTMLTemplateElement){const t=e.content.cloneNode(!0),a=document.createElement("div");return a.appendChild(t),l=(l=(l=l.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),o=a.innerHTML.replace(/{{value}}/gi,l),o.indexOf("{{value=")>=0&&(l?(o=o.substring(0,o.indexOf("{{value="))+l+o.substring(o.indexOf("}")),o=o.replace(/}/gi,""),o=o.replace(/{/gi,"")):(o=o.replace(/{{value=/gi,""),o=o.replace(/}}/gi,""))),o}}return o='<div class="smart-table-cell-template">'+r.replace(/{{value}}/gi,l)+"</div>",o}return"date"===t.dataType&&l instanceof Date?l.toLocaleDateString():l}_setCellContent(e,t,a){if(t instanceof HTMLElement==1){for(;e.childNodes.length>0;)e.childNodes[0].remove();if(a){const a=document.createElement("div");a.innerHTML='<div class="hierarchy-arrow smart-arrow smart-arrow-down" role="button" aria-label="Toggle row"></div><div></div>',a.children[1].appendChild(t),e.appendChild(a)}else e.appendChild(t)}else if(a)e.innerHTML=t=`<div>\n <div class="hierarchy-arrow smart-arrow smart-arrow-down" role="button" aria-label="Toggle row"></div>\n <div>${t}</div>\n </div>`;else if("string"==typeof t&&t.indexOf(">")>=0)if(/<.+?>/.test(t)||/&\S+;/.test(t)){if(e._content===t)return;e.innerHTML=t,e._content=t}else e.textContent!==t&&(e.textContent=t);else"html"===this.dataSourceSettings.sanitizeHTMLRender?e.innerHTML!==t&&(e.innerHTML=t):e.textContent!==t&&(e.textContent=t)}_dataBind(e){const t=this;if(t._cellsWithFormulas={},t.dataSource){if(t.dataSource instanceof Smart.DataAdapter==0){const e=t.dataSource;if(Array.isArray(e)){const a=t.columns;let l;if(e.length>0){const t=e[0];l=[];for(let e in t){const a=t[e];"number"==typeof a?l.push({name:e,dataType:"number"}):"boolean"==typeof a?l.push({name:e,dataType:"boolean"}):a instanceof Date?l.push({name:e,dataType:"date"}):a instanceof Object?l.push({name:e,dataType:"any"}):l.push({name:e,dataType:"string"})}}a&&a.length>0&&(l=l||[],a.forEach((e=>{if(e.dataType){const t=l.find((t=>t.name===e.dataField));t?t.dataType=e.dataType:e.map?l.find((t=>e.map.indexOf(t.name)>=0?t:null))&&l.push({name:e.dataField,map:e.map,dataType:e.dataType}):l.push({name:e.dataField,dataType:e.dataType})}}))),t.dataSourceSettings.dataFields&&t.dataSourceSettings.dataFields.length>0?t.dataSource=new Smart.DataAdapter({dataSource:t.dataSource,dataSourceType:t.dataSourceSettings.dataSourceType,dataFields:t.dataSourceSettings.dataFields,keyDataField:t.dataSourceSettings.keyDataField,parentDataField:t.dataSourceSettings.parentDataField,childrenDataField:t.dataSourceSettings.childrenDataField,groupBy:t.dataSourceSettings.groupBy,mapChar:t.dataSourceSettings.mapChar,root:t.dataSourceSettings.root,record:t.dataSourceSettings.record,autoGenerateColumns:t.autoGenerateColumns,id:t.dataSourceSettings.id||t.dataRowId,expandHierarchy:t.expandHierarchy,virtualDataSource:t.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:t.dataSourceSettings.virtualDataSourceOnExpand}):t.dataSource=new Smart.DataAdapter({dataSource:t.dataSource,dataFields:l,id:t.dataRowId||t.dataSourceSettings.id,dataSourceType:t.dataSourceSettings.dataSourceType,keyDataField:t.dataSourceSettings.keyDataField,parentDataField:t.dataSourceSettings.parentDataField,childrenDataField:t.dataSourceSettings.childrenDataField,groupBy:t.dataSourceSettings.groupBy,mapChar:t.dataSourceSettings.mapChar,root:t.dataSourceSettings.root,record:t.dataSourceSettings.record,autoGenerateColumns:t.autoGenerateColumns,expandHierarchy:t.expandHierarchy,virtualDataSource:t.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:t.dataSourceSettings.virtualDataSourceOnExpand})}else t.dataSource=new Smart.DataAdapter({dataSource:[],id:t.dataRowId,expandHierarchy:t.expandHierarchy})}}else{if(t.dataFields=[],!t.columns||Array.isArray(t.columns)&&0===t.columns.length){t.columns=[];const e=t.querySelectorAll("th");for(let a=0;a<e.length;a++){const l=e[a].innerHTML.trim();let i={label:l,dataField:l,dataType:"string"};t.columns.push(i),t.dataFields.push(l)}}else for(let e=0;e<t.columns.length;e++){const a=t.columns[e];"string"==typeof a?t.dataFields.push(a):"object"==typeof a&&t.dataFields.push(a.dataField+(a.dataType?": "+a.dataType:""))}let e=[];if(!t.rows){const a=t.querySelectorAll("tr");for(let l=0;l<a.length;l++){const i={},n=a[l].querySelectorAll("td");if(n.length>0){for(let e=0;e<t.columns.length;e++)i[t.columns[e].dataField]=n[e].innerHTML.trim();e.push(i)}}t.dataSource=new Smart.DataAdapter({dataSource:e,expandHierarchy:t.expandHierarchy,dataFields:t.dataFields,id:t.dataRowId})}const a=t.$.container.querySelectorAll("table");a.length>1&&a[a.length-1].parentNode.removeChild(a[a.length-1])}t.dataSource.expandHierarchy=t.expandHierarchy,t._transformDataSource(),t._applyInitialConditionalFormatting(t.dataSource),t._initColumns(e),t._initRows(),t.dataSource.notify((function(e){if(t.dataSource._updating)return void delete t.dataSource._updating;if(t._editing)return;const a=e.data,l=t._selectedIds.slice(0);let i=e.action;switch(t.rows.canNotify=!1,e.action){case"add":if(a.length)for(let e=0;e<a.length;e++)t._addNewRow(a[e],t.dataSource.length-a.length+e);else t._addNewRow(a,t.dataSource.length-1);break;case"update":if(a.length)for(let l=0;l<a.length;l++){const i=e.index[l];t.rows[i].data=a[l]}break;case"insert":t._addNewRow(a,e.index);for(let e=0;e<t.rows.length;e++)t.rows[e].dataIndex=e;break;case"remove":case"removeLast":i="remove",function(e){const a=e.$.id,l=t._selectedIds.indexOf(a);delete t.rowById[a],t.rows.splice(e.$.index,1),-1!==l&&t._selectedIds.splice(l,1)}(a);break;case"bindingComplete":if(t.filtering&&t.filterRow){const e=t._filterInfo;e.inputFilters?t._filterByAll(e.query):e.rowFilters?t._applyRowFilters():e.appliedFilters&&t._refreshFilters()}}t.rows.canNotify=!0,this.refreshHierarchy(),t._fullRefresh(void 0,l,i)})),t.refresh(),t.dataSource.virtualDataSource&&(t.paging=!0,t._requestVirtualDataSource("dataBind")),t.$.tableContainer.setAttribute("aria-rowcount",t.dataSource.length)}_requestVirtualDataSource(e,t,a=null){const l=this,i=l.pageSize,n=Math.max(l.pageIndex*i,0),r=n+i,o=[],s=[],d={};let c=null;if(l.dataSource._updating=!0,l._sortColumns&&(l._sortColumns.forEach(((e,t)=>o[e.dataField]={sortOrder:e.direction,sortIndex:t})),o.length=l._sortColumns.length),l._filterInfo.appliedFilters){for(let e in l._filterInfo.appliedFilters)s[e]=l._filterInfo.appliedFilters[e];s.length=Object.keys(l._filterInfo.appliedFilters).length,c="and"}else{const e=l._filterInfo.inputFilters||l._filterInfo.rowFilters;e&&(e.forEach((e=>s[e[0]]=e[1])),s.length=e.length),c=l._filterInfo.inputFilters?"or":"and"}l._editing&&(d.row=l._editing.row.data),l.$.loadingIndicatorContainer.classList.remove("smart-hidden"),l.setAttribute("loading",""),l.dataSource.onVirtualDataSourceRequested((function(i){let n=!0;-1!==["add","update","remove"].indexOf(e)&&t&&(n=t(i.result)),l.$.loadingIndicatorContainer.classList.add("smart-hidden"),l.removeAttribute("loading"),n&&(a&&(a.expanded=!0),l._initRows(),l._refreshDataRows())}),{first:n,last:r,sorting:o,filtering:s,filterOperator:c,grouping:[],edit:d,row:a,action:e})}sortBy(e,t){const a=this,l=a.columnByDataField[e];if(l){if(!1===l.allowSort)return;e=l.dataField}if(a._sortBy({column:l,columnDataField:e,sortOrder:t,dataFields:a.dataSource.dataFields,columnByDataField:"columnByDataField"}),null===e){const e=!0===a._sortOnClick?"interaction":"programmatic";a.$.fireEvent("sort",{columns:[],sortDataFields:[],sortOrders:[],sortDataTypes:[],type:e})}}_sortBy(e){const t=this,a=e.column,l=e.columnDataField,i=e.sortOrder,n=e.dataFields,r=e.columnByDataField,o=[],s=[],d=[],c=function(e){t._addSortIconContainer(e),e.headerCellElement&&(e.headerCellElement.removeAttribute("aria-sort"),e.headerCellElement.sortIconContainerElement.classList.remove("desc"),e.headerCellElement.sortIconContainerElement.classList.remove("asc")),e.sortOrder=null},u=function(){if(t._sortColumns&&t._sortColumns.length>0)for(let e=0;e<t._sortColumns.length;e++){const a=t._sortColumns[e],l=t[r][a.dataField];c(l)}t._sortColumns=[]};if(null==a)return void(t._sortColumns&&t._sortColumns.length>0&&(u(),t._sortCallback(o,s,d),t._updateState("sorted")));if("none"===t.sortMode||!t.dataSource)return;if(i&&a.sortOrder===i)return;let f=i||"asc";null===i&&(f=null),c(a),t._sortColumns||(t._sortColumns=[]);let m="string";for(let e=0;e<n.length;e++){const t=n[e];if(t.name===l){m=t.dataType,"any"===m&&(m="number");break}}let h=!0;for(let e=0;e<t._sortColumns.length;e++){const n=t._sortColumns[e];if(n.dataField===l)if(h=!1,null===f&&(n.direction="desc"),"asc"===n.direction)n.direction="desc",f="desc";else if("desc"===n.direction){t._sortColumns.splice(e,1),c(a),f=i;break}}h&&("one"===t.sortMode&&u(),t._sortColumns.push({dataField:l,direction:f,dataType:m})),t._addSortIconContainer(a),null!==f?(a.headerCellElement&&(a.headerCellElement.sortIconContainerElement.classList.remove("asc"),a.headerCellElement.sortIconContainerElement.classList.remove("desc")),a.sortOrder=f,a.headerCellElement&&("desc"===f?(a.headerCellElement.sortIconContainerElement.classList.add("desc"),a.headerCellElement.setAttribute("aria-sort","descending")):(a.headerCellElement.sortIconContainerElement.classList.add("asc"),a.headerCellElement.setAttribute("aria-sort","ascending")))):a.headerCellElement&&(a.headerCellElement.sortIconContainerElement.classList.remove("asc"),a.headerCellElement.sortIconContainerElement.classList.remove("desc"),a.headerCellElement.removeAttribute("aria-sort"));for(let e=0;e<t._sortColumns.length;e++){const a=t._sortColumns[e],l=t[r][a.dataField];o.push(a.dataField),s.push(a.direction),d.push(a.dataType),l.headerCellElement&&l.headerCellElement.sortIconContainerElement.setAttribute("order",e+1)}if(t._sortCallback(o,s,d),t._updateState("sorted"),!t._doNotFireEvent){const e=!0===t._sortOnClick?"interaction":"programmatic";t.$.fireEvent("sort",{columns:t._sortColumns,sortDataFields:o,sortOrders:s,sortDataTypes:d,type:e})}}_addSortIconContainer(e,t,a){const l=e.headerCellElement;if(l&&!l.sortIconContainerElement){const e=document.createElement("div");e.classList.add("sort-by"),e.setAttribute("aria-hidden",!0),t&&e.classList.add(t),l.firstElementChild.appendChild(e),l.sortIconContainerElement=e,"asc"===t?l.setAttribute("aria-sort","ascending"):"desc"===t?l.setAttribute("aria-sort","descending"):l.removeAttribute("aria-sort"),void 0!==a&&e.setAttribute("order",a)}}_sortCallback(e,t,a){const l=this,i=l.dataSource;if(!i.virtualDataSource){let n=null;for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.sort&&(n||(n={}),n[t.dataField]=t.sort)}i._sort(l.dataSource.boundSource,e,t,a,l.sort,n);let r=[],o=[];if(i.groupBy&&i.groupBy.toArray&&(r=i.groupBy.toArray().slice(0)),r.length>0&&(o=l._getExpandedGroups(i.boundHierarchy)),i.refreshHierarchy(),r.length>0){const e=l._doNotFireEvent;l._doNotFireEvent=!0,l._restoreExpandedGroups(o),l._doNotFireEvent=e}}l._fullRefresh("sort")}clearSort(){this.sortBy(null)}_fullRefresh(e,t,a,l){const i=this;if(i.__updating)return;if(i.dataSource.virtualDataSource)return void i._requestVirtualDataSource(e,l);const n=i._getFractionOfMax();t||(t=i._selectedIds.slice(0)),t=JSON.stringify(t.sort()),i._initRows(),i._refreshDataRows(),i._setFractionOfMax(n),"filter"===e&&(i._updateSelectAllState(),a||(a="filter")),t!==JSON.stringify(i._selectedIds.slice(0).sort())&&("filter"!==e&&i._updateSelectAllState(),i._updateState("selected"),i.$.fireEvent("change",{type:a})),"string"==typeof e&&-1!==e.indexOf("page")&&i._fixFrozenHeaderFirefox()}_pagerChangeHandler(e){const t=this;(t.isInShadowDOM?e.composedPath()[0]:e.target)===t.$.pager&&(t.pageIndex=e.detail.index,t._fullRefresh("pageIndexChange"),t.$.fireEvent("page",{action:"pageIndexChange"}))}_pagerPageSizeChanged(e){const t=this;t.pageSize=e.detail.value,t._fullRefresh("pageSizeChange"),t.$.fireEvent("page",{action:"pageSizeChange"})}_filterInputKeyupHandler(){const e=this;clearTimeout(e._filterInputTimeout),e._filterInputTimeout=setTimeout((function(){if(e._filterInfo&&e.$.filterInput.value!==e._filterInfo.query){const t=e.context;e.context=e,e._filterByAll(e.$.filterInput.value),e.context=t}}),500)}_filterByAll(e){const t=this;if(t._filterInfo.query=e,""===e)return void t.clearFilters();const a=[];t._clearRowFilters(),delete t._filterInfo.appliedFilters,t._filterInfo.stringDataFields.forEach((t=>{const l=new Smart.Utilities.FilterGroup,i=l.createFilter("string",e,"CONTAINS");l.addFilter("or",i),a.push([t,l])})),t.dataSource.virtualDataSource||t.dataSource._filter(a,t.filterOperator),t._filterInfo.inputFilters=a,t._fullRefresh("filter"),t._updateState("filtered"),t._doNotFireEvent||t.$.fireEvent("filter",{action:"add",filters:a})}_setupPagingAndFiltering(){const e=this;e.$.pager.$.pageSizeSelector.classList.add("underlined"),e.$.pager.$.pageSizeSelector.dropDownAppendTo="body",e._filterInfo={query:""},e._applyFilterTemplate(),e.$.header.classList.toggle("smart-hidden",(!e.filtering||e.filterRow||e.columnMenu)&&!e.conditionalFormattingButton)}_applyFilterTemplate(){const e=this,t=e.filterTemplate;if(e.$.filterTemplateContainer.innerHTML="",!t)return e.$.filterInput.classList.remove("smart-hidden"),e.$.filterTemplateContainer.classList.add("smart-hidden"),void(e.filterTemplate=null);const a=document.getElementById(t);if(a&&a instanceof HTMLTemplateElement){const t=document.importNode(a.content,!0);e.$.filterInput.classList.add("smart-hidden"),e.$.filterTemplateContainer.classList.remove("smart-hidden"),e.$.filterTemplateContainer.appendChild(t)}else e.filterTemplate=null,e.$.filterInput.classList.remove("smart-hidden"),e.$.filterTemplateContainer.classList.add("smart-hidden")}_refreshFilters(e){const t=this,a=[];for(let e in t._filterInfo.appliedFilters){let l=t._filterInfo.appliedFilters[e];a.push([e,l])}0!==a.length?(t._clearFilterInput(),t._clearRowFilters(),t.dataSource.virtualDataSource||t.dataSource._filter(a,t.filterOperator),t._fullRefresh("filter"),t._updateState("filtered"),e&&!t._doNotFireEvent&&t.$.fireEvent("filter",{action:e,filters:a})):t.clearFilters()}_localize(){const e=this,t=e.$.pager;t.messages[e.locale]||(t.messages[e.locale]={}),t.messages[e.locale].pageSizeLabel=e.localize("itemsPerPage"),t.messages[e.locale].summaryPrefix=e.localize("summaryPrefix"),t.messages[e.locale].summarySuffix="",t.$.firstButton.setAttribute("tooltip",e.localize("firstButton")),t.$.previousButton.setAttribute("tooltip",e.localize("previousButton")),t.$.nextButton.setAttribute("tooltip",e.localize("nextButton")),t.$.lastButton.setAttribute("tooltip",e.localize("lastButton")),e.$.filterInput.placeholder=e.localize("filterPlaceholder"),e.$.conditionalFormattingButton.setAttribute("tooltip",e.localize("conditionalFormatting")),e._filterInfo.stringConditions=[{value:"EMPTY",label:e.localize("EMPTY")},{value:"NOT_EMPTY",label:e.localize("NOT_EMPTY")},{value:"CONTAINS",label:e.localize("CONTAINS")},{value:"CONTAINS_CASE_SENSITIVE",label:e.localize("CONTAINS_CASE_SENSITIVE")},{value:"DOES_NOT_CONTAIN",label:e.localize("DOES_NOT_CONTAIN")},{value:"DOES_NOT_CONTAIN_CASE_SENSITIVE",label:e.localize("DOES_NOT_CONTAIN_CASE_SENSITIVE")},{value:"STARTS_WITH",label:e.localize("STARTS_WITH")},{value:"STARTS_WITH_CASE_SENSITIVE",label:e.localize("STARTS_WITH_CASE_SENSITIVE")},{value:"ENDS_WITH",label:e.localize("ENDS_WITH")},{value:"ENDS_WITH_CASE_SENSITIVE",label:e.localize("ENDS_WITH_CASE_SENSITIVE")},{value:"EQUAL",label:e.localize("EQUAL")},{value:"EQUAL_CASE_SENSITIVE",label:e.localize("EQUAL_CASE_SENSITIVE")},{value:"NULL",label:e.localize("NULL")},{value:"NOT_NULL",label:e.localize("NOT_NULL")}],e._filterInfo.numberAndDateConditions=[{value:"EQUAL",label:e.localize("EQUAL")},{value:"NOT_EQUAL",label:e.localize("NOT_EQUAL")},{value:"LESS_THAN",label:e.localize("LESS_THAN")},{value:"LESS_THAN_OR_EQUAL",label:e.localize("LESS_THAN_OR_EQUAL")},{value:"GREATER_THAN",label:e.localize("GREATER_THAN")},{value:"GREATER_THAN_OR_EQUAL",label:e.localize("GREATER_THAN_OR_EQUAL")},{value:"NULL",label:e.localize("NULL")},{value:"NOT_NULL",label:e.localize("NOT_NULL")}]}_createFilterRow(e){const t=this;if(!t.filtering||!t.filterRow)return;if(e)return void t.$.tableContainer.children[1].insertBefore(e,t.$.tableContainer.children[1].firstElementChild);const a=document.createElement("tr"),l=t._columns.filter((e=>e.visible));let i="";a.className="smart-table-filter-row",t.selection&&(i+="<td></td>");for(let e=0;e<l.length;e++){const a=l[e];i+=t._createFilterRowInput(a)}a.innerHTML=i,t.$.tableContainer.children[1].insertBefore(a,t.$.tableContainer.children[1].firstElementChild)}_createFilterRowInput(e){const t=this,a=` animation="${t.animation}" `,l=t.rightToLeft?" right-to-left":"",i=[];let n,r,o,s;return"string"===e.dataType?(n=t._filterInfo.stringConditions,r="string",o="string-filter",s=t.localize("CONTAINS")):(n=t._filterInfo.numberAndDateConditions,r=e.dataType,o="num-date-filter",s=t.localize("EQUAL")),e.freeze&&i.push("freeze-"+("far"===e.freeze?"far":"near")),e.responsivePriority&&i.push("priority-"+e.responsivePriority),!1===e.allowFilter&&i.push("no-filter"),`<td${i.length?' class="'+i.join(" ")+'"':""} filter-for="${e.dataField}">\n <div>\n <input type="${r}" class="filter-value" aria-label="Filter value" />\n <smart-input class="${o}${a}data-source='${JSON.stringify(n)}' drop-down-button-position="right" drop-down-width="auto" readonly${l} value="${s}" title="${t.localize("filterCondition")}" aria-label="Filter condition"></smart-input>\n <smart-button class="smart-hidden" title="${t.localize("clearFilter")}"${a}${l} aria-label="Clear filter"></smart-button>\n </div>\n </td>`}_tableContainerChangeHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target;a.classList.contains("filter-value")&&("date"===a.type||a instanceof Smart.Input&&(""!==a.previousElementSibling.value||-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(e.detail.value)))&&t._applyRowFilters()}_tableContainerClickHandler(e){const t=this;if(t._editing)return;const a=t.isInShadowDOM?e.composedPath()[0]:e.target;if(!t.$.tableContainer.contains(a))return;const l=a.closest("tbody tr[row-id], tfoot tr.grand-total");if(l){t.closeColumnMenu();const i=a.closest("td");if(a.classList.contains("hierarchy-arrow")){const e=t.animation;return t.virtualization&&(t._animation="none"),t._hierarchyArrowClickHandler(l,i),void(t.virtualization&&(t._animation=e))}const n=l.getAttribute("row-id");let r;n&&(r=t.rowById?t.rowById[n].data:t.rows.dataItemById[n]);const o=r?r.$.id:void 0,s=i?i.getAttribute("data-field"):void 0;if(!r&&l.classList.contains("grand-total")&&(r=l.data),void 0!==s){const a={};for(let e=0;e<t.columns.length;e++){const l=t.columns[e];a[l.dataField]=r[l.dataField]}t.$.fireEvent("cellClick",{id:n,row:a,dataField:s,value:r[s],originalEvent:e})}if(t._toggleSelection(l,r,e,a),t.editing||t.drillDown){if(!s||i.classList.contains("no-edit"))return;clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks?(t._dblclickObject.numberOfClicks=0,t._beginEdit({rowElement:l,cell:i,dataField:s})):t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300)}return void(t.rowDetailTemplate&&t._toggleRowDetail(l,o))}const i=a.closest(".smart-table-select-all");if(i){if("one"===t.selectionMode)return;return void t._selectAllCheckboxClickHandler(i)}const n=a.closest(".smart-table-filter-row smart-button")||a.closest(".smart-table-column-menu smart-button");if(n){const e=n.parentElement.firstElementChild,a=n.parentElement.children[1];return e.value="",-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(a.$.input.dataValue)&&(a.value=t.localize("text"===e.type?"CONTAINS":"EQUAL"),delete a.$.input.dataValue),void t._applyRowFilters()}}_toggleSelection(e,t,a,l){const i=this;if(!i.selection||"cell"===i.selectionMode||e.classList.contains("disable-select")||e.classList.contains("grand-total"))return;function n(){i._selectedIds=[],Array.from(i.$.tableContainer.querySelectorAll(".smart-table-select-row.selected")).forEach((e=>{e.parentElement.classList.contains("disable-select")||e.parentElement.setAttribute("aria-selected",!1),e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1)}))}const r=t.$.id;let o=-1!==i._selectedIds.indexOf(r);if(i._interaction=!0,"one"===i.selectionMode){if(o)return;n(),i.select(r)}if("many"===i.selectionMode)if(o)i.unselect(r);else{if(i._disabledSelection.length>0&&t.children&&t.children.length>0){let e=0,a=0,l=[];if(t.children.forEach((t=>{const n=t.$.id;-1===i._selectedIds.indexOf(n)?e++:l.push(n),-1!==i._disabledSelection.indexOf(n)&&a++})),e===a)return i.unselect(l),void delete i._interaction}i.select(r),i._selectionStart={data:t,element:e}}else{if(i._selectionStart&&a.shiftKey){let t,a,l;if(i.virtualization?(t=i.rows,a=t.findIndex((e=>e.data.$.id===r)),l=t.findIndex((e=>e.data.$.id===i._selectionStart.data.$.id))):(t=Array.from(i.$.tableContainer.querySelectorAll("tr[row-id]:not([unused])")),a=t.indexOf(e),l=t.indexOf(i._selectionStart.element)),a!==l){const e=JSON.stringify(i._selectedIds.slice(0).sort()),r=Math.min(a,l),o=Math.max(a,l);n();const s=[];for(let e=r;e<=o;e++){const a=t[e];s.push(a.data.$.id)}return i._changeSelectionOfMultiple(s,"select","interaction",e),getSelection().removeAllRanges(),void delete i._interaction}if(1===i._selectedIds.length)return void delete i._interaction}const s=!!l&&(l.classList.contains("selection-checkbox")||l.classList.contains("smart-table-select-row"));let d=!1;if(1===i._selectedIds.length)d=!0;else if(i.hasAttribute("hierarchy")&&i.selectionByHierarchy){const e=[];!function e(t,a){const l=t.$.id;-1!==i._selectedIds.indexOf(l)&&a.push(l),t.children&&t.children.forEach((t=>e(t,a)))}(t,e),i._selectedIds.length===e.length&&(d=!0),t&&t.leaf&&(d=!0),o=i._getChildCheckState(t).maxSelected}else i.hasAttribute("hierarchy")&&!i.selectionByHierarchy&&(d=!0);if(o&&(s||d||a.ctrlKey||a.metaKey))return delete i._selectionStart,i.unselect(r),void delete i._interaction;s||a.ctrlKey||a.metaKey||n(),i.select(r),i._selectionStart={data:t,element:e}}delete i._interaction}_selectAllCheckboxClickHandler(e,t){const a=this;if(void 0===t){const l=a._filterInfo;if(l.inputFilters||l.rowFilters||l.appliedFilters)return void a._selectAllCheckboxClickHandlerFiltering(e);if(t=a.dataSource,a.hasAttribute("hierarchy")&&a._disabledSelection.length>0){const e=t.boundHierarchy,l=a._getChildCheckState({children:e}).maxSelected;return void a._changeSelectionOfMultiple(e.map((e=>e.$.id)),l?"unselect":"select","interaction")}}const l=t.length,i=a._selectedIds.length===l-a._disabledSelection.length+a._selectableGroupRecords.length,n=a._selectedIds.slice(0);if(a._selectedIds=[],i)a._updateCSSOnUnselectAll(e);else{let i,n=0;for(let e=0;e<l;e++){const l=t[e].$.id;-1===a._disabledSelection.indexOf(l)&&(a._selectedIds.push(l),n++)}n===l?i=!0:0===n&&(i=!1),a._updateCSSOnSelectAll(e,i),a._selectableGroupRecords.length>0&&(a._selectedIds=a._selectedIds.concat(a._selectableGroupRecords))}n.length!==a._selectedIds.length&&(a._updateState("selected"),a.$.fireEvent("change",{type:"interaction"}))}_selectAllCheckboxClickHandlerFiltering(e){const t=this,a=t.dataSource,l=t._selectedIds.slice(0),i=[],n=[];let r=0;for(let e=0;e<a.length;e++){const o=a[e];if(!1===o.$.filtered)continue;const s=o.$.id;r++,-1!==l.indexOf(s)&&i.push(s),-1===t._disabledSelection.indexOf(s)&&n.push(s)}const o=i.length===n.length;if(t._selectedIds=t._selectedIds.filter((e=>-1===n.indexOf(e))),o)t._updateCSSOnUnselectAll(e);else{let a;t._selectedIds=t._selectedIds.concat(n),n.length===r?a=!0:0===n.length&&(a=!1),t._updateCSSOnSelectAll(e,a)}l.length!==t._selectedIds.length&&(t._updateState("selected"),t.$.fireEvent("change",{type:"interaction"}))}_updateCSSOnUnselectAll(e){e.classList.remove("indeterminate","selected"),e.firstElementChild.setAttribute("aria-checked",!1),Array.from(this.$.tableContainer.querySelectorAll(".smart-table-select-row")).forEach((e=>{e.parentElement.classList.contains("disable-select")||e.parentElement.setAttribute("aria-selected",!1),e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1)}))}_updateCSSOnSelectAll(e,t){t?(e.classList.remove("indeterminate"),e.classList.add("selected"),e.firstElementChild.setAttribute("aria-checked",!0)):!1===t?(e.classList.remove("indeterminate","selected"),e.firstElementChild.setAttribute("aria-checked",!1)):(e.classList.remove("selected"),e.classList.add("indeterminate"),e.firstElementChild.setAttribute("aria-checked","mixed")),Array.from(this.$.tableContainer.querySelectorAll(".smart-table-select-row")).forEach((e=>{e.parentElement.classList.contains("disable-select")||(e.parentElement.setAttribute("aria-selected",!0),e.classList.remove("indeterminate"),e.classList.add("selected"),e.firstElementChild.setAttribute("aria-checked",!0))}))}_beginEdit(e){const t=this,a=t.editMode,l=e.dataField;let i=e.rowId,n=e.rowElement,r=e.rowObject,o=e.cell,s=[],d=[];if(t.editing){n||(n=t.$.tableContainer.querySelector(`tr[row-id="${i}"]:not([unused])`)),r||(i=n.getAttribute("row-id"),r=t.rowById[i],i=r.data.$.id),"row"===a?(s=n.querySelectorAll("td[data-field]"),d=t._columns.filter((e=>e.visible)).map((e=>e.dataField)),o||(o=l?n.querySelector(`td[data-field="${l}"`):s[0])):(o||(o=n.querySelector(`td[data-field="${l}"`)),s=[o],d=[l]),t._editing={row:r,cells:[]};for(let e=0;e<d.length;e++){const a=s[e];let l=d[e];const n=t.columnByDataField[l];if(!1===n.allowEdit)continue;n.transform&&(l=n.originalDataField);const c=r.data[l],u=t._initEditor(n,i,l,c);let f=u instanceof HTMLInputElement&&"date"===u.type;if(n.editor&&n.editor.template)n.editor.onRender&&n.editor.onRender(i,l,u,c);else if(f)if(c instanceof Date&&!isNaN(c.getTime())){const e=(c.getMonth()+1).toString(),t=c.getDate().toString();u.value=`${c.getFullYear()}-${"0".repeat(2-e.length)}${e}-${"0".repeat(2-t.length)}${t}`}else u.value="";else u.value=void 0===c?"":c;a.classList.add("editing"),a.innerHTML="",a.appendChild(u),a===o&&u.focus&&(u.focus(),n.editor&&n.editor.template||f||!u.select||u.select()),t._editing.cells.push({dataField:l,editor:u,element:a}),t.$.fireEvent("cellBeginEdit",{id:r.data.$.id,row:r.data,value:r.data[l],dataField:l})}"row"===a&&t.$.fireEvent("rowBeginEdit",{id:r.data.$.id,row:r.data})}}_initEditor(e,t,a,l){let i=this._editors[a];if(i)return i;if(e.editor&&e.editor.template){const n=document.createElement("div");return n.innerHTML=e.editor.template,i=n.firstElementChild,i.className="smart-table-editor",e.editor.onInit&&e.editor.onInit(t,a,i,l),i}return i=document.createElement("input"),i.className="smart-table-editor standard","number"===e.dataType?i.type="number":"date"===e.dataType?i.type="date":i.type="text",this._editors[a]=i,i}_toggleRowDetail(e,t){const a=this;if(a.virtualization)return void a._toggleRowDetailVirtualization(e,t);const l=e.nextElementSibling;l.classList.toggle("collapsed"),l.classList.contains("collapsed")?(l.setAttribute("aria-hidden",!0),a._expandedRowDetailIds=a._expandedRowDetailIds.filter((e=>e!==t))):(l.removeAttribute("aria-hidden"),a._expandedRowDetailIds.push(t))}_toggleRowDetailVirtualization(e,t){const a=this;let l=e.nextElementSibling;function i(){let e=a.$.virtualizationContainer.$.verticalScrollBar,t=a.$.virtualizationContainer.$.verticalScrollBar.value;a._ignoreVerticalChange=!0,a._refreshDataRows(),t=Math.min(e.max,t),e.value=t,delete a._ignoreVerticalChange,a._onVerticalChange({detail:{value:t}},!0)}if(l&&l.classList.contains("smart-table-row-detail")&&!l.classList.contains("collapsed"))return l.setAttribute("aria-hidden",!0),a._expandedRowDetailIds=a._expandedRowDetailIds.filter((e=>e!==t)),l.classList.add("collapsed"),l.remove(),void i();const n=e.data;l=document.createElement("tr"),l.classList.add("collapsed"),a._createRowDetailOnDemand(l,{data:n},n),e.parentElement.insertBefore(l,e.nextElementSibling),a._expandedRowDetailIds.push(t),l.classList.remove("collapsed"),i()}_setFocusable(){const e=this,t="smart-table"===e.nodeName.toLowerCase();if(!e.keyboardNavigation||e.disabled||e.unfocusable||e.hasAttribute("modal"))return e.$.tableContainer.removeAttribute("tabindex"),t&&(e.$.filterInput.unfocusable=!0,e.$.pager.unfocusable=!0),void(e.$.conditionalFormattingButton.unfocusable=!0);const a=e.$.tableContainer.getAttribute("tabindex");(null===a||a<0)&&e.$.tableContainer.setAttribute("tabindex",0),t&&(e.$.filterInput.unfocusable=!1,e.$.pager.unfocusable=!1),e.$.conditionalFormattingButton.unfocusable=!1}_tableContainerFocusHandler(){const e=this;e._focusedCell&&e.$.tableContainer.contains(e._focusedCell)||e._focusCell(e.$.tableContainer.children[1].querySelector("tr:not([unused]) td[data-field], tr:not([unused]) td.group-header"))}_tableContainerDownHandler(e){const t=this.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;this._focusCell(t.closest("td[data-field], td.group-header")),e.stopPropagation()}_focusCell(e,t){const a=this;if(!e||!e.hasAttribute("data-field")&&!e.classList.contains("group-header")||e.parentElement.classList.contains("grand-total"))return!1;if(a._focusedCell){if(a._focusedCell===e)return!1;a._focusedCell.removeAttribute("focus")}if(a._focusedCell=e,e.setAttribute("focus",""),!t)return;const l=a.$.tableContainer.parentElement,i=a.$.header.offsetHeight,n=a.freezeHeader?a.$.tableContainer.firstElementChild.offsetHeight:0,r=l.scrollTop;let o=e.offsetTop-i-n;if(o<r)l.scrollTop=o;else{const t=a.footerRow&&a.freezeFooter?a.$.tableContainer.lastElementChild.offsetHeight:0,s=a.$.pager.offsetHeight,d=l.clientHeight-(i+n+t+s);o+=e.offsetHeight,o>r+d&&(l.scrollTop=o-d)}if(e.classList.contains("freeze-near")||e.classList.contains("freeze-far"))return;const s=l.scrollLeft,d=a.$.tableContainer.querySelector("tr[row-id]:not([unused])");let c,u=0;if(Array.from(d.children).forEach((e=>{e.classList.contains("freeze-near")&&(u+=e.offsetWidth)})),a.rightToLeft){let t=e.previousElementSibling;for(c=0;t;)t.classList.contains("freeze-near")||(c-=t.offsetWidth),t=t.previousElementSibling;if(c>s)l.scrollLeft=c;else{const t=l.clientWidth;c-=e.offsetWidth,c<s-t&&(l.scrollLeft=c+t-u)}}else if(c=e.offsetLeft-u,c<s)l.scrollLeft=c;else{const t=l.clientWidth;c+=e.offsetWidth+u,c>s+t&&(l.scrollLeft=c-t)}}focus(){const e=this;!e.keyboardNavigation||e.disabled||e.unfocusable||e.hasAttribute("modal")||e.$.tableContainer.focus()}blur(){this.$.tableContainer.blur()}_tableContainerKeydownHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=e.key;if("Shift"===l)return void("extended"===t.selectionMode&&t.$.tableContainer.classList.add("smart-unselectable"));if(!t.contains(a))return;if(a&&"INPUT"===a.nodeName&&!t._editing)return;const i=t._focusedCell;if(!i)return;const n=t.virtualization,r=i.classList.contains("group-header");if(r&&-1!==["ArrowRight","ArrowLeft","Home","End","Escape","F2"].indexOf(l))return void e.preventDefault();if(t._editing){switch(l){case"Enter":t.endEdit();break;case"Escape":t.cancelEdit();break;default:return}return t.$.tableContainer.focus(),void e.preventDefault()}const o=i.parentElement;if(n&&o){const e=t.$.virtualizationContainer.$.verticalScrollBar,a=e.value,i=o.data.$.id;if("ArrowUp"===l&&0===a&&i===t._rowsVirtual[0].data.$.id||"ArrowDown"===l&&a===e.max&&i===t._rowsVirtual[t._rowsVirtual.length-1].data.$.id)return}let s="ArrowRight",d="ArrowLeft";switch(t.rightToLeft&&(s="ArrowLeft",d="ArrowRight"),l){case s:case d:{const a=l===s?"nextElementSibling":"previousElementSibling";let r=i[a];for(;r&&r.classList.contains("smart-hidden");)r=r[a];t._focusCell(r,!n,e),t._scrollToVirtualization(l===s?"nextArrow":"prevArrow",r);break}case"ArrowUp":case"ArrowDown":{const a="ArrowUp"===l?"previousElementSibling":"nextElementSibling";let s=o[a];for(;s&&(s.classList.contains("smart-table-row-detail")||s.classList.contains("collapsed"));)s=s[a];s&&(r?t._focusCell(s.querySelector("td[data-field], .group-header"),!n,e):t._focusCell(s.querySelector(`td[data-field="${i.getAttribute("data-field")}"], .group-header`),!n,e),t._scrollToVirtualization(l,s));break}case"Home":t._focusCell(o.querySelector("td[data-field]"),!n,e),t._scrollToVirtualization(l);break;case"End":{const a=o.querySelectorAll("td[data-field]");let i=a.length-1,r=a[i];for(;r.classList.contains("smart-hidden");)i--,r=a[i];t._focusCell(r,!n,e),t._scrollToVirtualization(l);break}case"PageDown":t._pageDownHandler(i,e);break;case"PageUp":t._pageUpHandler(i,e);break;case"Enter":{const a=o.data;t.dataSource.boundHierarchy&&t._areChildrenFiltered(a)?t._hierarchyArrowClickHandler(o,i,e):t.rowDetailTemplate&&t._toggleRowDetail(o,a.$.id);break}case" ":t._toggleSelection(o,o.data,e);break;case"F2":t.beginEdit(o.data.$.id,i.getAttribute("data-field"));break;default:return}if(e.preventDefault(),t.onKeyboardScroll){const e=n?t.$.virtualizationContainer:t.$.container;t.onKeyboardScroll(l,e.scrollTop,e.scrollLeft)}}_pageDownHandler(e,t){const a=this,l=a.paging;if(!l&&e.parentElement===e.parentElement.parentElement.lastElementChild)return;const i=a.virtualization,n=a.$.tableContainer,r=n.parentElement,o=i?a.$.virtualizationContainer:r;let s=e.getAttribute("data-field");function d(){const e=n.querySelectorAll("tr[row-id]:not([unused])");let t=i?0:a.$.header.offsetHeight+a.$.pager.offsetHeight;a.footerRow&&a.freezeFooter&&(t+=n.lastElementChild.offsetHeight);for(let a=e.length-1;a>=0;a--){const l=e[a];if(!l.classList.contains("collapsed")&&l.offsetTop+l.offsetHeight<=(i?-r.offsetTop:r.scrollTop)+o.clientHeight-t)return l.querySelector(`td[data-field${s}], .group-header`)}}s=s?`="${s}"`:"";let c=d();if(c)if(e===c){const u=(a.freezeHeader?n.firstElementChild.offsetHeight:0)+a._rowHeight;let f;if(i?(f=o.$.verticalScrollBar.value,o.$.verticalScrollBar.value+=o.clientHeight-u):r.scrollTop+=r.clientHeight-u,c=d(),l&&(i&&f===o.$.verticalScrollBar.value||!i&&e===c)){const e=a.pageIndex;a.navigateTo(a.pageIndex+1),a.pageIndex!==e&&(i&&(o.$.verticalScrollBar.value=0),a._focusCell(n.querySelector(`tr[row-id]:not([unused]) td[data-field${s}], tr[row-id]:not([unused]) .group-header`),!i,t))}else a._focusCell(c,void 0,t)}else a._focusCell(c,void 0,t)}_pageUpHandler(e,t){const a=this,l=a.virtualization,i=a.$.tableContainer,n=i.parentElement,r=l?a.$.virtualizationContainer:n;let o=e.getAttribute("data-field");function s(){const e=i.querySelectorAll("tr[row-id]:not([unused])");let t=0;a.freezeHeader&&(t=i.firstElementChild.offsetHeight);for(let a=0;a<e.length;a++){const i=e[a];if(!i.classList.contains("collapsed")&&i.offsetTop>=(l?-n.offsetTop:n.scrollTop)+t)return i.querySelector(`td[data-field${o}], .group-header`)}}o=o?`="${o}"`:"";let d=s();if(d)if(e===d){const c=(a.freezeHeader?i.firstElementChild.offsetHeight:0)+a._rowHeight;let u;if(l?(u=r.$.verticalScrollBar.value,r.$.verticalScrollBar.value-=r.clientHeight-c):n.scrollTop-=n.clientHeight-c,d=s(),a.paging&&(l&&u===r.$.verticalScrollBar.value||!l&&e===d)){const e=a.pageIndex;if(a.navigateTo(a.pageIndex-1),a.pageIndex!==e){l&&(r.$.verticalScrollBar.value=r.$.verticalScrollBar.max);const e=i.querySelectorAll(`tr[row-id]:not([aria-hidden="true"]) td[data-field${o}], tr[row-id]:not([aria-hidden="true"]) .group-header`);a._focusCell(e[e.length-1],!l,t)}}else a._focusCell(d,void 0,t)}else a._focusCell(d,void 0,t)}_tableContainerKeyupHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target;if("Shift"===e.key&&"extended"===t.selectionMode&&t.$.tableContainer.classList.remove("smart-unselectable"),t.contains(a))return a.classList.contains("filter-value")&&"date"!==a.type?(clearTimeout(t._filterRowTimeout),void(t._filterRowTimeout=setTimeout((function(){const e=t.context;t.context=t,t._applyRowFilters(),t.context=e}),500))):void 0}_tableContainerPointeroverHandler(e){const t=this;if(!t.tooltip)return;const a=(t.isInShadowDOM?e.composedPath()[0]:e.target).closest("tbody td[data-field], thead th[data-field]");if(!a)return;const l=t.$.tableContainer.querySelector(".tooltip"),i=t.columnByDataField[a.getAttribute("data-field")],n=t.virtualization;if(l&&(l.classList.remove("tooltip"),l.removeAttribute("title")),"th"!==a.tagName.toLowerCase())(a.classList.contains("tree-cell")&&a.firstElementChild&&a.firstElementChild.children[1].scrollWidth>a.firstElementChild.children[1].offsetWidth||a.scrollWidth>a.offsetWidth)&&(a.classList.add("tooltip"),a.title=n&&i&&i.templateElement?"":a.innerText);else{const e=a.querySelector(".label");e&&e.scrollWidth>e.offsetWidth&&(a.classList.add("tooltip"),a.title=n&&i&&i.templateElement?"":e.innerText)}}_documentDownHandler(e){const t=this,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;function l(){"default"!==t.columnSizeMode&&(t._preventClickSort=!0,clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks?(t._dblclickObject.numberOfClicks=0,t._autoResizeColumnOnDblclick()):t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300))}if(delete t._preventClickSort,t._editing&&!a.closest(".smart-table-editor")){const e=a.closest(".smart-drop-down")||a.closest(".smart-input-drop-down-menu");if(!e)return void t.endEdit();const l=e.ownerElement;if(!l)return void t.endEdit();if(t.$.container.contains(l)&&l.classList.contains("smart-table-editor"))return;return void t.endEdit()}const i=t.columnReorder,n=t.columnResize;if(i&&!t.columnTotals||n){const r=a.closest("th[data-field]:not(.smart-pivot-table-total-header)");if(r&&t.$.tableContainer.contains(r)){if(t.$.tableContainer.classList.add("smart-unselectable"),n&&t._columns.length>1&&!t.hasAttribute("resize-max-reached")){const a=t.rightToLeft,i=r.getBoundingClientRect();let n=null;if(!a&&e.clientX<=i.left+5||a&&e.clientX>=i.right-5){const i=r.previousElementSibling;if(i&&i.hasAttribute("data-field")){if(i.hasAttribute("locked"))return;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.headerCellElement===i){n=a;break}}const r=i.getBoundingClientRect(),o=n&&n.minWidth||t._getNumericMinWidth();return t._resizeDetails={FeedbackShown:!1,Item:i,ItemStart:r[a?"right":"left"]+window.scrollX,Min:o,StartPosition:{left:e.pageX,top:e.pageY},StartTime:new Date},t._resizeDetails.Max=t._getCurrentResizeMax(),void l()}}if(!a&&e.clientX>=i.right-5||a&&e.clientX<=i.left+5){if(r.hasAttribute("locked"))return;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.headerCellElement===r){n=a;break}}const o=n&&n.minWidth||t._getNumericMinWidth();return t._resizeDetails={FeedbackShown:!1,Item:r,ItemStart:i[a?"right":"left"]+window.scrollX,Min:o,StartPosition:{left:e.pageX,top:e.pageY},StartTime:new Date},t._resizeDetails.Max=t._getCurrentResizeMax(),void l()}}i&&(t._dragDetails={FeedbackShown:!1,Item:r,StartPosition:{left:e.pageX,top:e.pageY},StartTime:new Date})}}}_documentMoveHandler(e){const t=this,a=t._dragDetails;if(!a)return void(t._resizeDetails&&t._handleResizeOnMove(e));if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,i=Math.abs(a.StartPosition.left-e.pageX)>5||Math.abs(a.StartPosition.top-e.pageY)>5;if(!i||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&i&&!l&&(delete t._dragDetails,t.$.tableContainer.classList.remove("smart-unselectable")));t._hideBodyOverflow(),a.Feedback=t._addDragFeedback(),a.FeedbackShown=!0,a.Item.classList.add("dragged"),t.classList.add("smart-unselectable")}const l=t.$.tableContainer.parentElement;a.Feedback.style.left=e.pageX+10+"px",a.Feedback.style.top=e.pageY+10+"px",a.HoveredItem&&(a.HoveredItem.classList.remove("drop-column","left","right"),delete a.HoveredItem),l.offsetWidth<l.scrollWidth&&(clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const a=l.getBoundingClientRect();a.left<=e.clientX&&a.left+a.width>=e.clientX?e.clientX>=a.left&&e.clientX<=a.left+25?l.scrollLeft-=t._autoScrollCoefficient:e.clientX>=a.left+a.width-25&&e.clientX<=a.left+a.width?l.scrollLeft+=t._autoScrollCoefficient:clearInterval(t._dragInterval):clearInterval(t._dragInterval)}),10));const i=t._getClosestThToHover(e);i&&(i.classList.add("drop-column"),a.HoveredItem=i)}_hideBodyOverflow(){const e=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,t=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth;this._originalBodyOverflow={overflowX:document.body.style.overflowX,overflowY:document.body.style.overflowY,overflow:document.body.style.overflow},document.body.classList.add("smart-dragging"),document.body.style.overflow=document.body.style.overflowX=document.body.style.overflowY="",e&&!t?document.body.style.overflowX="hidden":t&&!e?document.body.style.overflowY="hidden":t||e||(document.body.style.overflow="hidden")}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=document.createElement("div");return a.className="smart-table-feedback",a.setAttribute("parent-table-id",e.id),a.innerHTML=e.columnByDataField[t.getAttribute("data-field")].label,e.theme&&a.setAttribute("theme",e.theme),document.body.appendChild(a),a}_getClosestThToHover(e){const t=e.clientX,a=Array.from(this.$.tableContainer.querySelectorAll("th[data-field]:not(.smart-pivot-table-total-header)"));let l,i,n;for(let e=0;e<a.length;e++){const r=a[e];if(!r||this._dragDetails.Item===r)continue;const o=r.getBoundingClientRect(),s=Math.abs(t-o.left),d=Math.abs(t-o.right),c=Math.min(s,d);if(!(void 0===i||c<i))break;l=r,i=c,n=s<d?"left":"right"}return l&&l.classList.add(n),l}_handleResizeOnMove(e){const t=this,a=t._resizeDetails;if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,i=Math.abs(a.StartPosition.left-e.pageX)>=1||Math.abs(a.StartPosition.top-e.pageY)>=1;if(!i||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&i&&!l&&(delete t._resizeDetails,t.$.tableContainer.classList.remove("smart-unselectable","resizing"),document.body.style.cursor=null));a.Feedback=t._addResizeFeedbacks(),a.FeedbackShown=!0,t.classList.add("smart-unselectable","resizing"),document.body.style.cursor="col-resize"}const l=a.Feedback,i=a.ItemStart;let n;t.rightToLeft?(n=Math.min(a.Max,Math.max(a.Min,Math.round(i-e.pageX))),l.style.left=i-n+"px"):(n=Math.min(a.Max,Math.max(a.Min,Math.round(e.pageX-i))),l.style.left=i+n+"px"),l.classList.toggle("min",n===a.Min),l.classList.toggle("max",n===a.Max),t.columnResizeFeedback&&(l.innerHTML=n+"px"),a.Width=n}_addResizeFeedbacks(){const e=this,t=e._resizeDetails,a=e.$.container.getBoundingClientRect(),l=a.top+window.scrollY+"px",i=a.height+"px",n=document.createElement("div"),r=document.createElement("div");return r.className="smart-table-resize-feedback static",r.setAttribute("parent-table-id",e.id),r.style.top=l,r.style.left=t.ItemStart+"px",r.style.height=i,e._resizeDetails.StaticFeedback=r,n.className="smart-table-resize-feedback",n.setAttribute("parent-table-id",e.id),n.style.top=l,n.style.height=i,e.theme&&(r.setAttribute("theme",e.theme),n.setAttribute("theme",e.theme)),document.body.appendChild(n),document.body.appendChild(r),n}_resolveResize(e){const t=this,a=t._resizeDetails;if(delete t._resizeDetails,t.$.tableContainer.classList.remove("smart-unselectable","resizing"),e){if(!a.FeedbackShown)return;a.StaticFeedback.remove(),a.Feedback.remove()}const l=t._columns.find((e=>e.headerCellElement===a.Item));t.classList.remove("smart-unselectable","resizing"),document.body.style.cursor=null;let i=a.Width;i<t.columnMinWidth&&(i=t.columnMinWidth);const n=t._getTableRemainingWidth();if(l){const e=l._isResponsive||!!(l.width&&l.width.toString().indexOf("%")>=0);if(delete l.width,l.minWidth&&i<l.minWidth&&(i=l.minWidth),l._manualWidth=i,l._manualPercentageWidth=parseFloat(i/n*100),l._isResponsive=e,a.Item.style.width=l._isResponsive?parseFloat(i/n*100)+"%":i+"px",l._isFillRemainingWidth){let e=!0;for(let a=0;a<t._columns.length;a++){const l=t._columns[a];if(!l.width&&!l._manualWidth){e=!1;break}}!t.columnResizeNormalize&&e&&(t.columns.push({dataField:"",label:"",visible:!0,allowResize:!1,allowFilter:!1,allowSort:!1}),t._initColumns(!0),t.refresh())}}else a.Item.style.width=i+"px";t._handleAutoSizeMode(l),t._handleFrozenColumnPositions(),t._refreshHorizontalScrollbar();const r=parseFloat(i/n*100);t.$.fireEvent("columnResize",{dataField:l.dataField,headerCellElement:a.Item,widthInPercentages:r,width:i})}openColumnMenu(e){const t=this,a=t.columnByDataField[e];if(!a)return;const l=a.headerCellElement;if(!l)return;if(a&&!1===a.allowMenu)return;const i=l.querySelector(".column-menu");if(!i)return;const n=()=>{const e=c.getBoundingClientRect(),a=t.activeColumnMenu;t._columnsSettingsMenu.style.top=e.top+window.scrollY+"px",t._columnsSettingsMenu.style.left=e.right+window.scrollX+"px",e.right-i.offsetWidth+window.scrollX+a.offsetWidth>t.getBoundingClientRect().right&&(t._columnsSettingsMenu.style.left=10+e.right-a.offsetWidth-t._columnsSettingsMenu.offsetWidth+window.scrollX+"px")},r=()=>{const e=a.headerCellElement;e.hasAttribute("column-menu-button")||e.setAttribute("column-menu-button","");const l=e.querySelector(".column-menu"),i=l.getBoundingClientRect();o.style.top=i.bottom+10+window.scrollY+"px",o.style.left=i.right-l.offsetWidth+window.scrollX+"px",i.right-l.offsetWidth+window.scrollX+o.offsetWidth>t.getBoundingClientRect().right&&(o.style.left=i.right-o.offsetWidth+window.scrollX+"px");const n=o.querySelector("input");n&&n.focus()};a.columnMenu&&a.columnMenu.remove(),t.closeColumnMenu();const o=document.createElement("div");o.classList.add("smart-table-column-menu","wrapper"),o.owner=l,o.dataField=e;const s=document.createElement("div");s.innerHTML=`<span class='menu-icon sort-asc'></span><span class="label">${t.localize("columnMenuItemSortAsc")}</span>`,s.classList.add("smart-table-menu-item");const d=document.createElement("div");d.innerHTML=`<span class='menu-icon sort-desc'></span><span class="label">${t.localize("columnMenuItemSortDesc")}</span>`,d.classList.add("smart-table-menu-item");const c=document.createElement("div");c.innerHTML=`<span class='menu-icon columns'></span><span class="label">${t.localize("columnMenuItemColumns")}</span>`,c.classList.add("smart-table-menu-item","columns-item");const u=document.createElement("div");u.innerHTML=`<span class='menu-icon filter-by'></span><span class="label">${t.localize("columnMenuItemFilter")}</span>`,u.classList.add("smart-table-menu-item","filter-item");const f=document.createElement("div");f.innerHTML=`<span class='menu-icon filter-by-remove'></span><span class="label">${t.localize("columnMenuItemRemoveFilter")}</span>`,f.classList.add("smart-table-menu-item","remove-filter-item","smart-hidden");const m=document.createElement("div");m.innerHTML=`<span class='menu-icon sort-remove'></span><span class="label">${t.localize("columnMenuItemRemoveSort")}</span>`,m.classList.add("smart-table-menu-item","remove-sort-item","smart-hidden");const h=document.createElement("div");h.innerHTML=`<span class='menu-icon reset'></span><span class="label">${t.localize("columnMenuItemReset")}</span>`,h.classList.add("smart-table-menu-item","reset-item"),c.onmouseleave=e=>{const a=t._columnsSettingsMenu.getBoundingClientRect();e.pageX>=a.left-20&&e.pageX<=a.right+20&&e.pageY>=a.top-20&&e.pageY<=a.bottom+20||t._columnsSettingsMenu&&t._columnsSettingsMenu.remove()},c.onmouseenter=()=>{t._columnsSettingsMenu=(()=>{t._columnsSettingsMenu&&t._columnsSettingsMenu.remove();const a=document.createElement("div");a.classList.add("smart-table-column-menu","wrapper","smart-table-columns-menu");let l=0,i=null;for(let o=0;o<t.columns.length;o++){const s=document.createElement("div");s.innerHTML=`<span class='column-item menu-icon'></span><span class="label">${t.columns[o].label}</span>`,s.classList.add("smart-table-menu-item"),s.column=t.columns[o],e!==s.column.dataField&&!1!==s.column.allowHide&&(s.column.visible?(l++,i=s):s.firstElementChild.classList.add("off"),s.onpointerdown=e=>{s.column.visible=!s.column.visible,s.column.visible?s.firstElementChild.classList.remove("off"):s.firstElementChild.classList.add("off"),r(),n(),e.stopPropagation(),e.preventDefault()},a.appendChild(s))}return 1===l&&i&&i.classList.add("smart-disabled"),document.body.appendChild(a),a})(),n()};const p=t._createFilterRowInput(a);t.filtering&&!1!==a.allowFilter&&(t.filterRow?o.insertBefore(f,o.firstElementChild):(o.innerHTML=p,o.insertBefore(u,o.firstElementChild))),o.insertBefore(h,o.firstElementChild),o.insertBefore(c,o.firstElementChild),o.insertBefore(m,o.firstElementChild),!1!==a.allowSort&&"none"!==t.sortMode&&(o.insertBefore(d,o.firstElementChild),o.insertBefore(s,o.firstElementChild),a.headerCellElement.hasAttribute("aria-sort")&&(m.classList.remove("smart-hidden"),"ascending"===a.headerCellElement.getAttribute("aria-sort")?s.classList.add("smart-disabled"):d.classList.add("smart-disabled")),m.onclick=()=>{t.sortBy(a.dataField,null),t.closeColumnMenu()},s.onclick=()=>{t.sortBy(a.dataField,"asc"),t.closeColumnMenu()},d.onclick=()=>{t.sortBy(a.dataField,"desc"),t.closeColumnMenu()}),h.onclick=()=>{if(t._initialState){if(t.loadState(t._initialState),t._filterInfo.filterRowValues&&delete t._filterInfo.filterRowValues,t.clearFilters(),t.filterRow){const e=t.$.tableContainer.querySelector(".smart-table-filter-row");e&&e.remove()}t._initRows(),t.refresh()}t.closeColumnMenu()};const g=t.columns.findIndex((e=>e.dataField===a.dataField));t.appendChild(o);const _=o.lastElementChild.children[2];_&&(_.onclick=()=>{const e=_.parentElement.firstElementChild,a=_.parentElement.children[1];e.value="",-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(a.$.input.dataValue)&&(a.value=t.localize("text"===e.type?"CONTAINS":"EQUAL"),delete a.$.input.dataValue),t._applyRowFilters()});const b=t._filterInfo&&t._filterInfo.filterRowValues?t._filterInfo.filterRowValues[g]:null;if(b&&!t.filterRow){const e=o.lastElementChild,l=a.dataType,i=t._filterInfo["string"===l?"stringConditions":"numberAndDateConditions"].find((e=>e.value===b.condition));if(-1===["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(i.value))if("date"===l){const t=new Date(b.value),a=(t.getMonth()+1).toString(),l=t.getDate().toString();e.children[0].value=`${t.getFullYear()}-${"0".repeat(2-a.length)}${a}-${"0".repeat(2-l.length)}${l}`}else e.children[0].value=b.value;e.children[1].value=i.label,e.children[1].$.input.dataValue=i.value,e.children[2].classList.remove("smart-hidden")}a.headerCellElement.hasAttribute("filter")&&f.classList.remove("smart-hidden"),f.onclick=()=>{t.removeFilter(a.dataField),t.closeColumnMenu()},r(),a.columnMenu=t.activeColumnMenu=o,t.$.fireEvent("openColumnMenu",{dataField:e})}closeColumnMenu(){const e=this;e.activeColumnMenu&&(e.activeColumnMenu.owner.hasAttribute("column-menu-button")&&e.activeColumnMenu.owner.removeAttribute("column-menu-button"),e._columnsSettingsMenu&&e._columnsSettingsMenu.remove(),e.$.fireEvent("closeColumnMenu",{dataField:e.activeColumnMenu.dataField}),e.activeColumnMenu.remove(),delete e.activeColumnMenu)}_documentUpHandler(e){const t=this,a=t._dragDetails;if(t.activeColumnMenu){const a=e.originalEvent?e.originalEvent:e;if(a){let e=!1,l=a.target;for(;l;)if(l=l.parentNode,l===t){e=!0;break}(t.activeColumnMenu.contains(a.target)||t._columnsSettingsMenu&&t._columnsSettingsMenu.contains(a.target))&&(e=!0);const i=t.activeColumnMenu.querySelector("smart-input");i&&i.$.scrollView.contains(a.target)&&(e=!0),e||t.closeColumnMenu()}}if(t._selectDrag)return t.$.main.classList.remove("prevent-scroll"),void delete t._selectDrag;if(!a)return void(t._resizeDetails&&t._resolveResize(!0));if(delete t._dragDetails,t.$.tableContainer.classList.remove("smart-unselectable"),!a.FeedbackShown)return;const l=a.HoveredItem;document.body.classList.remove("smart-dragging"),document.body.style.overflow=t._originalBodyOverflow.overflow,document.body.style.eoverflowX=t._originalBodyOverflow.overflowX,document.body.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,t.classList.remove("smart-unselectable"),a.Item.classList.remove("dragged"),document.body.removeChild(a.Feedback),clearInterval(t._dragInterval),delete t._dragInterval,l&&t._applyColumnReorder(a,l),t._preventClickSort=!0,requestAnimationFrame((()=>delete t._preventClickSort))}_applyColumnReorder(e,t){const a=this,l=a.rightToLeft,i=a._columns,n=e.Item.getAttribute("data-field"),r=i.find((e=>e.dataField===n)),o=t.getAttribute("data-field"),s=t.classList.contains("right"),d=a._columns.filter((e=>e.dataField!==n)),c=d.findIndex((e=>e.dataField===o));t.classList.remove("drop-column","left","right"),s&&!l||!s&&l?d.splice(c+1,0,r):d.splice(c,0,r),i.map((e=>e.dataField)).join(",")!==d.map((e=>e.dataField)).join(",")&&(a.columns=d,a._initColumns(),a.refresh())}_applyRowFilters(){const e=this;if(!e.filtering||!e.filterRow&&!e.columnMenu)return;const t=e.filterRow?e.$.tableContainer.querySelector(".smart-table-filter-row"):null,a=Number(e.selection),l=e._columns.filter((e=>e.visible)),i=[],n=[];for(let r=0;r<l.length;r++){const o=l[r].dataField,s=l[r].dataType;if(l[r].headerCellElement&&l[r].headerCellElement.hasAttribute("filter")&&l[r].headerCellElement.removeAttribute("filter"),!e.filterRow&&!l[r].columnMenu){n.push(null);continue}const d=e.filterRow?t.children[r+a].firstElementChild:l[r].columnMenu.lastElementChild,c=d.children[2];let u=d.firstElementChild.value,f=d.children[1].value;"string"===s?f=e._filterInfo.stringConditions.find((e=>e.label===f)).value:(f=e._filterInfo.numberAndDateConditions.find((e=>e.label===f)).value,""!==u&&("number"===s?(u=parseFloat(u),isNaN(u)&&(d.firstElementChild.value="",u="")):"date"===s&&(u=new Date(u),u.setHours(0,0,0))));const m=-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(f);if(""!==u||m){const e=new Smart.Utilities.FilterGroup,t=e.createFilter(s,u,f);e.addFilter("or",t),i.push([o,e]),c.classList.remove("smart-hidden"),n.push({condition:f,value:u}),l[r].headerCellElement&&l[r].headerCellElement.setAttribute("filter","")}else c.classList.add("smart-hidden"),n.push(null),l[r].headerCellElement&&l[r].headerCellElement.hasAttribute("filter")&&l[r].headerCellElement.removeAttribute("filter");m?d.firstElementChild.setAttribute("disabled",!0):d.firstElementChild.removeAttribute("disabled")}i.length>0?(e.dataSource.virtualDataSource||e.dataSource._filter(i,e.filterOperator),e._filterInfo.rowFilters=i,e._filterInfo.filterRowValues=n,delete e._filterInfo.appliedFilters,e._fullRefresh("filter"),e._updateState("filtered"),e._doNotFireEvent||e.$.fireEvent("filter",{action:"add",filters:i})):e._filterInfo.rowFilters?(e._filterInfo.filterRowValues&&delete e._filterInfo.filterRowValues,e.clearFilters()):e._filterInfo.filterRowValues&&delete e._filterInfo.filterRowValues}_clearFilterInput(){const e=this;e._filterInfo.query="",delete e._filterInfo.inputFilters,e.$.filterInput.value=""}_clearRowFilters(e){const t=this;if(!t._filterInfo.rowFilters)return;const a=t.$.tableContainer.querySelector(".smart-table-filter-row"),l=t.selection?1:0;let i=t._columns.filter((e=>e.visible));if(e&&(i=t._columns.filter((t=>t.dataField===e))),a)for(let e=0;e<i.length;e++){const t=a.children[e+l]?a.children[e+l].firstElementChild:null;t&&(t.firstElementChild.value="",t.children[2].classList.add("smart-hidden")),i[e].headerCellElement&&i[e].headerCellElement.hasAttribute("filter")&&i[e].headerCellElement.removeAttribute("filter")}delete t._filterInfo.rowFilters}_createFooterRow(e){const t=this,a=t.footerRow;if(!a)return;if(e)return void t.$.tableContainer.appendChild(e);const l=document.getElementById(a);if(l&&l instanceof HTMLTemplateElement){const e=document.createElement("tfoot"),a=document.importNode(l.content,!0);e.appendChild(a),t.$.tableContainer.appendChild(e)}else t.footerRow=null}_createCustomHeaderRow(){const e=this,t=e.$.tableContainer.firstElementChild;let a=e.headerRow;if(a){if("function"==typeof a)a.call(e,t);else if("string"==typeof a){const e=document.getElementById(a);if(!e)return void(t.innerHTML=`<tr><th>${a}</th></tr>`);a=e}a instanceof HTMLTemplateElement?t.appendChild(document.importNode(a.content,!0)):a.nodeName?t.appendChild(a):e.headerRow=null}}_updateSelectAllState(e){const t=this;if(!t.selection||"cell"===t.selectionMode)return;const a=t.$.tableContainer.querySelector(".smart-table-select-all");let l;if(void 0===e){const a=t.dataSource,i=t._filterInfo;if(i.inputFilters||i.rowFilters||i.appliedFilters){const i=t._selectedIds;e=0,l=0;for(let t=0;t<a.length;t++){const n=a[t];if(!1===n.$.filtered)continue;const r=n.$.id;e++,-1!==i.indexOf(r)&&l++}}else e=t.dataSource.length}void 0===l&&(l=t._selectedIds.length),0===l||0===e?(a.classList.remove("selected","indeterminate"),a.firstElementChild.setAttribute("aria-checked",!1)):l===e+t._selectableGroupRecords.length?(a.classList.remove("indeterminate"),a.classList.add("selected"),a.firstElementChild.setAttribute("aria-checked",!0)):(a.classList.remove("selected"),a.classList.add("indeterminate"),a.firstElementChild.setAttribute("aria-checked","mixed"))}_resizeHandler(){const e=this;clearTimeout(e._resizeTimeout);const t=()=>{if(Smart.Utilities.Core.Browser.Firefox&&e.virtualization){const t=e.$.virtualizationContainer.$.verticalScrollBar.value;e._onVerticalChange({detail:{value:t}},!0)}};t(),"default"===e.columnSizeMode&&e._handleAutoSizeMode(),e._resizeTimeout=setTimeout((function(){if(e.columnGroups&&e._columns.some((e=>e.responsivePriority&&e.responsivePriority>1)))return void e.refresh();const a=e.offsetWidth,l=e.offsetHeight;if(e.virtualization&&e._cachedHeight!==l){const i=e._getFractionOfMax();return e._refreshDataRows(),e._setFractionOfMax(i),e._cachedWidth=a,e._cachedHeight=l,void t()}e._handleAutoSizeMode(),e._handleFrozenColumnPositions(),e._refreshHorizontalScrollbar(),e._cachedWidth=a,e._cachedHeight=l,t()}),75)}_hierarchyArrowClickHandler(e,t){const a=this,l=!a.grouping,i=e.data;if(a.animation=a._animation,l&&a.dataSource.virtualDataSource&&!i.expanded&&i.children&&0===i.children.length)return a._requestVirtualDataSource("expand",void 0,i),void a.$.fireEvent("expand",{id:i.$.id,record:i});if(a.virtualization)return void a._hierarchyArrowClickHandlerVirtualization(e,t);const n=a.$.tableContainer,r=i.$.id;function o(e){e.forEach((e=>{a._expandSingleChildRow(n.querySelector(`tr[row-id="${e.$.id}"]:not([unused])`)),e.children&&e.expanded&&requestAnimationFrame((()=>o(e.children)))}))}if(i.expanded?function e(t){t.forEach((t=>{a._collapseSingleChildRow(n.querySelector(`tr[row-id="${t.$.id}"]:not([unused])`)),t.children&&e(t.children)}))}(i.children):requestAnimationFrame((()=>o(i.children))),i.expanded=!i.expanded,e.setAttribute("aria-expanded",i.expanded),e.classList.toggle("expanded",i.expanded),l)i.expanded?(-1===a._expandedIds.indexOf(r)&&a._expandedIds.push(r),a.$.fireEvent("expand",{id:i.$.id,record:i})):(a._expandedIds=a._expandedIds.filter((e=>e!==r)),a.$.fireEvent("collapse",{id:i.$.id,record:i})),a._updateState("expanded");else if(!0!==t){let e=""+i.$.id;e=e.replace("Item","").replace(/_/gi,"."),i.expanded?a.$.fireEvent("group",{action:"expand",path:e,dataField:i.groupDataField,label:i.label}):a.$.fireEvent("group",{action:"collapse",path:e,dataField:i.groupDataField,label:i.label})}}_expandSingleChildRow(e,t=[]){e&&(t.push(!1),"none"!==this.animation?(e.classList.remove("smart-hidden"),requestAnimationFrame((()=>{e.classList.add("no-height"),e.ontransitionend=function(){e.classList.remove("no-height"),e.ontransitionend=null,t.pop()},e.removeAttribute("aria-hidden"),e.classList.remove("collapsed")}))):(e.removeAttribute("aria-hidden"),e.classList.remove("collapsed","smart-hidden"),t.pop()))}_collapseSingleChildRow(e,t=[]){e&&(t.push(!1),"none"!==this.animation?e.ontransitionend=function(){e.classList.add("smart-hidden"),e.ontransitionend=null,t.pop()}:(e.classList.add("smart-hidden"),t.pop()),e.setAttribute("aria-hidden",!0),e.classList.add("collapsed"))}_getGroupByIndex(e){"number"==typeof e&&(e=e.toString());const t=this.dataSource.boundHierarchy,a=e.split(".");let l=t[a[0]];if(l){for(let e=1;e<a.length;e++)if(l=l.children[a[e]],!l||l.leaf)return;return l}}getGroupChildren(e){"number"==typeof e&&(e=e.toString());const t=this.dataSource.boundHierarchy,a=e.split(".");let l=t[a[0]];if(!l)return[];for(let e=1;e<a.length;e++)if(l=l.children[a[e]],!l||l.leaf)return[];return l.children}_createDialog(){const e=this,t=document.createElement("smart-window"),a=document.createElement("template"),l=` animation=${e.animation} theme="${e.theme}"${e.rightToLeft?" right-to-left":""}${!e.keyboardNavigation||e.unfocusable?" unfocusable":""}`;a.innerHTML=`<smart-button class="ok primary"${l}>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${l}>${e.localize("cancel")}</smart-button>`,t.animation=e.animation,t.footerTemplate=a,t.headerButtons=["close"],t.rightToLeft=e.rightToLeft,t.theme=e.theme,t.unfocusable=!e.keyboardNavigation||e.unfocusable,t.className="smart-table-window",t.ownerElement=e,e._dialog=t,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(t),e.setAttribute("aria-owns",t.id)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("close",e._dialogEventHandler),t.addEventListener("click",e._dialogEventHandler)}_dialogEventHandler(e){const t=this,a=t.ownerElement,l=t.isInShadowDOM?e.composedPath()[0]:e.target,i=e.type,n=a.context;if(a.context=a,"close"===i){if(l!==t)return void(a.context=n);const e=t.classList.contains("conditional-formatting"),i=t.classList.contains("fields");t.ok?(e&&a._applyConditionalFormatting(),delete t.ok):e&&JSON.stringify(a._formattingPanel.items)!==JSON.stringify(a._formattingPanel.getItems())&&(a._formattingPanel.$.itemsContainer.innerHTML="",a._formattingPanel._addDefaultItems()),t.content.innerHTML="",t.classList.remove("conditional-formatting","drill-down","fields"),!a.keyboardNavigation||a.disabled||a.unfocusable||(a.$.tableContainer.setAttribute("tabindex",0),"smart-table"===a.nodeName.toLowerCase()&&(a.$.filterInput.unfocusable=!1,a.$.pager.unfocusable=!1),a.$.conditionalFormattingButton.unfocusable=!1),a.removeAttribute("modal"),e?a.$.conditionalFormattingButton.focus():i&&a.$.fieldsButton?a.$.fieldsButton.focus():a.$.tableContainer.focus()}else"click"===i&&t.$.footer.contains(l)&&(l.closest(".ok")?(t.ok=!0,t.close()):l.closest(".cancel")&&t.close());a.context=n}_openDialog(e,t,a){const l=this;l._dialog||l._createDialog();const i=l._dialog;i.label=e,i.classList.add(a),i.appendChild(t),l.$.tableContainer.removeAttribute("tabindex"),"smart-table"===l.nodeName.toLowerCase()&&(l.$.filterInput.unfocusable=!0,l.$.pager.unfocusable=!0),"drill-down"!==a?i.setAttribute("aria-controls",l.$.tableContainer.id):i.removeAttribute("aria-controls"),l.$.conditionalFormattingButton.unfocusable=!0,l.setAttribute("modal",""),i.open()}_conditionalFormattingButtonClickHandler(e,t,a){const l=this;let i;l._formattingPanel?i=l._formattingPanel:(i=document.createElement("smart-formatting-panel"),i.animation=l.animation,i.columns=t||l._columns,i.dataSource=a||l.dataSource,i.locale=l.locale,i.messages=l.messages,i.rightToLeft=l.rightToLeft,i.theme=l.theme,i.unfocusable=!l.keyboardNavigation||l.unfocusable,i.ownerElement=l,l._formattingPanel=i),l.conditionalFormatting&&(i.items=l.conditionalFormatting.slice(0)),l._openDialog(l.localize("conditionalFormatting"),i,"conditional-formatting")}_transformDataSource(){const e=this;if(!e.isRendered&&e.dataTransform){const t=e.dataSource;for(let a=0;a<t.length;a++)e.dataTransform(t[a])}}_applyInitialConditionalFormatting(e){const t=this,a=t.conditionalFormatting;if(!a||0===a.length)return void(t._conditionalFormatting=null);const l=t._defaults,i=new Smart.Utilities.ConditionalFormatter(e),n=[];let r;if("smart-pivot-table"===t.nodeName.toLowerCase()){const e=t._dynamicColumns;r=function(t){return"all"===t?e.map((e=>e.id)):e.filter((e=>e.dataFields[e.dataFields.length-1].dataField===t)).map((e=>e.id))}}else r=function(e){return"all"===e?t._columns.map((e=>e.value)):[e]};for(let e=0;e<a.length;e++){a[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},a[e]);const t=a[e],o=r(t.column),s=t.condition;i.color=t.highlight,i.comparator=t.firstValue,i.min=t.firstValue,i.max=t.secondValue;const d=i.format(s,o);for(let e in d){const a=d[e];for(let e in a){const l=a[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=a.slice(0)),0===n.length)return n[0];const o={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const a=t[e];o[e]||(o[e]={});for(let t in a)o[e][t]=Object.assign({},o[e][t],a[t])}}t._conditionalFormatting=o}_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"}_applyConditionalFormatting(){const e=this,t=e._conditionalFormatting;e._conditionalFormatting=e._formattingPanel.apply(),e.conditionalFormatting=e._formattingPanel.getItems(),e._conditionalFormatting!==t&&e._refreshDataRows()}_updateState(e,t){const a=this;let l;if("selected"===e&&(l=a.getSelection(),a.selected=l),-1===a.stateSettings.indexOf(e))return;const i=a._state;switch(e){case"columns":i.columns=a._columns;break;case"expanded":i.expanded=a._expandedIds;break;case"filtered":i.filtered=a._filterInfo;break;case"grouped":i.grouped=a.dataSource.groupBy._array.slice(0);break;case"selected":i.selected=l;break;case"sorted":i.sorted=a._sortColumns||[]}a.autoSaveState&&a.isRendered&&!1!==t&&window.localStorage.setItem("smartTable"+a.id,a._stringifyState())}_stringifyState(){const e=this,t=JSON.parse(JSON.stringify(e._state));return["columns","expanded","filtered","grouped","selected","sorted"].forEach((a=>{-1===e.stateSettings.indexOf(a)&&delete t[a]})),JSON.stringify(t,(function(e,t){if(!("function"==typeof t||t instanceof HTMLElement||"sortOrder"===e||"thHierarchy"===e))return t}))}_handleAutoSizeMode(){const e=this;if("default"===e.columnSizeMode){const t=e._columns.filter((e=>e.visible)),a=[],l=t=>{const a=t.headerCellElement;if(!a)return;const l=parseInt(t.minWidth||e.columnMinWidth);a.offsetWidth<l?a.style.width=l+"px":(a.style.width="",a.offsetWidth<l&&(a.style.width=l+"px"))};t.forEach((t=>{if(t.width||t._manualWidth||(l(t),a.push(t)),t.width&&"string"==typeof t.width&&t.width.endsWith("%")){const a=e._getColumnWidth(t.width,!1,t);!1===t.autoWidth?t.headerCellElement.style.width=t.width:(t.headerCellElement.setAttribute("responsive-width",t.width),t.headerCellElement.style.width=a+"px")}else if(t._manualPercentageWidth)if(t._isResponsive){const a=e._getColumnWidth(t._manualPercentageWidth+"%",!1,t);!1===t.autoWidth?t.headerCellElement.style.width=t.width:(t.headerCellElement.setAttribute("responsive-width",t._manualPercentageWidth+"%"),t.headerCellElement.style.width=a+"px")}else t.headerCellElement.style.width=t._manualWidth+"px"}));for(let e=0;e<a.length;e++)l(a[e]);return}const t=e._columns.filter((e=>e.visible)),a=e._getNumericMinWidth();let l,i;t.forEach((e=>{e.width||e._manualWidth||(l||(l=e),i=e,e.headerCellElement.style.width=null)}));const n=e.$.tableContainer.offsetWidth-(e.selection?e.$.tableContainer.querySelector(".smart-table-select-all").offsetWidth:0);let r=new Map,o=0,s=0,d=0;e.removeAttribute("resize-max-reached"),e.setAttribute("auto-size",""),l&&(l.headerCellElement.style.width="100%");for(let i=0;i<t.length;i++){const n=t[i];if(n===l){d++;continue}const c=n.headerCellElement;let u,f;n.width?(u=f=e._getColumnWidth(n.width,!1,n),n.minWidth&&u<f&&(u=n.minWidth,f=n.minWidth)):n._manualWidth?(u=n._manualWidth,f=n.minWidth||a,u<f&&(u=f)):(u=Math.max(c.offsetWidth,a),f=n.minWidth||a,d++),o+=u,s+=f,n._isResponsive&&(u=e._getColumnWidth(n._manualPercentageWidth+"%",!1,n),u<f&&(u=f)),r.set(n,{width:u,minWidth:f})}function c(){l.headerCellElement.style.width=null;const e=Math.max(l.headerCellElement.offsetWidth,a),t=l.minWidth||a;r.set(l,{width:e,minWidth:t}),o+=Math.max(e,t),s+=t}if(l)if(l!==i)i.headerCellElement.style.width="100%",c(),i.headerCellElement.style.width=null;else if(t.length>1){const e=t.find((e=>e!==l));e.headerCellElement.style.width="100%",c(),e._isResponsive?e.headerCellElement.style.width=r.get(e).width+"%":e.headerCellElement.style.width=r.get(e).width+"px"}else c();if(n<=s||0===d)t.forEach((t=>{if(t._isResponsive){if(t.headerCellElement.style.width=(t._manualPercentageWidth?t._manualPercentageWidth+"%":r.get(t).minWidth)+"px",t._manualPercentageWidth){const a=e._getColumnWidth(t._manualPercentageWidth+"%",!1,t),l=t.minWidth||e.columnMinWidth;a===l&&(t.headerCellElement.style.width=l+"px")}}else t.headerCellElement.style.width=(t._manualWidth?t._manualWidth:r.get(t).minWidth)+"px"})),n<=s&&e.setAttribute("resize-max-reached","");else if(n>s)if(n<o){const a=[];let l,i=o-n,s=d;for(;i>0&&s>0;)l=Math.ceil(i/s),t.forEach((e=>{if(e.width||e._manualWidth||-1!==a.indexOf(e))return;const t=r.get(e);let n=Math.max(t.width-l,t.minWidth);const o=t.width-n;i-=o,n===t.minWidth&&(s--,a.push(e)),t.width=n}));t.forEach((t=>{if(t._isResponsive){if(t.headerCellElement.style.width=r.get(t).width+"%",t._manualPercentageWidth){const a=e._getColumnWidth(t._manualPercentageWidth+"%",!1,t),l=t.minWidth||e.columnMinWidth;a===l&&(t.headerCellElement.style.width=l+"px")}}else t.headerCellElement.style.width=r.get(t).width+"px"}))}else n===o?t.forEach((e=>{e._isResponsive?e.headerCellElement.style.width=r.get(e).width+"%":e.headerCellElement.style.width=r.get(e).width+"px"})):t.forEach((e=>{const t=r.get(e).width;e.headerCellElement.style.width=e===l?n-o+t+"px":t+"px"}));e.removeAttribute("auto-size")}_getNumericMinWidth(){const e=this,t=e.columnMinWidth;return"string"==typeof t&&-1!==t.indexOf("%")?e.offsetWidth*(parseFloat(t)/100):parseFloat(t)}_getCurrentResizeMax(){const e=this;if("default"===e.columnSizeMode)return 1/0;const t=e._resizeDetails,a=e._columns,l=a.find((e=>e.headerCellElement===t.Item)),i=a.indexOf(l);let n,r=a.length-1;for(let e=a.length-1;e>=0;e--)if(a[e].visible){r=e;break}if(i===r)return t.Item.offsetWidth;for(let t=i+1;t<a.length;t++){const l=a[t];t===r&&l.headerCellElement&&(n=l.headerCellElement.getBoundingClientRect()[e.rightToLeft?"left":"right"]+window.scrollX)}return n}_autoResizeColumnOnDblclick(){const e=this,t=e._resizeDetails,a=t.Item,l=e._columns.find((e=>e.headerCellElement!==a)).headerCellElement,i=l.style.width;e.setAttribute("auto-size",""),a.style.width=null,l.style.width="100%";let n=a.offsetWidth;l.style.width=i,e.removeAttribute("auto-size",""),n=Math.min(t.Max,Math.max(t.Min,n)),t.Width=n,e._resolveResize()}_isExpandCollapseForbidden(){const e=this;return(!e.hasAttribute("hierarchy")||e.grouping)&&"smart-pivot-table"!==e.nodeName.toLowerCase()}_selectSingle(e){const t=this,a=t.rowById?t.rowById[e]||t.dataSource.dataItemById[e]:t.rows.dataItemById[e];if(!a)return;const l=a.data?a.data.$.id:a.$.id;if(-1!==t._selectedIds.indexOf(l)||-1!==t._disabledSelection.indexOf(l))return;const i=t.$.tableContainer.querySelector(`tr[row-id="${l}"]:not([unused])`);if("one"===t.selectionMode&&(t._clearSelection(),t._selectedIds=[]),t._selectedIds.push(l),i){const e=i.firstElementChild;e.classList.remove("indeterminate"),e.classList.add("selected"),e.firstElementChild.setAttribute("aria-checked",!0),i.setAttribute("aria-selected",!0)}return t._handleHierarchicalSelection(a,!0),!0}_unselectSingle(e){const t=this,a=t.rowById?t.rowById[e]||t.dataSource.dataItemById[e]:t.rows.dataItemById[e];if(!a)return;const l=a.data?a.data.$.id:a.$.id,i=t._selectedIds.indexOf(l),n=t.$.tableContainer.querySelector(`tr[row-id="${l}"]:not([unused])`);if(-1!==i&&t._selectedIds.splice(i,1),n){const e=n.firstElementChild;e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1),n.setAttribute("aria-selected",!1)}return t._handleHierarchicalSelection(a,!1),!0}_changeSelectionOfMultiple(e,t,a="programmatic",l){const i=this;l||(l=JSON.stringify(i._selectedIds.slice(0).sort()));for(let a=0;a<e.length;a++)i[`_${t}Single`](e[a]);l!==JSON.stringify(i._selectedIds.slice(0).sort())&&(i._updateSelectAllState(),i._updateState("selected"),i.$.fireEvent("change",{type:a}))}_handleHierarchicalSelection(e,t){const a=this;if(!a.hasAttribute("hierarchy"))return;if(!1===a.selectionByHierarchy)return;const l=e.data;let i=l;for(l&&l.children&&function e(t,l){const i=t.children;let n=0;for(let t=0;t<i.length;t++){const r=i[t];if(!1===r.$.filtered)continue;let o=a._setThreeStateCheckbox(r,l);r.children&&r.children.length>0&&(o=e(r,l)),l&&!1===o&&n++}if(l&&n>0)return a._setThreeStateCheckbox(t,n!==i.length&&null)}(l,t);i&&i.parent;){const e=i.parent,t=a._getChildCheckState(e).state;a._setThreeStateCheckbox(e,t),i=e}}_getChildCheckState(e){const t=this,a=t._selectedIds,l=t._disabledSelection,i=e.children;if(!i||0===i.length||!t.selectionByHierarchy){const t=e.$.id,i=-1!==a.indexOf(t);return{state:i,maxSelected:!!i||-1!==l.indexOf(t)}}let n=!0,r=0,o=0,s=0;for(let e=0;e<i.length;e++){const a=i[e];if(!1===a.$.filtered)continue;const l=t._getChildCheckState(a);r++,l.state?o++:null===l.state?s++:!1===l.maxSelected&&(n=!1)}return 0!==o&&o===r?{state:!0,maxSelected:!0}:0===o&&0===s?{state:!1,maxSelected:n}:{state:null,maxSelected:n}}_setThreeStateCheckbox(e,t){const a=this,l=e.$.id,i=a._selectedIds,n=i.indexOf(l);t&&(-1!==a._disabledSelection.indexOf(l)?t=!1:-1===n&&i.push(l)),t||-1===n||i.splice(n,1);const r=a.$.tableContainer.querySelector(`tr[row-id="${l}"]:not([unused])`);if(!r)return t;const o=r.firstElementChild,s=o.firstElementChild;return t?(o.classList.remove("indeterminate"),o.classList.add("selected"),s.setAttribute("aria-checked",!0),r.setAttribute("aria-selected",!0)):!1===t?(o.classList.remove("selected","indeterminate"),s.setAttribute("aria-checked",!1),r.setAttribute("aria-selected",!1)):(o.classList.remove("selected"),o.classList.add("indeterminate"),s.setAttribute("aria-checked","mixed"),r.setAttribute("aria-selected",!1)),t}_getSelectableGroupRecords(){const e=this,t=e.dataSource,a=t.boundHierarchy;e._selectableGroupRecords=[],a?(function t(a){a.forEach((a=>{a.groupDataField&&(e._selectableGroupRecords.push(a.$.id),t(a.children))}))}(a),e._selectedIds=e._selectedIds.filter((a=>void 0!==t.dataItemById[a]||-1!==e._selectableGroupRecords.indexOf(a)))):e._selectedIds=e._selectedIds.filter((e=>void 0!==t.dataItemById[e]))}_clearSelection(e){const t=this;if(0===t._selectedIds.length)return;const a=t.$.tableContainer.querySelector(".smart-table-select-all");Array.from(t.$.tableContainer.querySelectorAll(".smart-table-select-row")).forEach((e=>{e.parentElement.classList.contains("disable-select")||e.parentElement.setAttribute("aria-selected",!1),e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1)})),a&&(a.classList.remove("indeterminate","selected"),a.firstElementChild.setAttribute("aria-checked",!1)),t._selectedIds=[],e&&(t._updateState("selected"),t.$.fireEvent("change",{type:"programmatic"}))}_updateCellsWithFormulas(e){const t=this,a=t.formulas,l=t._cellsWithFormulas;if(a||e)for(let e in l){const a=/(.+):(.+)/.exec(e),l=t.columnByDataField[a[1]],i=t.rowById[a[2]];if(!l||!i)continue;const n=t.$.tableContainer.querySelector(`tr[row-id="${i.data.$.id}"]:not([unused]) td[data-field="${l.dataField}"]`);n&&t._setCellContent(n,t._formatCellValue(i,l,n),n.classList.contains("tree-cell"))}}_createVirtualDataRows(e){const t=this,a=t.rowDetailTemplate,l=t.selection,i=t.hasAttribute("hierarchy"),n=document.createDocumentFragment(),r=t.$.virtualizationContainer,o=t.$.tableContainer,s=t._rowHeight;t.isRendered&&(r.scrollWidth=0,r.scrollHeight=0,r.$.scrollViewerContainer.classList.remove("hscroll","vscroll"));const d=r.$.scrollViewerContainer.offsetHeight-o.firstElementChild.offsetHeight-(t.filtering&&t.filterRow?s:0)-(t.footerRow?o.lastElementChild.offsetHeight:0),c=d<5,u=t._getVirtualRecords(i,c),f=u.length;let m=i?2*d:d+3*s,h=s*f,p=0;t._rowsVirtual=u,t._rowsInDOM=[];for(let e=0;e<f;e++){const r=u[e],o=r.data;if(!r.detail){if(o.groupDataField)t._rowsInDOM.push(t._createGroupHeader(o,n));else{const e=t._createDataRow(r,n,{hierarchical:i,rowDetailTemplate:a,selection:l,virtualization:!0});t._rowsInDOM.push(e.row),e.detail&&(t._rowsInDOM.push(e.detail),p+=t._rowDetailHeight,m+=t._rowDetailHeight)}if(p+=s,!c&&p>m)break}}e.appendChild(n),t._updateState("expanded"),e.parentElement||t.$.tableContainer.insertBefore(e,t.$.tableContainer.querySelector("tfoot")),r.refresh(),a&&(h+=t._expandedRowDetailIds.length*(t._rowDetailHeight-s));let g=Math.max(0,h-d);g>0&&r.computedHorizontalScrollBarVisibility&&(g+=r.$.horizontalScrollBar.offsetHeight),r.$.scrollViewerContentContainer.style.top=0,r.$.verticalScrollBar.max=g,t._scrollHeight=h,t._start={view:0,data:0},!c&&t._rowsInDOM.length>0&&r.$.scrollViewerContentContainer.offsetHeight<r.$.scrollViewerContainer.offsetHeight&&t._rowsInDOM[t._rowsInDOM.length-1].classList.add("last-row"),t._fixFrozenHeaderFirefox(),t._focusEquivalentCell()}_getVirtualRecords(e,t){const a=this,l=e&&!t?a.rows.filter((e=>0===e.data.level||!a._isCollapsed(e.data))):a.rows;if(e||!a.rowDetailTemplate)return l;const i=[];return l.forEach((e=>{i.push(e),-1!==a._expandedRowDetailIds.indexOf(e.data.$.id)&&i.push({detail:!0,data:e.data})})),i}_onVerticalChange(e,t){const a=this;if(a._ignoreVerticalChange)return;const l=a.rows,i=a._rowHeight,n=a.$.virtualizationContainer;let r,o,s=e.detail.value;if(Smart.Utilities.Core.Browser.Firefox&&a.virtualization&&(n.$.scrollViewerContentContainer.style.top=null),a.setAttribute("ignore-detail-animation",""),a._rowsInDOM.length===l.length||0===n.$.verticalScrollBar.max){const e=Math.floor(s/i);return a._start={view:e,data:e},n.$.scrollViewerContentContainer.style.top=-s+"px",requestAnimationFrame((()=>a.removeAttribute("ignore-detail-animation"))),void a._fixFrozenHeaderFirefox()}if(a._expandedRowDetailIds.length>0){let e,t=0;r=1;for(let l=0;l<a._rowsVirtual.length;l++){const i=t;if(a._rowsVirtual[l].detail?t+=a._rowDetailHeight:t+=a._rowHeight,void 0===o&&s<=t){o=l,e=s-i;break}}n.computedVerticalScrollBarVisibility?s=e+a._rowHeight:r=0}else{for(s=s%(2*i)+i,s<i&&(s+=i);s+n.$.scrollViewerContainer.offsetHeight>a.$.tableContainer.offsetHeight;)s-=i;r=Math.floor(s/i),o=Math.floor(e.detail.value/i),r<0&&(o-=r,r=0)}n.$.scrollViewerContentContainer.style.top=-s+"px",a._updateVisibleRows(r,o,t||a._expandedRowDetailIds.length>0),a._fixFrozenHeaderFirefox(),requestAnimationFrame((()=>a.removeAttribute("ignore-detail-animation")))}_fixFrozenHeaderFirefox(){const e=this;e.virtualization&&e.$.virtualizationContainer&&e.$.virtualizationContainer.$.scrollViewerContentContainer&&(e._tableHeader.style.top=-parseFloat(e.$.virtualizationContainer.$.scrollViewerContentContainer.style.top)+"px"),Smart.Utilities.Core.Browser.Firefox&&e.virtualization}_focusEquivalentCell(e){const t=this,a=t._focusedCell;if(!e&&!a)return;let l;if(!e){if(!a.parentElement)return;e={rowId:a.parentElement.data.$.id,dataField:a.getAttribute("data-field")}}l=e.dataField?t.$.tableContainer.querySelector(`tr[row-id="${e.rowId}"]:not([unused]) td[data-field="${e.dataField}"]`):t.$.tableContainer.querySelector(`tr[row-id="${e.rowId}"]:not([unused]) td.group-header`),t._focusCell(l)}_detachCachedTemplates(){const e=this;e._cachedTemplates&&(delete e._cachedTemplates,e._tableCachedTemplates&&(e._tableCachedTemplates.remove(),delete e._tableCachedTemplates))}_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 a in e._cachedTemplates)t.appendChild(e._cachedTemplates[a]);e._tableCachedTemplates.appendChild(t)}}_updateVisibleRows(e,t,a){const l=this,i=t-e,n=l._rowsVirtual.length,r={hierarchical:l.hasAttribute("hierarchy"),selection:l.selection};let o;if(a=a&&(r.hierarchical||!!l.rowDetailTemplate),r.hierarchical&&!l.grouping&&(a=!0),l._sortColumns&&l._sortColumns.length>0&&(a=!0),l._focusedCell){const e=l._focusedCell.parentElement;e&&(o={rowId:e.data.$.id,dataField:l._focusedCell.getAttribute("data-field")})}for(let t=0;t<e;t++){const e=l._rowsInDOM[t];let n=i+t;n>=0&&(a||e.data.$.index!==n||e.data.detail)&&l._updateVisibleRow(e,n,r),e.setAttribute("unused",""),e.setAttribute("aria-hidden",!0),e.classList.remove("smart-table-row-detail")}for(let t=e;t<l._rowsInDOM.length;t++){const e=l._rowsInDOM[t],o=i+t;o<n?(e.removeAttribute("unused"),e.removeAttribute("aria-hidden"),(a||e.data.$.index!==o||e.data.parent)&&l._updateVisibleRow(e,o,r)):e.setAttribute("aria-hidden",!0)}l._start={view:e,data:t},l._focusEquivalentCell(o)}_updateVisibleRow(e,t,a){const l=this,i=l._columns.filter((e=>e.visible));if(!i.length)return;const n=l._rowsVirtual[t],r=n.data,o=r.$.id,s=Number(a.selection),d=!r.groupDataField&&!e.firstElementChild.classList.contains("group-header")&&!n.detail&&!e.classList.contains("smart-table-row-detail")&&e.childElementCount>1;if(e.className="",d){const t=e.attributes;for(;t.length>0;)e.removeAttribute(t[0].name)}else e.innerHTML="";if(r.groupDataField)l._createGroupHeader(r,void 0,e);else if(n.detail)l._createRowDetailOnDemand(e,n,r);else{e.setAttribute("aria-rowindex",r.$.index+1),l._processAndRenderSelection(r,e,a.hierarchical,d);for(let t=0;t<i.length;t++){const c=i[t];let u=d?e.children[t+s]:document.createElement("td"),f=!1;if(u&&(l.grouping&&!r.groupDataField||l.dataSource&&l.dataSource.groupBy&&l.dataSource.groupBy.length>0)&&u.removeAttribute("colspan"),!u){if(!d)continue;u=document.createElement("td"),f=!0,e.appendChild(u)}d&&(u.className=""),u.setAttribute("data-field",c.dataField),u.setAttribute("aria-colindex",t+1+s);let m,h=l._formatCellValue(n,c,u);if(f&&l._setCellContent(u,h,m),c.freeze&&u.classList.add("freeze-"+("far"===c.freeze?"far":"near")),c.responsivePriority&&u.classList.add("priority-"+c.responsivePriority),!1===c.allowEdit?(u.classList.add("no-edit"),u.setAttribute("aria-readonly",!0)):u.removeAttribute("aria-readonly"),0===t&&a.hierarchical){const e=l._areChildrenFiltered(r);r.leaf||(u.classList.add("tree-cell"),m=e),r.level&&(u.classList.add("outline-level-"+Math.min(r.level,10)),!r.leaf&&e||u.classList.add("tree-leaf"))}if(c.templateElement){if(f&&l.grouping){const e=c.templateElement+"",t=u;e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=e}else if(a.hierarchical&&l.grouping&&r.leaf){const e=c.templateElement+"",t=u;if((!t.firstElementChild||!(t.firstElementChild.hasAttribute("ng-version")||t.innerHTML.indexOf("ng-version")>=0))&&t.firstElementChild&&!t.firstElementChild.classList.contains(".smart-table-cell-template")){const a=t.innerHTML;e.substring(e.lastIndexOf("</"))!==a.substring(a.lastIndexOf("</"))&&(e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=e)}}if(m&&!u.querySelector(".hierarchy-arrow")){l._setCellContent(u,h,m);const e=u.children[0].children[1],t=c.templateElement+"";t.indexOf("{{value}}")>=0?e.innerHTML=t.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):e.innerHTML=t}else if(a.hierarchical&&!l.grouping&&r.leaf){const e=u;if(!e.firstElementChild||!(e.firstElementChild.hasAttribute("ng-version")||e.innerHTML.indexOf("ng-version")>=0)){l._setCellContent(u,h,!1);const t=c.templateElement+"";t.indexOf("{{value}}")>=0?e.innerHTML=t.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):e.innerHTML=t}}if(!d){const e=c.templateElement+"",t=m?u.children[0].children[1]:u;e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=e}let e=m?u.children[0].children[1].firstElementChild:u.firstElementChild;if(!e&&a.hierarchical){l._setCellContent(u,h,!1);const t=u,a=c.templateElement+"";a.indexOf("{{value}}")>=0?t.innerHTML=a.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=a,e=m?u.children[0].children[1].firstElementChild:u.firstElementChild}c.templateElementSettings?c.templateElementSettings(r[c.dataField],o,e):c.templateElement.indexOf("{{value}}")>=0&&(u.querySelector(".smart-table-cell-template").textContent=r[c.dataField])}else c.formatFunction,l._setCellContent(u,h,m);l.onCellRender&&l.onCellRender(r,c.dataField,r[c.dataField],u),l._applyConditionalFormattingToCell(u,c.dataField,r.$.index),d||e.appendChild(u)}e.data=r,e.setAttribute("row-id",o),-1!==l._disabledSelection.indexOf(o)&&(e.removeAttribute("aria-selected"),e.classList.add("disable-select"),a.selection&&e.firstElementChild.firstElementChild.setAttribute("aria-disabled",!0)),r.expanded?(-1===l._expandedIds.indexOf(o)&&l._expandedIds.push(o),e.setAttribute("aria-expanded",!0),e.classList.add("expanded")):!1===r.expanded&&e.setAttribute("aria-expanded",!1),r.level&&l._isCollapsed(r)&&(e.setAttribute("aria-hidden",!0),e.classList.add("collapsed","smart-hidden"))}}_createRowDetailOnDemand(e,t,a){const l=this,i=Number(l.selection)+l._columns.filter((e=>e.visible)).length;e.data=Object.assign(a,{detail:!0}),e.classList.add("smart-table-row-detail"),e.removeAttribute("aria-rowindex"),e.removeAttribute("row-id"),e.innerHTML=`<td colspan="${i}"><div class="smart-table-detail-container">${l._applyRowDetailTemplate(t)}</div></td>`}_hierarchyArrowClickHandlerVirtualization(e,t){const a=this,l=!a.grouping,i=a.$.tableContainer,n={nextRow:e.nextElementSibling,tbody:i.children[1]},r=e.data,o=[],s=[],d=Math.ceil((a.$.virtualizationContainer.$.scrollViewerContainer.offsetHeight-i.firstElementChild.offsetHeight)/a._rowHeight);function c(){0===o.length?function(){if(a._ignoreVerticalChange=!0,r.expanded=!r.expanded,l)r.expanded?(-1===a._expandedIds.indexOf(r.$.id)&&a._expandedIds.push(r.$.id),a.$.fireEvent("expand",{id:r.$.id,record:r})):(a._expandedIds=a._expandedIds.filter((e=>e!==r.$.id)),a.$.fireEvent("collapse",{id:r.$.id,record:r})),a._updateState("expanded");else if(!0!==t){const e=t=>{for(let a=0;a<t.length;a++){const l=t[a];if(l.$.id===r.$.id)return l;if(l.children){let t=e(l.children);if(t)return t}}return null},t=e(a.dataSource.boundHierarchy);t&&(t.expanded=r.expanded);let l=""+r.$.id;l=l.replace("Item","").replace(/_/gi,"."),r.expanded?a.$.fireEvent("group",{action:"expand",path:l,dataField:r.groupDataField,label:r.label}):a.$.fireEvent("group",{action:"collapse",path:l,dataField:r.groupDataField,label:r.label})}for(const e of s)e.remove();let e=a.$.virtualizationContainer.$.verticalScrollBar,i=a.$.virtualizationContainer.$.verticalScrollBar.value;a._refreshDataRows(),i=Math.min(e.max,i),e.value=i,delete a._ignoreVerticalChange,a._onVerticalChange({detail:{value:i}},!0)}():requestAnimationFrame((()=>c()))}function u(e){for(const t of e){if(s.length>=d)break;!1!==t.$.filtered&&(s.push(a._expandSingleChildRowVirtualization(t,n,o)),t.children&&t.expanded&&u(t.children))}}r.expanded?function e(t){t.forEach((t=>{a._collapseSingleChildRow(i.querySelector(`tr[row-id="${t.$.id}"]:not([unused])`),o),t.children&&e(t.children)}))}(r.children):requestAnimationFrame((()=>u(r.children))),e.setAttribute("aria-expanded",!r.expanded),e.classList.toggle("expanded",!r.expanded),requestAnimationFrame((()=>c()))}_expandSingleChildRowVirtualization(e,t,a){const l=this,i=l.rowById[e.$.id],n=document.createDocumentFragment();let r;if(i){if(r=i.data.groupDataField?l._createGroupHeader(i.data,n):l._createDataRow(i,n,{virtualization:!0,hierarchical:!0,selection:l.selection}).row,-1===[...t.tbody.children].indexOf(t.nextRow)){let a=!1;e.children&&0===e.children.length&&(a=!0),e.children||(a=!0),l._rowsInDOM&&l._rowsInDOM.length===l.rows.length&&(a=!0),a||t.tbody.appendChild(n)}else t.tbody.insertBefore(n,t.nextRow);return l._expandSingleChildRow(r,a),r}}_getFractionOfMax(){const e=this;return e.isRendered&&e.virtualization?{vertical:function(){const t=e.$.virtualizationContainer.$.verticalScrollBar,a=t.max;return 0===a?0:t.value/a}(),horizontal:function(){const t=e.$.virtualizationContainer.$.horizontalScrollBar,a=t.max;return 0===a?0:t.value/a}()}:null}_setFractionOfMax(e){if(!this.virtualization||null===e)return;const t=this.$.virtualizationContainer,a=t.$.verticalScrollBar,l=t.$.horizontalScrollBar;a.value=a.max*e.vertical,l.value=l.max*e.horizontal}_refreshHorizontalScrollbar(){const e=this.$.virtualizationContainer;if(!e)return;const t=e.$.scrollViewerContainer,a=e.$.horizontalScrollBar,l=e.$.verticalScrollBar,i=e.$.scrollViewerContentContainer.offsetWidth-t.offsetWidth;let n,r;i>0&&!t.classList.contains("hscroll")?(t.classList.add("hscroll"),n="add"):i<=0&&t.classList.contains("hscroll")&&(r=a.offsetHeight,t.classList.remove("hscroll"),n="subtract"),e.scrollWidth!==i&&(e.scrollWidth=i),e.computedVerticalScrollBarVisibility&&("add"===n?(r=a.offsetHeight,l.max+=r):"subtract"===n&&(l.max-=r))}_scrollToVirtualization(e,t){const a=this;if(!a.virtualization)return;const l=a.$.virtualizationContainer,i=l.$.scrollViewerContentContainer,n=l.$.verticalScrollBar,r=l.$.horizontalScrollBar,o=a.$.tableContainer,s=i.offsetLeft,d=i.offsetTop,c=n.value;let u,f;switch(t&&(u=t.offsetLeft,f=t.offsetTop),e){case"nextArrow":{if(!t||!l.computedHorizontalScrollBarVisibility)return;const e=s+u+t.offsetWidth-l.offsetWidth;e>0&&(r.value+=e+n.offsetWidth);break}case"prevArrow":if(!t||!l.computedHorizontalScrollBarVisibility||u>=-s)return;r.value=u-s-r.value;break;case"ArrowUp":{const e=o.firstElementChild.offsetHeight-d-f;if(e<=0)return;let t;if(a._focusedCell){const e=a._focusedCell.parentElement;e&&(t={rowId:e.data.$.id,dataField:a._focusedCell.getAttribute("data-field")})}const l=Math.max(0,c-e);l!==c&&(n.value=l,a._focusEquivalentCell(t));break}case"ArrowDown":{const e=d+f+t.offsetHeight-l.offsetHeight;if(e<=0)return;const a=Math.min(n.max,c+e);a!==c&&(n.value=a);break}case"Home":case"End":if(!l.computedHorizontalScrollBarVisibility)return;r.value="Home"===e?0:r.max}}_getExpandedGroups(e){const t=this,a=[];return e?(function e(l){l.forEach((l=>{l.expanded&&a.push({groupDataField:l.groupDataField,label:l.label,ancestorSignature:t._getGroupAncestorSignature(l)}),l.children&&l.children.length>0&&!1===l.children[0].leaf&&e(l.children)}))}(e),a):[]}_getGroupAncestorSignature(e){const t=[];let a=e.parent;for(;a;)t.push({groupDataField:a.groupDataField,label:a.label}),a=a.parent;return JSON.stringify(t)}_restoreExpandedGroups(e){if(0===e.length)return;const t=this,a=t.dataSource,l=[];!function a(i){i&&i.forEach((i=>{if(e.some((e=>e.groupDataField===i.groupDataField&&e.label===i.label&&e.ancestorSignature===t._getGroupAncestorSignature(i)))){let e=i.$.id;"string"==typeof e&&(e=e.replace("Item","").replace(/_/g,".")),l.push(e)}i.children&&i.children.length>0&&!1===i.children[0].leaf&&a(i.children)}))}(a.boundHierarchy);const i=t._doNotFireEvent;t._doNotFireEvent=!0,l.forEach((e=>t.expandGroup(e))),t._doNotFireEvent=i}});
866
+ Smart("smart-table",class extends Smart.ContentElement{static get properties(){return{autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},columnGroups:{value:null,type:"array?"},columnMinWidth:{value:"50px",type:"any"},columnReorder:{value:!1,type:"boolean"},columnResize:{value:!1,type:"boolean"},columnResizeFeedback:{value:!1,type:"boolean"},columnResizeNormalize:{value:!1,type:"boolean"},columns:{value:[],type:"any?",reflectToAttribute:!1},columnSizeMode:{value:"default",allowedValues:["auto","default"],type:"string"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},conditionalFormattingButton:{value:!1,type:"boolean"},deferredScrollDelay:{value:1,type:"number"},dataRowId:{value:null,type:"string?"},dataSource:{value:null,type:"any?",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},sanitizeHTMLRender:{value:"text",allowedValues:["text","html"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},dataTransform:{value:null,type:"function?",reflectToAttribute:!1},editing:{value:!1,type:"boolean"},editMode:{value:"cell",allowedValues:["cell","row"],type:"string"},expandHierarchy:{value:!1,type:"boolean"},filtering:{value:!1,type:"boolean"},columnMenu:{value:!1,type:"boolean"},filterRow:{value:!1,type:"boolean"},filterTemplate:{value:null,type:"string?"},filterOperator:{value:"and",type:"string?"},footerRow:{value:null,type:"string?"},formulas:{value:!1,type:"boolean"},freezeFooter:{value:!1,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},grouping:{value:!1,type:"boolean"},groupFormatFunction:{value:null,type:"any"},headerRow:{value:null,type:"any"},hideSelectionColumn:{value:!1,type:"boolean"},keyboardNavigation:{value:!1,type:"boolean"},loadColumnStateBehavior:{value:"implementationOnly",allowedValues:["stateOnly","implementationOnly","intersection"],type:"string"},messages:{value:{en:{add:"Add condition",all:"All columns",apply:"Apply",between:"Between",cancel:"Cancel",clearFilter:"Clear filter",close:"Close",column:"Column:",condition:"Condition:",conditionalFormatting:"Conditional Formatting",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",equal:"Equal To",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filterCondition:"Filter condition",filterPlaceholder:"Filter",firstButton:"First",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",formatColumn:"Format Column",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",greaterThan:"Greater Than",highlight:"Highlight",invalidValue:"Invalid value",itemsPerPage:"Items per page:",lastButton:"Last",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",lessThan:"Less Than",nextButton:"Next",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",notEqual:"Not Equal To",NULL:"null",ok:"OK",previousButton:"Previous",remove:"Remove condition",secondValue:"Second value:",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",summaryPrefix:"of",text:"Text",value:"Value:",with:"with",columnMenuItemSortAsc:"Sort Ascending",columnMenuItemSortDesc:"Sort Descending",columnMenuItemReset:"Reset",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Show rows where:",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemColumns:"Columns",grouping:"Group field name is not found in the dataFields collection!"}},type:"object",extend:!0},onCellRender:{value:null,type:"function?",reflectToAttribute:!1},onColumnRender:{value:null,type:"function?",reflectToAttribute:!1},onInit:{value:null,type:"function?",reflectToAttribute:!1},pageSize:{value:10,allowedValues:[10,25,50],type:"int"},pageIndex:{value:0,type:"int"},paging:{value:!1,type:"boolean"},rowDetailTemplate:{value:null,type:"string?"},selected:{value:[],type:"array",reflectToAttribute:!1},selection:{value:!1,type:"boolean"},selectionMode:{value:"many",type:"string",allowedValues:["one","many","extended"]},selectionByHierarchy:{value:!0,type:"boolean"},sort:{value:null,type:"function?",reflectToAttribute:!1},sortMode:{value:"none",type:"string",allowedValues:["none","one","many"]},stateSettings:{value:["columns","expanded","filtered","grouped","selected","sorted"],type:"array"},tooltip:{value:!1,type:"boolean"},virtualization:{value:!1,type:"boolean"}}}static get listeners(){return{resize:"_resizeHandler","conditionalFormattingButton.click":"_conditionalFormattingButtonClickHandler","filterInput.keyup":"_filterInputKeyupHandler","pager.change":"_pagerChangeHandler","pager.pageSizeChanged":"_pagerPageSizeChanged","tableContainer.change":"_tableContainerChangeHandler","tableContainer.click":"_tableContainerClickHandler","tableContainer.down":"_tableContainerDownHandler","tableContainer.focus":"_tableContainerFocusHandler","tableContainer.pointerover":"_tableContainerPointeroverHandler","document.down":"_documentDownHandler","document.keydown":"_tableContainerKeydownHandler","document.keyup":"_tableContainerKeyupHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler"}}template(){return Smart.Templates[this.nodeName]&&delete Smart.Templates[this.nodeName],this.virtualization?'<div id="container" class="smart-container" role="presentation">\n <div id="header" class="smart-table-header" role="toolbar">\n <smart-input id="filterInput" class="underlined" animation="[[animation]]" locale="[[locale]]" right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-input>\n <div id="filterTemplateContainer" class="smart-table-filter-template-container smart-hidden"></div>\n <smart-button id="conditionalFormattingButton" class="smart-table-toolbar-button conditional-formatting" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" aria-label="Conditional Formatting"></smart-button>\n </div>\n <smart-scroll-viewer style="opacity: 0.99" id="virtualizationContainer" class="smart-table-virtualization-container" right-to-left="[[rightToLeft]]" theme="[[theme]]">\n <table id="tableContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-table-container">\n <content></content>\n </table>\n </smart-scroll-viewer>\n <smart-pager id="pager" animation="[[animation]]" locale="[[locale]]" page-index="[[pageIndex]]" page-size="[[pageSize]]" pages-count="null" show-first-last-navigation-buttons show-page-size-selector show-prev-next-navigation-buttons show-summary right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-pager>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" aria-label="Loading">\n <span id="loadingIndicator" class="smart-loader" role="presentation"></span>\n </div>\n </div>':'<div id="container" class="smart-container" role="presentation">\n <div id="header" class="smart-table-header" role="toolbar">\n <smart-input id="filterInput" class="underlined" animation="[[animation]]" locale="[[locale]]" right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-input>\n <div id="filterTemplateContainer" class="smart-table-filter-template-container smart-hidden"></div>\n <smart-button id="conditionalFormattingButton" class="smart-table-toolbar-button conditional-formatting" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" aria-label="Conditional Formatting"></smart-button>\n </div>\n <table id="tableContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-table-container">\n <content></content>\n </table>\n <smart-pager id="pager" animation="[[animation]]" locale="[[locale]]" page-index="[[pageIndex]]" page-size="[[pageSize]]" pages-count="null" show-first-last-navigation-buttons show-page-size-selector show-prev-next-navigation-buttons show-summary right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-pager>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" aria-label="Loading">\n <span id="loadingIndicator" class="smart-loader" role="presentation"></span>\n </div>\n </div>'}resetState(e){const t=this;switch(e){case"expanded":t._expandedIds=[],t._state.expanded=[];break;case"selected":t._selectedIds=[],t._disabledSelection=[],t._selectableGroupRecords=[],t.set("selected",[]),t._state.selected=[];break;default:t._dblclickObject={numberOfClicks:0},t._expandedIds=[],t._selectedIds=[],t._disabledSelection=[],t._selectableGroupRecords=[],t._state={expanded:[],selected:[],sorted:[]},t.set("selected",[])}}render(){this._render(),super.render()}_render(){const e=this,t=getComputedStyle(e);if(e.setAttribute("role","presentation"),e.$.tableContainer.id=e.id+"TableContainer",e._cachedWidth=e.offsetWidth,e._cachedHeight=e.offsetHeight,e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)},e._isMobile=Smart.Utilities.Core.isMobile,e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?8:Smart.Utilities.Core.Browser.Edge?16:4,e._dblclickObject={numberOfClicks:0},e._expandedIds=[],e._selectedIds=[],e._disabledSelection=[],e._selectableGroupRecords=[],e._state={expanded:[],selected:[],sorted:[]},e._rowHeight=parseFloat(t.getPropertyValue("--smart-table-row-height")),e._rowDetailHeight=parseFloat(t.getPropertyValue("--smart-table-row-detail-height")),e._animation=e.animation,e._setFocusable(),e.selection&&e.$.tableContainer.setAttribute("aria-multiselectable",!0),e.virtualization){const t=e.$.virtualizationContainer,a=e;t&&(t._mouseWheelHandler=function(e){const l=t;if(!l.disabled&&(l.computedHorizontalScrollBarVisibility||l.computedVerticalScrollBarVisibility)){if(e.shiftKey&&l.computedHorizontalScrollBarVisibility){const t=l.scrollLeft;if(0===t&&e.deltaX<0||t===l.scrollHeight&&e.deltaX>0)return;return e.stopPropagation(),e.preventDefault(),void(l.scrollWidth>0&&l.scrollTo(void 0,l.scrollLeft+l._getScrollCoefficient(e,l.offsetWidth)))}if(l.computedVerticalScrollBarVisibility){const t=l.scrollTop;if(0===t&&e.deltaY<0||t===l.scrollHeight&&e.deltaY>0)return;if(e.stopPropagation(),e.preventDefault(),l.scrollHeight>0){let t=3*a._rowHeight;e.deltaY<=0&&(t=-3*a._rowHeight),Math.abs(e.deltaY)>=100?l.scrollTop+=t:l.scrollTop+=e.deltaY}}}},t._verticalScrollbarHandler=function(t){0===e.deferredScrollDelay?e._onVerticalChange(t):(e._verticalScrollTimer&&(clearTimeout(e._verticalScrollTimer),delete e._verticalScrollTimer),e._verticalScrollTimer=setTimeout((()=>{e._onVerticalChange(t),delete e._verticalScrollTimer}),e.deferredScrollDelay))}),t.hasStyleObserver=!1,t.$.verticalScrollBar.hasStyleObserver=!1,t.$.horizontalScrollBar.hasStyleObserver=!1,e.freezeHeader=!0,e.freezeFooter=!0}e.isRendered?e.innerHTML&&e.innerHTML.trim().length>1?e._initDataSourceFromHTML():e._fullRefresh():(e._createElement(),setTimeout((()=>{const t=e.querySelectorAll("tr[row-id]");if(t.length>0){let a=!1;for(let l=0;l<t.length;l++){const i=t[l];e._rowHeight<i.offsetHeight&&(e._rowHeight=i.offsetHeight,a=!0)}a&&(e.style.setProperty("--smart-table-row-height",e._rowHeight+"px"),e._refreshDataRows())}}),500),e.columnMenu&&(e._initialState=e.getState()),super.render())}_initDataSourceFromHTML(){const e=this,t=e.context;e.context=e,e.hasAttribute("smart-blazor")&&(e.$.tableContainer.innerHTML="");const a=e.columns;e.dataSource=null,e.rows=null,e.columns=null;const l=e.querySelectorAll("th");let i=[],n=[],r=[];for(let e=0;e<l.length;e++){const t=l[e].innerHTML.trim();let a={label:t,dataField:t,dataType:"string"};i.push(a),n.push(t)}if(0===l.length&&a&&a.length>0)for(let e=0;e<a.length;e++){const t=a[e];let l={label:t.label,dataField:t.dataField,dataType:t.dataType};t.width&&(l.width=t.width),t.allowResize&&(l.allowResize=t.allowResize),t.allowFilter&&(l.allowFilter=t.allowFilter),t.allowSort&&(l.allowSort=t.allowSort),t.allowHide&&(l.allowHide=t.allowHide),t.allowMenu&&(l.allowMenu=t.allowMenu),t.freeze&&(l.freeze=t.freeze),t.responsivePriority&&(l.responsivePriority=t.responsivePriority),t.columnGroup&&(l.columnGroup=t.columnGroup),i.push(l),n.push({name:t.dataField,dataType:t.dataType})}const o=e.querySelectorAll("tr");for(let e=0;e<o.length;e++){const t={},a=o[e].querySelectorAll("td");if(a.length>0){for(let e=0;e<i.length;e++)t[i[e].dataField]=a[e].innerHTML.trim();r.push(t)}}const s=new Smart.DataAdapter({dataSource:r,expandHierarchy:e.expandHierarchy,dataFields:n,id:e.dataRowId});e.$.tableContainer.innerHTML="",e.columns=i,e.context=t,e.dataSource=s}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog)),e.isRendered&&e.isCompleted&&e.endUpdate()}detached(){const e=this;if(super.detached(),e._focusedCell&&!e.$.tableContainer.contains(e._focusedCell)&&delete e._focusedCell,!e._dialog)return;e._detachCachedTemplates();const t=e._dialog;t.removeEventListener("change",e._dialogEventHandler),t.removeEventListener("clear",e._dialogEventHandler),t.removeEventListener("click",e._dialogEventHandler),t.removeEventListener("close",e._dialogEventHandler),t.removeEventListener("filter",e._dialogEventHandler),t.remove()}addFilter(e,t){const a=this,l=a.columnByDataField[e];l&&!1!==l.allowFilter&&t instanceof Smart.Utilities.FilterGroup!=0&&(e=l.dataField,a._clearSortByRow&&a._clearSortByRow(!0),a._designerFiltersApplied&&a._clearDesignerFilters(),a._filterInfo.appliedFilters||(a._filterInfo.appliedFilters={}),a._filterInfo.appliedFilters[e]=t,a._refreshFilters("add"),a.$.filterInput&&t&&!a.filterRow&&!a.columnMenu&&(a.$.filterInput.value=t.filters[t.filters.length-1].value,a._filterInfo.query=a.$.filterInput.value),a._originalDynamicColumnsOrder&&(a._originalDynamicColumnsOrder=a._dynamicColumns.map((e=>e.id))))}addGroup(e){const t=this;if(!t.grouping)return;const a=t.columnByDataField[e];if(!a||!1===a.allowGroup)return;const l=t.dataSource,i=l.groupBy;e=a.dataField,-1===i.indexOf(e)&&(i.push(e),l.refreshHierarchy(),t._getSelectableGroupRecords(),t._fullRefresh(),t._updateState("grouped"),t._doNotFireEvent||t.$.fireEvent("group",{action:"add",dataField:e}))}beginEdit(e,t){const a=this;if(!a.editing)return;const l=a.columnByDataField[t];if(t=l?l.dataField:void 0,"cell"===a.editMode&&!t||l&&!1===l.allowEdit)return;const i=a.rowById[e];if(!i)return;const n=i.data.$.id;a._editing&&a.endEdit(),a._beginEdit({rowId:n,rowObject:i,dataField:t})}cancelEdit(){const e=this,t=e._editing;if(t){for(let a=0;a<t.cells.length;a++){const l=t.cells[a];l.editor.contains(e.getRootNode().activeElement)&&e._focusCell(l.element),l.editor.remove(),e._setCellContent(l.element,e._formatCellValue(t.row,e.columnByDataField[l.dataField],l.element)),l.element.classList.remove("editing")}delete e._editing}}clearFilters(e=null){const t=this,a=t._filterInfo;(a.inputFilters||a.rowFilters||a.appliedFilters)&&(t._clearFilterInput(),t._clearRowFilters(e),delete t._filterInfo.appliedFilters,t.dataSource.virtualDataSource||t.dataSource.clearFilter(),t._fullRefresh("filter"),t._updateState("filtered"),t._doNotFireEvent||t.$.fireEvent("filter",{action:"remove"}))}clearGrouping(){const e=this,t=e.dataSource;0!==t.groupBy.length&&(t.groupBy=[],t.refreshHierarchy(),e._getSelectableGroupRecords(),e._fullRefresh(),e._updateState("grouped"),e.$.fireEvent("group",{action:"remove"}))}clearSelection(){this._clearSelection(!0)}collapseAllRows(){const e=this;e._isExpandCollapseForbidden()||function t(a){for(let l=0;l<a.length;l++){const i=a[l];i.leaf||(i.children&&t(i.children),i.expanded&&e.collapseRow(i.$.id))}}(e["smart-table"===e.nodeName.toLowerCase()?"dataSource":"rows"].boundHierarchy)}collapseGroup(e){const t=this;if(!t.grouping||0===t.dataSource.groupBy.length)return;const a=t._getGroupByIndex(e);if(!a||!a.expanded)return;const l=t.$.tableContainer.querySelector(`tr[row-id="${a.$.id}"]:not([unused])`);if(!l){a.expanded=!1;let e=a.$.id;return e=e.replace("Item","").replace(/_/gi,"."),void t.$.fireEvent("group",{action:"collapse",path:e,dataField:a.groupDataField,label:a.label})}if(t._isCollapsed(a))return l.setAttribute("aria-expanded",!1),l.classList.remove("expanded"),void(a.expanded=!1);t._hierarchyArrowClickHandler(l)}collapseRow(e){const t=this;if(t._isExpandCollapseForbidden())return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e],l=a.data||a;if(!a||l.leaf||!l.expanded)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);return i?t._isCollapsed(l)?(i.setAttribute("aria-expanded",!1),i.classList.remove("expanded"),l.expanded=!1,t._expandedIds=t._expandedIds.filter((e=>e!==l.$.id)),t._updateState("expanded"),void t.$.fireEvent("collapse",{record:l})):void t._hierarchyArrowClickHandler(i):(l.expanded=!1,t._expandedIds=t._expandedIds.filter((e=>e!==l.$.id)),void t._updateState("expanded"))}collapseRowDetails(e){const t=this;if(!t.rowDetailTemplate)return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e],l=a.data||a;if(!a||!l)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);if(!i)return;const n=i.nextElementSibling;n&&n.classList.contains("smart-table-row-detail")&&!n.classList.contains("collapsed")&&t._toggleRowDetail(i,l.$.id)}collapseAllRowDetails(){const e=this;if(!e.rowDetailTemplate||!e.dataSource)return;let t=e.dataSource.boundSource;t||(t=e.$.tableContainer.querySelectorAll("tr[row-id]:not([unused])"));for(let a=0;a<t.length;a++)e.collapseRowDetails(t[a].$.id)}expandAllRowDetails(){const e=this;if(!e.rowDetailTemplate||!e.dataSource)return;let t=e.dataSource.boundSource;t||(t=e.$.tableContainer.querySelectorAll("tr[row-id]:not([unused])"));for(let a=0;a<t.length;a++)e.expandRowDetails(t[a].$.id)}updateRow(e,t,a){const l=this,i=l.rowById?l.rowById[e]:l.rows.dataItemById[e];if(!i)return;const n=l._selectedIds.slice(0);l._editing=!0,l.__updatedRows=!0;let r=[];l.dataSource&&l.dataSource.groupBy&&l.dataSource.groupBy.toArray&&(r=l.dataSource.groupBy.toArray().slice(0));const o=l.dataSource.boundSource.canNotify;l.dataSource.boundSource.canNotify=!1;const s=e=>{if(i.data[e]=t[e],l.dataSource.id&&i&&i.data&&i.data.$&&(i.data.$.id=t[l.dataSource.id]),i&&i.data.$&&void 0!==i.data.$.index){const a=i.data.$.index,n=l.dataSource.dataSource,o=()=>{const a=t[e];if(null==a){const t=l.columnByDataField[e];return t?"number"===t.dataType?0:"boolean"!==t.dataType&&("date"===t.dataType?new Date:""):""}return a};if(n&&n[a]&&(n[a][e]=o()),l.dataSource[a]){if(r.length>0&&!l._dirtyHierarchy&&l.dataSource[a][e]!==o()&&r.indexOf(e)>=0){const e=l._getExpandedGroups(l.dataSource.boundHierarchy);l._dirtyHierarchy=e}l.dataSource[a][e]=o()}}};for(let e=0;e<l.columns.length;e++){const a=l.columns[e];void 0!==t[a.dataField]&&s(a.dataField)}if(a){const e=l.dataSource.dataFields;if(e)for(let t=0;t<e.length;t++)e[t].map?s(e[t].map):s(e[t].name)}l._editing=!1,l.dataSource.boundSource.canNotify=o,l.__updating||(l.dataSource.refreshHierarchy(),l._fullRefresh(void 0,n,"update"))}addRow(e){const t=this;let a=[];const l=t.dataSource.boundSource.canNotify;if(t.dataSource.boundSource.canNotify=!1,t._editing=!0,t.__updatedRows=!0,t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.toArray&&(a=t.dataSource.groupBy.toArray().slice(0),a.length>0&&t.dataSource.beginUpdate()),a.length>0)t.dataSource?t.dataSource.add(e,!0):t._addNewRow(e,0);else if(t.dataSource)if(t.dataSource.boundHierarchy&&t.$.tableContainer&&"treegrid"===t.$.tableContainer.getAttribute("role")){const a=e[t.dataSource.parentDataField];t.dataSource.add(e,a)}else t.dataSource.add(e,!0);else t._addNewRow(e,0);t.dataSource.boundSource.canNotify=l,t._editing=!1,a.length>0||t.dataSource.boundHierarchy&&t.$.tableContainer&&"treegrid"===t.$.tableContainer.getAttribute("role")?(t._dataSourceUpdatingTimer&&clearTimeout(t._dataSourceUpdatingTimer),t._dataSourceUpdatingTimer=setTimeout((()=>{t._doNotFireEvent=!0;const e=t._getExpandedGroups(t.dataSource.boundHierarchy);a.forEach((e=>t.addGroup(e))),t.dataSource.endUpdate(),t._restoreExpandedGroups(e),t._fullRefresh("update"),t._doNotFireEvent=!1}),50)):(t._dataSourceUpdatingTimer&&clearTimeout(t._dataSourceUpdatingTimer),t._dataSourceUpdatingTimer=setTimeout((()=>{t._doNotFireEvent=!0,t._fullRefresh("update"),t._doNotFireEvent=!1})))}removeRow(e){const t=this,a=t.rowById?t.rowById[e]:t.rows.dataItemById[e];if(!a){if(t.dataSource&&t.dataSource.dataItemById){const a=t.dataSource.dataItemById[e];if(a){const l=void 0!==a.$?a.$.index:0;t.dataSource.removeAt(l),t._selectedIds.indexOf(e)>=0&&(t._selectedIds.splice(t._selectedIds.indexOf(e),1),t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:"remove"})),t.virtualization&&t.__updating||t._fullRefresh("update")}}return}const l=a.data||a,i=void 0!==l.$?l.$.index:0,n=t.dataSource.boundSource.canNotify;t.dataSource.boundSource.canNotify=!1,t._editing=!0,t.__updatedRows=!0;let r=[];t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.toArray&&(r=t.dataSource.groupBy.toArray().slice(0),r.length>0&&t.dataSource.beginUpdate()),t._doNotFireEvent=!0,t._sortColumns&&t._sortColumns.length?t.dataSource.remove(l):t.dataSource.removeAt(i),t._selectedIds.indexOf(e)>=0&&(t._selectedIds.splice(t._selectedIds.indexOf(e),1),t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:"remove"})),t._doNotFireEvent=!1,t.dataSource.boundSource.canNotify=n,t._editing=!1,r.length>0&&(t._dataSourceUpdatingTimer&&clearTimeout(t._dataSourceUpdatingTimer),t._dataSourceUpdatingTimer=setTimeout((()=>{const e=t._getExpandedGroups(t.dataSource.boundHierarchy);r.forEach((e=>t.addGroup(e))),t.dataSource.endUpdate(),t._restoreExpandedGroups(e),t._fullRefresh("update")}),50)),t.virtualization&&t.__updating||t._fullRefresh("update")}expandRowDetails(e){const t=this;if(!t.rowDetailTemplate)return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e];if(!a)return;const l=a.data||a;if(!a||!l)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);if(!i)return;const n=i.nextElementSibling;!n&&!t.virtualization||n&&n.classList.contains("smart-table-row-detail")&&!n.classList.contains("collapsed")||t._toggleRowDetail(i,l.$.id)}endEdit(){const e=this,t=e._editing;if(!t)return;const a=t.row,l=a.data,i=[];let n=!0;for(let a=0;a<t.cells.length;a++){const l=t.cells[a],r=e.columnByDataField[l.dataField],o=l.element,s=l.editor;let d;if(r.editor&&r.editor.template?r.editor.getValue&&(d=r.editor.getValue(s)):(d=s.value,s instanceof HTMLInputElement&&("number"===s.type?d=parseFloat(d):"date"===s.type&&(d=new Date(d),isNaN(d.getTime())&&(d=null)))),r.validation){const t=r.validation(d),a=void 0!==t&&!0!==t;if(a){let a;a="object"==typeof t&&t.message?t.message:e.localize("invalidValue"),o.setAttribute("validation-message",a)}else o.removeAttribute("validation-message");o.classList.toggle("invalid",a),n=n&&!a}i.push({column:r,newValue:d})}if(n){if(e.dataSource.virtualDataSource){const a=Object.assign({},l);for(let e=0;e<t.cells.length;e++){const l=t.cells[e],n=i[e],r=n.column;a[l.dataField]=n.newValue,r.transform&&(a[r.dataField]=r.transform(n.newValue))}for(const t of e._columns)a[t.dataField]instanceof Date&&(a[t.dataField]=a[t.dataField].toISOString().slice(0,10));e._editing.row.data=a,e._requestVirtualDataSource("update",(function(t){return t?r(!1,a):(e._editing.row.data=l,e.cancelEdit()),t}))}else r(!0,l);delete e._editing}function r(l,n){for(let r=0;r<t.cells.length;r++){const o=t.cells[r],s=i[r],d=s.column,c=o.editor;c.contains(e.getRootNode().activeElement)&&e._focusCell(o.element),c.remove(),l&&(n[o.dataField]=s.newValue,d.transform&&(n[d.dataField]=d.transform(s.newValue))),e._setCellContent(o.element,e._formatCellValue(a,d,o.element)),o.element.classList.remove("editing"),e.$.fireEvent("cellEndEdit",{id:n.$.id,row:n,value:n[o.dataField],dataField:o.dataField})}e._updateCellsWithFormulas(),"row"===e.editMode&&e.$.fireEvent("rowEndEdit",{id:n.$.id,row:n})}}expandAllRows(){const e=this;if(e._isExpandCollapseForbidden())return;e.beginUpdate();const t=e["smart-table"===e.nodeName.toLowerCase()?"dataSource":"rows"].boundHierarchy;if(t)for(let e=0;e<t.length;e++){const a=t[e],l=e=>{if(!e.leaf&&(e.expanded=!0,e.children))for(let t=0;t<e.children.length;t++){const a=e.children[t];l(a)}};l(a)}e.endUpdate()}isGroupExpanded(e){const t=this,a=t.dataSource;if(!t.grouping||0===a.groupBy.length)return;const l=t._getGroupByIndex(e);return!!l&&l.expanded}expandGroup(e){const t=this,a=t.dataSource;if(!t.grouping||0===a.groupBy.length)return;const l=t._getGroupByIndex(e);if(!l)return;const i=t._doNotFireEvent,n=t.animation,r=t.$.tableContainer.querySelector(`tr[row-id="${l.$.id}"]:not([unused])`);let o=!1;if(i&&(t.animation="none"),r){if(t._isCollapsed(l))if(i)o=!0;else{let e=l.parent;e&&!e.expanded&&t.expandGroup(l.parent.$.id.replace("Item","").replace(/_/g,"."))}l.expanded||(o||i?(l.expanded=!0,r.setAttribute("aria-expanded",!0),r.classList.add("expanded")):t._hierarchyArrowClickHandler(r,i)),i&&(l.expanded=!0,r.setAttribute("aria-expanded",!0),r.classList.add("expanded"),requestAnimationFrame((()=>t.animation=n)))}else if(l.expanded=!0,!l.expanded&&!i){let e=l.$.id;e=e.replace("Item","").replace(/_/gi,"."),t.$.fireEvent("group",{action:"expand",path:e,dataField:l.groupDataField,label:l.label})}}expandAllRootGroups(){const e=this;if(!e.grouping)return;e.beginUpdate();const t=e.dataSource.boundHierarchy;if(t)for(let e=0;e<t.length;e++)t[e].expanded=!0;e.endUpdate()}expandAllGroups(){const e=this;if(!e.grouping)return;e.beginUpdate();const t=e.dataSource.boundHierarchy;if(t)for(let e=0;e<t.length;e++){const a=t[e],l=e=>{if(e.expanded=!0,e.children)for(let t=0;t<e.children.length;t++){const a=e.children[t];l(a)}};l(a)}e.endUpdate()}collapseAllGroups(){const e=this;if(!e.grouping)return;e.beginUpdate();const t=e.dataSource.boundHierarchy;if(t)for(let e=0;e<t.length;e++)t[e].expanded=!1;e.endUpdate()}expandRow(e){const t=this;if(t._isExpandCollapseForbidden())return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e],l=a.data||a;if(!a||l.leaf)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);if(!i)return l.expanded=!0,-1===t._expandedIds.indexOf(l.$.id)&&t._expandedIds.push(l.$.id),t._updateState("expanded"),void t.$.fireEvent("expand",{id:l.$.id,record:l});if(t._isCollapsed(l)){let e=l.parent;e&&!e.expanded&&t.expandRow(e.$.id)}l.expanded||t._hierarchyArrowClickHandler(i)}exportData(e,t,a,l){const i=this,n=i._columns.filter((e=>e.visible)),r=i.columnGroups,o=i.dataSource,s=getComputedStyle(i),d=s.borderRightColor,c=new Smart.Utilities.DataExporter(void 0,o.groupBy.toArray()),u={};let f,m=Array.from(i.$.tableContainer.firstElementChild.querySelectorAll("th"));if(o.virtualDataSource){f=[];for(let e=0;e<i.rows.length;e++)f.push(i.rows[e].data)}else o.boundHierarchy&&!i.grouping?(c.hierarchical=!0,f=function e(t){const l=[];return t.forEach((t=>{a&&!1===t.$.filtered||(l.push(t),t.leaf||(t._expanded=t.expanded,t.children&&(t.children=e(t.children),0===t.children.length&&(t._expanded=void 0,t.children=void 0,t.leaf=!0))))})),l}(JSON.parse(JSON.stringify(o.boundHierarchy,((e,t)=>{if("parent"!==e)return t}))))):(f=Array.from(o.toArray()),a&&(f=f.filter((e=>!1!==e.$.filtered))));c.style={border:"1px solid "+d,borderCollapse:"collapse",backgroundColor:s.backgroundColor,color:s.color,fontFamily:"Helvetica",header:{border:"1px solid "+d,fontWeight:"bold"},columns:{border:"1px solid "+d}},m=m.filter((e=>!1===e.classList.contains("smart-table-select-all")));for(let e=0;e<n.length;e++){const t=n[e],a={},l={};let i=m[e].offsetWidth+"px";u[t.dataField]=t.label,"date"===t.dataType&&(l.format="d"),a.width=i,c.style.header[t.dataField]=a,c.style.columns[t.dataField]=l}return r?c.header={columns:n,columngroups:r}:f.unshift(u),c.exportData(f,e,t,l)}getRowIndexById(e){const t=this.rowById[e];return this.dataSource&&t&&t.data&&t.data.$?t.data.$.index:-1}getSelection(){const e=this;return 0===e._selectableGroupRecords.length?e._selectedIds.filter((e=>!(""+e).startsWith("Item"))):e._selectedIds.filter((t=>-1===e._selectableGroupRecords.indexOf(t)&&!(""+t).startsWith("Item")))}getState(){return JSON.parse(this._stringifyState())}getValue(e,t){const a=this,l=a.columnByDataField[t];if(!l)return;let i=a.rowById[e];return i?i.data[l.dataField]:(i=a.dataSource.dataItemById[e],i?i[l.dataField]:void 0)}loadState(e){const t=this;if(!e&&!(e=window.localStorage.getItem("smartTable"+t.id)))return;const a=t.stateSettings;let l=!1;if(t._loadingState=!0,"string"==typeof e&&(e=JSON.parse(e)),-1!==a.indexOf("columns")){const a=t.loadColumnStateBehavior,i=t._columns,n=[],r=e.columns;for(let e=0;e<r.length;e++){let t=Object.assign({},r[e]);const l=i.find((e=>e.dataField===t.dataField));if(!l){"implementationOnly"!==a&&n.push(t);continue}const o=l.label,s=["editor","formatFunction","templateElement","templateElementSettings","transform","validation"];"stateOnly"!==a&&s.push("label");for(let e in l)-1===s.indexOf(e)&&delete l[e];t=Object.assign(l,t),"stateOnly"!==a&&o&&(t.label=o),n.push(t)}if("stateOnly"!==a)for(let e=0;e<i.length;e++){const t=i[e];n.find((e=>e.dataField===t.dataField))||n.push(t)}t.columns=n,t._initColumns(!0),l=!0,t._formattingPanel&&(t._formattingPanel.columns=t._columns)}if(t.grouping){const a=t.dataSource,i=t.dataSource.groupBy;e.grouped=e.grouped||[],JSON.stringify(i._array)!==JSON.stringify(e.grouped)&&(t.dataSource.groupBy=e.grouped,a.refreshHierarchy(),l=!0)}else t.hasAttribute("hierarchy")&&-1!==a.indexOf("expanded")&&JSON.stringify(t._expandedIds.slice(0).sort())!==JSON.stringify(e.expanded.slice(0).sort())&&(t.collapseAllRows(),t._expandedIds=e.expanded,l=!0);-1!==a.indexOf("selected")&&e.selected.slice&&JSON.stringify(t._selectedIds.slice(0).sort())!==JSON.stringify(e.selected.slice(0).sort())&&(t._selectedIds=e.selected,l=!0),l&&(t._initRows(),t.refresh());e:if(-1!==a.indexOf("filtered")){const a=t.filtering,l=e.filtered;if(t.clearFilters(),!l)break e;if(a&&t.filterRow&&l.rowFilters){const a=t.$.tableContainer.querySelector(".smart-table-filter-row"),l=Number(t.selection),i=e.filtered.filterRowValues;for(let e=0;e<t._columns.length;e++){const n=i[e];if(!n)continue;const r=t._columns[e].dataType,o=a.children[e+l].firstElementChild,s=t._filterInfo["string"===r?"stringConditions":"numberAndDateConditions"].find((e=>e.value===n.condition));if(-1===["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(s.value))if("date"===r){const e=new Date(n.value),t=(e.getMonth()+1).toString(),a=e.getDate().toString();o.children[0].value=`${e.getFullYear()}-${"0".repeat(2-t.length)}${t}-${"0".repeat(2-a.length)}${a}`}else o.children[0].value=n.value;o.children[1].value=s.label,o.children[1].$.input.dataValue=s.value}t._applyRowFilters()}else if(a&&l.inputFilters)t.$.filterInput.value=l.query,t._filterByAll(l.query);else if(l.appliedFilters){t._filterInfo.appliedFilters||(t._filterInfo.appliedFilters={});for(let e in l.appliedFilters){const a=l.appliedFilters[e],i=new window.Smart.Utilities.FilterGroup;a.filters.forEach(((e,t)=>{const l=i.createFilter(e.type.replace("Filter",""),e.value,e.condition);i.addFilter(a.logicalOperators[t],l)})),t._filterInfo.appliedFilters[e]=i}t._refreshFilters("add")}}-1!==a.indexOf("sorted")&&(t.clearSort(),e.sorted.forEach&&e.sorted.forEach((e=>{t.sortBy(e.dataField,e.direction)}))),a.forEach((e=>t._updateState(e,!1))),t.autoSaveState&&window.localStorage.setItem("smartTable"+t.id,t._stringifyState()),delete t._loadingState}navigateTo(e){const t=this;if(isNaN(e)||null===e)return;const a=t.pageIndex;t.pageIndex=Math.max(Math.min(Math.round(e),t.$.pager.pagesCount-1),0),t.paging&&t.pageIndex!==a&&(t._fullRefresh("pageIndexChange"),t.$.fireEvent("page",{action:"pageIndexChange"}))}removeFilter(e){const t=this,a=t.columnByDataField[e];a&&t.filterRow&&t.clearFilters(e),t._filterInfo.appliedFilters&&a&&(e=a.dataField,t._clearSortByRow&&t._clearSortByRow(!0),t._designerFiltersApplied&&t._clearDesignerFilters(e),delete t._filterInfo.appliedFilters[e],t._refreshFilters("remove"),t._originalDynamicColumnsOrder&&(t._originalDynamicColumnsOrder=t._dynamicColumns.map((e=>e.id))))}removeGroup(e){const t=this,a=t.columnByDataField[e];if(!t.grouping||!a)return;e=a.dataField;const l=t.dataSource,i=l.groupBy,n=i.indexOf(e);-1!==n&&(i.splice(n,1),l.refreshHierarchy(),t._getSelectableGroupRecords(),t._fullRefresh(),t._updateState("grouped"),t.$.fireEvent("group",{action:"remove",dataField:e}))}saveState(){const e=this._stringifyState();return window.localStorage.setItem("smartTable"+this.id,e),JSON.parse(e)}enableSelect(e){const t=this;t.selection&&t._disabledSelection.indexOf(e)>=0&&(t._disabledSelection.splice(t._disabledSelection.indexOf(e),1),t._fullRefresh("update"))}disableSelect(e){const t=this;t.selection&&(t._disabledSelection.push(e),t._fullRefresh("update"))}select(e){const t=this;t.selection&&(Array.isArray(e)?t._changeSelectionOfMultiple(e,"select"):t._selectSingle(e)&&(t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:t._interaction?"interaction":"programmatic"})))}setValue(e,t,a){const l=this,i=l.columnByDataField[t];if(!i)return;let n,r=l.rowById[e];if(r)n=r.data;else{if(r=l.dataSource.dataItemById[e],!r)return;n=r}t=i.dataField,l.dataSource._updating=!0,i.transform?(n[i.originalDataField]=a,n[t]=i.transform(a)):n[t]=a;const o=l.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused]) td[data-field="${t}"]`);if(o&&(l._setCellContent(o,l._formatCellValue(r,i,o),o.classList.contains("tree-cell")),i.templateElement&&i.templateElementSettings)){const e=o.classList.contains("tree-cell"),t=o,a=e?t.children[0].children[1]:t,r=n.$.id;l._cachedTemplates&&l._cachedTemplates[i.dataField+"_"+r]&&(0===l._cachedTemplates[i.dataField+"_"+r].innerHTML.length?delete l._cachedTemplates[i.dataField+"_"+r]:(a.innerHTML="",a.appendChild(l._cachedTemplates[i.dataField+"_"+r]))),i.templateElementSettings(n[i.dataField],r,a.firstElementChild),l._cachedTemplates||(l._cachedTemplates=[]),l._cachedTemplates[i.dataField+"_"+r]||(l._cachedTemplates[i.dataField+"_"+r]=a.firstElementChild)}l._updateCellsWithFormulas(),delete l.dataSource._updating}unselect(e){const t=this;t.selection&&(Array.isArray(e)?t._changeSelectionOfMultiple(e,"unselect"):t._unselectSingle(e)&&(t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:t._interaction&&-1===t._disabledSelection.indexOf(e)?"interaction":"programmatic"})))}set scrollTop(e){const t=this;t.isRendered&&(e=parseInt(e),isNaN(e)||((t.virtualization?t.$.virtualizationContainer:t.$.container).scrollTop=e))}get scrollTop(){const e=this;return e.isRendered?(e.virtualization?e.$.virtualizationContainer:e.$.container).scrollTop:0}set scrollLeft(e){const t=this;t.isRendered&&(e=parseInt(e),isNaN(e)||((t.virtualization?t.$.virtualizationContainer:t.$.container).scrollLeft=e))}get scrollLeft(){const e=this;return e.isRendered?(e.virtualization?e.$.virtualizationContainer:e.$.container).scrollLeft:0}clearContent(){const e=this;for(;e.$.tableContainer.firstChild;)e.$.tableContainer.removeChild(e.$.tableContainer.firstChild)}applyContent(){const e=this;if(void 0===e.content)return void(e.content=e.$.tableContainer);if(""===e.content||null===e.content)return void e.clearContent();if(e.content instanceof HTMLElement)return e.clearContent(),void e.$.content.appendChild(e.content);const t=document.createDocumentFragment();let a=document.createElement("div");t.appendChild(a),e.content instanceof HTMLElement?a.appendChild(e.content):a.innerHTML=e.content;let l=Array.from(a.childNodes);a.parentNode.removeChild(a);for(let e=0;e<l.length;e++)t.appendChild(l[e]);e.clearContent(),e.$.tableContainer.appendChild(t)}propertyChangedHandler(e,t,a){const l=this;if(super.propertyChangedHandler(e,t,a),"innerHTML"!==e)switch(e){case"animation":case"theme":if("theme"===e){const e=getComputedStyle(l);l._defaults.text=l._toHex(e.color),l._defaults.highlight=l._toHex(e.backgroundColor)}if(l.filterRow){const t=l.$.tableContainer.querySelector(".smart-table-filter-row");Array.from(t.querySelectorAll("smart-input, smart-button")).forEach((t=>t[e]=a))}i(e,a);break;case"autoSaveState":a&&window.localStorage.setItem("smartTable"+l.id,l._stringifyState());break;case"columnGroups":a&&(l.columnResize&&(l.columnResize=!1),"auto"===l.columnSizeMode&&(l.removeAttribute("resize-max-reached"),l.columnSizeMode="default")),l.refresh();break;case"columnMinWidth":if(isNaN(parseFloat(a)))return void(l.columnMinWidth=t);l._handleAutoSizeMode(),l._handleFrozenColumnPositions(),l._refreshHorizontalScrollbar();break;case"columnResize":a&&l.columnGroups&&(l.columnResize=!1);break;case"columnResizeNormalize":l._columns&&l._columns.length>0&&""===l._columns[l._columns.length-1].dataField&&(l._columns.pop(),l.columns.pop()),l._initColumns(!0),l.refresh();break;case"columns":{l._conditionalFormatting&&delete l._conditionalFormatting;const e=l._sortColumns,t=l._filterInfo;if(l._clearFilterInput(),l._clearRowFilters(),delete l._filterInfo.appliedFilters,l._sortColumns=[],l._initColumns(!0),l.refresh(),l._formattingPanel&&(l._formattingPanel.columns=l._columns),l.dataSource.dataFields){let a=l.dataSource.dataFields||[];const i=l.columns;let n=!1;if(i.forEach((e=>{if(e.dataType){const t=a.find((t=>t.name===e.dataField));t?t.dataType=e.dataType:e.map?a.find((t=>e.map.indexOf(t.name)>=0?t:null))&&(l.dataSource.dataFields.push({name:e.dataField,map:e.map,dataType:e.dataType}),n=!0):(l.dataSource.dataFields.push({name:e.dataField,dataType:e.dataType}),n=!0)}})),n&&l.dataSource.dataBind){let a=[],i=[];if(l.dataSource&&l.dataSource.groupBy&&l.dataSource.groupBy.toArray&&(a=l.dataSource.groupBy.toArray().slice(0)),a.length>0&&(i=l._getExpandedGroups(l.dataSource.boundHierarchy)),l.dataSource.bindingCompleted=!1,l.dataSource.dataBind(),l._doNotFireEvent=!0,a.length>0&&(a.forEach((e=>l.addGroup(e))),l.dataSource.boundHierarchy&&l.dataSource.refreshHierarchy(),l._restoreExpandedGroups(i)),t.inputFilters?l._filterByAll(t.query):t.rowFilters?l._applyRowFilters():t.appliedFilters&&l._refreshFilters(),e&&(l._sortColumns=[],e.forEach((e=>{l.columnByDataField[e.dataField].sortOrder=null,l.sortBy(e.dataField,e.direction)}))),l._selectedIds.length>0){const e=JSON.stringify(l._selectedIds.slice(0).sort()),t=l.dataSource;l._selectedIds=l._selectedIds.filter((e=>void 0!==t.dataItemById[e]||-1!==l._selectableGroupRecords.indexOf(e))),e!==JSON.stringify(l._selectedIds.slice(0).sort())&&(l._updateSelectAllState(),l._updateState("selected"),l.$.fireEvent("change",{type:"remove"}))}l.virtualization&&setTimeout((()=>{const e=l.columns&&l.columns.length>0?l.columns[0].dataField:"";if(e){const t=l.querySelector('td[data-field="'+e+'"]');t&&l._rowHeight<t.offsetHeight&&(l._rowHeight=t.offsetHeight,l.style.setProperty("--smart-table-row-height",l._rowHeight+"px"),l._refreshDataRows())}}),300),delete l._doNotFireEvent}else t.inputFilters?l._filterByAll(t.query):t.rowFilters?l._applyRowFilters():t.appliedFilters&&l._refreshFilters(),e&&(l._sortColumns=[],e.forEach((e=>{l.columnByDataField[e.dataField].sortOrder=null,l.sortBy(e.dataField,e.direction)})))}break}case"columnSizeMode":if("auto"===a){if(l.columnGroups)return void(l.columnSizeMode="default");l._handleAutoSizeMode()}else l.removeAttribute("resize-max-reached"),l._columns.forEach((e=>{e.visible&&(e._isResponsive?e.headerCellElement.style.width=e.width||e._manualPercentageWidth?l._getColumnWidth(e.width||e._manualPercentageWidth,!0,e):null:e.headerCellElement.style.width=e.width||e._manualWidth?l._getColumnWidth(e.width||e._manualWidth,!0,e):null)}));l._handleFrozenColumnPositions(),l._refreshHorizontalScrollbar();break;case"conditionalFormatting":l._applyInitialConditionalFormatting(l.dataSource),l._refreshDataRows();break;case"conditionalFormattingButton":l.$.header.classList.toggle("smart-hidden",(!l.filtering||l.filterRow)&&!a),!a&&l._dialog&&l._dialog.close();break;case"dataSource":case"dataSourceSettings":{const i=l._sortColumns,n=l._filterInfo;if("dataSource"===e&&null===a&&(l.dataSource=[]),"dataSource"===e&&t&&a&&l.virtualization&&t instanceof Smart.DataAdapter&&t.length===a.length&&t.length>0&&a.length>0&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===a)return;l.beginUpdate();for(let e=0;e<a.length;e++){const t=a[e],i=l.dataSource[e].$.id;l.updateRow(i,t,!0)}return l.endUpdate(void 0,!0),void(l._cachedDataSource=a)}const r=l.$.virtualizationContainer?l.$.virtualizationContainer.scrollTop:0,o=void 0!==l.$.virtualizationContainer&&l.$.virtualizationContainer.$?l.$.virtualizationContainer.$.verticalScrollBar:null;o&&o.beginUpdate();let s=[];if(t&&t.groupBy&&t.groupBy.toArray&&(s=t.groupBy.toArray().slice(0)),l._dataBind(!0),l._doNotFireEvent=!0,s.length>0){const e=l._getExpandedGroups(t.boundHierarchy);if(l.__updating=!0,l.dataSource._groupBy&&(l.dataSource._groupBy.canNotify=!1),l._selectedIds.length>0){const e=JSON.stringify(l._selectedIds.slice(0).sort()),t=l.dataSource;l._selectedIds=l._selectedIds.filter((e=>void 0!==t.dataItemById[e]||-1!==l._selectableGroupRecords.indexOf(e))),s.forEach((e=>l.addGroup(e))),e!==JSON.stringify(l._selectedIds.slice(0).sort())&&(l._updateSelectAllState(),l._updateState("selected"),l.$.fireEvent("change",{type:"remove"}))}else s.forEach((e=>l.addGroup(e)));l.dataSource.boundHierarchy&&l.dataSource.refreshHierarchy(),l.dataSource._groupBy&&(l.dataSource._groupBy.canNotify=!0),l.__updating=!1,l._restoreExpandedGroups(e),l._fullRefresh("update")}if(n.inputFilters?l._filterByAll(n.query):n.rowFilters?l._applyRowFilters():n.appliedFilters&&l._refreshFilters(),i&&(l._sortColumns=[],i.forEach((e=>{l.columnByDataField[e.dataField].sortOrder=null,l.sortBy(e.dataField,e.direction)}))),l._selectedIds.length>0){const e=JSON.stringify(l._selectedIds.slice(0).sort()),t=l.dataSource;l._selectedIds=l._selectedIds.filter((e=>void 0!==t.dataItemById[e]||-1!==l._selectableGroupRecords.indexOf(e))),e!==JSON.stringify(l._selectedIds.slice(0).sort())&&(l._updateSelectAllState(),l._updateState("selected"),l.$.fireEvent("change",{type:"remove"}))}l.virtualization&&(setTimeout((()=>{const e=l.columns&&l.columns.length>0?l.columns[0].dataField:"";if(e){const t=l.querySelector('td[data-field="'+e+'"]');t&&l._rowHeight<t.offsetHeight&&(l._rowHeight=t.offsetHeight,l.style.setProperty("--smart-table-row-height",l._rowHeight+"px"),l._refreshDataRows())}}),300),l.$.virtualizationContainer.scrollTop=r,o&&(o.endUpdate(),l._onVerticalChange({detail:{value:o.value}},!0))),delete l._doNotFireEvent;break}case"disabled":case"unfocusable":case"keyboardNavigation":l._setFocusable(),i("unfocusable",l.disabled||l.unfocusable||!l.keyboardNavigation),"disabled"===e&&l._dialog&&l._dialog.close();break;case"hideSelectionColumn":l.refresh();break;case"columnMenu":l.$.header.classList.toggle("smart-hidden",(!l.filtering||l.filterRow||l.columnMenu)&&!l.conditionalFormattingButton),l.columnMenu&&(l._initialState=l.getState()),l.refresh();break;case"editing":a?l.$.tableContainer.removeAttribute("aria-readonly"):l.$.tableContainer.setAttribute("aria-readonly",!0);break;case"filtering":l.columnMenu||l.$.header.classList.toggle("smart-hidden",(!a||l.filterRow)&&!l.conditionalFormattingButton),a&&l.filterRow?l._createFilterRow():!1===a&&(l.filterRow&&l.$.tableContainer.querySelector(".smart-table-filter-row").remove(),(l._filterInfo.query||l._filterInfo.rowFilters||l._filterInfo.appliedFilters)&&l.clearFilters()),l.virtualization&&l.refresh();break;case"filterRow":if(l.$.header.classList.toggle("smart-hidden",(!l.filtering||a)&&!l.conditionalFormattingButton),!l.filtering)return;a?l._createFilterRow():(l.$.tableContainer.querySelector(".smart-table-filter-row").remove(),l._filterInfo.rowFilters&&l.clearFilters());break;case"filterTemplate":l._applyFilterTemplate();break;case"footerRow":{const e=l.$.tableContainer.querySelector("tfoot");e&&e.remove(),a&&l._createFooterRow();break}case"formulas":a?l._formulaParser=new Smart.FormulaParser(l):delete l._formulaParser,l._updateCellsWithFormulas(!0);break;case"freezeHeader":case"freezeFooter":l.virtualization&&(l[e]=!0);break;case"grouping":a||l.clearGrouping();break;case"headerRow":{const e=Array.from(l.$.tableContainer.firstElementChild.children);for(let t=1;t<e.length;t++)e[t].remove();a&&l._createCustomHeaderRow();break}case"locale":case"messages":{const e=l._dialog;if(l._localize(),l.filterRow){const e=l.$.tableContainer.querySelector(".smart-table-filter-row"),t=Array.from(e.querySelectorAll("smart-input.string-filter")),a=Array.from(e.querySelectorAll("smart-input.num-date-filter")),i=Array.from(e.querySelectorAll("smart-button"));t.concat(a).forEach((e=>e.title=l.localize("filterCondition"))),t.forEach((e=>{e.dataSource=l._filterInfo.stringConditions,void 0===e.$.input.dataValue?e.value=l.localize("CONTAINS"):e.value=l._filterInfo.stringConditions.find((t=>t.value===e.$.input.dataValue)).label})),a.forEach((e=>{e.dataSource=l._filterInfo.numberAndDateConditions,void 0===e.$.input.dataValue?e.value=l.localize("EQUAL"):e.value=l._filterInfo.numberAndDateConditions.find((t=>t.value===e.$.input.dataValue)).label})),i.forEach((e=>e.title=l.localize("clearFilter")))}e&&(e.$.footer.firstElementChild.innerHTML=l.localize("ok"),e.$.footer.children[1].innerHTML=l.localize("cancel"),e.classList.contains("conditional-formatting")?e.label=l.localize("conditionalFormatting"):e.classList.contains("drill-down")&&(e.label=l.localize("details"))),l._formattingPanel&&(l._formattingPanel.messages=l.messages,l._formattingPanel.locale=l.locale),Array.from(l.$.tableContainer.querySelectorAll(".group-label-value>.placeholder")).forEach((e=>{e.textContent=l.localize("EMPTY")}));break}case"pageIndex":l.pageIndex=Math.max(Math.min(Math.round(a),l.$.pager.pagesCount-1),0),l.paging&&l.pageIndex!==t&&(l._fullRefresh("pageIndexChange"),l.$.fireEvent("page",{action:"pageIndexChange"}));break;case"pageSize":l.paging&&(l._fullRefresh("pageSizeChange"),l.$.fireEvent("page",{action:"pageSizeChange"}));break;case"paging":if(!1===a){if(l.dataSource.virtualDataSource)return void(l.paging=!0);if(1===l.$.pager.pagesCount)return}l._fullRefresh();break;case"rowDetailTemplate":l._fullRefresh();break;case"rightToLeft":Array.from(l.$.tableContainer.querySelectorAll(".freeze-near, .freeze-far")).forEach((e=>{e.style.left=null,e.style.right=null,e.style.zIndex=null})),l._handleFrozenColumnPositions(),i("rightToLeft",a);break;case"selected":{const e=l._selectedIds.slice(0);l._clearSelection(),l._changeSelectionOfMultiple(a,"select","programmatic",e);break}case"selection":if(l.filterRow){const e=l.$.tableContainer.querySelector(".smart-table-filter-row");a?e.insertBefore(document.createElement("td"),e.firstElementChild):e.firstElementChild.remove()}l.refresh(),a?(l.$.tableContainer.setAttribute("aria-multiselectable",!0),l._updateSelectAllState()):l.$.tableContainer.removeAttribute("aria-multiselectable");break;case"selectionMode":{l.$.tableContainer.classList.remove("smart-unselectable");const e=l.querySelector(".smart-table-select-all");e&&("one"===l.selectionMode?e.classList.add("smart-visibility-hidden"):e.classList.remove("smart-visibility-hidden"));break}case"sortMode":"none"===a&&l.clearSort();break;case"tooltip":if(!a){const e=l.$.tableContainer.querySelector(".tooltip");e&&(e.classList.remove("tooltip"),e.removeAttribute("title"))}break;case"virtualization":l.virtualization=t}else l._initDataSourceFromHTML();function i(e,t){const a=[];l._dialog&&a.push(l._dialog,l._dialog.$.footer.firstElementChild,l._dialog.$.footer.children[1]),l._formattingPanel&&a.push(l._formattingPanel),a.forEach((a=>a[e]=t))}}_createElement(){const e=this;if(e._expandedRowDetailIds=[],e._editors={},isNaN(parseFloat(e.columnMinWidth))&&(e.columnMinWidth="50px"),e.columnGroups&&(e.columnResize=!1,e.columnSizeMode="default"),e.formulas&&(e._formulaParser=new Smart.FormulaParser(e)),e._setupPagingAndFiltering(),e._localize(),e._selectedIds=e.selected.slice(0),"one"===e.selectionMode){e._selectedIds=e._selectedIds.slice(0,1);const t=e.querySelector(".smart-table-select-all");t&&t.classList.add("smart-visibility-hidden")}e._dataBind(),e.editing||e.$.tableContainer.setAttribute("aria-readonly",!0),e.autoLoadState&&e.loadState(),e.autoSaveState&&window.localStorage.setItem("smartTable"+e.id,e._stringifyState())}_initColumns(e){const t=this,a=t.columns;if(!t.isRendered&&t.dataSource.length>0&&(!a||Array.isArray(a)&&0===a.length)&&(t.columns=t.dataSource.dataFields.map((e=>({label:e.name,dataField:e.name,dataType:e.dataType})))),t._filterInfo.stringDataFields=[],t._columns=[],t.columnByDataField={},t.columns.canNotify=!1,t.columns instanceof Smart.ObservableArray){const e=[];for(let a=0;a<t.columns.length;a++){let l=t.columns[a],i={};for(let e in l)i[e]=l[e];e.push(i)}t.columns=e}for(let a=0;a<t.columns.length;a++){let l=t.columns[a];if("string"==typeof l&&t.dataSource.dataFields){const e=t.dataSource.dataFields.find((e=>{if(e.name===l)return e}));l={label:l,dataField:l,dataType:e&&e.dataType||"string"}}void 0===l.label&&void 0===l.dataField||(void 0===l.label&&(l.label=l.dataField),void 0===l.dataField&&(l.dataField=l.label),l.dataType||(l.dataType="string"),"string"!==l.dataType&&"number"!==l.dataType||!1===l.allowFilter||!l.dataField||t._filterInfo.stringDataFields.push(l.dataField),l.visible=void 0===l.visible||!!l.visible,l.allowResize=void 0===l.allowResize||!!l.allowResize,t._transformColumnDataField(l,e),l.thHierarchy=[],t._columns.push(l),t.columnByDataField[l.dataField]=l)}if("default"===t.columnSizeMode&&t.selection){let e=!0;for(let a=0;a<t._columns.length;a++){const l=t._columns[a];if(!l.width){e=!1,l._isResponsive=!0,l._isFillRemainingWidth=!0;break}}!t.columnResizeNormalize&&e&&t._columns.push({dataField:"",label:"",visible:!0,allowResize:!1,allowFilter:!1,allowSort:!1})}t.columns=new Smart.ObservableArray(t._columns),t._updateState("columns"),t.columns.notify((function(e){if(!t.columns.canNotify)return;if("length"===e.action||"update"===e.action&&-1!==["allowGroup","allowSort","sortOrder"].indexOf(e.propertyName))return void t._updateState("columns");const a=e.target;if("update"===e.action){const l=a.dataField;if("allowEdit"===e.propertyName)return Array.from(t.$.tableContainer.querySelectorAll(`td[data-field="${l}"]`)).forEach((t=>{t.classList.toggle("no-edit",!1===e.newValue),!1===e.newValue?t.setAttribute("aria-readonly",!0):t.removeAttribute("aria-readonly")})),void t._updateState("columns");if("allowFilter"===e.propertyName)return"string"!==a.dataType&&"number"!==a.dataType||!l||(!1===e.newValue?t._filterInfo.stringDataFields=t._filterInfo.stringDataFields.filter((e=>e!==l)):!1===e.oldValue&&t._filterInfo.stringDataFields.push(l)),t.filterRow&&t.$.tableContainer.querySelector(`.smart-table-filter-row td[filter-for="${l}"]`).classList.toggle("no-filter",!1===e.newValue),"smart-pivot-table"===t.nodeName.toLowerCase()&&t._columnNotify(e),void t._updateState("columns");if("transform"===e.propertyName)a.sortOrder&&t.sortBy(a.dataField,null),t._transformColumnDataField(a,!0);else{if(-1!==["allowPivot","allowRowGroup","pivot","rowGroup","summary"].indexOf(e.propertyName)&&"smart-pivot-table"===t.nodeName.toLowerCase())return t._columnNotify(e),void t._updateState("columns");if("visible"===e.propertyName){const e=t._expandedRowDetailIds,a=t.$.tableContainer;let l;return t.filterRow&&(l=a.querySelector(".smart-table-filter-row"),l&&l.remove()),e&&e.length&&!t._columns.some((e=>e.visible))&&e.forEach((e=>t._toggleRowDetail(a.querySelector(`[row-id="${e}"]`),e))),t.$.tableContainer.setAttribute("aria-colcount",t._columns.filter((e=>e.visible)).length+ +t.selection),t.refresh(),void t._updateState("columns")}}}"add"===e.action&&(t.columns[t.columns.length-1].visible=!0),t._columns=t.columns._array,t.columnByDataField=[],t._columns.forEach((e=>{t.columnByDataField[e.dataField]=e,e.originalDataField&&(t.columnByDataField[e.originalDataField]=e)})),t.refresh(!0),t._updateState("columns")})),t.$.tableContainer.setAttribute("aria-colcount",t._columns.filter((e=>e.visible)).length+ +t.selection)}_transformColumnDataField(e,t){const a=this;if("function"==typeof e.transform){if(!a.isRendered||t){const l=a.dataSource,i=a.columns.canNotify;i&&(a.columns.canNotify=!1),t&&e.originalDataField&&(delete a.columnByDataField[e.dataField],e.dataField=e.originalDataField);const n=e.dataField,r=n+"Transformed";a.columnByDataField[n]=e,e.originalDataField=n,e.dataField=r,l.canNotify=!1;for(let t=0;t<l.length;t++){const a=l[t];a[r]=e.transform(a[n])}i&&(a.columns.canNotify=!0),l.canNotify=!0}}else e.transform&&(e.transform=void 0)}_initRows(){const e=this,t=e.dataSource,a=e.context;if(e.context=e,e.rows=[],e.rowById=[],t.virtualDataSource)return e._initRowsVirtualDataSource(),void(e.context=a);if(t.boundHierarchy)return e.$.tableContainer.setAttribute("role","treegrid"),e.setAttribute("hierarchy",""),e._initHierarchicalRows(),void(e.context=a);e.$.tableContainer.setAttribute("role","grid");let l=0,i=t.length,n=!1;if(e.removeAttribute("hierarchy"),e.paging){const a=e.pageSize;if(e._filterInfo.query||e._filterInfo.rowFilters||e._filterInfo.appliedFilters){let e=0;for(let a=0;a<i;a++)!1!==t[a].$.filtered&&e++;i=e,n=!0}const r=Math.max(Math.ceil(i/a),1);e.$.pager.pagesCount=r,e.$.pager.totalRecords=i,e.pageIndex=Math.max(Math.min(e.pageIndex,r-1),0),l=e.pageIndex*a,i=l+a}if(n){let a=-1;for(let n=0;n<t.length;n++){const r=t[n];if(r&&!1!==r.$.filtered){if(a++,a<l)continue;if(a>=i)break;e._addNewRow(r,n)}}}else for(let a=l;a<i;a++){const l=t[a];l&&!1!==l.$.filtered&&e._addNewRow(l,a)}e._observeRows(),e.context=a}_initRowsVirtualDataSource(){const e=this,t=e.dataSource;if(t.boundHierarchy)e.$.tableContainer.setAttribute("role","treegrid"),e.setAttribute("hierarchy",""),e._processHierarchy(t.boundHierarchy,0,t.boundHierarchy.length);else for(let a=0;a<t._dataSource.length;a++){const l=t[a];l&&!1!==l.$.filtered&&e._addNewRow(l,a)}if(e.paging){const a=t.length,l=e.pageSize,i=Math.max(Math.ceil(a/l),1),n=e.$.pager.pagesCount;if(e.$.pager.pagesCount=i,e.$.pager.totalRecords=a,e.pageIndex=Math.max(Math.min(e.pageIndex,i-1),0),null!==n&&n!==i)return void e._fullRefresh()}e._observeRows()}_initHierarchicalRows(){const e=this,t=e.dataSource.boundHierarchy;let a=0,l=t.length,i=!1;if(e.paging){const n=e.pageSize;if(e._filterInfo.query||e._filterInfo.rowFilters||e._filterInfo.appliedFilters){let e=0;for(let a=0;a<l;a++)!1!==t[a].$.filtered&&e++;l=e,i=!0}const r=Math.max(Math.ceil(l/n),1);e.$.pager.pagesCount=r,e.$.pager.totalRecords=l,e.pageIndex=Math.max(Math.min(e.pageIndex,r-1),0),a=e.pageIndex*n,l=a+n}if(i){let i=-1;for(let n=0;n<t.length;n++){const r=t[n];if(r&&!1!==r.$.filtered){if(i++,i<a)continue;if(i>=l)break;e._processHierarchy(t,n,n+1)}}}else e._processHierarchy(t,a,l);e._observeRows()}_processHierarchy(e,t,a){const l=this;for(let i=t;i<a;i++){const t=e[i];if(!t)break;t.leaf?t&&!1!==t.$.filtered&&l._addNewRow(t,i):(-1!==l._expandedIds.indexOf(t.$.id)?t.expanded=!0:void 0===t.expanded&&(t.expanded=!1),!1!==t.$.filtered&&l._addNewRow(t,i),t.children.length&&!1!==t.$.filtered&&l._processHierarchy(t.children,0,t.children.length))}}_observeRows(){const e=this;e.rows=new Smart.ObservableArray(e.rows),e.rows.notify((function(t){if(!e.rows.canNotify||t.path||!e.dataSource)return;e.rows.canNotify=!1;const a=t.action,l=e._selectedIds.slice(0);switch(e.dataSource.canNotify=!1,a){case"add":{const a={};e.dataSource.dataFields.forEach((e=>a[e.name]=""));const l=Object.assign(a,e.rows[t.index]);e.dataSource.add(e.rows[t.index]),e._editing={row:{data:l}};break}case"update":e.dataSource.update(t.index,e.rows[t.index]),e._editing={row:{data:e.rows[t.index]}};break;case"remove":{const a=t.removed[0].data,l=a.$.id,i=e._selectedIds.indexOf(l);e.dataSource.removeAt(a.$.index),delete e.rowById[l],-1!==i&&e._selectedIds.splice(i,1),e._editing={row:t.removed[0]},e._updateSelectAllState();break}}e._fullRefresh(a,l,a),delete e._editing,e.dataSource.canNotify=!0,e.rows.canNotify=!0}))}beginUpdate(){const e=this;if("smart-table"!==e.nodeName.toLowerCase())return;e.__updating=!0,e.__updatedRows=!1;const t=window.__karma__||window.karma;document.hidden&&!t||(e._dirtyHierarchy=!1,e.__updatingOldSelectedIds=e._selectedIds.slice(0),e.__updatingSortColumns=e._sortColumns,e.dataSource&&e.dataSource.clearSort&&e.dataSource.clearSort())}endUpdate(e,t){const a=this;if("smart-table"!==a.nodeName.toLowerCase())return;a.__updating=!1;const l=window.__karma__||window.karma;if(document.hidden&&!l)return;if(!1===e)return;l&&(t=!0);const i=()=>{const t=a.__updatingOldSelectedIds?a.__updatingOldSelectedIds:a._selectedIds.slice(0);a.__updatingOldSelectedIds&&delete a.__updatingOldSelectedIds,a._dirtyHierarchy&&a.dataSource.refreshHierarchy();const l=a._sortColumns,i=a._filterInfo,n=a.dataSource.groupBy._array.slice(0),r=void 0!==a.$.virtualizationContainer&&a.$.virtualizationContainer.$?a.$.virtualizationContainer.$.verticalScrollBar:null;if(r&&r.beginUpdate(),a._doNotFireEvent=!0,a._fullRefresh("update",t,"update"),n.length>0){let e=a._getExpandedGroups(a.dataSource.boundHierarchy);a._dirtyHierarchy&&(e=a._dirtyHierarchy),n.forEach((e=>a.addGroup(e))),a._restoreExpandedGroups(e)}i.inputFilters?a._filterByAll(i.query):i.rowFilters?a._applyRowFilters():i.appliedFilters&&a._refreshFilters(),l&&(a.__updatingSortColumns&&JSON.stringify(a.__updatingSortColumns)!==JSON.stringify(l)||0===n.length||!0===e||!1===a.__updatedRows)&&(a._sortColumns=[],l.forEach((e=>{a.columnByDataField[e.dataField].sortOrder=null,a.sortBy(e.dataField,e.direction)}))),r&&(r.endUpdate(),a._onVerticalChange({detail:{value:r.value}},!0),a._dirtyHierarchy&&(a._rowsInDOM.length<a.rows.length&&0===a.$.virtualizationContainer.$.verticalScrollBar.max&&a._refreshDataRows(),a._dirtyHierarchy=!1)),delete a._doNotFireEvent};if(a._verticalScrollTimer)return a._scheduleUpdate&&clearInterval(a._scheduleUpdate),void(a._scheduleUpdate=setInterval((function(){a._verticalScrollTimer||(i(),clearInterval(a._scheduleUpdate),delete a._scheduleUpdate)}),100));t?i():requestAnimationFrame((()=>{i()}))}_addNewRow(e,t){const a=this,l=e.$.id,i=new Smart.Observable({data:e,boundIndex:t});-1!==a._disabledSelection.indexOf(l)&&(i.allowSelect=!1),i.canNotify=!0,i.notify((function(t){if(a._editing||a._hierarchyChange)return;const i=a.selection;if("allowSelect"===t.propertyName){const n=a._disabledSelection.indexOf(l);if(a._hierarchyChange=!0,t.newValue||-1!==n)t.newValue&&-1!==n&&function e(t){const l=t.$.id,n=a.$.tableContainer.querySelector(`[row-id="${l}"]:not([unused])`),r=a.rowById[l];if(t.parent&&-1!==a._disabledSelection.indexOf(t.parent.$.id))r.allowSelect=!1;else if(a._disabledSelection.splice(a._disabledSelection.indexOf(l),1),n&&(n.classList.remove("disable-select"),i&&(n.setAttribute("aria-selected",!1),n.firstElementChild.firstElementChild.removeAttribute("aria-disabled"))),r&&(r.allowSelect=!0),t.children)for(let a=0;a<t.children.length;a++)e(t.children[a])}(e);else{const t=[];!function e(t,l){const n=t.$.id,r=a.$.tableContainer.querySelector(`[row-id="${n}"]:not([unused])`),o=a.rowById[n];if(l.push(n),r&&(r.removeAttribute("aria-selected"),r.classList.add("disable-select"),i&&r.firstElementChild.firstElementChild.setAttribute("aria-disabled",!0)),o&&(o.allowSelect=!1),t.children)for(let a=0;a<t.children.length;a++)e(t.children[a],l)}(e,t),a._disabledSelection=a._disabledSelection.concat(t),a.unselect(t)}delete a._hierarchyChange}})),a.rowById[l]=i,a.rows.push(i)}refresh(){const e=this;if(e.__updating)return;const t=e._columns.filter((e=>e.visible)),a=e.$.tableContainer,l=a.querySelector(".smart-table-filter-row"),i=a.querySelector("tfoot"),n=document.createElement("tbody"),r=e._getFractionOfMax(),o=e.virtualization?e.$.virtualizationContainer:e.$.tableContainer.parentElement,s={top:o.scrollTop,left:o.scrollLeft};for(e.columns.canNotify=!1;a.childNodes.length>0;)a.childNodes[0].remove();e._createTableHeader(),e.isRendered||!e.onInit||e._loadingState||e.onInit(),e._createCustomHeaderRow(),e._createFooterRow(i),e._createDataRows(n),e._createFilterRow(l);const d=a.querySelectorAll("th[data-field]");for(let a=0;a<t.length;a++){const l=t[a];l.headerCellElement=d[a],l.headerCellElement&&(l.headerCellElement.onclick=function(){const t=this.dataField;e.$.fireEvent("columnClick",{dataField:t}),e.closeColumnMenu(),"none"===e.sortMode||!1===l.allowSort||e._preventClickSort||(e._addSortIconContainer(this),e._sortOnClick=!0,this.headerCellElement.sortIconContainerElement.classList.contains("asc")?e.sortBy(t,"desc"):this.headerCellElement.sortIconContainerElement.classList.contains("desc")?e.sortBy(t,null):e.sortBy(t,"asc"),e._sortOnClick=!1)}.bind(l))}if(e._sortColumns&&e._sortColumns.length>0)for(let t=0;t<e._sortColumns.length;t++){const a=e._sortColumns[t],l=e.columnByDataField[a.dataField];e._addSortIconContainer(l,a.direction,t+1)}e._handleAutoSizeMode(),e._handleFrozenColumnPositions(),e._refreshHorizontalScrollbar(),e.isRendered&&(e.selection&&e._updateSelectAllState(),e._setFractionOfMax(r)),[o.scrollTop,o.scrollLeft]=[s.top,s.left],e.columns.canNotify=!0}_createTableHeader(){const e=this,t=e.selection,a=document.createElement("thead"),l=e._columns.filter((e=>e.visible)),i=e._getColumnHeaderStructure(),n=window.innerWidth,r={};for(let o=0;o<i;o++){const s=document.createElement("tr"),d=document.createDocumentFragment();t&&(s.innerHTML=o<i-1?'<th class="empty"></th>':'<th class="smart-table-select-all freeze-near" scope="col" aria-colindex="1"><div role="checkbox" aria-checked="false" aria-label="Toggle selection of all rows"></div></th>',e.virtualization&&Smart.Utilities.Core.Browser.Safari&&s.querySelector("th").classList.add("sticky")),o<i-1&&s.classList.add("column-groups-header");for(let a=0;a<l.length;a++){const s=l[a];if(0===o&&(s.width&&isNaN(parseFloat(s.width))&&delete s.width,s.responsivePriority&&("number"!=typeof s.responsivePriority&&(s.responsivePriority=1),s.responsivePriority=Math.max(Math.min(Math.round(s.responsivePriority),5),1),i>1&&(r[a]=e._isColumnHidden(s.responsivePriority,n)))),o<i-1){if(r[a])continue;const t=l[a],i=t.headerStructure[o];if(a>0){let r=a-1,s=l[r];for(;s&&e._isColumnHidden(s.responsivePriority,n);)r--,s=l[r];if(s&&i===s.headerStructure[o]&&e._areColumnsWithSameFreezeSettings(t,s))continue}const s=document.createElement("th");if(s.includes=[t],a<l.length-1){let r=1,d=a+1,c=l[d];for(;c;){if(!e._isColumnHidden(c.responsivePriority,n)){if(i!==c.headerStructure[o]||!e._areColumnsWithSameFreezeSettings(t,c))break;r++,s.includes.push(c)}d++,c=l[d]}s.colSpan=r}0!==o&&t.headerStructure[o-1]===i||(s.textContent=i),s.includes.forEach((e=>e.thHierarchy[o]=s)),s.classList.add("column-header"),t.freeze&&s.classList.add("freeze-"+("far"===t.freeze?"far":"near")),e.virtualization&&Smart.Utilities.Core.Browser.Safari&&s.classList.add("sticky"),d.appendChild(s)}else e._setupColumnHeaderCell(t,d,a,s)}s.appendChild(d),a.appendChild(s),e._tableHeader=a}if(e.$.tableContainer.appendChild(a),"default"===e.columnSizeMode){for(let t=0;t<e.columns.length;t++){const l=e.columns[t];if(!l.width){const t=a.querySelector('[data-field="'+l.dataField+'"]');t&&t.offsetWidth<5&&(t.style.width=parseInt(l.minWidth||e.columnMinWidth)+"px")}}if(t){const t=e.columns.filter((e=>e.visible));if(1===t.length){const e=t[0],l=a.querySelector('[data-field="'+e.dataField+'"]');l&&(l.style.width="")}}}}_getColumnHeaderStructure(){const e=this._columns,t=this.columnGroups;if(!t)return 1;let a=1;for(const l of e){let e=l.columnGroup;if(l.headerStructure=[],e&&(e=t.find((t=>t.name===e)),e))for(l.headerStructure.push(e.label||e.name);e.parentGroup&&(e=t.find((t=>t.name===e.parentGroup)),e);)l.headerStructure.unshift(e.label||e.name);l.headerStructure.push(l.label),a=Math.max(a,l.headerStructure.length)}for(const t of e){const e=t.headerStructure,l=e[0];for(;e.length<a;)e.unshift(l)}return a}_isColumnHidden(e,t){return!(!e||1===e||t>1280)&&(t<=640&&2===e||t<=800&&3===e||t<=1024&&4===e||t<=1280&&5===e)}_areColumnsWithSameFreezeSettings(e,t){return!e.freeze&&!t.freeze||e.freeze===t.freeze||!0===e.freeze&&"near"===t.freeze||"near"===e.freeze&&!0===t.freeze}getColumnProperty(e,t){const a=this,l=a.columnByDataField[e];if(!l)return null;switch(t){case"width":return l.width?a._getColumnWidth(l.width,!0,l):l._isResponsive&&l._manualPercentageWidth?a._getColumnWidth(l._manualPercentageWidth+"%",!0,l):a._getColumnWidth(l._manualWidth,!0,l);default:return l[t]}}setColumnProperty(e,t,a){const l=this;if(!l.columnByDataField[e])return null;l.columns.forEach(((i,n)=>{i.dataField===e&&(l.columns[n][t]=a)}))}_getTableRemainingWidth(){const e=this;let t=e.offsetWidth;if(e.selection){const a=e.$.tableContainer.querySelector(".smart-table-select-all");a&&(t=e.offsetWidth-a.offsetWidth),""===e.columns[e.columns.length-1].dataField&&(t-=e.columnMinWidth)}e.virtualization&&e.$.virtualizationContainer&&e.$.virtualizationContainer.computedVerticalScrollBarVisibility&&(t-=20);let a=0;for(let t=0;t<e.columns.length;t++){const l=e.columns[t];l.visible&&l.width&&!(""+l.width).endsWith("%")&&(a+=e._getColumnWidth(l.width))}return t-=a,t}_getColumnWidth(e,t,a){const l=this,i=parseFloat(e);if((e=(e+"").trim()).endsWith("%")){let e=l.offsetWidth;if(l.selection){const t=l.$.tableContainer.querySelector(".smart-table-select-all");t&&(e=l.offsetWidth-t.offsetWidth),""===l.columns[l.columns.length-1].dataField&&(e-=l.columnMinWidth)}l.virtualization&&l.$.virtualizationContainer&&l.$.virtualizationContainer.computedVerticalScrollBarVisibility&&(e-=20);let n=0;for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.visible&&t.width&&!(""+t.width).endsWith("%")&&(n+=l._getColumnWidth(t.width))}e-=n;const r=a&&a.minWidth||l._getNumericMinWidth(),o=t?i+"%":e*(i/100);return r>o?r:o}return isNaN(i)?"auto":t?i+"px":i}_setupColumnHeaderCell(e,t,a,l){const i=this,n=document.createElement("th");if(n.setAttribute("aria-colindex",a+1+ +e),l.width){let e=l.width;"number"==typeof e&&l.minWidth&&(e=Math.max(e,l.minWidth)),n.style.width=i._getColumnWidth(e,!0,l)}else l._manualWidth&&(l._isResponsive?n.style.width=l._manualPercentageWidth+"%":n.style.width=l._manualWidth+"px");if(1!==i._columns.length&&l.allowResize||n.setAttribute("locked",""),l.freeze&&n.classList.add("freeze-"+("far"===l.freeze?"far":"near")),l.responsivePriority&&n.classList.add("priority-"+l.responsivePriority),i.virtualization&&Smart.Utilities.Core.Browser.Safari&&n.classList.add("sticky"),n.setAttribute("data-field",l.dataField),n.innerHTML=`<div class="wrapper" role="presentation"><div class="label">${l.label}</div></div>`,i.columnMenu){const e=document.createElement("div");e.classList.add("column-menu"),e.setAttribute("aria-hidden",!0),n.firstElementChild.appendChild(e),e.onclick=e=>{i.activeColumnMenu&&i.activeColumnMenu.dataField===l.dataField?i.closeColumnMenu():i.openColumnMenu(l.dataField),e.preventDefault(),e.stopPropagation()}}i.onColumnRender&&i.onColumnRender(l.dataField,n),t.appendChild(n)}_refreshDataRows(){const e=this,t=window.scrollY,a=window.scrollX,l=e.$.tableContainer.children[1],i=Array.from(l.querySelectorAll("tr:not(.smart-table-filter-row)"));if(e._clearCachedTemplates(),e.filterRow||e.footerRow||e.headerRow)for(let e=0;e<i.length;e++)i[e].remove();else l.innerHTML="";e._createDataRows(l),e._handleAutoSizeMode(),e._handleFrozenColumnPositions(),e._refreshHorizontalScrollbar(),(a||t)&&window.scroll(a,t)}_createDataRows(e){const t=this;if(t.virtualization)return void t._createVirtualDataRows(e);const a=t.rowDetailTemplate,l=t.selection,i=document.createDocumentFragment(),n=t.hasAttribute("hierarchy");for(let e=0;e<t.rows.length;e++){const r=t.rows[e],o=r.data;o.groupDataField?t._createGroupHeader(o,i):t._createDataRow(r,i,{hierarchical:n,rowDetailTemplate:a,selection:l,virtualization:!1})}if(i.appendChild(t._createLastRow()),e.appendChild(i),t._updateState("expanded"),e.parentElement||t.$.tableContainer.insertBefore(e,t.$.tableContainer.querySelector("tfoot")),t.getRootNode().activeElement===t.$.tableContainer&&t._tableContainerFocusHandler(),t._templateTags.length){const e=t.querySelectorAll("tr");for(let a=0;a<t._templateTags.length;a++){const l=t._templateTags[a],i=l.index,n=l.dataField,r=l.td;if(e[i]){const t=e[i].querySelector('[data-field="'+n+'"]'),a=[...t.querySelectorAll("smart-button"),...t.querySelectorAll("button"),...t.querySelectorAll("a")],l=[...r.querySelectorAll("smart-button"),...r.querySelectorAll("button"),...r.querySelectorAll("a")];for(let e=0;e<a.length;e++)"button"===a[e].nodeName.toLowerCase()&&a[e].classList.contains("smart-button")||(a[e].onclick=()=>{l[e].click()})}}}}_createDataRow(e,t,a){const l=this,i=l._columns.filter((e=>e.visible)),n=e.data,r=n.$.id,o=document.createElement("tr"),s={row:o,detail:null};let d=0;o.setAttribute("aria-rowindex",n.$.index+1),l._processAndRenderSelection(n,o,a.hierarchical),a.selection&&d++;for(let t=0;t<i.length;t++){const s=document.createElement("td"),c=i[t];s.setAttribute("data-field",c.dataField),s.setAttribute("aria-colindex",t+1+ +a.selection);let u,f=l._formatCellValue(e,c,s);if(c.freeze&&s.classList.add("freeze-"+("far"===c.freeze?"far":"near")),c.responsivePriority&&s.classList.add("priority-"+c.responsivePriority),!1===c.allowEdit&&(s.classList.add("no-edit"),s.setAttribute("aria-readonly",!0)),0===t&&a.hierarchical){const e=l._areChildrenFiltered(n);n.leaf||(s.classList.add("tree-cell"),u=e),n.level&&(s.classList.add("outline-level-"+Math.min(n.level,10)),!n.leaf&&e||s.classList.add("tree-leaf"))}if(a.virtualization&&c.templateElement){const e=c.templateElement+"";u&&l._setCellContent(s,f,u);const t=u?s.children[0].children[1]:s;e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+n[c.dataField]+"</div>"):t.innerHTML=e,c.templateElementSettings&&(l._cachedTemplates&&l._cachedTemplates[c.dataField+"_"+r]&&(0===l._cachedTemplates[c.dataField+"_"+r].innerHTML.length?delete l._cachedTemplates[c.dataField+"_"+r]:(t.innerHTML="",t.appendChild(l._cachedTemplates[c.dataField+"_"+r]))),c.templateElementSettings(n[c.dataField],r,t.firstElementChild),l._cachedTemplates||(l._cachedTemplates=[]),l._cachedTemplates[c.dataField+"_"+r]||(l._cachedTemplates[c.dataField+"_"+r]=t.firstElementChild))}else l._setCellContent(s,f,u);l.onCellRender&&l.onCellRender(n,c.dataField,n[c.dataField],s),l._applyConditionalFormattingToCell(s,c.dataField,n.$.index),o.appendChild(s),d++}if(o.data=n,o.setAttribute("row-id",r),-1!==l._disabledSelection.indexOf(r)&&(o.removeAttribute("aria-selected"),o.classList.add("disable-select"),a.selection&&o.firstElementChild.firstElementChild.setAttribute("aria-disabled",!0)),n.expanded?(-1===l._expandedIds.indexOf(r)&&l._expandedIds.push(r),o.setAttribute("aria-expanded",!0),o.classList.add("expanded")):!1===n.expanded&&o.setAttribute("aria-expanded",!1),n.level&&l._isCollapsed(n)&&(o.setAttribute("aria-hidden",!0),o.classList.add("collapsed","smart-hidden")),t.appendChild(o),a.rowDetailTemplate){const i=document.createElement("tr");if(-1===l._expandedRowDetailIds.indexOf(r)){if(a.virtualization)return s;i.setAttribute("aria-hidden",!0),i.classList.add("collapsed")}else s.detail=i;i.data=Object.assign(n,{detail:!0}),i.classList.add("smart-table-row-detail"),i.innerHTML=`<td colspan="${d}"><div class="smart-table-detail-container">${l._applyRowDetailTemplate(e)}</div></td>`,t.appendChild(i)}return s}_processAndRenderSelection(e,t,a,l){const i=this,n=e.$.id,r=i._getChildCheckState(e).state;if(a&&i.selectionByHierarchy){const e=i._selectedIds.indexOf(n);!0===r&&-1===e?i._selectedIds.push(n):r||-1===e||i._selectedIds.splice(e,1)}if(!i.selection)return;let o,s;l?(o=t.firstElementChild,s=o.firstElementChild):(o=document.createElement("td"),s=document.createElement("div")),s.className="selection-checkbox",s.setAttribute("role","checkbox"),s.setAttribute("aria-checked",!!r||null===r&&"mixed"),s.setAttribute("aria-label","Toggle row selection"),o.className="smart-table-select-row freeze-near"+(r?" selected":null===r?" indeterminate":""),o.setAttribute("aria-colindex",1),l||(o.appendChild(s),t.appendChild(o)),t.setAttribute("aria-selected",!0===r)}_applyConditionalFormattingToCell(e,t,a){const l=this;if(l._conditionalFormatting&&l._conditionalFormatting[t]){const i=l._conditionalFormatting[t][a];i&&(e.style.backgroundColor=i.background,e.style.color=i.color,e.style.fontFamily=i.fontFamily,e.style.fontSize=i.fontSize)}}_createLastRow(){const e=document.createElement("tr");e.setAttribute("aria-hidden",!0),e.classList.add("last-visible");try{new ResizeObserver((t=>{try{e.classList.toggle("sized",t[0].contentRect.height>0&&null!==e.previousSibling)}catch(e){}})).observe(e)}catch(e){}return e}_createGroupHeader(e,t,a){const l=this;l.columnByDataField[e.groupDataField]||console.error(l.localize("grouping"));const i=l.columnByDataField[e.groupDataField]?l.columnByDataField[e.groupDataField].label:`${l.localize("EMPTY")}`,n=a||document.createElement("tr"),r=document.createElement("td"),o=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div");let c=e.label;if(/<.+?>/.test(c)&&c.replace&&("all"===l.dataSourceSettings.sanitizeHTML?c=c.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===l.dataSourceSettings.sanitizeHTML&&(c=window.Smart.Utilities.Core.sanitizeHTML(c))),""!==c&&c||(c=`<em class="placeholder">${l.localize("EMPTY")}</em>`),n.removeAttribute("aria-rowindex"),n.data=e,s.classList.add("hierarchy-arrow","smart-arrow","smart-arrow-down"),s.setAttribute("role","button"),s.setAttribute("aria-label","Toggle row"),d.classList.add("group-label"),d.innerHTML=`<span class="group-label-name">${i}: </span>\n <span class="group-label-value">${c}</span>\n <span class="group-label-count">(${l._getLeafCount(e)})</span>`,r.colSpan=l._columns.filter((e=>e.visible)).length,r.classList.add("group-header"),e.level&&(r.classList.add("outline-level-"+Math.min(e.level,10)),l._isCollapsed(e)&&(n.setAttribute("aria-hidden",!0),n.classList.add("collapsed","smart-hidden"))),n.setAttribute("row-id",e.$.id),n.setAttribute("role","group"),n.setAttribute("aria-level",e.level),o.appendChild(s),o.appendChild(d),r.appendChild(o),l._processAndRenderSelection(e,n,!0),n.appendChild(r),n.setAttribute("aria-expanded",e.expanded),n.classList.toggle("expanded",e.expanded),e&&e.$&&!1===e.$.filtered&&n.classList.add("smart-hidden"),l.groupFormatFunction){const t={value:c,row:e.$.id,column:e.groupDataField,data:e,template:null};l.groupFormatFunction(t),c!==t.value&&(d.innerHTML=`<span class="group-label-name">${i}: </span>\n <span class="group-label-value">${t.value}</span>\n <span class="group-label-count">(${l._getLeafCount(e)})</span>`),t.template instanceof HTMLElement&&(d.innerHTML="",d.appendChild(t.template));const a=t.template;let n="";if(a&&a.startsWith("#")){const e=document.querySelector(a);let t=c;if(e&&e instanceof HTMLTemplateElement){const a=e.content.cloneNode(!0),l=document.createElement("div");l.appendChild(a),t=t.toString(),t=t.replace(/'/gi,"\\'"),t=t.replace(/"/gi,'\\"'),n=l.innerHTML.replace(/{{value}}/gi,t),n.indexOf("{{value=")>=0&&(t?(n=n.substring(0,n.indexOf("{{value="))+t+n.substring(n.indexOf("}")),n=n.replace(/}/gi,""),n=n.replace(/{/gi,"")):(n=n.replace(/{{value=/gi,""),n=n.replace(/}}/gi,""))),d.innerHTML=n}}else a&&"string"==typeof a&&(n=a.replace(/{{value}}/gi,c),d.innerHTML=n)}const u=l.selection?1:0;for(let e=0;e<l.columns.length;e++){const t=document.createElement("td"),a=l.columns[e];a.visible&&(t.setAttribute("data-field",a.dataField),t.setAttribute("aria-colindex",e+1+u),t.classList.add("smart-hidden"),n.appendChild(t))}return a||t.appendChild(n),n}_getLeafCount(e){let t=0;return function e(a){for(const l of a)l.leaf?t++:l.children&&l.children.length>0&&e(l.children)}(e.children),t}_isCollapsed(e){let t=e.parent;for(;t;){if(!t.expanded)return!0;t=t.parent}return!1}_areChildrenFiltered(e){if(!e.leaf){if(0===e.children.length&&this.dataSource.virtualDataSource)return!0;for(let t=0;t<e.children.length;t++)if(!1!==e.children[t].$.filtered)return!0;return!1}}_applyRowDetailTemplate(e){const t=this,a=t.dataSource.dataFields;let l=t.rowDetailTemplate;for(let i=0;i<a.length;i++){const n=a[i].name,r=new RegExp(`{{${n}}}`,"g");let o=t.columnByDataField[n]||{dataField:n};if(r.test(l)){let a=t._formatCellValue(e,o,document.createElement("td"));"string"!=typeof a&&(a=e.data[o.dataField]),l=l.replace(r,a)}}return l}_handleFrozenColumnPositions(){const e=this,t=e.rightToLeft,a=e._columns.filter((e=>e.visible));let l=[],i=[],n=0;function r(t,l,i,r,o){const s=a[l-n],d=[s.headerCellElement];for(const e of s.thHierarchy)e.includes[0].dataField===s.dataField&&d.push(e);Array.from(e.$.tableContainer.querySelectorAll(`td:nth-child(${l+1})`)).concat(d).forEach((e=>{e.style[t]=i+"px",o&&(e.style.zIndex=2+r)}))}e.selection&&(t?i.push(0):l.push(0),n=1);for(let e=0+n;e<a.length+n;e++){const r=a[e-n];r.freeze&&(!t&&"far"===r.freeze||t&&"far"!==r.freeze?i.push(e):l.push(e))}if(l.length<2&&i.length<2)return;const o=[];for(const e of a){let t=e.width;t||(t=e.headerCellElement.offsetWidth),e.minWidth&&(t=Math.max(e.minWidth,t)),o.push(t)}if(t){for(let e=0;e<l.length-1;e++){const t=l[e];let a=0;for(let e=t+1;e<o.length;e++)-1!==l.indexOf(e)&&(a+=o[e]);r("left",t,a,e,!0)}for(let e=1;e<i.length;e++){const t=i[e];let a=0;for(let e=0;e<t;e++)-1!==i.indexOf(e)&&(a+=o[e]);r("right",t,a,e,!1)}}else{for(let e=1;e<l.length;e++){const t=l[e];let a=0;for(let e=0;e<t;e++)-1!==l.indexOf(e)&&(a+=o[e]);r("left",t,a,e,!1)}for(let e=0;e<i.length-1;e++){const t=i[e];let a=0;for(let e=t+1;e<o.length;e++)-1!==i.indexOf(e)&&(a+=o[e]);r("right",t,a,e,!0)}}}_formatCellValue(e,t,a,l){const i=this;let n=e&&e.data?e.data.$.id:e;if(void 0===l&&(l=e.data[t.dataField]),"string"==typeof l&&l.indexOf(">")>=0&&/<.+?>/.test(l)&&l.replace&&("all"===i.dataSourceSettings.sanitizeHTML?l=l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===i.dataSourceSettings.sanitizeHTML&&(l=window.Smart.Utilities.Core.sanitizeHTML(l))),i._cellsWithFormulas){const e=t.dataField+":"+n;if("string"==typeof l&&/=.+/.test(l)){const t=i._formulaParser;i._cellsWithFormulas[e]=!0,t&&(l=t.parse(l.slice(1)))}else delete i._cellsWithFormulas[e]}if(t.formatFunction){const i={value:l,row:n,column:t.dataField,data:e.data,cell:a,template:null};if(t.formatFunction(i),l=i.value,i.template instanceof HTMLElement)return i.template;if(null===i.template||"string"!=typeof i.template)return l;const r=i.template;let o="";if(r.startsWith("#")){const e=document.querySelector(r);if(e&&e instanceof HTMLTemplateElement){const t=e.content.cloneNode(!0),a=document.createElement("div");return a.appendChild(t),l=(l=(l=l.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),o=a.innerHTML.replace(/{{value}}/gi,l),o.indexOf("{{value=")>=0&&(l?(o=o.substring(0,o.indexOf("{{value="))+l+o.substring(o.indexOf("}")),o=o.replace(/}/gi,""),o=o.replace(/{/gi,"")):(o=o.replace(/{{value=/gi,""),o=o.replace(/}}/gi,""))),o}}return o='<div class="smart-table-cell-template">'+r.replace(/{{value}}/gi,l)+"</div>",o}return"date"===t.dataType&&l instanceof Date?l.toLocaleDateString():l}_setCellContent(e,t,a){if(t instanceof HTMLElement==1){for(;e.childNodes.length>0;)e.childNodes[0].remove();if(a){const a=document.createElement("div");a.innerHTML='<div class="hierarchy-arrow smart-arrow smart-arrow-down" role="button" aria-label="Toggle row"></div><div></div>',a.children[1].appendChild(t),e.appendChild(a)}else e.appendChild(t)}else if(a)e.innerHTML=t=`<div>\n <div class="hierarchy-arrow smart-arrow smart-arrow-down" role="button" aria-label="Toggle row"></div>\n <div>${t}</div>\n </div>`;else if("string"==typeof t&&t.indexOf(">")>=0)if(/<.+?>/.test(t)||/&\S+;/.test(t)){if(e._content===t)return;e.innerHTML=t,e._content=t}else e.textContent!==t&&(e.textContent=t);else"html"===this.dataSourceSettings.sanitizeHTMLRender?e.innerHTML!==t&&(e.innerHTML=t):e.textContent!==t&&(e.textContent=t)}_dataBind(e){const t=this;if(t._cellsWithFormulas={},t._templateTags=[],t.dataSource){if(t.dataSource instanceof Smart.DataAdapter==0){const e=t.dataSource;if(Array.isArray(e)){const a=t.columns;let l;if(e.length>0){const t=e[0];l=[];for(let e in t){const a=t[e];"number"==typeof a?l.push({name:e,dataType:"number"}):"boolean"==typeof a?l.push({name:e,dataType:"boolean"}):a instanceof Date?l.push({name:e,dataType:"date"}):a instanceof Object?l.push({name:e,dataType:"any"}):l.push({name:e,dataType:"string"})}}a&&a.length>0&&(l=l||[],a.forEach((e=>{if(e.dataType){const t=l.find((t=>t.name===e.dataField));t?t.dataType=e.dataType:e.map?l.find((t=>e.map.indexOf(t.name)>=0?t:null))&&l.push({name:e.dataField,map:e.map,dataType:e.dataType}):l.push({name:e.dataField,dataType:e.dataType})}}))),t.dataSourceSettings.dataFields&&t.dataSourceSettings.dataFields.length>0?t.dataSource=new Smart.DataAdapter({dataSource:t.dataSource,dataSourceType:t.dataSourceSettings.dataSourceType,dataFields:t.dataSourceSettings.dataFields,keyDataField:t.dataSourceSettings.keyDataField,parentDataField:t.dataSourceSettings.parentDataField,childrenDataField:t.dataSourceSettings.childrenDataField,groupBy:t.dataSourceSettings.groupBy,mapChar:t.dataSourceSettings.mapChar,root:t.dataSourceSettings.root,record:t.dataSourceSettings.record,autoGenerateColumns:t.autoGenerateColumns,id:t.dataSourceSettings.id||t.dataRowId,expandHierarchy:t.expandHierarchy,virtualDataSource:t.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:t.dataSourceSettings.virtualDataSourceOnExpand}):t.dataSource=new Smart.DataAdapter({dataSource:t.dataSource,dataFields:l,id:t.dataRowId||t.dataSourceSettings.id,dataSourceType:t.dataSourceSettings.dataSourceType,keyDataField:t.dataSourceSettings.keyDataField,parentDataField:t.dataSourceSettings.parentDataField,childrenDataField:t.dataSourceSettings.childrenDataField,groupBy:t.dataSourceSettings.groupBy,mapChar:t.dataSourceSettings.mapChar,root:t.dataSourceSettings.root,record:t.dataSourceSettings.record,autoGenerateColumns:t.autoGenerateColumns,expandHierarchy:t.expandHierarchy,virtualDataSource:t.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:t.dataSourceSettings.virtualDataSourceOnExpand})}else t.dataSource=new Smart.DataAdapter({dataSource:[],id:t.dataRowId,expandHierarchy:t.expandHierarchy})}}else{if(t.dataFields=[],!t.columns||Array.isArray(t.columns)&&0===t.columns.length){t.columns=[];const e=t.querySelectorAll("th");for(let a=0;a<e.length;a++){const l=e[a].innerHTML.trim();let i={label:l,dataField:l,dataType:"string"};t.columns.push(i),t.dataFields.push(l)}}else for(let e=0;e<t.columns.length;e++){const a=t.columns[e];"string"==typeof a?t.dataFields.push(a):"object"==typeof a&&t.dataFields.push(a.dataField+(a.dataType?": "+a.dataType:""))}let e=[];if(!t.rows){const a=t.querySelectorAll("tr");for(let l=0;l<a.length;l++){const i={},n=a[l].querySelectorAll("td");if(n.length>0){for(let e=0;e<t.columns.length;e++){const a=t.columns[e];i[a.dataField]=n[e].innerHTML.trim(),i[a.dataField].indexOf("<")>=0&&t._templateTags.push({index:l,dataField:a.dataField,td:n[e]})}e.push(i)}}t.dataSource=new Smart.DataAdapter({dataSource:e,expandHierarchy:t.expandHierarchy,dataFields:t.dataFields,id:t.dataRowId})}const a=t.$.container.querySelectorAll("table");a.length>1&&a[a.length-1].parentNode.removeChild(a[a.length-1])}t.dataSource.expandHierarchy=t.expandHierarchy,t._transformDataSource(),t._applyInitialConditionalFormatting(t.dataSource),t._initColumns(e),t._initRows(),t.dataSource.notify((function(e){if(t.dataSource._updating)return void delete t.dataSource._updating;if(t._editing)return;const a=e.data,l=t._selectedIds.slice(0);let i=e.action;switch(t.rows.canNotify=!1,e.action){case"add":if(a.length)for(let e=0;e<a.length;e++)t._addNewRow(a[e],t.dataSource.length-a.length+e);else t._addNewRow(a,t.dataSource.length-1);break;case"update":if(a.length)for(let l=0;l<a.length;l++){const i=e.index[l];t.rows[i].data=a[l]}break;case"insert":t._addNewRow(a,e.index);for(let e=0;e<t.rows.length;e++)t.rows[e].dataIndex=e;break;case"remove":case"removeLast":i="remove",function(e){const a=e.$.id,l=t._selectedIds.indexOf(a);delete t.rowById[a],t.rows.splice(e.$.index,1),-1!==l&&t._selectedIds.splice(l,1)}(a);break;case"bindingComplete":if(t.filtering&&t.filterRow){const e=t._filterInfo;e.inputFilters?t._filterByAll(e.query):e.rowFilters?t._applyRowFilters():e.appliedFilters&&t._refreshFilters()}}t.rows.canNotify=!0,this.refreshHierarchy(),t._fullRefresh(void 0,l,i)})),t.refresh(),t.dataSource.virtualDataSource&&(t.paging=!0,t._requestVirtualDataSource("dataBind")),t.$.tableContainer.setAttribute("aria-rowcount",t.dataSource.length)}_requestVirtualDataSource(e,t,a=null){const l=this,i=l.pageSize,n=Math.max(l.pageIndex*i,0),r=n+i,o=[],s=[],d={};let c=null;if(l.dataSource._updating=!0,l._sortColumns&&(l._sortColumns.forEach(((e,t)=>o[e.dataField]={sortOrder:e.direction,sortIndex:t})),o.length=l._sortColumns.length),l._filterInfo.appliedFilters){for(let e in l._filterInfo.appliedFilters)s[e]=l._filterInfo.appliedFilters[e];s.length=Object.keys(l._filterInfo.appliedFilters).length,c="and"}else{const e=l._filterInfo.inputFilters||l._filterInfo.rowFilters;e&&(e.forEach((e=>s[e[0]]=e[1])),s.length=e.length),c=l._filterInfo.inputFilters?"or":"and"}l._editing&&(d.row=l._editing.row.data),l.$.loadingIndicatorContainer.classList.remove("smart-hidden"),l.setAttribute("loading",""),l.dataSource.onVirtualDataSourceRequested((function(i){let n=!0;-1!==["add","update","remove"].indexOf(e)&&t&&(n=t(i.result)),l.$.loadingIndicatorContainer.classList.add("smart-hidden"),l.removeAttribute("loading"),n&&(a&&(a.expanded=!0),l._initRows(),l._refreshDataRows())}),{first:n,last:r,sorting:o,filtering:s,filterOperator:c,grouping:[],edit:d,row:a,action:e})}sortBy(e,t){const a=this,l=a.columnByDataField[e];if(l){if(!1===l.allowSort)return;e=l.dataField}if(a._sortBy({column:l,columnDataField:e,sortOrder:t,dataFields:a.dataSource.dataFields,columnByDataField:"columnByDataField"}),null===e){const e=!0===a._sortOnClick?"interaction":"programmatic";a.$.fireEvent("sort",{columns:[],sortDataFields:[],sortOrders:[],sortDataTypes:[],type:e})}}_sortBy(e){const t=this,a=e.column,l=e.columnDataField,i=e.sortOrder,n=e.dataFields,r=e.columnByDataField,o=[],s=[],d=[],c=function(e){t._addSortIconContainer(e),e.headerCellElement&&(e.headerCellElement.removeAttribute("aria-sort"),e.headerCellElement.sortIconContainerElement.classList.remove("desc"),e.headerCellElement.sortIconContainerElement.classList.remove("asc")),e.sortOrder=null},u=function(){if(t._sortColumns&&t._sortColumns.length>0)for(let e=0;e<t._sortColumns.length;e++){const a=t._sortColumns[e],l=t[r][a.dataField];c(l)}t._sortColumns=[]};if(null==a)return void(t._sortColumns&&t._sortColumns.length>0&&(u(),t._sortCallback(o,s,d),t._updateState("sorted")));if("none"===t.sortMode||!t.dataSource)return;if(i&&a.sortOrder===i)return;let f=i||"asc";null===i&&(f=null),c(a),t._sortColumns||(t._sortColumns=[]);let m="string";for(let e=0;e<n.length;e++){const t=n[e];if(t.name===l){m=t.dataType,"any"===m&&(m="number");break}}let h=!0;for(let e=0;e<t._sortColumns.length;e++){const n=t._sortColumns[e];if(n.dataField===l)if(h=!1,null===f&&(n.direction="desc"),"asc"===n.direction)n.direction="desc",f="desc";else if("desc"===n.direction){t._sortColumns.splice(e,1),c(a),f=i;break}}h&&("one"===t.sortMode&&u(),t._sortColumns.push({dataField:l,direction:f,dataType:m})),t._addSortIconContainer(a),null!==f?(a.headerCellElement&&(a.headerCellElement.sortIconContainerElement.classList.remove("asc"),a.headerCellElement.sortIconContainerElement.classList.remove("desc")),a.sortOrder=f,a.headerCellElement&&("desc"===f?(a.headerCellElement.sortIconContainerElement.classList.add("desc"),a.headerCellElement.setAttribute("aria-sort","descending")):(a.headerCellElement.sortIconContainerElement.classList.add("asc"),a.headerCellElement.setAttribute("aria-sort","ascending")))):a.headerCellElement&&(a.headerCellElement.sortIconContainerElement.classList.remove("asc"),a.headerCellElement.sortIconContainerElement.classList.remove("desc"),a.headerCellElement.removeAttribute("aria-sort"));for(let e=0;e<t._sortColumns.length;e++){const a=t._sortColumns[e],l=t[r][a.dataField];o.push(a.dataField),s.push(a.direction),d.push(a.dataType),l.headerCellElement&&l.headerCellElement.sortIconContainerElement.setAttribute("order",e+1)}if(t._sortCallback(o,s,d),t._updateState("sorted"),!t._doNotFireEvent){const e=!0===t._sortOnClick?"interaction":"programmatic";t.$.fireEvent("sort",{columns:t._sortColumns,sortDataFields:o,sortOrders:s,sortDataTypes:d,type:e})}}_addSortIconContainer(e,t,a){const l=e.headerCellElement;if(l&&!l.sortIconContainerElement){const e=document.createElement("div");e.classList.add("sort-by"),e.setAttribute("aria-hidden",!0),t&&e.classList.add(t),l.firstElementChild.appendChild(e),l.sortIconContainerElement=e,"asc"===t?l.setAttribute("aria-sort","ascending"):"desc"===t?l.setAttribute("aria-sort","descending"):l.removeAttribute("aria-sort"),void 0!==a&&e.setAttribute("order",a)}}_sortCallback(e,t,a){const l=this,i=l.dataSource;if(!i.virtualDataSource){let n=null;for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.sort&&(n||(n={}),n[t.dataField]=t.sort)}i._sort(l.dataSource.boundSource,e,t,a,l.sort,n);let r=[],o=[];if(i.groupBy&&i.groupBy.toArray&&(r=i.groupBy.toArray().slice(0)),r.length>0&&(o=l._getExpandedGroups(i.boundHierarchy)),i.refreshHierarchy(),r.length>0){const e=l._doNotFireEvent;l._doNotFireEvent=!0,l._restoreExpandedGroups(o),l._doNotFireEvent=e}}l._fullRefresh("sort")}clearSort(){this.sortBy(null)}_fullRefresh(e,t,a,l){const i=this;if(i.__updating)return;if(i.dataSource.virtualDataSource)return void i._requestVirtualDataSource(e,l);const n=i._getFractionOfMax();t||(t=i._selectedIds.slice(0)),t=JSON.stringify(t.sort()),i._initRows(),i._refreshDataRows(),i._setFractionOfMax(n),"filter"===e&&(i._updateSelectAllState(),a||(a="filter")),t!==JSON.stringify(i._selectedIds.slice(0).sort())&&("filter"!==e&&i._updateSelectAllState(),i._updateState("selected"),i.$.fireEvent("change",{type:a})),"string"==typeof e&&-1!==e.indexOf("page")&&i._fixFrozenHeaderFirefox()}_pagerChangeHandler(e){const t=this;(t.isInShadowDOM?e.composedPath()[0]:e.target)===t.$.pager&&(t.pageIndex=e.detail.index,t._fullRefresh("pageIndexChange"),t.$.fireEvent("page",{action:"pageIndexChange"}))}_pagerPageSizeChanged(e){const t=this;t.pageSize=e.detail.value,t._fullRefresh("pageSizeChange"),t.$.fireEvent("page",{action:"pageSizeChange"})}_filterInputKeyupHandler(){const e=this;clearTimeout(e._filterInputTimeout),e._filterInputTimeout=setTimeout((function(){if(e._filterInfo&&e.$.filterInput.value!==e._filterInfo.query){const t=e.context;e.context=e,e._filterByAll(e.$.filterInput.value),e.context=t}}),500)}_filterByAll(e){const t=this;if(t._filterInfo.query=e,""===e)return void t.clearFilters();const a=[];t._clearRowFilters(),delete t._filterInfo.appliedFilters,t._filterInfo.stringDataFields.forEach((t=>{const l=new Smart.Utilities.FilterGroup,i=l.createFilter("string",e,"CONTAINS");l.addFilter("or",i),a.push([t,l])})),t.dataSource.virtualDataSource||t.dataSource._filter(a,t.filterOperator),t._filterInfo.inputFilters=a,t._fullRefresh("filter"),t._updateState("filtered"),t._doNotFireEvent||t.$.fireEvent("filter",{action:"add",filters:a})}_setupPagingAndFiltering(){const e=this;e.$.pager.$.pageSizeSelector.classList.add("underlined"),e.$.pager.$.pageSizeSelector.dropDownAppendTo="body",e._filterInfo={query:""},e._applyFilterTemplate(),e.$.header.classList.toggle("smart-hidden",(!e.filtering||e.filterRow||e.columnMenu)&&!e.conditionalFormattingButton)}_applyFilterTemplate(){const e=this,t=e.filterTemplate;if(e.$.filterTemplateContainer.innerHTML="",!t)return e.$.filterInput.classList.remove("smart-hidden"),e.$.filterTemplateContainer.classList.add("smart-hidden"),void(e.filterTemplate=null);const a=document.getElementById(t);if(a&&a instanceof HTMLTemplateElement){const t=document.importNode(a.content,!0);e.$.filterInput.classList.add("smart-hidden"),e.$.filterTemplateContainer.classList.remove("smart-hidden"),e.$.filterTemplateContainer.appendChild(t)}else e.filterTemplate=null,e.$.filterInput.classList.remove("smart-hidden"),e.$.filterTemplateContainer.classList.add("smart-hidden")}_refreshFilters(e){const t=this,a=[];for(let e in t._filterInfo.appliedFilters){let l=t._filterInfo.appliedFilters[e];a.push([e,l])}0!==a.length?(t._clearFilterInput(),t._clearRowFilters(),t.dataSource.virtualDataSource||t.dataSource._filter(a,t.filterOperator),t._fullRefresh("filter"),t._updateState("filtered"),e&&!t._doNotFireEvent&&t.$.fireEvent("filter",{action:e,filters:a})):t.clearFilters()}_localize(){const e=this,t=e.$.pager;t.messages[e.locale]||(t.messages[e.locale]={}),t.messages[e.locale].pageSizeLabel=e.localize("itemsPerPage"),t.messages[e.locale].summaryPrefix=e.localize("summaryPrefix"),t.messages[e.locale].summarySuffix="",t.$.firstButton.setAttribute("tooltip",e.localize("firstButton")),t.$.previousButton.setAttribute("tooltip",e.localize("previousButton")),t.$.nextButton.setAttribute("tooltip",e.localize("nextButton")),t.$.lastButton.setAttribute("tooltip",e.localize("lastButton")),e.$.filterInput.placeholder=e.localize("filterPlaceholder"),e.$.conditionalFormattingButton.setAttribute("tooltip",e.localize("conditionalFormatting")),e._filterInfo.stringConditions=[{value:"EMPTY",label:e.localize("EMPTY")},{value:"NOT_EMPTY",label:e.localize("NOT_EMPTY")},{value:"CONTAINS",label:e.localize("CONTAINS")},{value:"CONTAINS_CASE_SENSITIVE",label:e.localize("CONTAINS_CASE_SENSITIVE")},{value:"DOES_NOT_CONTAIN",label:e.localize("DOES_NOT_CONTAIN")},{value:"DOES_NOT_CONTAIN_CASE_SENSITIVE",label:e.localize("DOES_NOT_CONTAIN_CASE_SENSITIVE")},{value:"STARTS_WITH",label:e.localize("STARTS_WITH")},{value:"STARTS_WITH_CASE_SENSITIVE",label:e.localize("STARTS_WITH_CASE_SENSITIVE")},{value:"ENDS_WITH",label:e.localize("ENDS_WITH")},{value:"ENDS_WITH_CASE_SENSITIVE",label:e.localize("ENDS_WITH_CASE_SENSITIVE")},{value:"EQUAL",label:e.localize("EQUAL")},{value:"EQUAL_CASE_SENSITIVE",label:e.localize("EQUAL_CASE_SENSITIVE")},{value:"NULL",label:e.localize("NULL")},{value:"NOT_NULL",label:e.localize("NOT_NULL")}],e._filterInfo.numberAndDateConditions=[{value:"EQUAL",label:e.localize("EQUAL")},{value:"NOT_EQUAL",label:e.localize("NOT_EQUAL")},{value:"LESS_THAN",label:e.localize("LESS_THAN")},{value:"LESS_THAN_OR_EQUAL",label:e.localize("LESS_THAN_OR_EQUAL")},{value:"GREATER_THAN",label:e.localize("GREATER_THAN")},{value:"GREATER_THAN_OR_EQUAL",label:e.localize("GREATER_THAN_OR_EQUAL")},{value:"NULL",label:e.localize("NULL")},{value:"NOT_NULL",label:e.localize("NOT_NULL")}]}_createFilterRow(e){const t=this;if(!t.filtering||!t.filterRow)return;if(e)return void t.$.tableContainer.children[1].insertBefore(e,t.$.tableContainer.children[1].firstElementChild);const a=document.createElement("tr"),l=t._columns.filter((e=>e.visible));let i="";a.className="smart-table-filter-row",t.selection&&(i+="<td></td>");for(let e=0;e<l.length;e++){const a=l[e];i+=t._createFilterRowInput(a)}a.innerHTML=i,t.$.tableContainer.children[1].insertBefore(a,t.$.tableContainer.children[1].firstElementChild)}_createFilterRowInput(e){const t=this,a=` animation="${t.animation}" `,l=t.rightToLeft?" right-to-left":"",i=[];let n,r,o,s;return"string"===e.dataType?(n=t._filterInfo.stringConditions,r="string",o="string-filter",s=t.localize("CONTAINS")):(n=t._filterInfo.numberAndDateConditions,r=e.dataType,o="num-date-filter",s=t.localize("EQUAL")),e.freeze&&i.push("freeze-"+("far"===e.freeze?"far":"near")),e.responsivePriority&&i.push("priority-"+e.responsivePriority),!1===e.allowFilter&&i.push("no-filter"),`<td${i.length?' class="'+i.join(" ")+'"':""} filter-for="${e.dataField}">\n <div>\n <input type="${r}" class="filter-value" aria-label="Filter value" />\n <smart-input class="${o}${a}data-source='${JSON.stringify(n)}' drop-down-button-position="right" drop-down-width="auto" readonly${l} value="${s}" title="${t.localize("filterCondition")}" aria-label="Filter condition"></smart-input>\n <smart-button class="smart-hidden" title="${t.localize("clearFilter")}"${a}${l} aria-label="Clear filter"></smart-button>\n </div>\n </td>`}_tableContainerChangeHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target;a.classList.contains("filter-value")&&("date"===a.type||a instanceof Smart.Input&&(""!==a.previousElementSibling.value||-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(e.detail.value)))&&t._applyRowFilters()}_tableContainerClickHandler(e){const t=this;if(t._editing)return;const a=t.isInShadowDOM?e.composedPath()[0]:e.target;if(!t.$.tableContainer.contains(a))return;const l=a.closest("tbody tr[row-id], tfoot tr.grand-total");if(l){t.closeColumnMenu();const i=a.closest("td");if(a.classList.contains("hierarchy-arrow")){const e=t.animation;return t.virtualization&&(t._animation="none"),t._hierarchyArrowClickHandler(l,i),void(t.virtualization&&(t._animation=e))}const n=l.getAttribute("row-id");let r;n&&(r=t.rowById?t.rowById[n].data:t.rows.dataItemById[n]);const o=r?r.$.id:void 0,s=i?i.getAttribute("data-field"):void 0;if(!r&&l.classList.contains("grand-total")&&(r=l.data),void 0!==s){const a={};for(let e=0;e<t.columns.length;e++){const l=t.columns[e];a[l.dataField]=r[l.dataField]}t.$.fireEvent("cellClick",{id:n,row:a,dataField:s,value:r[s],originalEvent:e})}if(t._toggleSelection(l,r,e,a),t.editing||t.drillDown){if(!s||i.classList.contains("no-edit"))return;clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks?(t._dblclickObject.numberOfClicks=0,t._beginEdit({rowElement:l,cell:i,dataField:s})):t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300)}return void(t.rowDetailTemplate&&t._toggleRowDetail(l,o))}const i=a.closest(".smart-table-select-all");if(i){if("one"===t.selectionMode)return;return void t._selectAllCheckboxClickHandler(i)}const n=a.closest(".smart-table-filter-row smart-button")||a.closest(".smart-table-column-menu smart-button");if(n){const e=n.parentElement.firstElementChild,a=n.parentElement.children[1];return e.value="",-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(a.$.input.dataValue)&&(a.value=t.localize("text"===e.type?"CONTAINS":"EQUAL"),delete a.$.input.dataValue),void t._applyRowFilters()}}_toggleSelection(e,t,a,l){const i=this;if(!i.selection||"cell"===i.selectionMode||e.classList.contains("disable-select")||e.classList.contains("grand-total"))return;function n(){i._selectedIds=[],Array.from(i.$.tableContainer.querySelectorAll(".smart-table-select-row.selected")).forEach((e=>{e.parentElement.classList.contains("disable-select")||e.parentElement.setAttribute("aria-selected",!1),e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1)}))}const r=t.$.id;let o=-1!==i._selectedIds.indexOf(r);if(i._interaction=!0,"one"===i.selectionMode){if(o)return;n(),i.select(r)}if("many"===i.selectionMode)if(o)i.unselect(r);else{if(i._disabledSelection.length>0&&t.children&&t.children.length>0){let e=0,a=0,l=[];if(t.children.forEach((t=>{const n=t.$.id;-1===i._selectedIds.indexOf(n)?e++:l.push(n),-1!==i._disabledSelection.indexOf(n)&&a++})),e===a)return i.unselect(l),void delete i._interaction}i.select(r),i._selectionStart={data:t,element:e}}else{if(i._selectionStart&&a.shiftKey){let t,a,l;if(i.virtualization?(t=i.rows,a=t.findIndex((e=>e.data.$.id===r)),l=t.findIndex((e=>e.data.$.id===i._selectionStart.data.$.id))):(t=Array.from(i.$.tableContainer.querySelectorAll("tr[row-id]:not([unused])")),a=t.indexOf(e),l=t.indexOf(i._selectionStart.element)),a!==l){const e=JSON.stringify(i._selectedIds.slice(0).sort()),r=Math.min(a,l),o=Math.max(a,l);n();const s=[];for(let e=r;e<=o;e++){const a=t[e];s.push(a.data.$.id)}return i._changeSelectionOfMultiple(s,"select","interaction",e),getSelection().removeAllRanges(),void delete i._interaction}if(1===i._selectedIds.length)return void delete i._interaction}const s=!!l&&(l.classList.contains("selection-checkbox")||l.classList.contains("smart-table-select-row"));let d=!1;if(1===i._selectedIds.length)d=!0;else if(i.hasAttribute("hierarchy")&&i.selectionByHierarchy){const e=[];!function e(t,a){const l=t.$.id;-1!==i._selectedIds.indexOf(l)&&a.push(l),t.children&&t.children.forEach((t=>e(t,a)))}(t,e),i._selectedIds.length===e.length&&(d=!0),t&&t.leaf&&(d=!0),o=i._getChildCheckState(t).maxSelected}else i.hasAttribute("hierarchy")&&!i.selectionByHierarchy&&(d=!0);if(o&&(s||d||a.ctrlKey||a.metaKey))return delete i._selectionStart,i.unselect(r),void delete i._interaction;s||a.ctrlKey||a.metaKey||n(),i.select(r),i._selectionStart={data:t,element:e}}delete i._interaction}_selectAllCheckboxClickHandler(e,t){const a=this;if(void 0===t){const l=a._filterInfo;if(l.inputFilters||l.rowFilters||l.appliedFilters)return void a._selectAllCheckboxClickHandlerFiltering(e);if(t=a.dataSource,a.hasAttribute("hierarchy")&&a._disabledSelection.length>0){const e=t.boundHierarchy,l=a._getChildCheckState({children:e}).maxSelected;return void a._changeSelectionOfMultiple(e.map((e=>e.$.id)),l?"unselect":"select","interaction")}}const l=t.length,i=a._selectedIds.length===l-a._disabledSelection.length+a._selectableGroupRecords.length,n=a._selectedIds.slice(0);if(a._selectedIds=[],i)a._updateCSSOnUnselectAll(e);else{let i,n=0;for(let e=0;e<l;e++){const l=t[e].$.id;-1===a._disabledSelection.indexOf(l)&&(a._selectedIds.push(l),n++)}n===l?i=!0:0===n&&(i=!1),a._updateCSSOnSelectAll(e,i),a._selectableGroupRecords.length>0&&(a._selectedIds=a._selectedIds.concat(a._selectableGroupRecords))}n.length!==a._selectedIds.length&&(a._updateState("selected"),a.$.fireEvent("change",{type:"interaction"}))}_selectAllCheckboxClickHandlerFiltering(e){const t=this,a=t.dataSource,l=t._selectedIds.slice(0),i=[],n=[];let r=0;for(let e=0;e<a.length;e++){const o=a[e];if(!1===o.$.filtered)continue;const s=o.$.id;r++,-1!==l.indexOf(s)&&i.push(s),-1===t._disabledSelection.indexOf(s)&&n.push(s)}const o=i.length===n.length;if(t._selectedIds=t._selectedIds.filter((e=>-1===n.indexOf(e))),o)t._updateCSSOnUnselectAll(e);else{let a;t._selectedIds=t._selectedIds.concat(n),n.length===r?a=!0:0===n.length&&(a=!1),t._updateCSSOnSelectAll(e,a)}l.length!==t._selectedIds.length&&(t._updateState("selected"),t.$.fireEvent("change",{type:"interaction"}))}_updateCSSOnUnselectAll(e){e.classList.remove("indeterminate","selected"),e.firstElementChild.setAttribute("aria-checked",!1),Array.from(this.$.tableContainer.querySelectorAll(".smart-table-select-row")).forEach((e=>{e.parentElement.classList.contains("disable-select")||e.parentElement.setAttribute("aria-selected",!1),e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1)}))}_updateCSSOnSelectAll(e,t){t?(e.classList.remove("indeterminate"),e.classList.add("selected"),e.firstElementChild.setAttribute("aria-checked",!0)):!1===t?(e.classList.remove("indeterminate","selected"),e.firstElementChild.setAttribute("aria-checked",!1)):(e.classList.remove("selected"),e.classList.add("indeterminate"),e.firstElementChild.setAttribute("aria-checked","mixed")),Array.from(this.$.tableContainer.querySelectorAll(".smart-table-select-row")).forEach((e=>{e.parentElement.classList.contains("disable-select")||(e.parentElement.setAttribute("aria-selected",!0),e.classList.remove("indeterminate"),e.classList.add("selected"),e.firstElementChild.setAttribute("aria-checked",!0))}))}_beginEdit(e){const t=this,a=t.editMode,l=e.dataField;let i=e.rowId,n=e.rowElement,r=e.rowObject,o=e.cell,s=[],d=[];if(t.editing){n||(n=t.$.tableContainer.querySelector(`tr[row-id="${i}"]:not([unused])`)),r||(i=n.getAttribute("row-id"),r=t.rowById[i],i=r.data.$.id),"row"===a?(s=n.querySelectorAll("td[data-field]"),d=t._columns.filter((e=>e.visible)).map((e=>e.dataField)),o||(o=l?n.querySelector(`td[data-field="${l}"`):s[0])):(o||(o=n.querySelector(`td[data-field="${l}"`)),s=[o],d=[l]),t._editing={row:r,cells:[]};for(let e=0;e<d.length;e++){const a=s[e];let l=d[e];const n=t.columnByDataField[l];if(!1===n.allowEdit)continue;n.transform&&(l=n.originalDataField);const c=r.data[l],u=t._initEditor(n,i,l,c);let f=u instanceof HTMLInputElement&&"date"===u.type;if(n.editor&&n.editor.template)n.editor.onRender&&n.editor.onRender(i,l,u,c);else if(f)if(c instanceof Date&&!isNaN(c.getTime())){const e=(c.getMonth()+1).toString(),t=c.getDate().toString();u.value=`${c.getFullYear()}-${"0".repeat(2-e.length)}${e}-${"0".repeat(2-t.length)}${t}`}else u.value="";else u.value=void 0===c?"":c;a.classList.add("editing"),a.innerHTML="",a.appendChild(u),a===o&&u.focus&&(u.focus(),n.editor&&n.editor.template||f||!u.select||u.select()),t._editing.cells.push({dataField:l,editor:u,element:a}),t.$.fireEvent("cellBeginEdit",{id:r.data.$.id,row:r.data,value:r.data[l],dataField:l})}"row"===a&&t.$.fireEvent("rowBeginEdit",{id:r.data.$.id,row:r.data})}}_initEditor(e,t,a,l){let i=this._editors[a];if(i)return i;if(e.editor&&e.editor.template){const n=document.createElement("div");return n.innerHTML=e.editor.template,i=n.firstElementChild,i.className="smart-table-editor",e.editor.onInit&&e.editor.onInit(t,a,i,l),i}return i=document.createElement("input"),i.className="smart-table-editor standard","number"===e.dataType?i.type="number":"date"===e.dataType?i.type="date":i.type="text",this._editors[a]=i,i}_toggleRowDetail(e,t){const a=this;if(a.virtualization)return void a._toggleRowDetailVirtualization(e,t);const l=e.nextElementSibling;l.classList.toggle("collapsed"),l.classList.contains("collapsed")?(l.setAttribute("aria-hidden",!0),a._expandedRowDetailIds=a._expandedRowDetailIds.filter((e=>e!==t))):(l.removeAttribute("aria-hidden"),a._expandedRowDetailIds.push(t))}_toggleRowDetailVirtualization(e,t){const a=this;let l=e.nextElementSibling;function i(){let e=a.$.virtualizationContainer.$.verticalScrollBar,t=a.$.virtualizationContainer.$.verticalScrollBar.value;a._ignoreVerticalChange=!0,a._refreshDataRows(),t=Math.min(e.max,t),e.value=t,delete a._ignoreVerticalChange,a._onVerticalChange({detail:{value:t}},!0)}if(l&&l.classList.contains("smart-table-row-detail")&&!l.classList.contains("collapsed"))return l.setAttribute("aria-hidden",!0),a._expandedRowDetailIds=a._expandedRowDetailIds.filter((e=>e!==t)),l.classList.add("collapsed"),l.remove(),void i();const n=e.data;l=document.createElement("tr"),l.classList.add("collapsed"),a._createRowDetailOnDemand(l,{data:n},n),e.parentElement.insertBefore(l,e.nextElementSibling),a._expandedRowDetailIds.push(t),l.classList.remove("collapsed"),i()}_setFocusable(){const e=this,t="smart-table"===e.nodeName.toLowerCase();if(!e.keyboardNavigation||e.disabled||e.unfocusable||e.hasAttribute("modal"))return e.$.tableContainer.removeAttribute("tabindex"),t&&(e.$.filterInput.unfocusable=!0,e.$.pager.unfocusable=!0),void(e.$.conditionalFormattingButton.unfocusable=!0);const a=e.$.tableContainer.getAttribute("tabindex");(null===a||a<0)&&e.$.tableContainer.setAttribute("tabindex",0),t&&(e.$.filterInput.unfocusable=!1,e.$.pager.unfocusable=!1),e.$.conditionalFormattingButton.unfocusable=!1}_tableContainerFocusHandler(){const e=this;e._focusedCell&&e.$.tableContainer.contains(e._focusedCell)||e._focusCell(e.$.tableContainer.children[1].querySelector("tr:not([unused]) td[data-field], tr:not([unused]) td.group-header"))}_tableContainerDownHandler(e){const t=this.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;this._focusCell(t.closest("td[data-field], td.group-header")),e.stopPropagation()}_focusCell(e,t){const a=this;if(!e||!e.hasAttribute("data-field")&&!e.classList.contains("group-header")||e.parentElement.classList.contains("grand-total"))return!1;if(a._focusedCell){if(a._focusedCell===e)return!1;a._focusedCell.removeAttribute("focus")}if(a._focusedCell=e,e.setAttribute("focus",""),!t)return;const l=a.$.tableContainer.parentElement,i=a.$.header.offsetHeight,n=a.freezeHeader?a.$.tableContainer.firstElementChild.offsetHeight:0,r=l.scrollTop;let o=e.offsetTop-i-n;if(o<r)l.scrollTop=o;else{const t=a.footerRow&&a.freezeFooter?a.$.tableContainer.lastElementChild.offsetHeight:0,s=a.$.pager.offsetHeight,d=l.clientHeight-(i+n+t+s);o+=e.offsetHeight,o>r+d&&(l.scrollTop=o-d)}if(e.classList.contains("freeze-near")||e.classList.contains("freeze-far"))return;const s=l.scrollLeft,d=a.$.tableContainer.querySelector("tr[row-id]:not([unused])");let c,u=0;if(Array.from(d.children).forEach((e=>{e.classList.contains("freeze-near")&&(u+=e.offsetWidth)})),a.rightToLeft){let t=e.previousElementSibling;for(c=0;t;)t.classList.contains("freeze-near")||(c-=t.offsetWidth),t=t.previousElementSibling;if(c>s)l.scrollLeft=c;else{const t=l.clientWidth;c-=e.offsetWidth,c<s-t&&(l.scrollLeft=c+t-u)}}else if(c=e.offsetLeft-u,c<s)l.scrollLeft=c;else{const t=l.clientWidth;c+=e.offsetWidth+u,c>s+t&&(l.scrollLeft=c-t)}}focus(){const e=this;!e.keyboardNavigation||e.disabled||e.unfocusable||e.hasAttribute("modal")||e.$.tableContainer.focus()}blur(){this.$.tableContainer.blur()}_tableContainerKeydownHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=e.key;if("Shift"===l)return void("extended"===t.selectionMode&&t.$.tableContainer.classList.add("smart-unselectable"));if(!t.contains(a))return;if(a&&"INPUT"===a.nodeName&&!t._editing)return;const i=t._focusedCell;if(!i)return;const n=t.virtualization,r=i.classList.contains("group-header");if(r&&-1!==["ArrowRight","ArrowLeft","Home","End","Escape","F2"].indexOf(l))return void e.preventDefault();if(t._editing){switch(l){case"Enter":t.endEdit();break;case"Escape":t.cancelEdit();break;default:return}return t.$.tableContainer.focus(),void e.preventDefault()}const o=i.parentElement;if(n&&o){const e=t.$.virtualizationContainer.$.verticalScrollBar,a=e.value,i=o.data.$.id;if("ArrowUp"===l&&0===a&&i===t._rowsVirtual[0].data.$.id||"ArrowDown"===l&&a===e.max&&i===t._rowsVirtual[t._rowsVirtual.length-1].data.$.id)return}let s="ArrowRight",d="ArrowLeft";switch(t.rightToLeft&&(s="ArrowLeft",d="ArrowRight"),l){case s:case d:{const a=l===s?"nextElementSibling":"previousElementSibling";let r=i[a];for(;r&&r.classList.contains("smart-hidden");)r=r[a];t._focusCell(r,!n,e),t._scrollToVirtualization(l===s?"nextArrow":"prevArrow",r);break}case"ArrowUp":case"ArrowDown":{const a="ArrowUp"===l?"previousElementSibling":"nextElementSibling";let s=o[a];for(;s&&(s.classList.contains("smart-table-row-detail")||s.classList.contains("collapsed"));)s=s[a];s&&(r?t._focusCell(s.querySelector("td[data-field], .group-header"),!n,e):t._focusCell(s.querySelector(`td[data-field="${i.getAttribute("data-field")}"], .group-header`),!n,e),t._scrollToVirtualization(l,s));break}case"Home":t._focusCell(o.querySelector("td[data-field]"),!n,e),t._scrollToVirtualization(l);break;case"End":{const a=o.querySelectorAll("td[data-field]");let i=a.length-1,r=a[i];for(;r.classList.contains("smart-hidden");)i--,r=a[i];t._focusCell(r,!n,e),t._scrollToVirtualization(l);break}case"PageDown":t._pageDownHandler(i,e);break;case"PageUp":t._pageUpHandler(i,e);break;case"Enter":{const a=o.data;t.dataSource.boundHierarchy&&t._areChildrenFiltered(a)?t._hierarchyArrowClickHandler(o,i,e):t.rowDetailTemplate&&t._toggleRowDetail(o,a.$.id);break}case" ":t._toggleSelection(o,o.data,e);break;case"F2":t.beginEdit(o.data.$.id,i.getAttribute("data-field"));break;default:return}if(e.preventDefault(),t.onKeyboardScroll){const e=n?t.$.virtualizationContainer:t.$.container;t.onKeyboardScroll(l,e.scrollTop,e.scrollLeft)}}_pageDownHandler(e,t){const a=this,l=a.paging;if(!l&&e.parentElement===e.parentElement.parentElement.lastElementChild)return;const i=a.virtualization,n=a.$.tableContainer,r=n.parentElement,o=i?a.$.virtualizationContainer:r;let s=e.getAttribute("data-field");function d(){const e=n.querySelectorAll("tr[row-id]:not([unused])");let t=i?0:a.$.header.offsetHeight+a.$.pager.offsetHeight;a.footerRow&&a.freezeFooter&&(t+=n.lastElementChild.offsetHeight);for(let a=e.length-1;a>=0;a--){const l=e[a];if(!l.classList.contains("collapsed")&&l.offsetTop+l.offsetHeight<=(i?-r.offsetTop:r.scrollTop)+o.clientHeight-t)return l.querySelector(`td[data-field${s}], .group-header`)}}s=s?`="${s}"`:"";let c=d();if(c)if(e===c){const u=(a.freezeHeader?n.firstElementChild.offsetHeight:0)+a._rowHeight;let f;if(i?(f=o.$.verticalScrollBar.value,o.$.verticalScrollBar.value+=o.clientHeight-u):r.scrollTop+=r.clientHeight-u,c=d(),l&&(i&&f===o.$.verticalScrollBar.value||!i&&e===c)){const e=a.pageIndex;a.navigateTo(a.pageIndex+1),a.pageIndex!==e&&(i&&(o.$.verticalScrollBar.value=0),a._focusCell(n.querySelector(`tr[row-id]:not([unused]) td[data-field${s}], tr[row-id]:not([unused]) .group-header`),!i,t))}else a._focusCell(c,void 0,t)}else a._focusCell(c,void 0,t)}_pageUpHandler(e,t){const a=this,l=a.virtualization,i=a.$.tableContainer,n=i.parentElement,r=l?a.$.virtualizationContainer:n;let o=e.getAttribute("data-field");function s(){const e=i.querySelectorAll("tr[row-id]:not([unused])");let t=0;a.freezeHeader&&(t=i.firstElementChild.offsetHeight);for(let a=0;a<e.length;a++){const i=e[a];if(!i.classList.contains("collapsed")&&i.offsetTop>=(l?-n.offsetTop:n.scrollTop)+t)return i.querySelector(`td[data-field${o}], .group-header`)}}o=o?`="${o}"`:"";let d=s();if(d)if(e===d){const c=(a.freezeHeader?i.firstElementChild.offsetHeight:0)+a._rowHeight;let u;if(l?(u=r.$.verticalScrollBar.value,r.$.verticalScrollBar.value-=r.clientHeight-c):n.scrollTop-=n.clientHeight-c,d=s(),a.paging&&(l&&u===r.$.verticalScrollBar.value||!l&&e===d)){const e=a.pageIndex;if(a.navigateTo(a.pageIndex-1),a.pageIndex!==e){l&&(r.$.verticalScrollBar.value=r.$.verticalScrollBar.max);const e=i.querySelectorAll(`tr[row-id]:not([aria-hidden="true"]) td[data-field${o}], tr[row-id]:not([aria-hidden="true"]) .group-header`);a._focusCell(e[e.length-1],!l,t)}}else a._focusCell(d,void 0,t)}else a._focusCell(d,void 0,t)}_tableContainerKeyupHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target;if("Shift"===e.key&&"extended"===t.selectionMode&&t.$.tableContainer.classList.remove("smart-unselectable"),t.contains(a))return a.classList.contains("filter-value")&&"date"!==a.type?(clearTimeout(t._filterRowTimeout),void(t._filterRowTimeout=setTimeout((function(){const e=t.context;t.context=t,t._applyRowFilters(),t.context=e}),500))):void 0}_tableContainerPointeroverHandler(e){const t=this;if(!t.tooltip)return;const a=(t.isInShadowDOM?e.composedPath()[0]:e.target).closest("tbody td[data-field], thead th[data-field]");if(!a)return;const l=t.$.tableContainer.querySelector(".tooltip"),i=t.columnByDataField[a.getAttribute("data-field")],n=t.virtualization;if(l&&(l.classList.remove("tooltip"),l.removeAttribute("title")),"th"!==a.tagName.toLowerCase())(a.classList.contains("tree-cell")&&a.firstElementChild&&a.firstElementChild.children[1].scrollWidth>a.firstElementChild.children[1].offsetWidth||a.scrollWidth>a.offsetWidth)&&(a.classList.add("tooltip"),a.title=n&&i&&i.templateElement?"":a.innerText);else{const e=a.querySelector(".label");e&&e.scrollWidth>e.offsetWidth&&(a.classList.add("tooltip"),a.title=n&&i&&i.templateElement?"":e.innerText)}}_documentDownHandler(e){const t=this,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;function l(){"default"!==t.columnSizeMode&&(t._preventClickSort=!0,clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks?(t._dblclickObject.numberOfClicks=0,t._autoResizeColumnOnDblclick()):t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300))}if(delete t._preventClickSort,t._editing&&!a.closest(".smart-table-editor")){const e=a.closest(".smart-drop-down")||a.closest(".smart-input-drop-down-menu");if(!e)return void t.endEdit();const l=e.ownerElement;if(!l)return void t.endEdit();if(t.$.container.contains(l)&&l.classList.contains("smart-table-editor"))return;return void t.endEdit()}const i=t.columnReorder,n=t.columnResize;if(i&&!t.columnTotals||n){const r=a.closest("th[data-field]:not(.smart-pivot-table-total-header)");if(r&&t.$.tableContainer.contains(r)){if(t.$.tableContainer.classList.add("smart-unselectable"),n&&t._columns.length>1&&!t.hasAttribute("resize-max-reached")){const a=t.rightToLeft,i=r.getBoundingClientRect();let n=null;if(!a&&e.clientX<=i.left+5||a&&e.clientX>=i.right-5){const i=r.previousElementSibling;if(i&&i.hasAttribute("data-field")){if(i.hasAttribute("locked"))return;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.headerCellElement===i){n=a;break}}const r=i.getBoundingClientRect(),o=n&&n.minWidth||t._getNumericMinWidth();return t._resizeDetails={FeedbackShown:!1,Item:i,ItemStart:r[a?"right":"left"]+window.scrollX,Min:o,StartPosition:{left:e.pageX,top:e.pageY},StartTime:new Date},t._resizeDetails.Max=t._getCurrentResizeMax(),void l()}}if(!a&&e.clientX>=i.right-5||a&&e.clientX<=i.left+5){if(r.hasAttribute("locked"))return;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.headerCellElement===r){n=a;break}}const o=n&&n.minWidth||t._getNumericMinWidth();return t._resizeDetails={FeedbackShown:!1,Item:r,ItemStart:i[a?"right":"left"]+window.scrollX,Min:o,StartPosition:{left:e.pageX,top:e.pageY},StartTime:new Date},t._resizeDetails.Max=t._getCurrentResizeMax(),void l()}}i&&(t._dragDetails={FeedbackShown:!1,Item:r,StartPosition:{left:e.pageX,top:e.pageY},StartTime:new Date})}}}_documentMoveHandler(e){const t=this,a=t._dragDetails;if(!a)return void(t._resizeDetails&&t._handleResizeOnMove(e));if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,i=Math.abs(a.StartPosition.left-e.pageX)>5||Math.abs(a.StartPosition.top-e.pageY)>5;if(!i||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&i&&!l&&(delete t._dragDetails,t.$.tableContainer.classList.remove("smart-unselectable")));t._hideBodyOverflow(),a.Feedback=t._addDragFeedback(),a.FeedbackShown=!0,a.Item.classList.add("dragged"),t.classList.add("smart-unselectable")}const l=t.$.tableContainer.parentElement;a.Feedback.style.left=e.pageX+10+"px",a.Feedback.style.top=e.pageY+10+"px",a.HoveredItem&&(a.HoveredItem.classList.remove("drop-column","left","right"),delete a.HoveredItem),l.offsetWidth<l.scrollWidth&&(clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const a=l.getBoundingClientRect();a.left<=e.clientX&&a.left+a.width>=e.clientX?e.clientX>=a.left&&e.clientX<=a.left+25?l.scrollLeft-=t._autoScrollCoefficient:e.clientX>=a.left+a.width-25&&e.clientX<=a.left+a.width?l.scrollLeft+=t._autoScrollCoefficient:clearInterval(t._dragInterval):clearInterval(t._dragInterval)}),10));const i=t._getClosestThToHover(e);i&&(i.classList.add("drop-column"),a.HoveredItem=i)}_hideBodyOverflow(){const e=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,t=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth;this._originalBodyOverflow={overflowX:document.body.style.overflowX,overflowY:document.body.style.overflowY,overflow:document.body.style.overflow},document.body.classList.add("smart-dragging"),document.body.style.overflow=document.body.style.overflowX=document.body.style.overflowY="",e&&!t?document.body.style.overflowX="hidden":t&&!e?document.body.style.overflowY="hidden":t||e||(document.body.style.overflow="hidden")}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=document.createElement("div");return a.className="smart-table-feedback",a.setAttribute("parent-table-id",e.id),a.innerHTML=e.columnByDataField[t.getAttribute("data-field")].label,e.theme&&a.setAttribute("theme",e.theme),document.body.appendChild(a),a}_getClosestThToHover(e){const t=e.clientX,a=Array.from(this.$.tableContainer.querySelectorAll("th[data-field]:not(.smart-pivot-table-total-header)"));let l,i,n;for(let e=0;e<a.length;e++){const r=a[e];if(!r||this._dragDetails.Item===r)continue;const o=r.getBoundingClientRect(),s=Math.abs(t-o.left),d=Math.abs(t-o.right),c=Math.min(s,d);if(!(void 0===i||c<i))break;l=r,i=c,n=s<d?"left":"right"}return l&&l.classList.add(n),l}_handleResizeOnMove(e){const t=this,a=t._resizeDetails;if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,i=Math.abs(a.StartPosition.left-e.pageX)>=1||Math.abs(a.StartPosition.top-e.pageY)>=1;if(!i||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&i&&!l&&(delete t._resizeDetails,t.$.tableContainer.classList.remove("smart-unselectable","resizing"),document.body.style.cursor=null));a.Feedback=t._addResizeFeedbacks(),a.FeedbackShown=!0,t.classList.add("smart-unselectable","resizing"),document.body.style.cursor="col-resize"}const l=a.Feedback,i=a.ItemStart;let n;t.rightToLeft?(n=Math.min(a.Max,Math.max(a.Min,Math.round(i-e.pageX))),l.style.left=i-n+"px"):(n=Math.min(a.Max,Math.max(a.Min,Math.round(e.pageX-i))),l.style.left=i+n+"px"),l.classList.toggle("min",n===a.Min),l.classList.toggle("max",n===a.Max),t.columnResizeFeedback&&(l.innerHTML=n+"px"),a.Width=n}_addResizeFeedbacks(){const e=this,t=e._resizeDetails,a=e.$.container.getBoundingClientRect(),l=a.top+window.scrollY+"px",i=a.height+"px",n=document.createElement("div"),r=document.createElement("div");return r.className="smart-table-resize-feedback static",r.setAttribute("parent-table-id",e.id),r.style.top=l,r.style.left=t.ItemStart+"px",r.style.height=i,e._resizeDetails.StaticFeedback=r,n.className="smart-table-resize-feedback",n.setAttribute("parent-table-id",e.id),n.style.top=l,n.style.height=i,e.theme&&(r.setAttribute("theme",e.theme),n.setAttribute("theme",e.theme)),document.body.appendChild(n),document.body.appendChild(r),n}_resolveResize(e){const t=this,a=t._resizeDetails;if(delete t._resizeDetails,t.$.tableContainer.classList.remove("smart-unselectable","resizing"),e){if(!a.FeedbackShown)return;a.StaticFeedback.remove(),a.Feedback.remove()}const l=t._columns.find((e=>e.headerCellElement===a.Item));t.classList.remove("smart-unselectable","resizing"),document.body.style.cursor=null;let i=a.Width;i<t.columnMinWidth&&(i=t.columnMinWidth);const n=t._getTableRemainingWidth();if(l){const e=l._isResponsive||!!(l.width&&l.width.toString().indexOf("%")>=0);if(delete l.width,l.minWidth&&i<l.minWidth&&(i=l.minWidth),l._manualWidth=i,l._manualPercentageWidth=parseFloat(i/n*100),l._isResponsive=e,a.Item.style.width=l._isResponsive?parseFloat(i/n*100)+"%":i+"px",l._isFillRemainingWidth){let e=!0;for(let a=0;a<t._columns.length;a++){const l=t._columns[a];if(!l.width&&!l._manualWidth){e=!1;break}}!t.columnResizeNormalize&&e&&(t.columns.push({dataField:"",label:"",visible:!0,allowResize:!1,allowFilter:!1,allowSort:!1}),t._initColumns(!0),t.refresh())}}else a.Item.style.width=i+"px";t._handleAutoSizeMode(l),t._handleFrozenColumnPositions(),t._refreshHorizontalScrollbar();const r=parseFloat(i/n*100);t.$.fireEvent("columnResize",{dataField:l.dataField,headerCellElement:a.Item,widthInPercentages:r,width:i})}openColumnMenu(e){const t=this,a=t.columnByDataField[e];if(!a)return;const l=a.headerCellElement;if(!l)return;if(a&&!1===a.allowMenu)return;const i=l.querySelector(".column-menu");if(!i)return;const n=()=>{const e=c.getBoundingClientRect(),a=t.activeColumnMenu;t._columnsSettingsMenu.style.top=e.top+window.scrollY+"px",t._columnsSettingsMenu.style.left=e.right+window.scrollX+"px",e.right-i.offsetWidth+window.scrollX+a.offsetWidth>t.getBoundingClientRect().right&&(t._columnsSettingsMenu.style.left=10+e.right-a.offsetWidth-t._columnsSettingsMenu.offsetWidth+window.scrollX+"px")},r=()=>{const e=a.headerCellElement;e.hasAttribute("column-menu-button")||e.setAttribute("column-menu-button","");const l=e.querySelector(".column-menu"),i=l.getBoundingClientRect();o.style.top=i.bottom+10+window.scrollY+"px",o.style.left=i.right-l.offsetWidth+window.scrollX+"px",i.right-l.offsetWidth+window.scrollX+o.offsetWidth>t.getBoundingClientRect().right&&(o.style.left=i.right-o.offsetWidth+window.scrollX+"px");const n=o.querySelector("input");n&&n.focus()};a.columnMenu&&a.columnMenu.remove(),t.closeColumnMenu();const o=document.createElement("div");o.classList.add("smart-table-column-menu","wrapper"),o.owner=l,o.dataField=e;const s=document.createElement("div");s.innerHTML=`<span class='menu-icon sort-asc'></span><span class="label">${t.localize("columnMenuItemSortAsc")}</span>`,s.classList.add("smart-table-menu-item");const d=document.createElement("div");d.innerHTML=`<span class='menu-icon sort-desc'></span><span class="label">${t.localize("columnMenuItemSortDesc")}</span>`,d.classList.add("smart-table-menu-item");const c=document.createElement("div");c.innerHTML=`<span class='menu-icon columns'></span><span class="label">${t.localize("columnMenuItemColumns")}</span>`,c.classList.add("smart-table-menu-item","columns-item");const u=document.createElement("div");u.innerHTML=`<span class='menu-icon filter-by'></span><span class="label">${t.localize("columnMenuItemFilter")}</span>`,u.classList.add("smart-table-menu-item","filter-item");const f=document.createElement("div");f.innerHTML=`<span class='menu-icon filter-by-remove'></span><span class="label">${t.localize("columnMenuItemRemoveFilter")}</span>`,f.classList.add("smart-table-menu-item","remove-filter-item","smart-hidden");const m=document.createElement("div");m.innerHTML=`<span class='menu-icon sort-remove'></span><span class="label">${t.localize("columnMenuItemRemoveSort")}</span>`,m.classList.add("smart-table-menu-item","remove-sort-item","smart-hidden");const h=document.createElement("div");h.innerHTML=`<span class='menu-icon reset'></span><span class="label">${t.localize("columnMenuItemReset")}</span>`,h.classList.add("smart-table-menu-item","reset-item"),c.onmouseleave=e=>{const a=t._columnsSettingsMenu.getBoundingClientRect();e.pageX>=a.left-20&&e.pageX<=a.right+20&&e.pageY>=a.top-20&&e.pageY<=a.bottom+20||t._columnsSettingsMenu&&t._columnsSettingsMenu.remove()},c.onmouseenter=()=>{t._columnsSettingsMenu=(()=>{t._columnsSettingsMenu&&t._columnsSettingsMenu.remove();const a=document.createElement("div");a.classList.add("smart-table-column-menu","wrapper","smart-table-columns-menu");let l=0,i=null;for(let o=0;o<t.columns.length;o++){const s=document.createElement("div");s.innerHTML=`<span class='column-item menu-icon'></span><span class="label">${t.columns[o].label}</span>`,s.classList.add("smart-table-menu-item"),s.column=t.columns[o],e!==s.column.dataField&&!1!==s.column.allowHide&&(s.column.visible?(l++,i=s):s.firstElementChild.classList.add("off"),s.onpointerdown=e=>{s.column.visible=!s.column.visible,s.column.visible?s.firstElementChild.classList.remove("off"):s.firstElementChild.classList.add("off"),r(),n(),e.stopPropagation(),e.preventDefault()},a.appendChild(s))}return 1===l&&i&&i.classList.add("smart-disabled"),document.body.appendChild(a),a})(),n()};const p=t._createFilterRowInput(a);t.filtering&&!1!==a.allowFilter&&(t.filterRow?o.insertBefore(f,o.firstElementChild):(o.innerHTML=p,o.insertBefore(u,o.firstElementChild))),o.insertBefore(h,o.firstElementChild),o.insertBefore(c,o.firstElementChild),o.insertBefore(m,o.firstElementChild),!1!==a.allowSort&&"none"!==t.sortMode&&(o.insertBefore(d,o.firstElementChild),o.insertBefore(s,o.firstElementChild),a.headerCellElement.hasAttribute("aria-sort")&&(m.classList.remove("smart-hidden"),"ascending"===a.headerCellElement.getAttribute("aria-sort")?s.classList.add("smart-disabled"):d.classList.add("smart-disabled")),m.onclick=()=>{t.sortBy(a.dataField,null),t.closeColumnMenu()},s.onclick=()=>{t.sortBy(a.dataField,"asc"),t.closeColumnMenu()},d.onclick=()=>{t.sortBy(a.dataField,"desc"),t.closeColumnMenu()}),h.onclick=()=>{if(t._initialState){if(t.loadState(t._initialState),t._filterInfo.filterRowValues&&delete t._filterInfo.filterRowValues,t.clearFilters(),t.filterRow){const e=t.$.tableContainer.querySelector(".smart-table-filter-row");e&&e.remove()}t._initRows(),t.refresh()}t.closeColumnMenu()};const g=t.columns.findIndex((e=>e.dataField===a.dataField));t.appendChild(o);const _=o.lastElementChild.children[2];_&&(_.onclick=()=>{const e=_.parentElement.firstElementChild,a=_.parentElement.children[1];e.value="",-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(a.$.input.dataValue)&&(a.value=t.localize("text"===e.type?"CONTAINS":"EQUAL"),delete a.$.input.dataValue),t._applyRowFilters()});const b=t._filterInfo&&t._filterInfo.filterRowValues?t._filterInfo.filterRowValues[g]:null;if(b&&!t.filterRow){const e=o.lastElementChild,l=a.dataType,i=t._filterInfo["string"===l?"stringConditions":"numberAndDateConditions"].find((e=>e.value===b.condition));if(-1===["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(i.value))if("date"===l){const t=new Date(b.value),a=(t.getMonth()+1).toString(),l=t.getDate().toString();e.children[0].value=`${t.getFullYear()}-${"0".repeat(2-a.length)}${a}-${"0".repeat(2-l.length)}${l}`}else e.children[0].value=b.value;e.children[1].value=i.label,e.children[1].$.input.dataValue=i.value,e.children[2].classList.remove("smart-hidden")}a.headerCellElement.hasAttribute("filter")&&f.classList.remove("smart-hidden"),f.onclick=()=>{t.removeFilter(a.dataField),t.closeColumnMenu()},r(),a.columnMenu=t.activeColumnMenu=o,t.$.fireEvent("openColumnMenu",{dataField:e})}closeColumnMenu(){const e=this;e.activeColumnMenu&&(e.activeColumnMenu.owner.hasAttribute("column-menu-button")&&e.activeColumnMenu.owner.removeAttribute("column-menu-button"),e._columnsSettingsMenu&&e._columnsSettingsMenu.remove(),e.$.fireEvent("closeColumnMenu",{dataField:e.activeColumnMenu.dataField}),e.activeColumnMenu.remove(),delete e.activeColumnMenu)}_documentUpHandler(e){const t=this,a=t._dragDetails;if(t.activeColumnMenu){const a=e.originalEvent?e.originalEvent:e;if(a){let e=!1,l=a.target;for(;l;)if(l=l.parentNode,l===t){e=!0;break}(t.activeColumnMenu.contains(a.target)||t._columnsSettingsMenu&&t._columnsSettingsMenu.contains(a.target))&&(e=!0);const i=t.activeColumnMenu.querySelector("smart-input");i&&i.$.scrollView.contains(a.target)&&(e=!0),e||t.closeColumnMenu()}}if(t._selectDrag)return t.$.main.classList.remove("prevent-scroll"),void delete t._selectDrag;if(!a)return void(t._resizeDetails&&t._resolveResize(!0));if(delete t._dragDetails,t.$.tableContainer.classList.remove("smart-unselectable"),!a.FeedbackShown)return;const l=a.HoveredItem;document.body.classList.remove("smart-dragging"),document.body.style.overflow=t._originalBodyOverflow.overflow,document.body.style.eoverflowX=t._originalBodyOverflow.overflowX,document.body.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,t.classList.remove("smart-unselectable"),a.Item.classList.remove("dragged"),document.body.removeChild(a.Feedback),clearInterval(t._dragInterval),delete t._dragInterval,l&&t._applyColumnReorder(a,l),t._preventClickSort=!0,requestAnimationFrame((()=>delete t._preventClickSort))}_applyColumnReorder(e,t){const a=this,l=a.rightToLeft,i=a._columns,n=e.Item.getAttribute("data-field"),r=i.find((e=>e.dataField===n)),o=t.getAttribute("data-field"),s=t.classList.contains("right"),d=a._columns.filter((e=>e.dataField!==n)),c=d.findIndex((e=>e.dataField===o));t.classList.remove("drop-column","left","right"),s&&!l||!s&&l?d.splice(c+1,0,r):d.splice(c,0,r),i.map((e=>e.dataField)).join(",")!==d.map((e=>e.dataField)).join(",")&&(a.columns=d,a._initColumns(),a.refresh())}_applyRowFilters(){const e=this;if(!e.filtering||!e.filterRow&&!e.columnMenu)return;const t=e.filterRow?e.$.tableContainer.querySelector(".smart-table-filter-row"):null,a=Number(e.selection),l=e._columns.filter((e=>e.visible)),i=[],n=[];for(let r=0;r<l.length;r++){const o=l[r].dataField,s=l[r].dataType;if(l[r].headerCellElement&&l[r].headerCellElement.hasAttribute("filter")&&l[r].headerCellElement.removeAttribute("filter"),!e.filterRow&&!l[r].columnMenu){n.push(null);continue}const d=e.filterRow?t.children[r+a].firstElementChild:l[r].columnMenu.lastElementChild,c=d.children[2];let u=d.firstElementChild.value,f=d.children[1].value;"string"===s?f=e._filterInfo.stringConditions.find((e=>e.label===f)).value:(f=e._filterInfo.numberAndDateConditions.find((e=>e.label===f)).value,""!==u&&("number"===s?(u=parseFloat(u),isNaN(u)&&(d.firstElementChild.value="",u="")):"date"===s&&(u=new Date(u),u.setHours(0,0,0))));const m=-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(f);if(""!==u||m){const e=new Smart.Utilities.FilterGroup,t=e.createFilter(s,u,f);e.addFilter("or",t),i.push([o,e]),c.classList.remove("smart-hidden"),n.push({condition:f,value:u}),l[r].headerCellElement&&l[r].headerCellElement.setAttribute("filter","")}else c.classList.add("smart-hidden"),n.push(null),l[r].headerCellElement&&l[r].headerCellElement.hasAttribute("filter")&&l[r].headerCellElement.removeAttribute("filter");m?d.firstElementChild.setAttribute("disabled",!0):d.firstElementChild.removeAttribute("disabled")}i.length>0?(e.dataSource.virtualDataSource||e.dataSource._filter(i,e.filterOperator),e._filterInfo.rowFilters=i,e._filterInfo.filterRowValues=n,delete e._filterInfo.appliedFilters,e._fullRefresh("filter"),e._updateState("filtered"),e._doNotFireEvent||e.$.fireEvent("filter",{action:"add",filters:i})):e._filterInfo.rowFilters?(e._filterInfo.filterRowValues&&delete e._filterInfo.filterRowValues,e.clearFilters()):e._filterInfo.filterRowValues&&delete e._filterInfo.filterRowValues}_clearFilterInput(){const e=this;e._filterInfo.query="",delete e._filterInfo.inputFilters,e.$.filterInput.value=""}_clearRowFilters(e){const t=this;if(!t._filterInfo.rowFilters)return;const a=t.$.tableContainer.querySelector(".smart-table-filter-row"),l=t.selection?1:0;let i=t._columns.filter((e=>e.visible));if(e&&(i=t._columns.filter((t=>t.dataField===e))),a)for(let e=0;e<i.length;e++){const t=a.children[e+l]?a.children[e+l].firstElementChild:null;t&&(t.firstElementChild.value="",t.children[2].classList.add("smart-hidden")),i[e].headerCellElement&&i[e].headerCellElement.hasAttribute("filter")&&i[e].headerCellElement.removeAttribute("filter")}delete t._filterInfo.rowFilters}_createFooterRow(e){const t=this,a=t.footerRow;if(!a)return;if(e)return void t.$.tableContainer.appendChild(e);const l=document.getElementById(a);if(l&&l instanceof HTMLTemplateElement){const e=document.createElement("tfoot"),a=document.importNode(l.content,!0);e.appendChild(a),t.$.tableContainer.appendChild(e)}else t.footerRow=null}_createCustomHeaderRow(){const e=this,t=e.$.tableContainer.firstElementChild;let a=e.headerRow;if(a){if("function"==typeof a)a.call(e,t);else if("string"==typeof a){const e=document.getElementById(a);if(!e)return void(t.innerHTML=`<tr><th>${a}</th></tr>`);a=e}a instanceof HTMLTemplateElement?t.appendChild(document.importNode(a.content,!0)):a.nodeName?t.appendChild(a):e.headerRow=null}}_updateSelectAllState(e){const t=this;if(!t.selection||"cell"===t.selectionMode)return;const a=t.$.tableContainer.querySelector(".smart-table-select-all");let l;if(void 0===e){const a=t.dataSource,i=t._filterInfo;if(i.inputFilters||i.rowFilters||i.appliedFilters){const i=t._selectedIds;e=0,l=0;for(let t=0;t<a.length;t++){const n=a[t];if(!1===n.$.filtered)continue;const r=n.$.id;e++,-1!==i.indexOf(r)&&l++}}else e=t.dataSource.length}void 0===l&&(l=t._selectedIds.length),0===l||0===e?(a.classList.remove("selected","indeterminate"),a.firstElementChild.setAttribute("aria-checked",!1)):l===e+t._selectableGroupRecords.length?(a.classList.remove("indeterminate"),a.classList.add("selected"),a.firstElementChild.setAttribute("aria-checked",!0)):(a.classList.remove("selected"),a.classList.add("indeterminate"),a.firstElementChild.setAttribute("aria-checked","mixed"))}_resizeHandler(){const e=this;clearTimeout(e._resizeTimeout);const t=()=>{if(Smart.Utilities.Core.Browser.Firefox&&e.virtualization){const t=e.$.virtualizationContainer.$.verticalScrollBar.value;e._onVerticalChange({detail:{value:t}},!0)}};t(),"default"===e.columnSizeMode&&e._handleAutoSizeMode(),e._resizeTimeout=setTimeout((function(){if(e.columnGroups&&e._columns.some((e=>e.responsivePriority&&e.responsivePriority>1)))return void e.refresh();const a=e.offsetWidth,l=e.offsetHeight;if(e.virtualization&&e._cachedHeight!==l){const i=e._getFractionOfMax();return e._refreshDataRows(),e._setFractionOfMax(i),e._cachedWidth=a,e._cachedHeight=l,void t()}e._handleAutoSizeMode(),e._handleFrozenColumnPositions(),e._refreshHorizontalScrollbar(),e._cachedWidth=a,e._cachedHeight=l,t()}),75)}_hierarchyArrowClickHandler(e,t){const a=this,l=!a.grouping,i=e.data;if(a.animation=a._animation,l&&a.dataSource.virtualDataSource&&!i.expanded&&i.children&&0===i.children.length)return a._requestVirtualDataSource("expand",void 0,i),void a.$.fireEvent("expand",{id:i.$.id,record:i});if(a.virtualization)return void a._hierarchyArrowClickHandlerVirtualization(e,t);const n=a.$.tableContainer,r=i.$.id;function o(e){e.forEach((e=>{a._expandSingleChildRow(n.querySelector(`tr[row-id="${e.$.id}"]:not([unused])`)),e.children&&e.expanded&&requestAnimationFrame((()=>o(e.children)))}))}if(i.expanded?function e(t){t.forEach((t=>{a._collapseSingleChildRow(n.querySelector(`tr[row-id="${t.$.id}"]:not([unused])`)),t.children&&e(t.children)}))}(i.children):requestAnimationFrame((()=>o(i.children))),i.expanded=!i.expanded,e.setAttribute("aria-expanded",i.expanded),e.classList.toggle("expanded",i.expanded),l)i.expanded?(-1===a._expandedIds.indexOf(r)&&a._expandedIds.push(r),a.$.fireEvent("expand",{id:i.$.id,record:i})):(a._expandedIds=a._expandedIds.filter((e=>e!==r)),a.$.fireEvent("collapse",{id:i.$.id,record:i})),a._updateState("expanded");else if(!0!==t){let e=""+i.$.id;e=e.replace("Item","").replace(/_/gi,"."),i.expanded?a.$.fireEvent("group",{action:"expand",path:e,dataField:i.groupDataField,label:i.label}):a.$.fireEvent("group",{action:"collapse",path:e,dataField:i.groupDataField,label:i.label})}}_expandSingleChildRow(e,t=[]){e&&(t.push(!1),"none"!==this.animation?(e.classList.remove("smart-hidden"),requestAnimationFrame((()=>{e.classList.add("no-height"),e.ontransitionend=function(){e.classList.remove("no-height"),e.ontransitionend=null,t.pop()},e.removeAttribute("aria-hidden"),e.classList.remove("collapsed")}))):(e.removeAttribute("aria-hidden"),e.classList.remove("collapsed","smart-hidden"),t.pop()))}_collapseSingleChildRow(e,t=[]){e&&(t.push(!1),"none"!==this.animation?e.ontransitionend=function(){e.classList.add("smart-hidden"),e.ontransitionend=null,t.pop()}:(e.classList.add("smart-hidden"),t.pop()),e.setAttribute("aria-hidden",!0),e.classList.add("collapsed"))}_getGroupByIndex(e){"number"==typeof e&&(e=e.toString());const t=this.dataSource.boundHierarchy,a=e.split(".");let l=t[a[0]];if(l){for(let e=1;e<a.length;e++)if(l=l.children[a[e]],!l||l.leaf)return;return l}}getGroupChildren(e){"number"==typeof e&&(e=e.toString());const t=this.dataSource.boundHierarchy,a=e.split(".");let l=t[a[0]];if(!l)return[];for(let e=1;e<a.length;e++)if(l=l.children[a[e]],!l||l.leaf)return[];return l.children}_createDialog(){const e=this,t=document.createElement("smart-window"),a=document.createElement("template"),l=` animation=${e.animation} theme="${e.theme}"${e.rightToLeft?" right-to-left":""}${!e.keyboardNavigation||e.unfocusable?" unfocusable":""}`;a.innerHTML=`<smart-button class="ok primary"${l}>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${l}>${e.localize("cancel")}</smart-button>`,t.animation=e.animation,t.footerTemplate=a,t.headerButtons=["close"],t.rightToLeft=e.rightToLeft,t.theme=e.theme,t.unfocusable=!e.keyboardNavigation||e.unfocusable,t.className="smart-table-window",t.ownerElement=e,e._dialog=t,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(t),e.setAttribute("aria-owns",t.id)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("close",e._dialogEventHandler),t.addEventListener("click",e._dialogEventHandler)}_dialogEventHandler(e){const t=this,a=t.ownerElement,l=t.isInShadowDOM?e.composedPath()[0]:e.target,i=e.type,n=a.context;if(a.context=a,"close"===i){if(l!==t)return void(a.context=n);const e=t.classList.contains("conditional-formatting"),i=t.classList.contains("fields");t.ok?(e&&a._applyConditionalFormatting(),delete t.ok):e&&JSON.stringify(a._formattingPanel.items)!==JSON.stringify(a._formattingPanel.getItems())&&(a._formattingPanel.$.itemsContainer.innerHTML="",a._formattingPanel._addDefaultItems()),t.content.innerHTML="",t.classList.remove("conditional-formatting","drill-down","fields"),!a.keyboardNavigation||a.disabled||a.unfocusable||(a.$.tableContainer.setAttribute("tabindex",0),"smart-table"===a.nodeName.toLowerCase()&&(a.$.filterInput.unfocusable=!1,a.$.pager.unfocusable=!1),a.$.conditionalFormattingButton.unfocusable=!1),a.removeAttribute("modal"),e?a.$.conditionalFormattingButton.focus():i&&a.$.fieldsButton?a.$.fieldsButton.focus():a.$.tableContainer.focus()}else"click"===i&&t.$.footer.contains(l)&&(l.closest(".ok")?(t.ok=!0,t.close()):l.closest(".cancel")&&t.close());a.context=n}_openDialog(e,t,a){const l=this;l._dialog||l._createDialog();const i=l._dialog;i.label=e,i.classList.add(a),i.appendChild(t),l.$.tableContainer.removeAttribute("tabindex"),"smart-table"===l.nodeName.toLowerCase()&&(l.$.filterInput.unfocusable=!0,l.$.pager.unfocusable=!0),"drill-down"!==a?i.setAttribute("aria-controls",l.$.tableContainer.id):i.removeAttribute("aria-controls"),l.$.conditionalFormattingButton.unfocusable=!0,l.setAttribute("modal",""),i.open()}_conditionalFormattingButtonClickHandler(e,t,a){const l=this;let i;l._formattingPanel?i=l._formattingPanel:(i=document.createElement("smart-formatting-panel"),i.animation=l.animation,i.columns=t||l._columns,i.dataSource=a||l.dataSource,i.locale=l.locale,i.messages=l.messages,i.rightToLeft=l.rightToLeft,i.theme=l.theme,i.unfocusable=!l.keyboardNavigation||l.unfocusable,i.ownerElement=l,l._formattingPanel=i),l.conditionalFormatting&&(i.items=l.conditionalFormatting.slice(0)),l._openDialog(l.localize("conditionalFormatting"),i,"conditional-formatting")}_transformDataSource(){const e=this;if(!e.isRendered&&e.dataTransform){const t=e.dataSource;for(let a=0;a<t.length;a++)e.dataTransform(t[a])}}_applyInitialConditionalFormatting(e){const t=this,a=t.conditionalFormatting;if(!a||0===a.length)return void(t._conditionalFormatting=null);const l=t._defaults,i=new Smart.Utilities.ConditionalFormatter(e),n=[];let r;if("smart-pivot-table"===t.nodeName.toLowerCase()){const e=t._dynamicColumns;r=function(t){return"all"===t?e.map((e=>e.id)):e.filter((e=>e.dataFields[e.dataFields.length-1].dataField===t)).map((e=>e.id))}}else r=function(e){return"all"===e?t._columns.map((e=>e.value)):[e]};for(let e=0;e<a.length;e++){a[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},a[e]);const t=a[e],o=r(t.column),s=t.condition;i.color=t.highlight,i.comparator=t.firstValue,i.min=t.firstValue,i.max=t.secondValue;const d=i.format(s,o);for(let e in d){const a=d[e];for(let e in a){const l=a[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=a.slice(0)),0===n.length)return n[0];const o={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const a=t[e];o[e]||(o[e]={});for(let t in a)o[e][t]=Object.assign({},o[e][t],a[t])}}t._conditionalFormatting=o}_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"}_applyConditionalFormatting(){const e=this,t=e._conditionalFormatting;e._conditionalFormatting=e._formattingPanel.apply(),e.conditionalFormatting=e._formattingPanel.getItems(),e._conditionalFormatting!==t&&e._refreshDataRows()}_updateState(e,t){const a=this;let l;if("selected"===e&&(l=a.getSelection(),a.selected=l),-1===a.stateSettings.indexOf(e))return;const i=a._state;switch(e){case"columns":i.columns=a._columns;break;case"expanded":i.expanded=a._expandedIds;break;case"filtered":i.filtered=a._filterInfo;break;case"grouped":i.grouped=a.dataSource.groupBy._array.slice(0);break;case"selected":i.selected=l;break;case"sorted":i.sorted=a._sortColumns||[]}a.autoSaveState&&a.isRendered&&!1!==t&&window.localStorage.setItem("smartTable"+a.id,a._stringifyState())}_stringifyState(){const e=this,t=JSON.parse(JSON.stringify(e._state));return["columns","expanded","filtered","grouped","selected","sorted"].forEach((a=>{-1===e.stateSettings.indexOf(a)&&delete t[a]})),JSON.stringify(t,(function(e,t){if(!("function"==typeof t||t instanceof HTMLElement||"sortOrder"===e||"thHierarchy"===e))return t}))}_handleAutoSizeMode(){const e=this;if("default"===e.columnSizeMode){const t=e._columns.filter((e=>e.visible)),a=[],l=t=>{const a=t.headerCellElement;if(!a)return;const l=parseInt(t.minWidth||e.columnMinWidth);a.offsetWidth<l?a.style.width=l+"px":(a.style.width="",a.offsetWidth<l&&(a.style.width=l+"px"))};t.forEach((t=>{if(t.width||t._manualWidth||(l(t),a.push(t)),t.width&&"string"==typeof t.width&&t.width.endsWith("%")){const a=e._getColumnWidth(t.width,!1,t);!1===t.autoWidth?t.headerCellElement.style.width=t.width:(t.headerCellElement.setAttribute("responsive-width",t.width),t.headerCellElement.style.width=a+"px")}else if(t._manualPercentageWidth)if(t._isResponsive){const a=e._getColumnWidth(t._manualPercentageWidth+"%",!1,t);!1===t.autoWidth?t.headerCellElement.style.width=t.width:(t.headerCellElement.setAttribute("responsive-width",t._manualPercentageWidth+"%"),t.headerCellElement.style.width=a+"px")}else t.headerCellElement.style.width=t._manualWidth+"px"}));for(let e=0;e<a.length;e++)l(a[e]);return}const t=e._columns.filter((e=>e.visible)),a=e._getNumericMinWidth();let l,i;t.forEach((e=>{e.width||e._manualWidth||(l||(l=e),i=e,e.headerCellElement.style.width=null)}));const n=e.$.tableContainer.offsetWidth-(e.selection?e.$.tableContainer.querySelector(".smart-table-select-all").offsetWidth:0);let r=new Map,o=0,s=0,d=0;e.removeAttribute("resize-max-reached"),e.setAttribute("auto-size",""),l&&(l.headerCellElement.style.width="100%");for(let i=0;i<t.length;i++){const n=t[i];if(n===l){d++;continue}const c=n.headerCellElement;let u,f;n.width?(u=f=e._getColumnWidth(n.width,!1,n),n.minWidth&&u<f&&(u=n.minWidth,f=n.minWidth)):n._manualWidth?(u=n._manualWidth,f=n.minWidth||a,u<f&&(u=f)):(u=Math.max(c.offsetWidth,a),f=n.minWidth||a,d++),o+=u,s+=f,n._isResponsive&&(u=e._getColumnWidth(n._manualPercentageWidth+"%",!1,n),u<f&&(u=f)),r.set(n,{width:u,minWidth:f})}function c(){l.headerCellElement.style.width=null;const e=Math.max(l.headerCellElement.offsetWidth,a),t=l.minWidth||a;r.set(l,{width:e,minWidth:t}),o+=Math.max(e,t),s+=t}if(l)if(l!==i)i.headerCellElement.style.width="100%",c(),i.headerCellElement.style.width=null;else if(t.length>1){const e=t.find((e=>e!==l));e.headerCellElement.style.width="100%",c(),e._isResponsive?e.headerCellElement.style.width=r.get(e).width+"%":e.headerCellElement.style.width=r.get(e).width+"px"}else c();if(n<=s||0===d)t.forEach((t=>{if(t._isResponsive){if(t.headerCellElement.style.width=(t._manualPercentageWidth?t._manualPercentageWidth+"%":r.get(t).minWidth)+"px",t._manualPercentageWidth){const a=e._getColumnWidth(t._manualPercentageWidth+"%",!1,t),l=t.minWidth||e.columnMinWidth;a===l&&(t.headerCellElement.style.width=l+"px")}}else t.headerCellElement.style.width=(t._manualWidth?t._manualWidth:r.get(t).minWidth)+"px"})),n<=s&&e.setAttribute("resize-max-reached","");else if(n>s)if(n<o){const a=[];let l,i=o-n,s=d;for(;i>0&&s>0;)l=Math.ceil(i/s),t.forEach((e=>{if(e.width||e._manualWidth||-1!==a.indexOf(e))return;const t=r.get(e);let n=Math.max(t.width-l,t.minWidth);const o=t.width-n;i-=o,n===t.minWidth&&(s--,a.push(e)),t.width=n}));t.forEach((t=>{if(t._isResponsive){if(t.headerCellElement.style.width=r.get(t).width+"%",t._manualPercentageWidth){const a=e._getColumnWidth(t._manualPercentageWidth+"%",!1,t),l=t.minWidth||e.columnMinWidth;a===l&&(t.headerCellElement.style.width=l+"px")}}else t.headerCellElement.style.width=r.get(t).width+"px"}))}else n===o?t.forEach((e=>{e._isResponsive?e.headerCellElement.style.width=r.get(e).width+"%":e.headerCellElement.style.width=r.get(e).width+"px"})):t.forEach((e=>{const t=r.get(e).width;e.headerCellElement.style.width=e===l?n-o+t+"px":t+"px"}));e.removeAttribute("auto-size")}_getNumericMinWidth(){const e=this,t=e.columnMinWidth;return"string"==typeof t&&-1!==t.indexOf("%")?e.offsetWidth*(parseFloat(t)/100):parseFloat(t)}_getCurrentResizeMax(){const e=this;if("default"===e.columnSizeMode)return 1/0;const t=e._resizeDetails,a=e._columns,l=a.find((e=>e.headerCellElement===t.Item)),i=a.indexOf(l);let n,r=a.length-1;for(let e=a.length-1;e>=0;e--)if(a[e].visible){r=e;break}if(i===r)return t.Item.offsetWidth;for(let t=i+1;t<a.length;t++){const l=a[t];t===r&&l.headerCellElement&&(n=l.headerCellElement.getBoundingClientRect()[e.rightToLeft?"left":"right"]+window.scrollX)}return n}_autoResizeColumnOnDblclick(){const e=this,t=e._resizeDetails,a=t.Item,l=e._columns.find((e=>e.headerCellElement!==a)).headerCellElement,i=l.style.width;e.setAttribute("auto-size",""),a.style.width=null,l.style.width="100%";let n=a.offsetWidth;l.style.width=i,e.removeAttribute("auto-size",""),n=Math.min(t.Max,Math.max(t.Min,n)),t.Width=n,e._resolveResize()}_isExpandCollapseForbidden(){const e=this;return(!e.hasAttribute("hierarchy")||e.grouping)&&"smart-pivot-table"!==e.nodeName.toLowerCase()}_selectSingle(e){const t=this,a=t.rowById?t.rowById[e]||t.dataSource.dataItemById[e]:t.rows.dataItemById[e];if(!a)return;const l=a.data?a.data.$.id:a.$.id;if(-1!==t._selectedIds.indexOf(l)||-1!==t._disabledSelection.indexOf(l))return;const i=t.$.tableContainer.querySelector(`tr[row-id="${l}"]:not([unused])`);if("one"===t.selectionMode&&(t._clearSelection(),t._selectedIds=[]),t._selectedIds.push(l),i){const e=i.firstElementChild;e.classList.remove("indeterminate"),e.classList.add("selected"),e.firstElementChild.setAttribute("aria-checked",!0),i.setAttribute("aria-selected",!0)}return t._handleHierarchicalSelection(a,!0),!0}_unselectSingle(e){const t=this,a=t.rowById?t.rowById[e]||t.dataSource.dataItemById[e]:t.rows.dataItemById[e];if(!a)return;const l=a.data?a.data.$.id:a.$.id,i=t._selectedIds.indexOf(l),n=t.$.tableContainer.querySelector(`tr[row-id="${l}"]:not([unused])`);if(-1!==i&&t._selectedIds.splice(i,1),n){const e=n.firstElementChild;e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1),n.setAttribute("aria-selected",!1)}return t._handleHierarchicalSelection(a,!1),!0}_changeSelectionOfMultiple(e,t,a="programmatic",l){const i=this;l||(l=JSON.stringify(i._selectedIds.slice(0).sort()));for(let a=0;a<e.length;a++)i[`_${t}Single`](e[a]);l!==JSON.stringify(i._selectedIds.slice(0).sort())&&(i._updateSelectAllState(),i._updateState("selected"),i.$.fireEvent("change",{type:a}))}_handleHierarchicalSelection(e,t){const a=this;if(!a.hasAttribute("hierarchy"))return;if(!1===a.selectionByHierarchy)return;const l=e.data;let i=l;for(l&&l.children&&function e(t,l){const i=t.children;let n=0;for(let t=0;t<i.length;t++){const r=i[t];if(!1===r.$.filtered)continue;let o=a._setThreeStateCheckbox(r,l);r.children&&r.children.length>0&&(o=e(r,l)),l&&!1===o&&n++}if(l&&n>0)return a._setThreeStateCheckbox(t,n!==i.length&&null)}(l,t);i&&i.parent;){const e=i.parent,t=a._getChildCheckState(e).state;a._setThreeStateCheckbox(e,t),i=e}}_getChildCheckState(e){const t=this,a=t._selectedIds,l=t._disabledSelection,i=e.children;if(!i||0===i.length||!t.selectionByHierarchy){const t=e.$.id,i=-1!==a.indexOf(t);return{state:i,maxSelected:!!i||-1!==l.indexOf(t)}}let n=!0,r=0,o=0,s=0;for(let e=0;e<i.length;e++){const a=i[e];if(!1===a.$.filtered)continue;const l=t._getChildCheckState(a);r++,l.state?o++:null===l.state?s++:!1===l.maxSelected&&(n=!1)}return 0!==o&&o===r?{state:!0,maxSelected:!0}:0===o&&0===s?{state:!1,maxSelected:n}:{state:null,maxSelected:n}}_setThreeStateCheckbox(e,t){const a=this,l=e.$.id,i=a._selectedIds,n=i.indexOf(l);t&&(-1!==a._disabledSelection.indexOf(l)?t=!1:-1===n&&i.push(l)),t||-1===n||i.splice(n,1);const r=a.$.tableContainer.querySelector(`tr[row-id="${l}"]:not([unused])`);if(!r)return t;const o=r.firstElementChild,s=o.firstElementChild;return t?(o.classList.remove("indeterminate"),o.classList.add("selected"),s.setAttribute("aria-checked",!0),r.setAttribute("aria-selected",!0)):!1===t?(o.classList.remove("selected","indeterminate"),s.setAttribute("aria-checked",!1),r.setAttribute("aria-selected",!1)):(o.classList.remove("selected"),o.classList.add("indeterminate"),s.setAttribute("aria-checked","mixed"),r.setAttribute("aria-selected",!1)),t}_getSelectableGroupRecords(){const e=this,t=e.dataSource,a=t.boundHierarchy;e._selectableGroupRecords=[],a?(function t(a){a.forEach((a=>{a.groupDataField&&(e._selectableGroupRecords.push(a.$.id),t(a.children))}))}(a),e._selectedIds=e._selectedIds.filter((a=>void 0!==t.dataItemById[a]||-1!==e._selectableGroupRecords.indexOf(a)))):e._selectedIds=e._selectedIds.filter((e=>void 0!==t.dataItemById[e]))}_clearSelection(e){const t=this;if(0===t._selectedIds.length)return;const a=t.$.tableContainer.querySelector(".smart-table-select-all");Array.from(t.$.tableContainer.querySelectorAll(".smart-table-select-row")).forEach((e=>{e.parentElement.classList.contains("disable-select")||e.parentElement.setAttribute("aria-selected",!1),e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1)})),a&&(a.classList.remove("indeterminate","selected"),a.firstElementChild.setAttribute("aria-checked",!1)),t._selectedIds=[],e&&(t._updateState("selected"),t.$.fireEvent("change",{type:"programmatic"}))}_updateCellsWithFormulas(e){const t=this,a=t.formulas,l=t._cellsWithFormulas;if(a||e)for(let e in l){const a=/(.+):(.+)/.exec(e),l=t.columnByDataField[a[1]],i=t.rowById[a[2]];if(!l||!i)continue;const n=t.$.tableContainer.querySelector(`tr[row-id="${i.data.$.id}"]:not([unused]) td[data-field="${l.dataField}"]`);n&&t._setCellContent(n,t._formatCellValue(i,l,n),n.classList.contains("tree-cell"))}}_createVirtualDataRows(e){const t=this,a=t.rowDetailTemplate,l=t.selection,i=t.hasAttribute("hierarchy"),n=document.createDocumentFragment(),r=t.$.virtualizationContainer,o=t.$.tableContainer,s=t._rowHeight;t.isRendered&&(r.scrollWidth=0,r.scrollHeight=0,r.$.scrollViewerContainer.classList.remove("hscroll","vscroll"));const d=r.$.scrollViewerContainer.offsetHeight-o.firstElementChild.offsetHeight-(t.filtering&&t.filterRow?s:0)-(t.footerRow?o.lastElementChild.offsetHeight:0),c=d<5,u=t._getVirtualRecords(i,c),f=u.length;let m=i?2*d:d+3*s,h=s*f,p=0;t._rowsVirtual=u,t._rowsInDOM=[];for(let e=0;e<f;e++){const r=u[e],o=r.data;if(!r.detail){if(o.groupDataField)t._rowsInDOM.push(t._createGroupHeader(o,n));else{const e=t._createDataRow(r,n,{hierarchical:i,rowDetailTemplate:a,selection:l,virtualization:!0});t._rowsInDOM.push(e.row),e.detail&&(t._rowsInDOM.push(e.detail),p+=t._rowDetailHeight,m+=t._rowDetailHeight)}if(p+=s,!c&&p>m)break}}e.appendChild(n),t._updateState("expanded"),e.parentElement||t.$.tableContainer.insertBefore(e,t.$.tableContainer.querySelector("tfoot")),r.refresh(),a&&(h+=t._expandedRowDetailIds.length*(t._rowDetailHeight-s));let g=Math.max(0,h-d);g>0&&r.computedHorizontalScrollBarVisibility&&(g+=r.$.horizontalScrollBar.offsetHeight),r.$.scrollViewerContentContainer.style.top=0,r.$.verticalScrollBar.max=g,t._scrollHeight=h,t._start={view:0,data:0},!c&&t._rowsInDOM.length>0&&r.$.scrollViewerContentContainer.offsetHeight<r.$.scrollViewerContainer.offsetHeight&&t._rowsInDOM[t._rowsInDOM.length-1].classList.add("last-row"),t._fixFrozenHeaderFirefox(),t._focusEquivalentCell()}_getVirtualRecords(e,t){const a=this,l=e&&!t?a.rows.filter((e=>0===e.data.level||!a._isCollapsed(e.data))):a.rows;if(e||!a.rowDetailTemplate)return l;const i=[];return l.forEach((e=>{i.push(e),-1!==a._expandedRowDetailIds.indexOf(e.data.$.id)&&i.push({detail:!0,data:e.data})})),i}_onVerticalChange(e,t){const a=this;if(a._ignoreVerticalChange)return;const l=a.rows,i=a._rowHeight,n=a.$.virtualizationContainer;let r,o,s=e.detail.value;if(Smart.Utilities.Core.Browser.Firefox&&a.virtualization&&(n.$.scrollViewerContentContainer.style.top=null),a.setAttribute("ignore-detail-animation",""),a._rowsInDOM.length===l.length||0===n.$.verticalScrollBar.max){const e=Math.floor(s/i);return a._start={view:e,data:e},n.$.scrollViewerContentContainer.style.top=-s+"px",requestAnimationFrame((()=>a.removeAttribute("ignore-detail-animation"))),void a._fixFrozenHeaderFirefox()}if(a._expandedRowDetailIds.length>0){let e,t=0;r=1;for(let l=0;l<a._rowsVirtual.length;l++){const i=t;if(a._rowsVirtual[l].detail?t+=a._rowDetailHeight:t+=a._rowHeight,void 0===o&&s<=t){o=l,e=s-i;break}}n.computedVerticalScrollBarVisibility?s=e+a._rowHeight:r=0}else{for(s=s%(2*i)+i,s<i&&(s+=i);s+n.$.scrollViewerContainer.offsetHeight>a.$.tableContainer.offsetHeight;)s-=i;r=Math.floor(s/i),o=Math.floor(e.detail.value/i),r<0&&(o-=r,r=0)}n.$.scrollViewerContentContainer.style.top=-s+"px",a._updateVisibleRows(r,o,t||a._expandedRowDetailIds.length>0),a._fixFrozenHeaderFirefox(),requestAnimationFrame((()=>a.removeAttribute("ignore-detail-animation")))}_fixFrozenHeaderFirefox(){const e=this;e.virtualization&&e.$.virtualizationContainer&&e.$.virtualizationContainer.$.scrollViewerContentContainer&&(e._tableHeader.style.top=-parseFloat(e.$.virtualizationContainer.$.scrollViewerContentContainer.style.top)+"px"),Smart.Utilities.Core.Browser.Firefox&&e.virtualization}_focusEquivalentCell(e){const t=this,a=t._focusedCell;if(!e&&!a)return;let l;if(!e){if(!a.parentElement)return;e={rowId:a.parentElement.data.$.id,dataField:a.getAttribute("data-field")}}l=e.dataField?t.$.tableContainer.querySelector(`tr[row-id="${e.rowId}"]:not([unused]) td[data-field="${e.dataField}"]`):t.$.tableContainer.querySelector(`tr[row-id="${e.rowId}"]:not([unused]) td.group-header`),t._focusCell(l)}_detachCachedTemplates(){const e=this;e._cachedTemplates&&(delete e._cachedTemplates,e._tableCachedTemplates&&(e._tableCachedTemplates.remove(),delete e._tableCachedTemplates))}_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 a in e._cachedTemplates)t.appendChild(e._cachedTemplates[a]);e._tableCachedTemplates.appendChild(t)}}_updateVisibleRows(e,t,a){const l=this,i=t-e,n=l._rowsVirtual.length,r={hierarchical:l.hasAttribute("hierarchy"),selection:l.selection};let o;if(a=a&&(r.hierarchical||!!l.rowDetailTemplate),r.hierarchical&&!l.grouping&&(a=!0),l._sortColumns&&l._sortColumns.length>0&&(a=!0),l._focusedCell){const e=l._focusedCell.parentElement;e&&(o={rowId:e.data.$.id,dataField:l._focusedCell.getAttribute("data-field")})}for(let t=0;t<e;t++){const e=l._rowsInDOM[t];let n=i+t;n>=0&&(a||e.data.$.index!==n||e.data.detail)&&l._updateVisibleRow(e,n,r),e.setAttribute("unused",""),e.setAttribute("aria-hidden",!0),e.classList.remove("smart-table-row-detail")}for(let t=e;t<l._rowsInDOM.length;t++){const e=l._rowsInDOM[t],o=i+t;o<n?(e.removeAttribute("unused"),e.removeAttribute("aria-hidden"),(a||e.data.$.index!==o||e.data.parent)&&l._updateVisibleRow(e,o,r)):e.setAttribute("aria-hidden",!0)}l._start={view:e,data:t},l._focusEquivalentCell(o)}_updateVisibleRow(e,t,a){const l=this,i=l._columns.filter((e=>e.visible));if(!i.length)return;const n=l._rowsVirtual[t],r=n.data,o=r.$.id,s=Number(a.selection),d=!r.groupDataField&&!e.firstElementChild.classList.contains("group-header")&&!n.detail&&!e.classList.contains("smart-table-row-detail")&&e.childElementCount>1;if(e.className="",d){const t=e.attributes;for(;t.length>0;)e.removeAttribute(t[0].name)}else e.innerHTML="";if(r.groupDataField)l._createGroupHeader(r,void 0,e);else if(n.detail)l._createRowDetailOnDemand(e,n,r);else{e.setAttribute("aria-rowindex",r.$.index+1),l._processAndRenderSelection(r,e,a.hierarchical,d);for(let t=0;t<i.length;t++){const c=i[t];let u=d?e.children[t+s]:document.createElement("td"),f=!1;if(u&&(l.grouping&&!r.groupDataField||l.dataSource&&l.dataSource.groupBy&&l.dataSource.groupBy.length>0)&&u.removeAttribute("colspan"),!u){if(!d)continue;u=document.createElement("td"),f=!0,e.appendChild(u)}d&&(u.className=""),u.setAttribute("data-field",c.dataField),u.setAttribute("aria-colindex",t+1+s);let m,h=l._formatCellValue(n,c,u);if(f&&l._setCellContent(u,h,m),c.freeze&&u.classList.add("freeze-"+("far"===c.freeze?"far":"near")),c.responsivePriority&&u.classList.add("priority-"+c.responsivePriority),!1===c.allowEdit?(u.classList.add("no-edit"),u.setAttribute("aria-readonly",!0)):u.removeAttribute("aria-readonly"),0===t&&a.hierarchical){const e=l._areChildrenFiltered(r);r.leaf||(u.classList.add("tree-cell"),m=e),r.level&&(u.classList.add("outline-level-"+Math.min(r.level,10)),!r.leaf&&e||u.classList.add("tree-leaf"))}if(c.templateElement){if(f&&l.grouping){const e=c.templateElement+"",t=u;e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=e}else if(a.hierarchical&&l.grouping&&r.leaf){const e=c.templateElement+"",t=u;if((!t.firstElementChild||!(t.firstElementChild.hasAttribute("ng-version")||t.innerHTML.indexOf("ng-version")>=0))&&t.firstElementChild&&!t.firstElementChild.classList.contains(".smart-table-cell-template")){const a=t.innerHTML;e.substring(e.lastIndexOf("</"))!==a.substring(a.lastIndexOf("</"))&&(e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=e)}}if(m&&!u.querySelector(".hierarchy-arrow")){l._setCellContent(u,h,m);const e=u.children[0].children[1],t=c.templateElement+"";t.indexOf("{{value}}")>=0?e.innerHTML=t.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):e.innerHTML=t}else if(a.hierarchical&&!l.grouping&&r.leaf){const e=u;if(!e.firstElementChild||!(e.firstElementChild.hasAttribute("ng-version")||e.innerHTML.indexOf("ng-version")>=0)){l._setCellContent(u,h,!1);const t=c.templateElement+"";t.indexOf("{{value}}")>=0?e.innerHTML=t.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):e.innerHTML=t}}if(!d){const e=c.templateElement+"",t=m?u.children[0].children[1]:u;e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=e}let e=m?u.children[0].children[1].firstElementChild:u.firstElementChild;if(!e&&a.hierarchical){l._setCellContent(u,h,!1);const t=u,a=c.templateElement+"";a.indexOf("{{value}}")>=0?t.innerHTML=a.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=a,e=m?u.children[0].children[1].firstElementChild:u.firstElementChild}c.templateElementSettings?c.templateElementSettings(r[c.dataField],o,e):c.templateElement.indexOf("{{value}}")>=0&&(u.querySelector(".smart-table-cell-template").textContent=r[c.dataField])}else c.formatFunction,l._setCellContent(u,h,m);l.onCellRender&&l.onCellRender(r,c.dataField,r[c.dataField],u),l._applyConditionalFormattingToCell(u,c.dataField,r.$.index),d||e.appendChild(u)}e.data=r,e.setAttribute("row-id",o),-1!==l._disabledSelection.indexOf(o)&&(e.removeAttribute("aria-selected"),e.classList.add("disable-select"),a.selection&&e.firstElementChild.firstElementChild.setAttribute("aria-disabled",!0)),r.expanded?(-1===l._expandedIds.indexOf(o)&&l._expandedIds.push(o),e.setAttribute("aria-expanded",!0),e.classList.add("expanded")):!1===r.expanded&&e.setAttribute("aria-expanded",!1),r.level&&l._isCollapsed(r)&&(e.setAttribute("aria-hidden",!0),e.classList.add("collapsed","smart-hidden"))}}_createRowDetailOnDemand(e,t,a){const l=this,i=Number(l.selection)+l._columns.filter((e=>e.visible)).length;e.data=Object.assign(a,{detail:!0}),e.classList.add("smart-table-row-detail"),e.removeAttribute("aria-rowindex"),e.removeAttribute("row-id"),e.innerHTML=`<td colspan="${i}"><div class="smart-table-detail-container">${l._applyRowDetailTemplate(t)}</div></td>`}_hierarchyArrowClickHandlerVirtualization(e,t){const a=this,l=!a.grouping,i=a.$.tableContainer,n={nextRow:e.nextElementSibling,tbody:i.children[1]},r=e.data,o=[],s=[],d=Math.ceil((a.$.virtualizationContainer.$.scrollViewerContainer.offsetHeight-i.firstElementChild.offsetHeight)/a._rowHeight);function c(){0===o.length?function(){if(a._ignoreVerticalChange=!0,r.expanded=!r.expanded,l)r.expanded?(-1===a._expandedIds.indexOf(r.$.id)&&a._expandedIds.push(r.$.id),a.$.fireEvent("expand",{id:r.$.id,record:r})):(a._expandedIds=a._expandedIds.filter((e=>e!==r.$.id)),a.$.fireEvent("collapse",{id:r.$.id,record:r})),a._updateState("expanded");else if(!0!==t){const e=t=>{for(let a=0;a<t.length;a++){const l=t[a];if(l.$.id===r.$.id)return l;if(l.children){let t=e(l.children);if(t)return t}}return null},t=e(a.dataSource.boundHierarchy);t&&(t.expanded=r.expanded);let l=""+r.$.id;l=l.replace("Item","").replace(/_/gi,"."),r.expanded?a.$.fireEvent("group",{action:"expand",path:l,dataField:r.groupDataField,label:r.label}):a.$.fireEvent("group",{action:"collapse",path:l,dataField:r.groupDataField,label:r.label})}for(const e of s)e.remove();let e=a.$.virtualizationContainer.$.verticalScrollBar,i=a.$.virtualizationContainer.$.verticalScrollBar.value;a._refreshDataRows(),i=Math.min(e.max,i),e.value=i,delete a._ignoreVerticalChange,a._onVerticalChange({detail:{value:i}},!0)}():requestAnimationFrame((()=>c()))}function u(e){for(const t of e){if(s.length>=d)break;!1!==t.$.filtered&&(s.push(a._expandSingleChildRowVirtualization(t,n,o)),t.children&&t.expanded&&u(t.children))}}r.expanded?function e(t){t.forEach((t=>{a._collapseSingleChildRow(i.querySelector(`tr[row-id="${t.$.id}"]:not([unused])`),o),t.children&&e(t.children)}))}(r.children):requestAnimationFrame((()=>u(r.children))),e.setAttribute("aria-expanded",!r.expanded),e.classList.toggle("expanded",!r.expanded),requestAnimationFrame((()=>c()))}_expandSingleChildRowVirtualization(e,t,a){const l=this,i=l.rowById[e.$.id],n=document.createDocumentFragment();let r;if(i){if(r=i.data.groupDataField?l._createGroupHeader(i.data,n):l._createDataRow(i,n,{virtualization:!0,hierarchical:!0,selection:l.selection}).row,-1===[...t.tbody.children].indexOf(t.nextRow)){let a=!1;e.children&&0===e.children.length&&(a=!0),e.children||(a=!0),l._rowsInDOM&&l._rowsInDOM.length===l.rows.length&&(a=!0),a||t.tbody.appendChild(n)}else t.tbody.insertBefore(n,t.nextRow);return l._expandSingleChildRow(r,a),r}}_getFractionOfMax(){const e=this;return e.isRendered&&e.virtualization?{vertical:function(){const t=e.$.virtualizationContainer.$.verticalScrollBar,a=t.max;return 0===a?0:t.value/a}(),horizontal:function(){const t=e.$.virtualizationContainer.$.horizontalScrollBar,a=t.max;return 0===a?0:t.value/a}()}:null}_setFractionOfMax(e){if(!this.virtualization||null===e)return;const t=this.$.virtualizationContainer,a=t.$.verticalScrollBar,l=t.$.horizontalScrollBar;a.value=a.max*e.vertical,l.value=l.max*e.horizontal}_refreshHorizontalScrollbar(){const e=this.$.virtualizationContainer;if(!e)return;const t=e.$.scrollViewerContainer,a=e.$.horizontalScrollBar,l=e.$.verticalScrollBar,i=e.$.scrollViewerContentContainer.offsetWidth-t.offsetWidth;let n,r;i>0&&!t.classList.contains("hscroll")?(t.classList.add("hscroll"),n="add"):i<=0&&t.classList.contains("hscroll")&&(r=a.offsetHeight,t.classList.remove("hscroll"),n="subtract"),e.scrollWidth!==i&&(e.scrollWidth=i),e.computedVerticalScrollBarVisibility&&("add"===n?(r=a.offsetHeight,l.max+=r):"subtract"===n&&(l.max-=r))}_scrollToVirtualization(e,t){const a=this;if(!a.virtualization)return;const l=a.$.virtualizationContainer,i=l.$.scrollViewerContentContainer,n=l.$.verticalScrollBar,r=l.$.horizontalScrollBar,o=a.$.tableContainer,s=i.offsetLeft,d=i.offsetTop,c=n.value;let u,f;switch(t&&(u=t.offsetLeft,f=t.offsetTop),e){case"nextArrow":{if(!t||!l.computedHorizontalScrollBarVisibility)return;const e=s+u+t.offsetWidth-l.offsetWidth;e>0&&(r.value+=e+n.offsetWidth);break}case"prevArrow":if(!t||!l.computedHorizontalScrollBarVisibility||u>=-s)return;r.value=u-s-r.value;break;case"ArrowUp":{const e=o.firstElementChild.offsetHeight-d-f;if(e<=0)return;let t;if(a._focusedCell){const e=a._focusedCell.parentElement;e&&(t={rowId:e.data.$.id,dataField:a._focusedCell.getAttribute("data-field")})}const l=Math.max(0,c-e);l!==c&&(n.value=l,a._focusEquivalentCell(t));break}case"ArrowDown":{const e=d+f+t.offsetHeight-l.offsetHeight;if(e<=0)return;const a=Math.min(n.max,c+e);a!==c&&(n.value=a);break}case"Home":case"End":if(!l.computedHorizontalScrollBarVisibility)return;r.value="Home"===e?0:r.max}}_getExpandedGroups(e){const t=this,a=[];return e?(function e(l){l.forEach((l=>{l.expanded&&a.push({groupDataField:l.groupDataField,label:l.label,ancestorSignature:t._getGroupAncestorSignature(l)}),l.children&&l.children.length>0&&!1===l.children[0].leaf&&e(l.children)}))}(e),a):[]}_getGroupAncestorSignature(e){const t=[];let a=e.parent;for(;a;)t.push({groupDataField:a.groupDataField,label:a.label}),a=a.parent;return JSON.stringify(t)}_restoreExpandedGroups(e){if(0===e.length)return;const t=this,a=t.dataSource,l=[];!function a(i){i&&i.forEach((i=>{if(e.some((e=>e.groupDataField===i.groupDataField&&e.label===i.label&&e.ancestorSignature===t._getGroupAncestorSignature(i)))){let e=i.$.id;"string"==typeof e&&(e=e.replace("Item","").replace(/_/g,".")),l.push(e)}i.children&&i.children.length>0&&!1===i.children[0].leaf&&a(i.children)}))}(a.boundHierarchy);const i=t._doNotFireEvent;t._doNotFireEvent=!0,l.forEach((e=>t.expandGroup(e))),t._doNotFireEvent=i}});
867
867
 
868
868
  /***/ }),
869
869
 
870
870
  /***/ 8466:
871
871
  /***/ (() => {
872
872
 
873
- Smart("smart-window",class extends Smart.ContentElement{static get properties(){return{collapsed:{value:!1,type:"boolean"},closeOnMaskClick:{value:!1,type:"boolean"},disableSnap:{value:!1,type:"boolean"},footerPosition:{value:"bottom",allowedValues:["bottom","none"],type:"string"},footerTemplate:{value:null,type:"any"},headerButtons:{value:["close","maximize","minimize"],type:"array"},headerPosition:{value:"top",allowedValues:["top","bottom","left","right","none"],type:"string"},headerTemplate:{value:null,type:"any"},label:{value:"",type:"string"},liveResize:{value:!1,type:"boolean"},maximized:{value:!1,type:"boolean"},modal:{value:!1,type:"boolean"},minimized:{value:!1,type:"boolean"},opened:{value:!1,type:"boolean"},pinned:{value:!1,type:"boolean"},resizeIndicator:{value:!1,type:"boolean"},resizeMode:{allowedValues:["none","horizontal","vertical","both","top","bottom","left","right"],value:"none",type:"string"},windowParent:{value:null,type:"any"}}}static get listeners(){return{"document.dragstart":"_dragStartHandler","document.focusin":"_documentFocusInEventHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","document.wheel":"_mouseWheelHandler","document.selectstart":"_documentSelectStartHandler",down:"_downHandler",focus:"_focusHandler",blur:"_focusHandler",move:"_moveHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler"}}get hasStyleObserver(){return!1}static get styleUrls(){return["smart.button.css","smart.window.css"]}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header" role="presentation">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container" role="presentation">\n <button id="pinButton" class="smart-button smart-element smart-pin-button" aria-label="Pin"></button>\n <button id="collapseButton" class="smart-button smart-element smart-collapse-button" aria-label="Collapse"></button>\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button"aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content" inner-h-t-m-l="[[innerHTML]]"><content></content></div>\n <div id="footer" class="smart-footer"></div>\n </div>\n </div>'}propertyChangedHandler(e,t,a){const i=this;switch(e){case"collapsed":a?i.collapse(!0):i.expand(!0);break;case"disabled":case"unfocusable":i._setFocusable();break;case"headerTemplate":case"footerTemplate":i._applyLayoutTemplate(i.$[e.split(/[T]/)[0]],a);break;case"headerButtons":i._setHeaderButtons();break;case"headerPosition":{const e=i.minimized;i._preventEventFiring=!0,i.restore(),delete i._preventEventFiring,e&&i.minimize();break}case"label":i.$.header.innerHTML=i.label;break;case"maximized":a?i.maximize(!0):i.restore(e);break;case"modal":i._setModal(),i.setAttribute("aria-modal",a);break;case"minimized":a?i.minimize(!0):i.restore(e);break;case"opened":a?i.open(!0):i.close(!0);break;case"resizeMode":i.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right");break;case"windowParent":i._setElementParent(a);break;default:super.propertyChangedHandler(e,t,a)}}ready(){super.ready(),this._windowParent={initialParent:this.parentElement}}render(){const e=this,t=e.animation;e.$.header.id||(e.$.header.id=e.id+"Header"),e.$.content.id||(e.$.content.id=e.id+"Content"),e.opened||(e.animation="none"),e._windowParent={initialParent:e.parentElement},e.$.addClass("smart-window"),e._createElement(),e._setElementParent(e.windowParent),e._setHeaderButtons(),e.headerTemplate&&e._applyLayoutTemplate(e.$.header,e.headerTemplate),e.footerTemplate&&e._applyLayoutTemplate(e.$.footer,e.footerTemplate),e.opened?e.open():e.close(),e.maximized&&e.maximize(!0),e.minimized&&e.minimize(!0),e.collapsed&&e.collapse(!0),e.pinned?e.pin():e.unpin(),e._setFocusable(),e.animation=t,e.setAttribute("aria-modal",e.modal),e.setAttribute("aria-labelledby",e.$.header.id),e._setupDismissTargets(),super.render()}refresh(){const e=this;e.headerTemplate&&e._applyLayoutTemplate(e.$.header,e.headerTemplate),e.footerTemplate&&e._applyLayoutTemplate(e.$.footer,e.footerTemplate),e.opened?e.open():e.close(),e.maximized&&e.maximize(!0),e.minimized&&e.minimize(!0),e.collapsed&&e.collapse(!0),e.pinned?e.pin():e.unpin()}static get requires(){return{"Smart.Button":"smart.button.js"}}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)e.removeAttribute("tabindex");else{let t=e.tabIndex>0?e.tabIndex:0;e.setAttribute("tabindex",t)}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?t.$.content.appendChild(e):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}collapse(e){const t=this;!e&&t.collapsed||(t.collapsed=!0,t.$.fireEvent("collapse"),"left"===t.headerPosition||"right"===t.headerPosition?t.style.width="":t.style.height="")}close(e){const t=this;if(e||!t.$.hasClass("smart-visibility-hidden")){if(t.isCompleted){if(t.$.fireEvent("closing").defaultPrevented)return;t.$.addClass("smart-visibility-hidden"),t.opened=!1,t.isRendered&&t.$.fireEvent("close")}else t.$.addClass("smart-visibility-hidden"),t.opened=!1;t._setModal(),t.removeAttribute("ontop")}}attached(){super.attached();const e=this;e.isRendered,e._windowParent.parent&&e._windowParent.parent!==e.getShadowRootOrBody()&&e._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&"static"===window.getComputedStyle(e._windowParent.parent).getPropertyValue("position")&&(e._windowParent.parent.style.position="relative"),e.opened&&e._modal&&e.parentElement.insertBefore(e._modal,e)}bringToFront(){const e=this;if(!e.parentElement)return;const t=e.parentElement.closest(".smart-window");if(t)return void t.bringToFront();const a=document.body.getElementsByClassName("smart-window");let i=[];for(let e=0;e<a.length;e++){const t=a[e];t.removeAttribute("ontop"),t.opened&&i.push(t)}1===i.length&&i[0]===e||e.setAttribute("ontop","")}clear(){const e=this;e.isCompleted&&"Smart-WINDOW"===e.nodeName&&(e.innerHTML=e.$.content.innerHTML="")}detached(){super.detached();const e=this;e._windowParent.parent&&!e._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&(e._windowParent.parent.style.position=""),e._modal&&e._modal.parentElement&&e._modal.parentElement.removeChild(e._modal),e._resizeDummy&&e._resizeDummy.parentElement&&e._handleWindowResizeDummy(),e._refreshMinimizedWindowsPosition()}expand(e){const t=this;(e||t.collapsed)&&(t.collapsed=!1,t.$.fireEvent("expand"),t.maximized?"left"===t.headerPosition||"right"===t.headerPosition?t.style.width=Math.max(t._windowParent.scrollElement.scrollWidth,t._windowParent.element.clientWidth)-t._windowParent.borderWidth+"px":t.style.height=Math.max(t._windowParent.scrollElement.scrollHeight,t._windowParent.element.clientHeight)-t._windowParent.borderWidth+"px":"left"===t.headerPosition||"right"===t.headerPosition?t.style.width=t.className.indexOf("smart-window-snapped-")<0&&t._dragDetails?t._dragDetails.width+"px":"":t.style.height=t.className.indexOf("smart-window-snapped-")<0&&t._dragDetails?t._dragDetails.height+"px":"")}maximize(e){const t=this;if(!e&&t.maximized)return;t.minimized&&t._restoreFromMinimization(e),t._setDragDetails("minimize"),"none"!==t.resizeMode&&t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right"),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&t.classList.remove("smart-window-snapped-"+t._snapDummy._position),t.maximized=!0,t.$.fireEvent("maximize"),t.style.left=t.style.top=0,t.style.maxWidth=t.style.maxHeight="none";const a=t._windowParent.scrollElement.scrollHeight,i=t._windowParent.scrollElement.scrollWidth,n=t._windowParent.element.clientHeight,o=t._windowParent.element.clientWidth,s=Math.max(a,n),r=Math.max(i,o);"top"===t.headerPosition||"bottom"===t.headerPosition?(t.style.width=i>o?r-t._windowParent.borderWidth+"px":"100%",t.collapsed||(t.style.height=a>n?s-t._windowParent.borderWidth+"px":"100%")):(t.collapsed||(t.style.width=i>o?r-t._windowParent.borderWidth+"px":"100%"),t.style.height=a>n?s-t._windowParent.borderWidth+"px":"100%"),"100%"!==t.style.height&&t.addEventListener("transitionend",(function e(){if(!t.maximized||!t.hasAnimation)return;const a=t._windowParent.scrollElement.scrollHeight,i=t._windowParent.element.clientHeight,n=Math.max(a,i);("top"===t.headerPosition||"bottom"===t.headerPosition)&&t.collapsed||(t.style.height=a>i?n-t._windowParent.borderWidth+"px":"100%"),t.removeEventListener("transitionend",e)}))}minimize(e){const t=this;if(!e&&t.minimized)return;t.maximized&&(t._preventEventFiring=!0,t.restore(),delete t._preventEventFiring),t._setDragDetails(),t.minimized=!0,t.$.fireEvent("minimize"),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&(t.$.removeClass("smart-window-snapped-"+t._snapDummy._position),t.style.right=t.style.top=t.style.left="");const a=t._getAllMinimizedWindows(t._windowParent.element);if(a.length>0){const e=a[a.length-1];t.style.left=(e.offsetLeft+e.offsetWidth+t._dragDetails.minWidth+10>t._windowParent.element.clientWidth?e.offsetLeft:e.offsetLeft+e.offsetWidth+5)+"px",t.style.top=e.offsetTop+"px"}else t.style.left="5px",t.style.top=t._windowParent.element.clientHeight+t._windowParent.scrollElement.scrollTop-t.$.headerSection.offsetHeight-5+"px";t.style.width="",t.style.height=t.$.headerSection.offsetHeight+"px"}_createElement(){this.setAttribute("role","dialog")}removeChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?t.$.content.removeChild(e):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}restore(e){const t=this;if("maximized"===e||t.maximized?(t.maximized=!1,t.style.width=t.style.height=t.style.top=t.style.left=""):("minimized"===e||t.minimized)&&t._restoreFromMinimization(e),t._preventEventFiring||t.$.fireEvent("restore"),t.style.maxWidth=t.style.maxHeight="",t._dragDetails){if(t.style.left=Math.max(0,Math.min(t._dragDetails.windowX,t._windowParent.element.clientWidth-t._dragDetails.width))+"px",t.style.top=Math.max(0,Math.min(t._dragDetails.windowY,t._windowParent.scrollElement.scrollHeight-t._dragDetails.height))+"px",t.collapsed)return void("top"===t.headerPosition||"bottom"===t.headerPosition?t.style.width=t._dragDetails.width+"px":t.style.height=t._dragDetails.height+"px");t._dragDetails.resized&&(t.style.width=t._dragDetails.width+"px",t.style.height=t._dragDetails.height+"px")}}toggle(){const e=this;e.opened?e.close():e.open()}openModal(){this.modal=!0,this.open()}open(e){const t=this;if(e||t.$.hasClass("smart-visibility-hidden")){if(t.isCompleted){if(t.$.fireEvent("opening").defaultPrevented)return;t.$.removeClass("smart-visibility-hidden"),t.opened=!0,t.$.fireEvent("open")}else t.$.removeClass("smart-visibility-hidden"),t.opened=!0;t.bringToFront(),t._setModal(),t._handleActiveState(),t.hasAnimation?t.addEventListener("transitionend",a):a()}function a(e){if(!t.hasAnimation||e&&e.target===t){if(t.removeEventListener("transitionend",a),t._onOpenCallback)return void t._onOpenCallback();t.focus()}}}_setupDismissTargets(){const e=this;if(e.querySelector('[data-dismiss="modal"]')){const t=e.querySelectorAll('[data-dismiss="modal"]'),a=()=>{e.close()};for(let e=0;e<t.length;e++)t[e].removeEventListener("click",a,null),t[e].addEventListener("click",a)}}pin(){this.pinned=!0}unpin(){this.pinned=!1}_applyLayoutTemplate(e,t){const a=this;if(!t)return e.innerHTML="",void(e===a.$.header&&a.label&&(e.innerHTML=a.label));"content"in document.createElement("template")?(t instanceof HTMLTemplateElement||(t=document.getElementById(t)),null!==t&&"content"in t?(e.innerHTML="",e.appendChild(document.importNode(t.content,!0))):a.error(a.localize("invalidTemplate",{elementType:a.nodeName.toLowerCase(),property:e===a.$.footer?"footerTemplate":"headerTemplate"}))):a.error(a.localize("htmlTemplateNotSuported",{elementType:a.nodeName.toLowerCase()}))}_cancelDragging(e){const t=this;if(t._dragDetails&&t._dragDetails.started&&"drag"===t._dragDetails.type){if(!e){const a=t.getBoundingClientRect();e={pageX:a.left,pageY:a.top}}t.$.fireEvent("dragEnd",{left:e.pageX,top:e.pageY}),t.removeAttribute("dragged"),t._dragDetails.started=!1,delete t._mouseManipulation}}_documentFocusInEventHandler(e){const t=this;t._changingFocus&&(t.contains(e.target)||t.contains(e.composedPath()[0])||t.focus(),delete t._changingFocus)}_downHandler(e){const t=this;let a=Smart.Utilities.Core.isMobile?document.elementFromPoint(e.pageX-window.pageXOffset,e.pageY-window.pageYOffset):e.originalEvent.target;if((t.shadowRoot||t.isInShadowDOM)&&(a=e.originalEvent.composedPath()[0]),e.stopPropagation(),t.disabled||!Smart.Utilities.Core.isMobile&&1!==e.which)return;if(t._tabsWindow&&(t._tabsWindow._isAutoHideWindowClicked=!0),t.hasAttribute("ontop")||t.bringToFront(),a.closest&&a.closest(".smart-buttons-container")===t.$.buttonsContainer){if(t._buttonPressed=a.closest(".smart-button"),t._buttonPressed)return}else if(a.getRootNode()&&a.getRootNode().host&&(t._buttonPressed=a.getRootNode().host,t._buttonPressed.closest(".smart-buttons-container")===t.$.buttonsContainer))return;t._isWindowContentClicked=a.closest(".smart-content");let i=t.closest("smart-docking-layout");if(t.isInShadowDOM&&!i){let e=t.getRootNode().host;for(;e&&(i=e.closest("smart-docking-layout"),!i)&&e.getRootNode();)e=e.getRootNode().host}if(!(t instanceof Smart.TabsWindow&&i&&i.disabled)){if(t._handleActiveState(),!(t instanceof Smart.TabsWindow&&i))return a.closest(".smart-header-section")===t.$.headerSection&&(void 0===t._dblClickDetails&&(t._dblClickDetails={clicks:0}),clearTimeout(t._dblClickDetails.timeOut),t._dblClickDetails.clicks++,t._dblClickDetails.timeOut=setTimeout((function(){t._dblClickDetails&&(t._dblClickDetails.clicks=0)}),300),2===t._dblClickDetails.clicks)?(t._headerDblCickHandler(e),void(t._dblClickDetails.clicks=0)):void(t.maximized||(Smart.Utilities.Core.isMobile&&t._moveHandler(e),!t.pinned&&!t.minimized&&t.$.container.className.indexOf("smart-window-resizing")<0&&(a=a.closest(".smart-header-section"),a&&a===t.$.headerSection&&(t._mouseManipulation=!0,t._setDragDetails("drag",e))),"none"!==t.resizeMode&&t.$.container.className.indexOf("smart-window-resizing")>-1&&(t._mouseManipulation=!0,t._setDragDetails("resize",e))));t.$.hasClass("smart-docking-layout-auto-hide-window")&&(Smart.Utilities.Core.isMobile&&t._moveHandler(e),"none"!==t.resizeMode&&t.$.container.className.indexOf("smart-window-resizing")>-1&&(t._mouseManipulation=!0,t._setDragDetails("resize",e)))}}_documentMoveHandler(e){const t=this;!t._dragDetails||!t._dragDetails.started||t.minimized||!t._mouseManipulation||Math.abs(e.pageX-t._dragDetails.x)<=5&&Math.abs(e.pageY-t._dragDetails.y)<=5||(t.hasAttribute("dragged")||t.hasAttribute("resized")||t.$.fireEvent(t._dragDetails.type+"Start",{left:e.pageX,top:e.pageY,width:t.offsetWidth,height:t.offsetHeight}),e.stopPropagation(),"drag"!==t._dragDetails.type||t.pinned?(t._dragDetails.resized=!0,t._resize(t._dragDetails.side,e),t._dragDetails.x=Math.max(t._windowParent.offsetLeft+t._dragDetails.left,Math.min(t._windowParent.offsetLeft+t._dragDetails.left+(t._dragDetails.side.toLowerCase().indexOf("left")>-1?0:t._dragDetails.newWidth),e.pageX)),t._dragDetails.y=Math.max(t._windowParent.offsetTop+t._dragDetails.top,Math.min(t._windowParent.offsetTop+t._dragDetails.top+(t._dragDetails.side.toLowerCase().indexOf("top")>-1?0:t._dragDetails.newHeight),e.pageY))):(t.setAttribute("dragged",""),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&(t.$.removeClass("smart-window-snapped-"+t._snapDummy._position),t.style.right=t.style.top=t.style.left="",t.collapsed||(t.style.height=t._dragDetails.height+"px",t.style.width=t._dragDetails.width+"px")),t._drag(e,"both"),t._dragDetails.x=Math.max(t._windowParent.offsetLeft+t._dragDetails.offsetX-t._windowParent.scrollElement.scrollLeft,Math.min(t._windowParent.offsetLeft+t._windowParent.element.offsetWidth-(t._windowParent.element.offsetWidth-t.offsetLeft)+t._dragDetails.offsetX,e.pageX)),t._dragDetails.y=Math.max(t._windowParent.offsetTop+t._dragDetails.offsetY-t._windowParent.scrollElement.scrollTop,Math.min(t._windowParent.offsetTop+t._windowParent.element.offsetHeight-(t._windowParent.element.offsetHeight-t.offsetTop)+t._dragDetails.offsetY,e.pageY)),e.pageX>=t._windowParent.offsetLeft+t._windowParent.scrollElement.scrollWidth-1?t._handleSnapping("right"):e.pageY<=t._windowParent.offsetTop?t._handleSnapping("top"):e.pageX<=t._windowParent.offsetLeft?t._handleSnapping("left"):t._handleSnapping()))}_documentUpHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(t.disabled)return t.removeAttribute("active"),delete t._buttonPressed,void delete t._isWindowContentClicked;if(t._dragDetails&&t._dragDetails.started&&(t.hasAttribute("resized")&&(t.$.fireEvent(t._dragDetails.type+"End",{left:e.pageX,top:e.pageY,width:t._dragDetails.newWidth,height:t._dragDetails.newHeight}),t.removeAttribute("resized"),t._handleWindowResizeDummy(),t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right")),setTimeout((function(){t.$.removeClass("no-transition")}),20),t.hasAttribute("dragged")&&(t.$.fireEvent(t._dragDetails.type+"End",{left:e.pageX,top:e.pageY}),t.removeAttribute("dragged")),t._dragDetails.started=!1,delete t._mouseManipulation),t._snapDummy&&!t._snapDummy.classList.contains("smart-visibility-hidden")){switch(t._snapDummy._position){case"left":case"top":t.style.left=t.style.top="0",t.style.right="auto";break;case"right":t.style.left="auto",t.style.top=t.style.right="0"}t.style.width="top"===t._snapDummy._position?"100%":"50%",t.style.height="100%",t.$.addClass("smart-window-snapped-"+t._snapDummy._position),t._handleSnapping()}t._modal&&a===t._modal&&!t._isWindowContentClicked&&(t.closeOnMaskClick?t.close():t.focus()),t._isWindowButton(a)&&t.focus(),delete t._isWindowContentClicked,delete t._buttonPressed;const i=t.shadowRoot&&t._windowParent.element&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;if(!t.hasAttribute("active")||i===t)return;if(!a.closest)return;let n=a.closest(".smart-window");for(;n&&n!==t;)n=n.parentElement,n&&(n=n.closest(".smart-window"));t.opened&&n!==t&&t.removeAttribute("active")}_documentSelectStartHandler(e){this._dragDetails&&this._dragDetails.started&&e.preventDefault()}_drag(e,t){const a=this;if(!e||a.pinned||a.maximized)return;let i,n;a._dragDetails&&a._dragDetails.started||a._setDragDetails("drag",e),a.$.addClass("no-transition"),"object"==typeof e?(i=e.pageX-a._dragDetails.x,n=e.pageY-a._dragDetails.y):i=n=e;const o=Math.max(a._windowParent.element.clientHeight,a._windowParent.scrollElement.scrollHeight),s=Math.max(a._windowParent.element.clientWidth,a._windowParent.scrollElement.scrollWidth);switch(t){case"horizontal":a._dragDetails.windowX=Math.max(0,Math.min(a._dragDetails.windowX+i,s-a.offsetWidth)),a.style.left=a._dragDetails.windowX+"px";break;case"vertical":a._dragDetails.windowY=Math.max(0,Math.min(a._dragDetails.windowY+n,o-a.offsetHeight)),a.style.top=a._dragDetails.windowY+"px";break;case"both":a._dragDetails.windowX=Math.max(0,Math.min(a._dragDetails.windowX+i,s-a.offsetWidth)),a._dragDetails.windowY=Math.max(0,Math.min(a._dragDetails.windowY+n,o-a.offsetHeight)),a.style.left=a._dragDetails.windowX+"px",a.style.top=a._dragDetails.windowY+"px"}a._dragDetails.top=a.offsetTop,a._dragDetails.left=a.offsetLeft}_dragStartHandler(e){this._dragDetails&&this._dragDetails.started&&e.preventDefault()}_focusHandler(e){const t=this;"focus"===e.type?(t.setAttribute("focus",""),t.bringToFront()):t._buttonPressed||(t.removeAttribute("focus"),t._dragDetails&&t._dragDetails.started&&t._handleWindowResizeDummy())}_getAllMinimizedWindows(e){const t=this;let a=[];e||(e=t._windowParent.element);const i=e.querySelectorAll("smart-window");for(let e=0;e<i.length;e++)i[e]!==t&&i[e].hasAttribute("minimized")&&a.push(i[e]);return a.sort((function(e,t){let a=e.getBoundingClientRect(),i=t.getBoundingClientRect();return a.right-i.right})),a}_handleSnapping(e){const t=this;e?t.disableSnap||t.collapsed||(t._snapDummy||(t._snapDummy=document.createElement("div"),t._snapDummy.addEventListener("transitionend",(function(){t._snapDummy.classList.contains("smart-visibility-hidden")&&t._snapDummy.parentElement&&t._snapDummy.parentElement.removeChild(t._snapDummy)}))),t._snapDummy.className="smart-window-snap-"+e+"-feedback",t._snapDummy._position=e,t._snapDummy.parentElement||t._windowParent.element.appendChild(t._snapDummy)):t._snapDummy&&t._snapDummy.parentElement&&t._snapDummy.classList.add("smart-visibility-hidden")}_headerDblCickHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;a!==t.$.headerSection&&a!==t.$.header||t.$.maximizeButton&&0===t.$.maximizeButton.offsetHeight||(t.maximized?t.restore():t.maximize())}_isWindowButton(e){const t=this;for(;e&&(e.closest&&e.closest(".smart-buttons-container"))!==t.$.buttonsContainer;)e=e.getRootNode().host;if(!e)return;const a=/smart-(\w+[-]*\w*)-button/gi;if((e=e.closest(".smart-button"))&&e===t._buttonPressed)switch(e){case t.$.closeButton:return t.close(),!0;case t.$.collapseButton:return t.collapsed?t.expand():t.collapse(),!0;case t.$.maximizeButton:return t.maximized?t.restore():t.maximize(),!0;case t.$.minimizeButton:return t.minimized?t.restore():t.minimize(),!0;case t.$.pinButton:return t.pinned?t.unpin():t.pin(),!0;default:if(!a.test(e.className))return;return t.$.fireEvent(Smart.Utilities.Core.toCamelCase(e.className.match(a).toString().replace("smart-","").replace("-button","")),{button:e}),!0}}_keyDownHandler(e){const t=this;if(delete t._changingFocus,t.disabled||(t.hasAttribute("dragged")||t.hasAttribute("resized"))&&t._mouseManipulation)return;const a="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,i=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":{if(t.minimized||i!==t)return;let n=e.key.indexOf("Right")>-1||e.key.indexOf("Left")>-1;e.preventDefault();const o=(t.isInShadowDOM?t.getRootNode().host:t).closest("smart-docking-layout");if(!n&&e.altKey&&!(t instanceof Smart.TabsWindow&&o))return void("ArrowUp"===e.key?t.maximize():t.restore());if(t.maximized)return;if(t.$.addClass("no-transition"),e.ctrlKey&&"none"!==t.resizeMode&&!t.collapsed)return n=-1===["horizontal","vertical","both"].indexOf(t.resizeMode)?t.resizeMode:n?"right":"bottom",t.hasAttribute("dragged")&&t._cancelDragging(e),t.hasAttribute("resized")||t.$.fireEvent("resizeStart",{position:{x:e.pageX,y:e.pageY}}),void t._resize(n,a);t.pinned||(t.hasAttribute("dragged")||(t.setAttribute("dragged",""),t.$.fireEvent("dragStart",{left:e.pageX,top:e.pageY})),t._drag(a,n?"horizontal":"vertical")),t.$.removeClass("no-transition");break}case"Escape":t.headerButtons.indexOf("close")>-1&&t.close();break;case"p":e.altKey&&t.headerButtons.indexOf("pin")>-1&&(t.pinned?t.unpin():t.pin());break;case"c":e.altKey&&t.headerButtons.indexOf("collapse")>-1&&(t.collapsed?t.expand():t.collapse());break;case"m":e.altKey&&t.headerButtons.indexOf("minimize")>-1&&(t.minimized?t.restore():t.minimize());break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}}_keyUpHandler(e){const t=this;if(e.key){if("Control"===e.key&&t._dragDetails&&t.hasAttribute("resized")&&!t._mouseManipulation){if(!t._dragDetails.started)return;"drag"!==t._dragDetails.type&&(t.removeAttribute("resized"),t.$.fireEvent("resizeEnd",{left:e.pageX,top:e.pageY,width:t._dragDetails.newWidth,height:t._dragDetails.newHeight}),t._handleWindowResizeDummy()),t._dragDetails.started=!1}e.key.indexOf("Arrow")>-1&&t.hasAttribute("dragged")&&!t._mouseManipulation&&t._cancelDragging(e)}}_mouseWheelHandler(e){const t=this;!t.disabled&&t._dragDetails&&t._dragDetails.started&&(e.deltaY<0&&t._windowParent.scrollElement.scrollTop+e.deltaY<=0?t.style.top=Math.max(0,t._dragDetails.windowY)+"px":e.deltaY>0&&(t._dragDetails.windowY+t.offsetHeight+e.deltaY>=t._windowParent.scrollElement.scrollHeight||t._windowParent.scrollElement.scrollTop+t._windowParent.element.clientHeight===t._windowParent.scrollElement.scrollHeight)||("drag"===t._dragDetails.type?(t._dragDetails.windowY+=e.deltaY,t.style.top=t._dragDetails.windowY+"px"):(t._dragDetails.height+=e.deltaY,t.style.height=t._dragDetails.height+"px")))}_moveHandler(e){const t=this;if(!(t.disabled||t.collapsed||t.maximized||t.minimized||(Smart.Utilities.Core.isMobile&&navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&t.hasAttribute("dragged")&&e.originalEvent.preventDefault(),t._mouseManipulation||(t.$.container.className.indexOf("smart-window-resizing")>-1&&t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right"),"none"===t.resizeMode)))){const a=t.getBoundingClientRect(),i=e.clientY<a.top+10,n=e.clientY>a.bottom-10,o=e.clientX>a.right-10,s=e.clientX<a.left+10;switch(t.resizeMode){case"none":break;case"both":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-bottom-right"));if(s||o)return i?void t.$.container.classList.add("smart-window-resizing-top-"+(s?"left":"right")):n?void t.$.container.classList.add("smart-window-resizing-bottom-"+(s?"left":"right")):void t.$.container.classList.add("smart-window-resizing-"+(s?"left":"right"));if(i||n){if(o)return void t.$.container.classList.add("smart-window-resizing-"+(i?"top-right":"bottom-right"));if(s)return void t.$.container.classList.add("smart-window-resizing-"+(i?"top-left":"bottom-left"));t.$.container.classList.add("smart-window-resizing-"+(i?"top":"bottom"))}break;case"horizontal":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-right"));if(s)return void t.$.container.classList.add("smart-window-resizing-left");o&&t.$.container.classList.add("smart-window-resizing-right");break;case"vertical":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-bottom"));if(i)return void t.$.container.classList.add("smart-window-resizing-top");n&&t.$.container.classList.add("smart-window-resizing-bottom");break;case"top":if(i){if(t.resizeIndicator&&!s)return;t.$.container.classList.add("smart-window-resizing-top")}break;case"bottom":if(n){if(t.resizeIndicator&&!o)return;t.$.container.classList.add("smart-window-resizing-bottom")}break;case"left":if(s){if(t.resizeIndicator&&!i)return;t.$.container.classList.add("smart-window-resizing-left")}break;case"right":if(o){if(t.resizeIndicator&&!n)return;t.$.container.classList.add("smart-window-resizing-right")}}}}_handleActiveState(){const e=this,t=document.querySelectorAll(".smart-window");for(let a=0;a<t.length;a++)t[a].contains(e)||e.contains(t[a])||(t[a].removeAttribute("active"),t[a].removeAttribute("focus"));e.setAttribute("active","")}_handleWindowResizeDummy(){const e=this;if(e._resizeDummy||(e._resizeDummy=document.createElement("div"),e._resizeDummy.classList.add("smart-window-resize-feedback")),!e.hasAttribute("resized"))return e._resizeDummy&&e._resizeDummy.remove(),void(!e.liveResize&&"resize"===e._dragDetails.type&&e._dragDetails.started&&(e.style.top=e._dragDetails.top+"px",e.style.left=e._dragDetails.left+"px",e.style.width=e._dragDetails.newWidth+"px",e.style.height=e._dragDetails.newHeight+"px"));e._resizeDummy.parentElement||e._resizeDummy.getRootNode().host||(e._resizeDummy.style.width=e.offsetWidth+"px",e._resizeDummy.style.height=e.offsetHeight+"px",e._resizeDummy.style.top=e.offsetTop+"px",e._resizeDummy.style.left=e.offsetLeft+"px",e._windowParent.element.appendChild(e._resizeDummy))}_resize(e,t){const a=this;let i;if((!a._dragDetails||a._dragDetails&&"drag"===a._dragDetails.type)&&a._setDragDetails("resize"),!a._dragDetails)return;a._dragDetails.started=!0,a.hasAttribute("resized")||(a.setAttribute("resized",""),a.hasAnimation&&a.$.addClass("no-transition")),a.liveResize||a._handleWindowResizeDummy();const n=a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)?"snapWindowWidth":"width";switch(e){case"left":i="object"==typeof t?t.pageX-a._dragDetails.x:t,i=i>0?Math.min(i,a._dragDetails[n]-a._dragDetails.minWidth):-1*Math.min(a._dragDetails.maxWidth?a._dragDetails.maxWidth-a._dragDetails[n]:a._dragDetails.left,Math.abs(i)),a._dragDetails[n]=Math.min(a._dragDetails[n]+a._dragDetails.left-a._windowParent.scrollElement.scrollLeft,a._dragDetails[n]-i),a._dragDetails.windowX=Math.max(a._windowParent.scrollElement.scrollLeft,a._dragDetails.windowX+i),"object"!=typeof t&&(a._dragDetails[n]=Math.max(a._dragDetails[n],a._dragDetails.minWidth)),a._dragDetails[n]>=a._dragDetails.minWidth&&(a._dragDetails.left=a._dragDetails.windowX,a._dragDetails.newWidth=a._dragDetails[n]);break;case"right":{const e=a._windowParent.element.clientWidth!==a._windowParent.element.offsetWidth?a._windowParent.borderWidth:0,n=a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)?"snapWindowWidth":"width";i="object"==typeof t?t.pageX-a._dragDetails.x:t,i>0&&a._dragDetails.maxWidth&&(i=Math.min(a._dragDetails.maxWidth-a._dragDetails[n],i)),a._dragDetails[n]=Math.min(a._windowParent.element.clientWidth+a._windowParent.scrollElement.scrollLeft-a._dragDetails.left-e,Math.max(0,a._dragDetails[n]+i)),"object"!=typeof t&&(a._dragDetails[n]=Math.max(a._dragDetails[n],a._dragDetails.minWidth)),a._dragDetails.left=a.offsetLeft,a._dragDetails.newWidth=Math.max(a._dragDetails.minWidth,a._dragDetails[n]);break}case"top":a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)&&(a._dragDetails.height=a._dragDetails.snapWindowHeight),i="object"==typeof t?t.pageY-a._dragDetails.y:t,i=i>0?Math.min(i,a._dragDetails.height-a._dragDetails.minHeight):-1*Math.min(a._dragDetails.maxHeight?a._dragDetails.maxHeight-a._dragDetails.height:a._dragDetails.top,Math.abs(i)),a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.min(a._dragDetails.height+a._dragDetails.top-a._windowParent.scrollElement.scrollTop,a._dragDetails.height-i),a._dragDetails.windowY=Math.max(a._windowParent.scrollElement.scrollTop,a._dragDetails.windowY+i),"object"!=typeof t&&(a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.max(a._dragDetails.height,a._dragDetails.minHeight)),a._dragDetails.height>=a._dragDetails.minHeight&&(a._dragDetails.top=a._dragDetails.windowY,a._dragDetails.newHeight=a._dragDetails.height),a._dragDetails.newWidth=Math.max(a._dragDetails[n],a._dragDetails.newWidth);break;case"bottom":a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)&&(a._dragDetails.height=a._dragDetails.snapWindowHeight),i="object"==typeof t?t.pageY-a._dragDetails.y:t,i>0&&a._dragDetails.maxHeight&&(i=Math.min(a._dragDetails.maxHeight-a._dragDetails.height,i)),a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.min(a._windowParent.element.clientHeight+a._windowParent.scrollElement.scrollTop-a._dragDetails.top-a._windowParent.borderWidth,Math.max(0,a._dragDetails.height+i)),"object"!=typeof t&&(a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.max(a._dragDetails.height,a._dragDetails.minHeight)),a._dragDetails.newHeight=Math.max(a._dragDetails.minHeight,a._dragDetails.height),a._dragDetails.newWidth=Math.max(a._dragDetails[n],a._dragDetails.newWidth);break;case"bottomLeftCorner":a._resize("bottom",t),a._resize("left",t);break;case"bottomRightCorner":a._resize("bottom",t),a._resize("right",t);break;case"topLeftCorner":a._resize("top",t),a._resize("left",t);break;case"topRightCorner":a._resize("top",t),a._resize("right",t)}const o=a.liveResize?a:a._resizeDummy;a._dragDetails.newHeight=Math.max(a._dragDetails.snapWindowHeight,a._dragDetails.newHeight),o.style.top=a._dragDetails.top+"px",o.style.left=a._dragDetails.left+"px",o.style.width=a._dragDetails.newWidth+"px",o.style.height=a._dragDetails.newHeight+"px"}_restoreFromMinimization(){const e=this;e.minimized=!1,e.style.width=e.style.height=e.style.top=e.style.left="",e._refreshMinimizedWindowsPosition()}_refreshMinimizedWindowsPosition(){const e=this,t=e._getAllMinimizedWindows();if(0===t.length)return;let a;t[0].style.left="5px";for(let i=1;i<t.length;i++)parseFloat(t[i-1].style.left)+t[i-1].offsetWidth+t[i].offsetWidth+10<e._windowParent.element.clientWidth?(t[i].style.left=parseFloat(t[i-1].style.left)+t[i-1].offsetWidth+5+"px",t[i].style.top=t[i-1].offsetTop+"px",a=t[i]):(t[i].style.left=parseFloat(a.style.left)+"px",t[i].style.top=a.offsetTop+"px")}_setHeaderButtons(){const e=this,t=e.headerButtons,a=e.$.buttonsContainer.children,i=function(t){const a=e.$.buttonsContainer.getElementsByClassName("smart-"+(t+"").split(/(?=[A-Z])/).join("-").toLowerCase()+"-button")[0];return a&&a.classList.remove("smart-hidden"),a};for(let e=0;e<a.length;e++)a[e].classList.add("smart-hidden");if(t.length>0)for(let a=0;a<t.length;a++){let n=i(t[a]);if(!n){const e=(t[a]+"").split(/(?=[A-Z])/);n=document.createElement("button"),n.setAttribute("aria-label",e.map((e=>e.slice(0,1).toUpperCase()+e.slice(1))).join(" ")),n.classList.add("smart-"+e.join("-").toLowerCase()+"-button","smart-button","smart-element")}e.$.buttonsContainer.insertBefore(n,e.$.buttonsContainer.firstElementChild)}}_setDragDetails(e,t){const a=this;if(a._dragDetails||(a._dragDetails={}),void 0===a._dragDetails.minWidth||void 0===a._dragDetails.minHeight||void 0===a._dragDetails.maxWidth||void 0===a._dragDetails.maxHeight){const e=getComputedStyle(a);a._dragDetails.minWidth=parseFloat(e.getPropertyValue("min-width"))||0,a._dragDetails.minHeight=parseFloat(e.getPropertyValue("min-height"))||0,a._dragDetails.maxWidth=parseFloat(e.getPropertyValue("max-width"))||0,a._dragDetails.maxHeight=parseFloat(e.getPropertyValue("max-height"))||0}a._dragDetails.windowX=a.offsetLeft,a._dragDetails.windowY=a.offsetTop;const i=a.getBoundingClientRect();if(a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position))"right"===a.headerPosition&&a.collapsed&&(a._dragDetails.offsetX=i.left+a.offsetWidth-t.clientX);else{const n=a.parentElement===document.body?document.documentElement.getBoundingClientRect():a.parentElement?a.parentElement.getBoundingClientRect():document.documentElement.getBoundingClientRect(),o=window.scrollX||window.pageXOffset,s=window.scrollY||window.pageYOffset;a._windowParent.offsetLeft=n.left+o,a._windowParent.offsetTop=n.top+s,t&&"object"==typeof t&&(a._dragDetails.offsetX=t.clientX-i.left,a._dragDetails.offsetY=t.clientY-i.top),a.collapsed||(a.hasAnimation&&"minimize"===e?(a._dragDetails.width=a._dragDetails.width?a._dragDetails.width:a.offsetWidth,a._dragDetails.height=a._dragDetails.height?a._dragDetails.height:a.offsetHeight):(a._dragDetails.width=a.offsetWidth,a._dragDetails.height=a.offsetHeight),(a.style.width||a.style.height)&&(a._dragDetails.resized=!0))}if("minimize"!==e&&e&&(a._dragDetails.type=e,a._dragDetails.started=!0,a._dragDetails.snapWindowWidth=a.offsetWidth,a._dragDetails.snapWindowHeight=a.offsetHeight,t&&"object"==typeof t?(a._dragDetails.x=t.pageX,a._dragDetails.y=t.pageY):(a._dragDetails.x=a.offsetLeft,a._dragDetails.y=a.offsetTop),"resize"===e)){if("none"===a.resizeMode)return void delete a._dragDetails;a._dragDetails.top=a.offsetTop,a._dragDetails.left=a.offsetLeft,a._dragDetails.newWidth=a._dragDetails.width,a._dragDetails.newHeight=a._dragDetails.height,a.$container.hasClass("smart-window-resizing-right")?a._dragDetails.side="right":a.$container.hasClass("smart-window-resizing-left")?a._dragDetails.side="left":a.$container.hasClass("smart-window-resizing-top")?a._dragDetails.side="top":a.$container.hasClass("smart-window-resizing-bottom")?a._dragDetails.side="bottom":a.$container.hasClass("smart-window-resizing-top-left")?a._dragDetails.side="topLeftCorner":a.$container.hasClass("smart-window-resizing-bottom-left")?a._dragDetails.side="bottomLeftCorner":a.$container.hasClass("smart-window-resizing-top-right")?a._dragDetails.side="topRightCorner":a.$container.hasClass("smart-window-resizing-bottom-right")&&(a._dragDetails.side="bottomRightCorner")}}_setElementParent(e){const t=this;if(t._windowParent.element=void 0,t._windowParent.parent&&!t._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&(t._windowParent.parent.style.position=""),e instanceof HTMLElement)t._windowParent.element=e;else if("string"==typeof e)if("body"===e){const e=t.getRootNode();t._windowParent.element=e&&e.host?t.getShadowRootOrBody():document.body}else t._windowParent.element=document.getElementById(e);if(t._windowParent.element||(t._windowParent.initialParent?t._windowParent.element=t._windowParent.initialParent.parentElement?t._windowParent.initialParent:t.getShadowRootOrBody():t._windowParent.element=t.getShadowRootOrBody()),t.parentElement!==t._windowParent.element&&t._windowParent.element.appendChild(t),t._windowParent.element===document.body)t._windowParent.element=document.documentElement,t._windowParent.scrollElement=document.scrollingElement,t._windowParent.parent=document.body,t._windowParent.borderWidth=0;else{if(t.parentElement instanceof Smart.Window&&!t.parentElement.isCompleted)return void t.parentElement.whenRendered((function(){t.parentElement.appendChild(t),t._setElementParent(t.windowParent)}));t._windowParent.element instanceof Smart.Window&&(t._windowParent.element=t._windowParent.element.$.content);const e=getComputedStyle(t.parentElement),a=e.getPropertyValue("position");t._windowParent.borderWidth=2*parseInt(e.getPropertyValue("border-width")||0),t._windowParent.parent=t.parentElement,t._windowParent.scrollElement=t._windowParent.element,"static"===a&&(t.parentElement.style.position="relative")}t._setModal(),t.style.left&&t.offsetLeft>t._windowParent.scrollElement.scrollWidth&&(t.style.left=t._windowParent.scrollElement.scrollWidth-t.offsetWidth+"px"),t.style.top&&t.offsetTop>t._windowParent.scrollElement.scrollHeight&&(t.style.top=t._windowParent.scrollElement.scrollHeight-t.offsetHeight+"px")}_setModal(){const e=this;if(delete e._changingFocus,e._windowParent.element)if(e.modal)if(e._modal||(e._modal=document.createElement("div"),e._modal.classList.add("smart-modal")),e._windowParent.parent!==document.body?e._modal.setAttribute("nested-modal",""):e._modal.removeAttribute("nested-modal"),e._modal._window=e,e.opened&&!e._modal.parentElement){const t=parseInt(getComputedStyle(e).getPropertyValue("z-index"));isNaN(t)||(e._modal.style.zIndex=t-1),e.parentElement.insertBefore(e._modal,e)}else e._modal.parentElement&&e._modal.parentElement.removeChild(e._modal);else e._modal&&e._modal.parentElement&&(e._modal.parentElement.removeChild(e._modal),delete e._modal)}}),Smart("smart-dialog-window",class extends Smart.Window{static get properties(){return{cancelLabel:{value:"Cancel",type:"string"},confirmLabel:{value:"Ok",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},headerButtons:{value:["close"],type:"array"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0}}}static get listeners(){return{"footer.click":"_footerClickHandler"}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="pinButton" class="smart-pin-button" aria-label="Pin"></button>\n <button id="collapseButton" class="smart-button smart-element smart-collapse-button" aria-label="Collapse"></button>\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button" aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}_createElement(){const e=this;e.setAttribute("role","alertdialog"),e.setAttribute("aria-describedby",e.$.content.id)}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm"):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel")}_keyDownHandler(e){const t=this;if(delete t._changingFocus,t.disabled||(t.hasAttribute("dragged")||t.hasAttribute("resized"))&&t._mouseManipulation)return;e.stopPropagation();const a="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,i=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":{if(t.minimized||i!==t)return;const n=e.key.indexOf("Right")>-1||e.key.indexOf("Left")>-1;if(e.preventDefault(),!n&&e.altKey)return void("ArrowUp"===e.key?t.maximize():t.restore());if(t.$.addClass("no-transition"),t.maximized)return;if(e.ctrlKey&&"none"!==t.resizeMode)return t.hasAttribute("dragged")&&t._cancelDragging(e),t.hasAttribute("resized")||t.$.fireEvent("resizeStart",{position:{x:e.pageX,y:e.pageY}}),void t._resize(n?"right":"bottom",a);t.pinned||(t.hasAttribute("dragged")||(t.setAttribute("dragged",""),t.$.fireEvent("dragStart",{left:e.pageX,top:e.pageY})),t._drag(a,n?"horizontal":"vertical")),t.$.removeClass("no-transition");break}case"Escape":t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}}}),Smart("smart-alert-window",class extends Smart.DialogWindow{static get properties(){return{headerButtons:{value:[],type:"array"}}}_createElement(){const e=this;e.setAttribute("role","alertdialog"),e.setAttribute("aria-describedby",e.$.content.id)}}),Smart("smart-prompt-window",class extends Smart.DialogWindow{static get properties(){return{autoComplete:{allowedValues:["none","manual","auto","inline"],type:"string",value:"manual"},confirmLabel:{value:"Ok",type:"string"},cancelLabel:{value:"Cancel",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},displayMode:{value:"default",allowedValues:["default","escaped"],type:"string"},headerButtons:{value:["close"],type:"array"},form:{value:"",type:"string"},hint:{value:null,type:"any?"},maxLength:{value:null,type:"number?"},minLength:{value:2,type:"number"},messages:{extend:!0,value:{en:{missingReference:"{{elementType}}: Missing reference to {{files}}."}},type:"object"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},name:{value:"",type:"string"},placeholder:{value:"",type:"string"},promptLabel:{value:"",type:"string?"},required:{value:!1,type:"boolean"},requiredMessage:{value:"",type:"string"},selectAllOnFocus:{value:!1,type:"boolean"},value:{value:"",type:"string"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-text-box id="textBox"\n animation="[[animation]]"\n auto-complete="[[autoComplete]]"\n max-length="[[maxLength]]"\n value="{{value}}"\n form="[[form]]"\n label="[[promptLabel]]"\n hint="[[hint]]"\n display-mode="[[displayMode]]"\n max-length="[[maxLength]]"\n placeholder="[[placeholder]]"\n required="[[required]]"\n required-message="[[requiredMessage]]"\n select-all-on-focus="[[selectAllOnFocus]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n </smart-text-box>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button flat">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button flat">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}static get listeners(){return{"footer.click":"_footerClickHandler"}}static get requires(){return{"Smart.TextBox":"smart.textbox.js"}}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm",{value:t.$.textBox.value}):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel",{value:t.$.textBox.value})}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;e.stopPropagation();const i="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,n=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(n!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",i),void a();t._drag(i,"vertical");break;case"ArrowLeft":case"ArrowRight":if(n!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",i),void a();t._drag(i,"horizontal"),t.$.removeClass("no-transition");break;case"Escape":t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}}),Smart("smart-multiline-prompt-window",class extends Smart.PromptWindow{static get properties(){return{autoCapitalize:{value:"none",allowedValues:["none","words","characters"],type:"string"},autoExpand:{value:!1,type:"boolean"},headerButtons:{value:["close"],type:"array"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},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"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},wrap:{value:"soft",allowedValues:["hard","soft","off"],type:"string"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-multiline-text-box id="textBox"\n animation="[[animation]]"\n horizontal-scroll-bar-visibility= "[[horizontalScrollBarVisibility]]"\n vertical-scroll-bar-visibility= "[[verticalScrollBarVisibility]]"\n auto-capitalize="[[autoCapitalize]]"\n auto-expand = "[[autoExpand]]"\n selection-direction= "[[selectionDirection]]"\n selection-end= "[[selectionEnd]]"\n selection-start="[[selectionStart]]"\n spell-check= "[[spellCheck]]"\n wrap="[[wrap]]"\n max-length="[[maxLength]]"\n value="{{value}}"\n form="[[form]]"\n label="[[promptLabel]]"\n hint="[[hint]]"\n display-mode="[[displayMode]]"\n max-length="[[maxLength]]"\n placeholder="[[placeholder]]"\n required="[[required]]"\n required-message="[[requiredMessage]]"\n select-all-on-focus="[[selectAllOnFocus]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n </smart-multiline-text-box>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button flat">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button flat">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}static get listeners(){return{"footer.click":"_footerClickHandler"}}static get requires(){return{"Smart.MultilineTextBox":"smart.multilinetextbox.js"}}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm",{value:t.$.textBox.value}):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel",{value:t.$.textBox.value})}}),Smart("smart-progress-window",class extends Smart.Window{static get properties(){return{completeLabel:{value:"Continue",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},headerButtons:{value:["close"],type:"array"},indeterminate:{value:!1,type:"boolean"},inverted:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function"},max:{value:100,type:"number"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},min:{value:0,type:"number"},showProgressValue:{value:!1,type:"boolean"},value:{value:0,type:"number?"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content" inner-h-t-m-l="[[innerHTML]]">\n <content></content>\n </div>\n <div id="footer" class="smart-footer">\n <smart-progress-bar id="progressBar"\n animation="[[animation]]"\n min="[[min]]"\n max="[[max]]"\n indeterminate="[[inditerminate]]"\n inverted="[[inverted]]"\n format-function="[[formatFunction]]"\n show-progress-value="[[showProgressValue]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]"\n value="{{value}}">\n </smart-progress-bar>\n <button id="completeButton" class="smart-button smart-element smart-complete-button smart-visibility-hidden">[[completeLabel]]</button>\n </div>\n </div>\n </div>'}static get requires(){return{"Smart.ProgressBar":"smart.progressbar.js"}}propertyChangedHandler(e,t,a){const i=this;switch(e){case"value":i._handleCompletion();break;default:super.propertyChangedHandler(e,t,a)}}_createElement(){this.setAttribute("role","dialog"),this._handleCompletion()}_handleCompletion(){const e=this;e.$.completeButton&&(e.value>=e.max?(e.$completeButton.removeClass("smart-visibility-hidden"),e.$progressBar.addClass("smart-visibility-hidden")):(e.$completeButton.addClass("smart-visibility-hidden"),e.$progressBar.removeClass("smart-visibility-hidden")))}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;e.stopPropagation();const i="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,n=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(n!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",i),void a();t._drag(i,"vertical"),t.$.removeClass("no-transition");break;case"ArrowLeft":case"ArrowRight":if(n!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",i),void a();t._drag(i,"horizontal"),t.$.removeClass("no-transition");break;case"Escape":t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}}),Smart("smart-tabs-window",class extends Smart.Window{static get properties(){return{disableSnap:{value:!0,readOnly:!0,type:"boolean"},dropPosition:{value:["all"],type:"array"},addNewTab:{value:!1,type:"boolean"},allowToggle:{value:!1,type:"boolean"},autoHide:{value:!1,type:"boolean"},autoHideWindow:{value:null,type:"any"},dataSource:{value:null,type:"array?",reflectToAttribute:!1},tabCloseButtonMode:{value:"default",allowedValues:["default","selected"],type:"string"},tabCloseButtons:{value:!1,type:"boolean"},messages:{value:{en:{ambiguousIndexes:"smart-tabs: Initially set smart-tab-item indexes are ambiguous and are ignored in favour of the HTML structure.",detailsObjectRequired:'smart-tabs: The method "insert" requires a details Object to be passed as a second argument.',invalidIndex:'smart-tabs: "{{method}}" method accepts an index of type number.',referenceNodeNotChild:"smart-tabs: Passed {{argument}} is not part of this smart-tabs element.",tabItemRequired:'smart-tabs: The method "{{method}}" requires a "smart-tab-item" element to be passed as an argument.'}},type:"object",extend:!0},tabOverflow:{value:"auto",allowedValues:["auto","hidden","scroll"],type:"string"},tabReorder:{value:!1,type:"boolean"},tabResize:{value:!1,type:"boolean"},tabScrollButtonsPosition:{value:"both",allowedValues:["near","far","both"],type:"string"},selectedIndex:{value:null,type:"number?"},selectionMode:{value:"click",allowedValues:["click","dblclick","mouseenter","none"],type:"string"},collapsed:{value:!1,type:"boolean"},collapsible:{value:!1,type:"boolean"},locked:{value:!1,type:"boolean"},max:{value:"",type:"any"},min:{value:"",type:"any"},size:{value:"",type:"any"},tabLayout:{value:"scroll",allowedValues:["scroll","dropdown","wrap","shrink"],type:"string",defaultReflectToAttribute:!0},tabPosition:{value:"top",allowedValues:["top","bottom","left","right","hidden"],type:"string"},tabTextOrientation:{value:"horizontal",allowedValues:["horizontal","vertical"],type:"string"},layout:{value:null,type:"any"}}}static get listeners(){return{"tabsElement.blur":"_tabsFocusHandler","tabsElement.change":"_tabsChangeHandler","tabsElement.focus":"_tabsFocusHandler","autoHideWindow.close":"_autoHideWindowCloseHandler","autoHideWindow.open":"_autoHideWindowOpenHandler"}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button" aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div id="contentSection" class="smart-content">\n <smart-tabs id="tabsElement"\n animation="[[animation]]"\n add-new-tab="[[addNewTab]]"\n allow-toggle="[[allowToggle]]"\n close-button-mode="[[tabCloseButtonMode]]"\n close-buttons="[[tabCloseButtons]]"\n disabled="[[disabled]]"\n overflow="[[tabOverflow]]"\n reorder="[[tabReorder]]"\n resize="[[tabResize]]"\n scroll-buttons-position="[[tabScrollButtonsPosition]]"\n selected-index="{{selectedIndex}}"\n selection-mode="[[selectionMode]]"\n tab-layout="[[tabLayout]]"\n tab-position="[[tabPosition]]"\n tab-text-orientation="[[tabTextOrientation]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n <content></content>\n </smart-tabs>\n </div>\n <div id="footer" class="smart-footer smart-hidden"></div>\n </div>\n </div>'}static get requires(){return{"Smart.Tabs":"smart.tabs.js"}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(e instanceof Smart.TabItem||t.error(t.localize("tabItemRequired",{method:"removeChild"})),t.$.tabsElement.appendChild(e)):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}insert(e,t){this.$.tabsElement.insert(e,t);const a=this.$.tabsElement._tabs[e];a&&(a.draggable=void 0===t.draggable||t.draggable,a.floatable=void 0===t.floatable||t.floatable)}insertBefore(e,t){this.$.tabsElement.insertBefore(e,t)}removeAt(e){this.$.tabsElement.removeAt(e)}removeChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(e instanceof Smart.TabItem||t.error(t.localize("tabItemRequired",{method:"removeChild"})),(t.shadowRoot||t).contains(e)||t.error(t.localize("referenceNodeNotChild",{argument:"node"})),t.$.tabsElement.removeChild(e)):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}refreshTabHeader(){const e=this;e.$.tabsElement&&e.$.tabsElement.isCompleted&&e.$.tabsElement.refreshTabHeader()}refreshTabs(){const e=this;e.$.tabsElement&&e.$.tabsElement.isCompleted&&e.$.tabsElement._applyTabOverflow()}select(e){this.$.tabsElement.select(e)}update(e,t,a){this.$.tabsElement.update(e,t,a)}get items(){return this.isCompleted&&this.$.tabsElement?this.$.tabsElement._tabs:null}get itemLabels(){return this.$?this.$.tabsElement._tabLabelContainers:null}get siblings(){const e=this;let t=[];if(!e.isCompleted)return t;const a=e.closest("smart-splitter");if(!a||!a.closest("smart-docking-layout"))return t;const i=a._items;if(!i||!i.length)return t;for(let n=0;n<i.length;n++){const o=i[n];o!==e.closest("smart-splitter-item")&&o.querySelector("smart-tabs-window").closest("smart-splitter")===a&&t.push(o.querySelector("smart-tabs-window"))}return t}propertyChangedHandler(e,t,a){const i=this;switch("collapsed"!==e&&super.propertyChangedHandler(e,t,a),e){case"theme":""!==t&&(i.$.closeButton.classList.remove(t),i.$.collapseButton.classList.remove(t),i.$.maximizeButton.classList.remove(t),i.$.pinButton.classList.remove(t)),i._applyTheme(a);break;case"autoHideWindow":i._handleAutoHideWindow();break;case"autoHide":a||(null!==i.$.tabsElement.selectedIndex&&(i.$.tabsElement._tabs[i.$.tabsElement.selectedIndex]._autoHideWindowSize=void 0),i._autoHideWindow&&i._autoHideWindow.close());break;case"dataSource":i.$.tabsElement.dataSource=a;break;case"layout":i._handleLayoutProperty();break;case"collapsible":case"collapsed":case"locked":case"max":case"min":case"size":{const n=i.getRootNode(),o=(n&&n.host?n.host:i).closest("smart-docking-layout"),s=i.closest("smart-splitter-item");if(!o)return void("collapsed"===e&&super.propertyChangedHandler(e,t,a));s&&(s[e]=a);break}}}_applyTheme(e){if(""!==e){const t=this.$.buttonsContainer.children;for(let a=0;a<t.length;a++)t[a].classList.add(e)}}_autoHideWindowCloseHandler(){const e=this;e.allowToggle&&null!==e.$.tabsElement.selectedIndex&&e.$.tabsElement.select(e.$.tabsElement.selectedIndex),e._autoHideWindow&&e._moveContent(e._autoHideWindow.items[0],e._autoHideWindow._tab)}_autoHideWindowOpenHandler(){const e=this;e.$.tabsElement.selectedIndex&&e._handleAutoHide(e.$.tabsElement.selectedIndex)}_createElement(){const e=this;e.setAttribute("role","dialog"),e.$.tabsElement.$.tabHeaderControls&&!e.$.tabsElement.$.tabHeaderControls.innerHTML&&e.$.tabsElement.$tabHeaderControls.addClass("smart-hidden"),e.$.tabsElement.dataSource=e.dataSource,e._applyTheme(e.theme),e._handleAutoHideWindow(),e.autoHide&&e._handleAutoHide(e.$.tabsElement.selectedIndex),e.allowToggle||e.selectedIndex||null===e.$.tabsElement.selectedIndex||(e.selectedIndex=e.$.tabsElement.selectedIndex,e.$.tabsElement.setAttribute("selected-index",e.selectedIndex)),e._handleLayoutProperty();const t=(e.isInShadowDOM?e.getRootNode().host:e||e).closest("smart-docking-layout"),a=e.closest("smart-splitter-item");t&&a&&(a.collapsible=e.collapsible,a.collapsed=e.collapsed,a.min=e.min,a.max=e.max,a.size=e.size,a.locked=e.locked)}attached(){super.attached();const e=this;e.classList.add("smart-window"),e.shadowRoot&&e.$.root.classList.add("smart-window")}_handleLayoutProperty(){const e=this;let t=e.closest("smart-docking-layout");if(Smart.DockingLayout){if(!e.ownerLayout&&e.getRootNode()){let a=e.getRootNode().host;for(;a;){if(!a.closest)return;if(a.closest("smart-docking-layout")){t=a.closest("smart-docking-layout");break}a=a.getRootNode()?a.getRootNode().host:void 0}}t?e.layout=t:e.layout instanceof Smart.DockingLayout||"string"==typeof e.layout&&(e.layout=document.getElementById(e.layout))}}_headerDblCickHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;e.ctrlKey||a!==t.$.headerSection&&a!==t.$.header||t.$.maximizeButton&&0===t.$.maximizeButton.offsetHeight||(t.maximized?t.restore():t.maximize())}_documentUpHandler(e){const t=this;let a=e.originalEvent.target.closest?e.originalEvent.target.closest(".smart-window"):e.originalEvent.target,i=a===t||a===t._autoHideWindow||t._isAutoHideWindowClicked,n=t.closest("smart-docking-layout");(t.shadowRoot||t.isInShadowDOM)&&(a=e.originalEvent.composedPath()[0],i=a.getRootNode()===t.shadowRoot||a.closest(".smart-window")===t||a.closest(".smart-window")===t._autoHideWindow||t._isAutoHideWindowClicked),n=((t.isInShadowDOM?t.getRootNode().host:t)||t).closest("smart-docking-layout"),n&&n.disabled?delete t._isWindowContentClicked:(super._documentUpHandler(e),delete t._isAutoHideWindowClicked,t.autoHide&&t._autoHideWindow&&(i&&t._autoHideWindow.opened||(t.selectedIndex=null,t._autoHideWindow.parentElement&&t._autoHideWindow.parentElement.closest(".smart-window")===t&&t._autoHideWindow.close())))}_handleAutoHide(e){const t=this;if(!t.autoHide||null===e)return;if(t._autoHideWindow||t._handleAutoHideWindow(!0),!t._autoHideWindow)return;t._autoHideWindow._tabsWindow&&t._autoHideWindow._tabsWindow!==t&&(t._autoHideWindow._tabsWindow.selectedIndex=null);const a=t.$.tabsElement._tabs[e];t._autoHideWindow._tab!==a&&t._moveContent(t._autoHideWindow.items[0],t._autoHideWindow._tab),t._autoHideWindow.label=a.label,t._autoHideWindow.draggable=a.draggable,t._autoHideWindow.floatable=a.floatable,t._autoHideWindow._tab=a,t._moveContent(t._autoHideWindow._tab,t._autoHideWindow.items[0]),t._autoHideWindow.bringToFront(),t._setAutoHideWindowSize(e),t._autoHideWindow.open(),t._autoHideWindow._tabsWindow=t,t._autoHideWindow.controlledBy&&t._autoHideWindow.controlledBy.removeAttribute("aria-controls"),t._autoHideWindow.controlledBy=t.$.tabsElement._tabLabelContainers[e],t._autoHideWindow.controlledBy.setAttribute("aria-controls",t._autoHideWindow.id)}_moveHandler(e){const t=this,a=t.closest("smart-docking-layout");a&&a.items.indexOf(t)>-1||(Smart.Utilities.Core.isMobile&&navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&t.layout instanceof Smart.DockingLayout&&t.layout.hasAttribute("dragged")&&e.originalEvent.preventDefault(),super._moveHandler(e))}_setAutoHideWindowSize(e){const t=this;if(!t._autoHideWindow)return;t._autoHideWindow.$.addClass("no-transition"),t._autoHideWindow.style.maxWidth=t._autoHideWindow.style.maxHeight="";const a=t.$.tabsElement._tabs[e],i=(t._autoHideWindow.isInShadowDOM?t._autoHideWindow.getRootNode().host:t._autoHideWindow).closest("smart-docking-layout")||t._autoHideWindow.parentElement;let n,o;if(a){if("top"===t.tabPosition||"bottom"===t.tabPosition){t._autoHideWindow.resizeMode="top"===t.tabPosition?"bottom":"top",t._autoHideWindow.style.width=t.$.tabsElement.offsetWidth+"px",n=i.getBoundingClientRect(),o=t.$.tabsElement.getBoundingClientRect();let e=a._autoHideWindowSize&&parseFloat(a._autoHideWindowSize)||"";Smart.DockingLayout&&i instanceof Smart.DockingLayout&&(e&&(e=Math.min(i.$.itemsContainer.offsetHeight,e)+"px"),t._autoHideWindow.style.maxHeight=i.$.itemsContainer.offsetHeight+"px"),t._autoHideWindow.style.height=e,t._autoHideWindow.style.left=o.left-n.left+"px",t._autoHideWindow&&("top"===t.tabPosition?t._autoHideWindow.style.top=o.top+-n.top+o.height+"px":t._autoHideWindow.style.top=o.top-n.top-t._autoHideWindow.offsetHeight+"px")}else{t._autoHideWindow.resizeMode="left"===t.tabPosition?"right":"left",t._autoHideWindow.style.height=t.$.tabsElement.offsetHeight+"px";let e=a._autoHideWindowSize&&parseFloat(a._autoHideWindowSize)||"";i instanceof Smart.DockingLayout&&(e&&(e=Math.min(i.$.itemsContainer.offsetWidth,e)+"px"),t._autoHideWindow.style.maxWidth=i.$.itemsContainer.offsetWidth+"px"),t._autoHideWindow.style.width=e,n=i.getBoundingClientRect(),o=t.$.tabsElement.getBoundingClientRect(),t._autoHideWindow.style.top=o.top-n.top+"px","left"===t.tabPosition?t._autoHideWindow.style.left=o.left-n.left+t.$.tabsElement.offsetWidth+"px":t._autoHideWindow.style.left=o.left-n.left-t._autoHideWindow.offsetWidth+"px"}t._autoHideWindow._dragDetails&&(t._autoHideWindow._dragDetails.maxWidth=void 0),t._autoHideWindow._setDragDetails("resize"),t._autoHideWindow._dragDetails.started=!1,t._autoHideWindow.$.removeClass("no-transition")}}_handleAutoHideWindow(e){const t=this;if(t.autoHideWindow){if(t._autoHideWindow&&t._autoHideWindow.parentElement.removeChild(t._autoHideWindow),"string"==typeof t.autoHideWindow)return void(t._autoHideWindow=document.getElementById(t.autoHideWindow));if(t.autoHideWindow instanceof Smart.Window)return void(t._autoHideWindow=t.autoHideWindow)}if(!e||t._autoHideWindow||2===t.$.contentSection.children.length&&t.$.contentSection.children[1]instanceof Smart.Window)return;const a=document.createElement("smart-window");a.$=Smart.Utilities.Extend(a),a.disableSnap=a.pinned=!0,a.headerButtons=["close"],t.$.contentSection.appendChild(a),t._autoHideWindow=a}_moveContent(e,t){if(!e||!t)return;const a=[].slice.call(e.$.content.childNodes);for(let e=0;e<a.length;e++)t.appendChild(a[e])}_tabsChangeHandler(e){const t=this;if(e.target===t.$.tabsElement&&t.autoHide){if(t._autoHideWindow||t._handleAutoHideWindow(!0),null!==e.detail.oldIndex&&t._autoHideWindow.opened&&(t.$.tabsElement._tabs[e.detail.oldIndex]._autoHideWindowSize=t._autoHideWindow.style["right"===t.$.tabsElement.tabPosition||"left"===t.$.tabsElement.tabPosition?"width":"height"]),!t.autoHide||null===e.detail.index||void 0===e.detail.index)return t._autoHideWindow.setAttribute("active",""),void t._autoHideWindow.close();t._handleAutoHide(e.detail.index)}}_tabsFocusHandler(e){const t=this;"focus"===e.type?(t.bringToFront(),t.setAttribute("focus","")):t.removeAttribute("focus")}}),Smart("smart-wait-window",class extends Smart.ProgressWindow{static get properties(){return{headerButtons:{value:[],type:"array"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},pinned:{value:!0,type:"boolean",readOnly:!0}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-progress-bar id="progressBar" animation="[[animation]]" indeterminate theme="[[theme]]" right-to-left="[[rightToLeft]]"></smart-progress-bar>\n </div>\n <div id="footer" class="smart-footer"></div>\n </div>\n </div>'}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;const i=t.shadowRoot||t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;e.stopPropagation();const n="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(i!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",n),void a();t._drag(n,"vertical");break;case"ArrowLeft":case"ArrowRight":if(i!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",n),void a();t._drag(n,"horizontal");break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}});
873
+ Smart("smart-window",class extends Smart.ContentElement{static get properties(){return{collapsed:{value:!1,type:"boolean"},closeOnMaskClick:{value:!1,type:"boolean"},disableEscape:{value:!1,type:"boolean"},disableSnap:{value:!1,type:"boolean"},footerPosition:{value:"bottom",allowedValues:["bottom","none"],type:"string"},footerTemplate:{value:null,type:"any"},headerButtons:{value:["close","maximize","minimize"],type:"array"},headerPosition:{value:"top",allowedValues:["top","bottom","left","right","none"],type:"string"},headerTemplate:{value:null,type:"any"},disableKeyboard:{value:!1,type:"boolean"},label:{value:"",type:"string"},liveResize:{value:!1,type:"boolean"},maximized:{value:!1,type:"boolean"},modal:{value:!1,type:"boolean"},minimized:{value:!1,type:"boolean"},opened:{value:!1,type:"boolean"},pinned:{value:!1,type:"boolean"},resizeIndicator:{value:!1,type:"boolean"},resizeMode:{allowedValues:["none","horizontal","vertical","both","top","bottom","left","right"],value:"none",type:"string"},windowParent:{value:null,type:"any"}}}static get listeners(){return{"document.dragstart":"_dragStartHandler","document.focusin":"_documentFocusInEventHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","document.wheel":"_mouseWheelHandler","document.selectstart":"_documentSelectStartHandler",down:"_downHandler",focus:"_focusHandler",blur:"_focusHandler",move:"_moveHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler"}}get hasStyleObserver(){return!1}static get styleUrls(){return["smart.button.css","smart.window.css"]}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header" role="presentation">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container" role="presentation">\n <button id="pinButton" class="smart-button smart-element smart-pin-button" aria-label="Pin"></button>\n <button id="collapseButton" class="smart-button smart-element smart-collapse-button" aria-label="Collapse"></button>\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button"aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content" inner-h-t-m-l="[[innerHTML]]"><content></content></div>\n <div id="footer" class="smart-footer"></div>\n </div>\n </div>'}propertyChangedHandler(e,t,a){const i=this;switch(e){case"collapsed":a?i.collapse(!0):i.expand(!0);break;case"disabled":case"unfocusable":i._setFocusable();break;case"headerTemplate":case"footerTemplate":i._applyLayoutTemplate(i.$[e.split(/[T]/)[0]],a);break;case"headerButtons":i._setHeaderButtons();break;case"headerPosition":{const e=i.minimized;i._preventEventFiring=!0,i.restore(),delete i._preventEventFiring,e&&i.minimize();break}case"label":i.$.header.innerHTML=i.label;break;case"maximized":a?i.maximize(!0):i.restore(e);break;case"modal":i._setModal(),i.setAttribute("aria-modal",a);break;case"minimized":a?i.minimize(!0):i.restore(e);break;case"opened":a?i.open(!0):i.close(!0);break;case"resizeMode":i.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right");break;case"windowParent":i._setElementParent(a);break;default:super.propertyChangedHandler(e,t,a)}}ready(){super.ready(),this._windowParent={initialParent:this.parentElement}}render(){const e=this,t=e.animation;e.$.header.id||(e.$.header.id=e.id+"Header"),e.$.content.id||(e.$.content.id=e.id+"Content"),e.opened||(e.animation="none"),e._windowParent={initialParent:e.parentElement},e.$.addClass("smart-window"),e._createElement(),e._setElementParent(e.windowParent),e._setHeaderButtons(),e.headerTemplate&&e._applyLayoutTemplate(e.$.header,e.headerTemplate),e.footerTemplate&&e._applyLayoutTemplate(e.$.footer,e.footerTemplate),e.opened?e.open():e.close(),e.maximized&&e.maximize(!0),e.minimized&&e.minimize(!0),e.collapsed&&e.collapse(!0),e.pinned?e.pin():e.unpin(),e._setFocusable(),e.animation=t,e.setAttribute("aria-modal",e.modal),e.setAttribute("aria-labelledby",e.$.header.id),e._setupDismissTargets(),super.render()}refresh(){const e=this;e.headerTemplate&&e._applyLayoutTemplate(e.$.header,e.headerTemplate),e.footerTemplate&&e._applyLayoutTemplate(e.$.footer,e.footerTemplate),e.opened?e.open():e.close(),e.maximized&&e.maximize(!0),e.minimized&&e.minimize(!0),e.collapsed&&e.collapse(!0),e.pinned?e.pin():e.unpin()}static get requires(){return{"Smart.Button":"smart.button.js"}}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)e.removeAttribute("tabindex");else{let t=e.tabIndex>0?e.tabIndex:0;e.setAttribute("tabindex",t)}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?t.$.content.appendChild(e):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}collapse(e){const t=this;!e&&t.collapsed||(t.collapsed=!0,t.$.fireEvent("collapse"),"left"===t.headerPosition||"right"===t.headerPosition?t.style.width="":t.style.height="")}close(e){const t=this;if(e||!t.$.hasClass("smart-visibility-hidden")){if(t.isCompleted){if(t.$.fireEvent("closing").defaultPrevented)return;t.$.addClass("smart-visibility-hidden"),t.opened=!1,t.isRendered&&t.$.fireEvent("close")}else t.$.addClass("smart-visibility-hidden"),t.opened=!1;t._setModal(),t.removeAttribute("ontop")}}attached(){super.attached();const e=this;e.isRendered,e._windowParent.parent&&e._windowParent.parent!==e.getShadowRootOrBody()&&e._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&"static"===window.getComputedStyle(e._windowParent.parent).getPropertyValue("position")&&(e._windowParent.parent.style.position="relative"),e.opened&&e._modal&&e.parentElement.insertBefore(e._modal,e)}bringToFront(){const e=this;if(!e.parentElement)return;const t=e.parentElement.closest(".smart-window");if(t)return void t.bringToFront();const a=document.body.getElementsByClassName("smart-window");let i=[];for(let e=0;e<a.length;e++){const t=a[e];t.removeAttribute("ontop"),t.opened&&i.push(t)}1===i.length&&i[0]===e||e.setAttribute("ontop","")}clear(){const e=this;e.isCompleted&&"Smart-WINDOW"===e.nodeName&&(e.innerHTML=e.$.content.innerHTML="")}detached(){super.detached();const e=this;e._windowParent.parent&&!e._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&(e._windowParent.parent.style.position=""),e._modal&&e._modal.parentElement&&e._modal.parentElement.removeChild(e._modal),e._resizeDummy&&e._resizeDummy.parentElement&&e._handleWindowResizeDummy(),e._refreshMinimizedWindowsPosition()}expand(e){const t=this;(e||t.collapsed)&&(t.collapsed=!1,t.$.fireEvent("expand"),t.maximized?"left"===t.headerPosition||"right"===t.headerPosition?t.style.width=Math.max(t._windowParent.scrollElement.scrollWidth,t._windowParent.element.clientWidth)-t._windowParent.borderWidth+"px":t.style.height=Math.max(t._windowParent.scrollElement.scrollHeight,t._windowParent.element.clientHeight)-t._windowParent.borderWidth+"px":"left"===t.headerPosition||"right"===t.headerPosition?t.style.width=t.className.indexOf("smart-window-snapped-")<0&&t._dragDetails?t._dragDetails.width+"px":"":t.style.height=t.className.indexOf("smart-window-snapped-")<0&&t._dragDetails?t._dragDetails.height+"px":"")}maximize(e){const t=this;if(!e&&t.maximized)return;t.minimized&&t._restoreFromMinimization(e),t._setDragDetails("minimize"),"none"!==t.resizeMode&&t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right"),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&t.classList.remove("smart-window-snapped-"+t._snapDummy._position),t.maximized=!0,t.$.fireEvent("maximize"),t.style.left=t.style.top=0,t.style.maxWidth=t.style.maxHeight="none";const a=t._windowParent.scrollElement.scrollHeight,i=t._windowParent.scrollElement.scrollWidth,n=t._windowParent.element.clientHeight,o=t._windowParent.element.clientWidth,s=Math.max(a,n),r=Math.max(i,o);"top"===t.headerPosition||"bottom"===t.headerPosition?(t.style.width=i>o?r-t._windowParent.borderWidth+"px":"100%",t.collapsed||(t.style.height=a>n?s-t._windowParent.borderWidth+"px":"100%")):(t.collapsed||(t.style.width=i>o?r-t._windowParent.borderWidth+"px":"100%"),t.style.height=a>n?s-t._windowParent.borderWidth+"px":"100%"),"100%"!==t.style.height&&t.addEventListener("transitionend",(function e(){if(!t.maximized||!t.hasAnimation)return;const a=t._windowParent.scrollElement.scrollHeight,i=t._windowParent.element.clientHeight,n=Math.max(a,i);("top"===t.headerPosition||"bottom"===t.headerPosition)&&t.collapsed||(t.style.height=a>i?n-t._windowParent.borderWidth+"px":"100%"),t.removeEventListener("transitionend",e)}))}minimize(e){const t=this;if(!e&&t.minimized)return;t.maximized&&(t._preventEventFiring=!0,t.restore(),delete t._preventEventFiring),t._setDragDetails(),t.minimized=!0,t.$.fireEvent("minimize"),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&(t.$.removeClass("smart-window-snapped-"+t._snapDummy._position),t.style.right=t.style.top=t.style.left="");const a=t._getAllMinimizedWindows(t._windowParent.element);if(a.length>0){const e=a[a.length-1];t.style.left=(e.offsetLeft+e.offsetWidth+t._dragDetails.minWidth+10>t._windowParent.element.clientWidth?e.offsetLeft:e.offsetLeft+e.offsetWidth+5)+"px",t.style.top=e.offsetTop+"px"}else t.style.left="5px",t.style.top=t._windowParent.element.clientHeight+t._windowParent.scrollElement.scrollTop-t.$.headerSection.offsetHeight-5+"px";t.style.width="",t.style.height=t.$.headerSection.offsetHeight+"px"}_createElement(){this.setAttribute("role","dialog")}removeChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?t.$.content.removeChild(e):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}restore(e){const t=this;if("maximized"===e||t.maximized?(t.maximized=!1,t.style.width=t.style.height=t.style.top=t.style.left=""):("minimized"===e||t.minimized)&&t._restoreFromMinimization(e),t._preventEventFiring||t.$.fireEvent("restore"),t.style.maxWidth=t.style.maxHeight="",t._dragDetails){if(t.style.left=Math.max(0,Math.min(t._dragDetails.windowX,t._windowParent.element.clientWidth-t._dragDetails.width))+"px",t.style.top=Math.max(0,Math.min(t._dragDetails.windowY,t._windowParent.scrollElement.scrollHeight-t._dragDetails.height))+"px",t.collapsed)return void("top"===t.headerPosition||"bottom"===t.headerPosition?t.style.width=t._dragDetails.width+"px":t.style.height=t._dragDetails.height+"px");t._dragDetails.resized&&(t.style.width=t._dragDetails.width+"px",t.style.height=t._dragDetails.height+"px")}}toggle(){const e=this;e.opened?e.close():e.open()}openModal(){this.modal=!0,this.open()}open(e){const t=this;if(e||t.$.hasClass("smart-visibility-hidden")){if(t.isCompleted){if(t.$.fireEvent("opening").defaultPrevented)return;t.$.removeClass("smart-visibility-hidden"),t.opened=!0,t.$.fireEvent("open")}else t.$.removeClass("smart-visibility-hidden"),t.opened=!0;t.bringToFront(),t._setModal(),t._handleActiveState(),t.hasAnimation?t.addEventListener("transitionend",a):a()}function a(e){if(!t.hasAnimation||e&&e.target===t){if(t.removeEventListener("transitionend",a),t._onOpenCallback)return void t._onOpenCallback();t.focus()}}}_setupDismissTargets(){const e=this;if(e.querySelector('[data-dismiss="modal"]')){const t=e.querySelectorAll('[data-dismiss="modal"]'),a=()=>{e.close()};for(let e=0;e<t.length;e++)t[e].removeEventListener("click",a,null),t[e].addEventListener("click",a)}}pin(){this.pinned=!0}unpin(){this.pinned=!1}_applyLayoutTemplate(e,t){const a=this;if(!t)return e.innerHTML="",void(e===a.$.header&&a.label&&(e.innerHTML=a.label));"content"in document.createElement("template")?(t instanceof HTMLTemplateElement||(t=document.getElementById(t)),null!==t&&"content"in t?(e.innerHTML="",e.appendChild(document.importNode(t.content,!0))):a.error(a.localize("invalidTemplate",{elementType:a.nodeName.toLowerCase(),property:e===a.$.footer?"footerTemplate":"headerTemplate"}))):a.error(a.localize("htmlTemplateNotSuported",{elementType:a.nodeName.toLowerCase()}))}_cancelDragging(e){const t=this;if(t._dragDetails&&t._dragDetails.started&&"drag"===t._dragDetails.type){if(!e){const a=t.getBoundingClientRect();e={pageX:a.left,pageY:a.top}}t.$.fireEvent("dragEnd",{left:e.pageX,top:e.pageY}),t.removeAttribute("dragged"),t._dragDetails.started=!1,delete t._mouseManipulation}}_documentFocusInEventHandler(e){const t=this;t._changingFocus&&(t.contains(e.target)||t.contains(e.composedPath()[0])||t.focus(),delete t._changingFocus)}_downHandler(e){const t=this;let a=Smart.Utilities.Core.isMobile?document.elementFromPoint(e.pageX-window.pageXOffset,e.pageY-window.pageYOffset):e.originalEvent.target;if((t.shadowRoot||t.isInShadowDOM)&&(a=e.originalEvent.composedPath()[0]),e.stopPropagation(),t.disabled||!Smart.Utilities.Core.isMobile&&1!==e.which)return;if(t._tabsWindow&&(t._tabsWindow._isAutoHideWindowClicked=!0),t.hasAttribute("ontop")||t.bringToFront(),a.closest&&a.closest(".smart-buttons-container")===t.$.buttonsContainer){if(t._buttonPressed=a.closest(".smart-button"),t._buttonPressed)return}else if(a.getRootNode()&&a.getRootNode().host&&(t._buttonPressed=a.getRootNode().host,t._buttonPressed.closest(".smart-buttons-container")===t.$.buttonsContainer))return;t._isWindowContentClicked=a.closest(".smart-content");let i=t.closest("smart-docking-layout");if(t.isInShadowDOM&&!i){let e=t.getRootNode().host;for(;e&&(i=e.closest("smart-docking-layout"),!i)&&e.getRootNode();)e=e.getRootNode().host}if(!(t instanceof Smart.TabsWindow&&i&&i.disabled)){if(t._handleActiveState(),!(t instanceof Smart.TabsWindow&&i))return a.closest(".smart-header-section")===t.$.headerSection&&(void 0===t._dblClickDetails&&(t._dblClickDetails={clicks:0}),clearTimeout(t._dblClickDetails.timeOut),t._dblClickDetails.clicks++,t._dblClickDetails.timeOut=setTimeout((function(){t._dblClickDetails&&(t._dblClickDetails.clicks=0)}),300),2===t._dblClickDetails.clicks)?(t._headerDblCickHandler(e),void(t._dblClickDetails.clicks=0)):void(t.maximized||(Smart.Utilities.Core.isMobile&&t._moveHandler(e),!t.pinned&&!t.minimized&&t.$.container.className.indexOf("smart-window-resizing")<0&&(a=a.closest(".smart-header-section"),a&&a===t.$.headerSection&&(t._mouseManipulation=!0,t._setDragDetails("drag",e))),"none"!==t.resizeMode&&t.$.container.className.indexOf("smart-window-resizing")>-1&&(t._mouseManipulation=!0,t._setDragDetails("resize",e))));t.$.hasClass("smart-docking-layout-auto-hide-window")&&(Smart.Utilities.Core.isMobile&&t._moveHandler(e),"none"!==t.resizeMode&&t.$.container.className.indexOf("smart-window-resizing")>-1&&(t._mouseManipulation=!0,t._setDragDetails("resize",e)))}}_documentMoveHandler(e){const t=this;!t._dragDetails||!t._dragDetails.started||t.minimized||!t._mouseManipulation||Math.abs(e.pageX-t._dragDetails.x)<=5&&Math.abs(e.pageY-t._dragDetails.y)<=5||(t.hasAttribute("dragged")||t.hasAttribute("resized")||t.$.fireEvent(t._dragDetails.type+"Start",{left:e.pageX,top:e.pageY,width:t.offsetWidth,height:t.offsetHeight}),e.stopPropagation(),"drag"!==t._dragDetails.type||t.pinned?(t._dragDetails.resized=!0,t._resize(t._dragDetails.side,e),t._dragDetails.x=Math.max(t._windowParent.offsetLeft+t._dragDetails.left,Math.min(t._windowParent.offsetLeft+t._dragDetails.left+(t._dragDetails.side.toLowerCase().indexOf("left")>-1?0:t._dragDetails.newWidth),e.pageX)),t._dragDetails.y=Math.max(t._windowParent.offsetTop+t._dragDetails.top,Math.min(t._windowParent.offsetTop+t._dragDetails.top+(t._dragDetails.side.toLowerCase().indexOf("top")>-1?0:t._dragDetails.newHeight),e.pageY))):(t.setAttribute("dragged",""),t._snapDummy&&t.$.hasClass("smart-window-snapped-"+t._snapDummy._position)&&(t.$.removeClass("smart-window-snapped-"+t._snapDummy._position),t.style.right=t.style.top=t.style.left="",t.collapsed||(t.style.height=t._dragDetails.height+"px",t.style.width=t._dragDetails.width+"px")),t._drag(e,"both"),t._dragDetails.x=Math.max(t._windowParent.offsetLeft+t._dragDetails.offsetX-t._windowParent.scrollElement.scrollLeft,Math.min(t._windowParent.offsetLeft+t._windowParent.element.offsetWidth-(t._windowParent.element.offsetWidth-t.offsetLeft)+t._dragDetails.offsetX,e.pageX)),t._dragDetails.y=Math.max(t._windowParent.offsetTop+t._dragDetails.offsetY-t._windowParent.scrollElement.scrollTop,Math.min(t._windowParent.offsetTop+t._windowParent.element.offsetHeight-(t._windowParent.element.offsetHeight-t.offsetTop)+t._dragDetails.offsetY,e.pageY)),e.pageX>=t._windowParent.offsetLeft+t._windowParent.scrollElement.scrollWidth-1?t._handleSnapping("right"):e.pageY<=t._windowParent.offsetTop?t._handleSnapping("top"):e.pageX<=t._windowParent.offsetLeft?t._handleSnapping("left"):t._handleSnapping()))}_documentUpHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(t.disabled)return t.removeAttribute("active"),delete t._buttonPressed,void delete t._isWindowContentClicked;if(t._dragDetails&&t._dragDetails.started&&(t.hasAttribute("resized")&&(t.$.fireEvent(t._dragDetails.type+"End",{left:e.pageX,top:e.pageY,width:t._dragDetails.newWidth,height:t._dragDetails.newHeight}),t.removeAttribute("resized"),t._handleWindowResizeDummy(),t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right")),setTimeout((function(){t.$.removeClass("no-transition")}),20),t.hasAttribute("dragged")&&(t.$.fireEvent(t._dragDetails.type+"End",{left:e.pageX,top:e.pageY}),t.removeAttribute("dragged")),t._dragDetails.started=!1,delete t._mouseManipulation),t._snapDummy&&!t._snapDummy.classList.contains("smart-visibility-hidden")){switch(t._snapDummy._position){case"left":case"top":t.style.left=t.style.top="0",t.style.right="auto";break;case"right":t.style.left="auto",t.style.top=t.style.right="0"}t.style.width="top"===t._snapDummy._position?"100%":"50%",t.style.height="100%",t.$.addClass("smart-window-snapped-"+t._snapDummy._position),t._handleSnapping()}t._modal&&a===t._modal&&!t._isWindowContentClicked&&(t.closeOnMaskClick?t.close():t.focus()),t._isWindowButton(a)&&t.focus(),delete t._isWindowContentClicked,delete t._buttonPressed;const i=t.shadowRoot&&t._windowParent.element&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;if(!t.hasAttribute("active")||i===t)return;if(!a.closest)return;let n=a.closest(".smart-window");for(;n&&n!==t;)n=n.parentElement,n&&(n=n.closest(".smart-window"));t.opened&&n!==t&&t.removeAttribute("active")}_documentSelectStartHandler(e){this._dragDetails&&this._dragDetails.started&&e.preventDefault()}_drag(e,t){const a=this;if(!e||a.pinned||a.maximized)return;let i,n;a._dragDetails&&a._dragDetails.started||a._setDragDetails("drag",e),a.$.addClass("no-transition"),"object"==typeof e?(i=e.pageX-a._dragDetails.x,n=e.pageY-a._dragDetails.y):i=n=e;const o=Math.max(a._windowParent.element.clientHeight,a._windowParent.scrollElement.scrollHeight),s=Math.max(a._windowParent.element.clientWidth,a._windowParent.scrollElement.scrollWidth);switch(t){case"horizontal":a._dragDetails.windowX=Math.max(0,Math.min(a._dragDetails.windowX+i,s-a.offsetWidth)),a.style.left=a._dragDetails.windowX+"px";break;case"vertical":a._dragDetails.windowY=Math.max(0,Math.min(a._dragDetails.windowY+n,o-a.offsetHeight)),a.style.top=a._dragDetails.windowY+"px";break;case"both":a._dragDetails.windowX=Math.max(0,Math.min(a._dragDetails.windowX+i,s-a.offsetWidth)),a._dragDetails.windowY=Math.max(0,Math.min(a._dragDetails.windowY+n,o-a.offsetHeight)),a.style.left=a._dragDetails.windowX+"px",a.style.top=a._dragDetails.windowY+"px"}a._dragDetails.top=a.offsetTop,a._dragDetails.left=a.offsetLeft}_dragStartHandler(e){this._dragDetails&&this._dragDetails.started&&e.preventDefault()}_focusHandler(e){const t=this;"focus"===e.type?(t.setAttribute("focus",""),t.bringToFront()):t._buttonPressed||(t.removeAttribute("focus"),t._dragDetails&&t._dragDetails.started&&t._handleWindowResizeDummy())}_getAllMinimizedWindows(e){const t=this;let a=[];e||(e=t._windowParent.element);const i=e.querySelectorAll("smart-window");for(let e=0;e<i.length;e++)i[e]!==t&&i[e].hasAttribute("minimized")&&a.push(i[e]);return a.sort((function(e,t){let a=e.getBoundingClientRect(),i=t.getBoundingClientRect();return a.right-i.right})),a}_handleSnapping(e){const t=this;e?t.disableSnap||t.collapsed||(t._snapDummy||(t._snapDummy=document.createElement("div"),t._snapDummy.addEventListener("transitionend",(function(){t._snapDummy.classList.contains("smart-visibility-hidden")&&t._snapDummy.parentElement&&t._snapDummy.parentElement.removeChild(t._snapDummy)}))),t._snapDummy.className="smart-window-snap-"+e+"-feedback",t._snapDummy._position=e,t._snapDummy.parentElement||t._windowParent.element.appendChild(t._snapDummy)):t._snapDummy&&t._snapDummy.parentElement&&t._snapDummy.classList.add("smart-visibility-hidden")}_headerDblCickHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;a!==t.$.headerSection&&a!==t.$.header||t.$.maximizeButton&&0===t.$.maximizeButton.offsetHeight||(t.maximized?t.restore():t.maximize())}_isWindowButton(e){const t=this;for(;e&&(e.closest&&e.closest(".smart-buttons-container"))!==t.$.buttonsContainer;)e=e.getRootNode().host;if(!e)return;const a=/smart-(\w+[-]*\w*)-button/gi;if((e=e.closest(".smart-button"))&&e===t._buttonPressed)switch(e){case t.$.closeButton:return t.close(),!0;case t.$.collapseButton:return t.collapsed?t.expand():t.collapse(),!0;case t.$.maximizeButton:return t.maximized?t.restore():t.maximize(),!0;case t.$.minimizeButton:return t.minimized?t.restore():t.minimize(),!0;case t.$.pinButton:return t.pinned?t.unpin():t.pin(),!0;default:if(!a.test(e.className))return;return t.$.fireEvent(Smart.Utilities.Core.toCamelCase(e.className.match(a).toString().replace("smart-","").replace("-button","")),{button:e}),!0}}_keyDownHandler(e){const t=this;if(delete t._changingFocus,t.disabled||(t.hasAttribute("dragged")||t.hasAttribute("resized"))&&t._mouseManipulation)return;const a="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,i=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;if(!t.disableKeyboard)switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":{if(t.minimized||i!==t)return;let n=e.key.indexOf("Right")>-1||e.key.indexOf("Left")>-1;e.preventDefault();const o=(t.isInShadowDOM?t.getRootNode().host:t).closest("smart-docking-layout");if(!n&&e.altKey&&!(t instanceof Smart.TabsWindow&&o))return void("ArrowUp"===e.key?t.maximize():t.restore());if(t.maximized)return;if(t.$.addClass("no-transition"),e.ctrlKey&&"none"!==t.resizeMode&&!t.collapsed)return n=-1===["horizontal","vertical","both"].indexOf(t.resizeMode)?t.resizeMode:n?"right":"bottom",t.hasAttribute("dragged")&&t._cancelDragging(e),t.hasAttribute("resized")||t.$.fireEvent("resizeStart",{position:{x:e.pageX,y:e.pageY}}),void t._resize(n,a);t.pinned||(t.hasAttribute("dragged")||(t.setAttribute("dragged",""),t.$.fireEvent("dragStart",{left:e.pageX,top:e.pageY})),t._drag(a,n?"horizontal":"vertical")),t.$.removeClass("no-transition");break}case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"p":e.altKey&&t.headerButtons.indexOf("pin")>-1&&(t.pinned?t.unpin():t.pin());break;case"c":e.altKey&&t.headerButtons.indexOf("collapse")>-1&&(t.collapsed?t.expand():t.collapse());break;case"m":e.altKey&&t.headerButtons.indexOf("minimize")>-1&&(t.minimized?t.restore():t.minimize());break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}}_keyUpHandler(e){const t=this;if(e.key&&!t.disableKeyboard){if("Control"===e.key&&t._dragDetails&&t.hasAttribute("resized")&&!t._mouseManipulation){if(!t._dragDetails.started)return;"drag"!==t._dragDetails.type&&(t.removeAttribute("resized"),t.$.fireEvent("resizeEnd",{left:e.pageX,top:e.pageY,width:t._dragDetails.newWidth,height:t._dragDetails.newHeight}),t._handleWindowResizeDummy()),t._dragDetails.started=!1}e.key.indexOf("Arrow")>-1&&t.hasAttribute("dragged")&&!t._mouseManipulation&&t._cancelDragging(e)}}_mouseWheelHandler(e){const t=this;!t.disabled&&t._dragDetails&&t._dragDetails.started&&(e.deltaY<0&&t._windowParent.scrollElement.scrollTop+e.deltaY<=0?t.style.top=Math.max(0,t._dragDetails.windowY)+"px":e.deltaY>0&&(t._dragDetails.windowY+t.offsetHeight+e.deltaY>=t._windowParent.scrollElement.scrollHeight||t._windowParent.scrollElement.scrollTop+t._windowParent.element.clientHeight===t._windowParent.scrollElement.scrollHeight)||("drag"===t._dragDetails.type?(t._dragDetails.windowY+=e.deltaY,t.style.top=t._dragDetails.windowY+"px"):(t._dragDetails.height+=e.deltaY,t.style.height=t._dragDetails.height+"px")))}_moveHandler(e){const t=this;if(!(t.disabled||t.collapsed||t.maximized||t.minimized||(Smart.Utilities.Core.isMobile&&navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&t.hasAttribute("dragged")&&e.originalEvent.preventDefault(),t._mouseManipulation||(t.$.container.className.indexOf("smart-window-resizing")>-1&&t.$.container.classList.remove("smart-window-resizing-bottom-right","smart-window-resizing-top-right","smart-window-resizing-top-left","smart-window-resizing-bottom-left","smart-window-resizing-top","smart-window-resizing-bottom","smart-window-resizing-left","smart-window-resizing-right"),"none"===t.resizeMode)))){const a=t.getBoundingClientRect(),i=e.clientY<a.top+10,n=e.clientY>a.bottom-10,o=e.clientX>a.right-10,s=e.clientX<a.left+10;switch(t.resizeMode){case"none":break;case"both":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-bottom-right"));if(s||o)return i?void t.$.container.classList.add("smart-window-resizing-top-"+(s?"left":"right")):n?void t.$.container.classList.add("smart-window-resizing-bottom-"+(s?"left":"right")):void t.$.container.classList.add("smart-window-resizing-"+(s?"left":"right"));if(i||n){if(o)return void t.$.container.classList.add("smart-window-resizing-"+(i?"top-right":"bottom-right"));if(s)return void t.$.container.classList.add("smart-window-resizing-"+(i?"top-left":"bottom-left"));t.$.container.classList.add("smart-window-resizing-"+(i?"top":"bottom"))}break;case"horizontal":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-right"));if(s)return void t.$.container.classList.add("smart-window-resizing-left");o&&t.$.container.classList.add("smart-window-resizing-right");break;case"vertical":if(t.resizeIndicator)return void(n&&o&&t.$.container.classList.add("smart-window-resizing-bottom"));if(i)return void t.$.container.classList.add("smart-window-resizing-top");n&&t.$.container.classList.add("smart-window-resizing-bottom");break;case"top":if(i){if(t.resizeIndicator&&!s)return;t.$.container.classList.add("smart-window-resizing-top")}break;case"bottom":if(n){if(t.resizeIndicator&&!o)return;t.$.container.classList.add("smart-window-resizing-bottom")}break;case"left":if(s){if(t.resizeIndicator&&!i)return;t.$.container.classList.add("smart-window-resizing-left")}break;case"right":if(o){if(t.resizeIndicator&&!n)return;t.$.container.classList.add("smart-window-resizing-right")}}}}_handleActiveState(){const e=this,t=document.querySelectorAll(".smart-window");for(let a=0;a<t.length;a++)t[a].contains(e)||e.contains(t[a])||(t[a].removeAttribute("active"),t[a].removeAttribute("focus"));e.setAttribute("active","")}_handleWindowResizeDummy(){const e=this;if(e._resizeDummy||(e._resizeDummy=document.createElement("div"),e._resizeDummy.classList.add("smart-window-resize-feedback")),!e.hasAttribute("resized"))return e._resizeDummy&&e._resizeDummy.remove(),void(!e.liveResize&&"resize"===e._dragDetails.type&&e._dragDetails.started&&(e.style.top=e._dragDetails.top+"px",e.style.left=e._dragDetails.left+"px",e.style.width=e._dragDetails.newWidth+"px",e.style.height=e._dragDetails.newHeight+"px"));e._resizeDummy.parentElement||e._resizeDummy.getRootNode().host||(e._resizeDummy.style.width=e.offsetWidth+"px",e._resizeDummy.style.height=e.offsetHeight+"px",e._resizeDummy.style.top=e.offsetTop+"px",e._resizeDummy.style.left=e.offsetLeft+"px",e._windowParent.element.appendChild(e._resizeDummy))}_resize(e,t){const a=this;let i;if((!a._dragDetails||a._dragDetails&&"drag"===a._dragDetails.type)&&a._setDragDetails("resize"),!a._dragDetails)return;a._dragDetails.started=!0,a.hasAttribute("resized")||(a.setAttribute("resized",""),a.hasAnimation&&a.$.addClass("no-transition")),a.liveResize||a._handleWindowResizeDummy();const n=a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)?"snapWindowWidth":"width";switch(e){case"left":i="object"==typeof t?t.pageX-a._dragDetails.x:t,i=i>0?Math.min(i,a._dragDetails[n]-a._dragDetails.minWidth):-1*Math.min(a._dragDetails.maxWidth?a._dragDetails.maxWidth-a._dragDetails[n]:a._dragDetails.left,Math.abs(i)),a._dragDetails[n]=Math.min(a._dragDetails[n]+a._dragDetails.left-a._windowParent.scrollElement.scrollLeft,a._dragDetails[n]-i),a._dragDetails.windowX=Math.max(a._windowParent.scrollElement.scrollLeft,a._dragDetails.windowX+i),"object"!=typeof t&&(a._dragDetails[n]=Math.max(a._dragDetails[n],a._dragDetails.minWidth)),a._dragDetails[n]>=a._dragDetails.minWidth&&(a._dragDetails.left=a._dragDetails.windowX,a._dragDetails.newWidth=a._dragDetails[n]);break;case"right":{const e=a._windowParent.element.clientWidth!==a._windowParent.element.offsetWidth?a._windowParent.borderWidth:0,n=a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)?"snapWindowWidth":"width";i="object"==typeof t?t.pageX-a._dragDetails.x:t,i>0&&a._dragDetails.maxWidth&&(i=Math.min(a._dragDetails.maxWidth-a._dragDetails[n],i)),a._dragDetails[n]=Math.min(a._windowParent.element.clientWidth+a._windowParent.scrollElement.scrollLeft-a._dragDetails.left-e,Math.max(0,a._dragDetails[n]+i)),"object"!=typeof t&&(a._dragDetails[n]=Math.max(a._dragDetails[n],a._dragDetails.minWidth)),a._dragDetails.left=a.offsetLeft,a._dragDetails.newWidth=Math.max(a._dragDetails.minWidth,a._dragDetails[n]);break}case"top":a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)&&(a._dragDetails.height=a._dragDetails.snapWindowHeight),i="object"==typeof t?t.pageY-a._dragDetails.y:t,i=i>0?Math.min(i,a._dragDetails.height-a._dragDetails.minHeight):-1*Math.min(a._dragDetails.maxHeight?a._dragDetails.maxHeight-a._dragDetails.height:a._dragDetails.top,Math.abs(i)),a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.min(a._dragDetails.height+a._dragDetails.top-a._windowParent.scrollElement.scrollTop,a._dragDetails.height-i),a._dragDetails.windowY=Math.max(a._windowParent.scrollElement.scrollTop,a._dragDetails.windowY+i),"object"!=typeof t&&(a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.max(a._dragDetails.height,a._dragDetails.minHeight)),a._dragDetails.height>=a._dragDetails.minHeight&&(a._dragDetails.top=a._dragDetails.windowY,a._dragDetails.newHeight=a._dragDetails.height),a._dragDetails.newWidth=Math.max(a._dragDetails[n],a._dragDetails.newWidth);break;case"bottom":a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position)&&(a._dragDetails.height=a._dragDetails.snapWindowHeight),i="object"==typeof t?t.pageY-a._dragDetails.y:t,i>0&&a._dragDetails.maxHeight&&(i=Math.min(a._dragDetails.maxHeight-a._dragDetails.height,i)),a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.min(a._windowParent.element.clientHeight+a._windowParent.scrollElement.scrollTop-a._dragDetails.top-a._windowParent.borderWidth,Math.max(0,a._dragDetails.height+i)),"object"!=typeof t&&(a._dragDetails.snapWindowHeight=a._dragDetails.height=Math.max(a._dragDetails.height,a._dragDetails.minHeight)),a._dragDetails.newHeight=Math.max(a._dragDetails.minHeight,a._dragDetails.height),a._dragDetails.newWidth=Math.max(a._dragDetails[n],a._dragDetails.newWidth);break;case"bottomLeftCorner":a._resize("bottom",t),a._resize("left",t);break;case"bottomRightCorner":a._resize("bottom",t),a._resize("right",t);break;case"topLeftCorner":a._resize("top",t),a._resize("left",t);break;case"topRightCorner":a._resize("top",t),a._resize("right",t)}const o=a.liveResize?a:a._resizeDummy;a._dragDetails.newHeight=Math.max(a._dragDetails.snapWindowHeight,a._dragDetails.newHeight),o.style.top=a._dragDetails.top+"px",o.style.left=a._dragDetails.left+"px",o.style.width=a._dragDetails.newWidth+"px",o.style.height=a._dragDetails.newHeight+"px"}_restoreFromMinimization(){const e=this;e.minimized=!1,e.style.width=e.style.height=e.style.top=e.style.left="",e._refreshMinimizedWindowsPosition()}_refreshMinimizedWindowsPosition(){const e=this,t=e._getAllMinimizedWindows();if(0===t.length)return;let a;t[0].style.left="5px";for(let i=1;i<t.length;i++)parseFloat(t[i-1].style.left)+t[i-1].offsetWidth+t[i].offsetWidth+10<e._windowParent.element.clientWidth?(t[i].style.left=parseFloat(t[i-1].style.left)+t[i-1].offsetWidth+5+"px",t[i].style.top=t[i-1].offsetTop+"px",a=t[i]):(t[i].style.left=parseFloat(a.style.left)+"px",t[i].style.top=a.offsetTop+"px")}_setHeaderButtons(){const e=this,t=e.headerButtons,a=e.$.buttonsContainer.children,i=function(t){const a=e.$.buttonsContainer.getElementsByClassName("smart-"+(t+"").split(/(?=[A-Z])/).join("-").toLowerCase()+"-button")[0];return a&&a.classList.remove("smart-hidden"),a};for(let e=0;e<a.length;e++)a[e].classList.add("smart-hidden");if(t.length>0)for(let a=0;a<t.length;a++){let n=i(t[a]);if(!n){const e=(t[a]+"").split(/(?=[A-Z])/);n=document.createElement("button"),n.setAttribute("aria-label",e.map((e=>e.slice(0,1).toUpperCase()+e.slice(1))).join(" ")),n.classList.add("smart-"+e.join("-").toLowerCase()+"-button","smart-button","smart-element")}e.$.buttonsContainer.insertBefore(n,e.$.buttonsContainer.firstElementChild)}}_setDragDetails(e,t){const a=this;if(a._dragDetails||(a._dragDetails={}),void 0===a._dragDetails.minWidth||void 0===a._dragDetails.minHeight||void 0===a._dragDetails.maxWidth||void 0===a._dragDetails.maxHeight){const e=getComputedStyle(a);a._dragDetails.minWidth=parseFloat(e.getPropertyValue("min-width"))||0,a._dragDetails.minHeight=parseFloat(e.getPropertyValue("min-height"))||0,a._dragDetails.maxWidth=parseFloat(e.getPropertyValue("max-width"))||0,a._dragDetails.maxHeight=parseFloat(e.getPropertyValue("max-height"))||0}a._dragDetails.windowX=a.offsetLeft,a._dragDetails.windowY=a.offsetTop;const i=a.getBoundingClientRect();if(a._snapDummy&&a.$.hasClass("smart-window-snapped-"+a._snapDummy._position))"right"===a.headerPosition&&a.collapsed&&(a._dragDetails.offsetX=i.left+a.offsetWidth-t.clientX);else{const n=a.parentElement===document.body?document.documentElement.getBoundingClientRect():a.parentElement?a.parentElement.getBoundingClientRect():document.documentElement.getBoundingClientRect(),o=window.scrollX||window.pageXOffset,s=window.scrollY||window.pageYOffset;a._windowParent.offsetLeft=n.left+o,a._windowParent.offsetTop=n.top+s,t&&"object"==typeof t&&(a._dragDetails.offsetX=t.clientX-i.left,a._dragDetails.offsetY=t.clientY-i.top),a.collapsed||(a.hasAnimation&&"minimize"===e?(a._dragDetails.width=a._dragDetails.width?a._dragDetails.width:a.offsetWidth,a._dragDetails.height=a._dragDetails.height?a._dragDetails.height:a.offsetHeight):(a._dragDetails.width=a.offsetWidth,a._dragDetails.height=a.offsetHeight),(a.style.width||a.style.height)&&(a._dragDetails.resized=!0))}if("minimize"!==e&&e&&(a._dragDetails.type=e,a._dragDetails.started=!0,a._dragDetails.snapWindowWidth=a.offsetWidth,a._dragDetails.snapWindowHeight=a.offsetHeight,t&&"object"==typeof t?(a._dragDetails.x=t.pageX,a._dragDetails.y=t.pageY):(a._dragDetails.x=a.offsetLeft,a._dragDetails.y=a.offsetTop),"resize"===e)){if("none"===a.resizeMode)return void delete a._dragDetails;a._dragDetails.top=a.offsetTop,a._dragDetails.left=a.offsetLeft,a._dragDetails.newWidth=a._dragDetails.width,a._dragDetails.newHeight=a._dragDetails.height,a.$container.hasClass("smart-window-resizing-right")?a._dragDetails.side="right":a.$container.hasClass("smart-window-resizing-left")?a._dragDetails.side="left":a.$container.hasClass("smart-window-resizing-top")?a._dragDetails.side="top":a.$container.hasClass("smart-window-resizing-bottom")?a._dragDetails.side="bottom":a.$container.hasClass("smart-window-resizing-top-left")?a._dragDetails.side="topLeftCorner":a.$container.hasClass("smart-window-resizing-bottom-left")?a._dragDetails.side="bottomLeftCorner":a.$container.hasClass("smart-window-resizing-top-right")?a._dragDetails.side="topRightCorner":a.$container.hasClass("smart-window-resizing-bottom-right")&&(a._dragDetails.side="bottomRightCorner")}}_setElementParent(e){const t=this;if(t._windowParent.element=void 0,t._windowParent.parent&&!t._windowParent.parent.querySelectorAll("smart-window, smart-dialog-window, smart-progress-window, smart-wait-window, smart-alert-window, smart-prompt-window, smart-multiline-prompt-window")&&(t._windowParent.parent.style.position=""),e instanceof HTMLElement)t._windowParent.element=e;else if("string"==typeof e)if("body"===e){const e=t.getRootNode();t._windowParent.element=e&&e.host?t.getShadowRootOrBody():document.body}else t._windowParent.element=document.getElementById(e);if(t._windowParent.element||(t._windowParent.initialParent?t._windowParent.element=t._windowParent.initialParent.parentElement?t._windowParent.initialParent:t.getShadowRootOrBody():t._windowParent.element=t.getShadowRootOrBody()),t.parentElement!==t._windowParent.element&&t._windowParent.element.appendChild(t),t._windowParent.element===document.body)t._windowParent.element=document.documentElement,t._windowParent.scrollElement=document.scrollingElement,t._windowParent.parent=document.body,t._windowParent.borderWidth=0;else{if(t.parentElement instanceof Smart.Window&&!t.parentElement.isCompleted)return void t.parentElement.whenRendered((function(){t.parentElement.appendChild(t),t._setElementParent(t.windowParent)}));t._windowParent.element instanceof Smart.Window&&(t._windowParent.element=t._windowParent.element.$.content);const e=getComputedStyle(t.parentElement),a=e.getPropertyValue("position");t._windowParent.borderWidth=2*parseInt(e.getPropertyValue("border-width")||0),t._windowParent.parent=t.parentElement,t._windowParent.scrollElement=t._windowParent.element,"static"===a&&(t.parentElement.style.position="relative")}t._setModal(),t.style.left&&t.offsetLeft>t._windowParent.scrollElement.scrollWidth&&(t.style.left=t._windowParent.scrollElement.scrollWidth-t.offsetWidth+"px"),t.style.top&&t.offsetTop>t._windowParent.scrollElement.scrollHeight&&(t.style.top=t._windowParent.scrollElement.scrollHeight-t.offsetHeight+"px")}_setModal(){const e=this;if(delete e._changingFocus,e._windowParent.element)if(e.modal)if(e._modal||(e._modal=document.createElement("div"),e._modal.classList.add("smart-modal")),e._windowParent.parent!==document.body?e._modal.setAttribute("nested-modal",""):e._modal.removeAttribute("nested-modal"),e._modal._window=e,e.opened&&!e._modal.parentElement){const t=parseInt(getComputedStyle(e).getPropertyValue("z-index"));isNaN(t)||(e._modal.style.zIndex=t-1),e.parentElement.insertBefore(e._modal,e)}else e._modal.parentElement&&e._modal.parentElement.removeChild(e._modal);else e._modal&&e._modal.parentElement&&(e._modal.parentElement.removeChild(e._modal),delete e._modal)}}),Smart("smart-dialog-window",class extends Smart.Window{static get properties(){return{cancelLabel:{value:"Cancel",type:"string"},confirmLabel:{value:"Ok",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},headerButtons:{value:["close"],type:"array"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0}}}static get listeners(){return{"footer.click":"_footerClickHandler"}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="pinButton" class="smart-pin-button" aria-label="Pin"></button>\n <button id="collapseButton" class="smart-button smart-element smart-collapse-button" aria-label="Collapse"></button>\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button" aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}_createElement(){const e=this;e.setAttribute("role","alertdialog"),e.setAttribute("aria-describedby",e.$.content.id)}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm"):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel")}_keyDownHandler(e){const t=this;if(delete t._changingFocus,t.disabled||(t.hasAttribute("dragged")||t.hasAttribute("resized"))&&t._mouseManipulation)return;if(t.disableKeyboard)return;e.stopPropagation();const a="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,i=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":{if(t.minimized||i!==t)return;const n=e.key.indexOf("Right")>-1||e.key.indexOf("Left")>-1;if(e.preventDefault(),!n&&e.altKey)return void("ArrowUp"===e.key?t.maximize():t.restore());if(t.$.addClass("no-transition"),t.maximized)return;if(e.ctrlKey&&"none"!==t.resizeMode)return t.hasAttribute("dragged")&&t._cancelDragging(e),t.hasAttribute("resized")||t.$.fireEvent("resizeStart",{position:{x:e.pageX,y:e.pageY}}),void t._resize(n?"right":"bottom",a);t.pinned||(t.hasAttribute("dragged")||(t.setAttribute("dragged",""),t.$.fireEvent("dragStart",{left:e.pageX,top:e.pageY})),t._drag(a,n?"horizontal":"vertical")),t.$.removeClass("no-transition");break}case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}}}),Smart("smart-alert-window",class extends Smart.DialogWindow{static get properties(){return{headerButtons:{value:[],type:"array"}}}_createElement(){const e=this;e.setAttribute("role","alertdialog"),e.setAttribute("aria-describedby",e.$.content.id)}}),Smart("smart-prompt-window",class extends Smart.DialogWindow{static get properties(){return{autoComplete:{allowedValues:["none","manual","auto","inline"],type:"string",value:"manual"},confirmLabel:{value:"Ok",type:"string"},cancelLabel:{value:"Cancel",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},displayMode:{value:"default",allowedValues:["default","escaped"],type:"string"},headerButtons:{value:["close"],type:"array"},form:{value:"",type:"string"},hint:{value:null,type:"any?"},maxLength:{value:null,type:"number?"},minLength:{value:2,type:"number"},messages:{extend:!0,value:{en:{missingReference:"{{elementType}}: Missing reference to {{files}}."}},type:"object"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},name:{value:"",type:"string"},placeholder:{value:"",type:"string"},promptLabel:{value:"",type:"string?"},required:{value:!1,type:"boolean"},requiredMessage:{value:"",type:"string"},selectAllOnFocus:{value:!1,type:"boolean"},value:{value:"",type:"string"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-text-box id="textBox"\n animation="[[animation]]"\n auto-complete="[[autoComplete]]"\n max-length="[[maxLength]]"\n value="{{value}}"\n form="[[form]]"\n label="[[promptLabel]]"\n hint="[[hint]]"\n display-mode="[[displayMode]]"\n max-length="[[maxLength]]"\n placeholder="[[placeholder]]"\n required="[[required]]"\n required-message="[[requiredMessage]]"\n select-all-on-focus="[[selectAllOnFocus]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n </smart-text-box>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button flat">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button flat">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}static get listeners(){return{"footer.click":"_footerClickHandler"}}static get requires(){return{"Smart.TextBox":"smart.textbox.js"}}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm",{value:t.$.textBox.value}):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel",{value:t.$.textBox.value})}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;if(t.disableKeyboard)return;e.stopPropagation();const i="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,n=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(n!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",i),void a();t._drag(i,"vertical");break;case"ArrowLeft":case"ArrowRight":if(n!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",i),void a();t._drag(i,"horizontal"),t.$.removeClass("no-transition");break;case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}}),Smart("smart-multiline-prompt-window",class extends Smart.PromptWindow{static get properties(){return{autoCapitalize:{value:"none",allowedValues:["none","words","characters"],type:"string"},autoExpand:{value:!1,type:"boolean"},headerButtons:{value:["close"],type:"array"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},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"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},wrap:{value:"soft",allowedValues:["hard","soft","off"],type:"string"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-multiline-text-box id="textBox"\n animation="[[animation]]"\n horizontal-scroll-bar-visibility= "[[horizontalScrollBarVisibility]]"\n vertical-scroll-bar-visibility= "[[verticalScrollBarVisibility]]"\n auto-capitalize="[[autoCapitalize]]"\n auto-expand = "[[autoExpand]]"\n selection-direction= "[[selectionDirection]]"\n selection-end= "[[selectionEnd]]"\n selection-start="[[selectionStart]]"\n spell-check= "[[spellCheck]]"\n wrap="[[wrap]]"\n max-length="[[maxLength]]"\n value="{{value}}"\n form="[[form]]"\n label="[[promptLabel]]"\n hint="[[hint]]"\n display-mode="[[displayMode]]"\n max-length="[[maxLength]]"\n placeholder="[[placeholder]]"\n required="[[required]]"\n required-message="[[requiredMessage]]"\n select-all-on-focus="[[selectAllOnFocus]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n </smart-multiline-text-box>\n </div>\n <div id="footer" class="smart-footer">\n <button id="confirmButton" class="smart-button smart-element smart-confirm-button flat">[[confirmLabel]]</button>\n <button id="cancelButton" class="smart-button smart-element smart-cancel-button flat">[[cancelLabel]]</button>\n </div>\n </div>\n </div>'}static get listeners(){return{"footer.click":"_footerClickHandler"}}static get requires(){return{"Smart.MultilineTextBox":"smart.multilinetextbox.js"}}_footerClickHandler(e){const t=this,a=e.target;a.closest(".smart-confirm-button")?t.$.fireEvent("confirm",{value:t.$.textBox.value}):a.closest(".smart-cancel-button")&&t.$.fireEvent("cancel",{value:t.$.textBox.value})}}),Smart("smart-progress-window",class extends Smart.Window{static get properties(){return{completeLabel:{value:"Continue",type:"string"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},headerButtons:{value:["close"],type:"array"},indeterminate:{value:!1,type:"boolean"},inverted:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function"},max:{value:100,type:"number"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},min:{value:0,type:"number"},showProgressValue:{value:!1,type:"boolean"},value:{value:0,type:"number?"}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content" inner-h-t-m-l="[[innerHTML]]">\n <content></content>\n </div>\n <div id="footer" class="smart-footer">\n <smart-progress-bar id="progressBar"\n animation="[[animation]]"\n min="[[min]]"\n max="[[max]]"\n indeterminate="[[inditerminate]]"\n inverted="[[inverted]]"\n format-function="[[formatFunction]]"\n show-progress-value="[[showProgressValue]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]"\n value="{{value}}">\n </smart-progress-bar>\n <button id="completeButton" class="smart-button smart-element smart-complete-button smart-visibility-hidden">[[completeLabel]]</button>\n </div>\n </div>\n </div>'}static get requires(){return{"Smart.ProgressBar":"smart.progressbar.js"}}propertyChangedHandler(e,t,a){const i=this;switch(e){case"value":i._handleCompletion();break;default:super.propertyChangedHandler(e,t,a)}}_createElement(){this.setAttribute("role","dialog"),this._handleCompletion()}_handleCompletion(){const e=this;e.$.completeButton&&(e.value>=e.max?(e.$completeButton.removeClass("smart-visibility-hidden"),e.$progressBar.addClass("smart-visibility-hidden")):(e.$completeButton.addClass("smart-visibility-hidden"),e.$progressBar.removeClass("smart-visibility-hidden")))}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;if(t.disableKeyboard)return;e.stopPropagation();const i="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10,n=t.enableShadowDOM&&t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(n!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",i),void a();t._drag(i,"vertical"),t.$.removeClass("no-transition");break;case"ArrowLeft":case"ArrowRight":if(n!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",i),void a();t._drag(i,"horizontal"),t.$.removeClass("no-transition");break;case"Escape":t.disableEscape||t.headerButtons.indexOf("close")>-1&&t.close();break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}}),Smart("smart-tabs-window",class extends Smart.Window{static get properties(){return{disableSnap:{value:!0,readOnly:!0,type:"boolean"},dropPosition:{value:["all"],type:"array"},addNewTab:{value:!1,type:"boolean"},allowToggle:{value:!1,type:"boolean"},autoHide:{value:!1,type:"boolean"},autoHideWindow:{value:null,type:"any"},dataSource:{value:null,type:"array?",reflectToAttribute:!1},tabCloseButtonMode:{value:"default",allowedValues:["default","selected"],type:"string"},tabCloseButtons:{value:!1,type:"boolean"},messages:{value:{en:{ambiguousIndexes:"smart-tabs: Initially set smart-tab-item indexes are ambiguous and are ignored in favour of the HTML structure.",detailsObjectRequired:'smart-tabs: The method "insert" requires a details Object to be passed as a second argument.',invalidIndex:'smart-tabs: "{{method}}" method accepts an index of type number.',referenceNodeNotChild:"smart-tabs: Passed {{argument}} is not part of this smart-tabs element.",tabItemRequired:'smart-tabs: The method "{{method}}" requires a "smart-tab-item" element to be passed as an argument.'}},type:"object",extend:!0},tabOverflow:{value:"auto",allowedValues:["auto","hidden","scroll"],type:"string"},tabReorder:{value:!1,type:"boolean"},tabResize:{value:!1,type:"boolean"},tabScrollButtonsPosition:{value:"both",allowedValues:["near","far","both"],type:"string"},selectedIndex:{value:null,type:"number?"},selectionMode:{value:"click",allowedValues:["click","dblclick","mouseenter","none"],type:"string"},collapsed:{value:!1,type:"boolean"},collapsible:{value:!1,type:"boolean"},locked:{value:!1,type:"boolean"},max:{value:"",type:"any"},min:{value:"",type:"any"},size:{value:"",type:"any"},tabLayout:{value:"scroll",allowedValues:["scroll","dropdown","wrap","shrink"],type:"string",defaultReflectToAttribute:!0},tabPosition:{value:"top",allowedValues:["top","bottom","left","right","hidden"],type:"string"},tabTextOrientation:{value:"horizontal",allowedValues:["horizontal","vertical"],type:"string"},layout:{value:null,type:"any"}}}static get listeners(){return{"tabsElement.blur":"_tabsFocusHandler","tabsElement.change":"_tabsChangeHandler","tabsElement.focus":"_tabsFocusHandler","autoHideWindow.close":"_autoHideWindowCloseHandler","autoHideWindow.open":"_autoHideWindowOpenHandler"}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="minimizeButton" class="smart-button smart-element smart-minimize-button" aria-label="Minimize"></button>\n <button id="maximizeButton" class="smart-button smart-element smart-maximize-button" aria-label="Maximize"></button>\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div id="contentSection" class="smart-content">\n <smart-tabs id="tabsElement"\n animation="[[animation]]"\n add-new-tab="[[addNewTab]]"\n allow-toggle="[[allowToggle]]"\n close-button-mode="[[tabCloseButtonMode]]"\n close-buttons="[[tabCloseButtons]]"\n disabled="[[disabled]]"\n overflow="[[tabOverflow]]"\n reorder="[[tabReorder]]"\n resize="[[tabResize]]"\n scroll-buttons-position="[[tabScrollButtonsPosition]]"\n selected-index="{{selectedIndex}}"\n selection-mode="[[selectionMode]]"\n tab-layout="[[tabLayout]]"\n tab-position="[[tabPosition]]"\n tab-text-orientation="[[tabTextOrientation]]"\n theme="[[theme]]"\n right-to-left="[[rightToLeft]]">\n <content></content>\n </smart-tabs>\n </div>\n <div id="footer" class="smart-footer smart-hidden"></div>\n </div>\n </div>'}static get requires(){return{"Smart.Tabs":"smart.tabs.js"}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(e instanceof Smart.TabItem||t.error(t.localize("tabItemRequired",{method:"removeChild"})),t.$.tabsElement.appendChild(e)):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}insert(e,t){this.$.tabsElement.insert(e,t);const a=this.$.tabsElement._tabs[e];a&&(a.draggable=void 0===t.draggable||t.draggable,a.floatable=void 0===t.floatable||t.floatable)}insertBefore(e,t){this.$.tabsElement.insertBefore(e,t)}removeAt(e){this.$.tabsElement.removeAt(e)}removeChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(e instanceof Smart.TabItem||t.error(t.localize("tabItemRequired",{method:"removeChild"})),(t.shadowRoot||t).contains(e)||t.error(t.localize("referenceNodeNotChild",{argument:"node"})),t.$.tabsElement.removeChild(e)):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}refreshTabHeader(){const e=this;e.$.tabsElement&&e.$.tabsElement.isCompleted&&e.$.tabsElement.refreshTabHeader()}refreshTabs(){const e=this;e.$.tabsElement&&e.$.tabsElement.isCompleted&&e.$.tabsElement._applyTabOverflow()}select(e){this.$.tabsElement.select(e)}update(e,t,a){this.$.tabsElement.update(e,t,a)}get items(){return this.isCompleted&&this.$.tabsElement?this.$.tabsElement._tabs:null}get itemLabels(){return this.$?this.$.tabsElement._tabLabelContainers:null}get siblings(){const e=this;let t=[];if(!e.isCompleted)return t;const a=e.closest("smart-splitter");if(!a||!a.closest("smart-docking-layout"))return t;const i=a._items;if(!i||!i.length)return t;for(let n=0;n<i.length;n++){const o=i[n];o!==e.closest("smart-splitter-item")&&o.querySelector("smart-tabs-window").closest("smart-splitter")===a&&t.push(o.querySelector("smart-tabs-window"))}return t}propertyChangedHandler(e,t,a){const i=this;switch("collapsed"!==e&&super.propertyChangedHandler(e,t,a),e){case"theme":""!==t&&(i.$.closeButton.classList.remove(t),i.$.collapseButton.classList.remove(t),i.$.maximizeButton.classList.remove(t),i.$.pinButton.classList.remove(t)),i._applyTheme(a);break;case"autoHideWindow":i._handleAutoHideWindow();break;case"autoHide":a||(null!==i.$.tabsElement.selectedIndex&&(i.$.tabsElement._tabs[i.$.tabsElement.selectedIndex]._autoHideWindowSize=void 0),i._autoHideWindow&&i._autoHideWindow.close());break;case"dataSource":i.$.tabsElement.dataSource=a;break;case"layout":i._handleLayoutProperty();break;case"collapsible":case"collapsed":case"locked":case"max":case"min":case"size":{const n=i.getRootNode(),o=(n&&n.host?n.host:i).closest("smart-docking-layout"),s=i.closest("smart-splitter-item");if(!o)return void("collapsed"===e&&super.propertyChangedHandler(e,t,a));s&&(s[e]=a);break}}}_applyTheme(e){if(""!==e){const t=this.$.buttonsContainer.children;for(let a=0;a<t.length;a++)t[a].classList.add(e)}}_autoHideWindowCloseHandler(){const e=this;e.allowToggle&&null!==e.$.tabsElement.selectedIndex&&e.$.tabsElement.select(e.$.tabsElement.selectedIndex),e._autoHideWindow&&e._moveContent(e._autoHideWindow.items[0],e._autoHideWindow._tab)}_autoHideWindowOpenHandler(){const e=this;e.$.tabsElement.selectedIndex&&e._handleAutoHide(e.$.tabsElement.selectedIndex)}_createElement(){const e=this;e.setAttribute("role","dialog"),e.$.tabsElement.$.tabHeaderControls&&!e.$.tabsElement.$.tabHeaderControls.innerHTML&&e.$.tabsElement.$tabHeaderControls.addClass("smart-hidden"),e.$.tabsElement.dataSource=e.dataSource,e._applyTheme(e.theme),e._handleAutoHideWindow(),e.autoHide&&e._handleAutoHide(e.$.tabsElement.selectedIndex),e.allowToggle||e.selectedIndex||null===e.$.tabsElement.selectedIndex||(e.selectedIndex=e.$.tabsElement.selectedIndex,e.$.tabsElement.setAttribute("selected-index",e.selectedIndex)),e._handleLayoutProperty();const t=(e.isInShadowDOM?e.getRootNode().host:e||e).closest("smart-docking-layout"),a=e.closest("smart-splitter-item");t&&a&&(a.collapsible=e.collapsible,a.collapsed=e.collapsed,a.min=e.min,a.max=e.max,a.size=e.size,a.locked=e.locked)}attached(){super.attached();const e=this;e.classList.add("smart-window"),e.shadowRoot&&e.$.root.classList.add("smart-window")}_handleLayoutProperty(){const e=this;let t=e.closest("smart-docking-layout");if(Smart.DockingLayout){if(!e.ownerLayout&&e.getRootNode()){let a=e.getRootNode().host;for(;a;){if(!a.closest)return;if(a.closest("smart-docking-layout")){t=a.closest("smart-docking-layout");break}a=a.getRootNode()?a.getRootNode().host:void 0}}t?e.layout=t:e.layout instanceof Smart.DockingLayout||"string"==typeof e.layout&&(e.layout=document.getElementById(e.layout))}}_headerDblCickHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;e.ctrlKey||a!==t.$.headerSection&&a!==t.$.header||t.$.maximizeButton&&0===t.$.maximizeButton.offsetHeight||(t.maximized?t.restore():t.maximize())}_documentUpHandler(e){const t=this;let a=e.originalEvent.target.closest?e.originalEvent.target.closest(".smart-window"):e.originalEvent.target,i=a===t||a===t._autoHideWindow||t._isAutoHideWindowClicked,n=t.closest("smart-docking-layout");(t.shadowRoot||t.isInShadowDOM)&&(a=e.originalEvent.composedPath()[0],i=a.getRootNode()===t.shadowRoot||a.closest(".smart-window")===t||a.closest(".smart-window")===t._autoHideWindow||t._isAutoHideWindowClicked),n=((t.isInShadowDOM?t.getRootNode().host:t)||t).closest("smart-docking-layout"),n&&n.disabled?delete t._isWindowContentClicked:(super._documentUpHandler(e),delete t._isAutoHideWindowClicked,t.autoHide&&t._autoHideWindow&&(i&&t._autoHideWindow.opened||(t.selectedIndex=null,t._autoHideWindow.parentElement&&t._autoHideWindow.parentElement.closest(".smart-window")===t&&t._autoHideWindow.close())))}_handleAutoHide(e){const t=this;if(!t.autoHide||null===e)return;if(t._autoHideWindow||t._handleAutoHideWindow(!0),!t._autoHideWindow)return;t._autoHideWindow._tabsWindow&&t._autoHideWindow._tabsWindow!==t&&(t._autoHideWindow._tabsWindow.selectedIndex=null);const a=t.$.tabsElement._tabs[e];t._autoHideWindow._tab!==a&&t._moveContent(t._autoHideWindow.items[0],t._autoHideWindow._tab),t._autoHideWindow.label=a.label,t._autoHideWindow.draggable=a.draggable,t._autoHideWindow.floatable=a.floatable,t._autoHideWindow._tab=a,t._autoHideWindow.headerButtons=t.headerButtons,t._moveContent(t._autoHideWindow._tab,t._autoHideWindow.items[0]),t._autoHideWindow.bringToFront(),t._setAutoHideWindowSize(e),t._autoHideWindow.open(),t._autoHideWindow._tabsWindow=t,t._autoHideWindow.controlledBy&&t._autoHideWindow.controlledBy.removeAttribute("aria-controls"),t._autoHideWindow.controlledBy=t.$.tabsElement._tabLabelContainers[e],t._autoHideWindow.controlledBy.setAttribute("aria-controls",t._autoHideWindow.id)}_moveHandler(e){const t=this,a=t.closest("smart-docking-layout");a&&a.items.indexOf(t)>-1||(Smart.Utilities.Core.isMobile&&navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&t.layout instanceof Smart.DockingLayout&&t.layout.hasAttribute("dragged")&&e.originalEvent.preventDefault(),super._moveHandler(e))}_setAutoHideWindowSize(e){const t=this;if(!t._autoHideWindow)return;t._autoHideWindow.$.addClass("no-transition"),t._autoHideWindow.style.maxWidth=t._autoHideWindow.style.maxHeight="";const a=t.$.tabsElement._tabs[e],i=(t._autoHideWindow.isInShadowDOM?t._autoHideWindow.getRootNode().host:t._autoHideWindow).closest("smart-docking-layout")||t._autoHideWindow.parentElement;let n,o;if(a){if("top"===t.tabPosition||"bottom"===t.tabPosition){t._autoHideWindow.resizeMode="top"===t.tabPosition?"bottom":"top",t._autoHideWindow.style.width=t.$.tabsElement.offsetWidth+"px",n=i.getBoundingClientRect(),o=t.$.tabsElement.getBoundingClientRect();let e=a._autoHideWindowSize&&parseFloat(a._autoHideWindowSize)||"";Smart.DockingLayout&&i instanceof Smart.DockingLayout&&(e&&(e=Math.min(i.$.itemsContainer.offsetHeight,e)+"px"),t._autoHideWindow.style.maxHeight=i.$.itemsContainer.offsetHeight+"px"),t._autoHideWindow.style.height=e,t._autoHideWindow.style.left=o.left-n.left+"px",t._autoHideWindow&&("top"===t.tabPosition?t._autoHideWindow.style.top=o.top+-n.top+o.height+"px":t._autoHideWindow.style.top=o.top-n.top-t._autoHideWindow.offsetHeight+"px")}else{t._autoHideWindow.resizeMode="left"===t.tabPosition?"right":"left",t._autoHideWindow.style.height=t.$.tabsElement.offsetHeight+"px";let e=a._autoHideWindowSize&&parseFloat(a._autoHideWindowSize)||"";i instanceof Smart.DockingLayout&&(e&&(e=Math.min(i.$.itemsContainer.offsetWidth,e)+"px"),t._autoHideWindow.style.maxWidth=i.$.itemsContainer.offsetWidth+"px"),t._autoHideWindow.style.width=e,n=i.getBoundingClientRect(),o=t.$.tabsElement.getBoundingClientRect(),t._autoHideWindow.style.top=o.top-n.top+"px","left"===t.tabPosition?t._autoHideWindow.style.left=o.left-n.left+t.$.tabsElement.offsetWidth+"px":t._autoHideWindow.style.left=o.left-n.left-t._autoHideWindow.offsetWidth+"px"}t._autoHideWindow._dragDetails&&(t._autoHideWindow._dragDetails.maxWidth=void 0),t._autoHideWindow._setDragDetails("resize"),t._autoHideWindow._dragDetails.started=!1,t._autoHideWindow.$.removeClass("no-transition")}}_handleAutoHideWindow(e){const t=this;if(t.autoHideWindow){if(t._autoHideWindow&&t._autoHideWindow.parentElement.removeChild(t._autoHideWindow),"string"==typeof t.autoHideWindow)return void(t._autoHideWindow=document.getElementById(t.autoHideWindow));if(t.autoHideWindow instanceof Smart.Window)return void(t._autoHideWindow=t.autoHideWindow)}if(!e||t._autoHideWindow||2===t.$.contentSection.children.length&&t.$.contentSection.children[1]instanceof Smart.Window)return;const a=document.createElement("smart-window");a.$=Smart.Utilities.Extend(a),a.disableSnap=a.pinned=!0,a.headerButtons=["close"],t.$.contentSection.appendChild(a),t._autoHideWindow=a}_moveContent(e,t){if(!e||!t)return;const a=[].slice.call(e.$.content.childNodes);for(let e=0;e<a.length;e++)t.appendChild(a[e])}_tabsChangeHandler(e){const t=this;if(e.target===t.$.tabsElement&&t.autoHide){if(t._autoHideWindow||t._handleAutoHideWindow(!0),null!==e.detail.oldIndex&&t._autoHideWindow.opened&&(t.$.tabsElement._tabs[e.detail.oldIndex]._autoHideWindowSize=t._autoHideWindow.style["right"===t.$.tabsElement.tabPosition||"left"===t.$.tabsElement.tabPosition?"width":"height"]),!t.autoHide||null===e.detail.index||void 0===e.detail.index)return t._autoHideWindow.setAttribute("active",""),void t._autoHideWindow.close();t._handleAutoHide(e.detail.index)}}_tabsFocusHandler(e){const t=this;"focus"===e.type?(t.bringToFront(),t.setAttribute("focus","")):t.removeAttribute("focus")}}),Smart("smart-wait-window",class extends Smart.ProgressWindow{static get properties(){return{headerButtons:{value:[],type:"array"},disableSnap:{value:!0,readOnly:!0,type:"boolean"},modal:{value:!0,readOnly:!0,type:"boolean",defaultReflectToAttribute:!0},pinned:{value:!0,type:"boolean",readOnly:!0}}}template(){return'<div role="presentation">\n <div class="smart-content-container" id="container">\n <div id="headerSection" class="smart-header-section" role="heading" aria-level="1">\n <div id="header" class="smart-header">[[label]]</div>\n <div id="buttonsContainer" class="smart-buttons-container">\n <button id="closeButton" class="smart-button smart-element smart-close-button" aria-label="Close"></button>\n </div>\n </div>\n <div class="smart-content">\n <content></content>\n <smart-progress-bar id="progressBar" animation="[[animation]]" indeterminate theme="[[theme]]" right-to-left="[[rightToLeft]]"></smart-progress-bar>\n </div>\n <div id="footer" class="smart-footer"></div>\n </div>\n </div>'}_keyDownHandler(e){const t=this;function a(){t._dragDetails&&(t._dragDetails.started=!1),t.$.removeClass("no-transition")}if(delete t._changingFocus,t.disabled||t._dragDetails&&t._dragDetails.started)return;const i=t.shadowRoot||t._windowParent.element.getRootNode()?t._windowParent.element.getRootNode().activeElement:document.activeElement;e.stopPropagation();const n="ArrowDown"===e.key||"ArrowRight"===e.key?10:-10;switch(t.$.removeClass("no-transition"),e.key){case"ArrowUp":case"ArrowDown":if(i!==t)return;if(e.preventDefault(),e.altKey)return"ArrowUp"===e.key?t.maximize():t.restore(),void a();if(t.$.addClass("no-transition"),e.ctrlKey)return t._resize("bottom",n),void a();t._drag(n,"vertical");break;case"ArrowLeft":case"ArrowRight":if(i!==t)return;if(e.preventDefault(),t.$.addClass("no-transition"),e.ctrlKey)return t._resize("right",n),void a();t._drag(n,"horizontal");break;case"Tab":t.opened&&t.modal&&(t._changingFocus=!0);break;case"Enter":case" ":{let a;if(t.shadowRoot||t.isInShadowDOM?(a=e.composedPath()[0],t._buttonPressed=a.getRootNode().host):(a=e.target.closest&&e.target.closest(".smart-button"),t._buttonPressed=a),!a)return;t._isWindowButton(a),delete t._buttonPressed;break}}a()}});
874
874
 
875
875
  /***/ })
876
876
 
@@ -971,7 +971,7 @@ var __webpack_exports__ = {};
971
971
  /* harmony import */ var _smart_table_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(5523);
972
972
  /* harmony import */ var _smart_table_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_smart_table_js__WEBPACK_IMPORTED_MODULE_16__);
973
973
 
974
- /* Smart UI v13.1.1 (2022-03-23)
974
+ /* Smart UI v13.1.26 (2022-04-05)
975
975
  Copyright (c) 2011-2021 jQWidgets.
976
976
  License: https://htmlelements.com/license/ */ //
977
977