smart-webcomponents-react 15.2.2 → 15.2.9

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 (215) hide show
  1. package/index.d.ts +4 -0
  2. package/package.json +1 -1
  3. package/source/modules/smart.3dchart.js +2 -2
  4. package/source/modules/smart.accordion.js +1 -1
  5. package/source/modules/smart.array.js +2 -2
  6. package/source/modules/smart.barcode.js +1 -1
  7. package/source/modules/smart.breadcrumb.js +1 -1
  8. package/source/modules/smart.button.js +1 -1
  9. package/source/modules/smart.buttongroup.js +1 -1
  10. package/source/modules/smart.calendar.js +1 -1
  11. package/source/modules/smart.card.js +1 -1
  12. package/source/modules/smart.cardview.js +2 -2
  13. package/source/modules/smart.carousel.js +1 -1
  14. package/source/modules/smart.chart.js +1 -1
  15. package/source/modules/smart.checkbox.js +1 -1
  16. package/source/modules/smart.checkinput.js +1 -1
  17. package/source/modules/smart.chip.js +1 -1
  18. package/source/modules/smart.colorinput.js +1 -1
  19. package/source/modules/smart.colorpanel.js +2 -2
  20. package/source/modules/smart.colorpicker.js +2 -2
  21. package/source/modules/smart.combobox.js +2 -2
  22. package/source/modules/smart.common.js +1 -1
  23. package/source/modules/smart.countryinput.js +1 -1
  24. package/source/modules/smart.dateinput.js +1 -1
  25. package/source/modules/smart.daterangeinput.js +2 -2
  26. package/source/modules/smart.datetimepicker.js +2 -2
  27. package/source/modules/smart.dockinglayout.js +1 -1
  28. package/source/modules/smart.dropdownbutton.js +1 -1
  29. package/source/modules/smart.dropdownlist.js +2 -2
  30. package/source/modules/smart.editor.js +2 -2
  31. package/source/modules/smart.element.js +1 -1
  32. package/source/modules/smart.fileupload.js +2 -2
  33. package/source/modules/smart.form.js +1 -1
  34. package/source/modules/smart.formulaparser.js +1 -1
  35. package/source/modules/smart.ganttchart.js +3 -3
  36. package/source/modules/smart.gauge.js +1 -1
  37. package/source/modules/smart.grid.js +6 -6
  38. package/source/modules/smart.gridpanel.js +2 -2
  39. package/source/modules/smart.input.js +1 -1
  40. package/source/modules/smart.kanban.js +2 -2
  41. package/source/modules/smart.layout.js +1 -1
  42. package/source/modules/smart.led.js +1 -1
  43. package/source/modules/smart.listbox.js +2 -2
  44. package/source/modules/smart.listmenu.js +1 -1
  45. package/source/modules/smart.map.js +1 -1
  46. package/source/modules/smart.maskedtextbox.js +1 -1
  47. package/source/modules/smart.menu.js +1 -1
  48. package/source/modules/smart.multicomboinput.js +1 -1
  49. package/source/modules/smart.multiinput.js +1 -1
  50. package/source/modules/smart.multilinetextbox.js +2 -2
  51. package/source/modules/smart.multisplitbutton.js +2 -2
  52. package/source/modules/smart.numberinput.js +1 -1
  53. package/source/modules/smart.numerictextbox.js +2 -2
  54. package/source/modules/smart.pager.js +2 -2
  55. package/source/modules/smart.passwordinput.js +1 -1
  56. package/source/modules/smart.passwordtextbox.js +1 -1
  57. package/source/modules/smart.path.js +1 -1
  58. package/source/modules/smart.phoneinput.js +1 -1
  59. package/source/modules/smart.pivottable.js +3 -3
  60. package/source/modules/smart.progressbar.js +1 -1
  61. package/source/modules/smart.qrcode.js +1 -1
  62. package/source/modules/smart.querybuilder.js +2 -2
  63. package/source/modules/smart.radiobutton.js +1 -1
  64. package/source/modules/smart.rating.js +1 -1
  65. package/source/modules/smart.router.js +1 -1
  66. package/source/modules/smart.scheduler.js +2 -2
  67. package/source/modules/smart.scrollbar.js +1 -1
  68. package/source/modules/smart.slider.js +1 -1
  69. package/source/modules/smart.sortable.js +1 -1
  70. package/source/modules/smart.splitter.js +1 -1
  71. package/source/modules/smart.switchbutton.js +1 -1
  72. package/source/modules/smart.table.js +3 -3
  73. package/source/modules/smart.tabs.js +1 -1
  74. package/source/modules/smart.tank.js +1 -1
  75. package/source/modules/smart.textarea.js +1 -1
  76. package/source/modules/smart.textbox.js +2 -2
  77. package/source/modules/smart.timeinput.js +1 -1
  78. package/source/modules/smart.timepicker.js +1 -1
  79. package/source/modules/smart.toast.js +1 -1
  80. package/source/modules/smart.tooltip.js +1 -1
  81. package/source/modules/smart.tree.js +1 -1
  82. package/source/modules/smart.validator.js +1 -1
  83. package/source/modules/smart.window.js +2 -2
  84. package/source/smart.3dchart.js +1 -1
  85. package/source/smart.accordion.js +1 -1
  86. package/source/smart.ajax.js +1 -1
  87. package/source/smart.array.js +1 -1
  88. package/source/smart.barcode.js +1 -1
  89. package/source/smart.bootstrap.js +1 -1
  90. package/source/smart.breadcrumb.js +1 -1
  91. package/source/smart.button.js +1 -1
  92. package/source/smart.buttongroup.js +1 -1
  93. package/source/smart.calendar.js +1 -1
  94. package/source/smart.card.js +1 -1
  95. package/source/smart.cardview.js +1 -1
  96. package/source/smart.carousel.js +1 -1
  97. package/source/smart.chart.annotations.js +1 -1
  98. package/source/smart.chart.api.js +1 -1
  99. package/source/smart.chart.core.js +1 -1
  100. package/source/smart.chart.js +1 -1
  101. package/source/smart.chart.rangeselector.js +1 -1
  102. package/source/smart.chart.waterfall.js +1 -1
  103. package/source/smart.checkbox.js +1 -1
  104. package/source/smart.checkinput.js +1 -1
  105. package/source/smart.chip.js +1 -1
  106. package/source/smart.colorinput.js +1 -1
  107. package/source/smart.colorpanel.js +1 -1
  108. package/source/smart.colorpicker.js +1 -1
  109. package/source/smart.combobox.js +1 -1
  110. package/source/smart.complex.js +1 -1
  111. package/source/smart.core.js +1 -1
  112. package/source/smart.countryinput.js +1 -1
  113. package/source/smart.data.js +1 -1
  114. package/source/smart.date.js +1 -1
  115. package/source/smart.dateformatpanel.js +1 -1
  116. package/source/smart.dateinput.js +1 -1
  117. package/source/smart.daterangeinput.js +1 -1
  118. package/source/smart.datetimepicker.js +1 -1
  119. package/source/smart.dockinglayout.js +1 -1
  120. package/source/smart.draw.js +1 -1
  121. package/source/smart.dropdownbutton.js +1 -1
  122. package/source/smart.dropdownlist.js +1 -1
  123. package/source/smart.editor.js +1 -1
  124. package/source/smart.element.js +1 -1
  125. package/source/smart.elements.js +6 -6
  126. package/source/smart.export.js +1 -1
  127. package/source/smart.fileupload.js +1 -1
  128. package/source/smart.filter.js +1 -1
  129. package/source/smart.filterbuilder.js +1 -1
  130. package/source/smart.filterpanel.js +1 -1
  131. package/source/smart.form.js +1 -1
  132. package/source/smart.format.js +1 -1
  133. package/source/smart.formulaparser.js +1 -1
  134. package/source/smart.ganttchart.js +1 -1
  135. package/source/smart.gauge.js +1 -1
  136. package/source/smart.grid.cell.js +2 -2
  137. package/source/smart.grid.chart.js +1 -1
  138. package/source/smart.grid.column.js +1 -1
  139. package/source/smart.grid.core.js +2 -2
  140. package/source/smart.grid.dialog.js +1 -1
  141. package/source/smart.grid.edit.js +1 -1
  142. package/source/smart.grid.export.js +1 -1
  143. package/source/smart.grid.filter.js +1 -1
  144. package/source/smart.grid.group.js +1 -1
  145. package/source/smart.grid.js +1 -1
  146. package/source/smart.grid.menu.js +2 -2
  147. package/source/smart.grid.pager.js +1 -1
  148. package/source/smart.grid.reorder.js +1 -1
  149. package/source/smart.grid.resize.js +1 -1
  150. package/source/smart.grid.row.js +1 -1
  151. package/source/smart.grid.select.js +1 -1
  152. package/source/smart.grid.sort.js +1 -1
  153. package/source/smart.grid.toolbar.js +1 -1
  154. package/source/smart.grid.tree.js +1 -1
  155. package/source/smart.grid.view.js +1 -1
  156. package/source/smart.gridpanel.js +1 -1
  157. package/source/smart.input.js +1 -1
  158. package/source/smart.kanban.js +1 -1
  159. package/source/smart.layout.js +1 -1
  160. package/source/smart.led.js +1 -1
  161. package/source/smart.listbox.js +2 -2
  162. package/source/smart.listmenu.js +1 -1
  163. package/source/smart.map.js +1 -1
  164. package/source/smart.maskedtextbox.js +1 -1
  165. package/source/smart.math.js +1 -1
  166. package/source/smart.menu.js +1 -1
  167. package/source/smart.multicomboinput.js +1 -1
  168. package/source/smart.multiinput.js +1 -1
  169. package/source/smart.multilinetextbox.js +1 -1
  170. package/source/smart.multisplitbutton.js +1 -1
  171. package/source/smart.numberformatpanel.js +1 -1
  172. package/source/smart.numberinput.js +1 -1
  173. package/source/smart.numeric.js +1 -1
  174. package/source/smart.numerictextbox.js +1 -1
  175. package/source/smart.pager.js +2 -2
  176. package/source/smart.passwordinput.js +1 -1
  177. package/source/smart.passwordtextbox.js +1 -1
  178. package/source/smart.path.js +1 -1
  179. package/source/smart.phoneinput.js +1 -1
  180. package/source/smart.pivottable.js +1 -1
  181. package/source/smart.powerbutton.js +1 -1
  182. package/source/smart.progressbar.js +1 -1
  183. package/source/smart.qrcode.js +1 -1
  184. package/source/smart.radiobutton.js +1 -1
  185. package/source/smart.rating.js +1 -1
  186. package/source/smart.router.js +1 -1
  187. package/source/smart.scheduler.js +1 -1
  188. package/source/smart.scrollbar.js +1 -1
  189. package/source/smart.slider.js +1 -1
  190. package/source/smart.sortable.js +1 -1
  191. package/source/smart.splitter.js +1 -1
  192. package/source/smart.switchbutton.js +1 -1
  193. package/source/smart.table.js +1 -1
  194. package/source/smart.tabs.js +1 -1
  195. package/source/smart.tank.js +1 -1
  196. package/source/smart.textarea.js +1 -1
  197. package/source/smart.textbox.js +1 -1
  198. package/source/smart.tickintervalhandler.js +1 -1
  199. package/source/smart.timeinput.js +1 -1
  200. package/source/smart.timepicker.js +1 -1
  201. package/source/smart.toast.js +1 -1
  202. package/source/smart.tooltip.js +1 -1
  203. package/source/smart.tree.js +1 -1
  204. package/source/smart.validationpanel.js +1 -1
  205. package/source/smart.validator.js +1 -1
  206. package/source/smart.window.js +1 -1
  207. package/source/typescript/smart.elements.d.ts +4 -0
  208. package/source/typescript/smart.table.d.ts +4 -0
  209. package/table/table.d.ts +3 -0
  210. package/table/table.esm.js +12 -0
  211. package/table/table.umd.js +12 -0
  212. package/source/modules/smart.ribbon.js +0 -286
  213. package/source/smart.ribbon.js +0 -6
  214. package/source/styles/components/smart.ribbon.css +0 -13
  215. package/source/styles/default/smart.ribbon.css +0 -235
@@ -1,5 +1,5 @@
1
1
 
2
- /* Smart UI v15.2.5 (2023-05-19)
2
+ /* Smart UI v15.2.8 (2023-05-22)
3
3
  Copyright (c) 2011-2023 jQWidgets.
4
4
  License: https://htmlelements.com/license/ */ //
5
5
 
@@ -47,10 +47,10 @@ Smart("smart-multiline-text-box",class extends Smart.TextBox{static get properti
47
47
  Smart("smart-password-text-box",class extends Smart.BaseElement{static get properties(){return{autoFocus:{value:!1,type:"boolean"},hint:{value:"",reflectToAttribute:!0,type:"string"},label:{value:"",reflectToAttribute:!0,type:"string"},maxLength:{value:null,type:"number?"},minLength:{value:2,type:"number"},messages:{value:{en:{passwordStrength:"Password strength",short:"Short",weak:"Weak",far:"Far",good:"Good",strong:"Strong",showPassword:"Show password"}},type:"object",extend:!0},name:{value:"",type:"string"},passwordStrength:{value:null,type:"function?",reflectToAttribute:!1},placeholder:{value:"",type:"string"},selectAllOnFocus:{value:!1,type:"boolean"},showPasswordIcon:{value:!1,type:"boolean"},showPasswordStrength:{value:!1,type:"boolean"},tooltipArrow:{value:!1,type:"boolean"},tooltipDelay:{value:0,type:"number"},tooltipPosition:{allowedValues:["bottom","top","left","right","absolute"],value:"top",type:"string"},tooltipTemplate:{value:null,type:"string?"},type:{value:"password",type:"string",defaultReflectToAttribute:!0,readonly:!0},value:{value:"",reflectToAttribute:!1,type:"string"}}}static get listeners(){return{"document.up":"_documentUpHandler",mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler","passwordIcon.down":"_showPassword","input.change":"_textBoxChangeHandler","input.paste":"_textBoxChangeHandler","input.keyup":"_textBoxChangeHandler","input.blur":"_blurHandler","input.focus":"_focusHandler"}}static get requires(){return{"Smart.Tooltip":"smart.tooltip.js"}}static get styleUrls(){return["smart.textbox.css","smart.passwordtextbox.css"]}template(){return'<div id="container" role="presentation"><span id="label" class="smart-label">[[label]]</span><div id="innerContainer" class="smart-content" role="presentation"><input class="smart-input" type="password" id="input"\n disabled="[[disabled]]"\n maxlength="[[maxLength]]"\n minlength="[[minLength]]"\n name="[[name]]"\n placeholder="[[placeholder]]"\n readonly="[[readonly]]"\n value="[[value]]"/><span id="passwordIcon" title="Show Password" class="smart-password-icon smart-hidden" role="button" aria-label="Show Password"></span></div><span id="hint" class="smart-hint">[[hint]]</span><smart-tooltip id="tooltip"\n open-mode="manual"\n arrow="[[tooltipArrow]]"\n right-to-left="[[rightToLeft]]"\n tooltip-template="[[tooltipTemplate]]"\n position="[[tooltipPosition]]"\n delay="[[tooltipDelay]]"></smart-tooltip></div>'}propertyChangedHandler(e,t,s){const a=this;let o;switch(e){case"locale":case"messages":case"passwordStrength":o=a._evaluatePasswordStrength(),a._updateTooltipString(o),a.$.passwordIcon.setAttribute("title",a.localize("showPassword")),a._updatePasswordStrengthStyles(o);break;case"tooltipPosition":a.$.tooltip.position=a.tooltipPosition;break;case"tooltipTemplate":a.$.tooltip.tooltipTemplate=a.tooltipTemplate;break;case"value":o=a._evaluatePasswordStrength(),a._updateTooltipString(o),a._updatePasswordStrengthStyles(o);break;case"disabled":case"unfocusable":a._setFocusable();break;case"readonly":break;default:super.propertyChangedHandler(e,t,s)}}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.$.input.tabIndex=-1:e.$.input.removeAttribute("tabindex")}render(){this._createElement(),super.render()}focus(){this.$.input.focus()}blur(){this.$.input.blur()}reset(){const e=this;e.$.input.value=e.value=e._initializationValue}_createElement(){const e=this;e.autoFocus&&e.$.input.focus(),e.$.input.autocomplete="new-password",e.$.addClass("smart-input"),e._setFocusable(),e.$.tooltip.selector=e.$.innerContainer,e.$.passwordIcon.setAttribute("title",e.localize("showPassword")),e._updateTooltipString("short"),e._updatePasswordStrengthStyles(),e._initializationValue=e.value,e.value.length>0?e.$.addClass("has-value"):e.$.removeClass("has-value"),e._handleHintContainer(),e.shadowRoot&&(e.$.tooltip.style.display="none",requestAnimationFrame((()=>e.$.tooltip.style.display=""))),e.$.label.id||(e.$.label.id=e.id+"Label"),e.$.hint.id||(e.$.hint.id=e.id+"Hint"),e.setAttribute("role","presentation"),e.$.innerContainer.removeAttribute("aria-describedby"),e.$.input.setAttribute("aria-describedby",e.$.tooltip.id+" "+e.$.hint.id),e.$.input.setAttribute("aria-labelledby",e.$.label.id)}_handleHintContainer(){const e=this;if(!e.hint)return;const t=e.$.hint;if("function"==typeof e.hint){const s=e.value;e.hint(s,t)?e.$.addClass("invalid"):e.$.removeClass("invalid")}else"string"==typeof e.hint&&(t.innerHTML=e.hint,e.$.removeClass("invalid"))}_focusHandler(){const e=this;e.disabled||(e.selectAllOnFocus&&e.$.input.select(),e.showPasswordIcon&&e.$passwordIcon.removeClass("smart-hidden"),e.setAttribute("focus",""),e._valueBeforeChange=e.value,e.$.fireEvent("focus"),e.showPasswordStrength&&(e._tooltipOpened||(e.$.tooltip.open(),e._tooltipOpened=!0)))}_blurHandler(){const e=this;e.disabled||e._passwordIconPressed||(e._valueBeforeChange!==e.value&&(e.$.fireEvent("change",{value:e.value,oldValue:e._valueBeforeChange}),e._valueBeforeChange=""),e.showPasswordIcon&&e.$passwordIcon.addClass("smart-hidden"),e.removeAttribute("focus"),e.value.length>0?e.$.addClass("has-value"):e.$.removeClass("has-value"),e.$.fireEvent("blur"),e._tooltipOpened&&(e.$.tooltip.close(),e._tooltipOpened=!1))}_showPassword(){const e=this;!e.disabled&&e.showPasswordIcon&&(e.$.input.type="text",e._passwordIconPressed=!0)}_documentUpHandler(){const e=this;!e.disabled&&e.showPasswordIcon&&e._passwordIconPressed&&(e.$.input.type="password",e._passwordIconPressed=!1,e.$.input.focus())}_textBoxChangeHandler(e){const t=this;if(t.disabled||t.readonly)return;const s=t.value;if(t.value=t.$.input.value,t.$.input){const a=t.$.input.value;s!==a&&t.$.fireEvent("changing",{oldValue:s,value:a}),e&&"Enter"===e.key&&(t.$.fireEvent("change",{value:t.value,oldValue:t._valueBeforeChange}),t._valueBeforeChange=t.value)}e&&"keyup"!==e.type&&e.stopPropagation();let a=t._evaluatePasswordStrength();t._updateTooltipString(a),t._updatePasswordStrengthStyles(a)}_updatePasswordStrengthStyles(e){const t=this,s=["short","weak","far","good","strong"];e=e||"short";for(let e=0;e<s.length;e++)t.$container.removeClass("smart-password-"+s[e]);t.disabled||t.$container.addClass("smart-password-"+e)}_evaluatePasswordStrength(){const e=this,t=e.$.input.value,s=t.length,a="<>@!#$%^&*()_+[]{}?:;|'\"\\,./~`-=";if(e.disabled)return;if(e.passwordStrength)return e.passwordStrength(t,a);let o=0,n=0,r=0,l=0;for(var i=0;i<s;i++){const e=t.charAt(i),s=t.charCodeAt(i);s>64&&s<91||s>96&&s<123||s>127&&s<155||s>159&&s<166?o+=1:!1!==isNaN(e)?-1===a.indexOf(e)||(r+=1):n+=1}return l=o+n+2*r+o*n/2+s,s<8?"short":l<20?"weak":l<30?"far":l<40?"good":"strong"}refresh(){}_keyUpHandler(){}_mouseWheelHandler(){}_resizeHandler(){}_selectStartHandler(){}_setDropDownSize(){}_styleChangedHandler(){}_mouseEventsHandler(e){"mouseenter"===e.type?this.setAttribute("hover",""):this.removeAttribute("hover")}_updateTooltipString(e){const t=this;t.$.tooltip.value='<span class="password-strength-label">'+t.localize("passwordStrength")+': </span><span class="password-strength-value">'+t.localize(e)+"</span>"}});
48
48
  Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!=typeof t?Object.assign(e,t):(e.label=t,e.dataField=t),e.dataField||(e.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.setState(t),e.dataType||(e.dataType="string"),e.title||(e.title=""),e.rowSpan||(e.rowSpan=null),e.columnGroup||(e.columnGroup=""),e.canNotify=!0,(!t||t&&!t.properties)&&(e.data=t);let o="left";switch(e.dataType){case"string":case"date":o="left";break;case"number":o="right";break;case"boolean":o="center"}if(e.highlight||(e.highlight=!1),void 0===e.index&&(e.index=-1),void 0===e.visibleIndex&&(e.visibleIndex=-1),void 0===e.selected&&(e.selected=!1),void 0===e.freeze&&(e.freeze=!1),e.label||(e.label=""),e.menuItems||(e.menuItems=null),e.displayField||(e.displayField=e.dataField),e.template||(e.template=""),e.editor||(e.editor="input"),"string"==typeof e.editor){e.editor={template:e.editor,autoFocus:!0};let t=!0;e.editor.template&&e.editor.template.indexOf("<input")>=0&&(t=!1),t&&("number"===e.dataType||"int"===e.dataType||"float"===e.dataType?"slider"!==e.editor.template&&(e.editor.template="numberInput"):"date"===e.dataType?"timeInput"!==e.editor.template&&"dateTimePicker"!==e.editor.template&&(e.editor.template="dateInput"):"time"===e.dataType?e.editor.template="timeInput":"boolean"===e.dataType&&(e.editor.template="checkBox"))}else void 0===e.editor.autoFocus&&(e.editor.autoFocus=!0);if(!(e.icon||(e.icon="smart-icon-font","modifiedTime"===e.template&&(e.template="updatedTime"),"modifiedBy"===e.template&&(e.template="updatedBy"),"select"===e.editor.template&&(e.icon="smart-icon-sort-down"),"multiComboInput"===e.editor.template&&(e.icon="smart-icon-list-unordered"),"textArea"!==e.editor.template&&"textarea"!==e.editor.template||(e.icon="smart-icon-fontsize"),"url"===e.template&&(e.icon="smart-icon-link"),"email"===e.template&&(e.icon="smart-icon-mail"),"color"===e.template&&(e.icon="smart-icon-color-background"),"updatedTime"!==e.template&&"createdTime"!==e.template||(e.icon="smart-icon-clock"),"multiComboInput"===e.editor.template&&e.editor.collaborator&&(e.icon="smart-icon-user"),"createdBy"!==e.template&&"updatedBy"!==e.template&&"collaborator"!==e.template||(e.icon="smart-icon-user"),"image"===e.editor.template&&(e.icon="smart-icon-image"),"attachment"===e.editor.template&&(e.icon="smart-icon-docs"),"password"===e.editor.template&&(e.icon="smart-icon-lock"),"phone"===e.editor.template?e.icon="smart-icon-phone":"checkBox"===e.editor.template||"boolean"===e.dataType?e.icon="smart-icon-ok-squared":"numberInput"===e.editor.template||"slider"===e.editor.template||"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.icon="smart-icon-number":"dateInput"===e.editor.template||"dateTimePicker"===e.editor.template||"date"===e.dataType?e.icon="smart-icon-calendar":"timeInput"===e.editor.template||"time"===e.dataType?e.icon="smart-icon-clock":e.editor.template.indexOf("multi")>=0&&"collaborator"!==e.template&&(e.icon="smart-icon-list-ordered"),"autoNumber"===e.template&&(e.icon="smart-icon-list-ordered")),e.menu=null,void 0===e.allowActionButtonAnimation&&(e.grid?e.allowActionButtonAnimation=e.grid.appearance.allowColumnActionButtonAnimation:e.allowActionButtonAnimation=!1),void 0===e.allowSortButtonAnimation&&(e.grid?e.allowSortButtonAnimation=e.grid.appearance.allowColumnSortButtonAnimation:e.allowSortButtonAnimation=!1),void 0===e.autoShowActionButton&&(e.grid?e.autoShowActionButton=e.grid.appearance.autoShowColumnActionButton:e.autoShowActionButton=!1),void 0===e.autoShowSortButton&&(e.grid?e.autoShowSortButton=e.grid.appearance.autoShowColumnSortButton:e.autoShowSortButton=!0),void 0===e.showSortButton&&(e.grid?e.showSortButton=e.grid.appearance.showColumnSortButton:e.showSortButton=!1),void 0===e.showIcon&&(e.grid&&!e.autoGenerated?e.showIcon=e.grid.appearance.showColumnIcon:e.showIcon=!1),void 0===e.showDescriptionButton&&(e.grid?e.showDescriptionButton=e.grid.appearance.showColumnDescriptionButton:e.showDescriptionButton=!1),void 0===e.showCustomButton&&(e.grid?e.showCustomButton=e.grid.appearance.showColumnCustomButton:e.showCustomButton=!1),void 0===e.showActionButton&&(e.grid?e.showActionButton=e.grid.appearance.showColumnActionButton:e.showActionButton=!1),void 0===e.allowLabelAnimation&&(e.grid?e.allowLabelAnimation=e.grid.appearance.allowColumnLabelAnimation:e.allowLabelAnimation=!1),void 0===e.autoShowFilterButton&&(e.grid?e.autoShowFilterButton=e.grid.appearance.autoShowColumnFilterButton:e.autoShowFilterButton=!1),void 0===e.showFilterButton&&(e.grid?e.showFilterButton=e.grid.appearance.showColumnFilterButton:e.showFilterButton=!1),void 0===e.autoCloseMenu&&(e.grid?e.autoCloseMenu=e.grid.columnMenu.autoClose:e.autoCloseMenu=!0),void 0===e.allowNull&&(e.allowNull=!0),e.formatFunction||(e.formatFunction=null),e.sortOrder||(e.sortOrder=null),void 0===e.sortIndex&&(e.sortIndex=null),e.sortComparator||(e.sortComparator=null),e.filter||(e.filter=null),e.className||(e.className=""),e.cellsClassName||(e.cellsClassName=""),e.cellsCSSRules||(e.cellsCSSRules=null),e.filterMenuMode||(e.filterMenuMode="default",e.grid&&"excel"===e.grid.filtering.filterMenu.mode&&(e.filterMenuMode="excel"),e.autoGenerated&&(e.filterMenuMode="none")),e.align||(e.align=o),e.cellsAlign||(e.cellsAlign=o),e.cellsWrap||(e.cellsWrap=!1,e.grid&&e.grid.layout.allowCellsWrap&&(e.cellsWrap=e.grid.layout.allowCellsWrap)),e.minWidth||(e.minWidth=30),e.width||(e.width=null),e.autoGenerated||e.width&&"number"==typeof e.width))if(e.grid&&e.grid.layout.columnWidth)e.width=e.grid.layout.columnWidth;else if(e.grid&&e.grid.layout.autoSizeNewColumn&&!e._autoSizeWidth){const t=e._autoSize();e.width=Math.max(e.grid.layout.autoSizeNewColumnMinWidth,t),e._autoSizeWidth=e.width}void 0===e.visible&&(e.visible=!0),void 0===e.allowResize&&(e.allowResize=!0),void 0===e.allowFreeze&&(e.allowFreeze=!0),void 0===e.allowReorder&&(e.allowReorder=!0),void 0===e.allowHide&&(e.allowHide=!0),void 0===e.allowDelete&&(e.allowDelete=!0),void 0===e.allowSort&&(e.allowSort=!0),void 0===e.allowSelect&&(e.allowSelect=!0),void 0===e.allowSortToggleOnClick&&(e.allowSortToggleOnClick=!0),void 0===e.allowGroup&&(e.allowGroup=!0),void 0===e.allowFilter&&(e.allowFilter=!0),void 0===e.allowEdit&&(e.allowEdit=!0),void 0===e.allowSummary&&(e.allowSummary=!0),void 0===e.allowHeaderEdit&&(e.allowHeaderEdit=!0),void 0===e.allowExport&&(e.allowExport=!0),void 0===e.description&&(e.description=""),void 0===e.group&&(e.group=!1),e.summary||(e.summary=[]),"false"===e.freeze&&(e.freeze=!1),"true"===e.freeze&&(e.freeze=!0),!1===e.allowFreeze&&(e.freeze=!1),void 0===e.defaultValue&&(e.defaultValue=null),e.disabledDialogOptions||(e.disabledDialogOptions=[]),e.formatSettings||(e.formatSettings={decimalPlaces:null,decimalSeparator:null,negativeWithBrackets:null,prefix:null,sufix:null,thousandsSeparator:null,dateFormat:"d"}),this.validationRules||(this.validationRules=[]),e.selected=!1,e.sorted=!1,e.filtered=!1,e.parent=null,e.children=[]}refresh(){const t=this;t.element&&t.element._refresh()}render(){const t=this;t.element.column=t,t.element&&t.element._render()}get stateProps(){return["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","index","sortIndex","sortOrder","sortComparator","sorted","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","thHierarchy","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"]}setState(t){const e=this;if(!t)return;if(e._state={},!t.dataField)return;if(t.dataField.startsWith("_"))return{};const o=e.stateProps;for(let l in t)if(!l.startsWith("_")&&o.indexOf(l)>=0)if("editor"===l){e._state[l]={};for(let t in e[l])"row"!==t&&"column"!==t&&"cell"!==t&&"instance"!==t&&"element"!==t&&(e._state[l][t]=e[l][t])}else"groups"===l?e[l]&&e[l].length>0&&(e._state[l]=e[l]):e._state[l]=e[l]}getState(){const t=this;if(t.dataField.startsWith("_"))return{};if(t._state&&(t._state._visible=t._visible,t._state._dataField=t._dataField),!t._state){t._state={label:t.label,dataField:t.dataField,dataType:t.dataType,_visible:t._visible};const e=t.stateProps;for(let o in t)if(!o.startsWith("_")&&e.indexOf(o)>=0)if("editor"===o){t._state[o]={};for(let e in t[o])"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(t._state[o][e]=t[o][e])}else"groups"===o?t[o]&&t[o].length>0&&(t._state[o]=t[o]):"filter"===o?t[o]&&"string"!=typeof t[o]&&(t._state[o]=t[o].toString()):t._state[o]=t[o]}return t._state}setProperty(t,e,o=!0){const l=this,n=l.getProperty(t);n!==e&&(l.canNotify=!1,l[t]=e,o&&(l.propertyChanged(t,n,e),l.grid&&l.grid.onColumnChange&&l.stateProps.indexOf(t)>=0&&l.grid.onColumnChange(l,t,n,e)),l.canNotify=!0)}getProperty(t){const e=this;if("selected"===t){let o=!1;return e.grid._selection.cells["column"+e.dataField]&&(o=null),e.grid&&e.grid._selection.columns[e.dataField]&&(o=!0),e.grid.columns.canNotify=!1,e[t]!==o&&(e[t]=o),e.grid.columns.canNotify=!0,o}return"group"===t?!(!e.dataSource||!e.dataSource.groupBy)&&e.dataSource.groupBy.indexOf(e.dataField)>=0:e[t]}get properties(){return["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","canNotify","data","disabledDialogOptions","description","grid","icon","menuItems","menu","summary","cellsFormat","className","cellsClassName","cellsCSSRules","formatSettings","formatFunction","index","sortIndex","sortOrder","sortComparator","sorted","groups","element","level","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","rowSpan","showDescriptionButton","statusColumn","treeColumn","computedWidth","computedHeight","overflowWidth","parent","getFilterPanel","getCellValue","updateFilterPanel","children","value","thHierarchy","valueField","onAction","left","top","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"]}propertyChanged(t,e,o){const l=this;if(l.data&&void 0!==l.data[t]&&(l.data[t]=o),l._state||(l._state={label:l.label,dataField:l.dataField,dataType:l.dataType,_visible:l._visible}),l._state&&o!==e&&l.dataField&&!l.dataField.startsWith("_"))if("editor"===t){l._state[t]={};for(let e in o)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(l._state[t][e]=o[e])}else"filter"===t?l[t]&&"string"!=typeof o?l._state[t]=o.toString():l._state[t]=o:l.stateProps.indexOf(t)>=0&&(l._state[t]=o);if("highlight"!==t)if("className"!==t)if("editor"!==t)if("allowSort"!==t&&"allowFilter"!==t)if("showIcon"!==t){if("visible"===t){const t=l.grid.grouping.enabled;return l.grid.refresh(t),void(t&&l.grid._filters&&l.grid.refreshFilters(t))}if("showCustomButton"===t&&(o?l.element._showCustomButton():l.element._hideCustomButton()),"showDescriptionButton"===t)return o?l.element._showDescriptionButton():l.element._hideDescriptionButton(),void l.refresh();if("description"!==t){if("filter"===t&&(l.filter?(l.grid.addFilter(l.dataField,l.filter),l.filtered=!0):(l.grid.removeFilter(l.dataField),l.filtered=!1),(l.autoShowFilterButton||l.showFilterButton)&&(o?l.element._showFilterButton():l.element._hideFilterButton())),"sortIndex"===t)return"many"===l.grid.sorting.mode&&l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),null!==l.sortIndex?l.element.setAttribute("sort-index",l.sortIndex):l.element.removeAttribute("sort-index"),void l.element._updateSortOrder();if("selected"===t){if(!1===l.allowSelect)return;l.selectionColumn&&l.refresh(),o?l.grid._selection.columns[l.dataField]||(l.grid._selection.columns[l.dataField]=!0):!1===o&&l.grid._selection.columns[l.dataField]&&delete l.grid._selection.columns[l.dataField],l.grid._recycle(!1)}if("formatSettings"===t&&l.grid._recycle(!1),"sortOrder"===t)return l.sorted=!1,null===o?l.element._hideSortButton():(l.element._showSortButton(),l.sorted=!0),l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),void(l.sorted?l.element.setAttribute("aria-sort","asc"===l.sortOrder?"ascending":"descenting"):(l.element.removeAttribute("aria-sort"),l.element.removeAttribute("sort-index")));if("group"!==t){if("showActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._showActionButton():l.element._hideActionButton(),l.element.allowAnimations=!0),"autoShowActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._hideActionButton():l.element._showActionButton(),l.element.allowAnimations=!0),"showFilterButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowFilterButton&&(l._autoShowFilterButton=l.autoShowFilterButton),o?(l.autoShowFilterButton=!1,l.element._showFilterButton()):(l.element._hideFilterButton(),l.autoShowFilterButton=l._autoShowFilterButton),l.element.allowAnimations=!0),"showSortButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowSortButton&&(l._autoShowSortButton=l.autoShowSortButton),o?(l.autoShowSortButton=!1,l.element._showSortButton()):(l.element._hideSortButton(),l.autoShowSortButton=l._autoShowSortButton),l.element.allowAnimations=!0),"autoShowSortButton"===t&&(l.element.allowAnimations=!1,l._autoShowSortButton=l.autoShowSortButton,o?l.element._hideSortButton():l.element._showSortButton(),l.element.allowAnimations=!0),"menu"===t&&(o?l.element.setAttribute("aria-controls",l.menu.id):(l.element.removeAttribute("aria-controls"),l.autoShowActionButton&&l.element._hideActionButton())),"cellsFormat"!==t&&"formatSettings"!==t&&"dataField"!==t&&"displayField"!==t&&"template"!==t||l.grid._recycle(),"label"!==t&&"labelTemplate"!==t&&"width"!==t&&"minWidth"!==t||l.grid.refresh(),"freeze"===t){if(!l.allowFreeze)return;const t=()=>{const t=l.grid.context;l.grid.context=l.grid,l.grid._renderColumns(),!1===o&&l.grid._initializeRowElements(),l.grid.refresh(),l.grid.context=t};if(l.grid.columnGroups&&l.grid.columnGroups.length>0&&l.columnGroup)return void t();t()}}else l.grid.context===document&&(o?l.grid.addGroup(l.dataField):l.grid.removeGroup(l.dataField))}else l.refresh()}else l.refresh();else l.refresh();else l._editorId="_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);else l.refresh();else this.refresh()}_measureSize(t){const e=this.grid,o=function(){const o=[],l=document.createElement("div"),n=document.createElement("div"),i=Array.isArray(t)?t:[t];n.classList.add("smart-label"),l.appendChild(n),l.style.width="auto",l.style.position="static",e.$.columnHeader.appendChild(l);for(let t=0;t<i.length;t++){n.innerHTML="<span>"+i[t]+"</span>";const e=20+n.firstChild.offsetWidth,l=Math.max(30,e);o.push(l)}return e.$.columnHeader.removeChild(l),o}();return 1===o.length?o[0]:o}_autoSize(t){const e=this,o=e.grid;let l=e.label.toString();if(!t){const t=o.isInitialized?o._recyclingRows:[];for(let o=0;o<t.length;o++){const n=""+t[o].data[e.dataField];if("image"===e.template)break;n&&n.length>l.length&&(l=n)}}const n=e._measureSize(l);return e.showIcon?n+20:n}autoSize(t){const e=this._autoSize(t);this.width=e}createElement(){const t=this,e=document.createElement("smart-grid-column");return e._initialize(t),e.setAttribute("role","columnheader"),e.setAttribute("aria-haspopup",""),t.element=e,t.grid.notify((function(e,o,l){switch(e){case"appearance_allowColumnLabelAnimation":t.setProperty("allowLabelAnimation",l);break;case"appearance_allowColumnSortAnimation":t.setProperty("allowSortAnimation",l);break;case"appearance_allowColumnSortButtonAnimation":t.setProperty("allowSortButtonAnimation",l);break;case"appearance_allowColumnActionButtonAnimation":t.setProperty("allowActionButtonAnimation",l);break;case"appearance_allowColumnFilterButtonAnimation":t.setProperty("allowFilterButtonAnimation",l);break;case"appearance_autoShowColumnActionButton":t.setProperty("autoShowActionButton",l);break;case"appearance_autoShowColumnSortButton":t.setProperty("autoShowSortButton",l);break;case"appearance_autoShowColumnFilterButton":t.setProperty("autoShowFilterButton",l);break;case"appearance_showColumnActionButton":t.setProperty("showActionButton",l);break;case"appearance_showColumnFilterButton":t.setProperty("showFilterButton",l);break;case"appearance_showColumnCustomButton":t.setProperty("showCustomButton",l);break;case"appearance_showColumnDescriptionButton":t.setProperty("showDescriptionButton",l);break;case"appearance_showColumnSortButton":t.setProperty("showSortButton",l);break;case"appearance_showFrozenColumnBackground":case"appearance_showSortColumnBackground":case"appearance_showFilterColumnBackground":t.grid._recycle(!1)}})),e}}),Smart("smart-grid-column",class extends Smart.BaseElement{_showSortButton(t){const e=this;e.column&&(e.column.autoGenerated||(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.column&&e.column.grid&&!1===e.column.grid.sorting.maintainSort?e.sortButton.removeAttribute("order"):(e.column.autoShowSortButton||e.column.allowSort&&e.sortButton.classList.add("smart-icon-sort","smart-grid-icon"),"asc"===e.column.sortOrder?e.sortButton.classList.add("asc"):"desc"===e.column.sortOrder&&e.sortButton.classList.add("desc"),e.column.showSortButton&&(e.sortButton.classList.add("show"),!1!==t&&e._refresh()),null!==e.column.sortIndex?e.sortButton.setAttribute("order",1+e.column.sortIndex):e.sortButton.removeAttribute("order"))))}_updateSortOrder(){const t=this;if(!t.column)return t.removeAttribute("sort-index"),void t.sortButton.removeAttribute("order");null!==t.column.sortIndex?(t.setAttribute("sort-index",t.column.sortIndex),t.sortButton.setAttribute("order",1+t.column.sortIndex)):(t.removeAttribute("sort-index"),t.sortButton.removeAttribute("order"))}_hideSortButton(t){const e=this;e.column&&(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.sortButton.removeAttribute("order"),e.column.showSortButton&&!e.column.autoShowSortButton||(e.sortButton.classList.remove("show"),e.sortButton.classList.remove("smart-icon-sort"),!1!==t&&e._refresh()))}_showFilterButton(t){const e=this;e.column&&!e.column.autoGenerated&&(e.filterButton.classList.add("show"),e._isInitialized&&!1!==t&&e._refresh())}_hideFilterButton(t){const e=this;e.column&&(e.filterButton.classList.remove("show"),e._isInitialized&&!1!==t&&e._refresh())}_showDescriptionButton(){const t=this;t.column&&!t.column.autoGenerated?t.hasAttribute("columnHeader")||(t.column.description?(t.descriptionButton.setAttribute("title",t.column.description),t.descriptionButton.classList.add("show")):t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh()):t.descriptionButton.classList.remove("show")}_hideDescriptionButton(){const t=this;t.column&&(t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh())}_showIcon(){const t=this;t.column&&!t.column.autoGenerated&&(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon",""),t._isInitialized&&t._refresh())}_hideIcon(){const t=this;t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon"),t._refresh()}_showCustomButton(){const t=this;t.column&&!t.column.autoGenerated&&(t.customButton.classList.add("show"),t._refresh())}_hideCustomButton(){const t=this;t.column&&(t.customButton.classList.remove("show"),t._refresh())}_showActionButton(){const t=this;t.column&&t.column.showActionButton&&t.column.grid.hasColumnMenu(t.column)&&!t.column.autoGenerated&&t.actionButton&&(t.actionButton.classList.add("show"),t._refresh())}_hideActionButton(){const t=this;t.column&&t.column.showActionButton&&t.actionButton&&!t.hasAttribute("aria-controls")&&t.actionButton.classList.contains("show")&&(t.actionButton.classList.remove("show"),t._refresh())}_rotate(){const t=this,e=document.createElement("span");return t.label.innerHTML="",e.innerHTML=t.column.label,t.label.appendChild(e),e.className="rotate",e.style.transform="rotate("+t.column.rotationAngle+"deg)",t.column.grid._recycleRotate(t.label,e,t.column.align,t.column.verticalAlign,t.column.label)}_align(){const t=this;let e=t.column.align;switch(t.column.grid.rightToLeft&&("left"===e?e="right":"right"===e&&(e="left")),e){case"left":t.label.classList.add("align-left");break;case"center":t.label.classList.add("align-center");break;case"right":t.label.classList.add("align-right")}switch(t.column.verticalAlign){case"top":t.label.classList.add("align-top");break;case"middle":t.label.classList.add("align-middle");break;case"bottom":t.label.classList.add("align-bottom")}}_refresh(){const t=this;if(!t.column)return;const e=t.column.grid;if(t.sortButton.classList.remove("filter"),t.sortButton.classList.remove("action"),t.label.className="smart-label",t.label.firstElementChild&&(t.column.className?(t.label.firstElementChild.className="",t.label.firstElementChild.className+=" "+t.column.className):t.label.firstElementChild.className=""),t.descriptionButton&&t.descriptionButton.setAttribute("title",t.column.description),!0===t.column.autoGenerated||t.hasAttribute("columnHeader")?t.descriptionButton.classList.remove("show"):t.column.showDescriptionButton&&t.column.description?t.descriptionButton.classList.add("show"):t.descriptionButton.classList.remove("show"),t.column.highlight?t.setAttribute("highlight",""):t.removeAttribute("highlight"),t.column.visible&&"_checkBoxColumn"===t.column.dataField){const e=t.column.grid;let o=e.getVisibleRows();e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode&&(o=o.slice(e.paging.pageIndex*e.paging.pageSize,(e.paging.pageIndex+1)*e.paging.pageSize));const l=e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode?e._getSelectedRows(!0,!0):e._getSelectedRows(!0,!1);if(e.selection.checkBoxes.autoShow?t.setAttribute("auto-show",""):t.removeAttribute("auto-show"),e._isVirtualMode()){const o=e.dataSource.virtualDataSourceLength;l>0&&l===o?t.setAttribute("selected",""):l>0&&l<o?t.setAttribute("selected","indeterminate"):0!==l&&0!==o||t.removeAttribute("selected")}else l.length>0&&l.length===o.length?t.setAttribute("selected",""):l.length>0&&l.length<o.length?t.setAttribute("selected","indeterminate"):0!==l.length&&0!==o.length||t.removeAttribute("selected");return t.removeAttribute("checkbox"),t.label.classList.remove("smart-input"),void("none"!==e.selection.checkBoxes.selectAllMode&&(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")))}if("_rowHeaderColumn"===this.column.dataField){const e=t.column.grid;if(e.selection.enabled&&e.selection.allowRowHeaderSelection&&e.appearance.showRowHeaderSelectIcon){let o='<div class="smart-grid-command-item">',l=e.areAllRowsSelected()?"smart-icon-check-squared":"smart-icon-check-empty";e.isEmpty()&&(l=""),o+='<span class="smart-grid-icon '+l+'"></span>',o+="</div>",t.label.style.paddingLeft="0px",t.label.style.paddingRight="0px",t.label.innerHTML=o}}if("_commandColumn"===t.column.dataField){const e=t.column.grid,o="icon"!==e.editing.commandColumn.displayMode,l="label"!==e.editing.commandColumn.displayMode,n=e.editing.commandColumn.dataSource.commandColumnMenu;let i='<div class="smart-grid-command-item">';const a="{{messages}}"===n.label?e.localize("commandColumnMenu"):n.label,r=n.icon;l&&o?(i+='<span class="smart-grid-icon '+r+'"></span>',i+='<span class="smart-grid-label">'+a+"</span>"):l&&!o?i+='<span class="smart-grid-icon '+r+'"></span>':o&&!l&&(i+='<span class="smart-grid-label">'+a+"</span>"),i+="</div>",n.visible&&(t.label.innerHTML=i)}const o=t.column.getProperty("selected");if(!1===o&&t.hasAttribute("selected")?t.removeAttribute("selected"):!0===o?t.setAttribute("selected",""):null===o&&t.setAttribute("selected","indeterminate"),t.column.allowSortButtonAnimation?t.sortButton.classList.add("smart-animate"):t.sortButton.classList.remove("smart-animate"),e.dragDrop&&e.dragDrop.column===t.column?t.classList.add("dragged"):t.classList.remove("dragged"),t.column.sorted?t._showSortButton(!1):t._hideSortButton(!1),t.column.sorted?(t.setAttribute("aria-sort","asc"===t.column.sortOrder?"ascending":"descenting"),t._updateSortOrder()):(t.removeAttribute("aria-sort"),t.removeAttribute("sort-index")),(t.column.autoShowFilterButton||t.column.showFilterButton)&&(t.column.filtered?t._showFilterButton(!1):t._hideFilterButton(!1)),t.column.allowFilterButtonAnimation?t.filterButton.classList.add("smart-animate"):t.filterButton.classList.remove("smart-animate"),t.column.allowActionButtonAnimation&&!1!==t.allowAnimations?t.buttonsGroup.classList.add("smart-animate"):t.buttonsGroup.classList.remove("smart-animate"),t.column.allowLabelAnimation&&!1!==t.allowAnimations?t.label.classList.add("smart-animate"):t.label.classList.remove("smart-animate"),t.buttonsGroup.classList.remove("action"),t.actionButton.classList.contains("show")&&t.buttonsGroup.classList.add("action"),t.column.showIcon?(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon","")):(t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon","")),t.icon.classList.contains("show"))if(t.icon.className="smart-grid-icon show column-icon",t.column.icon&&t.column.icon.indexOf(" ")>=0){const e=t.column.icon.trim().split(" ");for(let o=0;o<e.length;o++)t.icon.classList.add(e[o])}else t.icon.classList.add(t.column.icon);let l=t.column.showIcon?1:0;for(let e=0;e<t.buttonsGroup.children.length;e++)t.buttonsGroup.children[e].classList.contains("show")&&l++;switch(l){case 1:t.label.classList.add("one");break;case 2:t.label.classList.add("two");break;case 3:t.label.classList.add("three");break;case 4:t.label.classList.add("four");break;case 5:t.label.classList.add("five");break;case 6:t.label.classList.add("six")}t.classList.remove("smart-visibility-hidden"),t.column.grid._columnGap>0?t.classList.add("smart-grid-column-border"):t.classList.remove("smart-grid-column-border"),t.column.grid.appearance.showColumnHeaderLines?t.classList.remove("smart-grid-vertical-border-collapse"):t.classList.add("smart-grid-vertical-border-collapse"),(!t.column.rotationAngle||t._rotate())&&t._align()}_renderTemplate(){const t=this,e=t.column,o=e.labelTemplate;let l="";if("function"!=typeof o){if(o instanceof HTMLTemplateElement)l=o;else{if("string"!=typeof o||!o.startsWith||!o.startsWith("#"))return void(t.label.innerHTML=o);l=document.querySelector(o)}if(l){let o=l.content.cloneNode(!0).firstElementChild,n=e.label;n=n.toString(),n=n.replace(/'/gi,"\\'"),n=n.replace(/"/gi,'\\"');const i=o.outerHTML.replace(/{{value}}/gi,n).replace(/{{id}}/gi,e.label);t.label.innerHTML=i}}else t.label.innerHTML=o(e.label)}_render(){const t=this,e=t.column.dataField?t.column.dataField:"",o=t.column===t.column.grid._lastVisibleColumn;t.column.labelTemplate?t._renderTemplate():t.label.firstChild?t.label.firstChild.textContent!==t.column.label&&(t.column.label.indexOf("&")>=0||"SPAN"!==t.label.firstChild.nodeName?t.label.innerHTML="<span>"+t.column.label+"</span>":t.label.firstChild.textContent=t.column.label):t.label.innerHTML="<span>"+t.column.label+"</span>",t.column.title?t.setAttribute("title",t.column.title):t.removeAttribute("title"),t._refresh(),t.column.autoGenerated&&t.setAttribute("auto-generated",""),t.column.autoGenerated||o?t.style.width=t.column.computedWidth+"px":t.style.width=t.column.computedWidth-t.column.grid._columnGap+"px",t.style.height!==t.column.computedHeight+"px"&&(t.style.height=t.column.computedHeight+"px"),t.style.lineHeight!==t.column.computedHeight+"px"&&(t.style.lineHeight=t.column.computedHeight+"px"),t.column.grid.rightToLeft?t.style.right!==t.column.left+"px"&&(t.style.right=t.column.left+"px"):t.style.left!==t.column.left+"px"&&(t.style.left=t.column.left+"px"),t.style.top!==t.column.top+"px"&&(t.style.top=t.column.top+"px"),t.getAttribute("data-field")!==e&&t.setAttribute("data-field",e),t.setAttribute("header",""),t.column.freeze&&t.setAttribute("freeze",""),t.column.level>0&&(t.style.top=t.column.top+"px")}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_initialize(t){const e=this;e._isInitialized=!1;const o=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div"),i=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),u=document.createElement("div"),d=document.createElement("div");e.column=t,e.classList.add("smart-visibility-hidden"),d.classList.add("smart-drag-handle"),s.classList.add("smart-icon","smart-grid-icon"),o.classList.add("smart-label"),l.classList.add("smart-sort-button","smart-grid-icon"),n.classList.add("smart-filter-button","smart-icon-filter","smart-grid-icon"),i.classList.add("smart-action-button","smart-grid-icon"),i.setAttribute("aria-haspopup",""),a.classList.add("smart-description-button","smart-icon-help-circled","smart-grid-icon"),r.classList.add("smart-custom-button",t.customButtonIcon?t.customButtonIcon:"smart-icon-tools","smart-grid-icon"),u.classList.add("smart-buttons-group"),i.innerHTML="<div></div>",e.style.width=e.column.computedWidth+"px",e.appendChild(d),e.appendChild(s),e.appendChild(o),e.appendChild(u),u.appendChild(l),u.appendChild(n),u.appendChild(a),u.appendChild(r),u.appendChild(i),e.handle=d,e.icon=s,e.label=o,e.sortButton=l,e.filterButton=n,e.actionButton=i,e.descriptionButton=a,e.customButton=r,e.buttonsGroup=u,e._properties=[];const c=window.PointerEvent?"pointerdown":"mousedown",m=window.PointerEvent?"pointerup":"mouseup";e._filterDownEvent=function(t){"col-resize"!==t.target.style.cursor&&(t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t))}.bind(e),e._filterUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionDownEvent=function(t){t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t)}.bind(e),e.filterButton.addEventListener(c,e._filterDownEvent),e.filterButton.addEventListener(m,e._filterUpEvent),e.actionButton.addEventListener(m,e._actionUpEvent),e.actionButton.addEventListener(c,e._actionDownEvent),!e.column.autoShowActionButton&&e.column.showActionButton&&e._showActionButton(),!e.column.autoShowSortButton&&e.column.showSortButton&&e._showSortButton(),!e.column.autoShowFilterButton&&e.column.showFilterButton&&e._showFilterButton(),e.column.showDescriptionButton&&e._showDescriptionButton(),e.column.showCustomButton&&e._showCustomButton(),e.column.showIcon&&e._showIcon(),"_rowHeaderColumn"===e.column.dataField&&e.classList.add("top-near-corner"),e.customButton.onclick=function(t){e.column.onCustomButtonClick&&e.column.onCustomButtonClick(t)}.bind(e),e.column.sorted||e.column.sortOrder?(e.column.sorted=!0,e.setAttribute("aria-sort","asc"===e.column.sortOrder?"ascending":"descenting"),e._updateSortOrder()):(e.removeAttribute("aria-sort"),e.removeAttribute("sort-index")),e._properties=[],e._isInitialized=!0}template(){return""}_detach(){const t=this,e=window.PointerEvent?"pointerdown":"mousedown",o=window.PointerEvent?"pointerup":"mouseup";t.filterButton.removeEventListener(e,t._filterDownEven),t.filterButton.removeEventListener(o,t._filterUpEvent),t.actionButton.removeEventListener(o,t._actionUpEvent),t.actionButton.removeEventListener(e,t._actionDownEvent),t.element=null,t.column&&(t.column.grid=null,t.column.element=null),t.icon=null,t.label=null,t.sortButton=null,t.filterButton=null,t.actionButton=null,t.descriptionButton=null,t.customButton=null,t.buttonsGroup=null,t.column=null,delete t.grid,delete t.column,delete t.icon,delete t.label,delete t.sortButton,delete t.filterButton,delete t.actionButton,delete t.descriptionButton,delete t.customButton,delete t.buttonsGroup}onDetached(){this._detach()}});
49
49
  Smart.Utilities.Assign("Grid.Row",class{constructor(e){const t=this;if(e||(e={}),Object.assign(t,e),e){if(void 0===t.data){const i={$:{}};if(e.grid&&e.grid.dataSource){const t=e.grid.dataSource;for(let e=0;e<t.dataFields.length;e++)i[(t.dataFields?t.dataFields[e]:{}).name]=""}else Object.assign(i,e);e.id&&(i.$.id=e.id),t.data=i}if((void 0===e.$||e.$&&void 0===e.$.id)&&(e.data?(e.data.$&&e.data.$.id&&(t.id=e.data.$.id),t.id||(t.id=e.index)):void 0===t.id&&(t.id=e.index),void 0===t.id&&(t.id=Smart.Utilities.Core.createGUID())),void 0===t.detailHeight&&(t.grid?t.detailHeight=t.grid.rowDetail.height:t.detailHeight=200),void 0===t.height&&t.grid&&(t.height=t.grid.layout.rowMinHeight,t.grid.__autoRowHeight&&(t.height=t.grid.__autoRowHeight),t.grid.layout.rowHeight&&(t.height=t.grid.layout.rowHeight)),void 0===t.cellHeight&&(t.cellHeight=t.height),void 0===t.showDetail&&(t.showDetail=!1),void 0===t.index&&(t.index=-1),void 0===t.visibleIndex&&(t.visibleIndex=-1),void 0===t.freeze&&(t.freeze=!1),void 0===t.height&&(t.height=null),void 0===t.minHeight&&(t.minHeight=25,t.grid&&(t.minHeight=t.grid.layout.rowMinHeight)),void 0===t.checked&&(t.checked=!1),void 0===t.selected?(t.selected=!1,(t.grid&&t.grid._selection.rows[t.id]||t.grid&&t.grid._selection.indexes[t.index])&&(t.selected=!0)):t.selected&&t.grid&&(t.grid._selection.rows[t.id]=!0,t.grid._selection.indexes[t.index]=t.index),void 0===t.enabled&&(t.enabled=!0),void 0===t.visible&&(t.visible=!0),void 0===t.allowCheck&&(t.allowCheck=!0),void 0===t.filtered&&(t.filtered=!0),void 0===t.allowResize&&(t.allowResize=!0),void 0===t.allowReorder&&(t.allowReorder=!0),void 0===t.allowToggle&&(t.allowToggle=!0),void 0===t.allowSelect&&(t.allowSelect=!0),void 0===t.starred&&(t.starred=!1),void 0===t.expanded&&(e.data&&void 0!==e.data.expanded?t.expanded=e.data.expanded:t.expanded=!1),t._addStyle(),t.headerCell=null,t._cells=[],t.name="",t.comments=[],!t.autoGenerated&&999999!==t.index){if(t.data){if(t.data.comments&&("string"==typeof t.data.comments&&t.data.comments.indexOf("[{")>=0&&t.data.comments.indexOf("}]")>=0?t.data.comments=JSON.parse(t.data.comments.replaceAll("\t"," ")):"string"==typeof t.data.comments&&t.data.comments.indexOf("[{")>=0&&-1===t.data.comments.indexOf("}]")?t.data.comments=[]:t.comments=t.data.comments),t.data.rowStyle&&(t.style=t._style=e.rowStyle),t.data.history&&(t.history=t.data.history),t.data.style&&(t.style=t._style=t.data.style,t.grid&&(t.grid._cellStyles||(t.grid._cellStyles=[]),t.grid._cellStyles["row"+t.id]=!0,t.grid._cellStyles.length++)),t.data.settings){const e=JSON.parse(t.data.settings);void 0!==e.starred&&(t.starred=e.starred),void 0!==e.height&&(t.height=t.cellHeight=e.height)}const e=t.data.$?t.data.$:t.data;e.history&&(t.history=e.history),"string"==typeof t.history&&t.history.indexOf("[{")>=0&&(t.history=JSON.parse(t.history.replaceAll("\t"," "))),t.history&&t.history.length&&(e.createdDate||(e.createdDate=t.history[0].date),e.createdBy||(e.createdBy=t.history[0].user),e.updatedDate||(e.updatedDate=t.history[t.history.length-1].date),e.updatedBy||(e.updatedBy=t.history[t.history.length-1].user)),e.style&&(t.style=t._style=e.style),e.height&&(t.height=t.cellHeight=e.height),e.comments&&(t.comments=e.comments),e.starred&&(t.starred=e.starred),e.createdDate&&(t.createdDate=e.createdDate),e.createdBy&&(t.createdBy=e.createdBy),e.updatedDate&&(t.updatedDate=e.updatedDate),e.updatedBy&&(t.updatedBy=e.updatedBy)}t.grid&&t.grid._currentUser&&t.grid._currentUser.info&&(void 0===t.createdUserId?(t.createdUserId=t.grid._currentUser.info.id,t.createdDate=new Date):t.createdDate||(t.createdDate=new Date),t.history||(t.history=[],t.addHistory({action:"created",user:t.grid._currentUser.info.id,details:{value:t.name},date:t.createdDate})))}}}_addStyle(){this.style=this._style={background:"",color:"",status:"",fontSize:"",fontFamily:"",fontWeight:"",textDecoration:"",fontStyle:""}}setStyle(e){const t=this;t._style||t._addStyle(),["background","color","fontSize","status","fontFamily","fontWeight","textDecoration","fontStyle"].forEach((i=>{e[i]&&(t._style[i]=e[i])})),t.grid&&(t._style._changed=!0,t.grid._recycle(!1))}get properties(){return["allowToggle","allowResize","allowSelect","allowReorder","allowCheck","createdDate","updatedDate","createdBy","updatedBy","canNotify","children","starred","checked","cells","detailHeight","detailTemplate","cellHeight","expandHeight","data","enabled","expanded","filtered","freeze","grid","headerCell","height","index","id","minHeight","unbound","name","selected","showDetail","visible","parent","leaf","visibleIndex","history","comments","style"]}createElement(){const e=document.createElement("smart-grid-row");return this.element=e,e.setAttribute("role","row"),e._initialize(this),e}_autoSize(e){const t=this,i=t.grid;if(!i)return;let l=i.layout.rowMinHeight;void 0!==t.minHeight&&(l=t.minHeight);const a=t.element;if(e||(e=t),e&&(t.data=e.data),!a)return t.height;i.__autoHeightRows||(i.__autoHeightRows=[]);const n=(e,t,a)=>{if(!a||!t||t.autoGenerated)return 0;i.__autoHeightRows[t.dataField]||(i.__autoHeightRows[t.dataField]=[]);let n=""+e.data[t.dataField];"date"===t.dataType&&e.data[t.dataField]&&(n=""+e.data[t.dataField].toLocaleString());let r=n.length;e._templatesHeight&&e._templatesHeight[t.dataField]&&(r=e._templatesHeight[t.dataField]);const o=i.__autoHeightRows[t.dataField][r],d=o||function(e){a.style.height="auto",t.cellsWrap?a.content.classList.add("wrap"):a.content.classList.add("nowrap");let i=0;if(e&&t)if(t.template){const l=e.canNotify;if(e.canNotify=!1,a.cell.row=e,"function"==typeof t.template)if(a.content.textContent=e.data[t.dataField],e._templatesHeight&&e._templatesHeight[t.dataField])i=e._templatesHeight[t.dataField];else{const i={row:e,column:t,cell:a.cell,oldValue:a.cell.oldValue,value:a.cell.value,template:null,isMeasuring:!0},l=a.innerHTML,n=a.cell.canNotify;a.cell.canNotify=!1,a.cell.template(i),a.cell.canNotify=n,i.template?(a.content.textContent="",a.innerHTML=l):a.content.textContent=e.data[t.dataField]}else a._setTemplate(e.data[t.dataField]||"",t.template,a.content);e.canNotify=l}else if("date"===t.dataType){const i=a.cell.getFormattedValue(e.data[t.dataField],t.cellsFormat);a.content.textContent=i}else a.content.textContent=e.data[t.dataField];let l=a.offsetHeight;return"function"==typeof t.template&&i>0&&(l=i),a.style.height="",a.content.classList.remove("wrap"),a.content.classList.remove("nowrap"),l}(e);l=Math.max(l,d),i.__autoHeightRows[t.dataField][r]=d};for(let t=0;t<i._frozenNearColumns.length;t++)n(e,i._frozenNearColumns[t],a.children[0].children[t]);for(let t=0;t<i._frozenFarColumns.length;t++)n(e,i._frozenFarColumns[t],a.children[2].children[t]);for(let t=0;t<a.children[1].children.length;t++)n(e,i._columnElements[t].column,a.children[1].children[t]);return l}addHistory(e){const t=this;e&&(t.grid.storeHistory?(void 0===t.history&&(t.history=[]),t.history.length===t.grid.storeHistoryItems&&t.history.splice(0,1),Array.isArray(t.history)||(t.history=[]),t.history.push(e)):t.history=[])}clearHistory(){this.history=[]}autoSize(){const e=this,t=e.grid._measureRowElement(e.data),i=e.data?t.row._autoSize(e):e.grid.layout.rowMinHeight;e.height=i,t.remove()}getCell(e){const t=this,i=t.grid;if(!i)return null;if("string"!=typeof e&&"number"!=typeof e||(e=i.columnByDataField[e]),!e)return null;if(t["column_"+e.dataField]){const i=t["column_"+e.dataField];return i.column=e,i}{const l=new Smart.Grid.Cell(t,e,i);return t["column_"+e.dataField]=l,l}}get cells(){const e=this;return e._cells&&e.grid&&e._cells.length===e.grid.columns.length||e.createCells(),e._cells}get viewCells(){const e=this,t=[];for(let i=0;i<e.grid.viewColumns.length;i++){const l=e.grid.viewColumns[i];if(e["column_"+l.dataField]){const i=e["column_"+l.dataField];t.push(i)}else{const i=new Smart.Grid.Cell(e,l,e.grid);e["column_"+l.dataField]=i,t.push(i)}}return e._viewCells=t,t}createCells(){const e=this,t=e.grid;e._cells=[];for(let i=0;i<t.viewColumns.length;i++){const l=t.viewColumns[i];if(!l.autoGenerated)if(e["column_"+l.dataField]){const t=e["column_"+l.dataField];e._cells.push(t)}else{const i=new Smart.Grid.Cell(e,l,t);e["column_"+l.dataField]=i,e._cells.push(i)}}}toggle(e){this.element._handleExpandCollapse(!this.expanded,e)}select(){this.setProperty("selected",!0)}unselect(){this.setProperty("selected",!1)}expand(){this.element&&this.element._handleExpandCollapse(!0)}collapse(){this.element&&this.element._handleExpandCollapse(!1)}render(){const e=this;e.element.row=e,e.element._render()}setProperty(e,t){const i=this,l=i.getProperty(e);i[e]=t,l!==t&&(i.canNotify=!1,i.propertyChanged(e,l,t),i.canNotify=!0)}getProperty(e){const t=this;if("selected"===e&&t.grid){let i=!1;t.grid._selection.cells["row"+t.id]&&(i=null),t.grid&&t.grid._selection.rows[t.id]&&(i=!0),t.grid&&t.grid._selection.indexes[t.index]&&(i=!0),t.grid&&t.grid.dataSource.virtualDataSource&&!t.grid.dataSource.id&&(i=void 0!==t.grid._selection.indexes[t.index]);const l=t.grid.rows.canNotify;return t.grid.rows.canNotify=!1,t[e]=i,t.grid.rows.canNotify=l,i}return t[e]}_updateData(){const e=this;e.data&&e.data.$&&["updatedBy","updatedDate","createdDate","createdBy","starred","comments","history","style"].forEach((t=>{void 0!==e.data.$[t]?(e[t]=e.data.$[t],"style"===t&&(e._style=e[t],e._style._changed=!0)):"starred"===t?e[t]=!1:"comments"===t||"history"===t?e[t]=[]:"updatedBy"===t?e[t]=-1:"updatedDate"===t?e[t]=null:"style"===t&&(e._addStyle(),e._style._changed=!0)}))}propertyChanged(e,t,i){const l=this;if("updatedBy"!==e&&"createdBy"!==e&&"userData"!==e&&"starred"!==e&&"style"!==e&&"history"!==e&&"updatedDate"!==e&&"createdDate"!==e&&"comments"!==e){if("showDetail"===e){l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled&&(l.height=0);const e=l.element.rowDetail;if(l.grid.appearance.allowRowDetailToggleAnimation&&!l.grid.rowDetail.dialog.enabled){l.grid._resizeHandling=!1;const t=function(e){const t=l.grid._toggledRow;!t||"transform"!==e.propertyName&&"height"!==e.propertyName||a(t)},a=function(e){e.grid.$.content.style.transition="",e.element.rowDetail.removeEventListener("transitionend",t),e.element.rowDetail.removeEventListener("transitioncancel",t),e.grid._toggledRow=null,e.element.removeAttribute("has-detail"),l.grid._refresh(),setTimeout((()=>{l.grid._resizeHandling=!0}),50)};l.grid._toggledRow=l,e.addEventListener("transitionend",t),e.addEventListener("transitioncancel",t),i?(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.element.toggleDetailButton.classList.remove("smart-animate"),setTimeout((()=>{l.element.toggleDetailButton.classList.add("smart-animate"),l.element.toggleDetailButton.setAttribute("toggled",""),l.element.setAttribute("show-detail","")})),l.element.style.height=l.cellHeight+l.detailHeight+"px",l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)+l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),e.classList.remove("smart-hidden"),e.style.height!==l.detailHeight+"px"&&(e.style.height=l.detailHeight+"px"),e.style.lineHeight!==l.detailHeight+"px"&&(e.style.lineHeight=l.detailHeight+"px"),e.style.top!==l.cellHeight+"px"&&(e.style.top=l.cellHeight+"px")):(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)-l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),setTimeout((()=>{l.element.style.height=l.cellHeight+"px",l.element.removeAttribute("show-detail")})))}else l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled?l.grid._refresh():l.grid._recycle()}if("allowCheck"!==e&&"allowSelect"!==e||l.grid._recycle(),"checked"===e&&(l.grid.checkBoxes.hasThreeStates&&l.grid._hasThreeStates(l,l),l.grid._recycle()),"selected"===e){if(!1===l.allowSelect)return;if(i?(l.grid._selection.rows[l.id]=!0,l.grid._selection.indexes[l.index]=l.index):!1===i&&(void 0!==l.grid._selection.rows[l.id]&&delete l.grid._selection.rows[l.id],void 0!==l.grid._selection.indexes[l.index]&&delete l.grid._selection.indexes[l.index]),!l.element)return;i?l.element.setAttribute("aria-selected",!0):l.element.removeAttribute("aria-selected"),l.grid._recycle()}"visible"===e&&l.grid.refresh(),"expanded"===e&&(l.expandHeight||l.grid.refresh()),"height"===e&&(l.expandHeight||l.cellHeight!==i&&(l.cellHeight=i,l.grid.refresh())),"minHeight"===e&&(l.height=null,l.grid.refresh()),"freeze"===e&&(!0===i||"near"===i?l.grid._frozenNearRows.push(l):"far"===i?l.grid._frozenFarRows.push(l):(l.grid._frozenNearRows.splice(l.grid._frozenNearRows.indexOf(l),1),l.grid._frozenFarRows.splice(l.grid._frozenFarRows.indexOf(l),1)),l.grid.refresh())}else l.data&&l.data.$&&(l.data.$[e]=i,"style"===e&&(l._style=i,l._style._changed=!0))}}),Smart("smart-grid-row",class extends Smart.BaseElement{static get properties(){return{}}get isUtilityElement(){return!0}get hasStyleObserver(){return!1}addThemeClass(){}addDefaultClass(){}_initialize(e){const t=this,i=e.grid,l=i._columnElements,a=i._frozenNearColumns,n=i._frozenFarColumns,r=document.createElement("div"),o=document.createElement("div"),d=document.createElement("div"),s=document.createDocumentFragment(),c=document.createDocumentFragment(),h=document.createDocumentFragment();i.rightToLeft?(o.classList.add("far","smart-grid-cell-container"),r.classList.add("center","smart-grid-cell-container"),d.classList.add("near","smart-grid-cell-container")):(o.classList.add("near","smart-grid-cell-container"),r.classList.add("center","smart-grid-cell-container"),d.classList.add("far","smart-grid-cell-container")),t._properties=[],t.row=e,e.createCells(),t._mouseEnter=function(){if(!i.isScrolling&&!i.editing.isEditing&&(t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.commandColumn.inline&&!t.commandBar)){const e=document.createElement("div"),l=i._getCommandColumnCommandsTemplate();e.classList.add("smart-grid-command-bar"),e.innerHTML=l,r.appendChild(e),requestAnimationFrame((()=>{e.classList.add("show")})),i._updateCommandColumnCommandsVisibility(e,t.row),e.onmousedown=function(e){const l=e.composedPath();let a=null;for(let e=0;e<l.length;e++)if(l[e].classList.contains("smart-grid-command-item")){a=l[e];break}if(a){const l=a.getAttribute("command");i._applyCommand(l,[t.row]),t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),t.removeAttribute("hover"),e.stopPropagation(),e.preventDefault()}},t.commandBar=e}},t._mouseLeave=function(){i.isScrolling||i.editing.isEditing||t.commandBar&&(t.commandBar.classList.remove("show"),t.commandBar.addEventListener("transitionend",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})),t.commandBar.addEventListener("transitioncancel",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})))},t.addEventListener("mouseenter",t._mouseEnter),t.addEventListener("mouseleave",t._mouseLeave);for(let t=0;t<a.length;t++){const i=a[t],l=e.getCell(i).createElement();c.appendChild(l)}for(let t=0;t<n.length;t++){const i=n[t],l=e.getCell(i).createElement();h.appendChild(l)}for(let i=0;i<l.length;i++){const a=l[i],n=a.column;if(!a.parentNode||!n)break;const r=e.getCell(n).createElement();n&&n._treeColumn&&(t.toggleButton=r.toggleButton),s.appendChild(r)}o.appendChild(c),r.appendChild(s),d.appendChild(h);const g=document.createElement("div");g.classList.add("smart-grid-row-detail","smart-hidden","smart-animate");const m=document.createElement("div");m.classList.add("smart-grid-row-sub-container","smart-hidden"),t._rowFragment=document.createDocumentFragment(),t._rowFragment.appendChild(o),t._rowFragment.appendChild(r),t._rowFragment.appendChild(d),t._rowFragment.appendChild(g),t._rowFragment.appendChild(m),t.appendChild(t._rowFragment),t.cellsNearContainerElement=t.children[0],t.cellsContainerElement=t.children[1],t.cellsFarContainerElement=t.children[2],t.rowDetail=t.children[3],t.rowContainer=t.children[4],i.layout.rowHeight&&"auto"!==i.layout.rowHeight&&(e.filterRow?t.style.height=i.layout.rowMinHeight+"px":t.style.height=i.layout.rowHeight+"px"),delete t._rowFragment}get enableShadowDOM(){return!1}_handleExpandCollapse(e,t){const i=this,l=i.row,a=l.grid;if(!l.allowToggle)return null;a._toggledRow=l;let n={row:l,id:l.id};t&&(n.originalEvent=t.originalEvent),a.$.fireEvent(e?"rowExpand":"rowCollapse",n);const r=a.dataSource.virtualDataSourceOnExpand&&e&&!0!==l.data._loaded;if(e?a.dataSource._expandedRowIds[l.data.$.id]=!0:delete a.dataSource._expandedRowIds[l.data.$.id],a.stateSettings.autoSave&&a.saveState(null,["expandedRows"]),!a.appearance.allowRowToggleAnimation||r)a.rows.canNotify=!1,l.expanded=e,a.rows.canNotify=!0,l.data.expanded=e,r?(l.data._loaded=!0,l.element.querySelector("button").setAttribute("load",""),a._virtualDataRequest("expand")):(a._toggledRow=null,a._refresh()),r&&a.appearance.allowRowToggleAnimation&&(i.toggleButton.removeAttribute("toggled"),i.toggleButton.classList.remove("smart-animate"),setTimeout((()=>{i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")}),50));else{const t=function(e){e.height=e.cellHeight,a.$.content.style.transition="",e.element.rowContainer.innerHTML="",e.element.rowContainer.classList.add("smart-hidden"),e.element.rowContainer.removeEventListener("transitionend",n),e.element.rowContainer.removeEventListener("transitioncancel",n),e.element.rowContainer.style.height="",e.element.rowContainer.style.transform="",e.element.rowContainer.style.transition="",e.element.rowContainer.classList.remove("smart-animate"),e.element.toggleButton&&e.element.toggleButton.classList.remove("smart-animate"),a._refresh()},n=function(e){const l=a._toggledRow;i._toggleTimer=null,a._toggledRow=null,!l||"transform"!==e.propertyName&&"height"!==e.propertyName||setTimeout((()=>{t(l)}),50)};if(i._toggleTimer){clearTimeout(i._toggleTimer);const e=a._toggledRow;a._toggledRow=null,t(e)}i._toggleTimer=setTimeout((()=>{const t=function(){!function(){const e=a._toggledRow;a._refresh(),a._refreshRowHierarchy();let t=0;for(let e=0;e<a.rowHierarchy.length;e++){const i=a.rowHierarchy[e];let l=i.parent;for(;l;)l.id===a._toggledRow.id&&(t+=i.height),l=l.parent}const i=a._scrollView.scrollTop,l=a._contentHeight-(e.cellHeight+e.top-i);e.expandHeight=Math.min(l,t),e.height=e.cellHeight+e.expandHeight}(),a._recycle(!1),i.style.overflow="hidden",i.style.height="auto",i.style.lineHeight=l.cellHeight+"px"};e?(l.expanded=!0,t(),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",i.toggleButton&&i.toggleButton.removeAttribute("toggled"),a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),setTimeout((function(){i.toggleButton&&(i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")),i.rowContainer.addEventListener("transitionend",n),i.rowContainer.addEventListener("transitioncancel",n),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)"}))):(t(),l.expanded=!1,i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px",a.$.content.style.transition="",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)",i.toggleButton&&(i.toggleButton.setAttribute("toggled",""),i.toggleButton.classList.add("smart-animate")),setTimeout((function(){i.toggleButton&&i.toggleButton.removeAttribute("toggled",""),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),i.rowContainer.addEventListener("transitionend",n),i.rowContainer.addEventListener("transitioncancel",n),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px"}),0))}),50)}}_renderAddNewRow(){const e=this,t=e.row,i=t.grid,l=t.element,a=new Smart.Grid.Cell(t,i.columns[0],i);t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden");let n=i.editing.addNewRow.label;n.indexOf("{{")>=0&&(n=i.localize("addNewRow")),l.innerHTML="<smart-grid-cell><div>"+n+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),l.firstChild.cell=a,i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px"))}_renderFilterRow(){const e=this,t=e.row,i=t.grid,l=t.element;t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),l.innerHTML="<smart-grid-cell><div>"+i.localize("addNewRow")+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")}_renderEmpty(){this.classList.add("smart-hidden")}_renderCell(e,t,i){if(!t)return void i.classList.add("smart-hidden");let l=e.getCell(t);if(l.element!==i&&(l._styleChanged=!0),e._style&&!t.autoGenerated){const t=l._updating;l._updating=!0,e._style._changed&&(l.color=e._style.color,l.background=e._style.background,l.fontFamily=e._style.fontFamily,l.fontSize=e._style.fontSize,l.fontStyle=e._style.fontStyle,l.textDecoration=e._style.textDecoration,l.fontWeight=e._style.fontWeight);const a=i.firstElementChild,n=e=>a._style&&a._style[e]?a._style[e]:"backgroundColor"===e&&null===l.background&&""===a.style[e]||null===l[e]&&""===a.style[e]?null:a.style[e];n("backgroundColor")===l.background&&n("fontFamily")===l.fontFamily&&n("fontSize")===l.fontSize&&n("fontStyle")===l.fontStyle&&n("textDecoration")===l.textDecoration&&n("fontWeight")===l.fontWeight&&n("color")===l.color||(l._styleChanged=!0),l._updating=t}i.cell!==l&&(i.cell.background===l.background&&i.cell.borderColor===l.borderColor&&i.cell.color===l.color&&i.cell.fontSize===l.fontSize&&i.cell.fontFamily===l.fontFamily&&i.cell.textDecoration===l.textDecoration&&i.cell.fontWeight===l.fontWeight&&i.cell.fontStyle===l.fontStyle||(l._styleChanged=!0)),l.element=i,i.cell=l,t._treeColumn&&l.element.isRendered&&!e.filterRow&&l.element._refresh(),l.render(),t&&t.rowHeaderColumn&&(e.header=i,i.setAttribute("data-id",e.id))}_alternate(){const e=this,t=e.row,i=t.grid,l=i.appearance.alternationStart,a=i.appearance.alternationEnd>0?i.appearance.alternationEnd:1/0;if(!(i.appearance.alternationCount<=0)&&(e.removeAttribute("alternation-index"),t.visibleIndex>=l&&t.visibleIndex<=a)){const a=(t.visibleIndex-l)%i.appearance.alternationCount;e.setAttribute("alternation-index",a)}}_openRowDetailDialog(e){const t=this,i=t.row.grid,l=t.row;if(!i.rowDetail.dialog.enabled||!l.showDetail)return!1;const a=i._dialogRowDetail||i._createDialog(i.rowDetail.dialog);if(!l.detailTemplate&&!i.rowDetail.template&&i._openRowSettingsDialog&&!i.onRowDetailInit)return void(i.editing.dialog.visible||(t._settingsDialogRowId=l.id,i._openRowSettingsDialog(l.id)));if(i.rowDetail.dialog.visible&&a.row!==l)return void(l.showDetail=!1);const n="{{message}}"===i.rowDetail.dialog.header?i.localize("dialogRowDetailHeader",{value:l.visibleIndex+1}):i.rowDetail.dialog.header;!i.rowDetail.dialog.visible||i.rowDetail.dialog.row!==l||l.showDetail?(a.header.innerHTML=n,a.content.innerHTML="",a.content.style.width="100%",a.content.style.height="100%",a.row=l,a.querySelector(".smart-footer").classList.add("smart-hidden"),i._dialogRowDetail||(a.setAttribute("tabindex",0),a.modal=!0,a.btnConfirm.innerHTML=i.localize("dialogRowDetailButtonConfirm"),a.btnCancel.innerHTML=i.localize("dialogRowDetailButtonCancel"),a.btnCancel.classList.add("smart-hidden"),a.onOpen=function(){i.rowDetail.dialog.visible=!0},a.onClose=function(){i.rowDetail.dialog.visible=!1,a.row.showDetail=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},i._dialogRowDetail=a),a.open(),setTimeout((function(){a.focus()}),100),a.content.appendChild(e)):a.close()}_renderDetail(e){const t=this,i=t.row.grid,l=t.row;let a=l.id,n=l.detailTemplate||i.rowDetail.template;if(n.startsWith("#")&&(n=document.querySelector(n)),l._detail)return e.firstChild===l._detail||(e.firstChild&&e.removeChild(e.firstChild),e.appendChild(l._detail)),void(i.onRowDetailUpdated&&i.onRowDetailUpdated(l.index,l,e.firstChild));if(n instanceof HTMLTemplateElement){const t=n.content.cloneNode(!0).firstElementChild;a=a.toString(),a=a.replace(/'/gi,"\\'"),a=a.replace(/"/gi,'\\"');let i=t.outerHTML.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id);i.indexOf("{{value=")>=0&&(a?(i=i.substring(0,i.indexOf("{{value="))+a+i.substring(i.indexOf("}")),i=i.replace(/}/gi,""),i=i.replace(/{/gi,"")):(i=i.replace(/{{value=/gi,""),i=i.replace(/}}/gi,""))),i="<div>"+i+"</div>";for(let e in l.data)i=i.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==i&&(e.innerHTML=i)}else{let t="<div>"+n.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id)+"</div>";for(let e in l.data)t=t.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==t&&(e.innerHTML=t)}i.onRowDetailInit&&i.onRowDetailInit(l.index,l,e.firstChild),i.rowDetail.dialog.enabled?i.rowDetail.dialog.visible?t._openRowDetailDialog(e.firstChild):t._openRowDetailDialog(e.firstChild.firstElementChild):l._detail=e.firstChild}_render(){let e=this;const t=e.row,i=t.grid;if(!i)return;const l=t.getProperty("selected");if(!1===l&&e.hasAttribute("selected")?e.removeAttribute("selected"):!0===l?e.setAttribute("selected",""):null===l&&e.setAttribute("selected","indeterminate"),t.allowSelect||e.setAttribute("selected","none"),e.hasAttribute("unbound")&&e.removeAttribute("unbound"),t.unbound&&e.setAttribute("unbound",""),e.removeAttribute("focus"),i._selection.focusedCell&&i._selection.focusedCell.row&&i._selection.focusedCell.row.id===t.id&&e.setAttribute("focus",""),!i._toggledRow&&e.classList.contains("smart-animate"))return e.classList.remove("smart-animate"),e.rowContainer.innerHTML="",e.rowContainer.classList.add("smart-hidden"),i._refreshLayout(),void i._recycle();if(0===i.columns.length)return void e._renderEmpty();if(t.addNewRow&&!t.inline)return void e._renderAddNewRow();let a=!1;if(t.addNewRow&&t.inline&&(a=!0),i._toggledRow&&(t.id===i._toggledRow.id?e.setAttribute("toggle",""):e.hasAttribute("toggle")&&e.removeAttribute("toggle")),i._toggledRow&&i.appearance.allowRowToggleAnimation){let l=t.parent;if(!i._toggledRow.expanded&&i._toggledRow.id===t.id){const t=e.rowContainer;for(let e=0;e<t.children.length;e++){const l=t.children[e],a=l.getAttribute("data-id"),n=i.rowById[a];l.getAttribute("data-rendered")||(l.setAttribute("data-rendered",!0),n.element=l,n.render())}}for(;l;){if(l.id===i._toggledRow.id){const a=l.element.rowContainer;if(i._toggledRow.expanded){e.classList.add("smart-hidden");let l=t.createElement(i);for(let e=0;e<a.children.length;e++){const i=a.children[e];if(i.getAttribute("data-id")===t.id.toString())return void(l=i)}t.element=l,a.appendChild(l),a.classList.remove("smart-hidden"),l.row=t,e=l}break}l=l.parent}}e._alternate();const n=parseFloat(i.$.columnNearContainer.style.width),r=parseFloat(i.$.columnContainer.style.width),o=parseFloat(i.$.columnFarContainer.style.width),d=e.children[1],s=e.children[0],c=e.children[2];if(i.rightToLeft?(s.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&s.classList.add("vscroll")):(c.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&c.classList.add("vscroll")),e.hasAttribute("group")&&e.removeAttribute("group"),e.hasAttribute("tree")&&e.removeAttribute("tree"),e.hasAttribute("level")&&(e.removeAttribute("level"),e.removeAttribute("aria-level")),e.hasAttribute("leaf")&&e.removeAttribute("leaf"),e.hasAttribute("expanded")&&e.removeAttribute("expanded"),e.hasAttribute("summary")&&e.removeAttribute("summary"),e.hasAttribute("filter")&&e.removeAttribute("filter"),null===t.filtered&&e.setAttribute("filter","indeterminate"),i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&"advanced"===i.grouping.renderMode&&!t.filterRow?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),void 0!==t.label&&t.level===i.dataSource.groupBy.length-1&&e.setAttribute("leaf",""),void 0!==t.label?e.setAttribute("group",""):e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):i.dataSource.boundHierarchy?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),t.leaf&&e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):(t.canNotify=!1,t.leaf=!0,t.expanded=!1,t.summaryRow=!1,t.data||(t.data={}),t.data.summaryRow&&(t.summaryRow=!0),t.level=0,e.toggleButton&&e.toggleButton.classList.add("smart-hidden"),t.canNotify=!0),e.setAttribute("data-id",t.id),e.visible=t.visible,e.cellsNearContainerElement.classList.remove("smart-visibility-hidden"),e.cellsContainerElement.classList.remove("smart-visibility-hidden"),e.cellsFarContainerElement.classList.remove("smart-visibility-hidden"),e.removeAttribute("rowspan"),t.addNewRow&&(t.cellHeight=t.height=i.layout.rowMinHeight),i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")),i.rightToLeft?(d.style.right!==i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"&&(d.style.right=i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"),i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth<=0&&!i._scrollView.scrollWidth&&(d.style.right=-i.offsetWidth+i._computedColumnsWidth+"px")):d.style.left!==-i._scrollView.scrollLeft+"px"&&(d.style.left=-i._scrollView.scrollLeft+"px"),i.rowDetail.enabled){const l=e.rowDetail;e.removeAttribute("show-detail"),t.showDetail?(l.classList.remove("smart-hidden"),e.setAttribute("show-detail",""),i.rowDetail.dialog.enabled?l.classList.add("smart-hidden"):(l.style.height!==t.detailHeight+"px"&&(l.style.height=t.detailHeight+"px"),l.style.lineHeight!==t.detailHeight+"px"&&(l.style.lineHeight=t.detailHeight+"px"),l.style.top!==t.cellHeight+"px"&&(l.style.top=t.cellHeight+"px")),e._renderDetail(l)):l.classList.add("smart-hidden")}else e.rowDetail&&e.rowDetail.classList.add("smart-hidden");if(s.classList.remove("smart-hidden"),c.classList.remove("smart-hidden"),s.style.width!==n+"px"&&(s.style.width=n+"px"),d.style.width!==r+"px"&&(d.style.width=r+"px"),c.style.width!==o+"px"&&(c.style.width=o+"px"),s.style.height=t.cellHeight+"px",d.style.height=t.cellHeight+"px",c.style.height=t.cellHeight+"px",0===o&&c.classList.add("smart-hidden"),0===n&&s.classList.add("smart-hidden"),n>0&&(parseInt(n),parseInt(i._autoGeneratedColumnsNearWidth)),o>0&&parseInt(o)===parseInt(i._autoGeneratedColumnsFarWidth)&&c.classList.add("border-collapse"),t._classNames="",i.onRowClass){const e=i.onRowClass(t.visibleIndex,t.data,t);if(e){const i=e.trim().split(" ");t._classNames=i}}if(i.rowCSSRules){const e=Object.keys(i.rowCSSRules);let l=[];for(let a=0;a<e.length;a++){let n=e[a];const r={index:t.visibleIndex,data:t.data,row:t,api:i};i.rowCSSRules[n](r)&&l.push(n)}t._classNames=l}for(let l=0;l<i._frozenNearColumns.length;l++){const a=i._frozenNearColumns[l];let n=e.children[0].children[l];n||(n=t.getCell(a).createElement(),e.children[0].appendChild(n)),!1!==a.visbile&&e._renderCell(t,a,n)}for(let l=0;l<i._frozenFarColumns.length;l++){const a=i._frozenFarColumns[l];let n=e.children[2].children[l];n||(n=t.getCell(a).createElement(),e.children[2].appendChild(n)),!1!==a.visbile&&e._renderCell(t,a,n)}for(let l=0;l<d.children.length;l++)if(!i._columnElements[l+i._frozenNearColumns.length]){let i=e.children[1].children[l];e._renderCell(t,null,i)}for(let l=0;l<i._columnElements.length;l++){const a=i._columnElements[l],n=a.column;if(!a.parentNode||!n){if(a&&!n){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}else if(n&&a&&a.classList.contains("smart-visibility-hidden")){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}continue}let r=e.children[1].children[l];r||(a.column||(a.column=n),r=t.getCell(n).createElement(),e.children[1].appendChild(r)),a.classList.contains("smart-visibility-hidden")?r.classList.add("smart-visibility-hidden"):(r.classList.remove("smart-visibility-hidden"),e._renderCell(t,n,r))}if(a){let t=e.children[1].children[0];const l=d.getBoundingClientRect(),a=s.getBoundingClientRect();for(let e=0;e<s.children.length;e++)s.children[e].classList.add("smart-add-new-row");s.children[0].innerHTML='<div style="width: 100%;" class="smart-grid-icon smart-icon-plus show"></div>',s.children[0].style.width="50px",s.children[0].style.zIndex=9;const n=i.editing.addNewColumn.visible?i._addNewColumn.width:0;let r=l.width-a.width-n+6,o=0;(i.appearance.showRowHeaderNumber||i.appearance.showRowHeader)&&(o+=30),i.rowDetail.enabled&&(o+=20),i._frozenColumnsNearWidth&&(r+=i._frozenColumnsNearWidth),t.style.width=r+"px",t.style.left=i._scrollView.scrollLeft+o+"px",i.selection.enabled?(t.content.innerHTML=r>=250?i.localize("addNewRowAlt"):i.localize("addNewRowAltSmall"),s.children[1]&&(t.content.title=s.children[1].title=i.localize("addNewRow")),i.rightToLeft&&(t.style.left="initial",t.style.right=a.width+"px"),!1===i.appearance.showRowHeader&&(i.rightToLeft?t.content.innerHTML='<span style="margin-right: 35px;"></span>'+i.localize("addNewRowAlt"):t.content.innerHTML='<span style="margin-left: 35px;"></span>'+i.localize("addNewRowAlt"))):t.content.innerHTML=i.localize("addNewRow"),t.classList.add("smart-add-new-row"),t.firstElementChild.classList.add("align-left"),t.firstElementChild.classList.remove("align-right")}t&&t._style&&(t._style._changed=!1),e.visible?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")}template(){return""}_detach(){const e=this;e.row.headerCell=null,e.row._cells=[],e.row=null,delete e.row,e.element=null,e.removeEventListener("mouseenter",e._mouseEnter),e.removeEventListener("mouseleave",e._mouseLeave),delete e.element,delete e.grid,delete e._mouseEnter,delete e._mouseLeave,delete e.cellsNearContainerElement,delete e.cellsContainerElement,delete e.cellsFarContainerElement,delete e.rowDetail,delete e.rowContainer}onDetached(){this._detach()}});
50
- Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,e._style){const t=e._style;l.color=t.color,l.background=t.background,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize,l.fontStyle=t.fontStyle,l.textDecoration=t.textDecoration,l.fontWeight=t.fontWeight}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(e,t){if("value"===t)return l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if("editor"===t||"template"===t)return e[t]||l.column[t];if("focused"===t){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===t)return!0===l.row.getProperty("selected")||!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField];if("modifiedValue"===t){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const t=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==t?t:e.value}return e[t]},set:function(e,a,i){const r=this.get(e,a);return r===i||(e[a]=i,!("element"!==a&&"isEditing"!==a&&"oldValue"!==a&&"_updating"!==a&&"notifyFn"!==a&&!a.startsWith("_")&&"canNotify"!==a)||("error"===a||("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a&&(void 0===l.oldValue&&(l.oldValue=r),(()=>{l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),null!==i&&i.label&&i.value?(l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value):(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i);const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;l.grid.dataSource&&i!==l.grid.dataSource.boundSource[t][l.column.dataField]&&(l.grid._sortedColumns&&l.grid._sortedColumns.length>0?e[l.column.dataField]=i:l.grid.dataSource.boundSource[t][l.column.dataField]=i)}l.grid.dataSource.boundSource.canNotify=!0})()),"selected"===a&&(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0)),!(!l._updating&&l.canNotify&&(l.grid._recycle(),l.row.canNotify&&(l.propertyChanged&&l.propertyChanged(name.substring(1),r),0)))))))}})}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const r=a[e];l+=`${r}: ${i};`},r=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<r.length;e++)i(r[e]);e.getAttribute("style")!==l&&e.setAttribute("style",l),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.grid&&!t.grid.appearance.showSelectionOnTop||t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t)+" - "+l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){const a=l.formatNumber(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat)return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e);!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits?l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits:2,a=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:t,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+a.replace("-","")+")":a}return l.column.formatSettings.Intl.NumberFormat.locale?new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,l.column.formatSettings.Intl.NumberFormat).format(e):new Intl.NumberFormat(this.grid.locale,l.column.formatSettings.Intl.NumberFormat).format(e)}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const r=i.formatNumber(e,t);return void 0===r?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+r+")":r}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let r=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(r=r.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let n=0;n<i._cellsMerge.length;n++){const s=i._cellsMerge[n];let o=[],d=[];if(o.push(s.row),s.rowspan>1){const e=r.indexOf(s.row);if(e>=0)for(let t=e;t<e+s.rowSpan;t++)r[t]&&-1===o.indexOf(r[t])&&o.push(r[t])}if(d.push(s.column.dataField),s.colspan>1){const e=i.columns.indexOf(i.columnByDataField[s.column.dataField]);for(let t=e;t<e+s.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(o.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:s.row.getCell(s.column.dataField),rows:o,columns:d,row:s.row,column:s.column,endRow:o[o.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const r=s.row.getCell(s.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=r,r}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div"),o=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=s,e.appendChild(a),e.appendChild(n),n.setAttribute("content",""),a.setAttribute("indent",""),r.setAttribute("label",""),i.setAttribute("toggle-button",""),s.setAttribute("checkbox",""),s.setAttribute("role","checkbox"),l.setAttribute("has-toggle-button",""),n.appendChild(i),n.appendChild(s),o.classList.add("smart-input"),s.appendChild(o),d.checkBoxes.visible?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),n.appendChild(r),l.content=r}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let r=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(r=!0,e.row.filterRow&&(r=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(r=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(r=!1)),r)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group","");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let r=a.label;const n=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&n(e,i.children,l))}return l};if(void 0!==a.label){let s="",o=[];if(t.grouping.summaryRow.visible){const r=n(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[]),d={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;d[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([d],r):null;if(m)for(let a=0;a<c.length;a++){const i=c[a];a>0&&(s+=", ");let r=m[l.dataField][i];const n=l.cellsFormat;n&&(r=e.cell.getFormattedValue(r,n)),s+=t.localize(i,{value:r}),o.push(m[l.dataField][i])}}if(t.dataSource.virtualDataSourceOnExpand&&(s=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)r="<div header group-advanced><span group></span><span value></span>",s&&(r+="<div summary>",r+=s,r+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let n="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e));t&&t.color?(n=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}r=`<div style="${n}" header group-advanced><span group>${i}: </span><span value>${e}</span>`,s&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=""+s,r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)r="<div header><span group></span><span value></span>",s&&(r+="<div summary>",r+=s,r+="</div>");else{let e=a.label;"object"==typeof e&&l.cellsFormat&&(e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)),r="<div header><span group>"+i+": </span><span value>"+e+"</span>",s&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+o+")",r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else("basic"===t.grouping.renderMode||"multipleColumns"===t.grouping.renderMode)&&(r=a.label,"object"==typeof r&&l.cellsFormat&&(r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)),a.summaryRow?s&&(r+="<div summary>",r+=s,r+="</div>"):s&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+o+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse"));e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),r=s}let s=e.firstChild;if(t.dataSource.boundHierarchy&&i){s.children.length<=1&&(e.innerHTML="<div></div>",s=e.firstChild,e._createToggleButton(s,e.cell),s=e.firstChild);const n=s.children[0],o=s.children[1].children[0],d=s.children[1].children[1].firstChild,c=s.children[1].children[2];n.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?o.classList.add("smart-visibility-hidden"):(o.classList.remove("smart-visibility-hidden"),a.expanded?o.setAttribute("toggled",""):o.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",n.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';n.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?o.classList.add("smart-hidden"):(o.classList.remove("smart-hidden"),o.style.marginLeft=""),n.innerHTML=m,c.innerHTML=r,i&&t.grouping.formatFunction){const i={row:a,column:l,cell:e.cell,value:r,template:null};t.grouping.formatFunction(i),i.value!==r?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:r):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(s.innerHTML=r);let o="smart-label";e.style.zIndex="";const d=t.editing.addNewColumn.visible?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l.cellsAlign&&(o+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(o+=" align-"+l.cellsVerticalAlign),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)");if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(o+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(o+=" align-"+l.cellsVerticalAlign)),s.className!==o&&(s.className=o),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,group:{value:r,template:null}};l.formatFunction(t),t.group.value!==r&&(l._treeColumn?s.children[1].children[2].innerHTML=t.group.value:s.innerHTML=t.group.value),null!==t.group.template&&(s.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const r=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:r,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:r,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:r,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:r,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:r,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:r,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:r,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:r,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:r,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:r,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]),i="string"===a.dataType?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let n="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition)a._filterInfo.condition="",n="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":n="smart-icon-equals";break;case"starts_with":n="smart-icon-starts-with";break;case"ends_with":n="smart-icon-ends-with";break;case"not_equal":n="smart-icon-not-equal";break;case"less_than":n="smart-icon-less-than";break;case"less_than_or_equal":n="smart-icon-less-than-or-equal";break;case"greater_than":n="smart-icon-greater-than";break;case"greater_than_or_equal":n="smart-icon-greater-than-or-equal";break;case"contains":n="smart-icon-contains";break;case"does_not_contain":n="smart-icon-does-not-contain";break;case"range":n="smart-icon-between";break;default:n="smart-icon-search"}let s=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${n} show"></i></div> `;if("string"===a.dataType)s+=`<input class="smart-filter-input-value" data-type="${a.dataType}" /> `,e.innerHTML=s;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;s+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=s,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)s+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=s,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const a=document.createElement("div");a.classList.add("smart-input"),a.classList.add("smart-grid-check-box-cell-editor"),a.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),a.setAttribute("checked","indeterminate"),s=a.outerHTML,e.innerHTML=s,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const o=e.querySelector("input");if(o&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),o.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),o.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),o.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),o.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=o,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&(o.value=a._filterInfo.value,"date"===a.dataType&&(o.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),a.allowFilter||(o.disabled=!0),a.filterEditor)if(a.filterEditor.template){const t=a.filterEditor.template,l=document.createElement("div");a.filterTemplate instanceof HTMLTemplateElement?l.appendChild(t.content.cloneNode(!0)):t instanceof HTMLElement?l.appendChild(t):l.innerHTML=t,e.innerHTML="",e.appendChild(l),l.style.height="100%",l.style.width="100%";const i=e.querySelector("input");i&&(i.onfocus=()=>{e.setAttribute("focus","")},i.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,l)}else void 0!==a.filterEditor.min&&(o.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(o.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(o.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(o.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(o.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(o.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(o.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(o.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(e,t,l){const a=this,i=a.cell.grid,r=a.cell.column;let n=null;switch((!i.editing.enabled||!r.allowEdit||a.cell.readonly||"none"===i.editing.action||i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.editRow!==a.cell.row)&&a.setAttribute("readonly",""),t){case"checkBox":case"radioButton":case"switchButton":n=document.createElement("span"),n.className="smart-input",e?n.setAttribute("checked",""):null===e?n.setAttribute("checked","indeterminate"):n.removeAttribute("checked"),a.setAttribute("template",a.cell.template);break;case"checklist":if(e&&e.indexOf("[")>=0&&(e=JSON.parse(e)),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(e&&Array.isArray(e)&&e.length>0){const t=e.filter((e=>e.completed)).length;e=i.localize("completed",{value:t})+"/"+e.length}else e="";n=document.createElement("span"),n.innerHTML=e,a.setAttribute("template",a.cell.template),n.setAttribute("value",e.length);break;case"createdBy":case"updatedBy":{const e=a.cell.row;let s=null,o=null;if(s="createdBy"===t?e.createdBy:e.updatedBy,l.firstElementChild&&l.firstElementChild.hasAttribute("user-id")&&s===parseInt(l.firstElementChild.getAttribute("user-id")))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",r.dataField),d.setAttribute("row-id",a.cell.row.id);let c="";if(null!=s&&-1!==s){o=i.users.find((e=>e.id===s));const e=o;if(e){const t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,i=document.createElement("span");a&&(i.style.backgroundImage=`url('${e.image}')`,i.className="smart-drop-down-list-selection-image"),c+=l?'<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+';" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>":'<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c=""}d.innerHTML=c;const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),n=m,n.setAttribute("user-id",s),a.setAttribute("template",a.cell.template);break}case"collaborator":case"tags":{let t=[];if("number"==typeof e&&(e=""+e),""===e||null===e){let e=`\n <div class="smart-multi-combo-input-container tokens smart-flex smart-flex-auto" data-field="${r.dataField}" row-id="${a.cell.row.id}"> \n <div class="smart-multi-combo-input" data-field="${r.dataField}" row-id="${a.cell.row.id}" class="tokens smart-flex smart-flex-auto">\n <div class=" smart-flex-auto smart-flex"></div>\n </div>\n <span class="smart-arrow-down arrowbtn"><span>\n </div>\n `;return l.innerHTML=e,l.querySelector(".smart-arrow-down").onpointerdown=e=>{if(i.editing.enabled){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()},void a.setAttribute("template",a.cell.template)}if(null!==e&&(t=Array.isArray(e)?t.map((e=>e.trim())):e.indexOf("{")>=0||"[]"===e?JSON.parse(e):e.split(",").map((e=>e.trim()))),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&r.editor._items&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild&&l.firstElementChild.firstElementChild&&l.firstElementChild.firstElementChild.firstElementChild&&(l.firstElementChild.firstElementChild.firstElementChild.classList.remove("smart-flex-wrap"),a.cell.row.height>45&&l.firstElementChild.firstElementChild.firstElementChild.classList.add("smart-flex-wrap")));const s=document.createElement("div");s.classList.add("smart-multi-combo-input"),s.setAttribute("data-field",r.dataField),s.setAttribute("row-id",a.cell.row.id);let o='<div class="smart-flex smart-flex-auto">';if(t.length>2&&a.cell.row.height>45&&(o='<div class="smart-flex smart-flex-wrap">'),e)for(let e=0;e<t.length;e++){const l=t[e];let a=null;if(r.editor.dataSource)if("string"==typeof l&&r.editor._items&&r.editor._items[l])a=r.editor._items[l];else for(let e=0;e<r.editor.dataSource.length;e++){const t=r.editor.dataSource[e];if(void 0!==t.value&&void 0!==l&&void 0!==l.value&&t.value===l.value){a=t,r.editor._items||(r.editor._items=[]),r.editor._items[l]=t;break}if(void 0===t.value&&t===l||void 0!==t.value&&""+t.value===l){a=t,r.editor._items||(r.editor._items=[]),r.editor._items[l]=t;break}}else a=l;if(!a)continue;const i="string"==typeof a?a:a.label,n="string"==typeof a?null:a.color,s="string"==typeof a?null:a.image;if(""===i)continue;const d=document.createElement("span");if(s&&(d.style.backgroundImage=`url('${a.image}')`,d.className="smart-drop-down-list-selection-image"),n&&r.editor.colorItems?o+='<span title="'+i+'" data-item="'+i+'" style="background: '+n+"; color: "+new Smart.Color(n).getInvertedColor()+';" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>":o+='<span title="'+i+'" data-item="'+i+'" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>",r.editor.dataSource){if(r.editor.singleSelect){o+="</span>";break}o+='<span class=\'smart-hidden smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else o+="</span>"}if(s.innerHTML=o+"</div>",s.onpointerdown=e=>{if(e.target&&"#text"!==e.target.nodeName&&e.target.classList.contains("smart-drop-down-list-unselect-button")){let l=e.target.parentNode.getAttribute("data-item");if(r.editor.dataSource&&"string"==typeof l&&r.editor.dataSource)for(let e=0;e<r.editor.dataSource.length;e++)r.editor.dataSource[e].label===l&&(l=r.editor.dataSource[e],l.value&&(l=l.value));if(t[0]&&t[0].label){const n=t.map((e=>e.value)).indexOf(l);if(n>=0){t.splice(n,1);const l=a.cell.value,s=t.join(", ");i.setCellValue(a.cell.row.id,r.dataField,JSON.stringify(t)),i.onCellUpdate&&i.onCellUpdate([a.cell],[l],[s],(function(){}),a),e.preventDefault(),e.stopPropagation()}}else if(t.indexOf(l)>=0){t.splice(t.indexOf(l),1);const n=a.cell.value,s=t.join(", ");i.setCellValue(a.cell.row.id,r.dataField,s),i.onCellUpdate&&i.onCellUpdate([a.cell],[n],[s],(function(){}),a),e.preventDefault(),e.stopPropagation()}}else if(e.target.classList.contains("smart-drop-down-list-selection-label")){if(i.editing.enabled){const t=e.target.parentElement.parentElement,l=t.getAttribute("data-field"),a=t.getAttribute("row-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}},!r.cellsWrap&&r.allowEdit&&i.editing.enabled){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),s.classList.add("smart-flex-auto"),s.classList.remove("smart-flex-wrap"),t.length>2&&i.layout.rowHeight>45&&s.classList.add("smart-flex-wrap"),i.rightToLeft&&(s.style.direction="rtl"),l.appendChild(s),"input"!==r.editor.template&&l.appendChild(e),n=l,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}}else r.cellsWrap||r.allowEdit||s.classList.add("smart-flex-auto"),n=s;a.setAttribute("template",a.cell.template),n.setAttribute("value",e);break}case"dropDownList":case"dropdownlist":case"list":{const t=document.createElement("div");if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(t.innerHTML='<span class="smart-truncate">'+e+"</span>",r.allowEdit&&i.editing.enabled){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),t.classList.add("smart-flex-auto","smart-multi-combo-input"),l.appendChild(t),l.appendChild(e),l.classList.add(a.cell.template.toLowerCase()),n=l,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),r=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(i.beginEdit(n,r),a.cell.column.editor&&a.cell.column.editor.instance){const e=a.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}else n=t;a.setAttribute("template",a.cell.template.toLowerCase()),n.setAttribute("value",e);break}case"password":l.innerHTML=e?'<span class="smart-truncate">'+e.replace(/./g,"*")+"</span>":"",a.setAttribute("template",a.cell.template);break;case"color":l.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${e};"></span>`,a.setAttribute("template",a.cell.template);break;case"autoNumber":n=document.createElement("span"),n.innerHTML=1+a.cell.row.visibleIndex,a.setAttribute("template",a.cell.template);break;case"createdDate":case"createdTime":l.innerHTML='<span class="align-left smart-truncate">'+a.cell.getFormattedValue(a.cell.row.createdDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.createdDate,"t")+"</span>",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"updatedDate":case"updatedTime":a.cell.row.updatedDate?l.innerHTML='<span class="align-left smart-truncate">'+a.cell.getFormattedValue(a.cell.row.updatedDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.updatedDate,"t")+"</span>":l.innerHTML="",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"progress":{const t=e?parseInt(100*e)+"%":"0%";if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&t===l.firstElementChild.getAttribute("value"))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const i="white",r=["#D50000","#F4511E","#F6BF26","#33B679"];let n=r[0];n=e<.25?r[0]:e<.5?r[1]:e<.75?r[2]:r[3],l.innerHTML='<div value="'+t+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+t+';"><div title="'+t+'" style="width: 100%; height: 4px; background: '+n+"; color: "+i+';" class="smart-truncate smart-token"></div></div><span>'+t+"</span></div>",a.setAttribute("template",a.cell.template);break}case"attachments":{if(""===e)return l.innerHTML="",a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")){const t=l.firstElementChild.getAttribute("value");if(e&&e.indexOf(t)>=0)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild.evaluateScroll&&l.firstElementChild.evaluateScroll());if(t&&e&&Array.isArray(e)&&e[0]&&e[0].value&&t.length===e[0].value.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template)}const t=document.createElement("div"),r=document.createElement("div");t.classList.add("container"),r.classList.add("attachments");let s=e;if(i._findIsFile(s)){let e="";if(s)try{e=JSON.parse(s)}catch(e){console.log(e)}s=e}if("string"==typeof s&&(s.indexOf("[{")>=0||s.indexOf("}]")>=0)){let e="";if(s)try{e=JSON.parse(s)}catch(e){console.log(e)}s=e}Array.isArray(s)&&s.forEach((e=>{const l=document.createElement("div");l.title=e.label,l.classList.add("item"),l.innerHTML="<div></div>",l.firstElementChild.classList.add("smart-grid-icon","show","attachment"),e.label.indexOf("png")>=0||e.label.indexOf("jpg")>=0||e.label.indexOf("jpeg")>=0||e.label.indexOf("gif")>=0?l.firstElementChild.classList.add("smart-icon-image"):e.label.indexOf(".pdf")>=0?l.firstElementChild.classList.add("smart-icon-pdf"):e.label.indexOf(".tsv")>=0||e.label.indexOf(".txt")>=0||e.label.indexOf(".csv")>=0?l.firstElementChild.classList.add("smart-icon-text"):e.label.indexOf(".xls")>=0||e.label.indexOf(".xlsx")>=0?l.firstElementChild.classList.add("smart-icon-excel"):e.label.indexOf(".ppt")>=0?l.firstElementChild.classList.add("smart-icon-powerpoint"):e.label.indexOf(".zip")>=0||e.label.indexOf(".rar")>=0||e.label.indexOf(".7z")>=0?l.firstElementChild.classList.add("smart-icon-archive"):e.label.indexOf(".doc")>=0||e.label.indexOf(".docx")>=0?l.firstElementChild.classList.add("smart-icon-word"):l.firstElementChild.classList.add("smart-icon-file"),t.appendChild(l)}));const o=document.createElement("div");o.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");if(d.classList.add("smart-arrow-right","arrowbtn"),r.onpointerdown=e=>{if(e.target.classList.contains("attachment")){const t=JSON.parse(a.cell.value),l=[...r.children[0].children].indexOf(e.target.parentNode);if(t[l]){const e=document.createElement("a");if(t[l].value.indexOf(window.location.host)>=0)fetch(t[l].value).then((e=>e.blob())).then((a=>{const i=URL.createObjectURL(a);e.download=t[l].label,e.href=i,e.click()}));else{if(t[l].value.indexOf("base64")>=0){const a=i._getFileFromBase64(t[l].value);e.href=URL.createObjectURL(a)}else e.href=t[l].value;e.target="_blank",e.click()}}e.stopPropagation(),e.preventDefault()}else if("DIV"===e.target.nodeName&&e.target.classList.contains("arrowbtn")){let l=parseInt(t.style.marginLeft);isNaN(l)&&(l=0);const i=o===e.target,r=t.scrollWidth-a.offsetWidth+30;t.style.marginLeft=i?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(t.style.marginLeft),0===l?o.classList.add("smart-hidden"):o.classList.remove("smart-hidden"),e.stopPropagation(),e.preventDefault()}},t.children.length){r.appendChild(t);const e=25*s.length;e-a.offsetWidth+30>30&&(r.appendChild(o),r.appendChild(d)),r.evaluateScroll=()=>{const l=e-a.offsetWidth+30;t.style.marginLeft="0px",o.classList.add("smart-hidden"),l<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),l>30&&(r.appendChild(o),r.appendChild(d))},n=r}else n=document.createElement("div");a.setAttribute("template",a.cell.template),e&&e[0]&&e[0].value?n.setAttribute("value",e[0].value):s&&s[0]&&s[0].label?n.setAttribute("value",s[0].label):n.setAttribute("value",e);break}case"images":{if(""===e)return l.innerHTML="",a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(!i._recycleFiles&&l.firstElementChild&&l.firstElementChild.hasAttribute("value")){const t=l.firstElementChild.getAttribute("value");if(e&&e.indexOf(t)>=0)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild.evaluateScroll&&l.firstElementChild.evaluateScroll());if(t&&e&&Array.isArray(e)&&e[0]&&e[0].value&&t.length===e[0].value.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template)}const t=document.createElement("div"),r=document.createElement("div");t.classList.add("container"),r.classList.add("images");let s=e;if(i._findIsFile(s)){let e="";if(s)try{e=JSON.parse(s)}catch(e){console.log(e)}s=e}if("string"==typeof s&&(s.indexOf("[{")>=0||s.indexOf("}]")>=0)){let e="";if(s)try{e=JSON.parse(s)}catch(e){console.log(e)}s=e}Array.isArray(s)&&s.forEach((e=>{const l=document.createElement("img");l.style.display="none";let a="";a=e.small?e.small:e.medium?e.medium:e.large?e.large:e.value,l.onload=()=>{l.style.display=""},a.indexOf("base64")>=0?l.src=a:(i._imagesCache||(i._imagesCache=[]),i.uploadSettings.url?i._imagesCache[a]?i._findUserFile(e)&&(l.src=a):(i._imagesCache[a]=!0,l.style.display="none",i._findUserFile(e)&&(l.src=a,l.style.display="")):l.src=a,l.onerror=()=>{l.style.display="none"}),l.title=e.label,l.setAttribute("data-url",e.large||e.value),t.appendChild(l)}));const o=document.createElement("div");o.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");if(d.classList.add("smart-arrow-right","arrowbtn"),r.onpointerdown=e=>{if("IMG"===e.target.nodeName)i._openImagePreviewDialog(e.target),e.stopPropagation(),e.preventDefault();else if("DIV"===e.target.nodeName&&e.target.classList.contains("arrowbtn")){let l=parseInt(t.style.marginLeft);isNaN(l)&&(l=0);const i=o===e.target,r=t.scrollWidth-a.offsetWidth+30;t.style.marginLeft=i?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(t.style.marginLeft),0===l?o.classList.add("smart-hidden"):o.classList.remove("smart-hidden"),e.stopPropagation(),e.preventDefault()}},t.children.length){r.appendChild(t);const e=25*s.length;e-a.offsetWidth+30>30&&(r.appendChild(o),r.appendChild(d)),r.evaluateScroll=()=>{const l=e-a.offsetWidth+30;t.style.marginLeft="0px",o.classList.add("smart-hidden"),l<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),l>30&&(r.appendChild(o),r.appendChild(d))},n=r}else n=document.createElement("div");a.setAttribute("template",a.cell.template),e&&e[0]&&e[0].value?n.setAttribute("value",e[0].value):s&&s[0]&&s[0].label?n.setAttribute("value",s[0].label):n.setAttribute("value",e);break}case"email":Smart.Validator&&(n=document.createElement("span"),null===e||""===e?n.innerHTML="":Smart.Validator.email(e)?n.innerHTML=e:(n.className="url",n.innerHTML='<a href="mailto:'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",n.firstElementChild&&(n.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),n.firstElementChild.click()}))),a.setAttribute("template",a.cell.template);break;case"url":Smart.Validator&&(n=document.createElement("span"),n.className="url",null===e||""===e?n.innerHTML="":Smart.Validator.url(e)?n.innerHTML='<a href="https://'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>":n.innerHTML='<a href="'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",n.firstElementChild&&(n.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),n.firstElementChild.click()})),a.setAttribute("template",a.cell.template);break;default:{let t=null;a.setAttribute("template","");const n=a.cell.row,s=l;let o=a.cell.getFormattedValue(e,r.cellsFormat);if(s.style.lineHeight="","function"==typeof a.cell.template){const t={row:n,column:r,cell:a.cell,oldValue:a.cell.oldValue,value:e,template:null};let l=s.querySelector(".smart-grid-cell-template");const d=n.id;i.isHScrolling&&(i._cachedTemplates||(i._cachedTemplates=[]),l&&0===l.innerHTML.length&&(l=null),!l&&i._cachedTemplates&&i._cachedTemplates[r.dataField+"_"+d]&&(0===i._cachedTemplates[r.dataField+"_"+d].innerHTML.length?delete i._cachedTemplates[r.dataField+"_"+d]:t.template=i._cachedTemplates[r.dataField+"_"+d])),l&&l.getAttribute("column")===r.dataField?t.template=l.firstElementChild:l=null,a.formattedValue!==o&&(l=null),a.cell.canNotify=!1,n.canNotify=!1;const c=Object.assign({},{background:a.cell.background,color:a.cell.color,fontSize:a.cell.fontSize,fontFamily:a.cell.fontFamily,fontWeight:a.cell.fontWeight,textDecoration:a.cell.textDecoration,fontStyle:a.cell.fontStyle});if(a.cell.template(t),!l&&t.template)if(t.template instanceof HTMLElement){const e=document.createElement("div");e.classList.add("smart-grid-cell-template"),e.setAttribute("column",r.dataField),s.innerHTML="",s.appendChild(e),e.appendChild(t.template)}else s.innerHTML='<div column="'+r.dataField+'" class="smart-grid-cell-template">'+t.template+"</div>";else l||null!==t.template||(s.innerHTML=e);if(i.isHScrolling&&!i._cachedTemplates[r.dataField+"_"+d]){const e=s.firstElementChild.firstElementChild;e&&(i._cachedTemplates[r.dataField+"_"+d]=e)}s.style.background===c.background&&s.style.color===c.color&&s.style.fontSize===c.fontSize&&s.style.fontWeight===c.fontWeight&&s.style.fontStyle===c.fontStyle||(a.cell._styleChanged=!0,a.cell._setStyle(s)),a.cell.background!==c.background||a.cell.color!==c.color||a.cell.fontSize!==c.fontSize||a.cell.fontWeight!==c.fontWeight||a.cell.fontStyle!==c.fontStyle?(a.cell._styleChanged=!0,a.cell._setStyle(s)):a.cell._styleChanged&&a.cell._setStyle(s),void 0===a.cell.oldValue&&(a.cell.oldValue=e),a.formattedValue=o,a.cell.canNotify=!0,n.canNotify=!0}else{if(""!==s.textContent&&(s.textContent=""),a.cell.template instanceof HTMLTemplateElement)t=a.cell.template;else if(a.cell.template instanceof HTMLElement){const t=a.cell.template.innerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,n.id);s.innerHTML!==t&&(s.innerHTML=t)}if(a.cell.template.startsWith&&a.cell.template.startsWith("#")&&(t=document.querySelector(a.cell.template)),t){let l=t.content.cloneNode(!0).firstElementChild;const d=e;if(e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),l.querySelector("[smart-if]")){const t=l.querySelector("[smart-else]"),a=l.querySelectorAll("[smart-if]");let i=!1;for(let t=0;t<a.length;t++){const n=a[t],s=n.getAttribute("smart-if").split(" "),o=s[1].trim();let c=s[2].trim(),m=e;switch("Today"===c&&(c=new Date),"date"===r.dataType&&(e=new Date(d).getTime(),c=new Date(c).getTime()),o){case">":e>parseFloat(c)&&(l=n,i=!0);break;case">=":e>=parseFloat(c)&&(l=n,i=!0);break;case"=":case"==":case"===":e===c&&(l=n,i=!0);break;case"<":e<parseFloat(c)&&(l=n,i=!0);break;case"<=":e<=parseFloat(c)&&(l=n,i=!0)}if(e=m,i)break}!i&&t&&(l=t)}let c=l.outerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,n.id);for(c.indexOf("{{value=")>=0&&(e?(c=c.substring(0,c.indexOf("{{value="))+e+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const t=c.indexOf("{{value::"),l=c.substring(t+9,c.indexOf("}}")),i=a.cell.getFormattedValue(e,l);c=c.replace(`{{value::${l}}}`,i)}if(r._treeColumn){const e=s.firstChild;if(e&&e.classList&&a.toggleButton&&r._treeColumn&&s.children[1]){const e=s.children[0],t=s.children[1].children[0],l=s.children[1].children[1].firstChild,a=s.children[1].children[2];let r="";if(i.grouping.enabled){let e=n.level-1;"multipleColumns"!==i.grouping.renderMode&&(r+='<div style="width: '+(1+e)*i.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<n.level;e++)r+="<div class='smart-indent'></div>";n.checked?l.setAttribute("checked",""):!1===n.checked?l.removeAttribute("checked"):null===n.checked&&l.setAttribute("checked","indeterminate"),n.leaf?n.allowCheck?l.classList.remove("smart-visibility-hidden"):l.classList.add("smart-visibility-hidden"):n.allowCheck?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),n.allowCheck?i.checkBoxes.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"):i.checkBoxes.visible||l.classList.add("smart-hidden"),e.innerHTML=r,t.classList.add("smart-visibility-hidden"),n.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),n.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),n.data.isEmpty&&t.classList.add("smart-visibility-hidden"),a.innerHTML=c,i.appearance.showTooltips?a.setAttribute("title",o):a.hasAttribute("title")&&a.removeAttribute("title")}}else s.innerHTML!==c&&(s.innerHTML=c)}else if("string"==typeof a.cell.template){""===e&&(e="&nbsp;");const t=a.cell.template.replace(/{{value}}/gi,e).replace(/{{id}}/gi,n.id);s.innerHTML!==t&&(s.innerHTML=t)}}if("auto"===a.cell.row.height||i.layout.allowCellsWrap||"auto"===i.layout.rowHeight){const e=s.querySelector(".smart-grid-cell-template");if(e){n._templatesHeight||(n._templatesHeight=[]);const t=(e,t)=>{if(e){const l=i.rowById[e.getAttribute("data-id")];l._templatesHeight[r.dataField]=t,l._isDirty=!0,l.autoSize(),delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),i.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(n)return l.innerHTML="",l.appendChild(n),a.cell._setStyle(l),n}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,r=a._isMeasureRow?null:l.cellsFormat,n=t.grouping.enabled&&t.dataSource.groupBy.length>0;if(!(!1!==t._recycleValues||n||l.formatFunction||l._treeColumn||a.summaryRow)){if(e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id&&a.element.star.classList.remove("smart-hidden")),e.cell.background||e.cell.color){e.cell._styleChanged=!0;const t=e.firstChild;e.cell._setStyle(t)}return}if(t.grouping.enabled&&t.dataSource.groupBy.length>0){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button");let s=l.displayField?i[l.displayField]:i[l.dataField];null!==s||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(s=0),"string"===l.dataType&&(s=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(s=!1),"date"===l.dataType&&(s=new Date)),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(s="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row");const o=t=>t?t.startsWith("off_")?(e.classList.remove(t.substring(4)),!1):(e.classList.add(t),e.hasAttribute("customCSS")&&(t=t+" "+e.getAttribute("customCSS")),e.setAttribute("customCSS",t),!0):(e.setAttribute("highlight",""),!0);if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS");const l=t.split(" ");for(let t=0;t<l.length;t++)e.classList.remove(l[t])}if(l.highlight&&!a.summaryRow&&(o(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]&&o(t.highlightedCells[a.id][l.dataField]),t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]&&o(t.highlightedRows[a.id]),t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),s=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,s=e.cell.value),void 0===s&&(s="");let d=s;r?d=e.cell.getFormattedValue(s,r):l.formatSettings&&l.formatSettings.Intl&&(d=e.cell.getFormattedValue(s,l.formatSettings.Intl));const c=e.firstChild;if(e.content=c,l._isDirty&&(c.innerHTML=""),c.hasAttribute("data-field")&&c.getAttribute("data-field")!==l.dataField&&(c.innerHTML=""),c.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?c.appendChild(t):c.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void c.appendChild(t)}e.cell.value!==s&&(d=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames||e._rowClassNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,s,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,s,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);let r=[];for(let n=0;n<i.length;n++){let o=i[n];const d={index:a.visibleIndex,value:s,dataField:l.dataField,row:a,api:t};l.cellsCSSRules[o](d)&&(e.classList.add(o),r.push(o))}e.__classNames=r}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const m=e._getCellAlignment(a,l),u=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let p="";if(m.align&&(p+=m.align+" "),m.verticalAlign&&(p+=m.verticalAlign+" "),l.cellsWrap&&(p+="wrap "),p+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let g=l.left;if(t.rightToLeft?e.style.right!==g+"px"&&(e.style.right=g+"px"):e.style.left!==g+"px"&&(e.style.left=g+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),p+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command",""),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze","")),l.cellsRotationAngle){if(!e._rotateCellContent(c,l,s))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(c));c.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)c.innerHTML="";else if(l.autoGenerated&&(c.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let r in a){const n=l.cellsFormat;let s=a[r];n&&n.indexOf("p")>=0&&"count"===r?s=a[r]:n&&"date"!==l.dataType&&(s=e.cell.getFormattedValue(s,n)),i.push(t.localize(r,{value:s}))}const r=i.join(", "),n=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let s=`<div title = "${r}" class="smart-truncate summary-value" > <span class="label">${r}</span>${n}</div> `;if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;s=`<div title = "${r}" class="smart-truncate summary-value" > <span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> <span class="label">${r}</span>${n}</div> `}c.innerHTML!==s&&(c.innerHTML=s)}else if(t.summaryRow.editing&&l.allowSummary)if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value" ><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;c.innerHTML!==l&&(c.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value" ><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;c.innerHTML!==e&&(c.innerHTML=e)}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?c.firstElementChild.setAttribute("has-summary",""):c.firstElementChild.removeAttribute("has-summary"),c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c._clickTarget=e.target},c.onpointerup=l=>{c._clickTarget===l.target&&(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="";if(l=a.showDetail?'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggled toggle-button></button>':'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggle-button></button>',t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,c.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):c.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(c.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else c.innerHTML!==l&&(c.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)c.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let r="";for(let e=0;e<t;e++)r+="A";return r+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?c.textContent="":c.textContent=l(a)}else if(u)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)c.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)c.innerHTML=s;else switch(e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(s,e.cell.template,c);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(s,e.cell.template,c);break;case"attachment":e._setTemplate(s,"attachments",c);break;case"image":e._setTemplate(s,"images",c);break;case"email":e._setTemplate(s,"email",c);break;case"url":e._setTemplate(s,"url",c);break;default:e._setTemplate(s,e.cell.template,c)}else{const i=c.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&c.children[1]){const e=c.children[0],i=c.children[1].children[0],r=c.children[1].children[1].firstChild,n=c.children[1].children[2];let s="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?s="":"multipleColumns"!==t.grouping.renderMode&&(s+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)s+="<div class='smart-indent'></div>";if(a.checked?r.setAttribute("checked",""):!1===a.checked?r.removeAttribute("checked"):null===a.checked&&r.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?r.classList.remove("smart-visibility-hidden"):r.classList.add("smart-visibility-hidden"):a.allowCheck?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(c)}}a.allowCheck?t.checkBoxes.visible?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"):t.checkBoxes.visible||r.classList.add("smart-hidden"),e.innerHTML=s,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),n.innerHTML=d,t.appearance.showTooltips?n.setAttribute("title",d):n.hasAttribute("title")&&n.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let r=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(r+=l.computedWidth)}e.style.width=r+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let r=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let r=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(r+=l.cellHeight)}e.style.height=r+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const n="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(s,a.visibleIndex,a.data),o=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(o>l[0]&&o<l[1]){d=!0;break}}if(a._rowSpan=n,n&&!d){let s=0;t._cellRowSpan.push([o,o+n,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(n,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=o;e<=o+n-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(s+=l.cellHeight)}e.style.height=s+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",n),i._styleChanged=!0,r=n}}1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width="",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===r&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),c.textContent===d||l.formatFunction||("string"==typeof d&&d.indexOf("&")>=0?c.innerHTML=d:c.textContent=d),i.column.autoGenerated||i._setStyle(c),t.appearance.showTooltips?c.setAttribute("title",i.tooltip||d):c.hasAttribute("title")&&c.removeAttribute("title"),t.appearance.showTooltipsOverflow&&(!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title"),d&&d.length)&&(14*d.length*.52>l.computedWidth?c.setAttribute("title",i.tooltip||d):!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title"))}else c.textContent=d}}if(c.className!==p&&(c.className=p),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&c.firstChild&&c.firstChild.classList&&c.firstChild.classList.contains("smart-grid-cell-loading")&&(c.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),c.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const t={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:s,formattedValue:d,template:null};e.cell.canNotify=!1,a.canNotify=!1;const i=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});await l.formatFunction(t),c.style.background===i.background&&c.style.color===i.color&&c.style.fontSize===i.fontSize&&c.style.fontFamily===i.fontFamily&&c.style.textDecoration===i.textDecoration&&c.style.fontWeight===i.fontWeight&&c.style.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c)),e.cell.background===i.background&&e.cell.color===i.color&&e.cell.fontSize===i.fontSize&&e.cell.fontWeight===i.fontWeight&&e.cell.textDecoration===i.textDecoration&&e.cell.fontFamily===i.fontFamily&&e.cell.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c));let r=!0;if(t.value!==s&&(e.toggleButton?c.children[1].children[2].innerHTML=t.value:c.innerHTML=t.value,r=!1),null!==t.template){if(e.toggleButton){const e=c.children[1].children[2];e.innerHTML!==t.template&&(e.innerHTML=t.template)}else if(c.innerHTML!==t.template){const e=document.createElement("div");e.innerHTML=t.template,e.innerHTML!==c.innerHTML&&(c.innerHTML=t.template)}r=!1}r&&(l.cellsFormat?c.textContent=d:c.textContent=s),e.cell.canNotify=!0,a.canNotify=!0}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,c),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&c.querySelector("[toggle-button]")){const e=c.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),r=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),r.appendChild(l),r.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(r),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const r=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-r.top+"px",i.style.left=a._offsetLeft(l)-r.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,r=e.row,n=e.row.index,s=r._style;if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][n];a.cell.canNotify=!1,r.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(s&&s._changed?(a.cell._styleChanged=!0,a.cell.background=s.background,a.cell.color=s.color,a.cell.fontFamily=s.fontFamily,a.cell.fontSize=s.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,r.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,r.canNotify=!1,s&&s._changed?(a.cell._styleChanged=!0,a.cell.background=s.background,a.cell.color=s.color,a.cell.fontFamily=s.fontFamily,a.cell.fontSize=s.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,r.canNotify=!0)}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const r={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":r.align="align-left";break;case"center":case"middle":r.align="align-center";break;case"right":r.align="align-right"}switch(a){case"top":r.verticalAlign="align-top";break;case"center":case"middle":r.verticalAlign="align-middle";break;case"bottom":r.verticalAlign="align-bottom"}return r}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});
50
+ Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,e._style){const t=e._style;l.color=t.color,l.background=t.background,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize,l.fontStyle=t.fontStyle,l.textDecoration=t.textDecoration,l.fontWeight=t.fontWeight}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(e,t){if("value"===t)return l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if("editor"===t||"template"===t)return e[t]||l.column[t];if("focused"===t){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===t)return!0===l.row.getProperty("selected")||!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField];if("modifiedValue"===t){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const t=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==t?t:e.value}return e[t]},set:function(e,a,i){const r=this.get(e,a);return r===i||(e[a]=i,!("element"!==a&&"isEditing"!==a&&"oldValue"!==a&&"_updating"!==a&&"notifyFn"!==a&&!a.startsWith("_")&&"canNotify"!==a)||("error"===a||("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a&&(void 0===l.oldValue&&(l.oldValue=r),(()=>{l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),null!==i&&i.label&&i.value?(l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value):(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i);const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;l.grid.dataSource&&i!==l.grid.dataSource.boundSource[t][l.column.dataField]&&(l.grid._sortedColumns&&l.grid._sortedColumns.length>0?e[l.column.dataField]=i:l.grid.dataSource.boundSource[t][l.column.dataField]=i)}l.grid.dataSource.boundSource.canNotify=!0})()),"selected"===a&&(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0)),!(!l._updating&&l.canNotify&&(l.grid._recycle(),l.row.canNotify&&(l.propertyChanged&&l.propertyChanged(name.substring(1),r),0)))))))}})}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const r=a[e];l+=`${r}: ${i};`},r=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<r.length;e++)i(r[e]);e.getAttribute("style")!==l&&e.setAttribute("style",l),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.grid&&!t.grid.appearance.showSelectionOnTop||t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t)+" - "+l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){const a=l.formatNumber(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat)return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e);!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits?l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits:2,a=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:t,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+a.replace("-","")+")":a}return l.column.formatSettings.Intl.NumberFormat.locale?new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,l.column.formatSettings.Intl.NumberFormat).format(e):new Intl.NumberFormat(this.grid.locale,l.column.formatSettings.Intl.NumberFormat).format(e)}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const r=i.formatNumber(e,t);return void 0===r?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+r+")":r}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let r=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(r=r.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let n=0;n<i._cellsMerge.length;n++){const s=i._cellsMerge[n];let o=[],d=[];if(o.push(s.row),s.rowspan>1){const e=r.indexOf(s.row);if(e>=0)for(let t=e;t<e+s.rowSpan;t++)r[t]&&-1===o.indexOf(r[t])&&o.push(r[t])}if(d.push(s.column.dataField),s.colspan>1){const e=i.columns.indexOf(i.columnByDataField[s.column.dataField]);for(let t=e;t<e+s.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(o.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:s.row.getCell(s.column.dataField),rows:o,columns:d,row:s.row,column:s.column,endRow:o[o.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const r=s.row.getCell(s.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=r,r}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div"),o=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=s,e.appendChild(a),e.appendChild(n),n.setAttribute("content",""),a.setAttribute("indent",""),r.setAttribute("label",""),i.setAttribute("toggle-button",""),s.setAttribute("checkbox",""),s.setAttribute("role","checkbox"),l.setAttribute("has-toggle-button",""),n.appendChild(i),n.appendChild(s),o.classList.add("smart-input"),s.appendChild(o),d.checkBoxes.visible?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),n.appendChild(r),l.content=r}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let r=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(r=!0,e.row.filterRow&&(r=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(r=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(r=!1)),r)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group","");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let r=a.label;const n=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&n(e,i.children,l))}return l};if(void 0!==a.label){let s="",o=[];if(t.grouping.summaryRow.visible){const r=n(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[]),d={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;d[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([d],r):null;if(m)for(let a=0;a<c.length;a++){const i=c[a];a>0&&(s+=", ");let r=m[l.dataField][i];const n=l.cellsFormat;n&&(r=e.cell.getFormattedValue(r,n)),s+=t.localize(i,{value:r}),o.push(m[l.dataField][i])}}if(t.dataSource.virtualDataSourceOnExpand&&(s=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)r="<div header group-advanced><span group></span><span value></span>",s&&(r+="<div summary>",r+=s,r+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let n="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e));t&&t.color?(n=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}r=`<div style="${n}" header group-advanced><span group>${i}: </span><span value>${e}</span>`,s&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=""+s,r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)r="<div header><span group></span><span value></span>",s&&(r+="<div summary>",r+=s,r+="</div>");else{let e=a.label;"object"==typeof e&&l.cellsFormat&&(e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)),r="<div header><span group>"+i+": </span><span value>"+e+"</span>",s&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+o+")",r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else("basic"===t.grouping.renderMode||"multipleColumns"===t.grouping.renderMode)&&(r=a.label,"object"==typeof r&&l.cellsFormat&&(r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)),a.summaryRow?s&&(r+="<div summary>",r+=s,r+="</div>"):s&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+o+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse"));e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),r=s}let s=e.firstChild;if(t.dataSource.boundHierarchy&&i){s.children.length<=1&&(e.innerHTML="<div></div>",s=e.firstChild,e._createToggleButton(s,e.cell),s=e.firstChild);const n=s.children[0],o=s.children[1].children[0],d=s.children[1].children[1].firstChild,c=s.children[1].children[2];n.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?o.classList.add("smart-visibility-hidden"):(o.classList.remove("smart-visibility-hidden"),a.expanded?o.setAttribute("toggled",""):o.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",n.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';n.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?o.classList.add("smart-hidden"):(o.classList.remove("smart-hidden"),o.style.marginLeft=""),n.innerHTML=m,c.innerHTML=r,i&&t.grouping.formatFunction){const i={row:a,column:l,cell:e.cell,value:r,template:null};t.grouping.formatFunction(i),i.value!==r?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:r):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(s.innerHTML=r);let o="smart-label";e.style.zIndex="";const d=t.editing.addNewColumn.visible?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l.cellsAlign&&(o+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(o+=" align-"+l.cellsVerticalAlign),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)");if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(o+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(o+=" align-"+l.cellsVerticalAlign)),s.className!==o&&(s.className=o),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,group:{value:r,template:null}};l.formatFunction(t),t.group.value!==r&&(l._treeColumn?s.children[1].children[2].innerHTML=t.group.value:s.innerHTML=t.group.value),null!==t.group.template&&(s.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const r=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:r,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:r,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:r,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:r,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:r,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:r,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:r,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:r,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:r,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:r,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]),i="string"===a.dataType?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let n="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition)a._filterInfo.condition="",n="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":n="smart-icon-equals";break;case"starts_with":n="smart-icon-starts-with";break;case"ends_with":n="smart-icon-ends-with";break;case"not_equal":n="smart-icon-not-equal";break;case"less_than":n="smart-icon-less-than";break;case"less_than_or_equal":n="smart-icon-less-than-or-equal";break;case"greater_than":n="smart-icon-greater-than";break;case"greater_than_or_equal":n="smart-icon-greater-than-or-equal";break;case"contains":n="smart-icon-contains";break;case"does_not_contain":n="smart-icon-does-not-contain";break;case"range":n="smart-icon-between";break;default:n="smart-icon-search"}let s=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${n} show"></i></div> `;if("string"===a.dataType)s+=`<input class="smart-filter-input-value" data-type="${a.dataType}" /> `,e.innerHTML=s;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;s+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=s,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)s+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=s,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const a=document.createElement("div");a.classList.add("smart-input"),a.classList.add("smart-grid-check-box-cell-editor"),a.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),a.setAttribute("checked","indeterminate"),s=a.outerHTML,e.innerHTML=s,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const o=e.querySelector("input");if(o&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),o.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),o.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),o.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),o.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=o,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&o&&(o.value=a._filterInfo.value,"date"===a.dataType&&(o.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),a.allowFilter||(o.disabled=!0),a.filterEditor)if(a.filterEditor.template){const t=a.filterEditor.template,l=document.createElement("div");a.filterTemplate instanceof HTMLTemplateElement?l.appendChild(t.content.cloneNode(!0)):t instanceof HTMLElement?l.appendChild(t):l.innerHTML=t,e.innerHTML="",e.appendChild(l),l.style.height="100%",l.style.width="100%";const i=e.querySelector("input");i&&(i.onfocus=()=>{e.setAttribute("focus","")},i.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,l)}else void 0!==a.filterEditor.min&&(o.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(o.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(o.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(o.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(o.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(o.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(o.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(o.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(e,t,l){const a=this,i=a.cell.grid,r=a.cell.column;let n=null;switch((!i.editing.enabled||!r.allowEdit||a.cell.readonly||"none"===i.editing.action||i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.editRow!==a.cell.row)&&a.setAttribute("readonly",""),t){case"checkBox":case"radioButton":case"switchButton":n=document.createElement("span"),n.className="smart-input",e?n.setAttribute("checked",""):null===e?n.setAttribute("checked","indeterminate"):n.removeAttribute("checked"),a.setAttribute("template",a.cell.template);break;case"checklist":if(e&&e.indexOf("[")>=0&&(e=JSON.parse(e)),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(e&&Array.isArray(e)&&e.length>0){const t=e.filter((e=>e.completed)).length;e=i.localize("completed",{value:t})+"/"+e.length}else e="";n=document.createElement("span"),n.innerHTML=e,a.setAttribute("template",a.cell.template),n.setAttribute("value",e.length);break;case"createdBy":case"updatedBy":{const e=a.cell.row;let s=null,o=null;if(s="createdBy"===t?e.createdBy:e.updatedBy,l.firstElementChild&&l.firstElementChild.hasAttribute("user-id")&&s===parseInt(l.firstElementChild.getAttribute("user-id")))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",r.dataField),d.setAttribute("row-id",a.cell.row.id);let c="";if(null!=s&&-1!==s){o=i.users.find((e=>e.id===s));const e=o;if(e){const t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,i=document.createElement("span");a&&(i.style.backgroundImage=`url('${e.image}')`,i.className="smart-drop-down-list-selection-image"),c+=l?'<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+';" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>":'<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c=""}d.innerHTML=c;const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),n=m,n.setAttribute("user-id",s),a.setAttribute("template",a.cell.template);break}case"collaborator":case"tags":{let t=[];if("number"==typeof e&&(e=""+e),""===e||null===e){let e=`\n <div class="smart-multi-combo-input-container tokens smart-flex smart-flex-auto" data-field="${r.dataField}" row-id="${a.cell.row.id}"> \n <div class="smart-multi-combo-input" data-field="${r.dataField}" row-id="${a.cell.row.id}" class="tokens smart-flex smart-flex-auto">\n <div class=" smart-flex-auto smart-flex"></div>\n </div>\n <span class="smart-arrow-down arrowbtn"><span>\n </div>\n `;return l.innerHTML=e,l.querySelector(".smart-arrow-down").onpointerdown=e=>{if(i.editing.enabled){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()},void a.setAttribute("template",a.cell.template)}if(null!==e&&(t=Array.isArray(e)?t.map((e=>e.trim())):e.indexOf("{")>=0||"[]"===e?JSON.parse(e):e.split(",").map((e=>e.trim()))),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&r.editor._items&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild&&l.firstElementChild.firstElementChild&&l.firstElementChild.firstElementChild.firstElementChild&&(l.firstElementChild.firstElementChild.firstElementChild.classList.remove("smart-flex-wrap"),a.cell.row.height>45&&l.firstElementChild.firstElementChild.firstElementChild.classList.add("smart-flex-wrap")));const s=document.createElement("div");s.classList.add("smart-multi-combo-input"),s.setAttribute("data-field",r.dataField),s.setAttribute("row-id",a.cell.row.id);let o='<div class="smart-flex smart-flex-auto">';if(t.length>2&&a.cell.row.height>45&&(o='<div class="smart-flex smart-flex-wrap">'),e)for(let e=0;e<t.length;e++){const l=t[e];let a=null;if(r.editor.dataSource)if("string"==typeof l&&r.editor._items&&r.editor._items[l])a=r.editor._items[l];else for(let e=0;e<r.editor.dataSource.length;e++){const t=r.editor.dataSource[e];if(void 0!==t.value&&void 0!==l&&void 0!==l.value&&t.value===l.value){a=t,r.editor._items||(r.editor._items=[]),r.editor._items[l]=t;break}if(void 0===t.value&&t===l||void 0!==t.value&&""+t.value===l){a=t,r.editor._items||(r.editor._items=[]),r.editor._items[l]=t;break}}else a=l;if(!a)continue;const i="string"==typeof a?a:a.label,n="string"==typeof a?null:a.color,s="string"==typeof a?null:a.image;if(""===i)continue;const d=document.createElement("span");if(s&&(d.style.backgroundImage=`url('${a.image}')`,d.className="smart-drop-down-list-selection-image"),n&&r.editor.colorItems?o+='<span title="'+i+'" data-item="'+i+'" style="background: '+n+"; color: "+new Smart.Color(n).getInvertedColor()+';" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>":o+='<span title="'+i+'" data-item="'+i+'" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>",r.editor.dataSource){if(r.editor.singleSelect){o+="</span>";break}o+='<span class=\'smart-hidden smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else o+="</span>"}if(s.innerHTML=o+"</div>",s.onpointerdown=e=>{if(e.target&&"#text"!==e.target.nodeName&&e.target.classList.contains("smart-drop-down-list-unselect-button")){let l=e.target.parentNode.getAttribute("data-item");if(r.editor.dataSource&&"string"==typeof l&&r.editor.dataSource)for(let e=0;e<r.editor.dataSource.length;e++)r.editor.dataSource[e].label===l&&(l=r.editor.dataSource[e],l.value&&(l=l.value));if(t[0]&&t[0].label){const n=t.map((e=>e.value)).indexOf(l);if(n>=0){t.splice(n,1);const l=a.cell.value,s=t.join(", ");i.setCellValue(a.cell.row.id,r.dataField,JSON.stringify(t)),i.onCellUpdate&&i.onCellUpdate([a.cell],[l],[s],(function(){}),a),e.preventDefault(),e.stopPropagation()}}else if(t.indexOf(l)>=0){t.splice(t.indexOf(l),1);const n=a.cell.value,s=t.join(", ");i.setCellValue(a.cell.row.id,r.dataField,s),i.onCellUpdate&&i.onCellUpdate([a.cell],[n],[s],(function(){}),a),e.preventDefault(),e.stopPropagation()}}else if(e.target.classList.contains("smart-drop-down-list-selection-label")){if(i.editing.enabled){const t=e.target.parentElement.parentElement,l=t.getAttribute("data-field"),a=t.getAttribute("row-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}},!r.cellsWrap&&r.allowEdit&&i.editing.enabled){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),s.classList.add("smart-flex-auto"),s.classList.remove("smart-flex-wrap"),t.length>2&&i.layout.rowHeight>45&&s.classList.add("smart-flex-wrap"),i.rightToLeft&&(s.style.direction="rtl"),l.appendChild(s),"input"!==r.editor.template&&l.appendChild(e),n=l,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}}else r.cellsWrap||r.allowEdit||s.classList.add("smart-flex-auto"),n=s;a.setAttribute("template",a.cell.template),n.setAttribute("value",e);break}case"dropDownList":case"dropdownlist":case"list":{const t=document.createElement("div");if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(t.innerHTML='<span class="smart-truncate">'+e+"</span>",r.allowEdit&&i.editing.enabled){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),t.classList.add("smart-flex-auto","smart-multi-combo-input"),l.appendChild(t),l.appendChild(e),l.classList.add(a.cell.template.toLowerCase()),n=l,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),r=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(i.beginEdit(n,r),a.cell.column.editor&&a.cell.column.editor.instance){const e=a.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}else n=t;a.setAttribute("template",a.cell.template.toLowerCase()),n.setAttribute("value",e);break}case"password":l.innerHTML=e?'<span class="smart-truncate">'+e.replace(/./g,"*")+"</span>":"",a.setAttribute("template",a.cell.template);break;case"color":l.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${e};"></span>`,a.setAttribute("template",a.cell.template);break;case"autoNumber":n=document.createElement("span"),n.innerHTML=1+a.cell.row.visibleIndex,a.setAttribute("template",a.cell.template);break;case"createdDate":case"createdTime":l.innerHTML='<span class="align-left smart-truncate">'+a.cell.getFormattedValue(a.cell.row.createdDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.createdDate,"t")+"</span>",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"updatedDate":case"updatedTime":a.cell.row.updatedDate?l.innerHTML='<span class="align-left smart-truncate">'+a.cell.getFormattedValue(a.cell.row.updatedDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.updatedDate,"t")+"</span>":l.innerHTML="",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"progress":{const t=e?parseInt(100*e)+"%":"0%";if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&t===l.firstElementChild.getAttribute("value"))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const i="white",r=["#D50000","#F4511E","#F6BF26","#33B679"];let n=r[0];n=e<.25?r[0]:e<.5?r[1]:e<.75?r[2]:r[3],l.innerHTML='<div value="'+t+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+t+';"><div title="'+t+'" style="width: 100%; height: 4px; background: '+n+"; color: "+i+';" class="smart-truncate smart-token"></div></div><span>'+t+"</span></div>",a.setAttribute("template",a.cell.template);break}case"attachments":{if(""===e)return l.innerHTML="",a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")){const t=l.firstElementChild.getAttribute("value");if(e&&e.indexOf(t)>=0)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild.evaluateScroll&&l.firstElementChild.evaluateScroll());if(t&&e&&Array.isArray(e)&&e[0]&&e[0].value&&t.length===e[0].value.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template)}const t=document.createElement("div"),r=document.createElement("div");t.classList.add("container"),r.classList.add("attachments");let s=e;if(i._findIsFile(s)){let e="";if(s)try{e=JSON.parse(s)}catch(e){console.log(e)}s=e}if("string"==typeof s&&(s.indexOf("[{")>=0||s.indexOf("}]")>=0)){let e="";if(s)try{e=JSON.parse(s)}catch(e){console.log(e)}s=e}Array.isArray(s)&&s.forEach((e=>{const l=document.createElement("div");l.title=e.label,l.classList.add("item"),l.innerHTML="<div></div>",l.firstElementChild.classList.add("smart-grid-icon","show","attachment"),e.label.indexOf("png")>=0||e.label.indexOf("jpg")>=0||e.label.indexOf("jpeg")>=0||e.label.indexOf("gif")>=0?l.firstElementChild.classList.add("smart-icon-image"):e.label.indexOf(".pdf")>=0?l.firstElementChild.classList.add("smart-icon-pdf"):e.label.indexOf(".tsv")>=0||e.label.indexOf(".txt")>=0||e.label.indexOf(".csv")>=0?l.firstElementChild.classList.add("smart-icon-text"):e.label.indexOf(".xls")>=0||e.label.indexOf(".xlsx")>=0?l.firstElementChild.classList.add("smart-icon-excel"):e.label.indexOf(".ppt")>=0?l.firstElementChild.classList.add("smart-icon-powerpoint"):e.label.indexOf(".zip")>=0||e.label.indexOf(".rar")>=0||e.label.indexOf(".7z")>=0?l.firstElementChild.classList.add("smart-icon-archive"):e.label.indexOf(".doc")>=0||e.label.indexOf(".docx")>=0?l.firstElementChild.classList.add("smart-icon-word"):l.firstElementChild.classList.add("smart-icon-file"),t.appendChild(l)}));const o=document.createElement("div");o.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");if(d.classList.add("smart-arrow-right","arrowbtn"),r.onpointerdown=e=>{if(e.target.classList.contains("attachment")){const t=JSON.parse(a.cell.value),l=[...r.children[0].children].indexOf(e.target.parentNode);if(t[l]){const e=document.createElement("a");if(t[l].value.indexOf(window.location.host)>=0)fetch(t[l].value).then((e=>e.blob())).then((a=>{const i=URL.createObjectURL(a);e.download=t[l].label,e.href=i,e.click()}));else{if(t[l].value.indexOf("base64")>=0){const a=i._getFileFromBase64(t[l].value);e.href=URL.createObjectURL(a)}else e.href=t[l].value;e.target="_blank",e.click()}}e.stopPropagation(),e.preventDefault()}else if("DIV"===e.target.nodeName&&e.target.classList.contains("arrowbtn")){let l=parseInt(t.style.marginLeft);isNaN(l)&&(l=0);const i=o===e.target,r=t.scrollWidth-a.offsetWidth+30;t.style.marginLeft=i?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(t.style.marginLeft),0===l?o.classList.add("smart-hidden"):o.classList.remove("smart-hidden"),e.stopPropagation(),e.preventDefault()}},t.children.length){r.appendChild(t);const e=25*s.length;e-a.offsetWidth+30>30&&(r.appendChild(o),r.appendChild(d)),r.evaluateScroll=()=>{const l=e-a.offsetWidth+30;t.style.marginLeft="0px",o.classList.add("smart-hidden"),l<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),l>30&&(r.appendChild(o),r.appendChild(d))},n=r}else n=document.createElement("div");a.setAttribute("template",a.cell.template),e&&e[0]&&e[0].value?n.setAttribute("value",e[0].value):s&&s[0]&&s[0].label?n.setAttribute("value",s[0].label):n.setAttribute("value",e);break}case"images":{if(""===e)return l.innerHTML="",a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(!i._recycleFiles&&l.firstElementChild&&l.firstElementChild.hasAttribute("value")){const t=l.firstElementChild.getAttribute("value");if(e&&e.indexOf(t)>=0)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild.evaluateScroll&&l.firstElementChild.evaluateScroll());if(t&&e&&Array.isArray(e)&&e[0]&&e[0].value&&t.length===e[0].value.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template)}const t=document.createElement("div"),r=document.createElement("div");t.classList.add("container"),r.classList.add("images");let s=e;if(i._findIsFile(s)){let e="";if(s)try{e=JSON.parse(s)}catch(e){console.log(e)}s=e}if("string"==typeof s&&(s.indexOf("[{")>=0||s.indexOf("}]")>=0)){let e="";if(s)try{e=JSON.parse(s)}catch(e){console.log(e)}s=e}Array.isArray(s)&&s.forEach((e=>{const l=document.createElement("img");l.style.display="none";let a="";a=e.small?e.small:e.medium?e.medium:e.large?e.large:e.value,l.onload=()=>{l.style.display=""},a.indexOf("base64")>=0?l.src=a:(i._imagesCache||(i._imagesCache=[]),i.uploadSettings.url?i._imagesCache[a]?i._findUserFile(e)&&(l.src=a):(i._imagesCache[a]=!0,l.style.display="none",i._findUserFile(e)&&(l.src=a,l.style.display="")):l.src=a,l.onerror=()=>{l.style.display="none"}),l.title=e.label,l.setAttribute("data-url",e.large||e.value),t.appendChild(l)}));const o=document.createElement("div");o.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");if(d.classList.add("smart-arrow-right","arrowbtn"),r.onpointerdown=e=>{if("IMG"===e.target.nodeName)i._openImagePreviewDialog(e.target),e.stopPropagation(),e.preventDefault();else if("DIV"===e.target.nodeName&&e.target.classList.contains("arrowbtn")){let l=parseInt(t.style.marginLeft);isNaN(l)&&(l=0);const i=o===e.target,r=t.scrollWidth-a.offsetWidth+30;t.style.marginLeft=i?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(t.style.marginLeft),0===l?o.classList.add("smart-hidden"):o.classList.remove("smart-hidden"),e.stopPropagation(),e.preventDefault()}},t.children.length){r.appendChild(t);const e=25*s.length;e-a.offsetWidth+30>30&&(r.appendChild(o),r.appendChild(d)),r.evaluateScroll=()=>{const l=e-a.offsetWidth+30;t.style.marginLeft="0px",o.classList.add("smart-hidden"),l<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),l>30&&(r.appendChild(o),r.appendChild(d))},n=r}else n=document.createElement("div");a.setAttribute("template",a.cell.template),e&&e[0]&&e[0].value?n.setAttribute("value",e[0].value):s&&s[0]&&s[0].label?n.setAttribute("value",s[0].label):n.setAttribute("value",e);break}case"email":Smart.Validator&&(n=document.createElement("span"),null===e||""===e?n.innerHTML="":Smart.Validator.email(e)?n.innerHTML=e:(n.className="url",n.innerHTML='<a href="mailto:'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",n.firstElementChild&&(n.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),n.firstElementChild.click()}))),a.setAttribute("template",a.cell.template);break;case"url":Smart.Validator&&(n=document.createElement("span"),n.className="url",null===e||""===e?n.innerHTML="":Smart.Validator.url(e)?n.innerHTML='<a href="https://'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>":n.innerHTML='<a href="'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",n.firstElementChild&&(n.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),n.firstElementChild.click()})),a.setAttribute("template",a.cell.template);break;default:{let t=null;a.setAttribute("template","");const n=a.cell.row,s=l;let o=a.cell.getFormattedValue(e,r.cellsFormat);if(s.style.lineHeight="","function"==typeof a.cell.template){const t={row:n,column:r,cell:a.cell,oldValue:a.cell.oldValue,value:e,template:null};let l=s.querySelector(".smart-grid-cell-template");const d=n.id;i.isHScrolling&&(i._cachedTemplates||(i._cachedTemplates=[]),l&&0===l.innerHTML.length&&(l=null),!l&&i._cachedTemplates&&i._cachedTemplates[r.dataField+"_"+d]&&(0===i._cachedTemplates[r.dataField+"_"+d].innerHTML.length?delete i._cachedTemplates[r.dataField+"_"+d]:t.template=i._cachedTemplates[r.dataField+"_"+d])),l&&l.getAttribute("column")===r.dataField?t.template=l.firstElementChild:l=null,a.formattedValue!==o&&(l=null),a.cell.canNotify=!1,n.canNotify=!1;const c=Object.assign({},{background:a.cell.background,color:a.cell.color,fontSize:a.cell.fontSize,fontFamily:a.cell.fontFamily,fontWeight:a.cell.fontWeight,textDecoration:a.cell.textDecoration,fontStyle:a.cell.fontStyle});if(a.cell.template(t),!l&&t.template)if(t.template instanceof HTMLElement){const e=document.createElement("div");e.classList.add("smart-grid-cell-template"),e.setAttribute("column",r.dataField),s.innerHTML="",s.appendChild(e),e.appendChild(t.template)}else s.innerHTML='<div column="'+r.dataField+'" class="smart-grid-cell-template">'+t.template+"</div>";else l||null!==t.template||(s.innerHTML=e);if(i.isHScrolling&&!i._cachedTemplates[r.dataField+"_"+d]){const e=s.firstElementChild.firstElementChild;e&&(i._cachedTemplates[r.dataField+"_"+d]=e)}s.style.background===c.background&&s.style.color===c.color&&s.style.fontSize===c.fontSize&&s.style.fontWeight===c.fontWeight&&s.style.fontStyle===c.fontStyle||(a.cell._styleChanged=!0,a.cell._setStyle(s)),a.cell.background!==c.background||a.cell.color!==c.color||a.cell.fontSize!==c.fontSize||a.cell.fontWeight!==c.fontWeight||a.cell.fontStyle!==c.fontStyle?(a.cell._styleChanged=!0,a.cell._setStyle(s)):a.cell._styleChanged&&a.cell._setStyle(s),void 0===a.cell.oldValue&&(a.cell.oldValue=e),a.formattedValue=o,a.cell.canNotify=!0,n.canNotify=!0}else{if(""!==s.textContent&&(s.textContent=""),a.cell.template instanceof HTMLTemplateElement)t=a.cell.template;else if(a.cell.template instanceof HTMLElement){const t=a.cell.template.innerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,n.id);s.innerHTML!==t&&(s.innerHTML=t)}if(a.cell.template.startsWith&&a.cell.template.startsWith("#")&&(t=document.querySelector(a.cell.template)),t){let l=t.content.cloneNode(!0).firstElementChild;const d=e;if(e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),l.querySelector("[smart-if]")){const t=l.querySelector("[smart-else]"),a=l.querySelectorAll("[smart-if]");let i=!1;for(let t=0;t<a.length;t++){const n=a[t],s=n.getAttribute("smart-if").split(" "),o=s[1].trim();let c=s[2].trim(),m=e;switch("Today"===c&&(c=new Date),"date"===r.dataType&&(e=new Date(d).getTime(),c=new Date(c).getTime()),o){case">":e>parseFloat(c)&&(l=n,i=!0);break;case">=":e>=parseFloat(c)&&(l=n,i=!0);break;case"=":case"==":case"===":e===c&&(l=n,i=!0);break;case"<":e<parseFloat(c)&&(l=n,i=!0);break;case"<=":e<=parseFloat(c)&&(l=n,i=!0)}if(e=m,i)break}!i&&t&&(l=t)}let c=l.outerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,n.id);for(c.indexOf("{{value=")>=0&&(e?(c=c.substring(0,c.indexOf("{{value="))+e+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const t=c.indexOf("{{value::"),l=c.substring(t+9,c.indexOf("}}")),i=a.cell.getFormattedValue(e,l);c=c.replace(`{{value::${l}}}`,i)}if(r._treeColumn){const e=s.firstChild;if(e&&e.classList&&a.toggleButton&&r._treeColumn&&s.children[1]){const e=s.children[0],t=s.children[1].children[0],l=s.children[1].children[1].firstChild,a=s.children[1].children[2];let r="";if(i.grouping.enabled){let e=n.level-1;"multipleColumns"!==i.grouping.renderMode&&(r+='<div style="width: '+(1+e)*i.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<n.level;e++)r+="<div class='smart-indent'></div>";n.checked?l.setAttribute("checked",""):!1===n.checked?l.removeAttribute("checked"):null===n.checked&&l.setAttribute("checked","indeterminate"),n.leaf?n.allowCheck?l.classList.remove("smart-visibility-hidden"):l.classList.add("smart-visibility-hidden"):n.allowCheck?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),n.allowCheck?i.checkBoxes.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"):i.checkBoxes.visible||l.classList.add("smart-hidden"),e.innerHTML=r,t.classList.add("smart-visibility-hidden"),n.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),n.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),n.data.isEmpty&&t.classList.add("smart-visibility-hidden"),a.innerHTML=c,i.appearance.showTooltips?a.setAttribute("title",o):a.hasAttribute("title")&&a.removeAttribute("title")}}else s.innerHTML!==c&&(s.innerHTML=c)}else if("string"==typeof a.cell.template){""===e&&(e="&nbsp;");const t=a.cell.template.replace(/{{value}}/gi,e).replace(/{{id}}/gi,n.id);s.innerHTML!==t&&(s.innerHTML=t)}}if("auto"===a.cell.row.height||i.layout.allowCellsWrap||"auto"===i.layout.rowHeight){const e=s.querySelector(".smart-grid-cell-template");if(e){n._templatesHeight||(n._templatesHeight=[]);const t=(e,t)=>{if(e){const l=i.rowById[e.getAttribute("data-id")];l._templatesHeight[r.dataField]=t,l._isDirty=!0,l.autoSize(),delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),i.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(n)return l.innerHTML="",l.appendChild(n),a.cell._setStyle(l),n}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,r=a._isMeasureRow?null:l.cellsFormat,n=t.grouping.enabled&&t.dataSource.groupBy.length>0;if(!(!1!==t._recycleValues||n||l.formatFunction||l._treeColumn||a.summaryRow)){if(e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id&&a.element.star.classList.remove("smart-hidden")),e.cell.background||e.cell.color){e.cell._styleChanged=!0;const t=e.firstChild;e.cell._setStyle(t)}return}if(t.grouping.enabled&&t.dataSource.groupBy.length>0){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button");let s=l.displayField?i[l.displayField]:i[l.dataField];null!==s||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(s=0),"string"===l.dataType&&(s=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(s=!1),"date"===l.dataType&&(s=new Date)),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(s="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row");const o=t=>t?t.startsWith("off_")?(e.classList.remove(t.substring(4)),!1):(e.classList.add(t),e.hasAttribute("customCSS")&&(t=t+" "+e.getAttribute("customCSS")),e.setAttribute("customCSS",t),!0):(e.setAttribute("highlight",""),!0);if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS");const l=t.split(" ");for(let t=0;t<l.length;t++)e.classList.remove(l[t])}if(l.highlight&&!a.summaryRow&&(o(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]&&o(t.highlightedCells[a.id][l.dataField]),t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]&&o(t.highlightedRows[a.id]),t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),s=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,s=e.cell.value),void 0===s&&(s="");let d=s;r?d=e.cell.getFormattedValue(s,r):l.formatSettings&&l.formatSettings.Intl&&(d=e.cell.getFormattedValue(s,l.formatSettings.Intl));const c=e.firstChild;if(e.content=c,l._isDirty&&(c.innerHTML=""),c.hasAttribute("data-field")&&c.getAttribute("data-field")!==l.dataField&&(c.innerHTML=""),c.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?c.appendChild(t):c.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void c.appendChild(t)}e.cell.value!==s&&(d=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames||e._rowClassNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,s,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,s,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);let r=[];for(let n=0;n<i.length;n++){let o=i[n];const d={index:a.visibleIndex,value:s,dataField:l.dataField,row:a,api:t};l.cellsCSSRules[o](d)&&(e.classList.add(o),r.push(o))}e.__classNames=r}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const m=e._getCellAlignment(a,l),u=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let p="";if(m.align&&(p+=m.align+" "),m.verticalAlign&&(p+=m.verticalAlign+" "),l.cellsWrap&&(p+="wrap "),p+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let g=l.left;if(t.rightToLeft?e.style.right!==g+"px"&&(e.style.right=g+"px"):e.style.left!==g+"px"&&(e.style.left=g+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),p+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command",""),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze","")),l.cellsRotationAngle){if(!e._rotateCellContent(c,l,s))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(c));c.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)c.innerHTML="";else if(l.autoGenerated&&(c.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let r in a){const n=l.cellsFormat;let s=a[r];n&&n.indexOf("p")>=0&&"count"===r?s=a[r]:n&&"date"!==l.dataType&&(s=e.cell.getFormattedValue(s,n)),i.push(t.localize(r,{value:s}))}const r=i.join(", "),n=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let s=`<div title = "${r}" class="smart-truncate summary-value" > <span class="label">${r}</span>${n}</div> `;if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;s=`<div title = "${r}" class="smart-truncate summary-value" > <span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> <span class="label">${r}</span>${n}</div> `}c.innerHTML!==s&&(c.innerHTML=s)}else if(t.summaryRow.editing&&l.allowSummary)if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value" ><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;c.innerHTML!==l&&(c.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value" ><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;c.innerHTML!==e&&(c.innerHTML=e)}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?c.firstElementChild.setAttribute("has-summary",""):c.firstElementChild.removeAttribute("has-summary"),c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c._clickTarget=e.target},c.onpointerup=l=>{c._clickTarget===l.target&&(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="";if(l=a.showDetail?'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggled toggle-button></button>':'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggle-button></button>',t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,c.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):c.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(c.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else c.innerHTML!==l&&(c.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)c.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let r="";for(let e=0;e<t;e++)r+="A";return r+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?c.textContent="":c.textContent=l(a)}else if(u)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)c.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)c.innerHTML=s;else switch(e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(s,e.cell.template,c);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(s,e.cell.template,c);break;case"attachment":e._setTemplate(s,"attachments",c);break;case"image":e._setTemplate(s,"images",c);break;case"email":e._setTemplate(s,"email",c);break;case"url":e._setTemplate(s,"url",c);break;default:e._setTemplate(s,e.cell.template,c)}else{const i=c.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&c.children[1]){const e=c.children[0],i=c.children[1].children[0],r=c.children[1].children[1].firstChild,n=c.children[1].children[2];let s="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?s="":"multipleColumns"!==t.grouping.renderMode&&(s+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)s+="<div class='smart-indent'></div>";if(a.checked?r.setAttribute("checked",""):!1===a.checked?r.removeAttribute("checked"):null===a.checked&&r.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?r.classList.remove("smart-visibility-hidden"):r.classList.add("smart-visibility-hidden"):a.allowCheck?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(c)}}a.allowCheck?t.checkBoxes.visible?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"):t.checkBoxes.visible||r.classList.add("smart-hidden"),e.innerHTML=s,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),n.innerHTML=d,t.appearance.showTooltips?n.setAttribute("title",d):n.hasAttribute("title")&&n.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let r=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(r+=l.computedWidth)}e.style.width=r+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let r=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let r=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(r+=l.cellHeight)}e.style.height=r+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const n="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(s,a.visibleIndex,a.data),o=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(o>l[0]&&o<l[1]){d=!0;break}}if(a._rowSpan=n,n&&!d){let s=0;t._cellRowSpan.push([o,o+n,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(n,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=o;e<=o+n-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(s+=l.cellHeight)}e.style.height=s+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",n),i._styleChanged=!0,r=n}}1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width="",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===r&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),c.textContent===d||l.formatFunction||("string"==typeof d&&d.indexOf("&")>=0?c.innerHTML=d:c.textContent=d),i.column.autoGenerated||i._setStyle(c),t.appearance.showTooltips?c.setAttribute("title",i.tooltip||d):c.hasAttribute("title")&&c.removeAttribute("title"),t.appearance.showTooltipsOverflow&&(!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title"),d&&d.length)&&(14*d.length*.52>l.computedWidth?c.setAttribute("title",i.tooltip||d):!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title"))}else c.textContent=d}}if(c.className!==p&&(c.className=p),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&c.firstChild&&c.firstChild.classList&&c.firstChild.classList.contains("smart-grid-cell-loading")&&(c.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),c.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const t={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:s,formattedValue:d,template:null};e.cell.canNotify=!1,a.canNotify=!1;const i=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});await l.formatFunction(t),c.style.background===i.background&&c.style.color===i.color&&c.style.fontSize===i.fontSize&&c.style.fontFamily===i.fontFamily&&c.style.textDecoration===i.textDecoration&&c.style.fontWeight===i.fontWeight&&c.style.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c)),e.cell.background===i.background&&e.cell.color===i.color&&e.cell.fontSize===i.fontSize&&e.cell.fontWeight===i.fontWeight&&e.cell.textDecoration===i.textDecoration&&e.cell.fontFamily===i.fontFamily&&e.cell.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c));let r=!0;if(t.value!==s&&(e.toggleButton?c.children[1].children[2].innerHTML=t.value:c.innerHTML=t.value,r=!1),null!==t.template){if(e.toggleButton){const e=c.children[1].children[2];e.innerHTML!==t.template&&(e.innerHTML=t.template)}else if(c.innerHTML!==t.template){const e=document.createElement("div");e.innerHTML=t.template,e.innerHTML!==c.innerHTML&&(c.innerHTML=t.template)}r=!1}r&&(l.cellsFormat?c.textContent=d:c.textContent=s),e.cell.canNotify=!0,a.canNotify=!0}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,c),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&c.querySelector("[toggle-button]")){const e=c.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),r=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),r.appendChild(l),r.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(r),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const r=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-r.top+"px",i.style.left=a._offsetLeft(l)-r.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,r=e.row,n=e.row.index,s=r._style;if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][n];a.cell.canNotify=!1,r.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(s&&s._changed?(a.cell._styleChanged=!0,a.cell.background=s.background,a.cell.color=s.color,a.cell.fontFamily=s.fontFamily,a.cell.fontSize=s.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,r.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,r.canNotify=!1,s&&s._changed?(a.cell._styleChanged=!0,a.cell.background=s.background,a.cell.color=s.color,a.cell.fontFamily=s.fontFamily,a.cell.fontSize=s.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,r.canNotify=!0)}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const r={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":r.align="align-left";break;case"center":case"middle":r.align="align-center";break;case"right":r.align="align-right"}switch(a){case"top":r.verticalAlign="align-top";break;case"center":case"middle":r.verticalAlign="align-middle";break;case"bottom":r.verticalAlign="align-bottom"}return r}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});
51
51
  Smart.Utilities.Assign("Grid.Resize",class{autoSizeRows(e){const t=this,o=e||t._recyclingRows;t.rows.canNotify=!1;for(let e=0;e<o.length;e++){const i=o[e];i.element=t._rowElements[1],i.grid=t;const l=i._autoSize(i);i.cellHeight!==l&&(i.cellHeight=l),i.height=l}t.rows.canNotify=!0,t.refresh()}autoSizeColumn(e){const t=this.columnByDataField[e];t&&t.autoSize()}autoSizeColumns(e,t){const o=this,i=t||o.columns;let l=[];if(!e){const e=o._recyclingRows;for(let t=0;t<e.length;t++){const o=e[t];for(let e=0;e<i.length;e++){const t=i[e],s=o.getCell(t.dataField);l[t.dataField]||(l[t.dataField]=t.label),s.value&&s.value.toString().length>l[t.dataField].length&&(l[t.dataField]=s.value)}}}const s=[];for(let e=0;e<i.length;e++){const t=i[e],o=l[t.dataField]?l[t.dataField]:t.label;s.push(o)}const n=i[0]._measureSize(s);o.columns.canNotify=!1;for(let e=0;e<i.length;e++)i[e].width=n[e];o.columns.canNotify=!0,o.refresh()}_doubleClickHandler(e){const t=this;if("none"!==t.behavior.rowResizeMode||"none"!==t.behavior.columnResizeMode){if(t._downTime&&new Date-t._downTime<300){const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null,s=null,n=null;for(let e=0;e<o.length;e++){const t=o[e];if(t.getAttribute("data-field")&&(i=t.getAttribute("data-field"),"smart-grid-column"===t.nodeName.toLowerCase())){l=t;break}if(t.getAttribute("data-id")){s=t.getAttribute("data-id"),n=t;break}}const r=t.columnByDataField[i],a=t.rowById[s];if(t.behavior.allowColumnAutoSizeOnDoubleClick&&r&&r.allowResize&&"none"!==t.behavior.columnResizeMode&&l){const t=l.getBoundingClientRect(),o=t.right,i=10;o-i<=e.clientX&&e.clientX<=o+i&&t.top<=e.clientY&&t.bottom>=e.clientY&&(r.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}if(t.behavior.allowRowAutoSizeOnDoubleClick&&a&&a.allowResize&&"none"!==t.behavior.rowResizeMode){const t=n.getBoundingClientRect().bottom,o=10;t-o<=e.clientY&&e.clientY<=t+o&&(a.computedHeight=null,n&&n.cell&&!i&&(i=n.cell.column.dataField),"_rowHeaderColumn"===i&&(a.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation())))}}t._downTime=new Date}}_endResize(){const e=this;e._overlay&&setTimeout((()=>{e._overlay&&(e._overlay.parentNode.removeChild(e._overlay),e._overlay=null)}),100);const t=e.getBoundingRect(e);if(delete e._columnDownPosition,delete e._rowDownPosition,e.classList.remove("smart-grid-resize-mode"),e.$.root.classList.remove("smart-grid-resize-mode"),e.classList.remove("smart-grid-row-resize-mode"),e.classList.remove("smart-grid-column-resize-mode"),e._rowToResize&&e._rowResizeStartLine&&e._rowResizeLine){const t=e.rowById[e._rowToResizeId],o=t.cellHeight+parseFloat(e._rowResizeLine.style.top)-parseFloat(e._rowResizeStartLine.style.top),i=t.cellHeight;if(e.rows.canNotify=!1,t.height=null,"split"===e.behavior.rowResizeMode){const i=e._nextRow(t),l=parseInt(t.height-o+t.cellHeight);t.computedHeight=o,i.computedHeight=parseInt(i.height)+l,i.height=null}else t.computedHeight=o;return e.rows.canNotify=!0,e._rowResizeStartLine.parentNode.removeChild(e._rowResizeStartLine),e._rowResizeLine.parentNode.removeChild(e._rowResizeLine),e.appearance.showResizeTooltips&&e._rowResizeTooltip.parentNode.removeChild(e._rowResizeTooltip),e._rowToResize.header?e._rowToResize.header.style.cursor="":e._rowToResize.style.cursor="",t.header&&(t.header.style.cursor=""),e._rowResizeLine=null,e._rowToResize=null,e._rowToResizeId=null,e._rowResizeStartLine=null,e.refresh(),e.$.fireEvent("rowResize",{row:t,id:t.id,oldHeight:i,height:o}),void(e.onRowResize&&e.onRowResize({row:t,id:t.id,oldHeight:i,height:o}))}if(!e._columnToResizeElement||!e._columnResizeLine)return;const o=e.columnByDataField[e._columnToResizeDataField],i=e._columnToResizeRect;let l=t.left+parseInt(e._columnResizeLine.style.left)-i.left+e.scrollLeft;const s=o.width;if(e.rightToLeft&&(l=t.left-parseFloat(e._columnResizeLine.style.left)+i.right-e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),l<o.minWidth&&(l=o.minWidth),e.columns.canNotify=!1,"split"===e.behavior.columnResizeMode){const t=e._nextColumn(o);if(t){const e=parseInt(o.computedWidth-l);o.width=l,t.width=parseInt(t.computedWidth)+e}}else o.width=l;e.columns.canNotify=!0,e._columnResizeLine.parentNode.removeChild(e._columnResizeLine),e._columnResizeLine=null,e._columnResizeStartLine.parentNode.removeChild(e._columnResizeStartLine),e._columnResizeTooltip.parentNode&&e._columnResizeTooltip.parentNode.removeChild(e._columnResizeTooltip),e._columnResizeStartLine=null,e._columnToResizeElement.style.cursor="",e._columnToResizeElement.sortButton.style.cursor="",e._columnToResizeElement.filterButton.style.cursor="",e._columnToResizeElement=null,e._columnToResizeRect=null,e._columnToResizeDataField=null,e._columnResizeTooltip=null,e.refresh(),o._state||(o._state={label:o.label,dataField:o.dataField,dataType:o.dataType}),o._state.width=o.width,e.onColumnResize?e.onColumnResize({column:o,dataField:o.dataField,oldWidth:s,width:l}):e.$.fireEvent("columnResize",{column:o,dataField:o.dataField,oldWidth:s,width:l}),e.autoSaveState(),e.closeMenu()}_columnResizePrepare(){const e=this,t=e._columnToResizeRect,o=e.getBoundingRect(e.$.columnHeader),i=e.appearance.showViewBar?4+e.layout.viewBarWidth:0,l=e.grouping.groupBar.visible?e.$.groupHeader.offsetHeight:0;if(e._dragDetails)return;const s=function(){const s=document.createElement("div");s.classList.add("smart-grid-resize-line"),e.rightToLeft?s.style.left=-o.left+t.left+"px":s.style.left=i-o.left+t.right+"px",e.header.visible?s.style.top=l-o.top+o.height+t.top+"px":s.style.top=l-o.top+t.top+"px";const n=parseInt(s.style.top)-e.$.horizontalScrollBar.offsetHeight;return s.style.height="calc(100% - "+n+"px)",s.style.cursor="col-resize",s},n=document.createElement("div");n.classList.add("smart-grid-resize-tooltip"),e._columnResizeTooltip=n,e._columnResizeTooltip.style.left=i-o.left+t.right+"px",e.rightToLeft&&(e._columnResizeTooltip.style.left=-o.left+t.left+"px"),e._columnResizeTooltip.innerHTML=e.localize("columnResizeTooltip",{value:t.width}),e._columnResizeLine=s(),e._columnResizeStartLine=s(),"growAndShrink"===e.behavior.columnResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-column-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e.appearance.showResizeTooltips&&e.$.root.appendChild(e._columnResizeTooltip),e.$.root.appendChild(e._columnResizeLine),e.$.root.appendChild(e._columnResizeStartLine),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="col-resize",e.$.root.appendChild(e._overlay)}_columnDownResizeHandler(e){this._columnDownPosition=e.pageX}_columnMoveResizeHandler(e){const t=this;if(t._dragDetails)return;t._columnDownPosition&&Math.abs(e.pageX-t._columnDownPosition)>=3&&!t._columnResizeLine&&t._columnResizePrepare();const o=function(e){const o=t._columnToResizeRect;let i=e.left+parseFloat(t._columnResizeLine.style.left)-o.left+t.scrollLeft;t.rightToLeft&&(i=e.left-parseFloat(t._columnResizeLine.style.left)+o.right-t.scrollLeft-t._scrollView.vScrollBar.offsetWidth);const l=t.columnByDataField[t._columnToResizeDataField];i<l.minWidth&&(i=l.minWidth),t.appearance.showResizeTooltips&&(t._columnResizeTooltip.innerHTML=t.localize("columnResizeTooltip",{value:parseInt(i)}))};if(t._columnResizeLine){const i=t.columnByDataField[t._columnToResizeDataField],l=t._columnToResizeRect,s=i.minWidth,n=i.maxWidth,r=t._nextColumn(i),a=t.getBoundingRect(t);if(t.rightToLeft){if(e.pageX>a.right)return;if("split"===t.behavior.columnResizeMode&&r&&e.pageX<=t.offsetWidth-t.scrollLeft-r.left-r.computedWidth+r.minWidth)return t._columnResizeLine.style.left=t.offsetWidth-t.scrollLeft-r.left-r.computedWidth+r.minWidth+"px",void o(a);if(l.right-s-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-s-t.scrollLeft+"px",void o(a);if(l.left+n-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-n-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a)}else{if(e.pageX<a.left)return;if("split"===t.behavior.columnResizeMode&&r&&e.pageX>=a.left+r.left+r.computedWidth-r.minWidth-t.scrollLeft)return t._columnResizeLine.style.left=-a.left+a.left+r.computedWidth+r.left-r.minWidth-t.scrollLeft+"px",void o(a);if(l.left+s-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+s-t.scrollLeft+"px",void o(a);if(l.left+n-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+n-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a)}}else if(!t._columnDownPosition){const t=this;if(e.composedPath&&-1===e.composedPath().indexOf(this))return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null;if(t._columnResizeLine)return;for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-field")&&t.hasAttribute("header")){i=t.getAttribute("data-field"),l=t;break}}if(t._columnToResizeElement&&(t._columnToResizeElement.style.cursor="",t._columnToResizeElement.sortButton.style.cursor="",t._columnToResizeElement.filterButton.style.cursor="",t._columnToResizeElement=null),i){const o=t.rightToLeft?l.getBoundingClientRect().left:l.getBoundingClientRect().right;if(l.style.cursor="",l.sortButton.style.cursor="",l.filterButton.style.cursor="",o-10<=e.clientX&&e.clientX<=o+10){const e=t.columnByDataField[i];if(!e||e&&!e.allowResize)return;const o=t._isLastVisibleColumn(e);if("split"===t.behavior.columnResizeMode&&o)return;l.style.cursor="col-resize",l.sortButton.style.cursor="col-resize",l.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(l),t._columnToResizeElement=l,t._columnToResizeDataField=i}}}}_rowMoveResizeHandler(e){const t=this;if(t.viewColumns.length&&t.viewColumns[0].rowHeaderColumn&&!t._rowResizeLine){const o=t.offset(t.viewColumns[0].element);if(e.pageX<o.left||e.pageX>o.left+t.viewColumns[0].width)return}const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null;if(t._rowDownPosition&&Math.abs(e.pageY-t._rowDownPosition)>=3&&!t._rowResizeLine&&t._rowDownResizeHandler(e),t._rowResizeLine){const o=t._offsetTop(t.$.scrollView),i={top:o,bottom:t.$.scrollView.offsetHeight+o};if(e.pageY<=i.top)return;if(e.pageY>=i.bottom)return;const l=function(){const e=s.cellHeight+parseFloat(t._rowResizeLine.style.top)-parseFloat(t._rowResizeStartLine.style.top);t.appearance.showResizeTooltips&&(t._rowResizeTooltip.innerHTML=t.localize("rowResizeTooltip",{value:parseInt(e)}))},s=t.rowById[t._rowToResizeId],n=t._nextRow(s),r=t._rowToResizeBounds,a=s.minHeight,c=s.maxHeight;return"split"===t.behavior.rowResizeMode&&n&&r.bottom+n.height-n.minHeight<=e.pageY?(t._rowResizeLine.style.top=r.bottom+n.height-n.minHeight-o+"px",void l()):r.top+a+10>=e.pageY?(t._rowResizeLine.style.top=r.top+a-o+"px",void l()):r.top+c>=e.pageY-o?(t._rowResizeLine.style.top=r.top+c+10-o+"px",void l()):(t._rowResizeLine.style.top=-o+e.pageY-1+"px",void l())}if(!t._rowDownPosition){for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-id")&&t.hasAttribute("header")){l=t,i=t.getAttribute("data-id");break}}if(t._rowToResize&&(t._rowToResize.style.cursor="",t._rowToResize=null),null!==i){const o=t._offsetTop(l)+l.offsetHeight;if(l.style.cursor="",o-10<=e.clientY&&e.clientY<=o+10){const e=t.rowById[i];if(!e||e&&!e.allowResize)return;e.header&&(e.header.style.cursor="row-resize");const o=t._offsetTop(l);t._rowToResizeBounds={top:o,bottom:l.offsetHeight+o,height:l.offsetHeight},t._rowToResize=l,t._rowToResizeId=i}}}}_rowDownResizeHandler(){const e=this,t=e._rowToResizeBounds,o=function(){const o=document.createElement("div");return o.classList.add("smart-grid-resize-line","row"),o.style.width=e.$.scrollView.offsetWidth-e._rowToResize.offsetLeft+"px",o.style.left="0px",o.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",o.style.cursor="row-resize",o},i=document.createElement("div");i.classList.add("smart-grid-resize-tooltip"),e._rowResizeTooltip=i,e._rowResizeTooltip.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",e._rowResizeTooltip.innerHTML=e.localize("rowResizeTooltip",{value:t.height}),e._rowResizeTooltip.style.right="20px",e._rowResizeTooltip.style.bottom="initial","growAndShrink"===e.behavior.rowResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-row-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e._rowResizeLine=o(),e._rowResizeStartLine=o(),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="row-resize",e.$.root.appendChild(e._overlay),e.$.scrollView.appendChild(e._rowResizeLine),e.$.scrollView.appendChild(e._rowResizeStartLine),e.appearance.showResizeTooltips&&e.$.scrollView.appendChild(e._rowResizeTooltip)}_rowResizeHandler(e){const t=this;let o=e.clientX,i=e.clientY;void 0!==o&&void 0!==i||(o=e.touches[0].clientX,i=e.touches[0].clientY);const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,i);let s=null;for(let e=0;e<l.length;e++){const t=l[e];t.getAttribute("data-id")&&(s=t.getAttribute("data-id"))}null===s||!t._rowToResize||t._rowResizeLine||(t._rowDownPosition=e.pageY)}});
52
52
  Smart.Utilities.Assign("Grid.Reorder",class{reorderColumns(e,r,t=!1){const o=this;if(void 0===e||void 0===r)return;let a=o.columnByDataField[e];const n=o.columnByDataField[r],d="string"==typeof e?o.columns.indexOf(a):e,i="string"==typeof r?o.columns.indexOf(n):r;"string"==typeof e&&"string"===r?a.columnGroup=n.columnGroup:(a=o.columns[d],a.columnGroup=o.columns[i].columnGroup);const l=a.sortIndex,s=a.sortOrder,g=a.filter;t&&i+1<=o.columns.length?o.columns.move(d,i):o.columns.move(d,i-1),a.sortOrder=s,a.sortIndex=l,a.filter=g}swapColumns(e,r){const t=this;if(void 0===e||void 0===r)return;const o=t.columnByDataField[e],a=t.columnByDataField[r],n="string"==typeof e?t.columns.indexOf(o):e,d="string"==typeof r?t.columns.indexOf(a):r,i="string"==typeof e?o.columnGroup:t.columns[n].columnGroup;"string"==typeof e&&"string"===r?o.columnGroup=a.columnGroup:t.columns[n].columnGroup=t.columns[d].columnGroup;const l=o.sortIndex,s=o.sortOrder,g=o.filter;t.columns.move(n,d),"string"==typeof e&&"string"===r?a.columnGroup=i:t.columns[d-1].columnGroup=i,t.columns.move(d-1,n),o.sortOrder=s,o.sortIndex=l,o.filter=g}_createLine(e){const r=this;return e.classList.contains("smart-breadcrumb-item")||e.column?function(){const t=document.createElement("div"),o=r.getBoundingRect(e),a=r.getBoundingRect(r.$.columnHeader),n=r.getBoundingRect(r),d=r.$.content.offsetHeight-7-r._scrollView.hScrollBar.offsetHeight-o.top+n.top;return t.classList.add("smart-grid-drag-line"),r.rightToLeft?t.style.left=-a.left+o.left+"px":t.style.left=-a.left+o.right+"px",t.style.top=o.top-n.top+"px",t.style.height=d+"px",t.style.opacity=0,t}():function(){const t=document.createElement("div"),o=r.getBoundingRect(e);return t.classList.add("smart-grid-drag-line","row"),t.style.width=r.$.scrollView.offsetWidth-e.offsetLeft-e.row.header.offsetWidth-r._scrollView.vScrollBar.offsetWidth+"px",t.style.left=e.row.header.offsetWidth+"px",t.style.top=o.bottom-r.offsetTop+"px",t.style.opacity=0,t}()}_drag(e){const r=this,t=e.originalEvent;if(r._dialogDragDetails&&r._dragDialog(e,"both"),!r._dragDrop)return;let o=r._dragDrop.dragDetails.feedback;if(!o&&r._dragDrop.showFeedback){if(o=r._dragDrop.createFeedback(t),!o)return;if(r._overlay=document.createElement("div"),r._overlay.classList.add("smart-grid-overlay"),r._overlay.style.cursor="",r.$.root.appendChild(r._overlay),r._dragDrop.column)r._dragLine=r._createLine(r._dragDrop.column.element),r.$.root.appendChild(r._dragLine),requestAnimationFrame((()=>{r._dragLine&&(r._dragLine.style.opacity=1)})),r._dragDrop.feedbackLine=r._dragLine,o.classList.add("smart-grid-column-drag-feedback");else{const e=r._dragDrop.row;let t="<div>";for(let o=0;o<r.columns.length;o++){const a=r.columns[o];t+="<div>"+a.label+": "+e["column_"+a.dataField].value+"</div>"}r._dragDrop.items=r._rowElements,r._dragDrop.getItemCoordinates(r._rowElements),t+="</div>",o.innerHTML=t,r._dragLine=r._createLine(r._dragDrop.row.element),r.$.root.appendChild(r._dragLine),requestAnimationFrame((()=>{r._dragLine&&(r._dragLine.style.opacity=1)})),o.classList.add("smart-grid-row-drag-feedback"),r._dragDrop.feedbackLine=r._dragLine}}r._dragDrop.drag(e),r._dragDrop.column?r._dragColumn(e):r._dragRow(e),t.preventDefault()}_dragRow(e){const r=this,t=r._dragDrop.dragDetails,o=r._dragLine,a=e.originalEvent,n=r.getBoundingRect(r);if(e.pageY<n.top||e.pageY>n.bottom||e.pageX<n.left||e.pageX>n.right||t.target&&!t.target.row||!t.target)r._dragDrop.error(),o.style.opacity=0;else{if(r._dragDrop.getItemCoordinates(r._dragDrop.items),o.style.opacity=1,r._dragDrop.success(),!t.target)return;let a=r.getBoundingRect(t.target);o.style.width=r.$.scrollView.offsetWidth-r._dragDrop.row.offsetLeft-r._dragDrop.row.header.offsetWidth-r._scrollView.vScrollBar.offsetWidth+"px",o.style.left=r._dragDrop.row.header.offsetWidth+"px";const d=r.offset(r).top;let i=a.top-d-r.scrollTop;r._recyclingRows[r._recyclingRows.length-1].element===t.target&&e.pageY>n.bottom-10&&(t.before=!1),e.pageY>i+d+a.height-7&&(t.before=!1),o.style.top=t.before?i+"px":i+a.height-7+"px"}r.$.fireEvent("rowDragging",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.visibleIndex,data:r._dragDrop,originalEvent:a})}_dragColumn(e){const r=this,t=r._dragDrop.dragDetails,o=r.getBoundingRect(r),a=e.originalEvent;e.pageY<o.top||e.pageY>o.bottom||e.pageX<o.left||e.pageX>o.right?(r._dragDrop.error(),r._dragLine.style.opacity=0):r._dragLine.style.opacity=1;const n=r.$.groupHeader.getBoundingClientRect();if(e.pageY>=n.top&&e.pageY<n.bottom&&e.pageX>=n.left&&e.pageX<n.right&&(!1===r._dragDrop.column.allowGroup?(r._dragLine.style.opacity=0,r._dragDrop.error()):(t.feedback.classList.remove("freeze"),t.feedback.classList.remove("error"))),t.target&&r._dragDrop.feedback&&!r._dragDrop.feedback.classList.contains("error")){r._dragDrop.getItemCoordinates(r._dragDrop.items);for(let o=0;o<r._dragDrop._itemCoordinates.coordinates.length;o++){const a=r._dragDrop._itemCoordinates.coordinates[o];if(Array.isArray(a))for(let o=0;o<a.length;o++){let n=a[o];e.pageY>=n.rect.top&&e.pageY<n.rect.bottom&&e.pageX>=n.rect.left&&e.pageX<n.rect.right&&(t.target=r._dragDrop.items[n.index],t.before=!0)}}const a=r.getBoundingRect(t.target),n=r.getBoundingRect(r.$.content);if(r._dragDrop.column){r._dragLine.style.opacity=1;const d=r.appearance.showViewBar?r.layout.viewBarWidth:0;if(!1===t.before?r._dragLine.style.left=d+a.right-n.left+"px":r._dragLine.style.left=d+a.left-n.left+"px",r.behavior.allowColumnFreeze&&r.dataSource&&0===r.dataSource.groupBy.length){const o=r._dragDrop._itemCoordinates.coordinates[0][0].rect;r._dragDrop.column.allowFreeze&&(e.pageX>=o.left&&e.pageX<=o.left+10?t.feedback.classList.add("freeze"):t.feedback.classList.remove("freeze"),t.target&&t.target.hasAttribute("freeze")&&t.feedback.classList.add("freeze"),t.item.column.freeze&&!t.target.hasAttribute("freeze")?t.feedback.classList.add("unfreeze"):t.feedback.classList.remove("unfreeze"))}if(t.target.classList.contains("smart-breadcrumb-item"))r._dragLine.style.top=a.top-o.top-r.scrollTop+"px",r._dragLine.style.height=a.height+"px",r.$.breadcrumb.dataSource.forEach((e=>{e.value===t.item.column.dataField&&(r._dragLine.style.opacity=0,r._dragDrop.error())}));else{r._dragLine.style.top=a.top-o.top-r.scrollTop+"px";const e=r.$.content.offsetHeight-7-r._scrollView.hScrollBar.offsetHeight-a.top+n.top;r._dragLine.style.height=e+"px"}parseInt(r._dragLine.style.left)<3?r._dragLine.style.left="3px":parseInt(r._dragLine.style.left)>=r.offsetWidth-3&&(r._dragLine.style.left=r.offsetWidth-7+"px")}}else r._dragLine.style.opacity=0;r.$.fireEvent("columnDragging",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:r.columns.indexOf(r._dragDrop.column),data:r._dragDrop,originalEvent:a})}_beginRowDrag(e,r){const t=this;let o=!1;t.behavior.allowRowReorder&&r.allowReorder&&(o=!0),o&&(t.$.fireEvent("rowDragStart",{row:r,id:r.id,index:r.visibleIndex,data:null,originalEvent:e.originalEvent}).defaultPrevented||(t._dragDrop=new Smart.Utilities.DragDrop(t),t._dragDrop.capture(r.element,e),t._dragDrop.row=r,t._recycle(!1),t._dragInterval&&clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const e=t._dragDrop.dragDetails;if(!e.feedback)return;const r=parseInt(e.feedback.style.left),o=parseInt(e.feedback.style.top),a=t.getBoundingClientRect();t._dragLine&&a.left<=r&&a.left+a.width>=r&&(o>=a.top&&o<=a.top+20?t.scrollTop-=5:o>=a.top+a.height+5&&o<=a.top+a.height+20&&(t.scrollTop+=5))}),10)))}_beginDrag(e,r){const t=this;if(!r.dataField)return void t._beginRowDrag(e,r);const o=r;if(t.behavior.allowColumnReorder&&o.allowReorder&&!o.autoGenerated){if(t.appearance.showColumnHeaderDragIcon&&!e.originalEvent.target.classList.contains("smart-drag-handle"))return;if(!t.$.fireEvent("columnDragStart",{column:o,dataField:o.dataField,index:t.columns.indexOf(o),data:null,originalEvent:e.originalEvent}).defaultPrevented){t._dragDrop=new Smart.Utilities.DragDrop(t),t._dragDrop.capture(o.element,e),t._dragDrop.column=o;const r=()=>{let e=t.columns.map((e=>e.element));t.behavior.allowColumnFreeze||(e=t.columns.filter((e=>!e.freeze)).map((e=>e.element))),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&-1===t.dataSource.groupBy.indexOf(o.dataField)&&(e=t.columns.filter((e=>{if(t.dataSource&&-1===t.dataSource.groupBy.indexOf(e.dataField))return!0})).map((e=>e.element))),e=e.filter((e=>!e.classList.contains("smart-visibility-hidden"))),t.$.breadcrumb?t._dragDrop.items=e.concat(t.$.breadcrumb._items):t._dragDrop.items=e};r(),t._dragInterval&&clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const e=t._dragDrop.dragDetails;if(!e.feedback)return;r();const o=parseInt(e.feedback.style.left),a=t.getBoundingClientRect();t._dragLine&&a.left<=o&&a.left+a.width>=o&&(o>=a.left&&o<=a.left+20?t.scrollLeft-=5:o>=a.left+a.width-20&&o<=a.left+a.width&&(t.scrollLeft+=5))}),3)}}}_cancelDrag(){const e=this;e._dragLine&&(e._dragLine.parentNode&&e._dragLine.parentNode.removeChild(e._dragLine),e._dragLine=null),e._dragDrop&&(e._dragDrop.removeFeedback(),e._dragDrop=null),e._dragInterval&&clearInterval(e._dragInterval),e._recycle()}_endDrag(e){const r=this;if(r._dialogDragDetails&&(r._dialogDragDetails.started=!1),r._dragDrop){const t=r._dragDrop.dragDetails;if(!t.feedback||t.feedback&&t.feedback.classList.contains("error")&&!t.feedback.classList.contains("data"))return void r._cancelDrag();if(e.key&&"Escape"===e.key)return r._dragDrop.column?r.$.fireEvent("columnDragCancel",{column:t.item.column,dataField:t.item.column.dataField,index:r.columns.indexOf(r._dragDrop.column),data:r._dragDrop}):r._dragDrop.row&&r.$.fireEvent("rowDragCancel",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.row.visibleIndex,data:r._dragDrop}),void r._cancelDrag();r.beginUpdate();let o=t.target;const a=t.before;if(r._dragDrop.column){if(r.filtering.filterRow)for(let e=0;e<r.columns.length;e++)r.columns[e]._filterEditorInitialized=!1;if(o&&o.column&&"Escape"!==e.key&&!t.feedback.classList.contains("data")){if(!r.$.fireEvent("columnDragEnd",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:r.columns.indexOf(r._dragDrop.column),newIndex:r.columns.indexOf(o.column),data:r._dragDrop,originalEvent:e.originalEvent}).defaultPrevented){const t=r.columns.indexOf(r._dragDrop.column);let n=r.columns.indexOf(o.column);r._dragDrop.column.freeze,n+=a?0:1,r._dragDrop.column.columnGroup=o.column.columnGroup,r._dragDrop.column.freeze=o.column.freeze,r.behavior.allowColumnFreeze&&(r._dragDrop.feedback.classList.contains("freeze")&&(r._dragDrop.column.freeze=!0),r._dragDrop.feedback.classList.contains("unfreeze")&&(r._dragDrop.column.freeze=!1)),t<n&&n--;const d=r._dragDrop.column,i=d.sortIndex,l=d.sortOrder,s=d.filter,g=r.columns.canNotify;r.columns.canNotify=!1,r.columns.move(t,n),r.columns.canNotify=g;const c=r.context;r.context=document,d.sortOrder=l,d.sortIndex=i,d.filter=s,r.context=c,r._renderColumns(),r.$.fireEvent("columnReorder",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:t,newIndex:n,data:r._dragDrop,originalEvent:e.originalEvent}),r.autoSaveState()}}else r.$.fireEvent("columnDragEnd",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:r.columns.indexOf(r._dragDrop.column),newIndex:-1,data:r._dragDrop,originalEvent:e.originalEvent});if("Escape"!==e.key&&r.$.breadcrumb&&r._dragDrop.column.allowGroup){const t=r.getBoundingRect(r.$.breadcrumb);if(e.originalEvent.pageY>=t.top-r.scrollTop&&e.originalEvent.pageY<=t.bottom-r.scrollTop){const e=r.$.breadcrumb._items.indexOf(o),t=r._dragDrop.dragDetails.item.column,n=r.$.breadcrumb.dataSource.slice(0);n.splice(Math.max(0,e+(a?0:1)),0,{label:t.label,value:t.dataField}),r.$.breadcrumb.dataSource=n;const d=r.$.breadcrumb.dataSource.map((e=>e.value));r.dataSource.groupBy=d,r.refresh(!0),r.refreshFilters(),r.$.fireEvent("group",{groups:r.dataSource.groupBy}),r.autoSaveState()}}}else if(r._dragDrop.row)if(o&&o.row&&"Escape"!==e.key&&!t.feedback.classList.contains("data")){if(!r.$.fireEvent("rowDragEnd",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.row.visibleIndex,newIndex:o.row.visibleIndex,data:r._dragDrop,originalEvent:e.originalEvent}).defaultPrevented){const a=r._dragDrop.row.visibleIndex;let n=o.row.visibleIndex;t.before||n++,a<n&&n--,r.rows.move(a,n),r.$.fireEvent("rowReorder",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:a,newIndex:n,data:r._dragDrop,originalEvent:e.originalEvent})}}else r.$.fireEvent("rowDragEnd",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.row.visibleIndex,newIndex:-1,data:r._dragDrop,originalEvent:e.originalEvent});r._cancelDrag(),r.endUpdate(),r.columnGroups&&r.columnGroups.length>0&&r._renderColumns(!0),r.paging.enabled&&r.grouping.enabled&&r._refreshPagesCount()}}});
53
- Smart.Utilities.Assign("Grid.Menu",class{_openColumnChooserMenu(e){const t=this;if(e||(e=t._commandColumn),!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t._createColumnChooserMenuItems(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e,t._filterContainer&&("none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"));let l=n.right-n.width+window.pageXOffset,i=n.bottom+window.pageYOffset;l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,t.menu.classList.add("smart-open-right"),l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth)),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open")}_openColumnFilterMenu(e){const t=this;if(!e||t.filterRowMenu&&t.filterRowMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.filterRowMenu||(t.filterRowMenu=document.createElement("div"),t.filterRowMenu.classList.add("smart-grid-column-menu"),t.filterRowMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowMenu.classList.add("smart-animate"):t.filterRowMenu.classList.remove("smart-animate"),t._createColumnFilterMenuItems(e),t.filterRowMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowMenu.column&&t.filterRowMenu.column!==e&&(t.filterRowMenu.column.setProperty("menu",null),t.filterRowMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowMenu):document.body.appendChild(t.filterRowMenu),e.setProperty("filterRowMenu",t.filterRowMenu);const n=e.element.getBoundingClientRect();t.filterRowMenu.column=e;let l=n.left+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowMenu.offsetWidth,l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowMenu.offsetWidth)),t.filterRowMenu.style.left=l+"px",t.filterRowMenu.style.top=i+"px",t.filterRowMenu.classList.remove("smart-hidden"),t.filterRowMenu.classList.add("open"),setTimeout((()=>{t.filterRowMenu.querySelector("smart-menu").focus()}),50),t.filterRowMenu}openContextMenu(e,t){const n=this;if(n.contextMenu.selector){const l=document.querySelector(n.contextMenu.selector);l&&setTimeout((()=>{l.open(e,t)}),100)}else n._closeMenu(n._contextMenu),n._contextMenu||(n._contextMenu=document.createElement("div"),n._contextMenu.classList.add("smart-grid-column-menu"),n._contextMenu.setAttribute("theme",n.getAttribute("theme")),n._contextMenu.id=n.id+"_"+n.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.menu=n._contextMenu),n.appearance.allowColumnMenuAnimation?n._contextMenu.classList.add("smart-animate"):n._contextMenu.classList.remove("smart-animate"),n.rightToLeft?n._contextMenu.setAttribute("right-to-left",""):n._contextMenu.removeAttribute("right-to-left"),n.contextMenu.dataField?n._contextMenu.column=n.columnByDataField[n.contextMenu.dataField]:n._contextMenu.column=n.columns[0],n._createContextMenuItems(n._contextMenu),n._contextMenu.style.height=n.contextMenu.height?n.contextMenu.height+"px":"auto",n._contextMenu.style.width=n.contextMenu.width?n.contextMenu.width+"px":"auto",n.isInShadowDOM?n.getRootNode().appendChild(n.menu):document.body.appendChild(n._contextMenu),n._contextMenu.style.left=e+"px",n._contextMenu.style.top=t+"px",n._contextMenu.classList.remove("smart-hidden"),n._contextMenu.classList.add("open"),setTimeout((()=>{n._contextMenu&&n._contextMenu.querySelector("smart-menu").focus()}),50)}_openMenu(e){const t=this;if(!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls")||!1===t.columnMenu.enabled)return void t.closeMenu();t._closeMenu(t.filterRowMenu),t.$.headerBar&&t.header.visible&&t.$.headerBar.closePanel(),t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t.rightToLeft?t.menu.setAttribute("right-to-left",""):t.menu.removeAttribute("right-to-left"),t._createMenuItems(e),t._createFilterPanel(e),t._filterMenuItemsVisibility(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e;let l=n.right-e.element.actionButton.getBoundingClientRect().width+window.pageXOffset,i=n.bottom+window.pageYOffset;t.menu.classList.remove("smart-open-right"),t.rightToLeft&&(l=n.left+window.pageXOffset-t.menu.offsetWidth+e.element.actionButton.getBoundingClientRect().width,l<0&&(l=n.left+window.pageXOffset)),l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth),t.menu.classList.add("smart-open-right")),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.hasColumnMenu(e)?t.menu.classList.remove("smart-hidden"):t.closeMenu(),t.menu.classList.add("open"),setTimeout((()=>{t.menu&&(t.menu.querySelector(".smart-filter-panel-input")?t.menu.querySelector(".smart-filter-panel-input").focus():t.menu.querySelector("smart-menu").focus())}),50)}_menuItemClick(e){const t=this,n=e.detail.value;if(n&&n.properties){const e=n.properties.command;"function"==typeof e?e.apply(t,[n.column,n.properties]):t[e]&&t[e].apply(t,[n.column,n.properties]),n.column&&n.column.autoCloseMenu&&t.closeMenu()}}contextMenuItemDeleteCommand(){const e=this;void 0!==e.contextMenu.id&&e.deleteRow(e.contextMenu.id)}contextMenuItemEditCommand(){const e=this;void 0!==e.contextMenu.id&&e.editing.enabled&&("cell"===e.editing.mode?e.beginEdit(e.contextMenu.id,e.contextMenu.dataField):e.beginEdit(e.contextMenu.id))}removeGroupByCommand(e){this.removeGroup(e.dataField),this.autoSaveState()}groupByCommand(e){const t=this;t.dataSource&&(t.$.headerBar?t.header.visible&&t.header.buttons.indexOf("group")>=0&&t.$.headerBar.openGroupPanel(e):t.addGroup(e.dataField),t.autoSaveState())}sortAscCommand(e){this.sortBy(e.dataField,"asc"),this.autoSaveState()}sortDescCommand(e){this.sortBy(e.dataField,"desc"),this.autoSaveState()}removeSortCommand(e){this.sortBy(e.dataField,null),this.autoSaveState()}addSortCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openSortPanel(e)}addFilterCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openFilterPanel(e)}removeFilterCommand(e){this.removeFilter(e.dataField)}customizeTypeCommand(e){this._openAddColumnDialog(e,"rename")}hideColumnCommand(e){e.visible=!1,this.autoSaveState()}deleteColumnCommand(e){const t=this;t.columns.splice(t.columns.indexOf(e),1);for(let n=0;n<t.rows.length;n++)delete t.rows[n].data[e.dataField]}duplicateCommand(e,t,n){const l=this,i=new Smart.Grid.Column(e);delete i._state;let o=e.dataField,a=0;if(void 0===n){let t=!1;for(let n=0;n<l.rows.length;n++)if(l.rows[n].data[e.dataField]){t=!0;break}if(t)return void l._openDescriptionDialog(e,"duplicate")}for(let e=0;e<l.columns.length;e++)l.columns[e].dataField.indexOf(o)>=0&&a++;if(i.displayField=i.dataField=e.dataField+"_"+a,"object"==typeof e.editor){const t={};for(let n in e.editor)"instance"!==n&&"cell"!==n&&"column"!==n&&"row"!==n&&"isInitialized"!==n&&(t[n]=e.editor[n]);i.editor=JSON.parse(JSON.stringify(t))}const r=l.columns.indexOf(e);if(n)for(let t=0;t<l.rows.length;t++){const n=l.rows[t],o=n.data[e.dataField];n.data[i.dataField]=o}i.label=e.label+` ${l.localize("copy")} `+a,l.columns.splice(1+r,0,i),l.onColumnClone&&setTimeout((()=>{l.onColumnClone(e.dataField,i.dataField,1+r,n)}),100)}_removeMenu(){const e=this;if(e.menu){const t=e.menu.querySelector("smart-menu");t&&e.menu.removeChild(t)}if(e.filterRowMenu){const t=e.filterRowMenu.querySelector("smart-menu");t&&e.filterRowMenu.removeChild(t)}if(e._contextMenu){const t=e._contextMenu.querySelector("smart-menu");t&&(e._contextMenu.removeChild(t),e._contextMenu.parentNode.removeChild(e._contextMenu))}}_createColumnChooserMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();if(n.mode="vertical",n.dropDownAppendTo="body",n.checkboxes=!0,n.checkable=!0,n.classList.add("smart-grid-column-chooser-menu"),n.rightToLeft=t.rightToLeft,e&&"_addNewColumn"===e.dataField){if(t._kanbanViewColumns&&t._kanbanViewColumns.length>0)for(let e=0;e<t._kanbanViewColumns.length;e++){const n=t._kanbanViewColumns[e],i=t.columnByDataField[n.dataField];if(i&&i.visible)continue;const o=document.createElement("smart-menu-item"),a=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";o.checked=n.visible,n.allowHide&&(n.command=function(e){t.closeMenu();const n=t.columnByDataField[e.dataField];n.visible=!0,delete n._visible;const l=t._kanbanViewColumns.indexOf(e);l>=0&&t._kanbanViewColumns.splice(l,1)},o.label=t.localize(n.label)||n.label||n.dataField,o.value={column:n,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),l.appendChild(o))}const e=document.createElement("smart-menu-item");e.label='<span class="smart-grid-icon smart-icon-plus"></span>'+t.localize("dialogNewColumn"),e.value={properties:{command:()=>{t.closeMenu(),t._openAddColumnDialog()}}},l.appendChild(e)}else for(let e=0;e<t.columns.length;e++){const n=t.columns[e],i=document.createElement("smart-menu-item"),o=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";i.checked=n.visible,n.allowHide&&(n.command=function(e){e.visible=!e.visible},i.label=t.localize(n.label)||n.label||n.dataField,i.value={column:n,properties:n},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),l.appendChild(i))}n.appendChild(l),t.menu.appendChild(n),t.menu.itemCheckChange=t._menuItemClick.bind(t),t.menu.addEventListener("itemCheckChange",t.menu.itemCheckChange),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createColumnFilterMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu"),n.rightToLeft=t.rightToLeft;const i=e._filterInfo.dataSource;for(let t=0;t<i.length;t++){const n=i[t],o=document.createElement("smart-menu-item"),a=n.icon;o.label=n.label,o.value={column:e,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),e._filterInfo.condition===n.value&&o.setAttribute("focus",""),l.appendChild(o)}n.appendChild(l),t.filterRowMenu.appendChild(n),t.filterRowMenu.itemClick=t._menuItemClick.bind(t),t.filterRowMenu.addEventListener("itemClick",t.filterRowMenu.itemClick),t.filterRowMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowMenu)}))}_createMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment(),i=e.menuItems||t.columnMenu.dataSource;n.mode="vertical",n.dropDownAppendTo="body",n.rightToLeft=t.rightToLeft;for(let n in i){const o=i[n],a=document.createElement("smart-menu-item");let r=o.icon;a.label=t.localize(n),a.value={column:e,properties:o};const s=t=>{if(t){if("string"===e.dataType)return"A → Z";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"1 → 9";if("bool"===e.dataType||"boolean"===e.dataType)return"0 → 1"}else{if("string"===e.dataType)return"Z → A";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"9 → 1";if("bool"===e.dataType||"boolean"===e.dataType)return"1 → 0"}};"columnMenuItemSortAsc"===n?(a.label=t.localize(n,{mode:s(!0)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)):"columnMenuItemSortDesc"===n&&(a.label=t.localize(n,{mode:s(!1)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)),r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),l.appendChild(a)}n.appendChild(l),t._filterContainer?t.menu.insertBefore(n,t._filterContainer):t.menu.appendChild(n),t.menu.itemClick=t._menuItemClick.bind(t),t.menu.addEventListener("itemClick",t.menu.itemClick),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createContextMenuItems(){const e=this;e._removeMenu();const t=document.createElement("smart-menu"),n=document.createDocumentFragment(),l=e.contextMenu.dataSource;t.mode="vertical",t.dropDownAppendTo="body",t.rightToLeft=e.rightToLeft;for(let t in l){const i=l[t],o=document.createElement("smart-menu-item");let a=i.icon;!0===i.visible?o.classList.remove("smart-hidden"):!1===i.visible&&o.classList.add("smart-hidden"),"contextMenuItemEdit"===t?(e.editing.enabled||(o.disabled=!0),"{{messages}}"===i.label?"cell"===e.editing.mode?o.label=e.localize("contextMenuItemEditCell"):o.label=e.localize("contextMenuItemEditRow"):o.label=i.label):"{{messages}}"===i.label?o.label=e.localize(t):o.label=i.label,o.value={properties:i},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),n.appendChild(o)}t.appendChild(n),e._contextMenu.appendChild(t),e._contextMenu.itemClick=t=>{t.detail.value.column=t.detail.item.column=e._contextMenu.column,e._menuItemClick(t),e._closeMenu(e._contextMenu),e.$.fireEvent("contextMenuItemClick",{id:e._contextMenu.id,dataField:e._contextMenu.column.dataField,command:t.detail.value.properties.command})},e._contextMenu.style.minHeight="30px",e._contextMenu.addEventListener("itemClick",e._contextMenu.itemClick),e._contextMenu.addEventListener("keydown",e._keyDownHandler.bind(e))}_getFilterType(e){let t="string";switch(e.dataType.endsWith("?")?e.dataType.substring(0,e.dataType.length-1):e.dataType){case"number":case"int":case"float":case"int64":t="numeric";break;case"bool":case"boolean":t="bool";break;case"date":case"time":case"datetime":t="date";break;case"any":t="string"}return t}_createFilterPanel(e){const t=this;if(Smart.FilterPanel)if(t.filtering.enabled&&t.filtering.filterMenu.visible&&e.allowFilter&&!t.filtering.filterRow.visible&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){const n=t._getFilterType(e);t._filterPanel&&t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),t._filterPanel=t._filterPanels[n],t._filterPanel.dataField=e.dataField,t._filterPanel.rightToLeft=t.rightToLeft,t.filtering.filterMenu.messages?t._filterPanel.messages=t.filtering.filterMenu.messages:t._filterPanel.messages=t.messages,"excel"===e.filterMenuMode&&(t._filterPanel.dataField=e.dataField,t.dataSource&&t.dataSource.boundSource&&(t._filterPanel.data=t.dataSource.boundSource.toArray?t.dataSource.boundSource.toArray():t.dataSource.boundSource)),t._filterPanel.mode=e.filterMenuMode,t._filterPanel.locale=t.locale;const l=t._filterPanel.querySelectorAll(".smart-filter-panel-input");for(let e=0;e<l.length;e++)l[e].onkeydown=e=>{"Enter"===e.key&&t._filterPanel.filter()};if(!t._filterContainer){const e=document.createElement("div");e.classList.add("smart-filter-container"),t._filterContainer=e,requestAnimationFrame((function(){t.menu.appendChild(e)})),t._applyFilterHandler=function(){t.addFilter(t._filterPanel.dataField,t._filterPanel.getFilter()),t.columnByDataField[t._filterPanel.dataField]._filterState=t._filterPanel.getState(),t.autoSaveState()},t._clearFilterHandler=function(){requestAnimationFrame((()=>{t.removeFilter(t._filterPanel.dataField),t.columnByDataField[t._filterPanel.dataField]._filterState=null,t.autoSaveState()}))}}t._filterContainer.appendChild(t._filterPanel),t._filterPanel.classList.remove("smart-hidden"),t._filterPanel.removeEventListener("filter",t._applyFilterHandler),t._filterPanel.removeEventListener("clear",t._clearFilterHandler),t._filterPanel.addEventListener("filter",t._applyFilterHandler),t._filterPanel.addEventListener("clear",t._clearFilterHandler);const i=t._filterContainer.querySelector(".smart-grid-custom-filter-panel");if(i&&t._filterContainer.removeChild(i),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),e.getFilterPanel)if(e._customFilterPanel)e.updateFilterPanel(e._customFilterPanel,e),t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(e._customFilterPanel);else{const n=e.getFilterPanel(e);n&&(n.classList.add("smart-grid-custom-filter-panel"),e._customFilterPanel=n,t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(n))}if(t._filterPanel.reset(),e._filterState)t._filterPanel.loadState(e._filterState);else if(e.filter){const n=e.filter,l=t._getFilterType(e);let i=n.getFilters();for(;i.length>0&&"FilterGroup"===i[0].type;)i=i[0].value;const o=n.getConditions(l),a=i.length>0?o.indexOf(i[0].condition):-1,r=i.length>1?o.indexOf(i[1].condition):-1,s=i.length>0?i[0].value:"",d=i.length>1?i[1].value:"",u=i.length>1?["and","or"].indexOf(i[1].logicalOperator):0;"excel"===e.filterMenuMode?(e._filterState={filters:i},t._filterPanel.loadState(e._filterState)):(e._filterState={firstFilterComparison:a,firstFilterValue:s,logicalOperator:u,secondFilterComparison:r,secondFilterValue:d},t._filterPanel.loadState(e._filterState))}}else t._filterPanel&&(t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),e._filterState=null)}hasColumnMenu(e){const t=this;if(!1===t.columnMenu.enabled)return!1;const n=e.menuItems||t.columnMenu.dataSource;let l=0,i=0;for(let o in n){const a=n[o];i++,!1===a.visible?l++:"auto"===a.visible&&("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))&&l++,"columnMenuItemGroupBy"!==o&&"columnMenuItemRemoveGroupBy"!==o||e.allowGroup&&t.grouping.enabled||l++,"columnMenuItemSort"!==o||e.allowSort&&t.sorting.enabled||l++,"columnMenuItemFilter"!==o||e.allowFilter&&t.filtering.enabled||l++,"columnMenuItemRemoveFilter"!==o||e.allowFilter&&t.filtering.enabled||l++,"columnMenuItemGroupBy"!==o||e.allowGroup||l++,"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled||l++)}return!!(t.filtering.enabled&&t.filtering.filterMenu.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0&&a.classList.remove("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"columnMenuItemSort"===o&&(!1===t.sorting.enabled?a.classList.add("smart-hidden"):(a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.remove("smart-hidden"))),"columnMenuItemGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n>=0}if("columnMenuItemRemoveGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("group")>=0&&a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSort"!==o||e.allowSort||a.classList.add("smart-hidden"),"columnMenuItemRemoveFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||(e.allowSort&&t.sorting.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.add("smart-hidden"))}}else a.classList.add("smart-hidden");else a.classList.add("smart-hidden")}}openMenu(e){const t=this.columnByDataField[e];t&&this._openMenu(t)}hasMenu(){const e=this;return!!(e.menu&&e.menu.column&&e.menu.parentNode)}_closeMenu(e){const t=this;(e=>{e&&e.column&&(e.column&&(e.column.setProperty("menu",null),e.column=null),e.parentNode&&(e.classList.remove("open"),t.appearance.allowColumnMenuAnimation||e.parentNode.removeChild(e)),e.removeEventListener("keydown",t._keyDownHandler.bind(t)),e.removeEventListener("itemClick",e.itemClick),e.removeEventListener("itemCheckChange",e.itemCheckChange),t.focus())})(e)}closeMenu(){const e=this,t=e.menu;if(e._closeMenu(t),e._closeMenu(e.filterRowMenu),e._closeMenu(e._contextMenu),e._filterPanel){const t=e._filterPanel.querySelectorAll("smart-drop-down-list");for(let e=0;e<t.length;e++){const n=t[e];n.opened&&n.close()}}}});
53
+ Smart.Utilities.Assign("Grid.Menu",class{_openColumnChooserMenu(e){const t=this;if(e||(e=t._commandColumn),!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t._createColumnChooserMenuItems(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e,t._filterContainer&&("none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"));let l=n.right-n.width+window.pageXOffset,i=n.bottom+window.pageYOffset;l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,t.menu.classList.add("smart-open-right"),l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth)),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open")}_openColumnFilterMenu(e){const t=this;if(!e||t.filterRowMenu&&t.filterRowMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.filterRowMenu||(t.filterRowMenu=document.createElement("div"),t.filterRowMenu.classList.add("smart-grid-column-menu"),t.filterRowMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowMenu.classList.add("smart-animate"):t.filterRowMenu.classList.remove("smart-animate"),t._createColumnFilterMenuItems(e),t.filterRowMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowMenu.column&&t.filterRowMenu.column!==e&&(t.filterRowMenu.column.setProperty("menu",null),t.filterRowMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowMenu):document.body.appendChild(t.filterRowMenu),e.setProperty("filterRowMenu",t.filterRowMenu);const n=e.element.getBoundingClientRect();t.filterRowMenu.column=e;let l=n.left+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowMenu.offsetWidth,l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowMenu.offsetWidth)),t.filterRowMenu.style.left=l+"px",t.filterRowMenu.style.top=i+"px",t.filterRowMenu.classList.remove("smart-hidden"),t.filterRowMenu.classList.add("open"),setTimeout((()=>{t.filterRowMenu.querySelector("smart-menu").focus()}),50),t.filterRowMenu}openContextMenu(e,t){const n=this;if(n.contextMenu.selector){const l=document.querySelector(n.contextMenu.selector);l&&setTimeout((()=>{l.open(e,t)}),100)}else n._closeMenu(n._contextMenu),n._contextMenu||(n._contextMenu=document.createElement("div"),n._contextMenu.classList.add("smart-grid-column-menu"),n._contextMenu.setAttribute("theme",n.getAttribute("theme")),n._contextMenu.id=n.id+"_"+n.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.menu=n._contextMenu),n.appearance.allowColumnMenuAnimation?n._contextMenu.classList.add("smart-animate"):n._contextMenu.classList.remove("smart-animate"),n.rightToLeft?n._contextMenu.setAttribute("right-to-left",""):n._contextMenu.removeAttribute("right-to-left"),n.contextMenu.dataField?n._contextMenu.column=n.columnByDataField[n.contextMenu.dataField]:n._contextMenu.column=n.columns[0],n._createContextMenuItems(n._contextMenu),n._contextMenu.style.height=n.contextMenu.height?n.contextMenu.height+"px":"auto",n._contextMenu.style.width=n.contextMenu.width?n.contextMenu.width+"px":"auto",n.isInShadowDOM?n.getRootNode().appendChild(n.menu):document.body.appendChild(n._contextMenu),n._contextMenu.style.left=e+"px",n._contextMenu.style.top=t+"px",n._contextMenu.classList.remove("smart-hidden"),n._contextMenu.classList.add("open"),setTimeout((()=>{n._contextMenu&&n._contextMenu.querySelector("smart-menu").focus()}),50)}_openMenu(e){const t=this;if(!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls")||!1===t.columnMenu.enabled)return void t.closeMenu();t._closeMenu(t.filterRowMenu),t.$.headerBar&&t.header.visible&&t.$.headerBar.closePanel(),t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t.rightToLeft?t.menu.setAttribute("right-to-left",""):t.menu.removeAttribute("right-to-left"),t._createMenuItems(e),t._createFilterPanel(e),t._filterMenuItemsVisibility(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e;let l=n.right-e.element.actionButton.getBoundingClientRect().width+window.pageXOffset,i=n.bottom+window.pageYOffset;t.menu.classList.remove("smart-open-right"),t.rightToLeft&&(l=n.left+window.pageXOffset-t.menu.offsetWidth+e.element.actionButton.getBoundingClientRect().width,l<0&&(l=n.left+window.pageXOffset)),l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth),t.menu.classList.add("smart-open-right")),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.hasColumnMenu(e)?(t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open"),setTimeout((()=>{t.menu&&(t.menu.querySelector(".smart-filter-panel-input")?t.menu.querySelector(".smart-filter-panel-input").focus():t.menu.querySelector("smart-menu").focus())}),50)):t.closeMenu()}_menuItemClick(e){const t=this,n=e.detail.value;if(n&&n.properties){const e=n.properties.command;"function"==typeof e?e.apply(t,[n.column,n.properties]):t[e]&&t[e].apply(t,[n.column,n.properties]),n.column&&n.column.autoCloseMenu&&t.closeMenu()}}contextMenuItemDeleteCommand(){const e=this;void 0!==e.contextMenu.id&&e.deleteRow(e.contextMenu.id)}contextMenuItemEditCommand(){const e=this;void 0!==e.contextMenu.id&&e.editing.enabled&&("cell"===e.editing.mode?e.beginEdit(e.contextMenu.id,e.contextMenu.dataField):e.beginEdit(e.contextMenu.id))}removeGroupByCommand(e){this.removeGroup(e.dataField),this.autoSaveState()}groupByCommand(e){const t=this;t.dataSource&&(t.$.headerBar?t.header.visible&&t.header.buttons.indexOf("group")>=0&&t.$.headerBar.openGroupPanel(e):t.addGroup(e.dataField),t.autoSaveState())}sortAscCommand(e){this.sortBy(e.dataField,"asc"),this.autoSaveState()}sortDescCommand(e){this.sortBy(e.dataField,"desc"),this.autoSaveState()}removeSortCommand(e){this.sortBy(e.dataField,null),this.autoSaveState()}addSortCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openSortPanel(e)}addFilterCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openFilterPanel(e)}removeFilterCommand(e){this.removeFilter(e.dataField)}customizeTypeCommand(e){this._openAddColumnDialog(e,"rename")}hideColumnCommand(e){e.visible=!1,this.autoSaveState()}deleteColumnCommand(e){const t=this;t.columns.splice(t.columns.indexOf(e),1);for(let n=0;n<t.rows.length;n++)delete t.rows[n].data[e.dataField]}duplicateCommand(e,t,n){const l=this,i=new Smart.Grid.Column(e);delete i._state;let o=e.dataField,a=0;if(void 0===n){let t=!1;for(let n=0;n<l.rows.length;n++)if(l.rows[n].data[e.dataField]){t=!0;break}if(t)return void l._openDescriptionDialog(e,"duplicate")}for(let e=0;e<l.columns.length;e++)l.columns[e].dataField.indexOf(o)>=0&&a++;if(i.displayField=i.dataField=e.dataField+"_"+a,"object"==typeof e.editor){const t={};for(let n in e.editor)"instance"!==n&&"cell"!==n&&"column"!==n&&"row"!==n&&"isInitialized"!==n&&(t[n]=e.editor[n]);i.editor=JSON.parse(JSON.stringify(t))}const r=l.columns.indexOf(e);if(n)for(let t=0;t<l.rows.length;t++){const n=l.rows[t],o=n.data[e.dataField];n.data[i.dataField]=o}i.label=e.label+` ${l.localize("copy")} `+a,l.columns.splice(1+r,0,i),l.onColumnClone&&setTimeout((()=>{l.onColumnClone(e.dataField,i.dataField,1+r,n)}),100)}_removeMenu(){const e=this;if(e.menu){const t=e.menu.querySelector("smart-menu");t&&e.menu.removeChild(t)}if(e.filterRowMenu){const t=e.filterRowMenu.querySelector("smart-menu");t&&e.filterRowMenu.removeChild(t)}if(e._contextMenu){const t=e._contextMenu.querySelector("smart-menu");t&&(e._contextMenu.removeChild(t),e._contextMenu.parentNode.removeChild(e._contextMenu))}}_createColumnChooserMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();if(n.mode="vertical",n.dropDownAppendTo="body",n.checkboxes=!0,n.checkable=!0,n.classList.add("smart-grid-column-chooser-menu"),n.rightToLeft=t.rightToLeft,e&&"_addNewColumn"===e.dataField){if(t._kanbanViewColumns&&t._kanbanViewColumns.length>0)for(let e=0;e<t._kanbanViewColumns.length;e++){const n=t._kanbanViewColumns[e],i=t.columnByDataField[n.dataField];if(i&&i.visible)continue;const o=document.createElement("smart-menu-item"),a=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";o.checked=n.visible,n.allowHide&&(n.command=function(e){t.closeMenu();const n=t.columnByDataField[e.dataField];n.visible=!0,delete n._visible;const l=t._kanbanViewColumns.indexOf(e);l>=0&&t._kanbanViewColumns.splice(l,1)},o.label=t.localize(n.label)||n.label||n.dataField,o.value={column:n,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),l.appendChild(o))}const e=document.createElement("smart-menu-item");e.label='<span class="smart-grid-icon smart-icon-plus"></span>'+t.localize("dialogNewColumn"),e.value={properties:{command:()=>{t.closeMenu(),t._openAddColumnDialog()}}},l.appendChild(e)}else for(let e=0;e<t.columns.length;e++){const n=t.columns[e],i=document.createElement("smart-menu-item"),o=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";i.checked=n.visible,n.allowHide&&(n.command=function(e){e.visible=!e.visible},i.label=t.localize(n.label)||n.label||n.dataField,i.value={column:n,properties:n},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),l.appendChild(i))}n.appendChild(l),t.menu.appendChild(n),t.menu.itemCheckChange=t._menuItemClick.bind(t),t.menu.addEventListener("itemCheckChange",t.menu.itemCheckChange),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createColumnFilterMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu"),n.rightToLeft=t.rightToLeft;const i=e._filterInfo.dataSource;for(let t=0;t<i.length;t++){const n=i[t],o=document.createElement("smart-menu-item"),a=n.icon;o.label=n.label,o.value={column:e,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),e._filterInfo.condition===n.value&&o.setAttribute("focus",""),l.appendChild(o)}n.appendChild(l),t.filterRowMenu.appendChild(n),t.filterRowMenu.itemClick=t._menuItemClick.bind(t),t.filterRowMenu.addEventListener("itemClick",t.filterRowMenu.itemClick),t.filterRowMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowMenu)}))}_createMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment(),i=e.menuItems||t.columnMenu.dataSource;n.mode="vertical",n.dropDownAppendTo="body",n.rightToLeft=t.rightToLeft;for(let n in i){const o=i[n],a=document.createElement("smart-menu-item");let r=o.icon;a.label=t.localize(n),a.value={column:e,properties:o};const s=t=>{if(t){if("string"===e.dataType)return"A → Z";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"1 → 9";if("bool"===e.dataType||"boolean"===e.dataType)return"0 → 1"}else{if("string"===e.dataType)return"Z → A";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"9 → 1";if("bool"===e.dataType||"boolean"===e.dataType)return"1 → 0"}};"columnMenuItemSortAsc"===n?(a.label=t.localize(n,{mode:s(!0)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)):"columnMenuItemSortDesc"===n&&(a.label=t.localize(n,{mode:s(!1)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)),r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),l.appendChild(a)}n.appendChild(l),t._filterContainer?t.menu.insertBefore(n,t._filterContainer):t.menu.appendChild(n),t.menu.itemClick=t._menuItemClick.bind(t),t.menu.addEventListener("itemClick",t.menu.itemClick),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createContextMenuItems(){const e=this;e._removeMenu();const t=document.createElement("smart-menu"),n=document.createDocumentFragment(),l=e.contextMenu.dataSource;t.mode="vertical",t.dropDownAppendTo="body",t.rightToLeft=e.rightToLeft;for(let t in l){const i=l[t],o=document.createElement("smart-menu-item");let a=i.icon;!0===i.visible?o.classList.remove("smart-hidden"):!1===i.visible&&o.classList.add("smart-hidden"),"contextMenuItemEdit"===t?(e.editing.enabled||(o.disabled=!0),"{{messages}}"===i.label?"cell"===e.editing.mode?o.label=e.localize("contextMenuItemEditCell"):o.label=e.localize("contextMenuItemEditRow"):o.label=i.label):"{{messages}}"===i.label?o.label=e.localize(t):o.label=i.label,o.value={properties:i},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),n.appendChild(o)}t.appendChild(n),e._contextMenu.appendChild(t),e._contextMenu.itemClick=t=>{t.detail.value.column=t.detail.item.column=e._contextMenu.column,e._menuItemClick(t),e._closeMenu(e._contextMenu),e.$.fireEvent("contextMenuItemClick",{id:e._contextMenu.id,dataField:e._contextMenu.column.dataField,command:t.detail.value.properties.command})},e._contextMenu.style.minHeight="30px",e._contextMenu.addEventListener("itemClick",e._contextMenu.itemClick),e._contextMenu.addEventListener("keydown",e._keyDownHandler.bind(e))}_getFilterType(e){let t="string";switch(e.dataType.endsWith("?")?e.dataType.substring(0,e.dataType.length-1):e.dataType){case"number":case"int":case"float":case"int64":t="numeric";break;case"bool":case"boolean":t="bool";break;case"date":case"time":case"datetime":t="date";break;case"any":t="string"}return t}_createFilterPanel(e){const t=this;if(Smart.FilterPanel)if(t.filtering.enabled&&t.filtering.filterMenu.visible&&e.allowFilter&&!t.filtering.filterRow.visible&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){const n=t._getFilterType(e);t._filterPanel&&t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),t._filterPanel=t._filterPanels[n],t._filterPanel.dataField=e.dataField,t._filterPanel.rightToLeft=t.rightToLeft,t.filtering.filterMenu.messages?t._filterPanel.messages=t.filtering.filterMenu.messages:t._filterPanel.messages=t.messages,"excel"===e.filterMenuMode&&(t._filterPanel.dataField=e.dataField,t.dataSource&&t.dataSource.boundSource&&(t._filterPanel.data=t.dataSource.boundSource.toArray?t.dataSource.boundSource.toArray():t.dataSource.boundSource)),t._filterPanel.mode=e.filterMenuMode,t._filterPanel.locale=t.locale;const l=t._filterPanel.querySelectorAll(".smart-filter-panel-input");for(let e=0;e<l.length;e++)l[e].onkeydown=e=>{"Enter"===e.key&&t._filterPanel.filter()};if(!t._filterContainer){const e=document.createElement("div");e.classList.add("smart-filter-container"),t._filterContainer=e,requestAnimationFrame((function(){t.menu.appendChild(e)})),t._applyFilterHandler=function(){t.addFilter(t._filterPanel.dataField,t._filterPanel.getFilter()),t.columnByDataField[t._filterPanel.dataField]._filterState=t._filterPanel.getState(),t.autoSaveState()},t._clearFilterHandler=function(){requestAnimationFrame((()=>{t.removeFilter(t._filterPanel.dataField),t.columnByDataField[t._filterPanel.dataField]._filterState=null,t.autoSaveState()}))}}t._filterContainer.appendChild(t._filterPanel),t._filterPanel.classList.remove("smart-hidden"),t._filterPanel.removeEventListener("filter",t._applyFilterHandler),t._filterPanel.removeEventListener("clear",t._clearFilterHandler),t._filterPanel.addEventListener("filter",t._applyFilterHandler),t._filterPanel.addEventListener("clear",t._clearFilterHandler);const i=t._filterContainer.querySelector(".smart-grid-custom-filter-panel");if(i&&t._filterContainer.removeChild(i),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),e.getFilterPanel)if(e._customFilterPanel)e.updateFilterPanel(e._customFilterPanel,e),t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(e._customFilterPanel);else{const n=e.getFilterPanel(e);n&&(n.classList.add("smart-grid-custom-filter-panel"),e._customFilterPanel=n,t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(n))}if(t._filterPanel.reset(),e._filterState)t._filterPanel.loadState(e._filterState);else if(e.filter){const n=e.filter,l=t._getFilterType(e);let i=n.getFilters();for(;i.length>0&&"FilterGroup"===i[0].type;)i=i[0].value;const o=n.getConditions(l),a=i.length>0?o.indexOf(i[0].condition):-1,r=i.length>1?o.indexOf(i[1].condition):-1,s=i.length>0?i[0].value:"",d=i.length>1?i[1].value:"",u=i.length>1?["and","or"].indexOf(i[1].logicalOperator):0;"excel"===e.filterMenuMode?(e._filterState={filters:i},t._filterPanel.loadState(e._filterState)):(e._filterState={firstFilterComparison:a,firstFilterValue:s,logicalOperator:u,secondFilterComparison:r,secondFilterValue:d},t._filterPanel.loadState(e._filterState))}}else t._filterPanel&&(t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),e._filterState=null)}hasColumnMenu(e){const t=this;if(!1===t.columnMenu.enabled)return!1;const n=e.menuItems||t.columnMenu.dataSource;let l=0,i=0;for(let o in n){const a=n[o];i++,!1===a.visible?l++:"auto"===a.visible&&("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))&&l++,"columnMenuItemGroupBy"!==o&&"columnMenuItemRemoveGroupBy"!==o||e.allowGroup&&t.grouping.enabled||l++,"columnMenuItemSort"!==o||e.allowSort&&t.sorting.enabled||l++,"columnMenuItemFilter"!==o||e.allowFilter&&t.filtering.enabled||l++,"columnMenuItemRemoveFilter"!==o||e.allowFilter&&t.filtering.enabled||l++,"columnMenuItemGroupBy"!==o||e.allowGroup||l++,"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled||l++)}return!!(t.filtering.enabled&&t.filtering.filterMenu.visible&&!t.filtering.filterRow.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0&&a.classList.remove("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"columnMenuItemSort"===o&&(!1===t.sorting.enabled?a.classList.add("smart-hidden"):(a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.remove("smart-hidden"))),"columnMenuItemGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n>=0}if("columnMenuItemRemoveGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("group")>=0&&a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSort"!==o||e.allowSort||a.classList.add("smart-hidden"),"columnMenuItemRemoveFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||(e.allowSort&&t.sorting.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.add("smart-hidden"))}}else a.classList.add("smart-hidden");else a.classList.add("smart-hidden")}}openMenu(e){const t=this.columnByDataField[e];t&&this._openMenu(t)}hasMenu(){const e=this;return!!(e.menu&&e.menu.column&&e.menu.parentNode)}_closeMenu(e){const t=this;(e=>{e&&e.column&&(e.column&&(e.column.setProperty("menu",null),e.column=null),e.parentNode&&(e.classList.remove("open"),t.appearance.allowColumnMenuAnimation||e.parentNode.removeChild(e)),e.removeEventListener("keydown",t._keyDownHandler.bind(t)),e.removeEventListener("itemClick",e.itemClick),e.removeEventListener("itemCheckChange",e.itemCheckChange),t.focus())})(e)}closeMenu(){const e=this,t=e.menu;if(e._closeMenu(t),e._closeMenu(e.filterRowMenu),e._closeMenu(e._contextMenu),e._filterPanel){const t=e._filterPanel.querySelectorAll("smart-drop-down-list");for(let e=0;e<t.length;e++){const n=t[e];n.opened&&n.close()}}}});
54
54
  Smart.Utilities.Assign("Grid.Pager",class{_refreshPaging(e){const a=this;requestAnimationFrame((()=>{if(a.filtering.filterRow)for(let e=0;e<a.columns.length;e++)a.columns[e]._filterEditorInitialized=!1;a._refreshLayout(),a._refreshSelection(),e||(a._initializeRowElements(),a._refreshLayout()),a.dataSource&&a.dataSource.virtualDataSource?a._virtualDataRequest(e?"pageIndexChange":"pageSizeChange"):(a._recycle(),a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50));const t=a.paging.pageIndex*a._pageSize,r=t+a._pageSize;a.$.fireEvent("page",{data:{first:t,last:r,size:r-t}})}))}firstPage(){const e=this;e.paging.enabled&&(e.paging.pageIndex>0&&(e.paging.pageIndex=0),e._refreshPaging(!0))}lastPage(){const e=this;if(!e.paging.enabled)return;const a=e.$.headerPager.querySelector("smart-pager");e.paging.pageIndex<a.pagesCount-1&&(e.paging.pageIndex=a.pagesCount-1),e._refreshPaging(!0)}prevPage(){const e=this;e.paging.enabled&&(e.paging.pageIndex>0&&e.paging.pageIndex--,e._refreshPaging(!0))}nextPage(){const e=this,a=e.$.headerPager.querySelector("smart-pager");e.paging.enabled&&(e.paging.pageIndex<a.pagesCount-1&&e.paging.pageIndex++,e._refreshPaging(!0))}goToPage(e){const a=this,t=a.$.headerPager.querySelector("smart-pager");!a.paging.enabled||e<0||e>t.pagesCount-1||(a.paging.pageIndex=e,a._refreshPaging(!0))}_refreshPagesCount(){const e=this;if(!e.paging.enabled)return;const a=e.$.headerPager.querySelector("smart-pager"),t=function(){const a=e.getVisibleRows();let t=a.length;if(void 0!==e.dataSource.virtualDataSourceLength&&(t=e.dataSource.virtualDataSourceLength),e.rowHierarchy){t=0;for(let e=0;e<a.length;e++){const r=a[e];0!==r.level||r.parent||t++}if(void 0!==e.dataSource.virtualDataSourceLength)t=e.dataSource.virtualDataSourceLength;else{e._refreshRowHierarchy(!1,!0),t=0;const a=t=>{let r=[];if(0===e.dataSource.groupBy.length)return t;for(let e=0;e<t.length;e++){const i=t[e];(!i.$||void 0===i.$.filtered||i.$.filtered)&&(r.push(i),i.children&&(r=r.concat(a(i.children))))}return r};if(e.rowHierarchy)for(let r=0;r<e.rowHierarchy.length;r++){const i=e.rowHierarchy[r];if(0===i.level&&!i.parent){if(0===a(i.children).length)continue;t++}}else e._visibleRows=null,e.__viewRows=null,t=e.getVisibleRows().length;e._refreshRowHierarchy(),e._recycle(!1)}}return{pagesCount:Math.ceil(t/e._pageSize),totalRecords:t}}();a&&(a.pagesCount=t.pagesCount,a.totalRecords=t.totalRecords);const r=e.$.footerPager.querySelector("smart-pager");a&&(r.pagesCount=t.pagesCount,r.totalRecords=t.totalRecords,a.$.pageSizeSelector.disabled=t.totalRecords<e.pager.pageSizeSelector.dataSource[0],r.$.pageSizeSelector.disabled=t.totalRecords<e.pager.pageSizeSelector.dataSource[0]),e.paging.pageIndex>=t.pagesCount&&t.pagesCount>0&&(e.paging.pageIndex=t.pagesCount-1,e._refreshPaging(e.paging.pageIndex))}_renderPagers(){const e=this;e.pager.visible&&requestAnimationFrame((()=>{const a=document.createElement("smart-pager"),t=document.createElement("smart-pager");e.$.headerPager.innerHTML="",e.$.footerPager.innerHTML="",e.$.headerPager.appendChild(a),e.$.footerPager.appendChild(t);const r=function(a){a.messages[e.locale]||(a.messages[e.locale]={}),Object.assign(a.messages[e.locale],{firstButton:e.localize("pagerFirstButton"),lastButton:e.localize("pagerLastButton"),previousButton:e.localize("pagerPreviousButton"),nextButton:e.localize("pagerNextButton"),navigateToLabel:e.localize("pagerNavigateToLabel"),pageSizeLabel:e.localize("pagerPageSizeLabel"),navigateToInputPlaceholder:e.localize("pagerNavigateToInputPlaceholder"),ellipsis:e.localize("pagerEllipsis"),summaryString:e.localize("pagerSummaryString"),summaryPrefix:e.localize("pagerSummaryPrefix"),summarySuffix:e.localize("pagerSummarySuffix")}),a.locale=e.locale},i=function(){const a=e.getVisibleRows();let t=a.length;if(void 0!==e.dataSource.virtualDataSourceLength&&(t=e.dataSource.virtualDataSourceLength),e.rowHierarchy){t=0;for(let e=0;e<a.length;e++){const r=a[e];0!==r.level||r.parent||t++}if(void 0!==e.dataSource.virtualDataSourceLength)t=e.dataSource.virtualDataSourceLength;else{e._refreshRowHierarchy(!1,!0),t=0;const a=t=>{let r=[];if(0===e.dataSource.groupBy.length)return t;for(let e=0;e<t.length;e++){const i=t[e];(!i.$||void 0===i.$.filtered||i.$.filtered)&&(r.push(i),i.children&&(r=r.concat(a(i.children))))}return r};for(let r=0;r<e.rowHierarchy.length;r++){const i=e.rowHierarchy[r];if(0===i.level&&!i.parent){if(0===a(i.children).length)continue;t++}}e._refreshRowHierarchy(),e._recycle(!1)}}return{pagesCount:Math.ceil(t/e._pageSize),totalRecords:t}},n=function(r,n){const o=n+"GridPager",g=i();r.setAttribute("smart-id",o),e.$[o]=r,e["$"+o]=Smart.Utilities.Extend(r),r.beginUpdate(),e.addPropertyBinding("[[pager_navigationButtons_position]]","navigationButtonsPosition",r),e.addPropertyBinding("[[pager_navigationButtons_firstLastButtons_visible]]","showFirstLastNavigationButtons",r),e.addPropertyBinding("[[pager_navigationButtons_prevNextButtons_visible]]","showPrevNextNavigationButtons",r),e.addPropertyBinding("[[pager_navigationButtons_labels_visible]]","showNavigationButtonLabels",r),e.addPropertyBinding("[[pager_pageIndexSelectors_visible]]","showPageIndexSelectors",r),e.addPropertyBinding("[[pager_pageIndexSelectors_dataSource]]","pageIndexSelectors",r),e.addPropertyBinding("[[pager_summary_visible]]","showSummary",r),e.addPropertyBinding("[[pager_summary_position]]","summaryPosition",r),e.addPropertyBinding("[[pager_navigationInput_visible]]","showNavigationInput",r),e.addPropertyBinding("[[pager_navigationInput_position]]","navigationInputPosition",r),e.addPropertyBinding("[[pager_pageSizeSelector_visible]]","showPageSizeSelector",r),e.addPropertyBinding("[[pager_pageSizeSelector_dataSource]]","pageSizeSelectorDataSource",r),e.addPropertyBinding("[[pager_pageSizeSelector_position]]","pageSizeSelectorPosition",r),e.addPropertyBinding("[[pager_autoEllipsis]]","autoEllipsis",r),e.addPropertyBinding("[[!paging_enabled]]","disabled",r),e.addPropertyBinding("{{paging_pageIndex}}","pageIndex",r),e.addPropertyBinding("{{paging_pageSize}}","pageSize",r),e.addPropertyBinding("{{rightToLeft}}","rightToLeft",r),r.pagesCount=g.pagesCount,r.totalRecords=g.totalRecords,r.$&&r.$.pageSizeSelector&&(r.$.pageSizeSelector.dropDownAppendTo="body",r.$.pageSizeSelector.selectedIndexes=[0],r.totalRecords<e.pager.pageSizeSelector.dataSource[0]&&(r.$.pageSizeSelector.disabled=!0)),e["$"+o].listen("change",(function(n){const o=i();r.pagesCount=o.pagesCount,r.totalRecords=o.totalRecords,e.paging.pageIndex>r.pagesCount&&(e.paging.pageIndex=r.pagesCount-1),a.refresh(),t.refresh();const g=n.detail&&void 0!==n.detail.index||void 0!==n.target.value;e._refreshPaging(g)})),r.endUpdate()};n(a,"header"),n(t,"footer"),r(a),r(t)}))}});
55
55
  Smart.Utilities.Assign("Grid.Filter",class{addFilter(e,t,l){const i=this,a=i.columnByDataField[e];if("string"==typeof t?t=i.dataSource._createFilter(a.dataType,[t]):t&&Array.isArray(t)&&(t=i.dataSource._createFilter(a.dataType,t)),a&&a.canNotify){if(a.setProperty("filter",t),i._isUpdating)return;!1!==l&&i.refreshFilters()}}removeFilter(e,t){const l=this,i=l.columnByDataField[e];if(i&&i.canNotify){if(i.setProperty("filter",null),l._isUpdating)return;!1!==t&&l.refreshFilters()}i&&delete i._filterState}findCells(e){const t=this,l=t.find(e,null,null,"or"),i=[];"string"==typeof e&&e.indexOf(",")>=0&&(e=e.split(","));for(let a=0;a<l.length;a++){const n=l[a];for(let l=0;l<t.columns.length;l++){const a=t.columns[l],r=n[a.dataField];if(Array.isArray(e))for(let t=0;t<e.length;t++)(""+r).trim().toLowerCase()===(""+e[t]).trim().toLowerCase()&&i.push([n.$.id,a.dataField,e[t]]);else(""+r).trim().toLowerCase()===(""+e).trim().toLowerCase()&&i.push([n.$.id,a.dataField,e])}}return i}find(e,t,l,i="and"){const a=this;let n=[];if(l){const e={"=":"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"};e[l]&&(l=e[l])}const r=(e,i="or")=>{let n=[];for(let r=0;r<a.columns.length;r++){const o=a.columns[r],s=new Smart.Utilities.FilterGroup;let d;t&&o.dataField!==t||("string"===o.dataType?(l||(l="CONTAINS"),d=s.createFilter("string",e,l)):"number"===o.dataType?(l||(l="EQUAL"),d=s.createFilter("number",e,l)):"date"===o.dataType&&(l||(l="EQUAL"),d=s.createFilter("date",e,l)),s.addFilter(i,d),n.push([o.dataField,s]))}return n};void 0!==e&&"string"==typeof e&&e.indexOf(",")>=0&&(e=e.split(","));let o=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)o.push(r(e[t].trim()));else n=r(e);const s=a.dataSource;if(!s)return[];let d=[];const u=(e,t)=>{let l=!1;for(let i=0;i<t.length;i++){const a=t[i],n=e[a[0]];l=l||a[1].evaluate(n)}return l};for(let e=0;e<s.length;e++){const t=s[e];if(o.length)if("and"===i){let e=!0;for(let l=0;l<o.length;l++)e=e&&u(t,o[l]);e&&d.push(t)}else{let e=!1;for(let l=0;l<o.length;l++)e=e||u(t,o[l]);e&&d.push(t)}else u(t,n)&&d.push(t)}return d}clearFilter(){const e=this;for(let t=0;t<e.columns.length;t++)e.columns[t].setProperty("filter",null);e.refreshFilters()}getFilteredColumns(){const e=this;if(e._filters){const t=[];for(let l=0;l<e._filters.length;l++){const i=e._filters[l];t[i[0]]=i[1],t.length++}return t}return[]}getVisibleRows(){const e=this;if(e._visibleRows)return e._visibleRows;const t=[],l=e._viewRows,i=e.editing.addNewRow.visible&&"far"!==e.editing.addNewRow.position&&"button"!==e.editing.addNewRow.displayMode?1:0,a=e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0;let n=0;for(let e=0;e<l.length;e++){const r=l[e];r.canNotify=!1,r.visibleIndex=-1,!r.visible||!1===r.filtered&&void 0!==r.filtered||(a?r.leaf?r.visibleIndex=n++:r.visibleIndex=-1:r.visibleIndex=t.length-i,t.push(r)),r.canNotify=!0}return e._visibleRows=t,t}_refreshFilterRowEditors(){const e=this;if(e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1)}refreshSortAndFilters(){this._refreshDataFilters()}_refreshDataFilters(){const e=this;!1!==e.editing.autoUpdateFilterAndSort&&(e._supressFilter||(!e._filters||e._filters&&0===e._filters.length)&&(!e._sortedColumns||e._sortedColumns&&0===e._sortedColumns.length)||(e.beginUpdate(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort(),e._filters&&e._filters.length>0&&e.refreshFilters(!0),e.endUpdate()))}refreshFilters(e){const t=this,l=[];t._filters||(t._filters=[]);for(let e=0;e<t.columns.length;e++){const i=t.columns[e];i.filter&&l.push([i.dataField,i.filter])}if(t.scrollTop=0,t.closeMenu(),t.dataSource&&!t.dataSource.onFilter&&(t.dataSource.onFilter=function(){const e=t._viewRows;for(let t=0;t<e.length;t++){const l=e[t];if(l.data&&!l.addNewRow){if(!l.data.$){l.filtered=!0;continue}l.filtered=void 0===l.data.$.filtered||l.data.$.filtered}}t.refresh()}),JSON.stringify(t._filters)===JSON.stringify(l)&&!0!==e)return void(t._visibleRows=null);if(t._filters=l,t._visibleRows=null,t.dataSource&&t.dataSource.virtualDataSource)t.closeMenu(),t._virtualDataRequest("filter");else{const e=t._filterOperator||t.filtering.operator;t.dataSource._filter(l,e)}t.paging.enabled&&t.dataSource&&!t.dataSource.virtualDataSource&&t._refreshPagesCount();let i=[];for(let e=0;e<t.columns.length;e++){const l=t.columns[e];l.filter&&i.push(l)}let a=[],n=[],r=[];if(t._filters)for(let e=0;e<t._filters.length;e++){const l=t._filters[e];r.push(l[0]);let i="";const o=t.columnByDataField[l[0]];for(let e=0;e<l[1].filters.length;e++){const t=l[1].filters[e].condition,a=l[1].filters[e].value,n=l[1].logicalOperators[e],r=1===n||"or"===n?"or":"and";"string"===o.dataType?i+=`"${t}" "${a}"`:i+=`"${t}" ${a}`,e<l[1].filters.length-1&&(i+=` ${r} `)}n.push([l[0],i]),a.push({dataField:l[0],filter:l[1]})}t.summaryRow.visible&&(t._calculateSummary(),t._recycle(!1)),e||t.$.fireEvent("filter",{columns:i,expressions:JSON.parse(JSON.stringify(n)),dataFields:r,data:JSON.parse(JSON.stringify(a))}),t._onFilter&&t._onFilter()}_handleFilterCellFocus(e){const t=this,l=e.column._filterInfo,i=l.editor,a=l.input,n=e.column,r=n.dataType;i.setAttribute("focus",""),t.filtering.filterRow.cell=e,"RANGE"===l.condition?t._openFilterCellDialog(e,(e=>{const l=e._filterInfo,i=l.editor,a=l.range,n=l.input,r=l.cell;if(a){const l=new Smart.FilterGroup;l.addFilter("and",l.createFilter(e.dataType,a.min,"GREATER_THAN_OR_EQUAL")),l.addFilter("and",l.createFilter(e.dataType,a.max,"LESS_THAN_OR_EQUAL")),t.addFilter(e.dataField,l)}else t.removeFilter(e.dataField);if(i&&n)if(n.type="",a){const t=r.getFormattedValue(a.min,e.cellsFormat),l=r.getFormattedValue(a.max,e.cellsFormat);n.value=t+" - "+l}else n.value=""})):(a.type="number"===r||"int"===r||"float"===r?"number":"",l.value&&(a.value=l.value,"date"===r&&(a.value=e.getFormattedValue(l.value,n.cellsFormat))))}_handleFilterCellBlur(e){const t=this,l=e.column._filterInfo,i=l.editor,a=l.input,n=e.column,r=l.condition;t.filtering.filterRow.cell=null,n.filterRowMenu&&n.filterRowMenu.classList.contains("open")||(""!==a.value&&"RANGE"!==r&&("date"===n.dataType?(l.value=new Date(a.value),a.value=e.getFormattedValue(l.value,n.cellsFormat)):"number"===n.dataType||"int"===n.dataType||"float"===n.dataType?(l.value=parseFloat(a.value),a.type="",a.value=e.getFormattedValue(l.value,n.cellsFormat)):l.value=a.value),"auto"===t.filtering.filterRow.applyMode&&t._handleFilterCellValue(e)),i.removeAttribute("focus")}_handleFilterCellValue(e){const t=this,l=e.column._filterInfo,i=e.column;if("RANGE"===l.condition){const e=l.range;if(e){const l=new Smart.FilterGroup;l.addFilter("and",l.createFilter(i.dataType,e.min,"GREATER_THAN_OR_EQUAL")),l.addFilter("and",l.createFilter(i.dataType,e.max,"LESS_THAN_OR_EQUAL")),t.addFilter(i.dataField,l)}else t.removeFilter(i.dataField)}else{const e=l.value;if(""!==e&&void 0!==e){const a=new Smart.FilterGroup;a.addFilter("and",a.createFilter(i.dataType,e,l.condition||("string"===i.dataType?"CONTAINS":"EQUAL"))),t.addFilter(i.dataField,a)}else t.removeFilter(i.dataField)}}_handleFilterCellKeyDown(e,t){const l=this,i=e.column._filterInfo.input;t.ctrlKey&&"a"===t.key?i.select():t.altKey&&"ArrowDown"===t.key&&l._handleFilterCellIconClick(e)}_handleFilterCellKeyUp(e,t){const l=e.column,i=l._filterInfo.input,a=this,n=l._filterInfo,r=t.key;n.value=i.value,"Escape"===r&&(n.value="",n.range=null,i.value=""),"Enter"===r||"Escape"===r||""===i.value?a._handleFilterCellValue(e):"auto"===a.filtering.filterRow.applyMode&&"Ctrl"!==r&&"Shift"!==r&&(a._filterRowTimer&&clearTimeout(a._filterRowTimer),a._filterRowTimer=setTimeout((()=>{a._handleFilterCellValue(e)}),a.filtering.filterRow.autoApplyModeDelay)),t.ctrlKey&&"a"===r&&i.select()}_handleFilterCellCheckBoxClick(e){const t=this,l=e.column,i=l._filterInfo;void 0===i.value&&(i.value=null),!0===i.value?i.value=!1:!1===i.value?i.value=null:null===i.value&&(i.value=!0);const a=e.element.querySelector(".smart-input");if(i.value?a.setAttribute("checked",i.value):null===i.value?a.setAttribute("checked","indeterminate"):a.removeAttribute("checked"),null===i.value)return void t.removeFilter(l.dataField);const n=new Smart.FilterGroup;n.addFilter("and",n.createFilter(l.dataType,!0===i.value,"EQUAL")),t.addFilter(l.dataField,n)}_handleFilterCellIconClick(e){const t=this,l=e.column;l.filterRowMenu&&l.filterRowMenu.classList.contains("open")?t._closeMenu(l.filterRowMenu):t._openColumnFilterMenu(l)}_handleFilterCalendarCellClick(e){const t=this;t._openFilterCellDialog(e,(l=>{const i=l._filterInfo,a=i.editor.querySelector("input"),n=i.value;if(a)if(n){a.value=e.getFormattedValue(n,l.cellsFormat||"");const r=new Smart.FilterGroup;r.addFilter("and",r.createFilter(l.dataType,n,i.condition||"EQUAL")),t.addFilter(l.dataField,r)}else a.value="",t.removeFilter(l.dataField)}))}_handleFilterMenuClick(e,t){const l=this,i=e._filterInfo,a=i.editor,n=i.input;if(a.firstElementChild.innerHTML=`<i class="smart-grid-icon ${t.icon} show"></i>`,"CLEAR_FILTER"===t.value&&(n.value="",a.firstElementChild.innerHTML='<i class="smart-grid-icon smart-icon-search show"></i>',i.condition=null,i.value="",i.range=null),n.type="","RANGE"===i.condition&&"RANGE"!==t.value){let e=i.range;i.value=e.min}else if("RANGE"===t.value&&"RANGE"!==i.condition&&null!==i.condition){let e=i.range;i.value&&(e={min:i.value,max:i.value},i.range=e)}if("RANGE"!==t.value){if(n.readonly=!1,"CLEAR_FILTER"!==t.value&&(i.condition=t.value),""===n.value)l.removeFilter(e.dataField);else{const t=new Smart.FilterGroup,a=i.value;t.addFilter("and",t.createFilter(e.dataType,a,i.condition||"EQUAL")),l.addFilter(e.dataField,t),n.value=i.cell.getFormattedValue(a,e.cellsFormat)}setTimeout((()=>{n.focus()}),25)}else{n.readonly=!0;const a=new Smart.FilterGroup,r=i.range;if(r){a.addFilter("and",a.createFilter(e.dataType,r.min,"GREATER_THAN_OR_EQUAL")),a.addFilter("and",a.createFilter(e.dataType,r.max,"LESS_THAN_OR_EQUAL")),l.addFilter(e.dataField,a);const t=i.cell.getFormattedValue(r.min,e.cellsFormat),o=i.cell.getFormattedValue(r.max,e.cellsFormat);n.value=t+" - "+o}else n.value="";i.condition=t.value}}_handleFilterNumberCellEditor(e,t,l){const i=t.querySelector("input"),a=t.querySelector(".up"),n=t.querySelector(".down"),r=e.column,o=this;let s=t=>{const l=r._filterInfo;if("RANGE"===l.condition)return void i.focus();let a=parseFloat(l.value);if(isNaN(a))return l.value=0,void(i.value=0);(t<0?a>i.min||""===i.min:a<i.max||""===i.max)&&(i.value=a+t,l.value=i.value,i.focus(),o._handleFilterCellValue(e))};l&&(s=l);const d=(e,t)=>{let l,i;e.onpointerdown=function(e){s(t),l&&clearTimeout(l),l=setTimeout((()=>{i&&clearInterval(i),i=setInterval((()=>{s(t)}),50)}),300),e.preventDefault(),e.stopPropagation()},e.onpointerup=()=>{i&&clearInterval(i),l&&clearTimeout(l),i=null},e.onpointerenter=()=>{i&&(clearInterval(i),i=setInterval((()=>{s(1)}),50))},e.onpointerleave=()=>{clearInterval(i)},document.addEventListener("pointerup",(()=>{i&&clearInterval(i),i=null,l&&clearTimeout(l)}))};d(a,1),d(n,-1)}_openFilterCellDialog(e,t){const l=this,i=l._dialogFilter||l._createDialog(),a=l.localize("dialogFilterHeader")+" "+e.column.label,n=i.content;i.header.innerHTML=a,i.confirm=t;let r=null,o=0;l._cellEditors||(l._cellEditors=[]),l._dialogFilter||(i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogFilterButtonConfirm"),i.btnCancel.innerHTML=l.localize("dialogFilterButtonCancel"),i.onOpen=function(){i.focus();const e=l._dialogFilterCell,t=e.column._filterInfo.range,a=e.column._filterInfo.value;if("date"===e.column.dataType){const i=n.querySelector("smart-calendar");i.locale=l.locale,setTimeout((()=>{"RANGE"===e.column._filterInfo.condition&&t?(i.selectedDates=[new Date(t.min.getTime()),new Date(t.max.getTime())],i._selectMultipleDates(new Date(t.min.getTime()),new Date(t.max.getTime()))):a&&(i.selectedDates=[new Date(a.getTime())]),i.focus()}),100),i.focus()}else{const e=n.querySelectorAll("input");e[0].focus(),t&&(e[0].value=t.min,e[1].value=t.max)}},i.onClose=function(){},i.btnCancel.onclick=function(){i.close();const e=l._dialogFilterCell;e.column._filterInfo.range=null,e.column._filterInfo.value=null,i.confirm(e.column)},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){const e=l._dialogFilterCell;if(e.column._filterInfo.range=null,e.column._filterInfo.value=null,"date"===e.column.dataType){const t=n.querySelector("smart-calendar"),l=t.selectedDates;"range"===t.selectionMode?e.column._filterInfo.range={min:new Date(l[0].getTime()),max:new Date(l[l.length-1].getTime())}:e.column._filterInfo.value=new Date(l[0].getTime())}else{const t=n.querySelectorAll("input");let l=t[0].value,i=t[1].value;""===i&&(i=100),""===l&&(l=0),e.column._filterInfo.range={min:l,max:i}}i.confirm(e.column),i.close()},i.onkeydown=function(e){const t=e.key;"Enter"===t?i.btnConfirm.onclick():"Escape"===t&&i.close()}),n.classList.remove("smart-grid-layout"),n.innerHTML="";const s=()=>{const e=n.querySelectorAll("input");i.btnConfirm.disabled=!0,""===e[0].value&&(e[0].value=0),""===e[1].value&&(e[1].value=100),parseFloat(e[0].value)<=parseFloat(e[1].value)&&(i.btnConfirm.disabled=!1)};"date"!==e.column.dataType&&n.classList.add("smart-grid-layout");for(let t=0;t<2;t++){const i=e.column;if("date"===i.dataType){const e=document.createElement("div");"RANGE"===i._filterInfo.condition?e.innerHTML='<smart-calendar selection-mode="range"></smart-calendar>':e.innerHTML="<smart-calendar></smart-calendar>",n.appendChild(e);break}o%2==0&&(r=document.createElement("div"),r.classList.add("row"),n.appendChild(r));const a=document.createElement("div");a.classList.add("col-sm-6");const d=document.createElement("div");d.classList.add("column");const u=document.createElement("label");u.innerHTML=0===t?l.localize("dialogFilterMinLabel"):l.localize("dialogFilterMaxLabel");const c=document.createElement("div");c.classList.add("smart-grid-dialog-editor"),c.setAttribute("editor",i.dataField),c.setAttribute("template",i.editor.template),a.appendChild(d),r.appendChild(a),d.appendChild(u),d.appendChild(c),o++,c.innerHTML='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>';const f=c.querySelector("input");f.onchange=()=>{s()},l._handleFilterNumberCellEditor(e,c,(e=>{let t=parseFloat(f.value);isNaN(t)?f.value=0:((e<0?t>f.min||""===f.min:t<f.max||""===f.max)&&(f.value=t+e),s())}))}l._dialogFilter=i,l._dialogFilterCell=e;const d=e.column.element.getBoundingClientRect(),u=l.offset(l);let c=d.left+window.pageXOffset-u.left,f=d.bottom+l.layout.rowMinHeight+window.pageYOffset-u.top,m=Math.max(i.offsetWidth,314);c+m>u.left+l.offsetWidth&&(c=d.left+d.width+window.pageXOffset-u.left-m),e.column.filterRowMenu&&e.column.filterRowMenu.classList.contains("open")&&l._closeMenu(e.column.filterRowMenu),i.open(c,f)}});
56
56
  Smart.Utilities.Assign("Grid.Sort",class{clearSort(){const t=this;if(!t._isSorting&&t.dataSource){t._isSorting=!0,t.dataSource.clearSort(),t._sortedColumns||(t._sortedColumns=[]);for(let r=0;r<t._sortedColumns.length;r++){const o=t._sortedColumns[r],e=t.columnByDataField[o.dataField];e&&(e.setProperty("sortOrder",null),e.setProperty("sortIndex",null))}t._sortedColumns=[],t.rowById=[];for(let r=0;r<t.dataSource.length;r++){const o=t.rows[r],e=t.dataSource[r];o&&(o.data=e,e&&e.$&&(o.id=e.$.id,o._updateData()),t.rowById[o.id]=o)}t._recycle(),t._refreshHeaderBar(),t._isSorting=!1}}getSortedColumns(){const t=this,r=[];if(t._sortedColumns)for(let o=0;o<t._sortedColumns.length;o++){const e=t._sortedColumns[o];r[e.dataField]={sortOrder:e.sortOrder,sortIndex:e.sortIndex},r.length++}return r}addSort(t,r){this.sortBy(t,r)}removeSort(t){this.sortBy(t,null)}refreshSort(){this._refreshSort(this._sortedColumns)}_refreshSort(t){const r=this;if(r._isSorting||!t)return;if(r._suppressSort)return;if(!1===r.sorting.maintainSort)return;const o=[],e=[],s=[];r._isSorting=!0;let a=[];for(let n=0;n<t.length;n++){const d=t[n],i=r.columnByDataField[d.dataField];i&&(i.setProperty("sortOrder",d.sortOrder),i.sortComparator&&(a[i.dataField]=i.sortComparator),o.push(d.dataField),e.push(d.sortOrder),s.push(d.dataType||"string"))}!function(){if(r.dataSource&&(r.dataSource.sortComparators=a),r.dataSource&&r.dataSource.virtualDataSource)r._virtualDataRequest("sort");else{if(r.dataSource.sortBy(o,s,e),r.dataSource.boundHierarchy)r._refreshRowHierarchy(),r.dataSource.groupBy.length>0&&(r._refreshRowHierarchy(!0,!0),r.refresh());else{r.rowById=[];for(let t=0;t<r.dataSource.length;t++){const o=r.rows[t],e=r.dataSource[t];o.data=e,o.id=e.$.id,o._updateData(),r.rowById[o.id]=o}}r._recycle()}}(),r._refreshHeaderBar(),r._isSorting=!1,r._sortedColumns=t}sortBy(t,r){const o=this,e=o.columnByDataField[t],s=[],a=[],n=[],d=void 0===r;if(o._isSorting||!e)return;o._isSorting=!0,"descending"===r&&(r="desc"),void 0!==r&&"ascending"!==r||(r="asc");const i=function(t){t&&(t.setProperty("sortOrder",null),t.setProperty("sortIndex",null))},l=function(){if(o._sortedColumns.length>0)for(let t=0;t<o._sortedColumns.length;t++){const r=o._sortedColumns[t],e=o.columnByDataField[r.dataField];i(e)}o._sortedColumns=[]};if(null===e)return l(),void(o._isSorting=!1);if(!o.sorting.enabled||!o.dataSource||!e.allowSort||o._sortAnimation)return void(o._isSorting=!1);i(e),o._sortedColumns||(o._sortedColumns=[]);let u="string";const c=o.dataSource&&o.dataSource.dataFields?o.dataSource.dataFields:o.dataSourceSettings.dataFields;if(c)for(let r=0;r<c.length;r++){const o=c[r];if(o.name===t){u=o.dataType;break}}let m=!0;for(let s=0;s<o._sortedColumns.length;s++){const a=o._sortedColumns[s];if(a.dataField===t)if(m=!1,a.sortIndex=e.sortIndex,d){if("asc"===a.sortOrder)a.sortOrder="desc",r="desc";else if("desc"===a.sortOrder){o.sorting.sortToggleThreeStates?(o._sortedColumns.splice(s,1),i(e),r=null):(a.sortOrder="asc",r="asc");break}}else a.sortOrder=r,null===r&&(o._sortedColumns.splice(s,1),i(e))}m&&("one"===o.sorting.mode&&l(),"many"===o.sorting.mode&&!1===o._canSort&&l(),null!==r&&o._sortedColumns.push({dataField:t,sortOrder:r,sortIndex:e.sortIndex,dataType:u})),e.setProperty("sortOrder",r),o._sortedColumns.sort(((t,r)=>"string"==typeof t.sortIndex&&"string"==typeof r.sortIndex?0:"number"==typeof t.sortIndex&&"string"==typeof r.sortIndex?-1:"string"==typeof t.sortIndex&&"number"==typeof r.sortIndex?1:"number"==typeof t.sortIndex&&"number"==typeof r.sortIndex?t.sortIndex-r.sortIndex:void 0));const f=[];for(let t=0;t<o._sortedColumns.length;t++){const r=o._sortedColumns[t];s.push(r.dataField),a.push(r.sortOrder),n.push(r.dataType||"string");const e=o.columnByDataField[r.dataField];e.sortComparator&&(f[e.dataField]=e.sortComparator)}const _=function(){if(o.dataSource.sortComparators=f,o.dataSource&&o.dataSource.virtualDataSource)o._virtualDataRequest("sort");else{if(o.dataSource.sortBy(s,n,a),o.dataSource.boundHierarchy)o._refreshRowHierarchy(),o.dataSource.groupBy.length>0&&o._refreshRowHierarchy(!0,!0),o.refresh();else{o.rowById=[];for(let t=0;t<o.dataSource.length;t++){const r=o.rows[t],e=o.dataSource[t];r&&(r.data=e,e&&e.$&&(r.id=e.$.id,r._updateData()),o._filters&&o._filters.length>0&&(r.filtered=void 0===r.data.$.filtered||r.data.$.filtered),o.rowById[r.id]=r)}o._filters&&o._filters.length>0&&o.refresh()}o._recycle()}const t=[],r=[];for(let e=0;e<o._sortedColumns.length;e++){const s=o.columnByDataField[o._sortedColumns[e].dataField];s&&(s.setProperty("sortIndex",e),t.push(s),r.push(s.sortIndex),o._sortedColumns[e].sortIndex=e)}o._refreshHeaderBar(),o.$.fireEvent("sort",{sortDataFields:s,sortOrders:a,sortDataTypes:n,sortIndexes:r,columns:t,data:o._sortedColumns}),o._onSort&&o._onSort()};if(o.appearance.allowSortAnimation){let t=[],r=[];o.rows.canNotify=!1,o._sortAnimation=!0;const e=function(){for(let r=0;r<o._rowElements.length;r++){const e=o._rowElements[r];e.classList.remove("smart-grid-sort-animation"),o.removeTransformMoveStyle(e),e.offsetHeight>0&&t.push(e.offsetTop)}};e(),o._sortTimer=setTimeout((function(){e(),o._sortAnimation=!1,o.rows.canNotify=!0}),o.appearance.sortAnimationDuration),o._sortTimer2=setTimeout((function(){_()}),o.appearance.sortAnimationDuration/2);for(let e=0;e<t.length;e++){const s=o._rowElements[e];s.classList.remove("smart-grid-sort-animation"),o.removeTransformMoveStyle(s);let a=Math.floor(Math.random()*t.length-1+1);for(;r[a];)a=Math.floor(Math.random()*t.length-1+1);r[a]=!0,o.addTransformMoveStyle(s,"0ms",0,-s.offsetTop+t[a],0,.5),s.classList.add("smart-grid-sort-animation"),setTimeout((function(){o.addTransformMoveStyle(s,o.appearance.sortAnimationDuration+"ms",0,0,0,1)})),setTimeout((function(){s.classList.remove("smart-grid-sort-animation")}),o.appearance.sortAnimationDuration)}}else _();o._isSorting=!1}});
@@ -62,7 +62,7 @@ Smart.Utilities.Assign("Grid.Dialog",class{_createOverlay(){const e=document.cre
62
62
  Smart.Utilities.Assign("Grid.Export",class{exportData(t,e){const o=this,a=new Smart.Utilities.DataExporter({exportHeader:o.dataExport.header}),r=[];a.expandChar=o.dataExport.expandChar,a.collapseChar=o.dataExport.collapseChar,a.pageOrientation=o.dataExport.pageOrientation,a.style=o.dataExport.style,a.filterBy=o.dataExport.filterBy,a.groupBy=o.dataExport.groupBy;const n=o.columns.toArray().slice(0).filter((t=>!1!==t.allowExport));if(a.header={columns:n,columngroups:o.columnGroups.slice(0)},!o.dataExport.style){const e=window.getComputedStyle(o),n=window.getComputedStyle(o.columns.length>0&&o.columns[0].element?o.columns[0].element:o.$.columnHeader),l=window.getComputedStyle(o.$.columnHeader);if(0!==o.offsetWidth&&0!==o.offsetHeight){const i=t=>{const e=t.fontSize,o=t.borderRightColor,a=t.backgroundColor,r=t.color,n=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");function l(t){return(t=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+i(t[1])+i(t[2])+i(t[3]).toUpperCase():"#ffffff"}function i(t){return isNaN(t)?"00":n[(t-t%16)/16]+n[t%16]}return{borderColor:l(o),fontSize:e,fontFamily:"Helvetica",color:l(r),backgroundColor:l(a)}},d=i(e),s=i(n),c=i(l),p={height:o.$.columnHeader.offsetHeight+"px",border:"1px solid "+d.borderColor,fontFamily:c.fontFamily,fontSize:c.fontSize,color:c.color,backgroundColor:s.backgroundColor,fontWeight:"400"},f={border:"1px solid "+d.borderColor,fontFamily:d.fontFamily,fontSize:d.fontSize},u={height:o.rowMinHeight+"px"};for(let e=0;e<o.columns.length;e++){const a=o.columns[e];if(!a.allowExport)continue;if(!a.visible)continue;p[a.dataField]={textAlign:a.align,width:a.computedWidth+"px",format:a.cellsFormat||""};let n=a.cellsFormat||"";n||("date"===a.dataType?n="d":"dateTime"===a.dataType?n="D":"time"===a.dataType&&(n="t"));const l={textAlign:a.cellsAlign,format:n};if(f[a.dataField]=l,o.dataExport.view&&-1!==["html","jpeg","pdf","png"].indexOf(t)&&(a.template||a.formatFunction))for(let t=0;t<o.rows.length;t++){const e=o.rows[t];let n=o.rows[t]["column_"+a.dataField];if(o.dataExport.viewStart&&t<o.dataExport.viewStart||o.dataExport.viewEnd&&t>o.dataExport.viewEnd)continue;if(!n||e&&e.element&&e.element.classList.contains("smart-hidden")){const t=o._rowElements[0];if(!t)continue;if(e.element=t,e.grid=o,e.render(),n=e["column_"+a.dataField],!n)continue}const i={};i.border=n.borderColor,i.background=n.background,i.color=n.color;const d=void 0!==o.dataExport.viewStart?t-o.dataExport.viewStart:t;r[t]=Object.assign({},e.data),r[t][a.dataField]=n.element.textContent,l[d]=i}}o.appearance.alternationCount>0&&(u.alternationCount=o.appearance.alternationCount,u.alternationStart=o.appearance.alternationStart,u.alternationEnd=o.appearance.alternationEnd,u.alternationIndex0Color=d.color,u.alternationIndex0BackgroundColor=d.backgroundColor,u.alternationIndex1Color=d.color,u.alternationIndex1BackgroundColor="#F5F5F5"),a.style={border:"1px solid "+d.borderColor,borderCollapse:"collapse",header:p,columns:f,rows:u}}}const l=!o.rowHierarchy||o.grouping.enabled?o.rows.toArray():o.rowHierarchy,i=o.dataExport.rowIds,d=null!==i;let s=[];if(o.dataExport.view)o._recyclingRows.forEach(((t,e)=>{if(o.dataExport.viewStart&&e<o.dataExport.viewStart||o.dataExport.viewEnd&&e>o.dataExport.viewEnd)return!0;r[e]?s.push(r[e]):s.push(t.data)}));else{for(let e=0;e<l.length;e++){const a=l[e];if(a.visible&&(!1!==a.filtered||void 0===a.filtered)){if(d&&-1===i.indexOf(a.id))continue;const e={};for(let r=0;r<o.columns.length;r++){const n=o.columns[r];if(!n.allowExport)continue;const l=n.dataField;let i=a.data[l];if("taskChecklist"===l)if(i){const t=i.map((t=>{let e=t.text;return t.completed?e="✓ "+e:e+="X "+e,e}));i=t.toString()}else i="";if("taskUserId"===l){const t=o.users.find((t=>t.id===parseInt(i)||parseInt(t.id)===parseInt(i)));t&&(i=t.name)}if(void 0===i)if("createdBy"===n.template){const t=o.users.find((t=>t.id===a.createdBy));if(t){const o=t,a="string"==typeof o?o:o.name;e[l]=a}else e[l]=""}else if("createdTime"===n.template){const t=a.getCell(l).getFormattedValue(a.createdTime,"d")+" "+a.getCell(l).getFormattedValue(a.createdTime,"t");e[l]=t}else if("modifiedBy"===n.template){const t=o.users.find((t=>t.id===a.modifiedBy));if(t){const o=t,a="string"==typeof o?o:o.name;e[l]=a}else e[l]=""}else if("modifiedTime"===n.template){const t=a.getCell(l).getFormattedValue(a.modifiedTime,"d")+" "+a.getCell(l).getFormattedValue(a.modifiedTime,"t");e[l]=t}else e[l]="";else if(i&&i.indexOf&&(i.indexOf("{")>=0||"[]"===i)){const t=i.indexOf("{")>=0||"[]"===i?JSON.parse(i):i.split(", "),o=[];for(let e=0;e<t.length;e++)"string"==typeof t[e]?o.push(t[e]):o.push(t[e].label);e[l]=o.join(",")}else if("csv"===t||"tsv"===t)if(n.cellsFormat){const t=a.getCell(l).getFormattedValue(i,n.cellsFormat);e[l]=t}else e[l]=i;else e[l]=i}s.push(e)}}l!==o.rowHierarchy||d||(s=o.dataSource.boundHierarchy,a.hierarchical=!0)}!o.dataExport.groupBy&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy&&(a.groupBy=o.dataSource.groupBy&&o.dataSource.groupBy.toArray?o.dataSource.groupBy.toArray():null),o.checkLicense(!0);const c=a.exportData(s,t,o.dataExport.fileName,e);return o.dataExport.view&&o._recycle(!1),c}print(){const t=this,e=t.dataExport.fileName;t.dataExport.fileName=null;const o=t.exportData("html"),a=window.open("","","width=800,height=500"),r=a.document.open(),n='<!DOCTYPE html><html><head><meta charset="utf-8" /><title>'+e+"</title></head><body>"+o+"</body></html>";try{r.write(n),r.close(),setTimeout((function(){a.print(),a.close()}),100)}catch(t){}t.dataExport.fileName=e}});
63
63
  Smart.Utilities.Assign("Grid.Chart",class{_getChartDataFields(e){const t=this,i=e[0];let a,n=!0,o=[];for(let e in i)"$"!==e&&("string"===t.dataSource.dataFields.find((t=>t.name===e)).dataType?0===t.columns.findIndex((t=>t.dataField===e))&&(a=e):(n=!1,o.push({dataField:e,displayText:e})));return{xAxisDataField:a,series:o,stringOnly:n}}createChart(e,t){const i=this,a=i.getSelection(),n=a.rows,o=a.columns,s=a.cells,l=document.createElement("smart-chart"),r=[],d={};let c,h=[],g=[];if(s&&s.length>1&&s.forEach((e=>{-1===h.indexOf(e.row.index)&&h.push(e.row.index),-1===g.indexOf(e.dataField)&&g.push(e.dataField)})),t)r.concat(t);else for(let e=0;e<i.dataSource.length;e++){const t={};if(n){if(!n.find((t=>t.row.index===e)))continue}else{if(o){o.forEach((a=>{t[a.dataField]=i.dataSource[e][a.dataField]})),r.push(t);continue}if(s&&s.length>1){if(-1===h.indexOf(e))continue;g.forEach((a=>{t[a]=i.dataSource[e][a]})),r.push(t);continue}}i.columns.forEach((a=>t[a.dataField]=i.dataSource[e][a.dataField])),r.push(t)}const f=i._getChartDataFields(r);if(f.stringOnly){if(i.header.visible&&i.$.header.firstElementChild){const t=i.enableShadowDOM?i.shadowRoot.getElementById(e):i.querySelector("#"+e);i.$.header.firstElementChild.classList.add("warning"),t&&t.classList.add("warning"),setTimeout((function(){i.$.header.firstElementChild.classList.remove("warning"),t&&t.classList.remove("warning")}),1e3)}}else{if(c=f.series,l.caption="",l.description="",l.clip=!1,l.showLegend=!0,l.showBorderLine=!1,l.padding={left:5,top:10,right:5,bottom:5},l.dataSource=r,l.xAxis={dataField:f.xAxisDataField,gridLines:{visible:!0}},l.valueAxis={displayValueAxis:!0,description:i.charting.description,axisSize:"auto",formatSettings:i.charting.formatSettings},l.colorScheme=i.charting.colorScheme,l.seriesGroups=[d],d.formatSettings=i.charting.formatSettings,d.series=c,"line"===e)c.forEach((function(e){e.symbolSize=8,e.symbolType="square"}));else if("pie"===e){const e=c[0].dataField;delete d.formatSettings,d.formatFunction=function(e,t){return isNaN(e)&&"object"==typeof e?t:e},d.showLabels=!0,c.length=0,c.push({dataField:e,displayText:f.xAxisDataField,initialAngle:0})}else if("bar"===e)e="column",d.orientation="horizontal",l.xAxis.textRotationAngle=90,l.valueAxis.textRotationAngle=30,l.valueAxis.flip=!0;else if("area"===e){let e=1;for(let t=0;t<c.length;t++)c[t].opacity=e,e-=.2,e=Math.max(.3,e)}if(d.type=e,i.onChartInit&&i.onChartInit(l),i.charting.appendTo){const e="string"===i.charting.appendTo?document.querySelector(i.charting.appendTo):i.charting.appendTo;e&&e.appendChild(l)}else i._openChartDialog(l,e)}}_openChartDialog(e,t){const i=this;if(!i.charting.dialog.enabled)return!1;const a=i._dialogChart||i._createDialog(i.charting.dialog),n=t.substring(0,1).toUpperCase()+t.substring(1),o="{{message}}"===i.charting.dialog.header?i.localize("dialogChartHeader",{value:n}):i.charting.dialog.header;e.style.width="100%",e.style.height="100%",a.header.innerHTML=o,a.content.innerHTML="",a.content.style.width="100%",a.content.style.height="100%",a.btnCancel.classList.add("smart-hidden"),i._dialogChart||(a.modal=!0,a.onOpen=function(){i.charting.dialog.visible=!0},a.onClose=function(){i.charting.dialog.visible=!1},a.btnConfirm.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},i._dialogChart=a),a.open(),setTimeout((function(){a.btnConfirm.focus(),a.content.appendChild(e)}),100)}});
64
64
  Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewStatesButton" class="smart-data-view-header-button smart-data-view-states-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ViewStates"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customButton" class="smart-data-view-header-button smart-data-view-custom-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Custom"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden")})),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;(t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled")})(e.dataSource&&0===e.dataSource.length),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget);const a=t.grid.parentElement,s=a?a.scrollTop:0;t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight-s+"px";const o=()=>{if(e){const a=t.grid.offset(e);a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px"}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",o())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter");const s=this.columns.map((e=>{const t=Object.assign({},e),s=a.dataFields.find((e=>e.name===t.dataField));return s&&(t.dataType=s.dataType),t})).filter((e=>e.allowFilter));if(super.openFilterPanel(s,null),t._closeDownloadMenu(),t._closeViewsMenu(),t.grid.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const s=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{s[s.length-1].querySelector(".editor").focus()}),350)}}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort");const s=t.columns.map((e=>{const s=Object.assign({},e),o=t._appliedSorting.dataFields.indexOf(s.dataField),n=a.dataFields.find((e=>e.name===s.dataField));return n&&(s.dataType=n.dataType,s.sortIndex=o,-1!==o&&(s.sortDirection=t._appliedSorting.orderBy[o])),s})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=s.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(s),t._closeDownloadMenu(),t._closeViewsMenu();const o=t.grid;o.closeMenu();const n=t.$.headerDropDown.querySelector("smart-sort-panel");if(!n)return;n.grid=o,n.$.maintainSortContainer.classList.remove("smart-hidden"),o.sorting.maintainSort?n.$.maintainSortContainer.firstElementChild.setAttribute("active",""):n.$.maintainSortContainer.firstElementChild.removeAttribute("active"),n._changeApplyButtonText();const i=n.$.inputNotSorted,r=()=>{const e=n.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};n.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let s=e.columns.length,o=0,n=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(s--,i.push(r.dataField)),r.visible||(o++,n.push(r.dataField)),t.push(r)})),s<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===o||s===o&&i.toString()!==n.toString()?a.visible=!1:a.visible=!0}})));const s=e.$.customize,o=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let n;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel","group-panel","format-panel"),s.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)n=s.querySelector("smart-column-panel"),n.locale=e.locale,n.messages=e._innerElementMessages.columnPanel,n.set("dataSource",o),n.propertyChangedHandler("dataSource",void 0,o),n.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=o,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const s=e[t],o=s[0],n=s[1];a.grid.columnByDataField[o].filter=n}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document,a.grid.autoSaveState()}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document,e.grid.autoSaveState()}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")&&(t="customize"),t}_applyHandler(e){const t=this,a=e.target,s=e.detail,o=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&o.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();o.contains(a)?t._applyColumns(s.value,s.moves):t.$.filter.contains(a)?t.addFilter(s.filters,s.operator,s.value):t.$.sort.contains(a)&&t.addSort(s.sortByInfo),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;const s=t.grid.$.header;if(t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]),t._closeDownloadMenu(),t._closeViewsMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||a!==s&&s.contains(a))){const o=a.closest("smart-scroll-viewer"),n=a.closest(".smart-drop-down");if((!o||!s.contains(o.ownerElement))&&(!n||n.ownerElement&&!s.contains(n.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(o&&o.ownerElement){const e=o.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let s,o=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return s=a._kanban._getCustomizeColumnPanelDataSource(),s=JSON.parse(JSON.stringify(s)),t._refreshCustomizeButton(),void(t.columns=s)}s=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],s=s.filter((t=>!1!==t._visible&&!(("filter"===e||"sort"===e)&&("sort"===e&&!t.sortOrder||"filter"===e&&!t.filter)&&!1===t.visible))),s=s.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null}})),s=JSON.parse(JSON.stringify(s)),s.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;o.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;o.set(t,e),e.label=t})),t.columns=s,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.grid._openRowSettingsDialog=t._openRowSettingsDialog,t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),t._updateViews(),e.header.onInit&&e.header.onInit(t)}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t);const a=e.viewsMenu.querySelector(".label");a&&e.viewsMenu.removeChild(a)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),s=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const o=(e,a,s)=>{const o=document.createElement("smart-menu-item");let n="#D50000",i="smart-icon-table-alt";switch(a){case"grid":n="#3f51b5",i="smart-icon-table-alt","grid"===t.view&&s&&(o.setAttribute("focus",""),o.checked=!0),o.title=t.localize("gridView");break;case"kanban":n="#C40093",i="smart-icon-kanban","kanban"===t.view&&s&&(o.setAttribute("focus",""),o.checked=!0),o.title=t.localize("kanbanView")}return o.label='<span style="color: '+n+'" class="smart-grid-icon '+i+'"></span>'+e,o.value=a,o};s.appendChild(o(t.localize("viewGrid"),"grid",!0)),s.appendChild(o(t.localize("viewKanban"),"kanban",!0)),a.appendChild(s);const n=document.createElement("div");n.classList.add("label"),n.innerHTML=t.localize("layout"),e.viewsMenu.insertBefore(a,e.viewsMenu.children[e.viewsMenu.children.length-1]),e.viewsMenu.insertBefore(n,e.viewsMenu.children[e.viewsMenu.children.length-1]),e.viewsMenu.onpointerup=()=>!1,a.onItemClick=a=>{e._setView(a.detail.value),e._closeViewsMenu(),t.autoSaveState(),e._updateViews()}}_updateViews(){const e=this,t=e.grid;if(t.stateSettings.enabled&&t.appearance.showViewBar){if(!t.$.viewBar.querySelector(".smart-grid-view-chooser-container")){const a=document.createElement("div");a.classList.add("smart-grid-view-chooser-container");const s=document.createElement("div");s.classList.add("new-view");const o=(a,s)=>{a.stopPropagation(),a.preventDefault(),t.beginUpdate(),t.stateSettings.current||(t.stateSettings.current=t.$.viewBar._input.value),t.saveState(),t.stateSettings.current=t.$.viewBar._input.value,e._closeViewsMenu(),t.resetState(),"kanban"===s&&(delete t.columnByDataField.taskStatus,e._setView("kanban")),t.saveState(),t.endUpdate(),e._updateViews()},n=document.createElement("smart-button");n.classList.add("selected"),n.classList.add("view"),n.innerHTML='<span class="show smart-grid-icon smart-icon-table-alt"></span>'+t.localize("newGrid"),n.title=t.localize("gridView");const i=document.createElement("smart-button");i.innerHTML='<span class="show smart-grid-icon smart-icon-kanban"></span>'+t.localize("newKanban"),i.classList.add("view"),i.title=t.localize("kanbanView"),i.onpointerdown=()=>{i.classList.add("selected"),n.classList.remove("selected")},n.onpointerdown=()=>{n.classList.add("selected"),i.classList.remove("selected")};const r=document.createElement("div");r.classList.add("smart-grid-view-storage"),a.appendChild(r);const l=document.createElement("smart-input");l.classList.add("underlined"),l.placeholder=t.localize("viewNamePlaceholder"),l.hint=t.localize("viewNamePlaceholder"),l.onselectstart=e=>{e.stopPropagation()};const d=document.createElement("div");d.innerHTML='<span class="smart-grid-icon show smart-icon-settings"></span><span>'+t.localize("Settings")+"</span>",d.classList.add("view-label"),s.appendChild(d),s.appendChild(l);const c=document.createElement("div");c.innerHTML="<span>"+t.localize("layout")+"</span>",c.classList.add("view-label"),s.appendChild(l),s.appendChild(c);const u=document.createElement("div");s.appendChild(u),u.classList.add("footer"),u.appendChild(n),u.appendChild(i);const p=document.createElement("div");p.innerHTML='<span class="smart-grid-icon show smart-icon-plus"></span><span><a href="javascript:void();">'+t.localize("createView")+"</a></span>",p.classList.add("view-button"),p.onclick=e=>{const t=i.classList.contains("selected")?"kanban":"grid";o(e,t)};const m=()=>{t.stateSettings.storage&&!t.stateSettings.storage[l.value]||l.value&&!t.stateSettings.storage?p.classList.remove("disabled"):p.classList.add("disabled")};l.update=()=>m(),l.onkeyup=l.onchange=()=>{m()},m(),s.appendChild(p),a.appendChild(s),t.$.viewBar._storage=r,t.$.viewBar._input=l,t.$.viewBar.appendChild(a)}let a=t.stateSettings.storage;(a&&0===Object.keys(a).length||!a)&&(t.$.viewBar._input.value||(t.$.viewBar._input.value=t.localize("view")+" 1"),t.stateSettings.current||(t.stateSettings.current=t.$.viewBar._input.value),t.saveState(),t.stateSettings.current=t.$.viewBar._input.value,a=t.stateSettings.storage);const s=t.$.viewBar._storage;if(s.innerHTML="",a){let o=1;const n=document.createDocumentFragment(),i=e=>{delete t.stateSettings.storage[e.valueName],t.stateSettings.current===e.valueName&&(t.stateSettings.current=""),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],e.valueName,t.stateSettings.storage,t.stringify_object),e.remove()},r=a=>{const s=document.createElement("input");s.value=a.valueName;const o=()=>{if(s.value){if(t.stateSettings.storage[s.value])return;const o=t.stateSettings.storage[a.valueName];t.stateSettings.current===a.valueName&&(t.stateSettings.current=s.value),o.name=s.value,t.stateSettings.storage[o.name]=o,t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],o.name,t.stateSettings.storage,t.stringify_object),delete t.stateSettings.storage[a.valueName],e._updateViews()}};s.onselectstart=e=>{e.stopPropagation()},s.onpointerdown=s.onpointerup=e=>{e.stopPropagation()},s.onkeydown=e=>{e.stopPropagation()},s.onkeyup=e=>{"Escape"===e.key&&s.remove(),"Enter"===e.key&&o(),e.stopPropagation()},s.onchange=()=>{o()},s.style.width="100%",s.style.height="100%",s.style.position="absolute",s.style.left="0px",s.style.top="0px",s.style.zIndex=99,s.classList.add("smart-input"),s.classList.add("underlined"),a.querySelector(".smart-menu-item-label-element").appendChild(s),setTimeout((()=>{s.focus()}),50)},l=(e,a,s)=>{const o=document.createElement("smart-menu-item");let n="smart-icon-table-alt";switch(a){case"grid":n="smart-icon-table-alt";break;case"kanban":n="smart-icon-kanban"}return o.value=s,o.valueName=e,e===t.stateSettings.current?(o.checked=!0,o.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span>'):o.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',o.ondblclick=e=>{const t=e.target.closest("smart-menu-item");r(t)},o.onclick=e=>{if(e.target&&e.target.classList.contains("smart-icon-delete")){const t=e.target.closest("smart-menu-item");i(t),e.preventDefault(),e.stopPropagation()}else if(e.target&&e.target.classList.contains("smart-icon-mode-edit")){const t=e.target.closest("smart-menu-item");r(t),e.preventDefault(),e.stopPropagation()}else if("INPUT"===e.target.nodeName)return},o};for(let e in a){const t=a[e];o++,n.appendChild(l(e,t.view,t))}if(o){const a=document.createElement("smart-menu");a.style.width="100%",a.mode="vertical",a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.checkMode="radioButton",a.disableAutoCheck=!0,a.rightToLeft=t.rightToLeft,a.appendChild(n),a.onItemCheckChange=a=>{if(a.detail.checked){const s=a.detail.item;t.loadState(s.valueName),e._updateViews(),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],s.valueName,t.stateSettings.storage,t.stringify_object),setTimeout((()=>{t.querySelector(".smart-grid-views-menu").focus()}),50)}},a.onkeydown=e=>{const t=a.querySelector("smart-menu-item[checked]");t&&"F2"===e.key&&r(t)};const o=document.createElement("div");o.style.display="flex",o.style.marginTop="10px",o.innerHTML='<span class="smart-grid-icon show smart-icon-filter"></span><span>'+t.localize("noViews")+"</span>";const i=document.createElement("smart-input");i.classList.add("underlined"),i.prefix='<span class="smart-grid-icon smart-icon-search show"></span>',i.placeholder=t.localize("commandBarSearch"),i.value=t.$.viewBar.filterValue||"",i.onkeydown=e=>{e.stopPropagation()},i.onselectstart=e=>{e.stopPropagation()},i.onAffixClick=i.onkeyup=()=>{const e=a.querySelectorAll("smart-menu-item");let s=0;o.classList.add("smart-hidden"),a.classList.remove("smart-hidden"),t.$.viewBar.filterValue=i.value,e.forEach((e=>{i.value.length>0?e.valueName.toLowerCase().startsWith(i.value.toLowerCase())?e.classList.remove("smart-hidden"):(e.classList.add("smart-hidden"),s++):e.classList.remove("smart-hidden")})),s===[...e].length&&(o.classList.remove("smart-hidden"),a.classList.add("smart-hidden"))},i.value&&i.onAffixClick(),s.appendChild(i),s.appendChild(a),s.appendChild(o),o.classList.add("smart-hidden")}if(t.stateSettings.storage)for(;t.stateSettings.storage[t.localize("view")+" "+o];)o++;t.$.viewBar._input.value=t.localize("view")+" "+o,t.$.viewBar._input.update()}}}_setView(e,t){const a=this,s=a.grid;if(s.view!==e||!0===t){if("kanban"===e){const e=s.context;if(s.context=s,s.view="kanban",s.context=e,s._kanbanInitialized&&s.columnByDataField.taskStatus)if(s.columnByDataField.taskStatus&&s._stackedBy&&s.columnByDataField.taskStatus.dataField!==s._stackedBy){s.beginUpdate(),delete s.columnByDataField.taskStatus;const e=s.columnByDataField[s._stackedBy];s.columnByDataField.taskStatus=e,s._createKanban(e),s._refreshHeaderBar(),s.endUpdate(!1),s._showKanbanView(),a._refresh()}else s._showKanbanView(),a._refresh();else delete s._kanbanInitialized,s._initKanbanView("dynamic")}else"grid"===e&&(s.view="grid",s._hideKanbanView(),a._refresh());s.$.fireEvent("viewChanged",{view:e}),a._refresh()}}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),s=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const o=(e,t)=>{const a=document.createElement("smart-menu-item");let s="#D50000";switch(t){case"csv":s="#3f51b5";break;case"pdf":s="#f4511e";break;case"xlsx":s="#0b8043";break;case"json":s="#8e24aa"}const o='<span style="position: absolute; top: 0px; font-size: 10px; color: '+s+'">'+t+"</span>";return a.label='<span style="color: '+s+'" class="smart-grid-icon smart-icon-docs"></span>'+o+e,a.value=t,a};s.appendChild(o(t.localize("download")+" CSV","csv")),s.appendChild(o(t.localize("download")+" XLSX","xlsx")),s.appendChild(o(t.localize("download")+" JSON","json")),a.appendChild(s),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")&&e._closeViewsMenu()}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,s=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=s+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu","smart-grid-view-chooser"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,s=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=s+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0&&t.stateSettings.enabled?e.$.viewStatesButton.classList.remove("smart-hidden"):e.$.viewStatesButton.classList.add("smart-hidden"),e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},e.$.viewStatesButton.onpointerup=a=>{t.closeMenu(),e._closeDownloadMenu(),e._closeViewsMenu(),t.appearance.showViewBar=!t.appearance.showViewBar,"kanban"===t.view&&t._refreshContentHeight(),a.stopPropagation(),e._updateViews()},t._sortedColumns){const a=[],s=[],o=[];for(let e=0;e<t._sortedColumns.length;e++){const n=t._sortedColumns[e];a.push(n.dataField),s.push(n.sortOrder),o.push(n.dataType)}e._appliedSorting={dataFields:a,dataTypes:o,orderBy:s},e._refreshSortButton()}if("grid"===t.view){const a={filters:[],operator:"and"},s=t.getFilteredColumns();if(s)for(let e in s){const t=s[e];for(let s=0;s<t.filters.length;s++){const o=t.filters[s];a.filters.push([e,o.condition,o.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}else e.$.sortButton.classList.add("smart-hidden"),e.$.filterButton.classList.add("smart-hidden");e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshCustomButton(),e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e.refreshTools()}_refreshCustomButton(){const e=this,t=e.grid;t.header.customButton.visible?(e.$.customButton.style.paddingLeft="0px",e.$.customButton.classList.remove("smart-hidden")):e.$.customButton.classList.add("smart-hidden"),t.header.customButton.enabled?e.$.customButton.classList.remove("smart-disabled"):e.$.customButton.classList.add("smart-disabled"),e.$.customButton.innerHTML=`<span class="smart-grid-icon show ${t.header.customButton.icon}"></span><div class="smart-tool-label" role="presentation">${t.header.customButton.label}</div>`,e.$.customButton.onclick=()=>{t.header.customButton.command&&t.header.customButton.command()}}_refreshViewsButton(){const e=this;let t=e.grid.localize("viewGrid");switch(e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":e.$.viewsButton.classList.remove("kanban"),t=e.grid.localize("viewGrid")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>",e.$.viewStatesButton.innerHTML='<div class="smart-tool-label" role="presentation">'+this.grid.localize("views")+"</div>"}_refreshDownloadButton(){this.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation">'+this.grid.localize("download")+"</div>"}_openRowSettingsDialog(e){let t=this;t.getSelectedRows||(t=t.grid);const a=t.editing.dialog.enabled,s=t.editing.mode,o=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=e,t.beginEdit(e),t._endToolbarEdit?(t.removeEventListener("endEdit",t._endToolbarEdit,null),t.removeEventListener("cancelEdit",t._endToolbarEdit,null)):t._endToolbarEdit=()=>{t.context=t,t.editing.dialog.enabled=a,t.editing.mode=s,t.editing.isEditing=!1,t.context=o,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endToolbarEdit),t.addEventListener("cancelEdit",t._endToolbarEdit)}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.querySelector("smart-grid-toolbar").$.deleteButton;0!==t?(a.classList.remove("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.querySelector("smart-grid-toolbar")._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const s=t.grid;if("kanban"===s.view)return;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._refreshColumns("group"),s.closeMenu();const o=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(o.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=o,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=o,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,o=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const n=s.onRowInserted;if(s.onRowInserted=null,s.beginUpdate(),s.grouping.autoHideGroupColumn&&o)for(let e=0;e<o.length;e++){const t=s.columnByDataField[o[e]];t&&(t.visible=!0)}s.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];s.addGroup(t)}t._appliedGrouping.expandAll&&s.expandAllRows(),t._appliedGrouping.collapseAll&&s.collapseAllRows(),s.autoSaveState(),s.endUpdate();const i=[];for(let e=0;e<s.dataSource.groupBy.length;e++)i.push(s.dataSource.groupBy[e]);s.$.fireEvent("group",{groups:i}),s.paging.enabled&&s._refreshPagesCount(),s.onRowInserted=n}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(e.grid&&"kanban"===e.grid.view){e.$.groupButton.onclick=()=>{"kanban"===e.grid.view&&e.grid._initKanbanView("dynamic")};const t=e.grid.columnByDataField[e.grid._stackedBy];t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("groupedBy",{column:t.label}),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped")}else{if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search("",!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),t.closeMenu();const a=[],s=t.getVisibleRows();for(let e=0;e<s.length;e++)a.push(Object.assign(s[e].data));const o=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:o,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,void a.grid._recycle(!1);const s=a._searchInfo.source,o=[],n=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,s=a.createFilter("string",e,"CONTAINS");a.addFilter("or",s),o.push([t,a])})),s._filter(o,"or");for(let e=0;e<s.length;e++){const t=s[e];!1!==t.$.filtered&&(n.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=n,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,n.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:n.length}),a._searchInfo.highlighted=n[0],a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if("kanban"===t.view&&t._kanban)return e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const s=t.columns[e];s.autoGenerated||!1!==s._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(s.dataField)>=0||s.visible||a++)}a>0?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"))}_applyColumns(e,t){const a=this,s=a.grid;s.beginUpdate();let o=0,n=[],i=[],r=[];const l=s.onColumnChange;s.onColumnChange=null;for(let t in e){const a=e[t],l=s.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(n.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||o++)}s.onColumnChange=l,s.onColumnChange&&s.onColumnChange(n,"visible",i,r),o>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+s.localize("customizeHidden",{n:o})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+s.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],o=a.oldIndex,n=a.newIndex,i=s.columns[n+1],r=s.columns[n-1],l=s.columns[o];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),s.reorderColumns(o,n,!0)}if(s.filtering.enabled&&s.filtering.filterRow)for(let e=0;e<s.columns.length;e++)s.columns[e]._filterEditorInitialized=!1;s.endUpdate();const d=s.grouping.enabled;d&&s._filters&&s.refreshFilters(d),s.autoSaveState()}});
65
- Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showSelectionOnTop:{value:!1,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showTooltipsOverflow:{value:!0,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"},showViewBar:{value:!1,type:"boolean"}},type:"object"},behavior:{value:{allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"object"},fileName:{value:"smartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:150,type:"number"},height:{value:null,type:"number?"},dataSource:{value:{contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertLeft:{value:{command:{value:"insertLeftCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-left",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertRight:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-right",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},description:{value:"",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:400,type:"any"},width:{value:400,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban"],type:"string"},currentUser:{value:null,type:"any"},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the smartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",kanbanNone:"Blank",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsertLeft:"Insert left",columnMenuItemInsertRight:"Insert right",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Shift</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Record with Id: {{value}}",dialogEditHeader:"Edit Record with Id: {{value}}",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonCancel:"CANCEL",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple Select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"Collaborator",dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeAutoNumber:"Auto Number",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnNumberFormatSeparator:"Use 1000 Separator (,)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnListItems:"List items",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnCheckItems:"Show Checkbox",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",noComments:"No comments to this record yet",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Details",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'Changed {{column}} from "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed {{column}} to "{{newValue}}"',rowCreated:"Row Created",propertyUpdated:'"{{value}}" updated',propertyRemoved:'"{{value}}" removed',dropImages:"Drop images here",addImages:"Add images",dropFiles:"Drop files here",addFiles:"Add files",unassigned:"Unassigned",historyDate:"Date",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",groupedBy:"Grouped by {{column}}",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less Than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",formatColumn:"Format Column",formating:"Conditional Formatting",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"Create new view",newGrid:"Grid",newKanban:"Kanban",layout:"Layout",settings:"Settings",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:500,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!0,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},customButton:{value:{command:{value:null,type:"any",reflectToAttribute:!1},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},stateSettings:{value:{enabled:{value:!0,type:"boolean",reflectToAttribute:!1},current:{value:"",type:"string",reflectToAttribute:!1},storage:{value:null,type:"any",reflectToAttribute:!1},autoSave:{value:!1,type:"boolean",reflectToAttribute:!1},autoLoad:{value:!1,type:"boolean",reflectToAttribute:!1},allowLocalStorage:{value:!0,type:"boolean",reflectToAttribute:!1},options:{value:[],type:"array",reflectToAttribute:!1},onStateChange:{value:null,type:"any",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["smart.menu.css","smart.filterpanel.css","smart.pager.css","smart.grid.css","smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' role='grid'>\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler"}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,a=window.pageYOffset,l=e.getBoundingClientRect();if(e!==document.body){let l=e.parentNode;for(;l!==document.body&&l;){l&&(o+=l.scrollLeft,a+=l.scrollTop);let e=l;l?(l=l.parentNode,t.enableShadowDOM&&l===t.shadowRoot?l=t:!t.isInShadowDOM||l!==t.getRootNode()&&e!==t.getRootNode()||(l=t.getRootNode().host)):t.isInShadowDOM&&(l=t.getRootNode().host)}}return{bottom:l.bottom+a,height:l.height,left:l.left+o,right:l.right+o,top:l.top+a,width:l.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);super._upHandler(),t._tapTimer&&clearTimeout(t._tapTimer);const a=()=>{t.editing.isEditing&&!t.editing.dialog.enabled&&setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),a=document.getElementById(t);if(a&&a.contains(e.originalEvent.target))return}if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.endEdit()}}),50)};if(!e.originalEvent||(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&a(),!e.originalEvent.target.closest(".smart-grid-dialog"))){if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,l=e.originalEvent.target;for(;l;)if(l=l.parentNode,l===t){o=!0;break}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),a(),t.menu){let o,a,l,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],a=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),l=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,a=t.contains(o),l=t.menu.contains(o),n=t.menu),!a&&!l){const e=n.querySelectorAll("smart-drop-down-list"),a=n.querySelectorAll("smart-date-time-picker"),l=n.querySelectorAll("smart-date-input"),i=n.querySelectorAll("smart-input");for(let t=0;t<e.length;t++)if(e[t].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.dropDownContainer.contains(o))return;for(let e=0;e<l.length;e++)if(l[e].$.scrollView.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;return void t.closeMenu()}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const a=t.viewColumns[o];if(a.visibleIndex===e.visibleIndex+1)return a}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],a=o.column;a&&a.autoShowActionButton&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],a=o.element;o&&o.autoShowActionButton&&a._hideActionButton()}}}_columnMouseLeaveHandler(){this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;const o=(o,a)=>{if(o&&o.autoShowActionButton){const l=a.getBoundingClientRect(),n=t.offset(a),i=t.parentElement,r=i?i.scrollTop:0;if(n.left<=e.pageX&&n.left+l.width-6>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+l.height>=e.pageY){if(!t.hasColumnMenu(o))return;a._showActionButton()}else a._hideActionButton();else a._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const a=t._columnElements[e];o(a.column,a)}for(let e=0;e<t._frozenNearColumns.length;e++){const a=t._frozenNearColumns[e];o(a,a.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let a=null,l=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){a=t.getAttribute("data-field"),l=t;break}}if(a){const o=l.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(a),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(a),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let a=null,l=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){a=t.getAttribute("data-field"),l=t;break}}if(a){const o=l.column;if(!o)return;if("_commandColumn"===a)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(l){const n=o.selectionColumn?t.selection.checkBoxes.action===l&&t.selection.enabled:t.selection.action===l&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=a,"_checkBoxColumn"===a)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===a&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField}),i("doubleClick"),t._onColumnDoubleClick(o,e)),t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,a,l,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+a+"px,"+l+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,a=e.clientY;e.touches&&(o=e.touches[0].clientX,a=e.touches[0].clientY);const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,a);let n=null,i=null,r=null,s=null;t._lastPointerDownTime=new Date;for(let e=0;e<l.length;e++){const t=l[e];if(t.hasAttribute("toggle-button")&&(i=t),t.hasAttribute("checkbox")&&(r=t),s||"smart-grid-cell"!==t.nodeName.toLowerCase()||(s=t),!n&&"smart-grid-row"===t.nodeName.toLowerCase()){n=t;break}}if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn){const e=n.row;e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else{const o=n.row,a=s?s.cell:null;if(a.column._treeColumn&&r)return void(o.checked=!o.checked);a.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:a,id:o.id,dataField:a.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const l=function(l){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return;o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===a.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===l){if(e.shiftKey||e.ctrlKey||!t.selection.allowRowHeaderSelection&&a.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=a.column.dataField,a.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,a.column.dataField,e),r()}else a.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===l&&(t._setSelection(o.id,a.column.dataField,e),r())},i=a.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,u=e.originalEvent?e.originalEvent:e,c=3===u.which;if(c||"_commandColumn"===a.column.dataField||l("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),t.$.fireEvent("cellClick",{cell:a,id:o.id,dataField:a.column.dataField,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),c&&t.contextMenu.enabled)return t.contextMenu.id=o.id,t.contextMenu.dataField=a.column.dataField,t._focusCell(o.id,a.column.dataField),t.openContextMenu(u.pageX+10,u.pageY+10),void(t.contextMenu.selector&&(u.stopPropagation(),u.preventDefault()));if(o.autoGenerated||a.column.autoGenerated||"checkBox"===a.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(a,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===a.selected&&!t.selection.isDragging){const l=t._selection.focusedCell;l&&t._clickedCell&&l.id===a.row.id&&l.dataField===a.column.dataField&&l.id===t._clickedCell.cell.row.id&&l.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(a,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(a,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===a.selected&&!t.selection.isDragging){const l=t._selection.focusedCell;t._clickedCell&&l.id===a.row.id&&l.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(a,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(a,e));else t._onRowClick(o.index,o,e),t._onCellClick(a,e);else t._onRowClick(o.index,o,e),t._onCellClick(a,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),l("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(a,e),t.$.fireEvent("cellDoubleClick",{cell:a,id:o.id,dataField:a.column.dataField,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():a.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const a=this;if(a.notifyFn)for(let l=0;l<a.notifyFn.length;l++)a.notifyFn[l](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}propertyChangedHandler(e,t,o){const a=this;if(a.isInitialized){switch(a._notify(e,t,o),e){case"onRowHistory":case"onRowInserted":return;case"view":return void(a.$.headerBar&&a.$.headerBar._setView&&a.$.headerBar._setView(o));case"users":case"currentUser":a._refreshCurrentUser(),a._recycle();break;case"summaryRow_visible":{for(let e=0;e<a.columns.length;e++)a._summaryRowCount=Math.max(a._summaryRowCount,a.columns[e].summary.length);const e=a.onRowInserted;a.onRowInserted=null,a._renderRows(!0),a.onRowInserted=e;break}case"conditionalFormatting":return a._renderConditionalFormatting(),void a.refresh();case"appearance_displayLoadingIndicator":return void a._setLoadingIndicatorVisibility();case"appearance_placeholder":return void(a.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void a._recycle();case"appearance_allowColumnStickyPosition":o?a._stickHeader():a._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<a.columns.length;e++)a.columns[e].setProperty("showIcon",a.appearance.showColumnIcon);a._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{a._initializeRowNumberColumn();const e=a._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&a.$.columnNearContainer.appendChild(e.element),a.refresh();break}case"header_visible":a.header.visible&&""===a.header.template&&(a.$.header.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',a.$.headerBar=a.$.header.firstElementChild,a.$.headerBar._init(a),a.header.onInit&&a.header.onInit(a.$.headerBar));break;case"header_buttons":a.header.visible&&""===a.header.template&&a._refreshHeaderBar();break;case"header_template":a._applyTemplate(o,a.$.header);break;case"footer_template":a._applyTemplate(o,a.$.footer);break;case"layout_columnWidth":case"columnWidth":{a.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<a.columns.length;t++)a.columns[t].width=e;a.columns.canNotify=!0,a.refresh();break}case"checkBoxes_visible":return void a._recycle();case"checkBoxes_hasThreeStates":return a.rows.canNotify=!1,a._applyThreeStates(a.rowHierarchy),a.rows.canNotify=!0,void a._recycle();case"columnHeader_visible":a.__columnHeaderHeight=null,a.refresh();break;case"selection_checkBoxes_enabled":a._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":a._selectionColumn.element&&(o?a._selectionColumn.element.setAttribute("auto-show",""):a._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=a.viewColumns.indexOf(a._selectionColumn);a.viewColumns.canNotify=!1,a.viewColumns.splice(e,1);const t=a._frozenNearColumns.indexOf(a._selectionColumn),l=a._frozenFarColumns.indexOf(a._selectionColumn);if(t>=0&&a._frozenNearColumns.splice(t,1),l>=0&&a._frozenFarColumns.splice(l,1),"far"===o)a._selectionColumn.canNotify=!1,a._selectionColumn.freeze="far",a._selectionColumn.canNotify=!0,a._frozenFarColumns.splice(0,0,a._selectionColumn),a.viewColumns.push(a._selectionColumn),a.$.columnFarContainer.appendChild(a._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<a.viewColumns.length&&(a.viewColumns[o].autoGenerated||a.viewColumns[o].dataField!==a.columns[t++].dataField);o++)a.viewColumns[o].autoGenerated&&e++;a._selectionColumn.canNotify=!1,a._selectionColumn.freeze="near",a._selectionColumn.canNotify=!0,a._frozenNearColumns.splice(e,0,a._selectionColumn),a.viewColumns.splice(e,0,a._selectionColumn),a.$.columnNearContainer.appendChild(a._selectionColumn.element)}a.viewColumns.canNotify=!0;break}case"selection_mode":if(a._selection&&(a._selection.focusedCell=null),a.selection.allowCellSelection)a.clearSelection();else if("one"===o){const e=a.getSelection();if(a.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=a.rowById[e.rows[0].row.id].getCell(a.columns[0].dataField);a._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index}}}break;case"grouping_groupBy":return a.dataSource&&a.dataSource.groupBy&&(a.dataSource.groupBy=o),void a.refresh();case"sorting_enabled":return void a.refresh();case"sorting_maintainSort":return void a._recycle(!1);case"filtering_enabled":return o&&0===a._filterPanels.length&&a._createFilterPanels(),void(a.header.visible&&a.refresh());case"filtering_filterRow_visible":return a._initializeRows(),a._initializeRowElements(),void a.refresh();case"filtering_operator":return void a.refreshFilters();case"filtering_filter":for(let e=0;e<a.columns.length;e++){const t=a.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<a.filtering.filter.length;e++){const t=a.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let l=null;if(o instanceof Smart.FilterGroup)l=o;else{const t=a.columnByDataField[e];t&&(l=a.dataSource._createFilter(t.dataType,o))}l&&a.addFilter(e,l,!1)}}return void a.refreshFilters();case"messages":case"locale":{if(a.columns)for(let e=0;e<a.columns.length;e++)a.columns[e]._cellsCachedValues=[];a._dialogEdit&&(a._dialogEdit.close(),a._dialogEdit=null),a._dialogDelete&&(a._dialogDelete.close(),a._dialogDelete=null),a._dialogAddRow&&(a._dialogAddRow.close(),a._dialogAddRow=null);const e=a.$.headerPager.querySelector("smart-pager"),t=a.$.footerPager.querySelector("smart-pager");e&&(e.locale=a.locale),t&&(t.locale=a.locale);const o=(e,t)=>{a._handleFilterMenuClick(e,t)};a._filterInfo||(a._filterInfo={}),a._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:a.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:a.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:a.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:a.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:a.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:a.localize("CLEAR_FILTER")}],a._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:a.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:a.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:a.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:a.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:a.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:a.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:a.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:a.localize("CLEAR_FILTER")}],a._refreshHeaderBar(),a.$.headerBar&&(a.$.headerBar.messages=a.messages,a.$.headerBar.locale=a.locale,a.$.headerBar._localizeHeader(),a.$.headerBar._getInnerElementMessages()),a._recycle();break}case"paging_spinner_enabled":a._refresh();break;case"pager_visible":return a._renderPagers(),void a._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void a._refreshPaging(!0);case"paging_pageSize":return void a._refreshPaging(!1);case"columns":{a.__measuredColumnHeight=null,a.editing&&a.editing.isEditing&&a.cancelEdit(),a._cellEditors=[];let e=!1;if(t&&t.length)for(let o=0;o<t.length;o++)if(t[o].freeze){e=!0;break}if(a.columns&&a.columns.length)for(let t=0;t<a.columns.length;t++)if(a.columns[t].freeze){e=!0;break}if(e&&a._initializeRowElements(),a.columns&&a._sortedColumns){const e=[];a.columns.forEach((t=>{t.sortOrder&&e.push(t)})),a._sortedColumns=JSON.parse(JSON.stringify(e))}if(a._renderColumns(),a._refreshHeaderBar(),a.columns&&a.filtering.enabled){a.beginUpdate();for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(t.canNotify=!1,a.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:a.dataSource._createFilter(t.dataType||"string",o),e&&a.addFilter(t.dataField,e,!1)}}a.refreshFilters(),a.endUpdate()}return a.layout.isDirty=!0,a._resetCachedLayout(),void a._refreshLayout()}case"columnGroups":if(a._columnGroups=[],a._columnHeights=0,a.viewColumns)for(let e=0;e<a.viewColumns.length;e++){const t=a.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return a.columns.canNotify=!1,a.columns=a._initColumns,a._renderColumns(),a.columns.canNotify=!0,a.__columnHeaderHeight=null,void a.refresh();case"dataSource":if(delete a._isFirstVirtualDataSourceRequest,"dataSource"===e&&t&&o){const e=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&"infinite"!==a.scrolling;if(t instanceof Smart.DataAdapter&&!e&&t.length===o.length&&t.length>0&&o.length>0&&!a.dataSourceSettings.parentDataField&&!t.parentDataField){if(a.dataSource=t,a._cachedDataSource===o)return;return setTimeout((()=>{let e=null;if(t&&a.dataSource&&a.dataSource._expandedRowIds){let t={};for(let e in a.dataSource._expandedRowIds){let o=""+e;o=o.replace("Item","").replace(/_/gi,"."),t[o]=!0}e=t}if(a.beginUpdate(),a._sortedColumns&&a._sortedColumns.length>0&&void 0===a._getId())for(let e=0;e<o.length;e++){const t=a.dataSource[e],l=o[e];a._updateRow(t,l,!0)}else for(let e=0;e<o.length;e++){const t=o[e],l=a.dataSource[e].$.id;a._updateRow(l,t,!0)}delete a.__autoRowHeight,a._virtualOnExpandCache=[],a._cellsMerge=[],a._cellStyles=[];const l=a._filters,n=a._sortedColumns;if(a.clearSort(),a.filtering.filterRow)for(let e=0;e<a.columns.length;e++)a.columns[e]._filterEditorInitialized=!1;for(let e=0;e<a.columns.length;e++)delete a.columns[e]._cellsCachedValues;if(n&&a._refreshSort(n),l&&l.length>0&&(a._filters=null,a.refreshFilters()),a.grouping.enabled)for(let t in e)a._expandCollapseGroup(t,!0);a.endUpdate()})),a._cachedDataSource=o,void(a.header.visible&&""===a.header.template&&a.$.headerBar._init(a))}}return a.dataBind(),void(a.header.visible&&""===a.header.template&&a.$.headerBar._init(a));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{a.beginUpdate(),a.rows.canNotify=!1;const e=a.appearance.allowRowDetailToggleAnimation;a.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<a._recyclingRows.length;e++){const t=a._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=a.rowDetail.height}if(a.rows.canNotify=!0,a.rowDetail.enabled){let t=!1;for(let e=0;e<a.viewColumns.length;e++)if(a.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return a.appearance.allowRowDetailToggleAnimation=e,a.endUpdate(),void a._renderColumns(!0)}else for(let e=0;e<a.viewColumns.length;e++){const t=a.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return a.appearance.allowRowDetailToggleAnimation=e,void a.endUpdate()}case"rowDetail_visible":for(let e=0;e<a.viewColumns.length;e++){const t=a.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void a._setLoadingIndicatorVisibility();case"filterable":return void a._refreshLayout();case"layout_allowCellsWrap":{const e=a.columns.canNotify;a.columns.canNotify=!1;for(let e=0;e<a.columns.length;e++)a.columns[e].cellsWrap=o;return a.layout.isDirty=!0,a._resetCachedLayout(),a._refreshLayout(),a.refresh(),void(a.columns.canNotify=e)}case"showViewBar":return a.layout.isDirty=!0,a._resetCachedLayout(),a._refreshLayout(),void a.refresh();case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return a.layout.isDirty=!0,a._resetCachedLayout(),a._refreshLayout(),void a.refresh();case"rightToLeft":return void a.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":a._addNewColumn?(a._addNewColumn.visible=o,a.refresh()):a._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===a.editing.addNewRow.displayMode&&a.editing.addNewRow._addButton&&(a.editing.addNewRow._addButton.remove(),delete a.editing.addNewRow._addButton);const e=a._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),a._renderAddNewRow(),void a.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===a.editing.addNewRow.visible&&"button"===a.editing.addNewRow.displayMode&&(a.editing.addNewRow._addButton&&a.editing.addNewRow._addButton.remove(),a._newRow&&a._newRow.element.classList.add("smart-hidden")),a._renderAddNewRow(),void a.refresh();case"editing_enabled":o?a.removeAttribute("aria-readonly"):a.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":a._renderCommandBar();break;case"editing_commandColumn_position":a._renderColumns(!0);break;case"editing_commandColumn_visible":return void a.refresh(!0);case"editing_commandColumn_inline":return a._commandColumn.visible=a.editing.commandColumn.visible&&!a.editing.commandColumn.inline,void a.refresh(!0);case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete a.__cellsCommandTemplate,void a.refresh(!0)}a.refresh()}}ready(){super.ready();const e=this,t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];e.filtering.enabled&&0===e._filterPanels.length&&requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel");o.filterType="boolean",a.filterType="numeric",l.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=l,e._filterPanels.numeric=a,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),a=o.createElement();e.$.scrollView.appendChild(a),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const l={};for(let t=0;t<e.dataSource.dataFields.length;t++)l[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=l,o._isMeasureRow=!0,o.render(),a.style.height="",a.style.lineHeight="",t=Math.max(a.offsetHeight,t);for(let e=0;e<a.children.length;e++)a.children[e].style.height="";for(let l=0;l<a.children[1].children.length;l++){if(a.children[1].children[l].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+a.children[1].children[l].offsetHeight);break}return e.$.scrollView.removeChild(a),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this;let t=e._recyclingRows,o=0,a=e._autoRowHeight,l=0,n=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===t.length||0===e.columns.length||!e.hasVisibleColumn())return 0;e.rows.canNotify=!1;const i=e._measureRowElement(t[0].data),r=t.length;for(let s=0;s<r;s++){let r=t[s];if(!r.visible||!1===r.filtered){r.height=0,r.cellHeight=0,r.top=o;continue}const d=e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled;if((!r.height||!r.cellHeight||d||"auto"===r.height||"auto"===r._height||"auto"===e.layout.rowHeight||e.layout.isDirty)&&!r.expandHeight){if(r.detailHeight||(r.detailHeight=200),e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.height=e.layout.rowHeight,r.computedHeight&&(r.height=r.computedHeight),r.minHeight>r.height&&(r.height=r.minHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.element=i,r.grid=e,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):a,o=r.canNotify;r.canNotify=!1,r.height=t,r.computedHeight&&(r.height=r.computedHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight),r.canNotify=o}else e.layout.rowHeight(s,r),r.height||(r.height=a),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}else{if("auto"===r.height||"auto"===r._height){r.element=i,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):a;r.height=t,r._height="auto"}else r.height=a;void 0===r.label||r.summaryRow||"advanced"!==e.grouping.renderMode||(r.height=e.grouping.groupRowHeight),r.computedHeight&&(r.height=r.computedHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}e._rowGap&&s<e.rows.length-1&&(r.height+=e._rowGap)}!0===r.freeze||"near"===r.freeze?r.visible&&(l+=r.height):"far"===r.freeze&&r.visible&&(n+=r.height),r.freeze&&r.visible?r.top=o:(r.top!==o&&(r.top=o),r.expandHeight?o+=r.cellHeight:o+=r.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(o+=1*a),e.editing.addNewRow&&"button"===e.editing.addNewRow.displayMode&&(o+=1*a),e.filtering&&e.filtering.filterRow.visible&&(l+=a),e.editing.addNewRow&&"button"!==e.editing.addNewRow.displayMode&&e.rowHierarchy&&e.editing.addNewRow.visible&&(o+=a,"far"!==e.editing.addNewRow.position&&(l+=a)),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(o=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return e.__scrollHeight=o,e.__frozenNearHeight=l,e.__frozenFarHeight=n,e._scrollView.scrollHeight=o-e.$.scrollView.offsetHeight+l+n,o=e.__scrollHeight+l+n-1,e.grouping.enabled&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(o+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=o,i.remove(),t[0]&&delete t[0]._isMeasureRow,e.rows.canNotify=!0,o}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let a=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(a=e._columnHeights[0]),a<e.layout.columnMinHeight&&(a=e.layout.columnMinHeight),e.__measuredColumnHeight=a,a}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const a=function(e){for(let t=0;t<o.length;t++){let a=o[t];if(a.name===e)return a}return null},l=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let a=l(e.groups[o]);for(let e=0;e<a.length;e++)t.push(a[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=a(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=a(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const a=e.viewColumns[o];let l=a;for(a.level=0;l.parent;)l=l.parent,a.level++;l=a;let n=a.level;for(t=Math.max(t,a.level);l.parent;)l=l.parent,l&&(l.level=--n)}for(let t=0;t<o.length;t++){const a=o[t],n=l(a);a.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,a.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?a.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o}_refreshColumnHeights(){const e=this;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let a=e._viewColumnsHeight;e.layout.columnHeight&&(a="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),a<e.layout.columnMinHeight&&(a=e.layout.columnMinHeight),a?(e._columnHeights.push(a),t+=a):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let a=0;a<t.level;a++)o+=e._columnHeights[a];return o},a=function(t){let a=o(t),l=e._columnHeaderHeight-a;for(let o=t.level+1;o<e._columnHeights.length;o++){const a=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===a){let o=n;for(;o.parent;){if(o.parent===t){l=e._columnHeights[a],i=!0;break}o=o.parent}if(i)break}}}return l};for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t],n=a(l);l.computedHeight=n,l.top=o(l)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let l=0;l<e._columnGroups.length;l++){const n=e._columnGroups[l];if(n.level!==t)continue;if(n.groups){const e=a(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let a=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,l=0;e.selection.checkBoxes.enabled&&(l=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-a;let i=0,r=[],s=0,d=0,u=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),a=e.editing.commandColumn.dataSource;let l=0,n="",i=0;o.classList.add("smart-label");for(let t in a){const o=a[t];let l=!1;if("commandColumnMenu"===t)continue;let r=!1;l||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),l=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),l=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?l=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?l+=25*i:l+=10*i,l};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let a;"number"==typeof o.width?a=o.width:o.width&&o.width.toString().indexOf("%")>=0?(a=parseFloat(o.width)/100,a*=n-l):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(a=parseFloat(o.width),a*=16):"auto"===o.width?a=o._autoSize():o.visible&&(r.push(o),a=0),o.overflowWidth&&(a-=o.overflowWidth),o.visible&&(i+=a),a<o.minWidth&&(a=o.minWidth),o.computedWidth=a}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const a=r[o];let l;l=e/r.length,o===r.length-1&&(l=e-t),a.overflowWidth&&(l-=a.overflowWidth),l<a.minWidth&&(l=a.minWidth),a.computedWidth=l,t+=l}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(a>0&&!o.autoGenerated&&(o.computedWidth+=a,a=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,u+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=u,u+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const a=e._columnGroups[o];if(a.level!==t)continue;let l=99999;if(a.groups){const e=function(t){let o=0;for(let a=0;a<t.groups.length;a++){let n=t.groups[a];n.groups?o+=e(n):n.visible&&(l=Math.min(n.left,l),o+=n.computedWidth)}return o};a.computedWidth=e(a),a.left=l}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let a=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];if(l.freeze)continue;const n=l.createElement();void 0!==l.computedWidth?(a+=l.computedWidth,e._columnElements.push(n),a<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const a=e._columnGroups[t],l=new Smart.Grid.Column({visible:void 0===a.visible||a.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:a.name,label:a.label,labelTemplate:a.labelTemplate,align:a.align,verticalAlign:a.verticalAlign,showIcon:!1});a.column=l;const n=l.createElement();n.style.width=a.computedWidth+"px",e.rightToLeft?n.style.right=a.right+"px":n.style.left=a.left+"px",n.style.top=a.top+"px",n.style.height=a.computedHeight+"px",n.style.lineHeight=a.computedHeight+"px",o.appendChild(n),a.element=n,a.grid=this,n.onpointerdown=t=>{if(e.selection.allowColumnHeaderSelection){const t=function(e){let o=new Array;if(e.columnGroup&&o.push(e),e.groups)for(let a=0;a<e.groups.length;a++)if(e.groups[a].columnGroup)o.push(e.groups[a]);else if(e.groups[a].groups){let l=t(e.groups[a]);for(let e=0;e<l.length;e++)o.push(l[e])}return o},o=t(a);e._selectColumnsRange(o[0].dataField,o[o.length-1].dataField)}}}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),a=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-l,height:e.$.container.offsetHeight-a-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const a=e.offsetHeight;e.$.container.classList.add("smart-hidden");const l=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&a===l||(o=e._scrollHeight);const n=function(){const a=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let l=0;l<e.rows.length;l++){const n=e.rows[l];if(n.freeze&&n.visible)continue;const i=n.createElement();if(a.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(a);const l=e.$.rowContainer.children;for(let t=0;t<l.length;t++){const o=l[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const a=o.createElement();o.element=a,e.$.rowNearContainer.appendChild(a)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const a=o.createElement();o.element=a,e.$.rowFarContainer.appendChild(a)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;t.summaryRow.visible&&(t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{!0!==t.editing.isEditing&&(t._calculateSummary(),!1!==e&&t._recycle(!1,!0,!1))}),100))}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[];let o=new Date;const a=function(){let t=[],o=!1;for(let a=0;a<e.columns.length;a++){const l=e.columns[a];let n={};l.summary&&l.summary.length>0&&(o=!0,n[l.dataField]=l.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const a=e.getSelectedRowIds();if(a.length>=1){const o=[];for(let t=0;t<a.length;t++){const l=e.dataSource.dataItemById[a[t]];l&&o.push(l)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),a=[],l=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===a.indexOf(r)&&a.push(r),-1===l.indexOf(n[1])&&l.push(n[1])}e._summaryItems=e.dataSource.summarize(t,a);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===l.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const l=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],n=function(a,n,i){let r=null;if(e.isInitialized&&(o=new Date),r=a?a.grid?a:new Smart.Grid.Row({data:a,index:n,grid:e,createdBy:e.currentUser,createdDate:o}):new Smart.Grid.Row({data:{},index:n,grid:e,createdBy:e.currentUser,createdDate:o}),l)for(let e=0;e<l.length;e++){const t=l[e],o=t.getCellValue(r.id,t.dataField,a);void 0!==o&&(r.data[t.dataField]=o)}if(e.rowById[r.id]&&(r.id=e.rows.length,e.rowById[r.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};r.id=e()}if(e.onRowInit){e.onRowInit(n,r,e),30!==r.height&&(r.cellHeight=r.height);for(let t in r)-1!==r.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}))}if(r.selected&&(e._selection.rows[r.id]=!0,e._selection.indexes[r.index]=r.index),r.freeze&&r.visible){if(!0===r.freeze||"near"===r.freeze){e.rows.splice(t++,0,r);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}else if("far"===r.freeze){e.rows.push(r);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&e._frozenFarRows.push(t)}}else e.rows[n]?e.rows.splice(n,0,r):e.rows.push(r),r.data&&r.data.$&&(r.data.$.history=r.history,r.data.$.starred=r.starred,r.data.$.comments=r.comments,r.data.$.style=r.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n],o=o=>{const a=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[a.id]){const t=e.dataSource.dataItemById[a.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};a.id=o(),a.data&&a.data.$?a.data.$.id=a.id:a.data.id=a.id,e._getId()&&(a.data[e._getId()]=a.id),t&&(e.dataSource.dataItemById[a.id]=a.data)}e.rowById[a.id]=a}else{const t=e.dataSource.dataItemById[a.id];a.id=o,a.data&&a.data.$?a.data.$.id=a.id:a.data.id=a.id;const l=e._getId();l&&(a.data[e._getId()]=a.id),t&&(t[l]=o,e.dataSource.dataItemById[a.id]=t,a.data=t),e.rowById[a.id]=a}-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._setAddUndoRedo(a),!e.editing.isEditing&&e.isInitialized&&e._recycle(!1,!0),e._onRowInserted&&e._onRowInserted(a),i&&i(a)};if(void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:n});const a=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([n],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let a=0;a<e._rowInsert.length;a++)t.push(e._rowInsert[a].index),o.push(e._rowInsert[a].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let a=0;a<o.length;a++){const l=o[a],n=t?t[a]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[l.id];l.id=l.data.id=n;const o=e._getId();o&&(l.data[e._getId()]=l.id),e.rowById[l.id]=l,t&&(t[o]=n,e.dataSource.dataItemById[l.id]=t,l.data=t)}e._setAddUndoRedo(l),-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._onRowInserted&&e._onRowInserted(l),i&&i(l)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),a)}else e.onRowInserted([n],[t],o,e)}else{const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n];void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),i&&i(t)}},i=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},r=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=n,e._removeLastRow=i,e._removeAt=r,e._rowHeight=e._autoRowHeight;const s=e.dataSource.length;if(e.setAttribute("aria-rowcount",s),e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];n(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];n(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(a(),e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let l=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)n(o[t],e.dataSource.length-o.length+t);else n(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],a=[],i=[];for(let r=0;r<i.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=i[r],o.push(s),a.push(e.rows[s]),i.push(e.rows[s].data)):(n(i[r],i[r].$.index),l=!0)}e.onRowUpdated&&e.onRowUpdated(o,a,i,e)}else{const a=t.index;e.rows[a]?e.rows[a].data=o:n(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([a],[e.rows[a]],[e.rows[a].data],e)}break;case"insert":n(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":r(t.index);break;case"removeLast":i();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==s){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize)),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize))}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),e.onLoad())}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?e._frozenNearRows.push(o):"far"===o.freeze&&e._frozenFarRows.push(o),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(a=t.target,l=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==l&&"showDetail"!==l||(a.propertyChanged(l,n,i),e.onRowChange&&a.properties.indexOf(l)>=0&&e.onRowChange(a,l,n,i,e))),void(e.rows.canNotify=!0);var a,l,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let a=e.rows[o];if(a instanceof Smart.Grid.Row==0){a=new Smart.Grid.Row(a);const l=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=a,a=t.object[o],e.rows.canNotify=l}if(a.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],a=e.rows[t];o&&(a.data=o,a.id=o.$.id),e.rowById[a.id]=a}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const a=e.columns[o];t.push({name:a.dataField,dataType:a.dataType||"string"}),a.displayField!==a.dataField&&t.push({name:a.displayField,dataType:a.dataType||"string"})}e.dataSource.dataFields=t}o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]&&(a.data=e.dataSource[o],void 0!==e.dataSource[o].$.id&&(a.id=e.dataSource[o].$.id,e.rowById[a.id]=a),a.data.$&&a.history&&(a.data.$.history=a.history)),-1!==a.index&&void 0!==a.index||(a.index=o),a.selected&&(e._selection.rows[a.id]=!0,e._selection.indexes[a.index]=a.index),a.freeze&&(!0===a.freeze||"near"===a.freeze?e._frozenNearRows.push(a):"far"===a.freeze&&e._frozenFarRows.push(a))})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],a=e.rows.indexOf(o);e.dataSource.update(a,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],a=e.rows[t];a.data=o,a.id=o.$.id,e.rowById[a.id]=a}return e.rows.canNotify=!0,void e.refresh()}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||e._render()})),e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),void super.render();const o=e.context;e.context=e,e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&e.header.buttons.indexOf("views")>=0&&e._updateKanbanTaskFields()),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const a=e.columns[o];t.push({name:a.dataField,dataType:a.dataType||"string"}),a.displayField!==a.dataField&&t.push({name:a.displayField,dataType:a.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale,e.$.header.appendChild(t),e.$.headerBar=e.$.header.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{let t=!1;if(e.stateSettings.autoLoad){let o=e.stateSettings.current;!o&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="View 1",o=e.stateSettings.current);let a=null;e.stateSettings.storage&&(a=e.stateSettings.storage[o]),a&&(t=!0),!a&&e.stateSettings.allowLocalStorage&&(a=window.localStorage.getItem(o),a&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const a=e.viewColumns[o];a.allowSort&&a.sortOrder&&t.push(a)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const a=e.sorting.sort[o],l=Object.keys(a)[0],n=a[l],i=e.columnByDataField[l];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const a=t[o],l=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(a.dataField,a.sortOrder),e.appearance.allowSortAnimation=l}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],a=e.filtering.filter[1];let l=null;o&&(l=e.dataSource._createFilter(o.dataType,a)),l&&e.addFilter(t,l,!1);break}const t=o[0],a=o.splice(1);let l=null;if(a instanceof Smart.FilterGroup)l=a;else{const o=e.columnByDataField[t];o&&(l=e.dataSource._createFilter(o.dataType,a))}l&&e.addFilter(t,l,!1)}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,a=o.filter;t=a instanceof Smart.FilterGroup?a:e.dataSource._createFilter(o.dataType,a),t&&e.addFilter(o.dataField,t,!1)}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="smartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view&&e._initKanbanView()}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,a=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=a,a}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(){const e=this,t=e.conditionalFormatting;if(!t||0===t.length)return;if(!e._defaults){const t=getComputedStyle(e);e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)}}e._formatter||(e._formatter=new Smart.Utilities.ConditionalFormatter(e.dataSource));const o=e._defaults,a=e._formatter,l=[],n=function(t){if("all"===t){if(e.columns&&e.columns.map){const t=[];for(let o=0;o<e.columns.length;o++){const a=e.columns[o];a.dataField.startsWith("task")||a.autoGenerated||"number"!==a.dataType&&"date"!==a.dataType||t.push(a.dataField)}return t}return[]}return[t]};for(let e=0;e<t.length;e++){t[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:o.fontFamily,fontSize:o.fontSize,text:o.text,highlight:o.highlight},t[e]);const i=t[e],r=n(i.column),s=i.condition;a.color=i.highlight,a.comparator=i.firstValue,a.min=i.firstValue,a.max=i.secondValue;const d=a.format(s,r);for(let e in d){const t=d[e];for(let e in t){const o=t[e];o.color=i.text,o.fontFamily=i.fontFamily,o.fontSize=i.fontSize}}l.push(d)}if(e._formattingPanel&&(e._formattingPanel.items=t),0===l.length)return l[0];const i={};for(let e=0;e<l.length;e++){const t=l[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){i[e]||(i[e]={});for(let t in o)i[e][t]=Object.assign({},i[e][t],o[t])}}}e._conditionalFormatting=i}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const a=parseInt(e.clientTop+o);e.$.columnHeader.style.top=a+"px";let l=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(l=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+l>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+a+l+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let a=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(a=e.layout.autoGenerateColumnWidth),t.width=a,t.createElement();const l=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,l),e._frozenNearColumns.splice(0,0,l)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let a="",l=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+l);l++;const s=a+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=a+r),t.push({align:"center",label:i,dataField:s,width:100}),l>=26&&(l=0,a+="A")}e._boundColumns=t}else{const t=e=>{const t=new WeakSet;return JSON.stringify(e,((e,o)=>{if(null!==o&&"object"==typeof o){if(t.has(o))return;t.add(o)}return o}))};e._boundColumns=Array.isArray(e.columns)?JSON.parse(t([...e.columns])):[...e.columns.toArray()];for(let t=0;t<e.columns.length;t++){const o=e.columns[t];e._boundColumns[t].formatFunction=o.formatFunction,e._boundColumns[t].getFilterPanel=o.getFilterPanel,e._boundColumns[t].getCellValue=o.getCellValue,e._boundColumns[t].updateFilterPanel=o.updateFilterPanel,e._boundColumns[t].children=o.children,e._boundColumns[t].onAction=o.onAction,e._boundColumns[t].menuItems=o.menuItems,e._boundColumns[t].sortComparator=o.sortComparator,e._boundColumns[t].groups=o.groups,e._boundColumns[t].labelTemplate=o.labelTemplate,e._boundColumns[t].template=o.template}}e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),a=o&&o.dataType||"string";t.dataType||(t.dataType=a)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],a=e._boundColumns.length,l={index:a,visibleIndex:a,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(l)}else for(let a in t){if(a.startsWith("_")||"$"===a)continue;const t=e._boundColumns.length,l={index:t,visibleIndex:t,label:a,dataField:a};o(l),e._boundColumns.push(l)}}for(let a=0;a<e._boundColumns.length;a++){let l=e._boundColumns[a];if("string"==typeof l){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===l)return e}));l={label:l,dataField:l,dataType:t&&t.dataType||"string"}}}else o(l);l.visibleIndex=a,l.index=a,l.grid=e,l.label&&/<.+?>/.test(l.label)&&l.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?l.label=l.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(l.label=window.Smart.Utilities.Core.escapeHTML(l.label)));const n=new Smart.Grid.Column(l);e.onColumnInit&&e.onColumnInit(a,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));n.grid=e,e.columns.push(n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(a,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let a=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),a++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),l=new Smart.Observable(o,o.observables);"near"===e.rowDetail.position?(o.freeze="near",l.freeze="near",e.viewColumns.splice(a,0,l),e._frozenNearColumns.splice(a,0,l)):(e.viewColumns.push(l),e._frozenFarColumns.splice(0,0,l)),a++}const l=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30}),n=new Smart.Observable(l,l.observables);n.canNotify=!1,e.viewColumns.push(n),e._frozenFarColumns.splice(0,0,n);const i=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),r=new Smart.Observable(i,i.observables);r.canNotify=!1,"near"===e.editing.commandColumn.position?(i.freeze="near",r.freeze="near",e.viewColumns.splice(a,0,r),e._frozenNearColumns.splice(a,0,r)):(e.viewColumns.push(r),e._frozenFarColumns.splice(0,0,r)),e._commandColumn=r;const s=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),d=new Smart.Observable(s,s.observables);if("near"===s.freeze?(e.viewColumns.splice(a,0,d),e._frozenNearColumns.splice(a,0,d)):(e.viewColumns.push(d),e._frozenFarColumns.splice(0,0,d)),e._selectionColumn=d,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let a=[];const l=document.createElement("div");l.style.display="grid",l.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)l.innerHTML+="<div></div>";l.style.width=e.clientWidth-t+"px",e.$.root.appendChild(l);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)a[t]=l.children[t].offsetWidth,"auto"===n[t]&&(a[t]=null);l.parentNode.removeChild(l);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||a[i]&&(o.width=o.templateWidth=a[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],a=[];for(let a=0;a<e.length;a++){const l=e[a];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===l.dataField){n=!1;break}n&&o.push(l)}const l=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===l.indexOf(o.dataField)&&a.push(o)}a.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],a=o.element;o.top=0,o.level=0,a&&(a.style.top="",a.style.height="",a.style.lineHeight="")}t._renderColumns(),t.__columnHeaderHeight=null,t.refresh()}onAttached(){const e=this;e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.isRendered&&e.isCompleted&&e._render()}onDetached(){const e=this;if(!e.isRendered)return;["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.querySelector("smart-grid-toolbar");if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,a=e._scrollView.vScrollBar;if(a.ownerElement=null,o.ownerElement=null,a.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let l=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];l=l.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=l,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}_observeColumns(){const e=this,t=function(t,o,a,l){a===l&&"selected"!==o||(t.propertyChanged(o,a,l),e.onColumnChange&&t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,a,l))};for(let o=0;o<e.viewColumns.length;o++){const a=e.viewColumns[o];a.rowHeaderColumn||(a.onAction=function(){e._openMenu(this)}),a.autoGenerated&&a.notify((function(e){a.canNotify=!1,t(a,e.propertyName,e.oldValue,e.newValue),a.canNotify=!0}))}e.columns.notify((function(o){let a=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let l=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(a=o.object[t],a instanceof Smart.Grid.Column==0){a=new Smart.Grid.Column(a);const l=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=a,a=o.object[t],e.columns.canNotify=l}a.grid=e,a.onAction=function(){e._openMenu(this)},a.freeze?e._frozenNearColumns.push(a):"far"===a.freeze&&e._frozenFarColumns.push(a);let l=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,a):e.viewColumns.splice(l,0,a),e.columnByDataField[a.dataField]){e.columnByDataField[a.dataField].children.push(a),a.parent=e.columnByDataField[a.dataField],a.valueField=a.dataField;const t=a.dataField+"_"+a.parent.children.length;e.columnByDataField[t]=a,a.dataField=t}else e.columnByDataField[a.dataField]=a;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===a.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:a.dataField,dataType:a.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=a.getState();o.dataField=a.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":a=o.object[o.index],a instanceof Smart.Grid.Column==0&&(a=new Smart.Grid.Column(a)),a.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&l++;e.viewColumns[l+o.index]=a,e.columnByDataField[a.dataField]=a,e.onColumnUpdated&&e.onColumnUpdated(o.index,a);break;case"remove":{a=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(a);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&l++;e.viewColumns.splice(l+t,1)}else e.viewColumns.splice(n,1);if(a&&(a.filter&&e.removeFilter(a.dataField),a.sortOrder&&e.removeSort(a.dataField),e.removeGroup(a.dataField),delete e.columnByDataField[a.dataField]),e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,a),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],a=o.element;o.top=0,o.level=0,a&&(a.style.top="",a.style.height="",a.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const a=e.viewColumns[o];a.visible&&(t+=a.computedWidth)}return t=parseInt(t),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,requestAnimationFrame((()=>{if(e.filtering.enabled&&e.filtering.filterRow.visible)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(t._isUpdating)return;if(t.editing.isEditing)return;const o=t.querySelector("smart-grid-toolbar");if(!o||!o.$.headerDropDown.classList.contains("open"))if(t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&!t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&e.deltaX){const o=t.scrollLeft;if(0===o&&e.deltaX<0||o===t.scrollWidth&&e.deltaX>0)return;e.stopPropagation(),e.preventDefault();let a=3*t.layout.rowMinHeight;e.deltaX<=0&&(a=-3*t.layout.rowMinHeight),Math.abs(e.deltaX)>=100?t._scrollView.scrollLeft+=a:t._scrollView.scrollLeft+=e.deltaX}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=3*t.layout.rowMinHeight;e.deltaY<=0&&(a=-3*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100?t._scrollView.scrollTop+=a:t._scrollView.scrollTop+=e.deltaY}}_refresh(){const e=this;if(e._isUpdating)return;const t=e.$.verticalScrollBar.offsetWidth;e.removeAttribute("grouped"),e.removeAttribute("tree");let o=!0;e.__autoHeightRows&&(e.__autoHeightRows=null,e._refreshColumnsResponsiveVisibility(),e._recycle(),o=!1),e._groups||(e._groups=[]),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>=0&&("advanced"===e.grouping.renderMode?e.setAttribute("grouped",""):e.setAttribute("tree",""),e._groups||(e._groups=[].concat(e.dataSource.groupBy.toArray())||[]),e._renderGroupBar()),e.grouping.enabled&&e.dataSource.groupBy&&0===e.dataSource.groupBy.length?e.$.breadcrumb&&(e.$.breadcrumb.dataSource=[]):e.dataSource.boundHierarchy&&(e.setAttribute("tree",""),e.setAttribute("role","treegrid")),(e.isInitialized||o)&&e._refreshColumnsResponsiveVisibility(),e._refreshLayout(),t!==e.$.verticalScrollBar.offsetWidth&&(e.__scrollWidth=null,e._refreshColumnsResponsiveVisibility(),e._refreshScrollBars(),0===e.$.verticalScrollBar.offsetWidth&&e.isRendered&&requestAnimationFrame((()=>{e._refreshScrollBars()}))),e._refreshSelection(),e._recycle(),e._refreshHeaderBar(),e._recyclingRows&&0===e._recyclingRows.length&&(e.$.placeholder.classList.remove("smart-hidden"),e.scrollHeight=0,e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${e.localize("filteredRecords")}`)),requestAnimationFrame((()=>{e._width=e.offsetWidth,e._height=e.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return;t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,a=e.$.columnFarContainer;let l=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,u=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(l+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(u+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=l+"px",a.style.width=n+"px",a.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&a.classList.add("smart-hidden"),0===l&&o.classList.add("smart-hidden"),a.classList.remove("border-collapse"),n===u&&a.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=u,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=l,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1)}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let a=0,l=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(l=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,a){for(let u=0;u<t.length;u++){const c=t[u];let m=o.rowById[c.$.id];if(n&&(m=o.rows[s],m||(m=r(c),o.rows.push(m)),c[i.leaf]?m.id=c.$.id:m.id="Group_"+c.$.id,o.rowById[m.id]=m),m||(m=r(c),o.rowById[m.id]=m),m.data=c,m.leaf=c[i.leaf]||!1,m.level=c[i.level],m.groupDataField=c.groupDataField,!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=c.label,m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),c.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),c.parent?(m.parent=o.rowById[c.parent.$.id],m.parentId=c.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(c);e&&(m.expanded=c[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==c[i.expanded]&&(m.expanded=c[i.expanded]);let g=!!e||m.expanded;l&&(g=!0);const p=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(p&&!m.data[p]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];c.parent&&c.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[p])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,g||c[i.leaf])if(a.push(m),c.children&&c.children.length>0){const e=d(c.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)a.push(e[t]);m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(a.push(m),c.children&&c.children.length>0){const e=d(c.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return a};let u=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let a=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const l=e[o];(!l.$||void 0===l.$.filtered||l.$.filtered)&&(a.push(l),l.children&&(a=a.concat(t(l.children))))}return a};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<u.length;o++){let a=u[o],l=!a.$||void 0===a.$.filtered||a.$.filtered;!l&&null!==l||0!==a.level||a.parent||(t(a.children).length,e.push(a))}u=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}o.rowHierarchy=d(u,new Array);let c=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],l=t.canNotify;t.leaf&&c.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=a++:t.visibleIndex=-1:t.visibleIndex=a++,t.canNotify=l}if(l&&(o.rowHierarchy=c),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow&&o._initializeRowElements(),o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,a,l){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:a.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+l+"_"+a.data.$.id,a&&(e.parent=a.data,e.parentId=a.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let a,l,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(a=e.offsetHeight,e.$.container.classList.add("smart-hidden"),l=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||a!==l||e._minHeight&&e._minHeight===a)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.header.visible?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,e.appearance.showViewBar){const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px",e.$.viewBar.style.width=o+"px";let a=0;e.header.visible&&(a+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(a+=e.$.groupHeader.offsetHeight),e.pager.visible&&(a+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=a+"px",e.$.viewBar.style.height=t+"px"}else e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft=""}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let a=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=a+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,a=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,l=e.$.scrollView.offsetWidth,n=e._scrollWidth-l-e._contentBorder.left,i=e._scrollHeight-a-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),u=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=u,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=a+"px",e.computedVerticalScrollBarVisibility?(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-l-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden"),e.$.scrollView.classList.add("has-vscroll")):e.$.scrollView.classList.remove("has-vscroll"),o.style.width=l+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=l-t.offsetWidth+"px",t.style.height=a-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),a=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-a+"px",t.style.top=a+"px",t.style.setProperty("--smart-scroll-bar-near-size",a+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),a=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-a+"px",t.style.setProperty("--smart-scroll-bar-far-size",a+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||u>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-u+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",u+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",u+e.__scrollBarSize+"px"))),t.refresh(),o.refresh()}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let a=0,l=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((a+l)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?a=n+1:i.top>e?l=n-1:a=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(a=>{let l=0,n=a.length-1;if(e<=0)return 0;const i=(a.length-1)*t;if(-1!==i&&i<=e)return a.length-1;for(;;){const a=Math.floor((l+n)/2),i=a*t;if(o(i,e))return a;i<e?l=a+1:i>e?n=a-1:l=a+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getColumns(){const e=this,t=[];if(!e.isInitialized)return t;if(e.columns)for(let o=0;o<e.columns.length;o++){const a=e.columns[o].getState();t.push(a)}return t}resetState(){const e=this;e._isUpdating=0,e.beginUpdate(),e.clearSort(),e.clearFilter(),e.clearGroups(),e.clearSelection(),e.columns.canNotify=!1;let t=[],o=!1;for(let a=0;a<e.columns.length;a++){const l=e.columns[a];l.visible=!0,l.width=180,l.freeze=!1,l.index>=0?t[l.index]=l:t.push(l),l.index!==a&&(o=!0)}o&&(e.columns=t),"grid"!==e.view&&(e.view="grid",e._hideKanbanView()),e.columns.canNotify=!0,e._scrollView.scrollLeft=e._scrollView.scrollTop=0,e.paging.enabled&&(e.paging.pageIndex=0),e.$.headerBar&&e.$.headerBar._setView&&e.$.headerBar._setView("grid"),e.endUpdate(),o&&(e._renderColumns(),e._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;if(t.stateSettings.loading=!0,e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const a=[];if(e.groups){t.dataSource.groupBy=e.groups,t._refreshRowHierarchy();for(let o in e.expandedRows)a["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}t.dataSource&&(t.dataSource._expandedRowIds=a)}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());for(let o=0;o<e.columns.length;o++){const a=e.columns[o];if(a.dataField){const e=t.columnByDataField[a.dataField];e&&(a.width?e.width=a.width:e.width=180,e.freeze=void 0!==a.freeze&&a.freeze,e.visible=void 0===a.visible||a.visible)}}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const a=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let l=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=l;for(let o in e.sort)if(e.sort[o]){const a=e.sort[o].sortOrder,l=t.columnByDataField[o];t.sortBy(l.dataField,a)}t.appearance.allowSortAnimation=a}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){const a=e.filter[o];a&&t.addFilter(o,a,!1)}}o&&(t.endUpdate(!1,!1),t._refresh());let a=!1;e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(a=!0),t._stackedBy=e.kanban.stackedBy),(a||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&t.$.headerBar._setView(e.view,!0),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.name&&(t.stateSettings.current=e.name),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let a=o.getCurrentState(),l=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",a&&l)for(let e in l)a[l[e]]=n[l[e]];else a=n;function r(e,t=0,o=10){if(t>o)return"Object";const a={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let l in e){let n=e[l];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){a[l]=n;continue}if(n&&Array.isArray(n)&&0===n.length){a[l]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==l&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}a[l]=n}return t?a:JSON.stringify(a)}a.name=i,o.stringify_object=r;const s=r(a);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]=a,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)&&o.stateSettings.onStateChange(a,i,o.stateSettings.storage,r),a}autoSaveState(){const e=this;e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,a=!e||e&&e.includes("filter")?t.getFilteredColumns():null,l=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells():null,i=!e||e&&e.includes("selection")?t.getSelectedRows():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null;let s=0;r&&(s=r.pagesCount);const d={sort:o,filter:a,groups:l,paging:{count:s,index:t.paging.pageIndex,size:t._pageSize},selectedCells:n,selectedRows:i};t.header.visible&&t.header.buttons.indexOf("views")>=0&&(d.kanban=t.getKanbanState(),d.view=t.view);const u=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];u.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}d.columns=u}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}d.expandedRows=e}if(e){const t={};for(let o in e){const a=e[o];d[a]&&(t[a]=d[a])}return t}return d}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,t,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,a=e.top+e.height,l=o<=t&&a>t;return 0!==e.height&&l}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),0===o.columns.length&&o.column.element.classList.add("smart-hidden"),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const a=t.viewColumns[o];if(a.visible)return a===e}return!1}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let o in e._cachedTemplates)t.appendChild(e._cachedTemplates[o]);e._tableCachedTemplates.appendChild(t)}}_recycle(e,t,o){const a=this;if(a._layoutSuspended||!1===a.isAttached)return;if(a._isUpdating)return;if(a.editing.isEditing&&(a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect();const l=a._scrollView.scrollTop;let n,i=a._getRowIndexByPosition(l),r=a._recyclingRows,s=r[i],d=s?s.top:0,u=0,c=0,m=0,g=0;if(a._cellRowSpan&&a._cellRowSpan.maxSpan>0){let e=0;if(i>=5?e=5:i>=4?e=4:i>=3?e=3:i>=2?e=2:i>=1&&(e=1),e>0){const t=r[i-e];t&&(s=t,d=s?s.top:0,m=e*s.height,i-=e)}}a._cellRowSpan=[];for(let e=0;e<a._cellsMerge.length;e++){const t=a._cellsMerge[e],o=r.indexOf(t.row);if(i>o&&i<=o+t.rowSpan&&(i=o,s=t.row,m=Math.max(m,d-s.top),d=s.top,a.$.rowContainer.style.top=a.__frozenNearHeight-l+d+"px"),t.colSpan>1)for(let e=0;e<a.viewColumns.length;e++){const o=a.viewColumns[e];let l=o.autoGenerated?o:a.columnByDataField[o.dataField];if(l.visible&&l.left+l.computedWidth-a._scrollView.scrollLeft>=u&&l.left-l.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){let e=a.columnByDataField[t.column.dataField];g=Math.max(g,l.left-e.left+l.computedWidth);break}}}a.isHScrolling&&a._clearCachedTemplates();let p=null;if(!1!==e||a._cellsMerge.length>0){for(let e=0;e<a._columnElements.length;e++){const t=a._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<a._columnGroups.length;e++){const t=a._columnGroups[e],o=t.element;o&&(a.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px")}a._firstVisibleColumn=null,a._lastVisibleColumn=null;for(let e=0;e<a.viewColumns.length;e++){let t=a.viewColumns[e];if(t.visible&&(a._firstVisibleColumn||(a._firstVisibleColumn=t),a._lastVisibleColumn=t),t.element&&(t===a._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-a._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){const o=a._columnElements[c++];o&&(o.set("column",t,!1),o.parentNode||a.$.columnContainer.appendChild(o),p||(p=t,a._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===n&&(n=t.left))}}}if(void 0===n&&(n=0),a.rightToLeft){const e=a._scrollView.scrollWidth-a._scrollView.scrollLeft-a._scrollView.vScrollBar.offsetWidth;a.$.columnContainer.style.right=e+"px",e<=0&&!a._scrollView.scrollWidth&&(a.$.columnContainer.style.right=-a.offsetWidth+a._computedColumnsWidth+"px")}else a.$.columnContainer.style.left=-a._scrollView.scrollLeft+"px";if(a.$.rowContainer.style.top=a.__frozenNearHeight-l+d+"px",a.isScrolling&&!a.isHScrolling&&(a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!a._rowElements)return;const h=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&a.dataSource.length>a.virtualModeCachedRowsCount&&"infinite"!==a.scrolling;if(i>=0){c=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;h&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(l),d=t*a.rows[0].height,a.$.rowContainer.style.top=a.__frozenNearHeight-l+d+"px",a.paging.enabled||(i=0)),a.paging.enabled&&(t=a.paging.pageIndex*a._pageSize));for(let o=i;o<r.length;o++){const n=r[o];if(0===n.height||!n.visible||!1===n.filtered||n.freeze&&n.visible)continue;const s=n.height;if(n.expandHeight&&(e+=a.offsetHeight+n.expandHeight),!(d+s>=l-m&&d<=l+e||a._autoHeight))break;{const e=a._rowElements[c++];if(!e)break;if(e.setAttribute("aria-rowindex",t+o+1),n.element=e,n.grid=a,h){if(n.index=o+t,n.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=n.canNotify;n.canNotify=!1,n.selected=e.indexOf(n.index)>=0,n.canNotify=t}a.paging.enabled?(n.data=a.dataSource[i+c-1],n.data&&(n.id=n.data.$.id,a.rowById[n.id]=n)):(n.data=a.dataSource[c-1],n.data&&(n.id=n.data.$.id,a.rowById[n.id]=n))}n.render()}d+=s}}a._renderFrozenRows();let f=c;if(c<a._rowElements.length)for(let e=c;e<a._rowElements.length;e++){const e=a._rowElements[c++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}a.editing.addNewRow&&a.editing.addNewRow.visible&&"button"===a.editing.addNewRow.displayMode&&a._rowElements[f]&&(a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0})),a._newRow.element=a._rowElements[f],a._newRow.element.classList.remove("smart-hidden"),a._newRow.render()),h&&a._selection.selectionRect&&a._refreshCellSelectionRect()}_renderFrozenRows(){const e=this;let t=!1,o=!1;0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const a=e._frozenNearRows[o];a.visible||(a.element=e.$.rowNearContainer.children[o],a.element||(a.element=a.createElement(),e.$.rowNearContainer.appendChild(a.element)),a.element.classList.add("smart-hidden")),a.visible&&a.filtered&&(t=!0,a.element=e.$.rowNearContainer.children[o],a.element||(a.element=a.createElement(),e.$.rowNearContainer.appendChild(a.element)),a.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const a=e._frozenFarRows[t];a.visible&&(o=!0),a.element=e.$.rowFarContainer.children[t],a.element||(a.element=a.createElement(),e.$.rowFarContainer.appendChild(a.element)),a.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const a=e.rows;a&&null!==a&&0!==a.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"))}_recycleRotate(e,t,o,a,l){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=l,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==a&&""!==a||(s=4),"center"!==a&&"middle"!==a||(s+=i.height/2-n.height/2),"bottom"===a&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let a=-1,l=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:a+e;t.classList.contains("smart-hidden")||(-1===a&&(a=i),-1!==i&&(l=1+i))}0===o._rowElements.length&&(a=0,l=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(a=1/0,l=1/0):(a=0,l=o.dataSource.length);l!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(l=Math.min(l,o.dataSource.length)),o.paging.enabled&&(a=o.paging.pageIndex*o._pageSize,l=a+o._pageSize),o._toggledRow||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:a,last:l,edit:o._editInfo,sorting:o.getSortedColumns(),filtering:o.getFilteredColumns(),grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action)return void(t&&t(e.result));if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const a=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling)o._recycle(!1,!1);else{const t=e.first>=0?e.first:0,a=e.last!==1/0?e.last:0;let l=0;for(let e=t;e<a;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[l++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){if(o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize)),o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1)}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=a,o._onDataUpdated&&o._onDataUpdated()}),n)}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=e.appearance.showViewBar?10+e.layout.viewBarWidth+"px":"",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const a=e.columns[o];void 0!==a.defaultValue&&(t[a.dataField]=a.defaultValue)}e._addingNewRow=!0,e._add(t),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max,e.closeMenu(),e._addingNewRow=!1}),0)},t}addColumn(e){const t=this;if(e){if("string"==typeof e){const o=t._getKanbanTaskField(e);return void(o&&t.columns.push(o))}t.columns.push(e)}}addNewColumn(e){e&&this.columns.push(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.remove(),void delete t.editing.addNewRow._addButton;if("float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)?t.editing.addNewRow._addButton.classList.remove("float"):t.computedVerticalScrollBarVisibility?t.computedVerticalScrollBarVisibility&&"float"===e&&t.editing.addNewRow._addButton.classList.add("float"):t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="")};t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&(t.editing.addNewRow._addButton?requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.style.left=t.appearance.showViewBar?10+t.layout.viewBarWidth+"px":"",o())})):(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.appendChild(t.editing.addNewRow._addButton),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o())}))))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if(t._recycle(!1),t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")})))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,a=o.rowById[e];a&&(a.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const a=this,l=a.rowById[e];if(l){const e=l.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,a._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const a=e.columns[o];t.push({name:a.dataField,dataType:a.dataType||"string"}),a.displayField!==a.dataField&&t.push({name:a.displayField,dataType:a.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e){const t=this;t.isInitialized&&(e&&(t._initializeRows(),t._initializeRowElements()),t._refresh(),t._refreshSummary())}refreshView(){const e=this;e._recycleFiles=!0,e._recycle(),delete e._recycleFiles}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t){const o=this;o._isUpdating--,o._isUpdating<0&&(o._isUpdating=0),!1!==e?o.refresh():!1!==t&&o.refreshView()}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const a=t[o];"constructor"!==a&&(Smart.Grid.prototype[a]=e.prototype[a])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
65
+ Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showSelectionOnTop:{value:!1,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showTooltipsOverflow:{value:!0,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"},showViewBar:{value:!1,type:"boolean"}},type:"object"},behavior:{value:{allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"object"},fileName:{value:"smartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:150,type:"number"},height:{value:null,type:"number?"},dataSource:{value:{contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertLeft:{value:{command:{value:"insertLeftCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-left",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertRight:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-right",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},description:{value:"",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:400,type:"any"},width:{value:400,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban"],type:"string"},currentUser:{value:null,type:"any"},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the smartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",kanbanNone:"Blank",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsertLeft:"Insert left",columnMenuItemInsertRight:"Insert right",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Shift</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Record with Id: {{value}}",dialogEditHeader:"Edit Record with Id: {{value}}",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonCancel:"CANCEL",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple Select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"Collaborator",dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeAutoNumber:"Auto Number",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnNumberFormatSeparator:"Use 1000 Separator (,)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnListItems:"List items",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnCheckItems:"Show Checkbox",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",noComments:"No comments to this record yet",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Details",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'Changed {{column}} from "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed {{column}} to "{{newValue}}"',rowCreated:"Row Created",propertyUpdated:'"{{value}}" updated',propertyRemoved:'"{{value}}" removed',dropImages:"Drop images here",addImages:"Add images",dropFiles:"Drop files here",addFiles:"Add files",unassigned:"Unassigned",historyDate:"Date",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",groupedBy:"Grouped by {{column}}",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less Than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",formatColumn:"Format Column",formating:"Conditional Formatting",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"Create new view",newGrid:"Grid",newKanban:"Kanban",layout:"Layout",settings:"Settings",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:500,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!0,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},customButton:{value:{command:{value:null,type:"any",reflectToAttribute:!1},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},stateSettings:{value:{enabled:{value:!0,type:"boolean",reflectToAttribute:!1},current:{value:"",type:"string",reflectToAttribute:!1},storage:{value:null,type:"any",reflectToAttribute:!1},autoSave:{value:!1,type:"boolean",reflectToAttribute:!1},autoLoad:{value:!1,type:"boolean",reflectToAttribute:!1},allowLocalStorage:{value:!0,type:"boolean",reflectToAttribute:!1},options:{value:[],type:"array",reflectToAttribute:!1},onStateChange:{value:null,type:"any",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["smart.menu.css","smart.filterpanel.css","smart.pager.css","smart.grid.css","smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' role='grid'>\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler"}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,a=window.pageYOffset,l=e.getBoundingClientRect();if(e!==document.body){let l=e.parentNode;for(;l!==document.body&&l;){l&&(o+=l.scrollLeft,a+=l.scrollTop);let e=l;l?(l=l.parentNode,t.enableShadowDOM&&l===t.shadowRoot?l=t:!t.isInShadowDOM||l!==t.getRootNode()&&e!==t.getRootNode()||(l=t.getRootNode().host)):t.isInShadowDOM&&(l=t.getRootNode().host)}}return{bottom:l.bottom+a,height:l.height,left:l.left+o,right:l.right+o,top:l.top+a,width:l.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);super._upHandler(),t._tapTimer&&clearTimeout(t._tapTimer);const a=()=>{t.editing.isEditing&&!t.editing.dialog.enabled&&setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),a=document.getElementById(t);if(a&&a.contains(e.originalEvent.target))return}if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.endEdit()}}),50)};if(!e.originalEvent||(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&a(),!e.originalEvent.target.closest(".smart-grid-dialog"))){if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,l=e.originalEvent.target;for(;l;)if(l=l.parentNode,l===t){o=!0;break}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),a(),t.menu){let o,a,l,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],a=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),l=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,a=t.contains(o),l=t.menu.contains(o),n=t.menu),!a&&!l){const e=n.querySelectorAll("smart-drop-down-list"),a=n.querySelectorAll("smart-date-time-picker"),l=n.querySelectorAll("smart-date-input"),i=n.querySelectorAll("smart-input");for(let t=0;t<e.length;t++)if(e[t].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.dropDownContainer.contains(o))return;for(let e=0;e<l.length;e++)if(l[e].$.scrollView.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;return void t.closeMenu()}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const a=t.viewColumns[o];if(a.visibleIndex===e.visibleIndex+1)return a}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],a=o.column;a&&a.autoShowActionButton&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],a=o.element;o&&o.autoShowActionButton&&a._hideActionButton()}}}_columnMouseLeaveHandler(){this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;const o=(o,a)=>{if(o&&o.autoShowActionButton){const l=a.getBoundingClientRect(),n=t.offset(a),i=t.parentElement,r=i?i.scrollTop:0;if(n.left<=e.pageX&&n.left+l.width-6>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+l.height>=e.pageY){if(!t.hasColumnMenu(o))return;a._showActionButton()}else a._hideActionButton();else a._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const a=t._columnElements[e];o(a.column,a)}for(let e=0;e<t._frozenNearColumns.length;e++){const a=t._frozenNearColumns[e];o(a,a.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let a=null,l=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){a=t.getAttribute("data-field"),l=t;break}}if(a){const o=l.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(a),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(a),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let a=null,l=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){a=t.getAttribute("data-field"),l=t;break}}if(a){const o=l.column;if(!o)return;if("_commandColumn"===a)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(l){const n=o.selectionColumn?t.selection.checkBoxes.action===l&&t.selection.enabled:t.selection.action===l&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=a,"_checkBoxColumn"===a)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===a&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField}),i("doubleClick"),t._onColumnDoubleClick(o,e)),t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,a,l,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+a+"px,"+l+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,a=e.clientY;e.touches&&(o=e.touches[0].clientX,a=e.touches[0].clientY);const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,a);let n=null,i=null,r=null,s=null;t._lastPointerDownTime=new Date;for(let e=0;e<l.length;e++){const t=l[e];if(t.hasAttribute("toggle-button")&&(i=t),t.hasAttribute("checkbox")&&(r=t),s||"smart-grid-cell"!==t.nodeName.toLowerCase()||(s=t),!n&&"smart-grid-row"===t.nodeName.toLowerCase()){n=t;break}}if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn){const e=n.row;e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else{const o=n.row,a=s?s.cell:null;if(a.column._treeColumn&&r)return void(o.checked=!o.checked);a.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:a,id:o.id,dataField:a.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const l=function(l){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return;o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===a.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===l){if(e.shiftKey||e.ctrlKey||!t.selection.allowRowHeaderSelection&&a.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=a.column.dataField,a.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,a.column.dataField,e),r()}else a.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===l&&(t._setSelection(o.id,a.column.dataField,e),r())},i=a.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,u=e.originalEvent?e.originalEvent:e,c=3===u.which;if(c||"_commandColumn"===a.column.dataField||l("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),t.$.fireEvent("cellClick",{cell:a,id:o.id,dataField:a.column.dataField,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),c&&t.contextMenu.enabled)return t.contextMenu.id=o.id,t.contextMenu.dataField=a.column.dataField,t._focusCell(o.id,a.column.dataField),t.openContextMenu(u.pageX+10,u.pageY+10),void(t.contextMenu.selector&&(u.stopPropagation(),u.preventDefault()));if(o.autoGenerated||a.column.autoGenerated||"checkBox"===a.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(a,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===a.selected&&!t.selection.isDragging){const l=t._selection.focusedCell;l&&t._clickedCell&&l.id===a.row.id&&l.dataField===a.column.dataField&&l.id===t._clickedCell.cell.row.id&&l.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(a,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(a,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===a.selected&&!t.selection.isDragging){const l=t._selection.focusedCell;t._clickedCell&&l.id===a.row.id&&l.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(a,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(a,e));else t._onRowClick(o.index,o,e),t._onCellClick(a,e);else t._onRowClick(o.index,o,e),t._onCellClick(a,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),l("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(a,e),t.$.fireEvent("cellDoubleClick",{cell:a,id:o.id,dataField:a.column.dataField,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():a.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const a=this;if(a.notifyFn)for(let l=0;l<a.notifyFn.length;l++)a.notifyFn[l](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}propertyChangedHandler(e,t,o){const a=this;if(a.isInitialized){switch(a._notify(e,t,o),e){case"onRowHistory":case"onRowInserted":return;case"view":return void(a.$.headerBar&&a.$.headerBar._setView&&a.$.headerBar._setView(o));case"users":case"currentUser":a._refreshCurrentUser(),a._recycle();break;case"summaryRow_visible":{for(let e=0;e<a.columns.length;e++)a._summaryRowCount=Math.max(a._summaryRowCount,a.columns[e].summary.length);const e=a.onRowInserted;a.onRowInserted=null,a._renderRows(!0),a.onRowInserted=e;break}case"conditionalFormatting":return a._renderConditionalFormatting(),void a.refresh();case"appearance_displayLoadingIndicator":return void a._setLoadingIndicatorVisibility();case"appearance_placeholder":return void(a.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void a._recycle();case"appearance_allowColumnStickyPosition":o?a._stickHeader():a._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<a.columns.length;e++)a.columns[e].setProperty("showIcon",a.appearance.showColumnIcon);a._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{a._initializeRowNumberColumn();const e=a._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&a.$.columnNearContainer.appendChild(e.element),a.refresh();break}case"header_visible":a.header.visible&&""===a.header.template&&(a.$.header.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',a.$.headerBar=a.$.header.firstElementChild,a.$.headerBar._init(a),a.header.onInit&&a.header.onInit(a.$.headerBar));break;case"header_buttons":a.header.visible&&""===a.header.template&&a._refreshHeaderBar();break;case"header_template":a._applyTemplate(o,a.$.header);break;case"footer_template":a._applyTemplate(o,a.$.footer);break;case"layout_columnWidth":case"columnWidth":{a.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<a.columns.length;t++)a.columns[t].width=e;a.columns.canNotify=!0,a.refresh();break}case"checkBoxes_visible":return void a._recycle();case"checkBoxes_hasThreeStates":return a.rows.canNotify=!1,a._applyThreeStates(a.rowHierarchy),a.rows.canNotify=!0,void a._recycle();case"columnHeader_visible":a.__columnHeaderHeight=null,a.refresh();break;case"selection_checkBoxes_enabled":a._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":a._selectionColumn.element&&(o?a._selectionColumn.element.setAttribute("auto-show",""):a._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=a.viewColumns.indexOf(a._selectionColumn);a.viewColumns.canNotify=!1,a.viewColumns.splice(e,1);const t=a._frozenNearColumns.indexOf(a._selectionColumn),l=a._frozenFarColumns.indexOf(a._selectionColumn);if(t>=0&&a._frozenNearColumns.splice(t,1),l>=0&&a._frozenFarColumns.splice(l,1),"far"===o)a._selectionColumn.canNotify=!1,a._selectionColumn.freeze="far",a._selectionColumn.canNotify=!0,a._frozenFarColumns.splice(0,0,a._selectionColumn),a.viewColumns.push(a._selectionColumn),a.$.columnFarContainer.appendChild(a._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<a.viewColumns.length&&(a.viewColumns[o].autoGenerated||a.viewColumns[o].dataField!==a.columns[t++].dataField);o++)a.viewColumns[o].autoGenerated&&e++;a._selectionColumn.canNotify=!1,a._selectionColumn.freeze="near",a._selectionColumn.canNotify=!0,a._frozenNearColumns.splice(e,0,a._selectionColumn),a.viewColumns.splice(e,0,a._selectionColumn),a.$.columnNearContainer.appendChild(a._selectionColumn.element)}a.viewColumns.canNotify=!0;break}case"selection_mode":if(a._selection&&(a._selection.focusedCell=null),a.selection.allowCellSelection)a.clearSelection();else if("one"===o){const e=a.getSelection();if(a.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=a.rowById[e.rows[0].row.id].getCell(a.columns[0].dataField);a._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index}}}break;case"grouping_groupBy":return a.dataSource&&a.dataSource.groupBy&&(a.dataSource.groupBy=o),void a.refresh();case"sorting_enabled":return void a.refresh();case"sorting_maintainSort":return void a._recycle(!1);case"filtering_enabled":return o&&0===a._filterPanels.length&&a._createFilterPanels(),void(a.header.visible&&a.refresh());case"filtering_filterRow_visible":return a._initializeRows(),a._initializeRowElements(),void a.refresh();case"filtering_operator":return void a.refreshFilters();case"filtering_filter":for(let e=0;e<a.columns.length;e++){const t=a.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<a.filtering.filter.length;e++){const t=a.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let l=null;if(o instanceof Smart.FilterGroup)l=o;else{const t=a.columnByDataField[e];t&&(l=a.dataSource._createFilter(t.dataType,o))}l&&a.addFilter(e,l,!1)}}return void a.refreshFilters();case"messages":case"locale":{if(a.columns)for(let e=0;e<a.columns.length;e++)a.columns[e]._cellsCachedValues=[];a._dialogEdit&&(a._dialogEdit.close(),a._dialogEdit=null),a._dialogDelete&&(a._dialogDelete.close(),a._dialogDelete=null),a._dialogAddRow&&(a._dialogAddRow.close(),a._dialogAddRow=null);const e=a.$.headerPager.querySelector("smart-pager"),t=a.$.footerPager.querySelector("smart-pager");e&&(e.locale=a.locale),t&&(t.locale=a.locale);const o=(e,t)=>{a._handleFilterMenuClick(e,t)};a._filterInfo||(a._filterInfo={}),a._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:a.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:a.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:a.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:a.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:a.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:a.localize("CLEAR_FILTER")}],a._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:a.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:a.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:a.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:a.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:a.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:a.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:a.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:a.localize("CLEAR_FILTER")}],a._refreshHeaderBar(),a.$.headerBar&&(a.$.headerBar.messages=a.messages,a.$.headerBar.locale=a.locale,a.$.headerBar._localizeHeader(),a.$.headerBar._getInnerElementMessages()),a._recycle();break}case"paging_spinner_enabled":a._refresh();break;case"pager_visible":return a._renderPagers(),void a._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void a._refreshPaging(!0);case"paging_pageSize":return void a._refreshPaging(!1);case"columns":{a.__measuredColumnHeight=null,a.editing&&a.editing.isEditing&&a.cancelEdit(),a._cellEditors=[];let e=!1;if(t&&t.length)for(let o=0;o<t.length;o++)if(t[o].freeze){e=!0;break}if(a.columns&&a.columns.length)for(let t=0;t<a.columns.length;t++)if(a.columns[t].freeze){e=!0;break}if(e&&a._initializeRowElements(),a.columns&&a._sortedColumns){const e=[];a.columns.forEach((t=>{t.sortOrder&&e.push(t)})),a._sortedColumns=JSON.parse(JSON.stringify(e))}if(a._renderColumns(),a._refreshHeaderBar(),a.columns&&a.filtering.enabled){a.beginUpdate();for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(t.canNotify=!1,a.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:a.dataSource._createFilter(t.dataType||"string",o),e&&a.addFilter(t.dataField,e,!1)}}a.refreshFilters(),a.endUpdate()}return a.layout.isDirty=!0,a._resetCachedLayout(),void a._refreshLayout()}case"columnGroups":if(a._columnGroups=[],a._columnHeights=0,a.viewColumns)for(let e=0;e<a.viewColumns.length;e++){const t=a.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return a.columns.canNotify=!1,a.columns=a._initColumns,a._renderColumns(),a.columns.canNotify=!0,a.__columnHeaderHeight=null,void a.refresh();case"dataSource":if(delete a._isFirstVirtualDataSourceRequest,"dataSource"===e&&t&&o){const e=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&"infinite"!==a.scrolling;if(t instanceof Smart.DataAdapter&&!e&&t.length===o.length&&t.length>0&&o.length>0&&!a.dataSourceSettings.parentDataField&&!t.parentDataField){if(a.dataSource=t,a._cachedDataSource===o)return;return setTimeout((()=>{let e=null;if(t&&a.dataSource&&a.dataSource._expandedRowIds){let t={};for(let e in a.dataSource._expandedRowIds){let o=""+e;o=o.replace("Item","").replace(/_/gi,"."),t[o]=!0}e=t}if(a.beginUpdate(),a._sortedColumns&&a._sortedColumns.length>0&&void 0===a._getId())for(let e=0;e<o.length;e++){const t=a.dataSource[e],l=o[e];a._updateRow(t,l,!0)}else for(let e=0;e<o.length;e++){const t=o[e],l=a.dataSource[e].$.id;a._updateRow(l,t,!0)}delete a.__autoRowHeight,a._virtualOnExpandCache=[],a._cellsMerge=[],a._cellStyles=[];const l=a._filters,n=a._sortedColumns;if(a.clearSort(),a.filtering.filterRow)for(let e=0;e<a.columns.length;e++)a.columns[e]._filterEditorInitialized=!1;for(let e=0;e<a.columns.length;e++)delete a.columns[e]._cellsCachedValues;if(n&&a._refreshSort(n),l&&l.length>0&&(a._filters=null,a.refreshFilters()),a.grouping.enabled)for(let t in e)a._expandCollapseGroup(t,!0);a.endUpdate()})),a._cachedDataSource=o,void(a.header.visible&&""===a.header.template&&a.$.headerBar._init(a))}}return a.dataBind(),void(a.header.visible&&""===a.header.template&&a.$.headerBar._init(a));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{a.beginUpdate(),a.rows.canNotify=!1;const e=a.appearance.allowRowDetailToggleAnimation;a.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<a._recyclingRows.length;e++){const t=a._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=a.rowDetail.height}if(a.rows.canNotify=!0,a.rowDetail.enabled){let t=!1;for(let e=0;e<a.viewColumns.length;e++)if(a.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return a.appearance.allowRowDetailToggleAnimation=e,a.endUpdate(),void a._renderColumns(!0)}else for(let e=0;e<a.viewColumns.length;e++){const t=a.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return a.appearance.allowRowDetailToggleAnimation=e,void a.endUpdate()}case"rowDetail_visible":for(let e=0;e<a.viewColumns.length;e++){const t=a.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void a._setLoadingIndicatorVisibility();case"filterable":return void a._refreshLayout();case"layout_allowCellsWrap":{const e=a.columns.canNotify;a.columns.canNotify=!1;for(let e=0;e<a.columns.length;e++)a.columns[e].cellsWrap=o;return a.layout.isDirty=!0,a._resetCachedLayout(),a._refreshLayout(),a.refresh(),void(a.columns.canNotify=e)}case"showViewBar":return a.layout.isDirty=!0,a._resetCachedLayout(),a._refreshLayout(),void a.refresh();case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return a.layout.isDirty=!0,a._resetCachedLayout(),a._refreshLayout(),void a.refresh();case"rightToLeft":return void a.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":a._addNewColumn?(a._addNewColumn.visible=o,a.refresh()):a._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===a.editing.addNewRow.displayMode&&a.editing.addNewRow._addButton&&(a.editing.addNewRow._addButton.remove(),delete a.editing.addNewRow._addButton);const e=a._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),a._renderAddNewRow(),void a.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===a.editing.addNewRow.visible&&"button"===a.editing.addNewRow.displayMode&&(a.editing.addNewRow._addButton&&a.editing.addNewRow._addButton.remove(),a._newRow&&a._newRow.element.classList.add("smart-hidden")),a._renderAddNewRow(),void a.refresh();case"editing_enabled":o?a.removeAttribute("aria-readonly"):a.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":a._renderCommandBar();break;case"editing_commandColumn_position":a._renderColumns(!0);break;case"editing_commandColumn_visible":return void a.refresh(!0);case"editing_commandColumn_inline":return a._commandColumn.visible=a.editing.commandColumn.visible&&!a.editing.commandColumn.inline,void a.refresh(!0);case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete a.__cellsCommandTemplate,void a.refresh(!0)}a.refresh()}}ready(){super.ready();const e=this,t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];e.filtering.enabled&&0===e._filterPanels.length&&requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel");o.filterType="boolean",a.filterType="numeric",l.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=l,e._filterPanels.numeric=a,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),a=o.createElement();e.$.scrollView.appendChild(a),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const l={};for(let t=0;t<e.dataSource.dataFields.length;t++)l[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=l,o._isMeasureRow=!0,o.render(),a.style.height="",a.style.lineHeight="",t=Math.max(a.offsetHeight,t);for(let e=0;e<a.children.length;e++)a.children[e].style.height="";for(let l=0;l<a.children[1].children.length;l++){if(a.children[1].children[l].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+a.children[1].children[l].offsetHeight);break}return e.$.scrollView.removeChild(a),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this;let t=e._recyclingRows,o=0,a=e._autoRowHeight,l=0,n=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===t.length||0===e.columns.length||!e.hasVisibleColumn())return 0;e.rows.canNotify=!1;const i=e._measureRowElement(t[0].data),r=t.length;for(let s=0;s<r;s++){let r=t[s];if(!r.visible||!1===r.filtered){r.height=0,r.cellHeight=0,r.top=o;continue}const d=e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled;if((!r.height||!r.cellHeight||d||"auto"===r.height||"auto"===r._height||"auto"===e.layout.rowHeight||e.layout.isDirty)&&!r.expandHeight){if(r.detailHeight||(r.detailHeight=200),e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.height=e.layout.rowHeight,r.computedHeight&&(r.height=r.computedHeight),r.minHeight>r.height&&(r.height=r.minHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.element=i,r.grid=e,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):a,o=r.canNotify;r.canNotify=!1,r.height=t,r.computedHeight&&(r.height=r.computedHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight),r.canNotify=o}else e.layout.rowHeight(s,r),r.height||(r.height=a),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}else{if("auto"===r.height||"auto"===r._height){r.element=i,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):a;r.height=t,r._height="auto"}else r.height=a;void 0===r.label||r.summaryRow||"advanced"!==e.grouping.renderMode||(r.height=e.grouping.groupRowHeight),r.computedHeight&&(r.height=r.computedHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}e._rowGap&&s<e.rows.length-1&&(r.height+=e._rowGap)}!0===r.freeze||"near"===r.freeze?r.visible&&(l+=r.height):"far"===r.freeze&&r.visible&&(n+=r.height),r.freeze&&r.visible?r.top=o:(r.top!==o&&(r.top=o),r.expandHeight?o+=r.cellHeight:o+=r.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(o+=1*a),e.editing.addNewRow&&"button"===e.editing.addNewRow.displayMode&&(o+=1*a),e.filtering&&e.filtering.filterRow.visible&&(l+=a),e.editing.addNewRow&&"button"!==e.editing.addNewRow.displayMode&&e.rowHierarchy&&e.editing.addNewRow.visible&&(o+=a,"far"!==e.editing.addNewRow.position&&(l+=a)),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(o=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return e.__scrollHeight=o,e.__frozenNearHeight=l,e.__frozenFarHeight=n,e._scrollView.scrollHeight=o-e.$.scrollView.offsetHeight+l+n,o=e.__scrollHeight+l+n-1,e.grouping.enabled&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(o+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=o,i.remove(),t[0]&&delete t[0]._isMeasureRow,e.rows.canNotify=!0,o}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let a=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(a=e._columnHeights[0]),a<e.layout.columnMinHeight&&(a=e.layout.columnMinHeight),e.__measuredColumnHeight=a,a}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const a=function(e){for(let t=0;t<o.length;t++){let a=o[t];if(a.name===e)return a}return null},l=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let a=l(e.groups[o]);for(let e=0;e<a.length;e++)t.push(a[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=a(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=a(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const a=e.viewColumns[o];let l=a;for(a.level=0;l.parent;)l=l.parent,a.level++;l=a;let n=a.level;for(t=Math.max(t,a.level);l.parent;)l=l.parent,l&&(l.level=--n)}for(let t=0;t<o.length;t++){const a=o[t],n=l(a);a.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,a.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?a.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o}_refreshColumnHeights(){const e=this;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let a=e._viewColumnsHeight;e.layout.columnHeight&&(a="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),a<e.layout.columnMinHeight&&(a=e.layout.columnMinHeight),a?(e._columnHeights.push(a),t+=a):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let a=0;a<t.level;a++)o+=e._columnHeights[a];return o},a=function(t){let a=o(t),l=e._columnHeaderHeight-a;for(let o=t.level+1;o<e._columnHeights.length;o++){const a=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===a){let o=n;for(;o.parent;){if(o.parent===t){l=e._columnHeights[a],i=!0;break}o=o.parent}if(i)break}}}return l};for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t],n=a(l);l.computedHeight=n,l.top=o(l)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let l=0;l<e._columnGroups.length;l++){const n=e._columnGroups[l];if(n.level!==t)continue;if(n.groups){const e=a(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let a=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,l=0;e.selection.checkBoxes.enabled&&(l=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-a;let i=0,r=[],s=0,d=0,u=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),a=e.editing.commandColumn.dataSource;let l=0,n="",i=0;o.classList.add("smart-label");for(let t in a){const o=a[t];let l=!1;if("commandColumnMenu"===t)continue;let r=!1;l||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),l=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),l=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?l=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?l+=25*i:l+=10*i,l};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let a;"number"==typeof o.width?a=o.width:o.width&&o.width.toString().indexOf("%")>=0?(a=parseFloat(o.width)/100,a*=n-l):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(a=parseFloat(o.width),a*=16):"auto"===o.width?a=o._autoSize():o.visible&&(r.push(o),a=0),o.overflowWidth&&(a-=o.overflowWidth),o.visible&&(i+=a),a<o.minWidth&&(a=o.minWidth),o.computedWidth=a}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const a=r[o];let l;l=e/r.length,o===r.length-1&&(l=e-t),a.overflowWidth&&(l-=a.overflowWidth),l<a.minWidth&&(l=a.minWidth),a.computedWidth=l,t+=l}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(a>0&&!o.autoGenerated&&(o.computedWidth+=a,a=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,u+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=u,u+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const a=e._columnGroups[o];if(a.level!==t)continue;let l=99999;if(a.groups){const e=function(t){let o=0;for(let a=0;a<t.groups.length;a++){let n=t.groups[a];n.groups?o+=e(n):n.visible&&(l=Math.min(n.left,l),o+=n.computedWidth)}return o};a.computedWidth=e(a),a.left=l}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let a=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];if(l.freeze)continue;const n=l.createElement();void 0!==l.computedWidth?(a+=l.computedWidth,e._columnElements.push(n),a<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const a=e._columnGroups[t],l=new Smart.Grid.Column({visible:void 0===a.visible||a.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:a.name,label:a.label,labelTemplate:a.labelTemplate,align:a.align,verticalAlign:a.verticalAlign,showIcon:!1});a.column=l;const n=l.createElement();n.style.width=a.computedWidth+"px",e.rightToLeft?n.style.right=a.right+"px":n.style.left=a.left+"px",n.style.top=a.top+"px",n.style.height=a.computedHeight+"px",n.style.lineHeight=a.computedHeight+"px",o.appendChild(n),a.element=n,a.grid=this,n.onpointerdown=t=>{if(e.selection.allowColumnHeaderSelection){const t=function(e){let o=new Array;if(e.columnGroup&&o.push(e),e.groups)for(let a=0;a<e.groups.length;a++)if(e.groups[a].columnGroup)o.push(e.groups[a]);else if(e.groups[a].groups){let l=t(e.groups[a]);for(let e=0;e<l.length;e++)o.push(l[e])}return o},o=t(a);e._selectColumnsRange(o[0].dataField,o[o.length-1].dataField)}}}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),a=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-l,height:e.$.container.offsetHeight-a-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const a=e.offsetHeight;e.$.container.classList.add("smart-hidden");const l=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&a===l||(o=e._scrollHeight);const n=function(){const a=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let l=0;l<e.rows.length;l++){const n=e.rows[l];if(n.freeze&&n.visible)continue;const i=n.createElement();if(a.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(a);const l=e.$.rowContainer.children;for(let t=0;t<l.length;t++){const o=l[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const a=o.createElement();o.element=a,e.$.rowNearContainer.appendChild(a)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const a=o.createElement();o.element=a,e.$.rowFarContainer.appendChild(a)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;t.summaryRow.visible&&(t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{!0!==t.editing.isEditing&&(t._calculateSummary(),!1!==e&&t._recycle(!1,!0,!1))}),100))}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[];let o=new Date;const a=function(){let t=[],o=!1;for(let a=0;a<e.columns.length;a++){const l=e.columns[a];let n={};l.summary&&l.summary.length>0&&(o=!0,n[l.dataField]=l.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const a=e.getSelectedRowIds();if(a.length>=1){const o=[];for(let t=0;t<a.length;t++){const l=e.dataSource.dataItemById[a[t]];l&&o.push(l)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),a=[],l=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===a.indexOf(r)&&a.push(r),-1===l.indexOf(n[1])&&l.push(n[1])}e._summaryItems=e.dataSource.summarize(t,a);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===l.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const l=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],n=function(a,n,i){let r=null;if(e.isInitialized&&(o=new Date),r=a?a.grid?a:new Smart.Grid.Row({data:a,index:n,grid:e,createdBy:e.currentUser,createdDate:o}):new Smart.Grid.Row({data:{},index:n,grid:e,createdBy:e.currentUser,createdDate:o}),l)for(let e=0;e<l.length;e++){const t=l[e],o=t.getCellValue(r.id,t.dataField,a);void 0!==o&&(r.data[t.dataField]=o)}if(e.rowById[r.id]&&(r.id=e.rows.length,e.rowById[r.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};r.id=e()}if(e.onRowInit){e.onRowInit(n,r,e),30!==r.height&&(r.cellHeight=r.height);for(let t in r)-1!==r.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}))}if(r.selected&&(e._selection.rows[r.id]=!0,e._selection.indexes[r.index]=r.index),r.freeze&&r.visible){if(!0===r.freeze||"near"===r.freeze){e.rows.splice(t++,0,r);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}else if("far"===r.freeze){e.rows.push(r);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&e._frozenFarRows.push(t)}}else e.rows[n]?e.rows.splice(n,0,r):e.rows.push(r),r.data&&r.data.$&&(r.data.$.history=r.history,r.data.$.starred=r.starred,r.data.$.comments=r.comments,r.data.$.style=r.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n],o=o=>{const a=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[a.id]){const t=e.dataSource.dataItemById[a.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};a.id=o(),a.data&&a.data.$?a.data.$.id=a.id:a.data.id=a.id,e._getId()&&(a.data[e._getId()]=a.id),t&&(e.dataSource.dataItemById[a.id]=a.data)}e.rowById[a.id]=a}else{const t=e.dataSource.dataItemById[a.id];a.id=o,a.data&&a.data.$?a.data.$.id=a.id:a.data.id=a.id;const l=e._getId();l&&(a.data[e._getId()]=a.id),t&&(t[l]=o,e.dataSource.dataItemById[a.id]=t,a.data=t),e.rowById[a.id]=a}-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._setAddUndoRedo(a),!e.editing.isEditing&&e.isInitialized&&e._recycle(!1,!0),e._onRowInserted&&e._onRowInserted(a),i&&i(a)};if(void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:n});const a=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([n],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let a=0;a<e._rowInsert.length;a++)t.push(e._rowInsert[a].index),o.push(e._rowInsert[a].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let a=0;a<o.length;a++){const l=o[a],n=t?t[a]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[l.id];l.id=l.data.id=n;const o=e._getId();o&&(l.data[e._getId()]=l.id),e.rowById[l.id]=l,t&&(t[o]=n,e.dataSource.dataItemById[l.id]=t,l.data=t)}e._setAddUndoRedo(l),-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._onRowInserted&&e._onRowInserted(l),i&&i(l)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),a)}else e.onRowInserted([n],[t],o,e)}else{const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n];void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),i&&i(t)}},i=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},r=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=n,e._removeLastRow=i,e._removeAt=r,e._rowHeight=e._autoRowHeight;const s=e.dataSource.length;if(e.setAttribute("aria-rowcount",s),e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];n(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];n(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(a(),e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let l=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)n(o[t],e.dataSource.length-o.length+t);else n(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],a=[],i=[];for(let r=0;r<i.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=i[r],o.push(s),a.push(e.rows[s]),i.push(e.rows[s].data)):(n(i[r],i[r].$.index),l=!0)}e.onRowUpdated&&e.onRowUpdated(o,a,i,e)}else{const a=t.index;e.rows[a]?e.rows[a].data=o:n(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([a],[e.rows[a]],[e.rows[a].data],e)}break;case"insert":n(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":r(t.index);break;case"removeLast":i();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==s){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize)),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize))}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),e.onLoad())}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?e._frozenNearRows.push(o):"far"===o.freeze&&e._frozenFarRows.push(o),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(a=t.target,l=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==l&&"showDetail"!==l||(a.propertyChanged(l,n,i),e.onRowChange&&a.properties.indexOf(l)>=0&&e.onRowChange(a,l,n,i,e))),void(e.rows.canNotify=!0);var a,l,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let a=e.rows[o];if(a instanceof Smart.Grid.Row==0){a=new Smart.Grid.Row(a);const l=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=a,a=t.object[o],e.rows.canNotify=l}if(a.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],a=e.rows[t];o&&(a.data=o,a.id=o.$.id),e.rowById[a.id]=a}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const a=e.columns[o];t.push({name:a.dataField,dataType:a.dataType||"string"}),a.displayField!==a.dataField&&t.push({name:a.displayField,dataType:a.dataType||"string"})}e.dataSource.dataFields=t}o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]&&(a.data=e.dataSource[o],void 0!==e.dataSource[o].$.id&&(a.id=e.dataSource[o].$.id,e.rowById[a.id]=a),a.data.$&&a.history&&(a.data.$.history=a.history)),-1!==a.index&&void 0!==a.index||(a.index=o),a.selected&&(e._selection.rows[a.id]=!0,e._selection.indexes[a.index]=a.index),a.freeze&&(!0===a.freeze||"near"===a.freeze?e._frozenNearRows.push(a):"far"===a.freeze&&e._frozenFarRows.push(a))})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],a=e.rows.indexOf(o);e.dataSource.update(a,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],a=e.rows[t];a&&(a.data=o,a.id=o.$.id,e.rowById[a.id]=a)}return e.rows.canNotify=!0,void e.refresh()}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||e._render()})),e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),void super.render();const o=e.context;e.context=e,e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&e.header.buttons.indexOf("views")>=0&&e._updateKanbanTaskFields()),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const a=e.columns[o];t.push({name:a.dataField,dataType:a.dataType||"string"}),a.displayField!==a.dataField&&t.push({name:a.displayField,dataType:a.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale,e.$.header.appendChild(t),e.$.headerBar=e.$.header.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{let t=!1;if(e.stateSettings.autoLoad){let o=e.stateSettings.current;!o&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="View 1",o=e.stateSettings.current);let a=null;e.stateSettings.storage&&(a=e.stateSettings.storage[o]),a&&(t=!0),!a&&e.stateSettings.allowLocalStorage&&(a=window.localStorage.getItem(o),a&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const a=e.viewColumns[o];a.allowSort&&a.sortOrder&&t.push(a)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const a=e.sorting.sort[o],l=Object.keys(a)[0],n=a[l],i=e.columnByDataField[l];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const a=t[o],l=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(a.dataField,a.sortOrder),e.appearance.allowSortAnimation=l}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],a=e.filtering.filter[1];let l=null;o&&(l=e.dataSource._createFilter(o.dataType,a)),l&&e.addFilter(t,l,!1);break}const t=o[0],a=o.splice(1);let l=null;if(a instanceof Smart.FilterGroup)l=a;else{const o=e.columnByDataField[t];o&&(l=e.dataSource._createFilter(o.dataType,a))}l&&e.addFilter(t,l,!1)}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,a=o.filter;t=a instanceof Smart.FilterGroup?a:e.dataSource._createFilter(o.dataType,a),t&&e.addFilter(o.dataField,t,!1)}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="smartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view&&e._initKanbanView()}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,a=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=a,a}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(){const e=this,t=e.conditionalFormatting;if(!t||0===t.length)return;if(!e._defaults){const t=getComputedStyle(e);e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)}}e._formatter||(e._formatter=new Smart.Utilities.ConditionalFormatter(e.dataSource));const o=e._defaults,a=e._formatter,l=[],n=function(t){if("all"===t){if(e.columns&&e.columns.map){const t=[];for(let o=0;o<e.columns.length;o++){const a=e.columns[o];a.dataField.startsWith("task")||a.autoGenerated||"number"!==a.dataType&&"date"!==a.dataType||t.push(a.dataField)}return t}return[]}return[t]};for(let e=0;e<t.length;e++){t[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:o.fontFamily,fontSize:o.fontSize,text:o.text,highlight:o.highlight},t[e]);const i=t[e],r=n(i.column),s=i.condition;a.color=i.highlight,a.comparator=i.firstValue,a.min=i.firstValue,a.max=i.secondValue;const d=a.format(s,r);for(let e in d){const t=d[e];for(let e in t){const o=t[e];o.color=i.text,o.fontFamily=i.fontFamily,o.fontSize=i.fontSize}}l.push(d)}if(e._formattingPanel&&(e._formattingPanel.items=t),0===l.length)return l[0];const i={};for(let e=0;e<l.length;e++){const t=l[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){i[e]||(i[e]={});for(let t in o)i[e][t]=Object.assign({},i[e][t],o[t])}}}e._conditionalFormatting=i}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const a=parseInt(e.clientTop+o);e.$.columnHeader.style.top=a+"px";let l=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(l=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+l>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+a+l+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let a=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(a=e.layout.autoGenerateColumnWidth),t.width=a,t.createElement();const l=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,l),e._frozenNearColumns.splice(0,0,l)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let a="",l=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+l);l++;const s=a+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=a+r),t.push({align:"center",label:i,dataField:s,width:100}),l>=26&&(l=0,a+="A")}e._boundColumns=t}else{const t=e=>{const t=new WeakSet;return JSON.stringify(e,((e,o)=>{if(null!==o&&"object"==typeof o){if(t.has(o))return;t.add(o)}return o}))};e._boundColumns=Array.isArray(e.columns)?JSON.parse(t([...e.columns])):[...e.columns.toArray()];for(let t=0;t<e.columns.length;t++){const o=e.columns[t],a=e._boundColumns[t];"string"!=typeof a&&(a.formatFunction=o.formatFunction,a.getFilterPanel=o.getFilterPanel,a.getCellValue=o.getCellValue,a.updateFilterPanel=o.updateFilterPanel,a.children=o.children,a.onAction=o.onAction,a.menuItems=o.menuItems,a.sortComparator=o.sortComparator,a.groups=o.groups,a.labelTemplate=o.labelTemplate,a.template=o.template)}}e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),a=o&&o.dataType||"string";t.dataType||(t.dataType=a)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],a=e._boundColumns.length,l={index:a,visibleIndex:a,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(l)}else for(let a in t){if(a.startsWith("_")||"$"===a)continue;const t=e._boundColumns.length,l={index:t,visibleIndex:t,label:a,dataField:a};o(l),e._boundColumns.push(l)}}for(let a=0;a<e._boundColumns.length;a++){let l=e._boundColumns[a];if("string"==typeof l){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===l)return e}));l={label:l,dataField:l,dataType:t&&t.dataType||"string"}}}else o(l);l.visibleIndex=a,l.index=a,l.grid=e,l.label&&/<.+?>/.test(l.label)&&l.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?l.label=l.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(l.label=window.Smart.Utilities.Core.escapeHTML(l.label)));const n=new Smart.Grid.Column(l);e.onColumnInit&&e.onColumnInit(a,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));n.grid=e,e.columns.push(n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(a,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let a=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),a++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),l=new Smart.Observable(o,o.observables);"near"===e.rowDetail.position?(o.freeze="near",l.freeze="near",e.viewColumns.splice(a,0,l),e._frozenNearColumns.splice(a,0,l)):(e.viewColumns.push(l),e._frozenFarColumns.splice(0,0,l)),a++}const l=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30}),n=new Smart.Observable(l,l.observables);n.canNotify=!1,e.viewColumns.push(n),e._frozenFarColumns.splice(0,0,n);const i=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),r=new Smart.Observable(i,i.observables);r.canNotify=!1,"near"===e.editing.commandColumn.position?(i.freeze="near",r.freeze="near",e.viewColumns.splice(a,0,r),e._frozenNearColumns.splice(a,0,r)):(e.viewColumns.push(r),e._frozenFarColumns.splice(0,0,r)),e._commandColumn=r;const s=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),d=new Smart.Observable(s,s.observables);if("near"===s.freeze?(e.viewColumns.splice(a,0,d),e._frozenNearColumns.splice(a,0,d)):(e.viewColumns.push(d),e._frozenFarColumns.splice(0,0,d)),e._selectionColumn=d,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let a=[];const l=document.createElement("div");l.style.display="grid",l.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)l.innerHTML+="<div></div>";l.style.width=e.clientWidth-t+"px",e.$.root.appendChild(l);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)a[t]=l.children[t].offsetWidth,"auto"===n[t]&&(a[t]=null);l.parentNode.removeChild(l);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||a[i]&&(o.width=o.templateWidth=a[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],a=[];for(let a=0;a<e.length;a++){const l=e[a];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===l.dataField){n=!1;break}n&&o.push(l)}const l=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===l.indexOf(o.dataField)&&a.push(o)}a.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],a=o.element;o.top=0,o.level=0,a&&(a.style.top="",a.style.height="",a.style.lineHeight="")}t._renderColumns(),t.__columnHeaderHeight=null,t.refresh()}onAttached(){const e=this;e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.isRendered&&e.isCompleted&&e._render()}onDetached(){const e=this;if(!e.isRendered)return;["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.querySelector("smart-grid-toolbar");if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,a=e._scrollView.vScrollBar;if(a.ownerElement=null,o.ownerElement=null,a.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let l=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];l=l.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=l,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}_observeColumns(){const e=this,t=function(t,o,a,l){a===l&&"selected"!==o||(t.propertyChanged(o,a,l),e.onColumnChange&&t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,a,l))};for(let o=0;o<e.viewColumns.length;o++){const a=e.viewColumns[o];a.rowHeaderColumn||(a.onAction=function(){e._openMenu(this)}),a.autoGenerated&&a.notify((function(e){a.canNotify=!1,t(a,e.propertyName,e.oldValue,e.newValue),a.canNotify=!0}))}e.columns.notify((function(o){let a=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let l=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(a=o.object[t],a instanceof Smart.Grid.Column==0){a=new Smart.Grid.Column(a);const l=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=a,a=o.object[t],e.columns.canNotify=l}a.grid=e,a.onAction=function(){e._openMenu(this)},a.freeze?e._frozenNearColumns.push(a):"far"===a.freeze&&e._frozenFarColumns.push(a);let l=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,a):e.viewColumns.splice(l,0,a),e.columnByDataField[a.dataField]){e.columnByDataField[a.dataField].children.push(a),a.parent=e.columnByDataField[a.dataField],a.valueField=a.dataField;const t=a.dataField+"_"+a.parent.children.length;e.columnByDataField[t]=a,a.dataField=t}else e.columnByDataField[a.dataField]=a;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===a.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:a.dataField,dataType:a.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=a.getState();o.dataField=a.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":a=o.object[o.index],a instanceof Smart.Grid.Column==0&&(a=new Smart.Grid.Column(a)),a.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&l++;e.viewColumns[l+o.index]=a,e.columnByDataField[a.dataField]=a,e.onColumnUpdated&&e.onColumnUpdated(o.index,a);break;case"remove":{a=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(a);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&l++;e.viewColumns.splice(l+t,1)}else e.viewColumns.splice(n,1);if(a&&(a.filter&&e.removeFilter(a.dataField),a.sortOrder&&e.removeSort(a.dataField),e.removeGroup(a.dataField),delete e.columnByDataField[a.dataField]),e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,a),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],a=o.element;o.top=0,o.level=0,a&&(a.style.top="",a.style.height="",a.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const a=e.viewColumns[o];a.visible&&(t+=a.computedWidth)}return t=parseInt(t),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,requestAnimationFrame((()=>{if(e.filtering.enabled&&e.filtering.filterRow.visible)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(t._isUpdating)return;if(t.editing.isEditing)return;const o=t.querySelector("smart-grid-toolbar");if(!o||!o.$.headerDropDown.classList.contains("open"))if(t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&!t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&e.deltaX){const o=t.scrollLeft;if(0===o&&e.deltaX<0||o===t.scrollWidth&&e.deltaX>0)return;e.stopPropagation(),e.preventDefault();let a=3*t.layout.rowMinHeight;e.deltaX<=0&&(a=-3*t.layout.rowMinHeight),Math.abs(e.deltaX)>=100?t._scrollView.scrollLeft+=a:t._scrollView.scrollLeft+=e.deltaX}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=3*t.layout.rowMinHeight;e.deltaY<=0&&(a=-3*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100?t._scrollView.scrollTop+=a:t._scrollView.scrollTop+=e.deltaY}}_refresh(){const e=this;if(e._isUpdating)return;const t=e.$.verticalScrollBar.offsetWidth;e.removeAttribute("grouped"),e.removeAttribute("tree");let o=!0;e.__autoHeightRows&&(e.__autoHeightRows=null,e._refreshColumnsResponsiveVisibility(),e._recycle(),o=!1),e._groups||(e._groups=[]),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>=0&&("advanced"===e.grouping.renderMode?e.setAttribute("grouped",""):e.setAttribute("tree",""),e._groups||(e._groups=[].concat(e.dataSource.groupBy.toArray())||[]),e._renderGroupBar()),e.grouping.enabled&&e.dataSource.groupBy&&0===e.dataSource.groupBy.length?e.$.breadcrumb&&(e.$.breadcrumb.dataSource=[]):e.dataSource.boundHierarchy&&(e.setAttribute("tree",""),e.setAttribute("role","treegrid")),(e.isInitialized||o)&&e._refreshColumnsResponsiveVisibility(),e._refreshLayout(),t!==e.$.verticalScrollBar.offsetWidth&&(e.__scrollWidth=null,e._refreshColumnsResponsiveVisibility(),e._refreshScrollBars(),0===e.$.verticalScrollBar.offsetWidth&&e.isRendered&&requestAnimationFrame((()=>{e._refreshScrollBars()}))),e._refreshSelection(),e._recycle(),e._refreshHeaderBar(),e._recyclingRows&&0===e._recyclingRows.length&&(e.$.placeholder.classList.remove("smart-hidden"),e.scrollHeight=0,e.$.placeholder.innerHTML=e.appearance.placeholder,e.filtering.filterRow.visible&&(e.$.placeholder.style.top="0px",e.$.placeholder.style.position="relative",e._filters&&e._filters.length&&(e.$.placeholder.style.top="12px")),e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${e.localize("filteredRecords")}`)),requestAnimationFrame((()=>{e._width=e.offsetWidth,e._height=e.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return;t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,a=e.$.columnFarContainer;let l=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,u=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(l+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(u+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=l+"px",a.style.width=n+"px",a.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&a.classList.add("smart-hidden"),0===l&&o.classList.add("smart-hidden"),a.classList.remove("border-collapse"),n===u&&a.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=u,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=l,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1)}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let a=0,l=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(l=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,a){for(let u=0;u<t.length;u++){const c=t[u];let m=o.rowById[c.$.id];if(n&&(m=o.rows[s],m||(m=r(c),o.rows.push(m)),c[i.leaf]?m.id=c.$.id:m.id="Group_"+c.$.id,o.rowById[m.id]=m),m||(m=r(c),o.rowById[m.id]=m),m.data=c,m.leaf=c[i.leaf]||!1,m.level=c[i.level],m.groupDataField=c.groupDataField,!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=c.label,m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),c.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),c.parent?(m.parent=o.rowById[c.parent.$.id],m.parentId=c.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(c);e&&(m.expanded=c[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==c[i.expanded]&&(m.expanded=c[i.expanded]);let g=!!e||m.expanded;l&&(g=!0);const p=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(p&&!m.data[p]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];c.parent&&c.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[p])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,g||c[i.leaf])if(a.push(m),c.children&&c.children.length>0){const e=d(c.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)a.push(e[t]);m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(a.push(m),c.children&&c.children.length>0){const e=d(c.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return a};let u=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let a=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const l=e[o];(!l.$||void 0===l.$.filtered||l.$.filtered)&&(a.push(l),l.children&&(a=a.concat(t(l.children))))}return a};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<u.length;o++){let a=u[o],l=!a.$||void 0===a.$.filtered||a.$.filtered;!l&&null!==l||0!==a.level||a.parent||(t(a.children).length,e.push(a))}u=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}o.rowHierarchy=d(u,new Array);let c=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],l=t.canNotify;t.leaf&&c.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=a++:t.visibleIndex=-1:t.visibleIndex=a++,t.canNotify=l}if(l&&(o.rowHierarchy=c),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow&&o._initializeRowElements(),o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,a,l){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:a.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+l+"_"+a.data.$.id,a&&(e.parent=a.data,e.parentId=a.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let a,l,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(a=e.offsetHeight,e.$.container.classList.add("smart-hidden"),l=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||a!==l||e._minHeight&&e._minHeight===a)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible&&(t+=e.layout.rowMinHeight),e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,e.appearance.showViewBar){const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px",e.$.viewBar.style.width=o+"px";let a=0;e.header.visible&&(a+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(a+=e.$.groupHeader.offsetHeight),e.pager.visible&&(a+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=a+"px",e.$.viewBar.style.height=t+"px"}else e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft=""}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let a=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=a+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,a=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,l=e.$.scrollView.offsetWidth,n=e._scrollWidth-l-e._contentBorder.left,i=e._scrollHeight-a-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),u=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=u,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=a+"px",e.computedVerticalScrollBarVisibility?(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-l-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden"),e.$.scrollView.classList.add("has-vscroll")):e.$.scrollView.classList.remove("has-vscroll"),o.style.width=l+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=l-t.offsetWidth+"px",t.style.height=a-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),a=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-a+"px",t.style.top=a+"px",t.style.setProperty("--smart-scroll-bar-near-size",a+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),a=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-a+"px",t.style.setProperty("--smart-scroll-bar-far-size",a+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||u>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-u+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",u+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",u+e.__scrollBarSize+"px"))),t.refresh(),o.refresh()}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let a=0,l=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((a+l)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?a=n+1:i.top>e?l=n-1:a=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(a=>{let l=0,n=a.length-1;if(e<=0)return 0;const i=(a.length-1)*t;if(-1!==i&&i<=e)return a.length-1;for(;;){const a=Math.floor((l+n)/2),i=a*t;if(o(i,e))return a;i<e?l=a+1:i>e?n=a-1:l=a+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getColumns(){const e=this,t=[];if(!e.isInitialized)return t;if(e.columns)for(let o=0;o<e.columns.length;o++){const a=e.columns[o].getState();t.push(a)}return t}resetState(){const e=this;e._isUpdating=0,e.beginUpdate(),e.clearSort(),e.clearFilter(),e.clearGroups(),e.clearSelection(),e.columns.canNotify=!1;let t=[],o=!1;for(let a=0;a<e.columns.length;a++){const l=e.columns[a];l.visible=!0,l.width=180,l.freeze=!1,l.index>=0?t[l.index]=l:t.push(l),l.index!==a&&(o=!0)}o&&(e.columns=t),"grid"!==e.view&&(e.view="grid",e._hideKanbanView()),e.columns.canNotify=!0,e._scrollView.scrollLeft=e._scrollView.scrollTop=0,e.paging.enabled&&(e.paging.pageIndex=0),e.$.headerBar&&e.$.headerBar._setView&&e.$.headerBar._setView("grid"),e.endUpdate(),o&&(e._renderColumns(),e._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;if(t.stateSettings.loading=!0,e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const a=[];if(e.groups){t.dataSource.groupBy=e.groups,t._refreshRowHierarchy();for(let o in e.expandedRows)a["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}t.dataSource&&(t.dataSource._expandedRowIds=a)}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());for(let o=0;o<e.columns.length;o++){const a=e.columns[o];if(a.dataField){const e=t.columnByDataField[a.dataField];e&&(a.width?e.width=a.width:e.width=180,e.freeze=void 0!==a.freeze&&a.freeze,e.visible=void 0===a.visible||a.visible)}}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const a=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let l=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=l;for(let o in e.sort)if(e.sort[o]){const a=e.sort[o].sortOrder,l=t.columnByDataField[o];t.sortBy(l.dataField,a)}t.appearance.allowSortAnimation=a}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){const a=e.filter[o];a&&t.addFilter(o,a,!1)}}o&&(t.endUpdate(!1,!1),t._refresh());let a=!1;e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(a=!0),t._stackedBy=e.kanban.stackedBy),(a||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&t.$.headerBar._setView(e.view,!0),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.name&&(t.stateSettings.current=e.name),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let a=o.getCurrentState(),l=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",a&&l)for(let e in l)a[l[e]]=n[l[e]];else a=n;function r(e,t=0,o=10){if(t>o)return"Object";const a={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let l in e){let n=e[l];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){a[l]=n;continue}if(n&&Array.isArray(n)&&0===n.length){a[l]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==l&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}a[l]=n}return t?a:JSON.stringify(a)}a.name=i,o.stringify_object=r;const s=r(a);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]=a,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)&&o.stateSettings.onStateChange(a,i,o.stateSettings.storage,r),a}autoSaveState(){const e=this;e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,a=!e||e&&e.includes("filter")?t.getFilteredColumns():null,l=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells():null,i=!e||e&&e.includes("selection")?t.getSelectedRows():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null;let s=0;r&&(s=r.pagesCount);const d={sort:o,filter:a,groups:l,paging:{count:s,index:t.paging.pageIndex,size:t._pageSize},selectedCells:n,selectedRows:i};t.header.visible&&t.header.buttons.indexOf("views")>=0&&(d.kanban=t.getKanbanState(),d.view=t.view);const u=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];u.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}d.columns=u}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}d.expandedRows=e}if(e){const t={};for(let o in e){const a=e[o];d[a]&&(t[a]=d[a])}return t}return d}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,t,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,a=e.top+e.height,l=o<=t&&a>t;return 0!==e.height&&l}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),0===o.columns.length&&o.column.element.classList.add("smart-hidden"),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const a=t.viewColumns[o];if(a.visible)return a===e}return!1}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let o in e._cachedTemplates)t.appendChild(e._cachedTemplates[o]);e._tableCachedTemplates.appendChild(t)}}_recycle(e,t,o){const a=this;if(a._layoutSuspended||!1===a.isAttached)return;if(a._isUpdating)return;if(a.editing.isEditing&&(a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect();const l=a._scrollView.scrollTop;let n,i=a._getRowIndexByPosition(l),r=a._recyclingRows,s=r[i],d=s?s.top:0,u=0,c=0,m=0,g=0;if(a._cellRowSpan&&a._cellRowSpan.maxSpan>0){let e=0;if(i>=5?e=5:i>=4?e=4:i>=3?e=3:i>=2?e=2:i>=1&&(e=1),e>0){const t=r[i-e];t&&(s=t,d=s?s.top:0,m=e*s.height,i-=e)}}a._cellRowSpan=[];for(let e=0;e<a._cellsMerge.length;e++){const t=a._cellsMerge[e],o=r.indexOf(t.row);if(i>o&&i<=o+t.rowSpan&&(i=o,s=t.row,m=Math.max(m,d-s.top),d=s.top,a.$.rowContainer.style.top=a.__frozenNearHeight-l+d+"px"),t.colSpan>1)for(let e=0;e<a.viewColumns.length;e++){const o=a.viewColumns[e];let l=o.autoGenerated?o:a.columnByDataField[o.dataField];if(l.visible&&l.left+l.computedWidth-a._scrollView.scrollLeft>=u&&l.left-l.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){let e=a.columnByDataField[t.column.dataField];g=Math.max(g,l.left-e.left+l.computedWidth);break}}}a.isHScrolling&&a._clearCachedTemplates();let p=null;if(!1!==e||a._cellsMerge.length>0){for(let e=0;e<a._columnElements.length;e++){const t=a._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<a._columnGroups.length;e++){const t=a._columnGroups[e],o=t.element;o&&(a.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px")}a._firstVisibleColumn=null,a._lastVisibleColumn=null;for(let e=0;e<a.viewColumns.length;e++){let t=a.viewColumns[e];if(t.visible&&(a._firstVisibleColumn||(a._firstVisibleColumn=t),a._lastVisibleColumn=t),t.element&&(t===a._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-a._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){const o=a._columnElements[c++];o&&(o.set("column",t,!1),o.parentNode||a.$.columnContainer.appendChild(o),p||(p=t,a._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===n&&(n=t.left))}}}if(void 0===n&&(n=0),a.rightToLeft){const e=a._scrollView.scrollWidth-a._scrollView.scrollLeft-a._scrollView.vScrollBar.offsetWidth;a.$.columnContainer.style.right=e+"px",e<=0&&!a._scrollView.scrollWidth&&(a.$.columnContainer.style.right=-a.offsetWidth+a._computedColumnsWidth+"px")}else a.$.columnContainer.style.left=-a._scrollView.scrollLeft+"px";if(a.$.rowContainer.style.top=a.__frozenNearHeight-l+d+"px",a.isScrolling&&!a.isHScrolling&&(a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!a._rowElements)return;const h=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&a.dataSource.length>a.virtualModeCachedRowsCount&&"infinite"!==a.scrolling;if(i>=0){c=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;h&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(l),d=t*a.rows[0].height,a.$.rowContainer.style.top=a.__frozenNearHeight-l+d+"px",a.paging.enabled||(i=0)),a.paging.enabled&&(t=a.paging.pageIndex*a._pageSize));for(let o=i;o<r.length;o++){const n=r[o];if(0===n.height||!n.visible||!1===n.filtered||n.freeze&&n.visible)continue;const s=n.height;if(n.expandHeight&&(e+=a.offsetHeight+n.expandHeight),!(d+s>=l-m&&d<=l+e||a._autoHeight))break;{const e=a._rowElements[c++];if(!e)break;if(e.setAttribute("aria-rowindex",t+o+1),n.element=e,n.grid=a,h){if(n.index=o+t,n.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=n.canNotify;n.canNotify=!1,n.selected=e.indexOf(n.index)>=0,n.canNotify=t}a.paging.enabled?(n.data=a.dataSource[i+c-1],n.data&&(n.id=n.data.$.id,a.rowById[n.id]=n)):(n.data=a.dataSource[c-1],n.data&&(n.id=n.data.$.id,a.rowById[n.id]=n))}n.render()}d+=s}}a._renderFrozenRows();let f=c;if(c<a._rowElements.length)for(let e=c;e<a._rowElements.length;e++){const e=a._rowElements[c++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}a.editing.addNewRow&&a.editing.addNewRow.visible&&"button"===a.editing.addNewRow.displayMode&&a._rowElements[f]&&(a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0})),a._newRow.element=a._rowElements[f],a._newRow.element.classList.remove("smart-hidden"),a._newRow.render()),h&&a._selection.selectionRect&&a._refreshCellSelectionRect()}_renderFrozenRows(){const e=this;let t=!1,o=!1;0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const a=e._frozenNearRows[o];a.visible||(a.element=e.$.rowNearContainer.children[o],a.element||(a.element=a.createElement(),e.$.rowNearContainer.appendChild(a.element)),a.element.classList.add("smart-hidden")),a.visible&&a.filtered&&(t=!0,a.element=e.$.rowNearContainer.children[o],a.element||(a.element=a.createElement(),e.$.rowNearContainer.appendChild(a.element)),a.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const a=e._frozenFarRows[t];a.visible&&(o=!0),a.element=e.$.rowFarContainer.children[t],a.element||(a.element=a.createElement(),e.$.rowFarContainer.appendChild(a.element)),a.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const a=e.rows;a&&null!==a&&0!==a.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e._filters&&e._filters.length&&e.filtering.filterRow.visible&&e.$.rowNearContainer.classList.remove("smart-hidden"))}_recycleRotate(e,t,o,a,l){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=l,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==a&&""!==a||(s=4),"center"!==a&&"middle"!==a||(s+=i.height/2-n.height/2),"bottom"===a&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let a=-1,l=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:a+e;t.classList.contains("smart-hidden")||(-1===a&&(a=i),-1!==i&&(l=1+i))}0===o._rowElements.length&&(a=0,l=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(a=1/0,l=1/0):(a=0,l=o.dataSource.length);l!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(l=Math.min(l,o.dataSource.length)),o.paging.enabled&&(a=o.paging.pageIndex*o._pageSize,l=a+o._pageSize),o._toggledRow||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:a,last:l,edit:o._editInfo,sorting:o.getSortedColumns(),filtering:o.getFilteredColumns(),grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action)return void(t&&t(e.result));if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const a=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling)o._recycle(!1,!1);else{const t=e.first>=0?e.first:0,a=e.last!==1/0?e.last:0;let l=0;for(let e=t;e<a;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[l++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){if(o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize)),o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1)}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=a,o._onDataUpdated&&o._onDataUpdated()}),n)}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=e.appearance.showViewBar?10+e.layout.viewBarWidth+"px":"",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const a=e.columns[o];void 0!==a.defaultValue&&(t[a.dataField]=a.defaultValue)}e._addingNewRow=!0,e._add(t),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max,e.closeMenu(),e._addingNewRow=!1}),0)},t}addColumn(e){const t=this;if(e){if("string"==typeof e){const o=t._getKanbanTaskField(e);return void(o&&t.columns.push(o))}t.columns.push(e)}}addNewColumn(e){e&&this.columns.push(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.remove(),void delete t.editing.addNewRow._addButton;if("float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)?t.editing.addNewRow._addButton.classList.remove("float"):t.computedVerticalScrollBarVisibility?t.computedVerticalScrollBarVisibility&&"float"===e&&t.editing.addNewRow._addButton.classList.add("float"):t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="")};t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&(t.editing.addNewRow._addButton?requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.style.left=t.appearance.showViewBar?10+t.layout.viewBarWidth+"px":"",o())})):(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.appendChild(t.editing.addNewRow._addButton),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o())}))))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if(t._recycle(!1),t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")})))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,a=o.rowById[e];a&&(a.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const a=this,l=a.rowById[e];if(l){const e=l.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,a._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const a=e.columns[o];t.push({name:a.dataField,dataType:a.dataType||"string"}),a.displayField!==a.dataField&&t.push({name:a.displayField,dataType:a.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e){const t=this;t.isInitialized&&(e&&(t._initializeRows(),t._initializeRowElements()),t._refresh(),t._refreshSummary())}refreshView(){const e=this;e._recycleFiles=!0,e._recycle(),delete e._recycleFiles}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t){const o=this;o._isUpdating--,o._isUpdating<0&&(o._isUpdating=0),!1!==e?o.refresh():!1!==t&&o.refreshView()}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const a=t[o];"constructor"!==a&&(Smart.Grid.prototype[a]=e.prototype[a])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
66
66
  Smart("smart-menu-item",class extends Smart.BaseElement{static get properties(){return{checked:{value:!1,type:"boolean"},label:{value:"",type:"any"},level:{value:null,type:"number?"},separator:{value:!1,type:"boolean"},shortcut:{value:"",type:"string"},value:{value:null,type:"any"}}}get enableShadowDOM(){return!1}template(){return""}ready(){const e=this;if(super.ready(),e.$.addClass("smart-unselectable"),e.setAttribute("role","menuitem"),e.checked&&e.setAttribute("aria-checked",!0),!1===e.isDirty)return;const t=e.closest("smart-menu, smart-tree");t&&t.isRendered&&(cancelAnimationFrame(Smart.Menu.processTimer),Smart.Menu.processTimer=requestAnimationFrame((()=>{t._lazyInitItems()})))}propertyChangedHandler(e,t,n){const o=this;if(super.propertyChangedHandler(e,t,n),"smart-tree-item"===o.tagName.toLowerCase())return;const i=o.menu,r=o.parentItem,a=r||i;if("label"===e)return""===n?void(o.label=t):(o.setAttribute("aria-label",n),void(i&&i._setItemLabel(o,n)));if(!i)return;if("separator"===e)return void i._refreshCheckableItems(a);if("disabled"!==e||!1===n||!o.checked)return;super.propertyChangedHandler(e,t,n),o.checked=!1;const s=a.checkMode;"radioButton"===s?i._validateRadioButtonSelection(r,o.level,[]):"checkbox"!==s&&i._refreshCheckableItems(a)}}),Smart("smart-menu-items-group",class extends Smart.BaseElement{static get properties(){return{checkable:{value:!1,type:"boolean"},checked:{value:!1,type:"boolean"},checkMode:{value:"checkbox",type:"string"},dropDownHeight:{value:null,type:"number?"},expanded:{value:!1,type:"boolean"},label:{value:"",type:"any"},level:{value:null,type:"number?"},separator:{value:!1,type:"boolean"},value:{value:null,type:"any"}}}get enableShadowDOM(){return!1}template(){return""}ready(){const e=this;if(super.ready(),e.$.addClass("smart-unselectable"),e.setAttribute("role","menuitem"),e.setAttribute("aria-haspopup",!0),e.setAttribute("aria-expanded",e.expanded),e.checked&&e.setAttribute("aria-checked",!0),!1===e.isDirty)return;const t=e.closest("smart-menu, smart-tree");t&&t.isRendered&&(cancelAnimationFrame(Smart.Menu.processTimer),Smart.Menu.processTimer=requestAnimationFrame((()=>{t._lazyInitItems()})))}propertyChangedHandler(e,t,n){const o=this;if(super.propertyChangedHandler(e,t,n),"smart-tree-items-group"===o.tagName.toLowerCase())return;const i=o.menu,r=o.parentItem,a=r||i;if("label"===e)return""===n?void(o.label=t):(o.setAttribute("aria-label",n),void(i&&i._setItemLabel(o,n)));if(i&&-1!==["checkable","checkMode","disabled","separator"].indexOf(e))switch(e){case"checkable":n?o.itemContainer.setAttribute("checkable",""):o.itemContainer.removeAttribute("checkable"),i._isContainerOpened(o.container.level,o.container)&&"tree"!==i.mode&&!i._minimized&&i._closeSubContainers(o.level+2),i._updateItemRoles(o);break;case"checkMode":o.itemContainer.setAttribute("check-mode",n),i._changeToRadioButtonMode(n,o.itemContainer,o),i._updateItemRoles(o);break;case"disabled":{if(Smart.ListMenu&&i instanceof Smart.ListMenu){if(i._view)for(;o.contains(i._view);)i._backButtonClickHandler()}else i._isContainerOpened(o.container.level,o.container)&&i._closeSubContainers(o.level+1,o.container);if(!o.checked)return;o.checked=!1;const e=a.checkMode;"radioButton"===e?i._validateRadioButtonSelection(r,o.level,[]):"checkbox"!==e&&i._refreshCheckableItems(a);break}case"separator":i._refreshCheckableItems(a)}}}),Smart("smart-menu",class extends Smart.BaseElement{static get properties(){return{autoCloseDelay:{value:100,type:"number"},autoFocusOnMouseenter:{value:!1,type:"boolean"},checkable:{value:!1,type:"boolean"},checkboxes:{value:!1,type:"boolean"},checkMode:{value:"checkbox",type:"string"},closeAction:{value:"up",allowedValues:["up","down","none"],type:"string"},disableAutoCheck:{value:!1,type:"boolean"},dataSource:{value:null,type:"array?",reflectToAttribute:!1},displayMember:{value:"label",type:"string"},dropDownAppendTo:{value:null,type:"any?"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPosition:{value:"auto",allowedValues:["top-left","top-right","bottom-left","bottom-right","overlay-left","overlay-right","auto"],type:"string"},enableMouseWheelAction:{value:!1,type:"boolean"},innerHTML:{type:"string",reflectToAttribute:!1},itemsMember:{value:"items",type:"string"},minimizeIconTemplate:{value:null,type:"string?"},minimizeWidth:{value:null,type:"number?"},mode:{value:"horizontal",allowedValues:["horizontal","vertical","dropDown","tree"],type:"string"},opened:{value:!1,type:"boolean"},overflow:{value:"auto",allowedValues:["auto","hidden","scroll"],type:"string"},preventCloseOnCheck:{value:!1,type:"boolean"},selectionMode:{value:"click",allowedValues:["click","mouseenter"],type:"string"},valueMember:{value:"value",type:"string"}}}static get listeners(){return{"container.click":"_selectionHandler",keydown:"_keydownHandler",mouseenter:"_mouseenterHandler",mouseleave:"_mouseleaveHandler","container.mouseout":"_mouseoutMouseoverHandler","container.mouseover":"_mouseoutMouseoverHandler",resize:"_resizeHandler",transitionend:"_transitionendHandler","hamburgerIcon.click":"_hamburgerIconClickHandler","mainContainer.click":"_mainContainerHandler","mainContainer.mouseleave":"_mainContainerHandler","mainContainer.mouseout":"_mainContainerHandler","mainContainer.mouseover":"_mainContainerHandler","document.down":"_documentDownHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.RepeatButton":"smart.button.js"}}static get styleUrls(){return["smart.button.css","smart.menu.css"]}get items(){return this._menuItems}template(){return'<div id="container" role="presentation">\n <div id="minimizedHeader" class="smart-header smart-minimized-header smart-hidden" role="presentation">\n <div id="hamburgerIcon" class="smart-hamburger-icon smart-hidden" role="button" aria-label="Toggle minimized menu" aria-haspopup="true">\n <div id="hamburgerIconLineTop" class="smart-hamburger-icon-line smart-hamburger-icon-line-top" role="presentation"></div>\n <div id="hamburgerIconLineCenter" class="smart-hamburger-icon-line smart-hamburger-icon-line-center" role="presentation"></div>\n <div id="hamburgerIconLineBottom" class="smart-hamburger-icon-line smart-hamburger-icon-line-bottom" role="presentation"></div>\n <div id="customIconContainer" class="smart-hamburger-icon-custom-container smart-hidden" role="presentation"></div>\n </div>\n </div>\n <smart-repeat-button id="scrollButtonNear" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable right-to-left="[[rightToLeft]]">\n <div id="arrowNear" class="smart-arrow" aria-hidden="true"></div>\n </smart-repeat-button>\n <div id="mainContainer" class="smart-menu-main-container" role="presentation">\n <content></content>\n </div>\n <smart-repeat-button id="scrollButtonFar" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable right-to-left="[[rightToLeft]]">\n <div id="arrowFar" class="smart-arrow" aria-hidden="true"></div>\n </smart-repeat-button>\n </div>'}attached(){const e=this;if(super.attached(),!e.isCompleted||!e.isRendered||"tree"===e._element||Smart.ListMenu&&e instanceof Smart.ListMenu)return;const t=e._scrollInfo;if(null!==e.dropDownAppendTo){if(e._minimized)e._dropDownParent.appendChild(e.$.mainContainer);else for(let t=0;t<e._containersInBody.length;t++)e._dropDownParent.appendChild(e._containersInBody[t]);"dropDown"===e.mode&&(e._dropDownParent===e.parentElement?e._dynamicallyReparented?delete e._dynamicallyReparented:e._positionRelativeTo=null:(e._positionRelativeTo=e.parentElement,e._dynamicallyReparented=!0,setTimeout((function(){e._dropDownParent.appendChild(e)}),0)))}t&&t.forEach((function(e,t){t.scrollLeft=e.left,t.scrollTop=e.top}))}detached(){const e=this;super.detached(),"tree"===e._element||Smart.ListMenu&&e instanceof Smart.ListMenu||(e._close(),null!==e.dropDownAppendTo&&(e._minimized?e._dropDownParent.removeChild(e.$.mainContainer):e._removeContainersInBody()))}ready(){super.ready()}render(){const e=this;e._element="menu",e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._containers=[],e._containersInBody=[],e._openedContainers=[],e._containersFixedHeight=[],e._menuItemsGroupsToExpand=[],e._additionalScrollButtons=[],e._scrollInfo=new Map,e._createElement(),super.render()}addItem(e,t){const n=this;if(!(e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup))if("string"==typeof e){const t=document.createElement("smart-menu-item");t.label=e,e=t}else{if(!e||!e.label)return;{const t=document.createElement("smart-menu-item");t.label=e.label,e=t}}let o,i,r;if(e.isDirty=!1,void 0===t)o=n,i=1,r=t=n.$.mainContainer;else{if((t=n.getItem(t))instanceof Smart.MenuItemsGroup==0)return;o=t,i=t.level+1,r=t.itemContainer}if(n._createItemHTMLStructure(e,i,t,r.childElementCount,0),e instanceof Smart.MenuItemsGroup&&(n._processHTML(e,i+1),n._checkContainersLength()),r.appendChild(e),n._checkOverflowAddRemove(e.level,r),e instanceof Smart.MenuItemsGroup&&("tree"===n.mode||n._minimized)){const t=e.getElementsByClassName("smart-menu-items-group-arrow");for(let e=0;e<t.length;e++)t[e].className="smart-menu-items-group-arrow down smart-arrow-down";n._expandItemsByDefault()}n._refreshCheckableItems(o)}checkItem(e){void 0===(e=this.getItem(e))||e.checked||e.disabled||e.templateApplied||this._toggleItem(e)}clear(){const e=this;e.$.mainContainer.innerHTML="",e._removeContainersInBody(),e._menuItems={},e._containers=[],e._containersInBody=[],e._openedContainers=[],e._containersFixedHeight=[],e._menuItemsGroupsToExpand=[],e._additionalScrollButtons=[]}clickItem(e){const t=this;"string"==typeof e&&(e=t.getItem(e)),e&&e.nodeName&&t._selectionHandler({type:"click",isTrusted:!0,target:e,stopPropagation:()=>{},preventDefault:()=>{}})}close(){const e=this;"dropDown"!==e.mode||!1===e.opened&&e.$.hasClass("smart-visibility-hidden")||(e.$.fireEvent("closing",arguments[0]||{trigger:"programmatic"}).defaultPrevented?e.opened=!0:(e.opened=!1,e.$.addClass("smart-visibility-hidden"),e._close(),e.$.fireEvent("close")))}collapseItem(e,t){const n=this,o=n.animation,i=!1===t&&n.hasAnimation;if(void 0===e)return i&&(n.animation="none"),n._close(),void(i&&setTimeout((function(){n.animation=o}),0));if(void 0===(e=n.getItem(e))||e instanceof Smart.MenuItem)return;const r=e.level;if(n._openedContainers[r+1]&&n._isContainerOpened(r+1,e.container)){const t=n.mode;i&&(n.animation="none"),n._closeSubContainers(r+1,e.container,void 0,!1!==arguments[2]),1!==r&&"tree"!==t||n._checkOverflow(n.$.mainContainer,"horizontal"===t,[n.$.scrollButtonNear,n.$.scrollButtonFar]),i&&(n.animation=o)}}expandItem(e,t){const n=this;if(void 0===(e=n.getItem(e))||e instanceof Smart.MenuItemsGroup&&n._isContainerOpened(e.level+1,e.container)&&n._isBranchExpanded(e))return;void 0!==Smart.Menu.processTimer&&n._lazyInitItems();const o=[e],i=n.animation,r=!1===t&&n.hasAnimation;let a=e.parentItem;for(r&&(n.animation="none"),n._discardKeyboardHover();a;)o.unshift(a),a=a.parentItem;for(let e=0;e<o.length;e++){const t=o[e];if(e===o.length-1&&t instanceof Smart.MenuItem){t.disabled||t.templateApplied||n._hoverViaKeyboard(t);break}n._isContainerOpened(t.container.level,t.container)||n._menuItemsGroupSelectionHandler(t,{target:t,type:"expand",isTrusted:!0},arguments[2])}r&&(n.animation=i)}getItem(e){const t=this;let n;if(null!=e&&t._menuItems){if("string"==typeof e){if(/^[0-9]*([.]?[0-9]*)*$/gm.test(e))return t._menuItems[e];if(n=t.$.mainContainer.querySelector('[id="'+e+'"]'),null===n)return t._menuItems[e]}else{if(!isNaN(e))return t._menuItems[e.toString()];n=e}if((n instanceof Smart.MenuItem||n instanceof Smart.MenuItemsGroup)&&(t.contains(n)||t.$.mainContainer.contains(n)||n.parentElement.parentElement.ownerElement===t))return n}}maximize(){const e=this;if(!e._minimized)return;const t=e.animation;if(e.$.mainContainer.style.marginTop="",e.$.mainContainer.style.marginLeft="",e.enableShadowDOM&&!e.$.mainContainer.id&&(e.$.mainContainer.id=e.$.mainContainer.getAttribute("smart-id")),"none"!==t&&(e.animation="none"),e._positionDetection.removeOverlay(),e._closeSubContainers(2),e.$minimizedHeader.addClass("smart-hidden"),e._minimized=!1,e._minimizedDropDownOpened&&(e.$hamburgerIcon.removeClass("smart-close-button"),e._minimizedDropDownOpened=!1),null!==e.dropDownAppendTo&&e._appendMinimizedContainerToMenu(e.$.mainContainer,e.$.scrollButtonFar),"tree"!==e.mode){e.$mainContainer.addClass("smart-menu-main-container"),e.$mainContainer.removeClass("smart-menu-minimized-items-container");const t=e.$.mainContainer.getElementsByClassName("smart-menu-items-group-arrow");for(let n=0;n<t.length;n++)e._setArrowDirection(t[n],t[n].parentElement.parentElement.level+1);null!==e.dropDownAppendTo&&e._moveDropDownsToExternalContainer(),e._applyContainerFixedHeight()}e.$mainContainer.removeClass("smart-visibility-hidden"),e.$hamburgerIcon.addClass("smart-hidden"),e.removeAttribute("minimized"),e._checkOverflow(e.$.mainContainer,"horizontal"===e.mode,[e.$.scrollButtonNear,e.$.scrollButtonFar]),"none"!==t&&setTimeout((function(){e.animation=t}),0),e.$.mainContainer.removeAttribute("drop-down"),e.$.hamburgerIcon.removeAttribute("aria-expanded"),e.$.hamburgerIcon.removeAttribute("aria-owns"),e.$.mainContainer.setAttribute("role","presentation"),e.$.mainContainer.removeAttribute("aria-orientation"),e.setAttribute("role","menu"),e.setAttribute("aria-orientation","horizontal"===e.mode?"horizontal":"vertical")}minimize(){const e=this;if(e._minimized||"dropDown"===e.mode)return;e.$minimizedHeader.removeClass("smart-hidden");const t=null!==e.dropDownAppendTo,n=e.animation,o=e.hasAnimation;if(o&&(e.animation="none"),e._positionDetection.removeOverlay(),e._closeSubContainers(2),o&&t&&(e.animation=n),"tree"!==e.mode&&(t&&e._moveDropDownsToMenu(),e._removeContainerFixedHeight()),e._hideMainContainerScrollButtons(),e.$mainContainer.removeClass("smart-menu-main-container"),e.$mainContainer.addClass("smart-visibility-hidden"),e.enableShadowDOM&&e.$.mainContainer.removeAttribute("id"),e._edgeMacFF&&(e.$.mainContainer.style.left="",e.$.mainContainer.style.top="",e.$mainContainer.addClass("not-in-view")),e.$hamburgerIcon.removeClass("smart-hidden"),t&&e._appendMinimizedContainerToExternalElement(e.$.mainContainer),setTimeout((function(){e.$mainContainer.addClass("smart-menu-minimized-items-container"),o&&!t&&(e.animation=n)}),0),e._minimized=!0,e.setAttribute("minimized",""),"tree"!==e.mode)for(let t=0;t<e._containers.length;t++){const n=e._containers[t];n.level>2&&e._setArrowDirection(n.menuItemsGroup.children[0].children[1],n.level)}e.$.mainContainer.setAttribute("drop-down",""),e.setAttribute("role","presentation"),e.removeAttribute("aria-orientation"),e.$.hamburgerIcon.setAttribute("aria-expanded",!1),e.$.hamburgerIcon.setAttribute("aria-owns",e.$.mainContainer.id),e.$.mainContainer.setAttribute("role","menu"),e.$.mainContainer.setAttribute("aria-orientation","vertical")}open(e,t){const n=this;if("dropDown"!==n.mode)return;if(n.$.fireEvent("opening").defaultPrevented)return void(n.opened=!1);let o;if(n.opened=!0,n._positionRelativeTo){const i=n._positionRelativeTo.getBoundingClientRect();e+=i.left,t+=i.top,n._positionedParent?(o=n._positionedParent.getBoundingClientRect(),e-=o.left,t-=o.top):(e+=window.pageXOffset,t+=window.pageYOffset)}let i=e+n.offsetWidth-document.documentElement.clientWidth,r=t+n.offsetHeight-document.documentElement.clientHeight;o?(i+=o.left,r+=o.top):(i-=window.pageXOffset,r-=window.pageYOffset),i>0?e-=i:e=o?Math.max(e,-o.left):Math.max(e,window.pageXOffset),r>0?t-=r:t=o?Math.max(t,-o.top):Math.max(t,window.pageYOffset),n.style.right="",isNaN(e)||(n.rightToLeft&&(n.style.right="initial"),n.style.left=e+"px"),isNaN(t)||(n.style.top=t+"px"),n.$.removeClass("smart-visibility-hidden"),n.$.fireEvent("open"),n.hasAnimation||(n._checkOverflowOnOpen&&(n._checkOverflow(n.$.mainContainer,!1,[n.$.scrollButtonNear,n.$.scrollButtonFar]),delete n._checkOverflowOnOpen),n._noAutoFocus||n.focus())}removeItem(e){const t=this;if(void 0===(e=t.getItem(e)))return;const n=e.parentElement,o=e.parentItem||t;if(e instanceof Smart.MenuItemsGroup){const n=e.container;if(t._isContainerOpened(n.level,n)&&t._closeSubContainers(n.level,n),1===e.level){const e=t._containersInBody.indexOf(n);-1!==e&&(t._containersInBody.splice(e,1),null===t.dropDownAppendTo||"tree"===t.mode||t._minimized||t._dropDownParent.removeChild(n))}}n.removeChild(e),t._refreshContainersArrays(),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0),t._checkOverflowAddRemove(e.level,n),t._refreshCheckableItems(o)}uncheckItem(e){void 0===(e=this.getItem(e))||!e.checked||e.disabled||e.templateApplied||this._toggleItem(e)}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const o=this;if("tree"!==o._element)switch(e){case"animation":o.$.mainContainer.setAttribute("animation",n),o._additionalScrollButtons.forEach((function(e){e[0].animation=n,e[1].animation=n})),null!==o._dropDownParent&&o._containers.forEach((function(e){e.setAttribute("animation",n)}));break;case"checkable":"tree"===o.mode||o._minimized?o._minimized&&null!==o.dropDownAppendTo&&r("checkable",o.$.mainContainer,n):o._closeSubContainers(2),o._updateItemRoles(o);break;case"checkboxes":if(o._close(),null!==o.dropDownAppendTo){for(let e=0;e<o._containers.length;e++)r("checkboxes",o._containers[e],n);o._minimized&&r("checkboxes",o.$.mainContainer,n)}o._updateItemRoles();break;case"checkMode":o._changeToRadioButtonMode(n,o.$.mainContainer),o._minimized&&null!==o.dropDownAppendTo&&o.$.mainContainer.setAttribute("check-mode",n),o._updateItemRoles(o);break;case"dataSource":{let e=!1;o._minimized&&(o.maximize(),e=!0),o._removeContainersInBody(),o._containersInBody=[],o._menuItems={},o._processDataSource(),o._checkContainersLength(),e?o.minimize():i(),o._expandItemsByDefault(),o._refreshCheckableItems(),o._suppressResizeHandler=!0,setTimeout((()=>delete o._suppressResizeHandler),500);break}case"innerHTML":o.$.mainContainer.innerHTML=n,o._lazyInitItems();break;case"dropDownAppendTo":{const e=o._dropDownParent;if(o._positionDetection.getDropDownParent(),o._dropDownParent===e||"tree"===o.mode&&!o._minimized)return;if(o._close(),o._minimized)return void(null===n?o._appendMinimizedContainerToMenu(o.$.mainContainer,o.$.scrollButtonFar):o._appendMinimizedContainerToExternalElement(o.$.mainContainer));if(null!==o._dropDownParent&&null===e)o._moveDropDownsToExternalContainer();else if(null===o._dropDownParent&&null!==e)o._moveDropDownsToMenu();else if(null!==o._dropDownParent&&null!==e)for(let e=0;e<o._containersInBody.length;e++)o._dropDownParent.appendChild(o._containersInBody[e]);null!==n||o.$mainContainer.hasClass("simple")?o._checkOverflow(o.$.mainContainer,"horizontal"===o.mode,[o.$.scrollButtonNear,o.$.scrollButtonFar]):o._hideMainContainerScrollButtons();for(let e=0;e<o._containersFixedHeight.length;e++)o._containersFixedHeight[e].itemContainer.checkOverflow=!0;"dropDown"===o.mode&&(o.close({trigger:"internal"}),o._reparentMenu(!0,e));break}case"dropDownOverlay":n||o._positionDetection.removeOverlay();break;case"disabled":n&&o._close(),o._setFocusable(),o.$.scrollButtonNear.disabled=n,o.$.scrollButtonFar.disabled=n,n||null===o.dropDownAppendTo&&!o.$mainContainer.hasClass("simple")&&"tree"!==o.mode||o._updateScrollButtonVisibility(o.$.mainContainer,"horizontal"===o.mode,[o.$.scrollButtonNear,o.$.scrollButtonFar]);break;case"dropDownPosition":case"mode":{if("mode"===e){if(delete o._dynamicallyReparented,"tree"===t||o._minimized?(o._closeSubContainersTreeMode(2,void 0,void 0,void 0,!0),o._openedContainers=[]):o._closeSubContainersDefaultMode(2),o._discardKeyboardHover(!0),o._minimized&&o._minimizedDropDownOpened&&(o.$mainContainer.addClass("smart-visibility-hidden"),o.$hamburgerIcon.removeClass("smart-close-button"),o.$.hamburgerIcon.setAttribute("aria-expanded",!1),o._minimizedDropDownOpened=!1),"horizontal"!==n&&"horizontal"!==t||o._changeScrollButtonsArrows(),o._minimized)return void("dropDown"===n&&(o.mode=t));o.setAttribute("aria-orientation","horizontal"===o.mode?"horizontal":"vertical"),!1===o.opened&&("dropDown"===n?o.$.addClass("smart-visibility-hidden"):"dropDown"===t&&o.$.removeClass("smart-visibility-hidden")),"tree"===t?(null!==o.dropDownAppendTo&&o._moveDropDownsToExternalContainer(),o.$mainContainer.addClass("smart-menu-main-container"),o.$mainContainer.removeClass("smart-menu-minimized-items-container"),o._applyContainerFixedHeight()):"tree"===n&&(null!==o.dropDownAppendTo&&o._moveDropDownsToMenu(),o._applyTreeMode()),"auto"===o.overflow&&o._hideMainContainerScrollButtons(),i()}if("tree"===o.mode||o._minimized)return o._minimizedDropDownOpened&&o._close(),void(o._minimized&&null!==o.dropDownAppendTo&&o.$.mainContainer.setAttribute(o.properties[e].attributeName,n));"dropDownPosition"===e&&o._close();const r=o._containers.map((e=>e.menuItemsGroup));for(let e=0;e<r.length;e++){const t=r[e];o._setArrowDirection(t.children[0].children[1],t.level+1)}if(null!==o.dropDownAppendTo)for(let t=0;t<o._containers.length;t++){const i=o._containers[t];i.setAttribute(Smart.Utilities.Core.toDash(e),n),i.level>2&&o._setArrowDirection(i.menuItemsGroup.children[0].children[1],i.level)}break}case"minimizeIconTemplate":o._applyMinimizeIconTemplate(n,t);break;case"minimizeWidth":o._resizeHandler();break;case"opened":n?o.open():o.close({trigger:"internal"});break;case"overflow":o._handleOverflowChange();break;case"rightToLeft":if("tree"!==o.mode){const e=o._containers.map((e=>e.menuItemsGroup));for(let t=0;t<e.length;t++){const n=e[t];o._setArrowDirection(n.children[0].children[1],n.level+1)}if(null!==o.dropDownAppendTo){n?o.$.mainContainer.setAttribute("right-to-left",""):o.$.mainContainer.removeAttribute("right-to-left");for(let e=0;e<o._containers.length;e++){const t=o._containers[e];n?t.setAttribute("right-to-left",""):t.removeAttribute("right-to-left"),t.level>2&&o._setArrowDirection(t.menuItemsGroup.children[0].children[1],t.level)}}}break;case"theme":if(null===o.dropDownAppendTo||Smart.ListMenu&&o instanceof Smart.ListMenu)return;if(o._minimized)""!==t&&o.$mainContainer.removeClass(t),""!==n&&o.$mainContainer.addClass(n);else for(let e=0;e<o._containers.length;e++){const i=o._containers[e];""!==t&&i.classList.remove(t),""!==n&&i.classList.add(n)}break;case"unfocusable":o._setFocusable()}function i(){null===o.dropDownAppendTo&&"tree"!==o.mode||o._checkOverflow(o.$.mainContainer,"horizontal"===o.mode,[o.$.scrollButtonNear,o.$.scrollButtonFar])}function r(e,t,n){n?t.setAttribute(e,""):t.removeAttribute(e)}}_addOpenedContainer(e,t){const n=this;if("tree"===n.mode||n._minimized){n._openedContainers[e]||(n._openedContainers[e]=[]);const o=t.menuItemsGroup;return o.set("expanded",!0),o.setAttribute("aria-expanded",!0),n._updateState&&n._updateState("expanded",o.id,!0),n._openedContainers[e].push(t)}n._openedContainers[e]=t}_appendMinimizedContainerToExternalElement(e){const t=this;e.ownerElement=t,t._dropDownParent.appendChild(e),e.setAttribute("animation",t.animation),""!==t.theme&&e.$.addClass(t.theme),e.$.addClass("smart-menu-drop-down smart-drop-down"),e.$.addClass("smart-drop-down-repositioned"),e.setAttribute("check-mode",t.checkMode),e.setAttribute("drop-down-position",t.dropDownPosition),e.setAttribute("mode",t.mode),e.setAttribute("loading-indicator-position",t.loadingIndicatorPosition),t.rightToLeft&&e.setAttribute("right-to-left",""),t.checkable&&e.setAttribute("checkable",""),t.checkboxes&&e.setAttribute("checkboxes",""),t.$.view&&t.detachedChildren.indexOf(t.$.view)&&t.detachedChildren.push(t.$.view)}_appendMinimizedContainerToMenu(e,t){const n=this;delete e.ownerElement,n.$.container.insertBefore(e,t),e.removeAttribute("animation"),""!==n.theme&&e.$.removeClass(n.theme),e.$.removeClass("smart-menu-drop-down smart-drop-down"),e.$.removeClass("smart-drop-down-repositioned"),e.removeAttribute("checkable"),e.removeAttribute("checkboxes"),e.removeAttribute("check-mode"),e.removeAttribute("drop-down-position"),e.removeAttribute("mode"),e.removeAttribute("loading-indicator-position"),e.removeAttribute("style"),e.removeAttribute("right-to-left")}_applyContainerFixedHeight(){const e=this;for(let t=0;t<e._containers.length;t++){const n=e._containers[t];-1!==e._containersFixedHeight.indexOf(n)?(n.style.height=n.menuItemsGroup.dropDownHeight+"px",n.itemContainer.checkOverflow=!0):n.style.height=""}}_applyGrouping(e,t){const n=this;let o;o=e===n.$.mainContainer?Array.from(e.children):Array.from(e.container.firstElementChild.children);for(let e=0;e<o.length;e++){const i=o[e];i.originalIndex=e,i instanceof Smart.MenuItemsGroup&&void 0===t&&n._applyGrouping(i)}n._sortItems(e)}_applyMinimizeIconTemplate(e,t){const n=this;if(null===e){if(null===t)return;n.$customIconContainer.addClass("smart-hidden"),n.$.customIconContainer.innerHTML="",n.$hamburgerIconLineTop.removeClass("smart-hidden"),n.$hamburgerIconLineCenter.removeClass("smart-hidden"),n.$hamburgerIconLineBottom.removeClass("smart-hidden")}else{const o=document.getElementById(e);if(null!==o&&"template"===o.tagName.toLowerCase()){const e=document.importNode(o.content,!0);n.$hamburgerIconLineTop.addClass("smart-hidden"),n.$hamburgerIconLineCenter.addClass("smart-hidden"),n.$hamburgerIconLineBottom.addClass("smart-hidden"),n.$.customIconContainer.innerHTML="",n.$.customIconContainer.appendChild(e),n.$customIconContainer.removeClass("smart-hidden")}else n.minimizeIconTemplate=t}}_applyTreeMode(){const e=this,t=e.$.mainContainer.getElementsByClassName("smart-menu-items-group-arrow");if(e.$mainContainer.removeClass("smart-menu-main-container"),e.$mainContainer.addClass("smart-menu-minimized-items-container"),e.isCompleted&&e.isRendered)for(let e=0;e<t.length;e++)t[e].className="smart-menu-items-group-arrow down";e._removeContainerFixedHeight()}_arrowLeftHandler(e,t,n,o){const i=this;1===e?"horizontal"===t&&i._levelOneNavigate("_getLastEnabledChild",n,o):2===e?i._levelOneNavigateFromLowerLevel("_getPreviousEnabledChild",n):i._escapeHandler(n,e,o)}_arrowRightHandler(e,t,n,o){const i=this;1===e?"horizontal"===t?i._levelOneNavigate("_getFirstEnabledChild",n,o):i._levelOneOpenDropDown(n):n instanceof Smart.MenuItemsGroup?i._selectionHandler({target:n,isTrusted:!0}):i._levelOneNavigateFromLowerLevel("_getNextEnabledChild",n)}_browserBoundsDetection(e){const t=this;if("tree"===t.mode&&!t._minimized)return;if(e.style.marginTop="",e.style.marginLeft="","auto"!==t.dropDownPosition)return;const n=1===window.devicePixelRatio?document.documentElement.clientWidth:window.innerWidth,o=1===window.devicePixelRatio?document.documentElement.clientHeight:window.innerHeight,i=e.getBoundingClientRect(),r=n-i.left-e.offsetWidth,a=o-i.top-e.offsetHeight;r<10&&(e.style.marginLeft=Math.min(r-10,-10)+"px"),a<10&&(e.style.marginTop=Math.min(a-10,-10)+"px")}_changeScrollButtonsArrows(){const e=this;"horizontal"===e.mode?(e.$.scrollButtonNear.setAttribute("aria-label","Scroll left"),e.$.scrollButtonFar.setAttribute("aria-label","Scroll right"),e.$arrowNear.removeClass("smart-arrow-up"),e.$arrowFar.removeClass("smart-arrow-down"),e.$arrowNear.addClass("smart-arrow-left"),e.$arrowFar.addClass("smart-arrow-right")):(e.$.scrollButtonNear.setAttribute("aria-label","Scroll up"),e.$.scrollButtonFar.setAttribute("aria-label","Scroll down"),e.$arrowNear.removeClass("smart-arrow-left"),e.$arrowFar.removeClass("smart-arrow-right"),e.$arrowNear.addClass("smart-arrow-up"),e.$arrowFar.addClass("smart-arrow-down"))}_changeToRadioButtonMode(e,t,n){if("radioButton"===e){const e=[];for(let n=0;n<t.childElementCount;n++){const o=t.children[n];!o.checked||o.disabled||o.templateApplied||e.push(o)}this._validateRadioButtonSelection(n,n?n.level+1:1,e)}}_checkContainersLength(e){const t=this;0===t._containers.length?(t.$mainContainer.addClass("simple"),e||t._checkOverflow(t.$.mainContainer,"horizontal"===t.mode,[t.$.scrollButtonNear,t.$.scrollButtonFar])):e||(t.$mainContainer.removeClass("simple"),null===t.dropDownAppendTo&&"tree"!==t.mode&&t.$mainContainer.removeClass("scroll-buttons-shown one-button-shown"))}_checkOverflow(e,t,n){const o=this,i=o.$.mainContainer,r=e===i?o.overflow:"auto";if(o._minimized||"hidden"===r||null===o.dropDownAppendTo&&"tree"!==o.mode&&e===i&&!i.classList.contains("simple"))return;if("dropDown"===o.mode&&!o.opened)return void(o._checkOverflowOnOpen=!0);const a=e.scrollLeft,s=a/(e.scrollWidth-e.offsetWidth),l=e.scrollTop,d=l/(e.scrollHeight-e.offsetHeight);let m,c,u;"auto"===r&&(e.classList.remove("scroll-buttons-shown"),e.classList.remove("one-button-shown"),n[0].$.addClass("smart-hidden"),n[1].$.addClass("smart-hidden")),t?(m=Math.round(e.scrollWidth)>Math.round(e.offsetWidth),c=s>0,u=s<1):(m=Math.round(e.scrollHeight)>Math.round(e.offsetHeight),c=d>0,u=d<1),m?"auto"===r?(e.classList.add("scroll-buttons-shown"),c&&n[0].$.removeClass("smart-hidden"),u&&n[1].$.removeClass("smart-hidden"),!1===(c&&u)&&e.classList.add("one-button-shown"),o.disabled||(n[0].disabled=!1,n[1].disabled=!1),e.scrollLeft=a,e.scrollTop=l):(n[0].$.removeClass("smart-hidden"),n[1].$.removeClass("smart-hidden"),o.disabled?(n[0].disabled=!0,n[1].disabled=!0):(n[0].disabled=!c,n[1].disabled=!u)):"scroll"===r&&(n[0].disabled=!0,n[1].disabled=!0),e===i&&"tree"!==o.mode&&o._close(),o._scrollInfo.set(e,{left:e.scrollLeft,top:e.scrollTop})}_checkOverflowAddRemove(e,t){const n=this;1===e&&null!==n.dropDownAppendTo||"tree"===n.mode?n._checkOverflow(n.$.mainContainer,"horizontal"===n.mode,[n.$.scrollButtonNear,n.$.scrollButtonFar]):e>1&&t.dropDownHeightSet&&(n._isContainerOpened(e,t.container)?n._checkOverflow(t,!1,[t.container.children[0],t.container.children[2]]):t.checkOverflow=!0)}_close(){const e=this;e._positionDetection.removeOverlay(),e._closeSubContainers(2),e._discardKeyboardHover(!0),e._minimized&&e._minimizedDropDownOpened&&(e.$mainContainer.addClass("smart-visibility-hidden"),e._edgeMacFF&&(e.$.mainContainer.style.left="",e.$.mainContainer.style.top="",e.$mainContainer.addClass("not-in-view")),e.$hamburgerIcon.removeClass("smart-close-button"),e.$.hamburgerIcon.setAttribute("aria-expanded",!1),e._minimizedDropDownOpened=!1)}_closeSubContainers(e,t,n,o){const i=this;"tree"===i.mode||i._minimized?i._closeSubContainersTreeMode(e,t,n,o):i._closeSubContainersDefaultMode(e,t,n)}_closeSubContainersDefaultMode(e,t,n){const o=this,i=o._openedContainers;function r(t){const r=i[t].menuItemsGroup;n&&t===e||(r.$.removeClass("focus"),r.removeAttribute("focus"),r.$.removeClass("hover"),r.removeAttribute("hover")),r.$.removeClass("smart-menu-items-group-opened"),r.$.removeClass("smart-menu-items-group-expanded"),r.setAttribute("aria-expanded",!1),i[t].$.addClass("smart-visibility-hidden"),o._edgeMacFF&&2===t&&!o.hasAnimation&&(i[t].style.left="",i[t].style.top="",i[t].$.addClass("not-in-view")),o._minimized&&o._browserBoundsDetection(o.$.mainContainer),o.$.fireEvent("collapse",{item:r,label:r.label,path:r.path,value:r.value,children:r.itemContainer.children}),i[t]=void 0}for(let t=i.length-1;t>=e;t--)void 0!==i[t]&&r(t)}_closeSubContainersTreeMode(e,t,n,o,i){const r=this;if(o){const e=t.menuItemsGroup;if(r.$.fireEvent("collapsing",{item:e,label:e.label,path:e.path,value:e.value,children:t.itemContainer.children}).defaultPrevented)return}if(void 0===t)return void r._collapseAll(!1,i);const a=t.menuItemsGroup;if(a.set("expanded",!1),a.setAttribute("aria-expanded",!1),"menu"===r._element)if(n){const e=r.$.mainContainer.getElementsByClassName("focus")[0];e&&(e.$.removeClass("focus"),e.removeAttribute("focus")),a.$.addClass("focus"),a.setAttribute("focus",""),r._focusedViaKeyboard=a}else a.$.removeClass("focus"),a.removeAttribute("focus");else r._updateState("expanded",a.id,!1);if(a.$.removeClass("smart-"+r._element+"-items-group-opened"),i||!r.hasAnimation?(a.$.removeClass("smart-"+r._element+"-items-group-expanded"),a.setAttribute("aria-expanded",!1),t.$.addClass("smart-visibility-hidden"),r._minimized&&r._browserBoundsDetection(r.$.mainContainer)):r._collapseSection(t),o){const e={item:a,label:a.label,path:a.path,value:a.value,children:a.itemContainer.children};r.toggleCallback?(e.type="collapse",r.toggleCallback(e)):r.$.fireEvent("collapse",e)}if(!r._openedContainers[e])return;const s=r._openedContainers[e].indexOf(t);-1!==s&&r._openedContainers[e].splice(s,1)}_collapseAll(e,t){const n=this;for(let o=n._openedContainers.length-1;o>=2&&void 0!==n._openedContainers[o];o--)for(let i=n._openedContainers[o].length-1;i>=0;i--)n._closeSubContainersTreeMode(o,n._openedContainers[o][i],void 0,e,t);n.hasAnimation||n._checkOverflow(n.$.mainContainer,!1,[n.$.scrollButtonNear,n.$.scrollButtonFar]);for(let e=n._openedContainers.length-1;e>=2;e--){const t=n._openedContainers[e];if(void 0!==t&&0!==t.length)break;n._openedContainers.splice(e,1)}2===n._openedContainers.length&&(n._openedContainers=[])}_collapseSection(e){const t=this,n=e.scrollHeight+"px";t._treeAnimationInProgress=e,e.style.transition="none",requestAnimationFrame((function(){"tree"===t.mode||t._minimized?(e.style.height=n,e.style.transition="",requestAnimationFrame((function(){e.style.height="0px","smart-tree"===t.tagName.toLowerCase()&&e.$.addClass("smart-visibility-hidden"),"0px"===n&&t._transitionendHandlerCollapse(t,e)}))):e.style.transition=""})),e.addEventListener("transitionend",t._transitionendHandlerCollapse)}_createElement(){const e=this,t=e.mode;e.setAttribute("role","menu"),e.$.mainContainer.id=e.id+"MainContainer",e.setAttribute("aria-orientation","horizontal"===e.mode?"horizontal":"vertical"),e._positionDetection=new Smart.Utilities.PositionDetection(e),e._positionDetection.getDropDownParent(),e._reparentMenu(),e.disabled&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList();const n=(e.shadowRoot||e).querySelectorAll("smart-menu-item, smart-menu-items-group"),o=function(){const n=e.animation;e._changeScrollButtonsArrows(),e._setFocusable(),"dropDown"===t&&!1===e.opened&&(e.hasAnimation?(e.animation="none",e.$.addClass("smart-visibility-hidden"),e.animation=n):e.$.addClass("smart-visibility-hidden")),e._menuItems={},e.$.mainContainer.setAttribute("animation",n),null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource(),e._checkContainersLength(!0),null===e.dropDownAppendTo&&!e.$mainContainer.hasClass("simple")&&"tree"!==e.mode||"scroll"!==e.overflow||(e.$mainContainer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility(e.$.mainContainer,"horizontal"===t,[e.$.scrollButtonNear,e.$.scrollButtonFar])),e._applyMinimizeIconTemplate(e.minimizeIconTemplate,null),"tree"===t&&e._applyTreeMode(),null!==e.minimizeWidth&&e.offsetWidth<=e.minimizeWidth?e.minimize():e._checkOverflow(e.$.mainContainer,"horizontal"===t,[e.$.scrollButtonNear,e.$.scrollButtonFar]),e._expandItemsByDefault(),e._refreshCheckableItems(),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===n.length||e.enableShadowDOM||e.isInShadowDOM?o():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(n,o))}_ensureItemsReady(e,t){const n=this,o=function(){const n=function(t){for(let n=0;n<e.length;n++)e[n].context="node"===t?e[n]:document};n("node"),t(),n()};if(0===e.length)o();else{n._nodesReadyListeners=0;for(let t=0;t<e.length;t++){const i=e[t],r=function(){const e=n.context;n.context=n,n._nodesReadyListeners--,0===n._nodesReadyListeners&&(o(),delete n._nodesReadyListeners),n.context=e}.bind(n);i.isCompleted||(n._nodesReadyListeners++,i.completeHandlers=[],i._onCompleted=r)}0===n._nodesReadyListeners&&o()}}_createItemHTMLStructure(e,t,n,o){const i=this,r="smart-"+i._element+"-item-label-container",a="smart-"+i._element+"-item-label-element",s=document.createDocumentFragment(),l=e.children;let d,m,c,u;for(let e=0;e<l.length;e++){const t=l[e];if(t.classList&&(t.classList&&t.classList.contains(r)?d=t:t.classList&&t.classList.contains(a)&&(m=t),d&&m))break}if(d){const t=d.querySelector("."+a);if(null!==t){e.insertBefore(t.firstElementChild,e.children[0]);const n="smart-"+i._element+"-drop-down",o="smart-"+i._element+"-item-container",r=e.querySelector("."+n);if(r){const t=e.querySelector("."+o);for(;t.childNodes.length;)e.appendChild(t.firstChild);r.remove()}}d.remove()}m&&m.remove(),d=document.createElement("div"),m=document.createElement("div");let p=document.createElement("span");e.menu=i,t>1?(e.originalIndex=o,c=n.path+"."+e.originalIndex,e.parentItem=n,u=n):(e.originalIndex=o,c=""+o,u=i),i.checkboxes&&u.checkable&&("checkbox"===u.checkMode?e.setAttribute("role","menuitemcheckbox"):"radioButton"===u.checkMode&&e.setAttribute("role","menuitemradio")),e.path=c,i._menuItems[c]=e,d.className=r,m.className=a,"tree"===i._element&&i._setIndentation(d,t,i.rightToLeft?"paddingRight":"paddingLeft");const h=Array.from(e.childNodes);for(let e=0;e<h.length;e++){const t=h[e];if(t instanceof Smart.MenuItem||t instanceof Smart.MenuItemsGroup)break;p.appendChild(t)}if(""===p.innerHTML.trim()){const t=e.label||e.getAttribute("label");t&&""!==t?i._setLabel(t,p,e,!0):(e.set("label","Item "+o),p.innerHTML="Item "+o)}else e.set("label",p.innerHTML.trim());if(e.setAttribute("aria-label",e.label),e instanceof Smart.MenuItemsGroup&&void 0===e.titleLabel&&(e.titleLabel=e.label),m.appendChild(p),s.appendChild(m),e.set("level",t),e.set("shortcut",e.shortcut||e.getAttribute("shortcut")||""),e.shortcut&&e instanceof Smart.MenuItem){const t=document.createElement("div");t.id=e.id+"Shortcut",t.className="smart-"+i._element+"-item-shortcut",t.innerHTML=e.shortcut,s.appendChild(t),e.setAttribute("aria-describedby",t.id)}d.appendChild(s),e.insertBefore(d,e.children[0]),e.id||(e.id=i.id+"ItemP"+e.path.replace(/\./g,"_")+"L"+e.label.replace(/[^a-zA-Z0-9\-\_]/g,""))}_createMenuItemsGroupContainer(e,t){const n=this,o=e.children,i="smart-"+n._element+"-drop-down",r="smart-"+n._element+"-item-container";let a,s;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList&&(t.classList&&t.classList.contains(i)?a=t:t.classList&&t.classList.contains(r)&&(s=t),a&&s))break}if(a||(a=document.createElement("div")),s||(s=document.createElement("div")),a.innerHTML=s.innerHTML="",a.id=e.id+"Container",a.className="smart-"+n._element+"-drop-down smart-visibility-hidden",n._edgeMacFF&&2===t&&"tree"!==n.mode&&(a.className+=" not-in-view"),a.$||(a.$=Smart.Utilities.Extend(a)),a.level=t,a.setAttribute("level",t),"menu"===n._element?(e.setAttribute("aria-owns",a.id),a.setAttribute("role","menu")):a.setAttribute("role","group"),a.menuItemsGroup=e,s.className=r,s.$||(s.$=Smart.Utilities.Extend(s)),s.container=a,s.menuItemsGroup=e,e.checkable&&s.setAttribute("checkable",""),s.setAttribute("check-mode",e.checkMode),s.setAttribute("role","presentation"),a.itemContainer=s,a.contains(s)||a.appendChild(s),null!==e.dropDownHeight){let t=a.querySelector(".smart-spin-button.smart-scroll-button-near"),o=a.querySelector(".smart-spin-button.smart-scroll-button-far");t||(t=document.createElement("smart-repeat-button")),o||(o=document.createElement("smart-repeat-button")),t.className="smart-menu-scroll-button smart-spin-button smart-scroll-button-near smart-hidden",t.setAttribute("aria-label","Scroll up"),t.innerHTML='<div class="smart-arrow smart-arrow-up" aria-hidden="true"></div>',t.animation=n.animation,t.unfocusable=!0,t.rightToLeft=n.rightToLeft,o.className="smart-menu-scroll-button smart-spin-button smart-scroll-button-far smart-hidden",o.setAttribute("aria-label","Scroll down"),o.innerHTML='<div class="smart-arrow smart-arrow-down" aria-hidden="true"></div>',o.animation=n.animation,o.unfocusable=!0,o.rightToLeft=n.rightToLeft,a.contains(t)||a.insertBefore(t,s),a.contains(o)||a.appendChild(o),a.$.addClass("drop-down-height-set"),s.dropDownHeightSet=!0,s.checkOverflow=!0,a.style.height=e.dropDownHeight+"px",n._containersFixedHeight.push(a),n._additionalScrollButtons.push([t,o])}return a}_discardKeyboardHover(e){const t=this;t._focusedViaKeyboard&&(!e&&t._focusedViaKeyboard instanceof Smart.MenuItemsGroup&&t._isContainerOpened(t._focusedViaKeyboard.level+1,t._focusedViaKeyboard.container)||(t._focusedViaKeyboard.$.removeClass("focus"),t._focusedViaKeyboard.removeAttribute("focus"),t._focusedViaKeyboard.$.removeClass("hover"),t._focusedViaKeyboard.removeAttribute("hover"),t._focusedViaKeyboard=void 0))}_documentDownHandler(e){const t=this;"down"===t.closeAction&&t._closeOnDocumentInteraction(e.originalEvent)}_documentUpHandler(e){const t=this,n=e.originalEvent.target;if(t.disabled||t.displayLoadingIndicator||!n.closest)return;const o="up"===t.closeAction&&t._closeOnDocumentInteraction(e.originalEvent);if(o)return;let i,r;if(t.isInShadowDOM?(i=t.isInShadowDOM?t.getRootNode().activeElement:t.shadowRoot&&t.shadowRoot.activeElement||document.activeElement,r=t.$.container.contains(e.originalEvent.composedPath()[0])):(i=document.activeElement,r=t.contains(n)),!o&&t!==i&&null===i.closest("[template-applied]")){if(r||n.closest(".smart-list-menu-view")===t.$.view)return void t.focus();const e=n.closest(".smart-drop-down-repositioned");e&&e.ownerElement===t&&t.focus()}}_closeOnDocumentInteraction(e){const t=this,n=e.target;let o,i;if(t.isInShadowDOM?(o=e.composedPath()[0],i=t.$.container.contains(o)):i=t.contains(n),"dropDown"===t.mode&&t.opened){const e=n.closest(".smart-drop-down-repositioned");if(!(i||e&&e.ownerElement===t))return t.close({trigger:"interaction",target:t.isInShadowDOM?o:n}),!0}const r=(o||n).closest(".smart-input-drop-down-menu");return(!r||!t.contains(r.ownerElement))&&(!i&&null===n.closest(".smart-menu-drop-down")||o&&o===t.$.mainContainer||n===t.$.mainContainer?("tree"===t.mode||t._close(),!0):void 0)}_ensureVisible(e){const t=this;if(t._minimized)return;const n=t.mode,o=t.$.mainContainer;let i,r;if("tree"!==n&&e.parentElement!==o){if(null===e.dropDownHeight)return;i=e.parentElement,r=[i.container.children[0],i.container.children[2]]}else i=o,r=[t.$.scrollButtonNear,t.$.scrollButtonFar];if(i===o&&(null===t.dropDownAppendTo&&"tree"!==t.mode&&!o.classList.contains("simple")||!i.$.hasClass("scroll-buttons-shown")&&"hidden"!==t.overflow))return;const a=i.getBoundingClientRect(),s=e.getBoundingClientRect();function l(t,n,o){let r=e.firstElementChild[o]+t-i[o];r<0&&(r=t),i["scroll"+n]=r}function d(n,a){let s=e["offset"+n],d=i[a];"Top"!==n||i===o||r[0].$.hasClass("smart-hidden")||(s-=r[0][a]),l(s,n,a),t._updateScrollButtonVisibility(i,"Left"===n,r),d!==i[a]&&l(s,n,a)}"tree"!==n?(i===o&&"horizontal"===n&&(a.left>s.left||a.right<s.right)?d("Left","offsetWidth"):(a.top>s.top||a.bottom<s.bottom)&&d("Top","offsetHeight"),t._scrollInfo.set(i,{left:i.scrollLeft,top:i.scrollTop})):t._ensureVisibleTreeMode(e,s,i,a,0)}_ensureVisibleTreeMode(e,t,n,o,i){const r=this;if(("menu"===r._element||"scrollButtons"===r.scrollMode)&&!n.$.hasClass("scroll-buttons-shown")&&"hidden"!==r.overflow)return;const a=n.offsetHeight,s=r.$scrollButtonNear.hasClass("smart-hidden");let l;if(o.top>t.top)l=r._getOffsetTop(e);else{let n=e.expanded?e.firstElementChild.offsetHeight+parseInt(window.getComputedStyle(e.children[1]).marginTop,10):e.offsetHeight;if("tree"===r._element&&(n+=parseFloat(getComputedStyle(r).getPropertyValue("--smart-tree-item-vertical-offset"))||0),!(o.bottom<t.top+n))return;l=r._getOffsetTop(e)-a+n+i}"tree"===r._element&&"0"===e.path&&(l-=parseFloat(getComputedStyle(r).getPropertyValue("--smart-tree-item-vertical-offset"))),n.scrollTop=l,"menu"!==r._element&&"scrollButtons"!==r.scrollMode||r._updateScrollButtonVisibility(n,!1,[r.$.scrollButtonNear,r.$.scrollButtonFar]),"auto"===r.overflow&&s&&!r.$scrollButtonNear.hasClass("smart-hidden")&&(n.scrollTop+=a-n.offsetHeight),r._scrollInfo.set(n,{left:n.scrollLeft,top:n.scrollTop})}_escapeHandler(e,t,n){e&&(e.$.removeClass("focus"),e.removeAttribute("focus")),this._closeSubContainers(t,void 0,void 0,!0),this._hoverViaKeyboard(n.menuItemsGroup)}_expandItemsByDefault(e){const t=this;if(0===t._menuItemsGroupsToExpand.length&&!e||"tree"!==t.mode&&!t._minimized)return;const n=t.hasAnimation,o=t.animation;n&&(t.animation="none"),e&&t._collapseAll(!1);for(let e=0;e<t._menuItemsGroupsToExpand.length;e++)t.expandItem(t._menuItemsGroupsToExpand[e].path,void 0,!1);n&&(t.animation=o),t._menuItemsGroupsToExpand=[]}_expandSection(e){const t=this,n=e.style.height,o=e.scrollHeight+"px";e.style.height=o,t._treeAnimationInProgress=e,n!==o&&(parseFloat(n)||parseFloat(o))?e.addEventListener("transitionend",t._transitionendHandlerExpand):t._transitionendHandlerExpand(t,e)}_filterInputKeyupHandler(){const e=this;e._filterTimer&&clearTimeout(e._filterTimer),e._filterTimer=setTimeout((function(){const t=e.context;e.context=e,e._applyFilter(e.$.filterInput.value,e._view),e._checkOverflow(),e.context=t}),300)}_findItem(e,t){if(""===t)return e;const n=e[this.filterMember||"label"];if("string"!=typeof n)return null;switch(this.filterMode){case"startsWith":if(0===n.indexOf(t))return e;break;case"startsWithIgnoreCase":if(0===n.toLowerCase().indexOf(t.toLowerCase()))return e;break;case"doesNotContain":if(n.indexOf(t)<0)return e;break;case"doesNotContainIgnoreCase":if(n.toLowerCase().indexOf(t.toLowerCase())<0)return e;break;case"contains":if(n.indexOf(t)>-1)return e;break;case"containsIgnoreCase":if(n.toLowerCase().indexOf(t.toLowerCase())>-1)return e;break;case"equals":if(0===n.localeCompare(t))return e;break;case"equalsIgnoreCase":if(0===n.toLowerCase().localeCompare(t.toLowerCase()))return e;break;case"endsWith":if(n.endsWith(t))return e;break;case"endsWithIgnoreCase":if(n.toLowerCase().endsWith(t.toLowerCase()))return e}return null}_getFirstEnabledChild(e){const t=e.children;for(let e=0;e<t.length;e++)if(this._isChildEnabled(t[e]))return t[e]}_getLastEnabledChild(e){const t=e.children;for(let e=t.length-1;e>=0;e--)if(this._isChildEnabled(t[e]))return t[e]}_getNextEnabledChild(e){if(e)for(;e.nextElementSibling;){const t=e.nextElementSibling;if(this._isChildEnabled(t))return t;e=t}}_getOffsetTop(e){if(!e)return 0;let t=e.offsetTop;for(;e.offsetParent!==this.$.mainContainer;){if(!(e=e.offsetParent))return t;t+=e.offsetTop}return t}_getPreviousEnabledChild(e){if(e)for(;e.previousElementSibling;){const t=e.previousElementSibling;if(this._isChildEnabled(t))return t;e=t}}_hamburgerIconClickHandler(e,t){e&&e.stopPropagation();const n=this;if(void 0===t&&(t=Smart.ListMenu&&n instanceof Smart.ListMenu?n.$.view:n.$.mainContainer),!n.disabled)if(n._minimizedDropDownOpened)n._close();else{if(n._positionDetection.placeOverlay(),null!==n.dropDownAppendTo){const e=n.dropDownPosition,o=n.getBoundingClientRect(),i=n._positionDetection.getDropDownOffset();-1!==e.indexOf("right")||"auto"===e?n.rightToLeft?(t.style.right="initial",t.style.left=o.left+o.width-t.offsetWidth-i.x+"px"):(t.style.left=o.left+i.x+"px",t.style.right="initial"):-1!==e.indexOf("left")&&(t.style.left=o.right-t.offsetWidth+i.x+"px",t.style.right="initial"),-1!==e.indexOf("bottom")||-1!==e.indexOf("overlay")||"auto"===e?t.style.top=o.bottom+i.y+"px":-1!==e.indexOf("top")&&(t.style.top=o.top+i.y+"px")}else t.style.right="";n._edgeMacFF&&t.$.removeClass("not-in-view"),t.$.removeClass("smart-visibility-hidden"),n.$hamburgerIcon.addClass("smart-close-button"),n.$.hamburgerIcon.setAttribute("aria-expanded",!0),n._minimizedDropDownOpened=!0,n._browserBoundsDetection(t)}}_handleOverflowChange(){const e=this,t=e.$.mainContainer;if((e._minimized||null===e.dropDownAppendTo&&!t.classList.contains("simple")&&"tree"!==e.mode)&&!(Smart.ListMenu&&e instanceof Smart.ListMenu))return;const n=e.overflow;let o;"horizontal"===e.mode?(o=!0,t.scrollLeft=0):(o=!1,t.scrollTop=0),"hidden"===n?(t.classList.remove("scroll-buttons-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden")):(e.$.scrollButtonNear.disabled=e.disabled,e.$.scrollButtonFar.disabled=e.disabled,"auto"===n?(e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"),e._checkOverflow(t,o,[e.$.scrollButtonNear,e.$.scrollButtonFar])):(t.classList.add("scroll-buttons-shown"),t.classList.remove("one-button-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility(t,o,[e.$.scrollButtonNear,e.$.scrollButtonFar]))),e._scrollInfo.set(t,{left:t.scrollLeft,top:t.scrollTop})}_hideMainContainerScrollButtons(){const e=this;e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"),e.$mainContainer.removeClass("scroll-buttons-shown"),e.$mainContainer.removeClass("one-button-shown")}_hoverViaKeyboard(e){e&&(e.$.addClass("focus"),e.setAttribute("focus",""),this._focusedViaKeyboard=e,this._ensureVisible(e))}_isBranchExpanded(e){if("tree"!==this.mode)return!0;let t=!0;for(;e.parentItem;)t=t&&e.parentItem.expanded,e=e.parentItem;return t}_isChildEnabled(e){return!(e.disabled||e.templateApplied||e.hidden||e instanceof HTMLDivElement||0===e.offsetHeight)}_isContainerOpened(e,t){const n=this;return"tree"===n.mode||n._minimized?(n._openedContainers[e]||(n._openedContainers[e]=[]),-1!==n._openedContainers[e].indexOf(t)):n._openedContainers[e]===t}_keydownHandler(e){const t=this;let n=e.key;if(t.getRootNode().activeElement!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","Escape","Home"," "].indexOf(n)||t.disabled)return;e.preventDefault();const o=t.mode;if("tree"===o||t._minimized)return void t._keydownHandlerTreeMode(n);const i=t.dropDownPosition,r=-1!==i.indexOf("left"),a="top-left"===i||"top-right"===i,s=t._openedContainers;let l,d=t.$.mainContainer,m=1;for(let e=s.length-1;e>=0;e--)if(void 0!==s[e]){d=s[e],m=d.level,d=d.itemContainer;break}switch(l=d.querySelector('[focus][level="'+m+'"]'),t.rightToLeft&&("ArrowLeft"===n?n="ArrowRight":"ArrowRight"===n&&(n="ArrowLeft")),n){case"ArrowDown":1===m?"horizontal"!==o||a?"horizontal"!==o&&t._levelOneNavigate("_getFirstEnabledChild",l,d):t._levelOneOpenDropDown(l):t._navigate("_getNextEnabledChild",l,d);break;case"ArrowLeft":r?1===m?"horizontal"===o?t._levelOneNavigate("_getLastEnabledChild",l,d):t._levelOneOpenDropDown(l):l instanceof Smart.MenuItemsGroup?t._selectionHandler({target:l,isTrusted:!0}):t._levelOneNavigateFromLowerLevel("_getPreviousEnabledChild",l):t._arrowLeftHandler(m,o,l,d);break;case"ArrowRight":r?1===m?"horizontal"===o&&t._levelOneNavigate("_getFirstEnabledChild",l,d):2===m?t._levelOneNavigateFromLowerLevel("_getNextEnabledChild",l):t._escapeHandler(l,m,d):t._arrowRightHandler(m,o,l,d);break;case"ArrowUp":1===m?"horizontal"===o&&a?t._levelOneOpenDropDown(l):"horizontal"!==o&&t._levelOneNavigate("_getLastEnabledChild",l,d):t._navigate("_getPreviousEnabledChild",l,d);break;case"End":case"Home":{const e="End"===n?t._getLastEnabledChild(d):t._getFirstEnabledChild(d);if(!e||l===e)return;l&&(l.$.removeClass("focus"),l.removeAttribute("focus")),t._hoverViaKeyboard(e);break}case"Enter":l&&t._selectionHandler({target:l,isTrusted:!0});break;case"Escape":m>1?(2===m&&t._positionDetection.removeOverlay(),t._escapeHandler(l,m,d)):"dropDown"===o&&t.opened&&t.close({trigger:"interaction",target:"Escape"});break;case" ":l&&t._toggleItem(l)}}_keydownHandlerTreeMode(e){const t=this,n=Array.from(t.$.mainContainer.querySelectorAll("smart-menu-item, smart-menu-items-group")),o=t.$.mainContainer.getElementsByClassName("focus")[0];function i(e){const n=e.level;return!1===e.disabled&&!0!==e.templateApplied&&(1===n||n>1&&t._isContainerOpened(n,e.parentElement.container)&&e.getBoundingClientRect().height>0)}function r(e){for(let r=e;r<n.length;r++){const e=n[r];if(i(e)){if(o){if(o===e)break;o.$.removeClass("focus"),o.removeAttribute("focus")}t._hoverViaKeyboard(e);break}}}function a(e){for(let r=e;r>=0;r--){const e=n[r];if(i(e)){if(o){if(o===e)break;o.$.removeClass("focus"),o.removeAttribute("focus")}t._hoverViaKeyboard(e);break}}}function s(){o.level>1&&(o.$.removeClass("focus"),o.removeAttribute("focus"),t._hoverViaKeyboard(o.parentItem))}let l;switch(e){case"ArrowDown":l=o?n.indexOf(o)+1:0,r(l);break;case"ArrowLeft":if(!o)return;if(o instanceof Smart.MenuItem)s();else{if(t._isContainerOpened(o.level+1,o.container))return void t._closeSubContainers(o.level+1,o.container,!0,!0);s()}break;case"ArrowRight":if(!o||o instanceof Smart.MenuItem)return;t._isContainerOpened(o.level+1,o.container)?(o.$.removeClass("focus"),o.removeAttribute("focus"),t._hoverViaKeyboard(t._getFirstEnabledChild(o.itemContainer))):t._selectionHandler({target:o,type:"keydown",isTrusted:!0},o);break;case"ArrowUp":l=o?n.indexOf(o)-1:n.length-1,a(l);break;case"End":a(n.length-1);break;case"Enter":t._minimized&&!t._minimizedDropDownOpened?t._hamburgerIconClickHandler(void 0,t.$.mainContainer):o&&t._selectionHandler({target:o,type:"keydown",isTrusted:!0});break;case"Escape":t._minimized&&t._minimizedDropDownOpened&&t._close();break;case"Home":r(0);break;case" ":o&&t._toggleItem(o)}}_lazyInitItems(){const e=this;e._inLazyInit||(e._inLazyInit=!0,e._menuItems={},e._processHTML(e.$.mainContainer,1),e._expandItemsByDefault(),e._refreshCheckableItems(),cancelAnimationFrame(Smart.Menu.processTimer),delete Smart.Menu.processTimer,e._inLazyInit=!1,e.$.scrollViewer&&e.$.scrollViewer.refresh())}_levelOneNavigate(e,t,n){const o=this;if(t)"_getLastEnabledChild"===e?o._navigate("_getPreviousEnabledChild",t,n):o._navigate("_getNextEnabledChild",t,n);else{const t=o[e](n);t&&o._hoverViaKeyboard(t)}}_levelOneNavigateFromLowerLevel(e,t){const n=this,o=n[e](n._openedContainers[2].menuItemsGroup);o&&(t&&(t.$.removeClass("focus"),t.removeAttribute("focus")),n._closeSubContainers(2),o instanceof Smart.MenuItemsGroup?n._selectionHandler({target:o,isTrusted:!0}):n._hoverViaKeyboard(o))}_levelOneOpenDropDown(e){e&&e instanceof Smart.MenuItemsGroup&&this._selectionHandler({target:e,isTrusted:!0})}_mainContainerHandler(e){const t=this;if(t._minimized&&null!==t.dropDownAppendTo)switch(e.type){case"click":t._selectionHandler(e);break;case"mouseleave":t._mouseleaveHandler(e);break;case"mouseout":case"mouseover":t._mouseoutMouseoverHandler(e)}}_menuItemSelectionHandler(e,t){const n=this;function o(){n.enableShadowDOM&&(n.shadowRoot.activeElement||document.activeElement)!==n&&null!==n.dropDownAppendTo&&"click"===t.type&&!n.shadowRoot.contains(e)?n.focus():document.activeElement===n||null===n.dropDownAppendTo||"click"!==t.type||n.contains(e)||n.focus()}if(e.disabled||e.templateApplied)o();else{if(!n._toggleItem(e)){if(n.$.fireEvent("itemClick",{item:e,label:e.label,value:e.value}),t.target&&"A"!==t.target.nodeName){const t=e.querySelector("a");t&&t.click()}if("tree"!==n.mode&&(n._close(),"dropDown"===n.mode))return n._ripple(e,t),void n.close({trigger:"interaction",target:e})}n._ripple(e,t),o()}}_menuItemsGroupSelectionHandler(e,t,n){const o=this,i=o.mode,r=e.container,a=r.level,s="tree"!==i&&!o._minimized;if(o._treeAnimationInProgress===r)return;if(o._discardKeyboardHover(),o.getRootNode().activeElement===o||null===o.dropDownAppendTo||"click"!==t.type||o.contains(t.target)||o.focus(),"click"===t.type&&(!t.target.classList.contains("smart-"+o._element+"-items-group-arrow")&&o._toggleItem(e)||"mouseenter"===o.selectionMode&&"tree"!==i&&!o._minimized))return;let l=o.hasAnimation;if(o._isContainerOpened(a,r))o._closeSubContainers(a,r,!0,!1!==n),s&&e.hasAttribute("focus")&&(o._focusedViaKeyboard=e);else{if(o.$.fireEvent("expanding",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children}).defaultPrevented)return;if(o._positionDetection.placeOverlay(),s&&o._closeSubContainers(a),l&&!s&&("expand"!==t.type&&(o._ensureVisibleOnTransitionend=e),o._expandSection(r)),o._edgeMacFF&&2===a&&s&&r.$.removeClass("not-in-view"),r.$.removeClass("smart-visibility-hidden"),s||"expand"!==t.type){if(s)"keydown"===t.type&&(o._focusedViaKeyboard=e);else{const t=o.$.mainContainer.getElementsByClassName("focus")[0];t&&(t.$.removeClass("focus"),t.removeAttribute("focus")),o._focusedViaKeyboard=e}e.$.addClass("focus"),e.setAttribute("focus","")}if(e.$.addClass("smart-"+o._element+"-items-group-opened"),e.$.addClass("smart-"+o._element+"-items-group-expanded"),e.setAttribute("aria-expanded",!0),o._addOpenedContainer(a,r),s){if(o._ensureVisible(e),e.level>1&&e.parentElement.dropDownHeightSet){const t=o.dropDownPosition,n=e.getBoundingClientRect().top-e.parentElement.container.getBoundingClientRect().top;-1!==t.indexOf("bottom")||"auto"===t?r.style.top=n+"px":-1!==t.indexOf("top")?r.style.top=n+e.offsetHeight+"px":r.style.top=n+e.offsetHeight/2+"px"}r.itemContainer.checkOverflow&&r.itemContainer.dropDownHeightSet&&(o._checkOverflow(r.itemContainer,!1,[r.children[0],r.children[2]]),delete r.itemContainer.checkOverflow)}o._positionExternalContainer(r,e),"tree"===i||o._minimized?l||o._browserBoundsDetection(o.$.mainContainer):o._browserBoundsDetection(r),void 0===t.type&&o._hoverViaKeyboard(o._getFirstEnabledChild(e.itemContainer)),!1!==n&&o.$.fireEvent("expand",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children})}s?o._ripple(e,t):"tree"!==i||l||(o._checkOverflow(o.$.mainContainer,!1,[o.$.scrollButtonNear,o.$.scrollButtonFar]),o._minimized||"expand"===t.type||o._ensureVisible(e))}_mouseenterHandler(){const e=this;e.autoFocusOnMouseenter&&e.getRootNode().activeElement!==e&&e.focus()}_mouseleaveHandler(e){const t=this;if("mouseenter"===t.selectionMode&&"tree"!==t.mode&&!t._minimized){if(null!==t.dropDownAppendTo&&e.relatedTarget)if(t.contains(e.target)){const n=e.relatedTarget.closest(".smart-menu-drop-down");if(n&&n.ownerElement===t)return}else if(t.contains(e.relatedTarget))return;t._isElementHovered=!1,t._autoCloseTimeout=setTimeout((function(){const e=t.context;clearTimeout(t._autoCloseTimeout),t._isElementHovered||(t.context=t,t._close(),t.context=e)}),t.autoCloseDelay)}}_mouseoutMouseoverHandler(e){const t=this;if(t.disabled||t.displayLoadingIndicator)return;let n=e.target.closest("smart-menu-item")||e.target.closest("smart-menu-items-group");if(t.enableShadowDOM&&(n=e.composedPath()[0].closest("smart-menu-item")||e.composedPath()[0].closest("smart-menu-items-group")||n),"mouseover"===e.type&&(t._isElementHovered=!0),null!==n&&!n.disabled&&!n.templateApplied&&("tree"!==t.mode&&!t._minimized||!n.hasAttribute("focus")||!e.relatedTarget||e.target.parentElement!==e.relatedTarget&&e.relatedTarget.parentElement!==e.target))if(t._discardKeyboardHover(!1),"mouseover"===e.type){"mouseenter"!==t.selectionMode||"tree"===t.mode||t._minimized||(n instanceof Smart.MenuItemsGroup&&!n.hasAttribute("hover")?t._selectionHandler(e,n):n instanceof Smart.MenuItem&&t._closeSubContainers(n.level+1));const o=e.target.closest(".smart-menu-drop-down");(!o||o&&!n.contains(o))&&(n.$.addClass("hover"),n.setAttribute("hover",""),t._discardKeyboardHover(!0))}else{if("tree"!==t.mode&&!t._minimized&&("mouseenter"===t.selectionMode&&e.relatedTarget===t.$.mainContainer&&t._close(),n instanceof Smart.MenuItemsGroup&&n.container&&!n.container.$.hasClass("smart-visibility-hidden")))return;n.$.removeClass("hover"),n.removeAttribute("hover")}}_moveDropDownsToExternalContainer(){const e=this;for(let t=0;t<e._containersInBody.length;t++){const n=e._containersInBody[t];e._dropDownParent.appendChild(n),n.$.listen("click",e._selectionHandler.bind(e)),n.$.listen("mouseleave",e._mouseleaveHandler.bind(e)),n.$.listen("mouseout",e._mouseoutMouseoverHandler.bind(e)),n.$.listen("mouseover",e._mouseoutMouseoverHandler.bind(e))}for(let t=0;t<e._containers.length;t++){const n=e._containers[t];n.ownerElement=e,""!==e.theme&&n.classList.add(e.theme),e.rightToLeft&&n.setAttribute("right-to-left",""),n.classList.add("smart-drop-down-repositioned"),n.setAttribute("mode",e.mode),n.setAttribute("drop-down-position",e.dropDownPosition),e.checkboxes&&n.setAttribute("checkboxes","")}}_moveDropDownsToMenu(){const e=this;for(let t=0;t<e._containersInBody.length;t++){const n=e._containersInBody[t];n.$.unlisten("click"),n.$.unlisten("mouseleave"),n.$.unlisten("mouseout"),n.$.unlisten("mouseover"),n.style.left="",n.style.right="",n.style.top="",n.style.marginLeft="",n.style.marginTop="",n.menuItemsGroup.appendChild(n)}for(let t=0;t<e._containers.length;t++){const n=e._containers[t];""!==e.theme&&n.classList.remove(e.theme),n.classList.remove("smart-drop-down-repositioned"),n.removeAttribute("mode"),n.removeAttribute("drop-down-position"),n.removeAttribute("checkboxes"),n.removeAttribute("right-to-left")}}_navigate(e,t,n){const o=this;if(!t)return void("_getNextEnabledChild"===e?o._hoverViaKeyboard(o._getFirstEnabledChild(n)):o._hoverViaKeyboard(o._getLastEnabledChild(n)));const i=o[e](t);i&&(t.$.removeClass("focus"),t.removeAttribute("focus"),o._hoverViaKeyboard(i))}_positionExternalContainer(e,t){const n=this;if(null===n.dropDownAppendTo||2!==e.level)return;const o=n.dropDownPosition,i=n.mode,r=t.getBoundingClientRect(),a=n._positionDetection.getDropDownOffset(),s=r.top+a.y,l=r.bottom+a.y;let d=r.left+a.x,m=r.right+a.x;switch(e.style.top=e.style.left=e.style.right="",n.rightToLeft&&(e.style.right="initial"),-1!==o.indexOf("left")?(d-=e.offsetWidth,"horizontal"!==i&&"overlay-left"!==o||(d+=r.width),e.style.left=d+"px",e.style.right="initial"):"horizontal"===i||"overlay-right"===o?e.style.left=d+"px":n.rightToLeft?e.style.left=m-e.offsetWidth+"px":e.style.left=d+r.width+"px",o){case"bottom-right":case"bottom-left":case"auto":e.style.top="horizontal"===i?l+"px":s+"px";break;case"top-right":case"top-left":e.style.top="horizontal"===i?s-e.offsetHeight+"px":l-e.offsetHeight+"px";break;case"overlay-right":case"overlay-left":e.style.top=s+r.height/2+"px"}}_processDataSource(){const e=this,t=e.dataSource,n=e.displayMember,o=e.itemsMember,i=e.valueMember,r=e.$.mainContainer,a=document.createDocumentFragment();function s(t,r){let a;if(Array.isArray(t[o])&&t[o].length>0){a=document.createElement("smart-"+e._element+"-items-group"),!0===t.checkable&&a.set("checkable",!0),"string"==typeof t.checkMode&&a.set("checkMode",t.checkMode),t.dropDownHeight&&a.set("dropDownHeight",t.dropDownHeight),!0===t.expanded&&"tree"===e.mode&&(a.set("expanded",!0),a.setAttribute("aria-expanded",!0));for(let e=0;e<t[o].length;e++)s(t[o][e],a)}else a=document.createElement("smart-"+e._element+"-item"),void 0!==t.shortcut&&a.set("shortcut",t.shortcut),t.customAttribute&&a.setAttribute(t.customAttribute,"");a.isDirty=!1,void 0!==t.id&&/^[A-Za-z]+[\w\-\:\.]*$/.test(t.id)&&(a.id=t.id),!0===t.checked&&(a.set("checked",!0),a.setAttribute("aria-checked",!0)),!0===t.disabled&&a.set("disabled",!0),void 0!==t[n]?a.set("label",t[n]):"string"==typeof t[o]&&a.set("label",t[o]),!0===t.selected&&a.set("selected",!0),!0===t.separator&&a.set("separator",!0),void 0!==t[i]&&a.set("value",t[i]),r.appendChild(a)}r.innerHTML="",r instanceof Smart.ScrollViewer&&r.removeAll();for(let e=0;e<t.length;e++)s(t[e],a);e.$.mainContainer.appendChild(a),e._processHTML(e.$.mainContainer,1)}_processHTML(e,t,n){const o=this;let i,r;t>1&&(i=o._createMenuItemsGroupContainer(e,t),r=i.itemContainer,(e.expanded||e.hasAttribute("expanded"))&&"tree"===o.mode?o._menuItemsGroupsToExpand.push(e):(e.set("expanded",!1),e.removeAttribute("expanded"),e.setAttribute("aria-expanded",!1)));const a=Array.from(e.children),s=[],l=document.createDocumentFragment();let d=0;for(let n=0;n<a.length;n++){if(t>1&&0===n){d++;continue}const i=a[n];i instanceof Smart.MenuItem||i instanceof Smart.MenuItemsGroup?(o._createItemHTMLStructure(i,t,e,n-d),(i.checked||i.hasAttribute("checked"))&&(i.disabled||i.hasAttribute("disabled")||i.templateApplied?(i.set("checked",!1),i.removeAttribute("checked"),i.removeAttribute("aria-checked")):s.push(i)),t>1&&l.appendChild(i),i instanceof Smart.MenuItemsGroup&&o._processHTML(i,t+1)):(i.parentElement.removeChild(i),d++)}if(t>1){if(r.appendChild(l),e.container=i,e.itemContainer=r,e instanceof Smart.MenuItemsGroup){const n=document.createElement("div");n.className="smart-"+o._element+"-items-group-arrow","menu"===o._element?n.setAttribute("role","presentation"):(n.setAttribute("role","button"),n.setAttribute("aria-label","Toggle")),o._setArrowDirection(n,t),e.firstElementChild.appendChild(n)}o._containers.push(i),2===t&&(o._containersInBody.push(i),o._edgeMacFF&&i.addEventListener("transitionend",(function(e){e.target===this&&this.$.hasClass("smart-visibility-hidden")&&(this.style.left="",this.style.top="",this.$.addClass("not-in-view"))}))),null===o.dropDownAppendTo||"tree"===o.mode||o._minimized?e.appendChild(i):(i.ownerElement=o,o.rightToLeft?i.setAttribute("right-to-left",""):i.removeAttribute("right-to-left"),i.classList.add("smart-drop-down-repositioned"),i.setAttribute("mode",o.mode),i.setAttribute("drop-down-position",o.dropDownPosition),o.checkboxes&&i.setAttribute("checkboxes",""),""!==o.theme&&i.$.addClass(o.theme),i.setAttribute("animation",o.animation),2===t?(o._dropDownParent.appendChild(i),i.$.listen("click",o._selectionHandler.bind(o)),i.$.listen("mouseleave",o._mouseleaveHandler.bind(o)),i.$.listen("mouseout",o._mouseoutMouseoverHandler.bind(o)),i.$.listen("mouseover",o._mouseoutMouseoverHandler.bind(o))):e.appendChild(i))}o._validateRadioButtonSelection(e,t,s),o._sortItems&&!1!==n&&o._sortItems(e)}_processUList(){const e=this,t=new RegExp(/<li>(.(?!<\/li>)|\n)*?<ul>/),n=new RegExp(/<\/ul>(.|\n)*?<\/li>/);let o=e.$.mainContainer.firstElementChild.innerHTML;for(o=o.replace(/\r?\n|\r/g,""),o=o.replace(/<li(.|\n)*?>/g,"<li>"),o=o.replace(/<li><\/li>/g,"<li> </li>"),o=o.replace(/<ul(.|\n)*?>/g,"<ul>");t.test(o);){const n=t.exec(o),i="<smart-"+e._element+"-items-group>"+n[0].slice(4,n[0].length-4);o=o.replace(n[0],i)}for(;n.test(o);){const t=n.exec(o),i="</smart-"+e._element+"-items-group>";o=o.replace(t[0],i)}o=o.replace(/li>/g,"smart-"+e._element+"-item>"),e.$.mainContainer.innerHTML=o}_refreshContainersArrays(){const e=this;for(let t=e._containers.length-1;t>=0;t--){const n=e._containers[t];if(!document.body.contains(n)){e._containers.splice(t,1);const o=e._containersFixedHeight.indexOf(n);o>-1&&(e._containersFixedHeight.splice(o,1),e._additionalScrollButtons.splice(o,1))}}e._checkContainersLength()}_refreshItemPaths(e,t,n,o){const i=this;let r;r=t?e:e.container.itemContainer;const a=n?n(e):r.children;for(let r=0;r<a.length;r++){const s=a[r];let l;o&&(s.originalIndex=r),l=t?""+r:e.path+"."+r,s.path=l,i._menuItems[l]=s,s instanceof Smart.MenuItemsGroup&&i._refreshItemPaths(s,void 0,n,o)}}_removeContainerFixedHeight(){const e=this;for(let t=0;t<e._containersFixedHeight.length;t++){const n=e._containersFixedHeight[t];n.style.height="",n.itemContainer.$.removeClass("scroll-buttons-shown"),n.itemContainer.$.removeClass("one-button-shown"),n.children[0].$.addClass("smart-hidden"),n.children[2].$.addClass("smart-hidden"),n.itemContainer.checkOverflow=!0}}_removeContainersInBody(){const e=this;if(null!==e.dropDownAppendTo&&!e._minimized)for(let t=0;t<e._containersInBody.length;t++)e._containersInBody[t].remove()}_reparentMenu(e,t){const n=this;if("dropDown"===n.mode&&(null!==n._dropDownParent||e)&&n._dropDownParent!==n.parentElement){if(e&&null!==t){if(null===n._dropDownParent)return n._positionRelativeTo.appendChild(n),void(n._positionRelativeTo=null)}else n._positionRelativeTo=n.parentElement;n._dropDownParent.appendChild(n)}}refresh(){const e=this;if(e._suppressResizeHandler)return void delete e._suppressResizeHandler;const t=e.minimizeWidth,n=e.mode;if(null!==t&&"dropDown"!==n){if(e.offsetWidth<=t&&!e._minimized)return void e.minimize();e.offsetWidth>t&&e.maximize()}(null!==e.dropDownAppendTo||"tree"===n||e.$mainContainer.hasClass("simple"))&&e._checkOverflow(e.$.mainContainer,"horizontal"===n,[e.$.scrollButtonNear,e.$.scrollButtonFar])}_resizeHandler(){this.refresh()}_ripple(e,t){if(this.hasRippleAnimation&&"click"===t.type)return Smart.Utilities.Animation.Ripple.animate(e,t.pageX,t.pageY),!0}_scroll(e){if(e.closest("[template-applied]"))return;const t=this,n=t.$.mainContainer,o=t.mode,i=e.classList.contains("smart-scroll-button-near")?-1:1;let r;if(e.parentElement===t.$.container)r=n,"tree"!==o&&t._closeSubContainers(2),"horizontal"===t.mode?(n.scrollLeft=n.scrollLeft+10*i,t._updateScrollButtonVisibility(n,!0,[t.$.scrollButtonNear,t.$.scrollButtonFar])):(n.scrollTop=n.scrollTop+10*i,t._updateScrollButtonVisibility(n,!1,[t.$.scrollButtonNear,t.$.scrollButtonFar]));else{const n=e.parentElement,o=n.itemContainer;r=o,t._closeSubContainers(n.level+1),o.scrollTop=o.scrollTop+10*i,t._updateScrollButtonVisibility(o,!1,[n.children[0],n.children[2]])}t._scrollInfo.set(r,{left:r.scrollLeft,top:r.scrollTop})}_selectionHandler(e,t){const n=this,o=e.target;if(o.closest("[template-applied]")&&e.stopPropagation(),!n.disabled&&!n.displayLoadingIndicator){if(void 0===t){if("click"===e.type){const t=o.closest("smart-repeat-button");if(t)return void n._scroll(t,e)}if(!e.isTrusted)return;const i=o.closest("smart-"+n._element+"-item");if(i)return void n._menuItemSelectionHandler(i,e);if((t=o.closest("smart-"+n._element+"-items-group"))&&(o===t.container||o===t.container.firstElementChild))return}t&&!t.disabled&&n._menuItemsGroupSelectionHandler(t,e)}}_setArrowDirection(e,t){const n=this,o=n.mode;"tree"===o||n._minimized?e.className="smart-"+n._element+"-items-group-arrow down smart-arrow-down":"overlay"!==n.dropDownPosition.slice(0,7)?2===t&&"horizontal"===o?"top"!==n.dropDownPosition.slice(0,3)?e.className="smart-menu-items-group-arrow down smart-arrow-down":e.className="smart-menu-items-group-arrow up smart-arrow-up":e.className="smart-menu-items-group-arrow "+(n.rightToLeft?"left smart-arrow-left":"right smart-arrow-right"):e.className="smart-menu-items-group-arrow minus"}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return void e.removeAttribute("tabindex");const t=e.getAttribute("tabindex");(null===t||t<0)&&e.setAttribute("tabindex",0)}_setItemLabel(e,t){const n=this,o=n.context,i=e.querySelector(".smart-menu-item-label-element>span");n.context=n,n._setLabel(t,i,e,!0),n._checkOverflow(n.$.mainContainer,"horizontal"===n.mode,[n.$.scrollButtonNear,n.$.scrollButtonFar]),n.context=o}_setLabel(e,t,n,o){const i=document.getElementById(e);if(null!==i&&"template"===i.tagName.toLowerCase()){const r=document.importNode(i.content,!0);if(n instanceof Smart.MenuItem)t.appendChild(r),o&&(n.setAttribute("template-applied",""),n.templateApplied=!0);else if(Smart.ListMenu&&this instanceof Smart.ListMenu){const e=new RegExp(/{{title="(.*)"}}/);for(let t=0;t<r.childNodes.length;t++)e.test(r.childNodes[t].innerHTML)?(n.titleLabel=e.exec(r.childNodes[t].innerHTML)[1],r.childNodes[t].innerHTML=r.childNodes[t].innerHTML.replace(e,"")):e.test(r.childNodes[t].textContent)&&(n.titleLabel=e.exec(r.childNodes[t].textContent)[1],r.childNodes[t].textContent=r.childNodes[t].textContent.replace(e,""));void 0===n.titleLabel&&(n.titleLabel=r.textContent),t.appendChild(r)}else t.innerHTML=e,n.titleLabel=e}else t.innerHTML=e,n instanceof Smart.MenuItemsGroup&&(n.titleLabel=e)}_toggleItem(e){const t=this;if(t.checkboxes){const n=1===e.level?t:e.parentItem;if(n.checkable){const o=t._getItemCheckableInfo(e,n);let i=!1;return"none"!==o.checkMode&&("checkbox"===o.checkMode?(i=!0,e.set("checked",!e.checked),e.checked?e.setAttribute("aria-checked",!0):e.removeAttribute("aria-checked"),t.$.fireEvent("itemCheckChange",{item:e,label:e.label,value:e.value,checked:e.checked})):"radioButton"!==o.checkMode||e.checked||(i=!0,e.set("checked",!0),e.setAttribute("aria-checked",!0),t._uncheckSiblings(e,o.siblings),t.$.fireEvent("itemCheckChange",{item:e,label:e.label,value:e.value,checked:!0})),e instanceof Smart.MenuItem&&i&&t.$.fireEvent("itemClick",{item:e,label:e.label,value:e.value}),"tree"===t.mode||"ListMenu"===t.elementName||t.preventCloseOnCheck||(t._close(),t.close()),!0)}}return!1}_getItemCheckableInfo(e,t){const n=Array.from(e.parentElement.children),o=t.checkMode.replace(/\s/g,"").split(",");let i,r;if(1===o.length)i=o[0],r=n;else{let t=0,a=!1;r=[];for(let o=0;o<n.length;o++){const i=n[o];if(r.push(i),i===e&&(a=!0),i.separator){if(!0===a)break;t++,r=[]}}i=o[t]}return{checkMode:i,siblings:r}}_refreshCheckableItems(e){const t=this,n=!t.checkboxes;(e?[e]:[t].concat(t._containers.map((e=>e.menuItemsGroup)))).forEach((e=>{const o=Array.from((e===t?t.$.mainContainer:e.itemContainer).children);let i=e.checkMode.replace(/\s/g,"").split(",");if(n||!e.checkable||1===i.length)return void o.forEach((e=>e.removeAttribute("check-type")));let r=0;i=i.map((e=>-1===["checkbox","radioButton","none"].indexOf(e)?"none":e));let a=[],s=[];for(let e=0;e<o.length;e++){const n=o[e];let l=i[r];if(void 0===l&&(l=i[r]="none"),"none"!==l&&t._isChildEnabled(n)||(n.checked=!1,n.removeAttribute("aria-checked")),"none"===l?n.setAttribute("role","menuitem"):"checkbox"===l?n.setAttribute("role","menuitemcheckbox"):"radioButton"===l&&(n.setAttribute("role","menuitemradio"),a.push(n),n.checked&&s.push(n)),n.setAttribute("check-type",l),n.separator){if(a.length>0)if(s.length>1)for(let e=0;e<s.length-1;e++)s[e].checked=!1;else if(0===s.length)for(let e=0;e<a.length;e++)if(t._isChildEnabled(a[e])){a[e].checked=!0;break}a=[],s=[],r++}}e.checkMode=i.join(", ")}))}_transitionendHandler(e){const t=this;"dropDown"===t.mode&&t.opened&&e.target===t&&"opacity"===e.propertyName&&(t._checkOverflowOnOpen&&(t._checkOverflow(t.$.mainContainer,!1,[t.$.scrollButtonNear,t.$.scrollButtonFar]),delete t._checkOverflowOnOpen),t.getRootNode().activeElement===t||t._noAutoFocus||t.focus())}_transitionendHandlerCollapse(){let e,t;if(1===arguments.length){if("visibility"===arguments[0].propertyName)return;t=this,e=t.menuItemsGroup.menu}else e=arguments[0],t=arguments[1];t.menuItemsGroup.$.removeClass("smart-"+e._element+"-items-group-expanded"),t.menuItemsGroup.setAttribute("aria-expanded",!1),t.removeEventListener("transitionend",e._transitionendHandlerCollapse),t.style.height=null,t.$.addClass("smart-visibility-hidden"),e._checkOverflow(e.$.mainContainer,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar]),e._minimized&&e._browserBoundsDetection(e.$.mainContainer),delete e._treeAnimationInProgress}_transitionendHandlerExpand(){let e,t;if(1===arguments.length){if("visibility"===arguments[0].propertyName)return;t=this,e=t.menuItemsGroup.menu}else e=arguments[0],t=arguments[1];t.removeEventListener("transitionend",e._transitionendHandlerExpand),t.style.height=null,e._checkOverflow(e.$.mainContainer,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar]),e._minimized&&e._browserBoundsDetection(e.$.mainContainer),e._ensureVisibleOnTransitionend&&(e._ensureVisible(e._ensureVisibleOnTransitionend),delete e._ensureVisibleOnTransitionend),delete e._treeAnimationInProgress}_uncheckSiblings(e,t){for(let n=0;n<t.length;n++){const o=t[n];o!==e&&o.checked&&(o.set("checked",!1),o.removeAttribute("aria-checked"),this.$.fireEvent("itemCheckChange",{item:o,label:o.label,value:o.value,checked:!1}))}}_unsortItems(e,t){const n=this;let o,i,r=[];e===n.$.mainContainer?(i=e,o=e.children):(i=e.container.firstElementChild,o=i.children);for(let e=0;e<o.length;e++){const i=o[e];r[i.originalIndex]=i,i instanceof Smart.MenuItemsGroup&&void 0===t&&n._unsortItems(i)}if(!(r.length<2))for(let e=0;e<r.length;e++)i.appendChild(r[e])}_updateItemRoles(e){const t=this;for(let n in t._menuItems){const o=t._menuItems[n],i=o.parentItem||t;e&&i!==e||(t.checkboxes&&i.checkable?o.setAttribute("role","checkbox"===i.checkMode?"menuitemcheckbox":"menuitemradio"):o.setAttribute("role","menuitem"))}t._refreshCheckableItems(e)}_updateScrollButtonVisibility(e,t,n){const o=this,i=o.overflow,r=e===o.$.mainContainer;if(r&&"hidden"===i)return;let a,s,l,d=!0,m=!0;if(t?(a="scrollLeft",s="offsetWidth",l="scrollWidth"):(a="scrollTop",s="offsetHeight",l="scrollHeight"),0===Math.round(e[a])&&(d=!1),Math.round(e[s]+e[a])>=Math.round(e[l])&&(m=!1),r&&"auto"!==i)"scroll"!==i||o.disabled||(n[0].disabled=!d,n[1].disabled=!m);else{if(d&&m)return n[0].$.removeClass("smart-hidden"),n[1].$.removeClass("smart-hidden"),void e.classList.remove("one-button-shown");d?n[0].$.removeClass("smart-hidden"):n[0].$.addClass("smart-hidden"),m?n[1].$.removeClass("smart-hidden"):n[1].$.addClass("smart-hidden"),e.classList.add("one-button-shown")}}_validateRadioButtonSelection(e,t,n){const o=this;if(o.checkboxes){let i,r;if(1===t?(i=o,r=o.$.mainContainer):(i=e,r=e.itemContainer),"radioButton"===i.checkMode&&i.checkable)if(n.length>1)for(let e=n.length-2;e>=0;e--)n[e].set("checked",!1),n[e].removeAttribute("aria-checked");else if(0===n.length){const e=o._getFirstEnabledChild(r);e&&!o.disableAutoCheck&&(e.set("checked",!0),e.setAttribute("aria-checked",!0))}}}});
67
67
  (()=>{class e extends HTMLElement{constructor(){super(),this._properties={min:50,label:"Item",modifiers:["resize","drag","close"],size:null}}_setProperty(e,t){const i=this;if(i._properties[e]===t)return;if(i._properties[e]=t,i._updating=!0,"disabled"===e||"modifiers"===e?t?i.setAttribute(e,t):i.removeAttribute(e):null===t?i.removeAttribute(e):i.setAttribute(e,t),!i.isCompleted)return;const r=i.closest("smart-layout");r&&(r._resizeDetails||r._updating||!r.isRendered||r.refresh()),i._updating=!1}get label(){return this._properties.label}set label(e){this._setProperty("label",e)}get modifiers(){return this._properties.modifiers}set modifiers(e){this._setProperty("modifiers",e)}get min(){return this._properties.min}set min(e){this._setProperty("min",e)}get size(){return this._properties.size}set size(e){null!==e?"string"==typeof e?this._setProperty("size",e):this._setProperty("size",Math.max(this.min,e)):this._setProperty("size",e)}static get observedAttributes(){return["min","size","label","modifiers"]}attributeChangedCallback(e,t,i){const r=this;if(t!==i&&r.isCompleted)if("size"===e){if(!r._updating){if(null===i)return void(this[e]=null);r[e]=Math.max(r.min,parseInt(i))}}else r[e]=i}connectedCallback(){this.isCompleted||this.render()}whenRendered(e){const t=this;t.isRendered?e():(t.whenRenderedCallbacks||(t.whenRenderedCallbacks=[]),t.whenRenderedCallbacks.push(e))}render(){const e=this;e.hasAttribute("data-id")||e.setAttribute("data-id","id"+Math.random().toString(16).slice(2)),e.hasAttribute("label")||e.setAttribute("label",e.label),e.hasAttribute("min")||e.setAttribute("min",e.min),e.hasAttribute("label")||e.setAttribute("label",e.label),e.hasAttribute("modifiers")||e.setAttribute("modifiers",e.modifiers);for(let t=0;t<e.attributes.length;t++){const i=e.attributes[t],r=i.name,s=i.value;isNaN(s)||"min"!==r&&"size"!==r?e._properties[r]=s:e._properties[r]=parseInt(s)}if(e.classList.add("smart-layout-item"),e.isCompleted=!0,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}}}class t extends e{constructor(){super(),this._properties.label="Group",this._properties.orientation="vertical"}get orientation(){return this._properties.orientation}set orientation(e){this._setProperty("orientation",e)}static get observedAttributes(){return["min","size","modifiers","orientation","position"]}render(){const e=this;super.render(),e.className="smart-layout-group",e.hasAttribute("orientation")?e._properties.orientation=e.getAttribute("orientation"):e.setAttribute("orientation",e._properties.orientation)}}class i extends t{constructor(){super(),this._properties.position="top",this._properties.label="TabGroup"}get position(){return this._properties.position}set position(e){this._setProperty("position",e)}render(){const e=this;super.render(),!e.hasAttribute("position")&&e.position&&e.setAttribute("position","top")}static get observedAttributes(){return["min","size","modifiers","orientation","position"]}}class r extends t{constructor(){super(),this._properties.label="TabItem"}}customElements.define("smart-layout-group",t),customElements.define("smart-layout-item",e),customElements.define("smart-tab-layout-group",i),customElements.define("smart-tab-layout-item",r),Smart("smart-layout",class extends Smart.ContentElement{static get properties(){return{allowLiveSplit:{value:!1,type:"boolean"},allowContextMenu:{value:!1,type:"boolean"},contextMenuDataSource:{value:["select","delete"],type:"any"},dataSource:{reflectToAttribute:!1,value:null,type:"any"},messages:{value:{en:{select:"Select Parent",delete:"Delete"}},type:"object",extend:!0},orientation:{value:"vertical",type:"string"},selectedIndex:{value:null,type:"any"}}}static get listeners(){return{contextmenu:"_contextMenuHandler","document.down":"_documentDownHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","document.selectstart":"_documentSelectStartHandler",mouseleave:"_leaveHandler",mouseenter:"_enterHandler",dragStart:"_dragStart","document.keyup":"_keyUpHandler"}}_dragStart(e){e.stopPropagation(),e.preventDefault()}_leaveHandler(){const e=this;e._resizeDetails||(e._handleButtonsVisibility(null),e._hideSplitter(),requestAnimationFrame((()=>{e.classList.remove("outline")})))}_enterHandler(){const e=this;e._resizeDetails||(e._handleButtonsVisibility(e._selectedItem),e._updateSplitter(),requestAnimationFrame((()=>{e.classList.add("outline")})))}template(){return'<div id="container" role="presentation"><smart-layout-group data-id="root" id="itemsContainer"><content></content></smart-layout-group><div root-splitter id="splitter" class="smart-layout-splitter"></div>'}propertyChangedHandler(e,t,i){const r=this;switch(e){case"contextMenuDataSource":r._contextMenu&&(r._closeContextMenu(),r._contextMenu.innerHTML="");break;case"orientation":r.$.itemsContainer&&(r.$.itemsContainer.orientation=r.orientation);break;case"dataSource":r.dataBind();break;case"selectedIndex":r._handleItemClick(r.getItem(i+""),!0);break;default:super.propertyChangedHandler(e,t,i)}}dataBind(){const e=this;e.$.itemsContainer.innerHTML="";let t="";const i=(e,r)=>{for(let s=0;s<e.length;s++){const n=e[s],o=n.size,a=n.min,l=n.modifiers,d=n.type,c=n.position,u=n.orientation?n.orientation:"vertical";let p="";if(void 0!==o&&(p+=`size="${o}" `),void 0!==a&&(p+=`min="${a}" `),void 0!==l&&(p+=`modifiers="${l}" `),void 0!==c&&(p+=`position="${c}" `),n.items)p+=`orientation=${u} `,"tabs"===d?(t+=`<smart-tab-layout-group ${p}>`,i(n.items,!0),t+="</smart-tab-layout-group>"):(t+=`<smart-layout-group ${p}>`,i(n.items),t+="</smart-layout-group>");else{const e=n.content||"";t+=r?`<smart-tab-layout-item ${p}>`+e+"</smart-tab-layout-item>":`<smart-layout-item ${p}>`+e+"</smart-layout-item>"}}};i(e.dataSource),e.$.itemsContainer.innerHTML=t,e.refresh()}render(){const e=this;e.setAttribute("role","group"),e.selectedIndex&&e._handleItemClick(e.getItem(e.selectedIndex+""),!0),e.checkLicense();const t=()=>{e.dataSource?e.dataBind():e.dataSource=e._getDataSource(e._getLayout()),e.$.itemsContainer.orientation=e.orientation,super.render(),e.refresh(),e._updateSplitter()};"complete"===document.readyState?t():window.addEventListener("load",(()=>{t()}))}getItem(e){if(null==e)return;e=(e+"").split(".");let t,i=this._getDataSource(this._getLayout());for(let r=0;r<e.length&&(t=i[e[r]],t);r++)i=t.items;return t}_contextMenuHandler(e){const i=this;let r=e.target;if(i.allowContextMenu&&r.closest){if(r.closest(".smart-layout-context-menu"))return void e.preventDefault();let s=i.querySelector("[selected][data-id]");if(s||(s=r.closest(".smart-layout-item")||r.closest(".smart-layout-group")),!s)return;e.preventDefault(),i._createContextMenu();const n=i._contextMenu.children;for(let e=0;e<n.length;e++){const i=n[e];"delete"===i.getAttribute("value")?s.hasAttribute("index")&&"0"===s.getAttribute("index")?i.setAttribute("disabled",""):i.removeAttribute("disabled"):"select"===i.getAttribute("value")&&(s.hasAttribute("index")&&"0"===s.getAttribute("index")||!(s.parentElement instanceof t)?i.setAttribute("disabled",""):i.removeAttribute("disabled"))}i._openContextMenu(s,e.pageX,e.pageY)}}_createContextMenu(){const e=this;let t=e._contextMenu;if(t||(t=document.createElement("div"),t.classList.add("smart-layout-context-menu","smart-visibility-hidden"),e._contextMenu=t),!t.innerHTML){const i=e.contextMenuDataSource;for(let r=0;r<i.length;r++){const s=i[r];let n,o;"object"==typeof s?(n=s.label,o=s.value):o=n=s+"",t.innerHTML+=`<div class="smart-layout-context-menu-item" value="${o}">${e.localize(n)||n}</div>`}}}_openContextMenu(e,t,i){const r=this,s=r._contextMenu;if(!s||!s.classList.contains("smart-visibility-hidden"))return;r.$.fireEvent("opening").defaultPrevented||e.parentElement&&(s._target=e,r._opening=!0,r.$.container.appendChild(s),r._positionContextMenu(t,i),s.classList.remove("smart-visibility-hidden"),r.$.fireEvent("open"))}_closeContextMenu(){const e=this,t=e._contextMenu;if(!t||t.classList.contains("smart-visibility-hidden"))return;e.$.fireEvent("closing").defaultPrevented||(delete e._opening,e.hasAnimation&&t.addEventListener("transitionend",e._contextMenuTransitionEndHandler.bind(e),{once:!0}),t.classList.add("smart-visibility-hidden"),e.$.fireEvent("close"))}_contextMenuTransitionEndHandler(){const e=this,t=e._contextMenu;t&&!e._opening&&t.parentElement&&e.$.container.removeChild(t)}_positionContextMenu(e,t){const i=this._contextMenu;if(!i)return;const r=this.$.container.getBoundingClientRect();e-=r.left+window.pageXOffset,t-=r.top+window.pageYOffset,e+i.offsetWidth>r.width&&(e-=e+i.offsetWidth-r.width),t+i.offsetHeight>r.height&&(t-=t+i.offsetHeight-r.height),i.style.left=e+"px",i.style.top=t+"px"}_documentDownHandler(e){const t=this,i=e.originalEvent.target;t.contains(i)&&i.closest&&(t._target=i,t._updateSplitter())}_documentMoveHandler(e){const t=this,s=e.originalEvent.target,n=t._contextMenu;if(n&&!Smart.Utilities.Core.isMobile){if(n.querySelector(".smart-layout-context-menu-item[hover]")){const e=n.children;for(let t=0;t<e.length;t++)e[t].removeAttribute("hover")}n.contains(s)&&s.closest&&s.closest(".smart-layout-context-menu-item")&&s.setAttribute("hover","")}if(t._dragDetails){const s=Math.abs(t._dragDetails.pageX-e.pageX);if(Math.abs(t._dragDetails.pageY-e.pageY)<=5&&s<=5)return;t._dragDetails.feedback.parentElement||(document.body.appendChild(t._dragDetails.feedback),document.body.appendChild(t._dragDetails.overlay),setTimeout((()=>{t._dragDetails.feedback.classList.add("dragging")}),100)),t._dragDetails.dragging=!0,t._dragDetails.feedback.style.left=e.pageX-t._dragDetails.feedback.offsetWidth/2-5+"px",t._dragDetails.feedback.style.top=e.pageY-t._dragDetails.feedback.offsetHeight/2-5+"px";const n=document.elementsFromPoint(e.pageX,e.pageY);let o=null,a=!1;for(let e=0;e<n.length;e++){const s=n[e];if(!t._dragDetails.feedback.contains(s)){if(s.classList.contains("smart-layout-tab-strip")){if(t._dragDetails.element.contains(s))continue;o=s.parentElement,a=!0;break}if((s.parentElement!==t._dragDetails.parent&&s!==t._dragDetails.parent||1!==t._dragDetails.layoutGroup.items.length)&&!t._dragDetails.element.contains(s)){if(s instanceof r){o=s.parentElement;break}if(s instanceof i){o=s;break}}}}const l=(i,r)=>{const s=t.offset(i);let n=null,o=50,a=r,l=r;r?o=0:(l=i.offsetWidth/3,a=i.offsetHeight/3);const d=[{left:s.left,top:s.top,right:s.left+o,bottom:s.top+o,position:"top"},{left:s.left+o,top:s.top,right:s.left+i.offsetWidth-o,bottom:s.top+a-o,position:"top"},{left:s.left+i.offsetWidth-o,top:s.top,right:s.left+i.offsetWidth,bottom:s.top+o,position:"top"},{left:s.left,top:s.top+o,right:s.left+l,bottom:s.top+i.offsetHeight-o,position:"left"},{left:s.left+i.offsetWidth-l,top:s.top+o,right:s.left+i.offsetWidth,bottom:s.top+i.offsetHeight-o,position:"right"},{left:s.left,top:s.top+i.offsetHeight-o,right:s.left+o,bottom:s.top+i.offsetHeight,position:"bottom"},{left:s.left+o,top:s.top+i.offsetHeight-a+o,right:s.left+i.offsetWidth-o,bottom:s.top+i.offsetHeight,position:"bottom"},{left:s.left+i.offsetWidth-o,top:s.top+i.offsetHeight-o,right:s.left+i.offsetWidth,bottom:s.top+i.offsetHeight,position:"bottom"}];for(let t=0;t<d.length;t++){const i=d[t];if(i.left<=e.pageX&&e.pageX<=i.right&&i.top<=e.pageY&&e.pageY<=i.bottom){n=i.position;break}}return n},d=t.querySelector("smart-layout-group");let c=l(d,10),u=null;c?u=d:o?a?o!==t._dragDetails.parent&&(c="center",u=o):(c=l(o)||"center",u=o):t._handleDropArea(null),u&&(t._dragDetails.current=u,t._dragDetails.position=c,t._handleDropArea(u,c))}if(t._resizeDetails){const i=Math.abs(t._resizeDetails.clientX-e.clientX),r=Math.abs(t._resizeDetails.clientY-e.clientY),s=t._resizeDetails.splitter,n=t._resizeDetails.item,o=t._resizeDetails.itemRect,a=t._resizeDetails.previousItemRect,l=t._resizeDetails.previousItem,d=t._resizeDetails.nextItemRect,c=t._resizeDetails.nextItem,u=parseInt(n.getAttribute("min")),p=e=>{e.classList.contains("smart-visibility-hidden")||(e.style.right="",e.style.top="",e.style.left="",e.style.bottom="")};if(p(s),p(t.$.splitter),s.classList.remove("error"),s.classList.add("active"),!t._resizeDetails.dragging){if(s.classList.contains("horizontal")&&r<=5)return;if(s.classList.contains("vertical")&&i<=5)return;t._resizeDetails.dragging=!0}let m={clientPos:"clientX",pos:"x",size:"width",near:"left",far:"right",offsetSize:"offsetWidth"};s.classList.contains("horizontal")&&(m={clientPos:"clientY",pos:"y",size:"height",near:"top",far:"bottom",offsetSize:"offsetHeight"});const f=e=>{const i=t.offset(e),r=t.offset(t);t.$.splitter.style.width=e.offsetWidth+"px",t.$.splitter.style.height=e.offsetHeight+"px",t.$.splitter.className=e.className,t.$.splitter.style.left=i.left-r.left+"px",t.$.splitter.style.top=i.top-r.top+"px",e.setAttribute("drag",""),t.$.splitter.setAttribute("drag","")};if(s.classList.contains("last")){let i=e[m.clientPos]-t._resizeDetails.splitterRect[m.pos],r=o[m.size]-u;if(i>r&&(i=r,s.classList.add("error")),a){const e=parseInt(l.getAttribute("min"));let t=a[m.size]-e;i<-t&&(i=-t,s.classList.add("error"))}s.style[m.near]=i+"px";const d=n[m.offsetSize]-i;if(n.setAttribute("size",d),l){const e=n[m.offsetSize]+l[m.offsetSize]-d;l.setAttribute("size",e)}}else{let i=-e[m.clientPos]+t._resizeDetails.splitterRect[m.pos],r=o[m.size]-u;if(i>r&&(i=r,s.classList.add("error")),d){const e=parseInt(c.getAttribute("min"));let t=-d[m.size]+e;i<t&&(i=t,s.classList.add("error"))}s.style[m.far]=i+"px";const a=n[m.offsetSize]-i;if(n.setAttribute("size",a),c){const e=c[m.offsetSize]+n[m.offsetSize]-a;c.setAttribute("size",e)}}f(s)}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}_keyUpHandler(e){const t=this;if("Escape"===e.key){if(t._dragDetails&&(t._dragDetails.feedback.remove(),t._dragDetails.overlay.remove(),t._dragDetails=null,t._handleDropArea(null)),t._resizeDetails){const e=t._resizeDetails;return e.splitter.classList.contains("last")?e.previousItem.size=e.previousItemSize:e.nextItem.size=e.nextItem.previousItemSize,e.item.size=e.itemSize,t.refresh(),t._handleItemClick(e.item),void(t._resizeDetails=null)}}else"Delete"===e.key&&t._selectedItem&&t._removeLayoutItem(t._selectedItem)}_endDrag(){const e=this;if(e._handleDropArea(null),!e._dragDetails.dragging)return void(e._dragDetails=null);const t=e._dragDetails.current,i=e._dragDetails.element,r=e._dragDetails.position;if(e._handleDropArea(null),t){if(e._addTabLayoutItem(t,r,i),e._removeLayoutItem(i),t.parentElement&&1===Array.from(t.parentElement.parentElement.children).filter((e=>!!e.classList.contains("smart-layout-group"))).length){const i=t.parentElement,r=i.parentElement,s=r.parentElement;if("root"!==r.getAttribute("data-id")&&"root"!==s.getAttribute("data-id")&&s!==e){const e=Array.from(s.children).indexOf(i.parentElement);e>=0?s.insertBefore(i,s.children[e]):s.appendChild(i),r.remove()}}e.refresh(),e._updateSplitter(),requestAnimationFrame((()=>{e.classList.add("outline"),e.querySelectorAll(".smart-element").forEach((e=>{e.$.fireEvent("resize")}))}))}e.$.fireEvent("stateChange",{type:"insert",item:i}),e._dragDetails.feedback.remove(),e._dragDetails.overlay.remove(),e._dragDetails=null}_documentUpHandler(e){const t=this,i=Smart.Utilities.Core.isMobile,s=i?document.elementFromPoint(e.pageX-window.pageXOffset,e.pageY-window.pageYOffset):e.originalEvent.target;if(2!==e.button){if(t._dragDetails&&t._endDrag(e),t._resizeDetails){const e=t._resizeDetails;return e.item&&(e.item.style.overflow=""),e.previousItem&&(e.previousItem.style.overflow=""),e.nextItem&&(e.nextItem.style.overflow=""),t.refresh(),t._handleItemClick(e.item),t._resizeDetails=null,void t.querySelectorAll(".smart-element").forEach((e=>{e.$.fireEvent("resize")}))}if(t.contains(s)&&(t.classList.add("outline"),t._target&&!s.item&&(s instanceof r?t._handleItemClick(s):t._handleItemClick(s.closest(".smart-layout-item"))),t._target)){if(t._target!==s)return void delete t._target;if(!e.button&&s.closest(".smart-layout-buttons-container")){const i=e.originalEvent.target;t._handleButtonClick(i.item,i.position)}else s.closest(".smart-layout-context-menu")&&(!i&&!e.button||i)&&t._handleMenuItemClick(s.closest(".smart-layout-context-menu-item"));delete t._target}}}_documentSelectStartHandler(e){this._target&&e.preventDefault()}_getDataSource(i,r,s){const n=this;let o=[];s||(s=0),r||(r="");for(let a=0;a<i.length;a++){const l=i[a],d={label:l.label,id:l.getAttribute("data-id"),orientation:l.orientation,size:l.size,min:l.min,type:l.type,modifiers:l.modifiers,position:l.position};if(l.removeAttribute("index"),l instanceof t){if(o.push(d),d.index=""!==r?r+"."+s:s.toString(),l.setAttribute("index",d.index),l.items){const e=n._getDataSource(l.items,d.index,0);d.items=e}}else if(l instanceof e)if(l.items){const e=n._getDataSource(l.items,r,s);o=o.concat(e)}else d.index=""!==r?r+"."+s:s.toString(),l.setAttribute("index",d.index),o.push(d);s++}return o}_getLayout(){const e=this,i=arguments.length?arguments[0]:e.$.itemsContainer;e._buttons&&e._buttons.remove(),e._dropArea&&e._dropArea.remove();const r=e.querySelectorAll(".smart-layout-splitter");for(let t=0;t<r.length;t++){const i=r[t];i!==e.$.splitter&&i.remove()}i.items=Array.from(i.children),i.items=i.items.filter((e=>e!==i.tabs&&e.hasAttribute("data-id")));const s=i.items.map((function(i){if(i.classList.contains("smart-layout-tab-strip"))return null;const r=i,s=i instanceof t?i:null;return s&&(r.items=e._getLayout(s)),r}));if(i!==e.$.itemsContainer)return s.filter((e=>null!==e&&e!==i.tabs));const n=[],o=i;return o.items=s.filter((e=>null!==e&&e!==i.tabs)),n.push(o),n}_updateSplitter(){const e=this;e._buttons&&e._dragDetails&&e._buttons.remove(),e._removeSplitter();const t=e.querySelectorAll("[data-id]");for(let i=0;i<t.length;i++){const r=t[i];if("root"!==r.getAttribute("data-id")){if(r.hasAttribute("role")){const e=r.getAttribute("role");if("gridcell"===e||"row"===e||"columnheader"===e||"rowheader"===e)continue}r.setAttribute("hover",""),e._handleSplitter(r)}}}_hideSplitter(){const e=this.querySelectorAll("[data-id]");for(let t=0;t<e.length;t++){e[t].removeAttribute("hover")}}_removeSplitter(){const e=this,t=e.querySelectorAll(".smart-layout-splitter");for(let i=0;i<t.length;i++){const r=t[i];r!==e.$.splitter&&r.remove()}e._hideSplitter()}_handleItemClick(e){const t=this,i=t.selectedIndex;let r=null;return e?(r=e instanceof HTMLElement?e:t.querySelector("[data-id="+e.id+"]"),r&&r.readonly?(t._closeContextMenu(),void(t.selectedIndex=null)):(t.querySelectorAll("[data-id]").forEach((e=>e.removeAttribute("selected"))),t._closeContextMenu(),void(r?(t.selectedIndex=r.getAttribute("index"),r.setAttribute("selected",""),r.setAttribute("hover",""),t._selectedItem=r,r.classList.contains("smart-hidden")&&t.refresh(),t._handleButtonsVisibility(r),i!==t.selectedIndex&&t.$.fireEvent("change",{selectedIndex:t.selectedIndex,oldSelectedIndex:i}),t._updateSplitter()):t.refresh()))):(t._closeContextMenu(),t.selectedIndex=null,t.querySelectorAll("[data-id]").forEach((e=>e.removeAttribute("selected"))),void(t._selectedItem=null))}_handleButtonClick(e,t){const i=this,r=i._addLayoutItem(e,t);i.$.fireEvent("stateChange",{type:"insert",item:r}),i._handleItemClick(r,!0)}_handleMenuItemClick(e){const t=this;if(!e||e.hasAttribute("disabled"))return;const i=e.getAttribute("value"),r=t._contextMenu;t.$.fireEvent("menuItemClick",{target:r?r._target:null,item:e,label:e.textContent,value:i});const s=r._target;s&&("select"===i&&t._handleItemClick(s.parentElement?s.parentElement:s),"delete"===i&&t._removeLayoutItem(s))}_removeLayoutItem(t){const i=this;if("root"!==t.getAttribute("data-id")){if(t instanceof e&&1===t.parentElement.items.length){let e=t.parentElement,r=e;for(;e&&e.items&&1===e.items.length&&"root"!==e.getAttribute("data-id");)r=e,e=e.parentElement;"root"!==r.getAttribute("data-id")?r.remove():i.allowLiveSplit&&r.appendChild(document.createElement("smart-layout-item"))}else t.remove();i.refresh(),i.$.fireEvent("stateChange",{type:"delete",item:t})}}refresh(){const e=this;if(e._isUpdating)return;e.dataSource=e._getDataSource(e._getLayout()),e.$.splitter.className="smart-visibility-hidden smart-layout-splitter";const t=t=>{const s=e.getItem(t.getAttribute("index"));if(!s)return;t.style.gridTemplateColumns="",t.style.gridTemplateRows="";let n="",o=0,a=0;if(t instanceof i){t.tabs&&t.tabs.remove();const i=document.createElement("div");i.classList.add("smart-layout-tab-strip"),e._selectedItem&&t.contains(e._selectedItem)&&e._selectedItem instanceof r&&(t.selectedIndex=Math.max(0,t.items.indexOf(e._selectedItem))),t.selectedIndex>=t.children.length&&(t.selectedIndex=0);for(let r=0;r<t.children.length;r++){const n=t.children[r],o=e.getItem(n.getAttribute("index"));if(!o)continue;const a=document.createElement("div");a.classList.add("smart-layout-tab"),a.innerHTML="<label>"+o.label+'</label><span class="smart-close-button"></span>',i.appendChild(a),n.setAttribute("tab",""),n.classList.add("smart-hidden"),a.content=n,a.item=o,a.group=s,n.modifiers?-1===n.modifiers.indexOf("close")&&a.querySelector(".smart-close-button").classList.add("smart-hidden"):a.querySelector(".smart-close-button").classList.add("smart-hidden"),void 0!==t.selectedIndex&&r!==t.selectedIndex||(a.classList.add("selected"),n.classList.remove("smart-hidden"),t.selectedIndex=r),a.onpointerup=function(i){i.target.classList.contains("smart-close-button")&&a.close&&(t.selectedIndex=0,e._removeLayoutItem(e._selectedItem),e._handleItemClick(parent))},a.onpointerdown=function(t){const i=this.closest(".smart-layout-group");e._handleItemClick(this.content),a.close=!1,t.target.classList.contains("smart-close-button")?a.close=!0:o.modifiers&&o.modifiers.indexOf("drag")>=0&&e._beginDrag(i,this,t)}}t.tabs=i,"top"===s.position||"left"===s.position?t.insertBefore(i,t.firstChild):t.appendChild(i)}else{for(var l=0;l<t.children.length;l++){var d=t.children[l];if(d.hasAttribute("size")){var c=d.getAttribute("size"),u=parseFloat(c),p="vertical"===t.orientation?t.offsetWidth:t.offsetHeight,m=c.indexOf("%")>=0?parseFloat(c):parseFloat(u/p*100);if(o+=m,a++,a===t.children.length){if(o<100){n+="1fr ",o=100;continue}o>100&&(o-=m,m=100-o,o=100)}else if(o>100||0===m){a=t.children.length,o=0;break}n+=m+"% "}else n+="1fr "}if(a===t.children.length&&(o<99||o>100)){n="";for(let e=0;e<t.children.length;e++){t.children[e].removeAttribute("size"),n+="1fr "}}"vertical"===t.orientation?t.style.gridTemplateColumns=n:t.style.gridTemplateRows=n}t.items=Array.from(t.children),t.items=t.items.filter((e=>e!==t.tabs))},s=e.querySelectorAll(".smart-layout-group");for(let e=0;e<s.length;e++)t(s[e])}_beginDrag(e,t,i){const r=this;r._dragDetails&&r._dragDetails.feedback.remove();const s=document.createElement("div"),n=document.createElement("div"),o=e.querySelector(".smart-layout-tab-strip");let a="";if(o)for(let t=0;t<Array.from(o.children).length;t++)t===e.selectedIndex&&(a=o.children[t].innerText);s.innerHTML=`<smart-layout><smart-tab-layout-group><smart-tab-layout-item label="${a}"></smart-tab-layout-item></smart-tab-layout-group></smart-layout>`,r._feedback=s,r._feedback.classList.add("smart-layout-feedback","smart-layout"),n.classList.add("smart-layout-overlay"),r._dragDetails={element:t.content,item:t.item,layoutGroup:t.group,parent:e,overlay:n,feedback:s,pageX:i.pageX,pageY:i.pageY}}moveChildren(e,t){t.innerHTML="";let i=e;for(;i.firstChild;){const e=i.firstChild;t.appendChild(e)}}createLayoutItem(e,t){const i=this;return"layoutItem"!==e&&e?"tabLayoutItem"!==e&&e?"tabLayoutGroup"===e?(e=>{const t=document.createElement("smart-tab-layout-group"),r="top"===e||"bottom"===e?"horizontal":"vertical";return t.setAttribute("orientation",r),t.orientation=r,i.$.fireEvent("createGroup",{item:t,type:"tabLayoutGroup"}),t})(t):(e=>{const t=document.createElement("smart-layout-group"),r="top"===e||"bottom"===e?"horizontal":"vertical";return i.$.fireEvent("createGroup",{item:t,type:"layoutGroup"}),t.setAttribute("orientation",r),t.orientation=r,t})(t):(()=>{const e=document.createElement("smart-tab-layout-item");return e.innerHTML="",i.$.fireEvent("createItem",{item:e,type:"tabLayoutItem"}),e})():(()=>{const e=document.createElement("smart-layout-item");return e.innerHTML="",i.$.fireEvent("createItem",{item:e,type:"layoutItem"}),e})()}_addTabLayoutItem(s,n,o){const a=this,l=a.createLayoutItem("tabLayoutItem"),d=s.closest("smart-tab-layout-group");let c;o&&(l.label=o.label,l.modifiers=o.modifiers,a.moveChildren(o,l));const u=e=>{for(let t=0;t<e.children.length;t++){e.children[t].removeAttribute("size")}e.removeAttribute("size")},p=e=>{if(s.removeAttribute("size"),s.querySelector("smart-layout-group"))a._addLayoutItem(s.querySelector("smart-layout-group"),e);else{c=a.createLayoutItem("layoutGroup",e);const t=a.createLayoutItem();a.moveChildren(s,t),"top"===e||"left"===e?(c.appendChild(a.createLayoutItem()),c.appendChild(t)):(c.appendChild(t),c.appendChild(a.createLayoutItem())),s.appendChild(c)}},m=(e,t)=>{const i=s.parentElement,r=s,n=a.createLayoutItem("layoutGroup",t);i.insertBefore(n,r),"top"===t||"left"===t?(n.append(e),n.appendChild(r)):(n.appendChild(r),n.append(e)),"root"===r.getAttribute("data-id")&&(r.setAttribute("data-id",n.getAttribute("data-id")),n.setAttribute("data-id","root"),a.$.itemsContainer=n),u(r),u(i)};if(o)switch(n){case"center":if(s instanceof i||s instanceof r)d.appendChild(l);else{const i=a.createLayoutItem("tabLayoutGroup","top");i.appendChild(l),s instanceof t&&!(s instanceof r)?(s.appendChild(i),u(s)):s instanceof e&&(c=a.createLayoutItem("layoutGroup"),s.parentElement.insertBefore(c,s),c.appendChild(s),c.appendChild(i),u(c))}break;case"left":case"right":{const e=a.createLayoutItem("tabLayoutGroup","top");e.appendChild(l),"root"===s.getAttribute("data-id")?(e.position=n,m(e,n)):m(e,n)}break;case"top":case"bottom":{const e=a.createLayoutItem("tabLayoutGroup","top");e.appendChild(l),"root"===s.getAttribute("data-id")?(e.position=n,m(e,n)):m(e,n);break}}else{switch(n){case"center":s instanceof i||s instanceof r?d.appendChild(l):p();break;case"left":case"right":if(s instanceof i){const e=s.querySelector("smart-tab-layout-item");e&&"left"===n?s.insertBefore(l,e):s.appendChild(l)}else if(s instanceof r){const e=a.createLayoutItem("tabLayoutGroup","top"),t=s.parentElement;e.appendChild(l),c=a.createLayoutItem("layoutGroup"),t.parentElement.insertBefore(c,t),"right"===n?(c.appendChild(t),c.appendChild(e)):"left"===n&&(c.appendChild(e),c.appendChild(t))}else if(o){const i=a.createLayoutItem("tabLayoutGroup","top");i.appendChild(l),s instanceof t?s.insertBefore(s.firstChild,i):s instanceof e&&(c=a.createLayoutItem("layoutGroup"),c.orientation=d.orientation,c.setAttribute("orientation",d.orientation),s.removeAttribute("size"),s.parentElement.insertBefore(c,s),c.appendChild(s),c.appendChild(i))}else p(n);break;case"top":case"bottom":s instanceof i?(c=a.createLayoutItem("layoutGroup","top"),s.removeAttribute("size"),s.parentElement.insertBefore(c,s),"top"===n?(c.appendChild(a.createLayoutItem()),c.appendChild(s)):(c.appendChild(s),c.appendChild(a.createLayoutItem()))):p(n)}a.refresh()}}_addLayoutItem(s,n,o){const a=this;if(!s)return;const l=e=>{for(let t=0;t<e.children.length;t++){e.children[t].removeAttribute("size")}e.removeAttribute("size")};if(s instanceof r||s instanceof i||o&&o instanceof r)return a._addTabLayoutItem(s,n,o);const d=a.createLayoutItem(),c=s.closest(".smart-layout-group");let u;if(o&&a.moveChildren(o,d),"center"===n){if(s instanceof t)return u=c,u.appendChild(d),l(u),a.refresh(),d;if(s instanceof e)return u=a.createLayoutItem("layoutGroup"),u.orientation=c.orientation,u.setAttribute("orientation",c.orientation),s.removeAttribute("size"),s.parentElement.insertBefore(u,s),u.appendChild(s),u.appendChild(d),a.refresh(),u}if("vertical"===c.orientation&&("left"===n||"right"===n)||"horizontal"===c.orientation&&("top"===n||"bottom"===n))if(u=c,s instanceof t)"left"===n||"top"===n?u.insertBefore(d,u.children[0]):u.appendChild(d),l(s);else{const e=u.items,t=Math.max(0,e.indexOf(s)+("top"===n||"left"===n?0:1));u.insertBefore(d,e[t]),l(u)}else if(s instanceof t){const e=s.parentElement,t=s,i=a.createLayoutItem("layoutGroup",n);e.insertBefore(i,t),"top"===n||"left"===n?(i.append(d),i.appendChild(t)):(i.appendChild(t),i.append(d)),"root"===t.getAttribute("data-id")&&(t.setAttribute("data-id",i.getAttribute("data-id")),i.setAttribute("data-id","root"),a.$.itemsContainer=i),l(e)}else u=a.createLayoutItem("layoutGroup",n),c.insertBefore(u,s),"top"===n||"left"===n?(u.appendChild(d),u.appendChild(s)):(u.appendChild(s),u.appendChild(d)),l(u);return a.refresh(),d}_handleButtonsVisibility(e){const t=this;if(t._buttons||(t._buttons=document.createElement("div"),t._buttons.classList.add("smart-layout-buttons-container"),t._buttons.innerHTML='<div role="button" position="top"></div>\n <div role="button" position="bottom"></div>\n <div role="button" position="center"></div>\n <div role="button" position="left"></div>\n <div role="button" position="right"></div>'),e||!t._buttons.parentElement){if(e){const i=e._buttonPosition||[],r=t._buttons.children;for(let t=0;t<r.length;t++){const s=r[t];s.position=s.getAttribute("position"),s.item=e,i.length&&i.indexOf(s.getAttribute("position"))<0?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),s.onmouseenter=()=>{s.setAttribute("hover","")},s.onmouseleave=()=>{s.removeAttribute("hover")}}t.allowLiveSplit&&t._buttons.parentElement!==e&&e.appendChild(t._buttons)}}else t._buttons.parentElement.removeChild(t._buttons)}_handleDropArea(e,t="center"){const i=this,r=e=>{switch(e){case"left":i._dropArea.style.top="0px",i._dropArea.style.left="0px",i._dropArea.style.width="50%",i._dropArea.style.height="100%";break;case"right":i._dropArea.style.top="0px",i._dropArea.style.left="calc(100% - 50%)",i._dropArea.style.width="50%",i._dropArea.style.height="100%";break;case"top":i._dropArea.style.top="0px",i._dropArea.style.left="0px",i._dropArea.style.width="100%",i._dropArea.style.height="50%";break;case"bottom":i._dropArea.style.top="calc(100% - 50%)",i._dropArea.style.left="0px",i._dropArea.style.width="100%",i._dropArea.style.height="50%";break;case"center":i._dropArea.style.top="0px",i._dropArea.style.left="0px",i._dropArea.style.width="100%",i._dropArea.style.height="100%"}};i._dropArea&&i._dropArea.parentElement===e?r(t):(i._dropArea&&i._dropArea.remove(),i._dragDetails&&e&&(i._dropArea=document.createElement("div"),i._dropArea.classList.add("smart-layout-drop-area"),e.appendChild(i._dropArea),i._dropArea.style.opacity=1,r(t)))}_handleSplitter(e){const t=this;if(!e)return;if(e.hasAttribute("tab")&&(e=e.parentElement),e._splitter&&e._splitter.remove(),e._splitter||(e._splitter=document.createElement("div")),t._dragDetails&&t._dragDetails.dragging)return void e._splitter.remove();if(-1===e.modifiers.indexOf("resize"))return;e.appendChild(e._splitter);const i=e.parentElement;if(i){e._splitter.className="smart-layout-splitter",e._splitter.item=e,e._splitter.removeAttribute("drag");const r=i.orientation;e.nextElementSibling&&e.nextElementSibling.hasAttribute("data-id")?e._splitter.classList.add(r):e.previousElementSibling&&e.previousElementSibling.hasAttribute("data-id")&&(e._splitter.classList.add(r),e._splitter.classList.add("last"));(e=>{e.style.top="",e.style.left="",e.style.bottom="",e.style.right="",e.onpointerdown=e=>{const i=e.target.item;i.style.overflow="hidden",t._resizeDetails={splitter:e.target,splitterRect:e.target.getBoundingClientRect(),itemRect:i.getBoundingClientRect(),item:i,itemSize:i.size,group:i.parentElement,clientX:e.clientX,clientY:e.clientY},t._selectedItem!==i&&(t.querySelectorAll("[data-id]").forEach((e=>e.removeAttribute("selected"))),t.selectedIndex=i.getAttribute("index"),i.setAttribute("selected",""),t._selectedItem=i,t._handleButtonsVisibility(i)),i.previousElementSibling&&i.previousElementSibling.hasAttribute("data-id")?(t._resizeDetails.previousItemRect=i.previousElementSibling.getBoundingClientRect(),t._resizeDetails.previousItem=i.previousElementSibling,t._resizeDetails.previousItemSize=i.previousElementSibling.size,t._resizeDetails.previousItem.style.overflow="hidden"):(t._resizeDetails.previousItemRect=null,t._resizeDetails.previousItem=null),i.nextElementSibling&&i.nextElementSibling.hasAttribute("data-id")?(t._resizeDetails.nextItemRect=i.nextElementSibling.getBoundingClientRect(),t._resizeDetails.nextItem=i.nextElementSibling,t._resizeDetails.nextItemSize=i.nextElementSibling.size,t._resizeDetails.nextItem.style.overflow="hidden"):(t._resizeDetails.nextItemRect=null,t._resizeDetails.nextItem=null)}})(e._splitter)}}})})();
68
68
  Smart("smart-list-menu",class extends Smart.Menu{static get properties(){return{displayLoadingIndicator:{value:!1,type:"boolean"},dropDownPosition:{value:"auto",allowedValues:["top-left","top-right","bottom-left","bottom-right","auto"],type:"string"},enableMouseWheelAction:{value:!0,type:"boolean"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterMember:{value:"label",type:"string"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},grouped:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},scrollMode:{value:"scrollButtons",allowedValues:["scrollbar","scrollButtons"],type:"string"}}}static get listeners(){return{resize:"_resizeHandler","backButton.click":"_backButtonClickHandler","filterInput.keyup":"_filterInputKeyupHandler","mainContainer.down":"_mainContainerDownHandler","mainContainer.move":"_mainContainerMoveHandler","mainContainer.swipeleft":"_mainContainerSwipeHandler","mainContainer.swiperight":"_mainContainerSwipeHandler","mainContainer.touchmove":"_mainContainerTouchmoveHandler","mainContainer.touchstart":"_mainContainerTouchstartHandler","view.click":"_viewHandler","view.mouseout":"_viewHandler","view.mouseover":"_viewHandler","view.transitionend":"_viewHandler"}}static get styleUrls(){return["smart.listmenu.css"]}template(){return`<div id="container" role="presentation">\n <div id="hamburgerIcon" class="smart-hamburger-icon smart-hidden" role="button" aria-label="Toggle minimized menu" aria-haspopup="true">\n <div id="hamburgerIconLineTop" class="smart-hamburger-icon-line smart-hamburger-icon-line-top" role="presentation"></div>\n <div id="hamburgerIconLineCenter" class="smart-hamburger-icon-line smart-hamburger-icon-line-center" role="presentation"></div>\n <div id="hamburgerIconLineBottom" class="smart-hamburger-icon-line smart-hamburger-icon-line-bottom" role="presentation"></div>\n <div id="customIconContainer" class="smart-hamburger-icon-custom-container smart-hidden" role="presentation"></div>\n </div>\n <div id="view" class="smart-list-menu-view" role="presentation">\n <div id="header" class="smart-header smart-hidden" role="heading" aria-level="1">\n <smart-button id="backButton" animation="[[animation]]" disabled="[[disabled]]" unfocusable right-to-left="[[rightToLeft]]" aria-label="Back">\n <div id="backButtonArrow" class="smart-arrow ${this.rightToLeft?"smart-arrow-right":"smart-arrow-left"}" aria-hidden="true"></div>\n </smart-button>\n <div id="title" class="smart-title"></div>\n </div>\n <div class="smart-list-menu-filter-input-container smart-hidden" id="filterInputContainer" role="presentation"><input id="filterInput" class="smart-filter-input" disabled="[[disabled]]" placeholder="[[filterInputPlaceholder]]" type="text" role="searchbox" aria-label="[[filterInputPlaceholder]]" /></div>\n <smart-repeat-button id="scrollButtonNear" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll up">\n <div id="arrowNear" class="smart-arrow smart-arrow-up" right-to-left="[[rightToLeft]]"></div>\n </smart-repeat-button>\n <smart-scroll-viewer id="mainContainer" class="smart-menu-main-container" horizontal-scroll-bar-visibility="hidden" right-to-left="[[rightToLeft]]" role="presentation">\n <content></content>\n </smart-scroll-viewer>\n <smart-repeat-button id="scrollButtonFar" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable right-to-left="[[rightToLeft]]" aria-label="Scroll down">\n <div id="arrowFar" class="smart-arrow smart-arrow-down"></div>\n </smart-repeat-button>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n </div>\n </div>`}attached(){const e=this;super.attached(),e.isCompleted&&null!==e.dropDownAppendTo&&e._minimized&&e._dropDownParent.appendChild(e.$.view)}detached(){const e=this;super.detached(),e._close(),null!==e.dropDownAppendTo&&e._minimized&&e._dropDownParent.removeChild(e.$.view)}addItem(e,t){const i=this;if(!(e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup))return;let r,n,o,a;if(void 0===t)r=void 0,n=1,o=t=i.$.mainContainer,a=i._topLevelFilter;else{if("string"==typeof t&&(t=i.getItem(t)),void 0===t||!(t instanceof Smart.MenuItemsGroup)||!i.contains(t)&&t.closest(".smart-list-menu-view")!==i.$.view)return;r=t,n=t.level+1,o=t.itemContainer,a=t.filter}if(i._createItemHTMLStructure(e,n,t,i._getCurrentViewItems(r).length,0),e instanceof Smart.MenuItemsGroup&&i._processHTML(e,n+1),i._view!==t&&!t.$.hasClass("smart-hidden")&&t.offsetHeight>0&&t.offsetWidth>0&&(!i._view&&!i.$.mainContainer.contains(t)||i._view&&!i._view.contains(t))&&e.$.addClass("smart-hidden"),i.grouped){let e;e=o instanceof Smart.ScrollViewer&&o.isRendered?Array.from(o.$.scrollViewerContentContainer.children):Array.from(o.children);for(let t=e.length-1;t>=0;t--)e[t].$.hasClass("smart-list-menu-group-label")&&o.removeChild(e[t]);i._unsortItems(t,!0)}if(o.appendChild(e),i.grouped){const e=i._view;i._applyGrouping(t,!0),i._home(),e&&i.changePage(e.path)}i.filterable&&void 0!==a&&""!==a&&null===i._findItem(e,a)&&(e.$.addClass("smart-hidden"),e.hidden=!0),i._toggleFilterInputGroupLabelVisibility(),i._checkOverflow()}back(e){const t=this,i=t.animation,r=!1===e&&"none"!==i;r&&(t.animation="none"),t._backButtonClickHandler(),r&&(t.animation=i)}changePage(e){const t=this,i=t.getItem(e);if(void 0===i||i instanceof Smart.MenuItem||i.hidden)return;const r=[i];let n=i.parentItem,o=0;for(t._discardKeyboardHover();n;)r.unshift(n),n=n.parentItem;if(t._view){const e=r.indexOf(t._view);-1===e?t._home():o=e+1}for(let e=o;e<r.length&&!r[e].disabled&&!r[e].hidden;e++)t._menuItemsGroupSelectionHandler(r[e],{type:"expand"},!0)}maximize(){const e=this;if(e._minimized){if(e._positionDetection.removeOverlay(),e._minimized=!1,e._minimizedDropDownOpened&&(e.$hamburgerIcon.removeClass("smart-close-button"),e._minimizedDropDownOpened=!1),null!==e.dropDownAppendTo&&e._appendMinimizedContainerToMenu(e.$.view,null),e.$view.removeClass("smart-visibility-hidden"),e.$view.removeClass("smart-list-menu-view-minimized"),e.$hamburgerIcon.addClass("smart-hidden"),e.removeAttribute("minimized"),e.enableShadowDOM){e.$.view.id=e.$.view.getAttribute("smart-id");const t=e.$.view.querySelectorAll("[smart-id]");for(let e=0;e<t.length;e++)t[e].id=t[e].getAttribute("smart-id")}e.$.mainContainer.scrollTop=0,e._checkOverflow(),e.$.hamburgerIcon.removeAttribute("aria-expanded"),e.$.hamburgerIcon.removeAttribute("aria-owns"),e.$.view.setAttribute("role","presentation"),e.$.view.removeAttribute("aria-orientation"),e.setAttribute("role","menu")}}minimize(){const e=this;if(!e._minimized){if(e.$view.addClass("smart-visibility-hidden"),e.enableShadowDOM){e.$.view.removeAttribute("id");const t=e.$.view.querySelectorAll("[smart-id]");for(let e=0;e<t.length;e++)t[e].removeAttribute("id")}e._edgeMacFF&&e.$view.addClass("not-in-view"),e.$hamburgerIcon.removeClass("smart-hidden"),setTimeout((function(){null!==e.dropDownAppendTo&&e._appendMinimizedContainerToExternalElement(e.$.view),e.$view.addClass("smart-list-menu-view-minimized"),e.$.mainContainer.scrollTop=0,e._checkOverflow()}),0),e._minimized=!0,e.setAttribute("minimized",""),e.setAttribute("role","presentation"),e.removeAttribute("aria-orientation"),e.$.hamburgerIcon.setAttribute("aria-expanded",!1),e.$.hamburgerIcon.setAttribute("aria-owns",e.$.view.id),e.$.view.setAttribute("role","menu"),e.$.view.setAttribute("aria-orientation","vertical")}}removeItem(e){const t=this;if("string"==typeof e&&(e=t.getItem(e)),void 0===e||!(e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup)||!t.contains(e)&&e.closest(".smart-list-menu-view")!==t.$.view)return;const i=e.parentElement;for(;e.contains(t._view);)t._backButtonClickHandler(void 0,!0);const r=t._view;t.grouped&&(t._home(),t._discardGrouping()),i.removeChild(e),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,(function(e){return t._getCurrentViewItems(e===t.$.mainContainer?void 0:e)})),t.grouped&&(t._applyGrouping(t.$.mainContainer),r&&t.changePage(r.path)),t._toggleFilterInputGroupLabelVisibility(),t._checkOverflow()}propertyChangedHandler(e,t,i){if("disabled"===e||"dropDownOverlay"===e||"minimizeIconTemplate"===e||"minimizeWidth"===e||"unfocusable"===e)return void super.propertyChangedHandler(e,t,i);const r=this;switch(e){case"animation":r.$.view.setAttribute("animation",i);break;case"checkable":case"checkboxes":r._minimized&&null!==r.dropDownAppendTo&&(i?r.$.view.setAttribute(e,""):r.$.view.removeAttribute(e));break;case"checkMode":{const e=r.$.mainContainer;r._changeToRadioButtonMode(i,e.isRendered?e.$.scrollViewerContentContainer:e),r._minimized&&null!==r.dropDownAppendTo&&r.$.view.setAttribute("check-mode",i);break}case"dataSource":{r.$header.addClass("smart-hidden"),r.$mainContainer.removeClass("header-shown"),r._view=void 0;const e=r.querySelectorAll("smart-menu-items-group");e.length>0&&e.forEach((e=>{e.remove()})),r._menuItems={},r._topLevelFilter="",r._processDataSource(),r._toggleFilterInputGroupLabelVisibility(),r._checkOverflow();break}case"displayLoadingIndicator":if(i){const e=r.$.mainContainer.querySelector("[hover]");e&&e.removeAttribute("hover"),r._discardKeyboardHover(),r.$loadingIndicatorContainer.removeClass("smart-hidden")}else r.$loadingIndicatorContainer.addClass("smart-hidden");break;case"dropDownAppendTo":{const e=r._dropDownParent;if(r._positionDetection.getDropDownParent(),r._dropDownParent===e||!r._minimized)return;r._close(),null===i?r._appendMinimizedContainerToMenu(r.$.view,null):r._appendMinimizedContainerToExternalElement(r.$.view),r.$.mainContainer.scrollTop=0,r._checkOverflow();break}case"dropDownPosition":r._close(),r._minimized&&null!==r.dropDownAppendTo&&r.$.view.setAttribute("drop-down-position",i);break;case"filterable":if(r._toggleFilterInputGroupLabelVisibility(!0),!1===i){""!==r._topLevelFilter&&r._applyFilter("");for(let e=r._filteredLowerLevelGroups.length-1;e>=0;e--)r._applyFilter("",r._filteredLowerLevelGroups[e])}r._checkOverflow();break;case"filterMode":if(!r.filterable)return;""!==r._topLevelFilter&&r._applyFilter(r._topLevelFilter);for(let e=r._filteredLowerLevelGroups.length-1;e>=0;e--)r._applyFilter(r._filteredLowerLevelGroups[e].filter,r._filteredLowerLevelGroups[e]);break;case"grouped":r._home(),i?r._applyGrouping(r.$.mainContainer):r._discardGrouping(),r._toggleFilterInputGroupLabelVisibility(!1,!0),r._checkOverflow();break;case"loadingIndicatorPosition":null!==r.dropDownAppendTo&&r._minimized&&r.$.view.setAttribute("loading-indicator-position",i),"center"===i?r.$loadingIndicatorPlaceHolder.addClass("smart-hidden"):r.$loadingIndicatorPlaceHolder.removeClass("smart-hidden");break;case"overflow":r.$.mainContainer.verticalScrollBarVisibility="scroll"===i?"visible":i,r._handleOverflowChange();break;case"rightToLeft":i?(r.$backButtonArrow.removeClass("smart-arrow-left"),r.$backButtonArrow.addClass("smart-arrow-right")):(r.$backButtonArrow.removeClass("smart-arrow-right"),r.$backButtonArrow.addClass("smart-arrow-left")),i?r.$.view.setAttribute("right-to-left",""):r.$.view.removeAttribute("right-to-left"),Array.prototype.forEach.call(r.$.mainContainer.querySelectorAll(".smart-menu-items-group-arrow"),(e=>e.className="smart-menu-items-group-arrow "+(r.rightToLeft?"smart-arrow-left left":"smart-arrow-right right")));break;case"scrollMode":r.$.mainContainer.verticalScrollBarVisibility="scrollButtons"===i?"hidden":"scroll"===r.overflow?"visible":r.overflow,r._checkOverflow();break;case"theme":super.propertyChangedHandler(e,t,i),null!==r.dropDownAppendTo&&r._minimized&&(""!==t&&r.$view.removeClass(t),i&&r.$view.addClass(i))}}_appendGroupLabels(e,t){for(let i=0;i<e.length;i++){const r=document.createElement("div");r.$=Smart.Utilities.Extend(r),r.className="smart-list-menu-group-label",r.setAttribute("role","heading"),r.setAttribute("aria-level",1),r.innerHTML=e[i],r.groupChildren=t[i],t[i][0].parentElement.insertBefore(r,t[i][0]);for(let e=0;e<t[i].length;e++)t[i][e].groupLabel=r}}_applyFilter(e,t){const i=this,r=i._getCurrentViewItems(t);for(let n=0;n<r.length;n++){const o=i._findItem(r[n],e);o&&o.hidden?(o.hidden=!1,(t===i._view||void 0!==i._view&&void 0!==t&&!t.contains(i._view)||void 0===i._view)&&o.$.removeClass("smart-hidden")):o||(r[n].hidden=!0,r[n].$.addClass("smart-hidden"))}if(t){t.filter=e;const r=i._filteredLowerLevelGroups.indexOf(t);""===e?-1!==r&&i._filteredLowerLevelGroups.splice(r,1):-1===r&&i._filteredLowerLevelGroups.push(t)}else i._topLevelFilter=e}_backButtonClickHandler(e,t){const i=this,r=i._view;if(e&&e.stopPropagation(),!r||i.disabled&&e||i.displayLoadingIndicator||i._inTransition)return;let n=i.hasAnimation,o=i.animation,a=!1;n&&t&&(n=!1,a=!0,i.animation="none"),i._discardKeyboardHover(),i.$scrollButtonNear.addClass("smart-hidden"),i.$scrollButtonFar.addClass("smart-hidden"),i.$mainContainer.removeClass("scroll-buttons-shown"),r.firstElementChild.classList.remove("smart-hidden"),n?(i._inTransition=!0,r.container.$.addClass("no-transition"),r.container.$.addClass("smart-hidden"),r.$.addClass("right"),r.$.removeClass("right"),r.container.$.removeClass("no-transition")):(r.$.removeClass("smart-menu-items-group-opened"),r.container.$.addClass("smart-hidden")),i._showHideMenuItemsGroupSiblings(r,"removeClass",n),n?setTimeout((function(){r.container.style.top=r.parentElement.getBoundingClientRect().top-r.getBoundingClientRect().top+"px"}),0):a&&(i.animation=o),1===r.level?(i.$header.addClass("smart-hidden"),i.$mainContainer.removeClass("header-shown"),i._view=void 0):(i.$.title.innerHTML=r.parentItem.titleLabel,i._view=r.parentItem),i._toggleFilterInputGroupLabelVisibility(),i.$.mainContainer.scrollTop=0,n||i._checkOverflow(),e&&i.focus()}_bounceBottom(e){const t=this,i=t.$.mainContainer;function r(){i.scrollTop-=5,i.scrollTop>e?window.requestAnimationFrame(r):t.$mainContainer.removeClass("bounce-bottom")}t.$mainContainer.addClass("bounce-bottom"),window.requestAnimationFrame((function e(){i.scrollTop+=5,i.scrollTop!==i.scrollHeight-i.offsetHeight?window.requestAnimationFrame(e):window.requestAnimationFrame(r)}))}_bounceTop(){const e=this,t=e.$.mainContainer;function i(){t.scrollTop+=5,50!==t.scrollTop?window.requestAnimationFrame(i):(t.scrollTop=0,e.$mainContainer.removeClass("bounce-top"))}e.$mainContainer.addClass("bounce-top"),window.requestAnimationFrame((function e(){t.scrollTop-=5,t.scrollTop>0?window.requestAnimationFrame(e):window.requestAnimationFrame(i)}))}_checkOverflow(){const e=this,t=e.overflow,i=e.$.mainContainer,r=i instanceof Smart.ScrollViewer?i.$.content:i;if(r){if("hidden"!==t&&"scrollButtons"===e.scrollMode){const n=Math.round(r.scrollHeight)>Math.round(i.offsetHeight),o=Math.round(i.scrollTop)>0,a=Math.round(i.offsetHeight+i.scrollTop)<Math.round(r.scrollHeight);e.$.mainContainer.verticalScrollBarVisibility="hidden",n?"auto"===t?(e.$mainContainer.hasClass("scroll-buttons-shown")||e.$mainContainer.addClass("scroll-buttons-shown"),o?e.$scrollButtonNear.removeClass("smart-hidden"):e.$scrollButtonNear.addClass("smart-hidden"),a?e.$scrollButtonFar.removeClass("smart-hidden"):e.$scrollButtonFar.addClass("smart-hidden"),!1===(o&&a)?e.$mainContainer.addClass("one-button-shown"):e.$mainContainer.removeClass("one-button-shown"),e.disabled||(e.$.scrollButtonNear.disabled=!1,e.$.scrollButtonFar.disabled=!1)):(e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.disabled?(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0):(e.$.scrollButtonNear.disabled=!o,e.$.scrollButtonFar.disabled=!a)):!n&&"auto"===t&&e.$mainContainer.hasClass("scroll-buttons-shown")?(e.$mainContainer.removeClass("scroll-buttons-shown"),e.$mainContainer.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden")):n||"scroll"!==t||(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0)}else"scrollbar"===e.scrollMode&&(e.$mainContainer.removeClass("scroll-buttons-shown"),e.$mainContainer.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"));i.refresh()}}_updateScrollButtonVisibility(e,t,i){const r=this,n=r.overflow,o=r.$.mainContainer,a=e===r.$.mainContainer,s=a?o.$.content:e;if(a&&"hidden"===n)return void o.refresh();let l,d,c,m=!0,u=!0;if(t?(l="scrollLeft",d="offsetWidth",c="scrollWidth"):(l="scrollTop",d="offsetHeight",c="scrollHeight"),0===Math.round(e[l])&&(m=!1),Math.round(e[d]+e[l])>=Math.round(s[c])&&(u=!1),a&&"auto"!==n)"scroll"!==n||r.disabled||(i[0].disabled=!m,i[1].disabled=!u);else{if(m&&u)return i[0].$.removeClass("smart-hidden"),i[1].$.removeClass("smart-hidden"),e.classList.remove("one-button-shown"),void o.refresh();m?i[0].$.removeClass("smart-hidden"):i[0].$.addClass("smart-hidden"),u?i[1].$.removeClass("smart-hidden"):i[1].$.addClass("smart-hidden"),e.classList.add("one-button-shown")}o.refresh()}_close(){const e=this;e._discardKeyboardHover(!0),e._minimized&&e._minimizedDropDownOpened&&(e._positionDetection.removeOverlay(),e.$view.addClass("smart-visibility-hidden"),e._edgeMacFF&&(e.$.view.style.left="",e.$.view.style.top="",e.$view.addClass("not-in-view")),e.$hamburgerIcon.removeClass("smart-close-button"),e._minimizedDropDownOpened=!1,e.$.hamburgerIcon.setAttribute("aria-expanded",!1))}_createElement(){const e=this,t=e.$.mainContainer;e.$.title.id||(e.$.title.id=e.id+"Title"),e.$.view.id||(e.$.view.id=e.id+"View"),e.setAttribute("role","menu"),e.setAttribute("aria-labelledby",e.$.title.id),e.setAttribute("aria-orientation","vertical"),e.$.header.setAttribute("aria-labelledby",e.$.title.id),e.mode="vertical",t.verticalScrollBarVisibility="scroll"===e.overflow?"visible":e.overflow,t.refresh=e._scrollViewerRefresh,t._mouseWheelHandler=e._mouseWheelHandler.bind(e),t.onVerticalChange=()=>{"scrollButtons"===e.scrollMode&&e._updateScrollButtonVisibility(t,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar]),t.scrollTop===t.scrollHeight&&e.$.fireEvent("scrollBottomReached")},e._positionDetection=new Smart.Utilities.PositionDetection(e),e._positionDetection.getDropDownParent(),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList();const i=e.getElementsByTagName("smart-menu-item"),r=function(){e._setFocusable(),e._menuItems={},e._topLevelFilter="",e._filteredLowerLevelGroups=[],e.$.view.setAttribute("animation",e.animation),null===e.dataSource?e._processHTML(void 0,1):e._processDataSource(),e._toggleFilterInputGroupLabelVisibility(),"scroll"===e.overflow&&(e.$mainContainer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility(e.$.mainContainer,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar])),e._applyMinimizeIconTemplate(e.minimizeIconTemplate,null),null!==e.minimizeWidth&&e.offsetWidth<=e.minimizeWidth?e.minimize():e._checkOverflow(),e.displayLoadingIndicator&&e.$loadingIndicatorContainer.removeClass("smart-hidden"),"center"!==e.loadingIndicatorPosition&&e.$loadingIndicatorPlaceHolder.removeClass("smart-hidden"),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===i.length?r():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(i,r))}_createMenuItemsGroupContainer(e,t){const i=document.createElement("div"),r=document.createElement("div");return i.className="smart-menu-drop-down smart-hidden",i.$=Smart.Utilities.Extend(i),i.level=t,i.setAttribute("level",t),i.setAttribute("role","menu"),i.menuItemsGroup=e,r.className="smart-menu-item-container",r.$=Smart.Utilities.Extend(r),r.container=i,r.menuItemsGroup=e,e.checkable&&r.setAttribute("checkable",""),r.setAttribute("check-mode",e.checkMode),i.itemContainer=r,i.appendChild(r),i}_discardGrouping(){const e=this,t=Array.from(e.$.view.getElementsByClassName("smart-list-menu-group-label"));for(let e=0;e<t.length;e++){let i=t[e];i.parentElement.removeChild(i)}e._unsortItems(e.$.mainContainer)}_discardKeyboardHover(){const e=this;e._focusedViaKeyboard&&(e._focusedViaKeyboard===e.$.backButton?(e.$.backButton.removeAttribute("hover"),e.$.backButton.$.button.removeAttribute("hover")):(e._focusedViaKeyboard.removeAttribute("focus"),e._focusedViaKeyboard.removeAttribute("hover")),e._focusedViaKeyboard=void 0)}_documentUpHandler(e){const t=this,i=e.originalEvent.target,r=e=>{"right"===e&&!t.rightToLeft||"left"===e&&t.rightToLeft?t._backButtonClickHandler():t._swipeDetails.target&&t._selectionHandler({target:t._swipeDetails.target},t._swipeDetails.target,!0)};if(delete t._dragStartDetails,t._swipeDetails){const i="pointercancel"===e.originalEvent.type;return"left"===t._swipeDetails.direction?(i||t._swipeDetails.start>e.pageX&&t._swipeDetails.start-e.pageX>t.offsetWidth/4)&&r(t._swipeDetails.direction):(i||t._swipeDetails.start<e.pageX&&e.pageX-t._swipeDetails.start>t.offsetWidth/4)&&r(t._swipeDetails.direction),void delete t._swipeDetails}i===t.$.filterInput||t.disabled||t.displayLoadingIndicator||!i.closest||(t.contains(i)||i.closest(".smart-list-menu-view")===t.$.view?!t.contains(i)&&i.closest(".smart-list-menu-view")!==t.$.view||t===document.activeElement||t.focus():t._close())}_ensureVisible(e){const t=this,i=t.$.mainContainer;if(!i.$.hasClass("scroll-buttons-shown")&&"hidden"!==t.overflow)return;const r=i.getBoundingClientRect(),n=e.getBoundingClientRect(),o=[t.$.scrollButtonNear,t.$.scrollButtonFar],a=i.scrollTop;(r.top>n.top||r.bottom<n.bottom)&&(i.scrollTop=e.offsetTop,t._updateScrollButtonVisibility(i,!1,o)),t._fireScrollBottomReachedEvent(a)}_fireScrollBottomReachedEvent(e){const t=this.$.mainContainer,i=t.scrollTop;e!==i&&i===t.scrollHeight-t.offsetHeight&&this.$.fireEvent("scrollBottomReached")}_getCurrentViewItems(e){const t=this;let i;if(void 0===e&&(i=t.$.mainContainer,i instanceof Smart.ScrollViewer&&(i=i.isRendered?i.$.scrollViewerContentContainer:i)),t.grouped){if(void 0===e)return Array.from(i.children).filter((e=>e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup));{const t=e.container.firstElementChild.children,i=[];for(let e=0;e<t.length;e++){let r=t[e];(r instanceof Smart.MenuItem||r instanceof Smart.MenuItemsGroup)&&i.push(r)}return i}}return void 0===e?i.children:e.container.firstElementChild.children}_sortItems(e){const t=this;if(!t.grouped)return;const i=[],r=t.$.mainContainer,n=[];let o;e instanceof Smart.MenuItemsGroup?o=e.container.firstElementChild:e===t.$.mainContainer&&(o=r instanceof Smart.ScrollViewer?r.$.content:r);const a=Array.from(o.children);a.sort((function(e,t){return e.label.localeCompare(t.label)}));for(let e=a.length-1;e>=0;e--)o.insertBefore(a[e],o.firstElementChild);for(let e=0;e<a.length;e++){const t=a[e],r=t.label.charAt(0),o=i.indexOf(r.toUpperCase());-1===o?(i.push(r.toUpperCase()),n.push([t])):n[o].push(t)}t._appendGroupLabels(i,n)}_home(){const e=this;for(;e._view;)e._backButtonClickHandler(void 0,!0)}_keydownHandler(e){const t=this,i=e.key;if(((t.shadowRoot||t.getRootNode()).activeElement||document.activeElement)!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","Escape","Home"," "].indexOf(i)||t.disabled||t.displayLoadingIndicator)return;e.preventDefault();const r=t._view,n=t.$.mainContainer;let o;o=r?r.itemContainer:n.isRendered?n.$.scrollViewerContentContainer:n;const a=t.$.backButton.hasAttribute("hover")?t.$.backButton:o.querySelector("[focus]");switch(i){case"ArrowDown":t._navigate("_getNextEnabledChild",a,o);break;case"ArrowLeft":case"ArrowRight":if("ArrowLeft"===i&&!t.rightToLeft||"ArrowRight"===i&&t.rightToLeft){t._backButtonClickHandler();break}("ArrowRight"===i&&!t.rightToLeft||"ArrowLeft"===i&&t.rightToLeft)&&a&&a instanceof Smart.MenuItemsGroup&&t._menuItemsGroupSelectionHandler(a,{type:"keydown"});break;case"ArrowUp":t._navigate("_getPreviousEnabledChild",a,o);break;case"End":case"Home":{if(r&&"Home"===i)return t.$.mainContainer.scrollTop=0,t._checkOverflow(),t.$.backButton.setAttribute("hover",""),t.$.backButton.$.button.setAttribute("hover",""),t._focusedViaKeyboard=t.$.backButton,void(a&&a.removeAttribute("focus"));const e="End"===i?t._getLastEnabledChild(o):t._getFirstEnabledChild(o);if(!e||a===e)return;a&&(a===t.$.backButton?(t.$.backButton.removeAttribute("hover"),t.$.backButton.$.button.removeAttribute("hover")):a.removeAttribute("focus")),t._hoverViaKeyboard(e);break}case"Enter":t._minimized&&!t._minimizedDropDownOpened?t._hamburgerIconClickHandler(void 0,t.$.view):a&&(a===t.$.backButton?t._backButtonClickHandler():t._selectionHandler({target:a}));break;case"Escape":t._minimized&&t._minimizedDropDownOpened&&!t._view?t._close():t._backButtonClickHandler();break;case" ":a&&(a===t.$.backButton?t._backButtonClickHandler():t._toggleItem(a))}}_mainContainerDownHandler(e){const t=this;!Smart.Utilities.Core.isMobile||t.disabled||t.displayLoadingIndicator||(t._dragStartDetails={startY:e.pageY,x:e.pageX,y:e.pageY,startTime:Date.now(),target:e.originalEvent.target})}_mainContainerHandler(){}_mainContainerMoveHandler(){}_mainContainerSwipeHandler(e){const t=this;if(!Smart.Utilities.Core.isMobile||t.disabled||t.displayLoadingIndicator||Math.abs(t._dragStartDetails.startY-e.pageY)>2)return;const i=e.originalEvent.target,r=i.closest("smart-menu-item"),n=i.closest("smart-menu-items-group");if("swiperight"===e.type&&!t.rightToLeft||"swipeleft"===e.type&&t.rightToLeft){const i=r||n;i&&(delete t._dragStartDetails,t._swipeDetails={direction:e.type.replace("swipe",""),start:e.pageX,target:i})}else("swipeleft"===e.type&&!t.rightToLeft||"swiperight"===e.type&&t.rightToLeft&&n&&null===r)&&(delete t._dragStartDetails,t._swipeDetails={direction:e.type.replace("swipe",""),start:e.pageX,target:n})}_mainContainerTouchmoveHandler(){}_mainContainerTouchstartHandler(){}_getRootDetails(e,t){const i=this;if(!e)return;if(!i.enableShadowDOM)return{activeElement:e.activeElement,isInsideElement:i.contains(t.target)};let r,n;for(;e&&(!r&&e.activeElement&&(r=e.activeElement),e.host===i&&(n=!0),e!==document);)e=e.host?e.host.getRootNode():e.getRootNode();return{activeElement:r,isInsideElement:n}}_menuItemsGroupSelectionHandler(e,t,i){const r=this,n=e.container,o=n.level,a=r._getRootDetails(t.target?t.target.getRootNode():null,t);if(r._view===e)return;if(r._discardKeyboardHover(),a&&a.activeElement!==r&&null!==r.dropDownAppendTo&&"click"===t.type&&!a.isInsideElement&&r.focus(),r._inTransition)return;if("click"===t.type&&!t.target.classList.contains("smart-menu-items-group-arrow")&&r._toggleItem(e))return void r._ripple(e,t);let s=r.hasAnimation,l=r.animation,d=!1;s&&i&&(s=!1,d=!0,r.animation="none"),2===o&&(r.$header.removeClass("smart-hidden"),r.$mainContainer.addClass("header-shown")),r.$.title.innerHTML=e.titleLabel,r._view=e,r._toggleFilterInputGroupLabelVisibility(),e.removeAttribute("hover"),e.removeAttribute("focus"),e.$.addClass("smart-menu-items-group-opened"),r._showHideMenuItemsGroupSiblings(e,"addClass",s),s?(r._inTransition=!0,e.firstElementChild.classList.add("animate"),setTimeout((function(){n.style.top=e.parentElement.getBoundingClientRect().top-e.getBoundingClientRect().top+"px"}),0)):e.firstElementChild.classList.add("smart-hidden"),n.$.removeClass("smart-hidden"),d&&(r.animation=l),r.$.mainContainer.scrollTop=0,s||r._checkOverflow(),r.$.fireEvent("expand",{item:e,label:e.label,path:e.path,value:e.value})}_mouseoutMouseoverHandler(e){const t=this;if(t.disabled||t.displayLoadingIndicator)return;const i=e.target.closest("smart-menu-item")||e.target.closest("smart-menu-items-group");null===i||t._view&&i.level<=t._view.level||i.disabled||i.templateApplied||(t._discardKeyboardHover(),"mouseover"===e.type?(i.setAttribute("hover",""),t._discardKeyboardHover(!0)):i.removeAttribute("hover"))}_navigate(e,t,i){const r=this;if(!t)return void("_getNextEnabledChild"===e?r._view?(r.$.backButton.setAttribute("hover",""),r.$.backButton.$.button.setAttribute("hover",""),r._focusedViaKeyboard=r.$.backButton):r._hoverViaKeyboard(r._getFirstEnabledChild(i)):r._hoverViaKeyboard(r._getLastEnabledChild(i)));let n;if("_getNextEnabledChild"===e&&t===r.$.backButton){if(n=r._getFirstEnabledChild(i),!n)return;r.$.backButton.removeAttribute("hover"),r.$.backButton.$.button.removeAttribute("hover")}else{if("_getPreviousEnabledChild"===e&&r._view&&t===r._getFirstEnabledChild(i))return r.$.backButton.setAttribute("hover",""),r.$.backButton.$.button.setAttribute("hover",""),r._focusedViaKeyboard=r.$.backButton,void t.removeAttribute("focus");n=r[e](t)}n&&(t.removeAttribute("focus"),r._hoverViaKeyboard(n))}_processHTML(e,t){const i=this,r=i.$.mainContainer;let n,o,a;void 0===e&&(e=i.$.mainContainer),t>1&&(n=i._createMenuItemsGroupContainer(e,t),o=n.itemContainer),a=e===r?Array.from((r instanceof Smart.ScrollViewer?r.$.content:r).children):Array.from(e.children);const s=[];let l=0;for(let r=0;r<a.length;r++){if(t>1&&0===r){l++;continue}const n=a[r];n instanceof Smart.MenuItem||n instanceof Smart.MenuItemsGroup?(i._createItemHTMLStructure(n,t,e,r-l),n.checked&&(n.disabled||n.templateApplied?n.checked=!1:s.push(n)),t>1&&o.appendChild(n),n instanceof Smart.MenuItemsGroup&&i._processHTML(n,t+1)):(n.parentElement.removeChild(n),l++)}if(t>1){if(e.container=n,e.itemContainer=o,e instanceof Smart.MenuItemsGroup){const t=document.createElement("div");t.className="smart-menu-items-group-arrow "+(i.rightToLeft?"smart-arrow-left left":"smart-arrow-right right"),e.children[0].appendChild(t)}e.appendChild(n)}i._validateRadioButtonSelection(e,t,s),i._sortItems(e)}_resizeHandler(){this.refresh()}refresh(){const e=this,t=e.minimizeWidth;if(null!==t){if(!e._minimized&&e.offsetWidth<=t)return void e.minimize();if(e._minimized&&e.offsetWidth>t)return void e.maximize()}e._checkOverflow()}_scroll(e){const t=this,i=t.$.mainContainer,r=e.classList.contains("smart-scroll-button-near")?-1:1,n=i.scrollTop;i.scrollTop=i.scrollTop+10*r,"scrollbar"!==t.scrollMode&&n!==i.scrollTop&&(t._updateScrollButtonVisibility(i,!1,[t.$.scrollButtonNear,t.$.scrollButtonFar]),t._fireScrollBottomReachedEvent(n))}_selectionHandler(e,t,i){const r=this,n=e.target;if(!r.disabled&&!r.displayLoadingIndicator){if(r._swipeDetails&&!i)return delete r._dragStartDetails,void delete r._swipeDetails;if(void 0===t){if("click"===e.type){const t=n.closest("smart-repeat-button");if(t)return void r._scroll(t,e)}const i=n.closest("smart-menu-item");if(i)return i.disabled||i.templateApplied||(r._toggleItem(i)||r.$.fireEvent("itemClick",{item:i,label:i.label,value:i.value}),r._ensureVisible(i),r._ripple(i,e)),void o();if((t=n.closest("smart-menu-items-group"))&&(n===t.container||n===t.container.firstElementChild))return}t&&!t.disabled&&r._menuItemsGroupSelectionHandler(t,e)}function o(){const t=r._getRootDetails(n.getRootNode(),e);t&&t.activeElement!==r&&null!==r.dropDownAppendTo&&"click"===e.type&&!t.isInsideElement&&r.focus()}}_showHideMenuItemsGroupSiblings(e,t,i){const r=e.parentElement.children;for(let n=0;n<r.length;n++){const o=r[n];o!==e&&(o.hidden||(i?"addClass"===t?o.$.addClass("animate"):(o.$.removeClass("smart-hidden"),o.$.addClass("right"),setTimeout((function(){o.$.removeClass("right")}),0)):o.$[t]("smart-hidden")))}}_toggleFilterInputGroupLabelVisibility(e,t){const i=this,r=i._getCurrentViewItems(i._view).length;if(!0!==t){const e=!i.$filterInputContainer.hasClass("smart-hidden");i.filterable&&r>1?(e||(i.$mainContainer.addClass("filter-input-shown"),i.$filterInputContainer.removeClass("smart-hidden")),i._view?i.$.filterInput.value=i._view.filter||"":i.$.filterInput.value=i._topLevelFilter):e&&(i.$mainContainer.removeClass("filter-input-shown"),i.$filterInputContainer.addClass("smart-hidden"))}if(!e&&i.grouped&&r>0){const e=i._view?i._view.container.firstElementChild.firstElementChild.$:i.$.mainContainer.$.content.firstElementChild.$;1===r?e.addClass("smart-hidden"):e.removeClass("smart-hidden")}}_viewHandler(e){const t=this;if("transitionend"===e.type){const i=e.target;if(i===t.$.view||t.$.backButton.contains(i))return;return i.classList.contains("animate")&&(i.classList.remove("animate"),i.classList.add("smart-hidden")),i.classList.contains("smart-menu-drop-down")&&(i.style.top=""),i.classList.contains("smart-menu-items-group-opened")&&i.classList.remove("smart-menu-items-group-opened"),cancelAnimationFrame(t._refreshScroll),t._refreshScroll=requestAnimationFrame((()=>{t._checkOverflow(),cancelAnimationFrame(t._refreshScroll),delete t._refreshScroll})),void(t._inTransition=!1)}if(t._minimized&&null!==t.dropDownAppendTo)switch(e.type){case"click":t._selectionHandler(e);break;case"mouseout":case"mouseover":t._mouseoutMouseoverHandler(e)}}_mouseWheelHandler(e){let t=this;if(t.enableMouseWheelAction&&!t.disabled&&!t.displayLoadingIndicator&&(t=t.$.mainContainer,t.scrollHeight>0)){const i=t.scrollTop;if(0===i&&e.deltaY<0||i===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault(),t.scrollTo(t.scrollTop+t._getScrollCoefficient(e,t.offsetHeight))}}_scrollViewerRefresh(){const e=this;e.$.scrollViewerContentContainer&&(e.scrollWidth=0,e.scrollHeight=function(){let t;const i=e.$.scrollViewerContainer.classList.contains("hscroll");if(e.$.scrollViewerContainer.classList.remove("hscroll"),Smart.Utilities.Core.Browser.Safari){const i=e.$.scrollViewerContentContainer.getBoundingClientRect().height,r=e.$.scrollViewerContainer.getBoundingClientRect().height;t=i&&r?parseInt(i)-parseInt(r):e.$.scrollViewerContentContainer.scrollHeight-e.$.scrollViewerContainer.offsetHeight}else t=e.$.scrollViewerContentContainer.scrollHeight-e.$.scrollViewerContainer.offsetHeight;return t>0&&"hidden"!==e.verticalScrollBarVisibility||"visible"===e.verticalScrollBarVisibility?e.$.scrollViewerContainer.classList.add("vscroll"):e.$.scrollViewerContainer.classList.remove("vscroll"),i&&e.$.scrollViewerContainer.classList.add("hscroll"),t}(),e.computedVerticalScrollBarVisibility&&(e.scrollHeight+=e._scrollView.hScrollBar.offsetHeight))}});
@@ -81,10 +81,10 @@ Smart("smart-file-upload",class extends Smart.BaseElement{static get properties(
81
81
  Smart("smart-query-builder",class extends Smart.BaseElement{static get properties(){return{allowDrag:{value:!1,type:"boolean"},autoPrompt:{value:!1,type:"boolean"},applyMode:{allowValues:["immediately","change"],value:"change",type:"string"},autoApplyValue:{value:!1,type:"boolean"},customOperations:{value:[],type:"array",reflectToAttribute:!1},customOperators:{value:{},type:"object",reflectToAttribute:!1},dropDownWidth:{type:"any",value:"auto"},fields:{value:null,type:"array?",reflectToAttribute:!1},fieldsMode:{value:"dynamic",allowedValues:["dynamic","static"],type:"string"},formatStringDate:{value:"dd-MMM-yy",type:"string"},formatStringDateTime:{value:"dd-MMM-yy HH:mm:ss",type:"string"},getDynamicField:{value:null,type:"function?"},icons:{value:{"=":"equals","<>":"notequals",">":"greaterthan",">=":"greaterthanorequal","<":"lessthan","<=":"lessthanorequal",startswith:"startswith",endswith:"endswith",contains:"contains",notcontains:"notcontains",isblank:"isblank",isnotblank:"isnotblank"},type:"object",reflectToAttribute:!1},messages:{value:{en:{add:"Add",addCondition:"Add Condition",addGroup:"Add Group",and:"And",notand:"Not And",or:"Or",notor:"Not Or","=":"Equals","<>":"Does not equal",">":"Greater than",">=":"Greater than or equal to","<":"Less than","<=":"Less than or equal to",startswith:"Starts with",endswith:"Ends with",contains:"Contains",notcontains:"Does not contain",isblank:"Is blank",isnotblank:"Is not blank",wrongParentGroupIndex:'{{elementType}}: Wrong parent group index in "{{method}}" method.',wrongElementNode:'{{elementType}}: Incorect node / node Id in "{{method}}" method.',invalidDataStructure:"{{elementType}}: Used invalid data structure in updateCondition/updateGroup method.",dateTabLabel:"DATE",timeTabLabel:"TIME",queryLabel:"Query"}},type:"object",extend:!0},operatorPlaceholder:{value:"Operator",type:"string"},propertyPlaceholder:{value:"Property",type:"string"},showIcons:{value:!1,type:"boolean"},showFieldNameArrow:{value:!1,type:"boolean"},validateOnInput:{value:!1,type:"boolean"},validationTimeout:{value:100,type:"number"},value:{value:[],type:"any",reflectToAttribute:!1},valueFormatFunction:{value:null,type:"function?",reflectToAttribute:!1},valuePlaceholder:{value:"Value",type:"string"}}}static get requires(){const e={"Smart.Button":"smart.button.js","Smart.Calendar":"smart.calendar.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.DropDownList":"smart.dropdownlist.js","Smart.Input":"smart.input.js","Smart.ListBox":"smart.listbox.js","Smart.Menu":"smart.menu.js","Smart.NumericTextBox":"smart.numerictextbox.js","Smart.ScrollBar":"smart.scrollbar.js","Smart.TimePicker":"smart.timepicker.js","Smart.Tooltip":"smart.tooltip.js","Smart.Utilities.BigNumber":"smart.math.js","Smart.Utilities.DateTime":"smart.date.js","Smart.Utilities.Draw":"smart.draw.js","Smart.Utilities.NumericProcessor":"smart.numeric.js"};return window.NIComplex||(e["Smart.Utilities.Complex"]="smart.complex.js"),e}static get listeners(){return{down:"_downHandler",resize:"_resizeHandler","editorsContainer.keydown":"_editorsContainerKeydownHandler","editorsContainer.keyup":"_editorsContainerKeyUpHandler","conditionsMenu.close":"_menuCloseHandler","conditionsMenu.closing":"_menuClosingHandler","conditionsMenu.itemClick":"_menuItemClickHandler","contentContainer.change":"_contentContainerChangeHandler","contentContainer.itemClick":"_contentContainerChangeHandler","scrollableContainer.touchmove":"_scrollableContainerTouchmoveHandler","document.down":"_documentDownHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler"}}static get styleUrls(){return["smart.querybuilder.css"]}template(){return'<div id="container" role="presentation">\n <smart-scroll-viewer id="scrollableContainer" class="smart-scrollable-container" animation="[[animation]]" right-to-left="[[rightToLeft]]">\n <div id="queryLabel" class="smart-query-builder-label smart-unselectable"></div>\n <div id="contentContainer" class="smart-content-container"></div>\n </smart-scroll-viewer>\n <div id="editorsContainer" class="smart-editors-container" role="presentation">\n <div id="customEditor" class="smart-custom-editor smart-hidden"></div>\n </div>\n <smart-menu id="conditionsMenu" mode="dropDown" class="smart-conditions-menu" theme="[[theme]]" animation="[[animation]]" right-to-left="[[rightToLeft]]"></smart-menu>\n </div>'}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const i=this;switch(e){case"animation":case"theme":["textBoxEditor","numericTextBoxEditor","comboBoxEditor","dateTimePickerEditor","checkBoxEditor"].forEach((t=>i.$[t]&&(i.$[t][e]=a)));break;case"formatStringDate":case"formatStringDateTime":case"valueFormatFunction":i._refresh();break;case"operatorPlaceholder":Array.from((i.shadowRoot||i).querySelectorAll(".smart-filter-operation[placeholder]")).forEach((e=>e.firstElementChild.innerHTML=a));break;case"propertyPlaceholder":Array.from((i.shadowRoot||i).querySelectorAll(".smart-filter-field-name[placeholder]")).forEach((e=>e.firstElementChild.innerHTML=a));break;case"showIcons":i._closeEditor(),a?i._filterOperationDescriptions.map((e=>e.icon=i.icons[e.value])):i._filterOperationDescriptions.map((e=>delete e.icon));break;case"customOperations":case"fields":case"value":{const t=JSON.stringify(i._validValue),o=i._queryParser;"customOperations"===e?i._handleCustomOperations():""===e&&i._mapFieldsToMenu(),i._applyValue(),"customOperations"!==e&&"fields"!==e||(o[e]=a),i._oldValueAsString!==t&&(i._oldValueAsString=JSON.stringify(i._validValue),i.$.fireEvent("change",{value:JSON.parse(i._oldValueAsString),linq:o.toLinq(i._validValue)}));break}case"valuePlaceholder":Array.from((i.shadowRoot||i).querySelectorAll(".smart-filter-value[placeholder]")).forEach((e=>e.firstElementChild.innerHTML=a));break;case"locale":case"messages":i._localizeInitialValues(),i._refresh(),i._handleCustomOperations(),i.$.dateTimePickerEditor&&(i.$.dateTimePickerEditor.messages[i.locale]||(i.$.dateTimePickerEditor.messages[i.locale]={}),i.$.dateTimePickerEditor.messages[i.locale].dateTabLabel=i.localize("dateTabLabel"),i.$.dateTimePickerEditor.messages[i.locale].timeTabLabel=i.localize("timeTabLabel"),"locale"===e?i.$.dateTimePickerEditor.locale=i.locale:"messages"===e&&(i.$.dateTimePickerEditor.$.selectDate.innerHTML=i.$.dateTimePickerEditor.messages[i.locale].dateTabLabel,i.$.dateTimePickerEditor.$.selectTime.innerHTML=i.$.dateTimePickerEditor.messages[i.locale].timeTabLabel));break;case"icons":i._closeEditor()}}ready(){super.ready();const e=this;e.$.queryLabel.id||(e.$.queryLabel.id=e.id+"Label"),e.setAttribute("role","dialog"),e.setAttribute("aria-labelledby",e.$.queryLabel.id),-1!==navigator.platform.toLowerCase().lastIndexOf("mac")&&e.$.contentContainer.classList.add("mac"),e._queryParser=new Smart.Utilities.QueryParser,e._setInitialValues(),e._handleCustomOperations(),e._applyValue(),Object.defineProperty(e,"value",{get:function(){return e.context===e?e.properties.value.value:e._validValue},set(t){e.updateProperty(e,e._properties.value,t)}})}getLinq(){const e=this;if(e._validValue)return e._queryParser.customOperations=e.customOperations,e._queryParser.fields=e.fields,e._queryParser.dynamicField="dynamic"===e.fieldsMode?e.getDynamicField:void 0,e._queryParser.toLinq(e._validValue)}get validationStatus(){const e=this;return!e.isReady||void 0===e._validationStatus||e._validationStatus}_setInitialValues(){const e=this;e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._isMobile=Smart.Utilities.Core.isMobile,e._manuallyAddedFields=[],e._localizeInitialValues(),e.$.conditionsMenu.dropDownAppendTo=e.$.container,e.$.conditionsMenu.dataSource=e._groupOperationDescriptions,e._valueFlat=[],e._lastProcessedItemInCurrentGroup={parentId:null,id:null,position:null}}_applyValue(){const e=this;e._emptyElementsStructure(!0),e._validateValue(),e._convertValueToFlat(e.value),e._getFieldsFromValue(),e._mapFieldsToMenu(),e._validateValueByType(),e._generateHTMLStructureFromFlatValue(!0),e._restrictNesting(),e._validValue=e._getValidValue(),e._oldValueAsString=JSON.stringify(e._validValue)}_validateValueByType(){const e=this;if(!e._valueFlat||!e._valueFlat.length)return;const t=e._valueFlat;for(let a=0;a<t.length;a++){const i=t[a];if("condition"!==i.type)continue;const o=i.data[0];!o||i.data.length<3||(i.data[2]=e._validateStoredValue(i.data[2],o))}e._generateValue(!0)}_applyValidationOnInput(){const e=this,t=e._editor;if(!t||!e._editorIsOpen)return;const a=t.closest(".filter-builder-item"),i=t.closest(".smart-filter-group-condition");a&&a.classList.contains("smart-filter-value")&&(clearTimeout(e._valueValidationTimeout),e._valueValidationTimeout=setTimeout((()=>{const a=i.getAttribute("node-id"),o=e.value.toString();clearTimeout(e._valueValidationTimeout),e._closeEditor(),o===e.value.toString()&&e._generateValue();const l=e._getItemById(a);l&&(t.setAttribute("focus",""),e._openEditor(l.htmlNode.querySelector(".smart-filter-value"))),delete e._valueValidationTimeout}),e.validationTimeout))}_contentContainerChangeHandler(e){const t=this,a=e.type,i=e.target,o=t._editor,l=t._editorIsOpen,r=t.applyMode;if(e.stopPropagation(),"change"===a&&t.validateOnInput&&l&&i===o&&t._applyValidationOnInput(),"itemClick"===a&&i.value!==e.detail.label||"immediately"!==r||!l||!o||"immediately"===r&&i!==o)return;const n=t._editor.closest(".filter-builder-item");n.classList.contains("smart-filter-value")||(t._closeEditor(),t._handleAutoPrompt(n))}_handleAutoPrompt(e){const t=this;if(e&&t.autoPrompt&&"immediately"===t.applyMode&&!e.classList.contains("smart-filter-value")){const a=e.closest(".smart-filter-group-condition")||e.closest(".smart-filter-nested-operator")||e.closest(".smart-filter-group");if(!a)return;const i=t._getItemById(a.getAttribute("node-id")),o=a.querySelector(".smart-filter-value");if(!i||!o)return;t._clickHandlerFilterButton(e.classList,i.nodeId,o)}}_mapFieldsToMenu(){const e=this;(e.fields||e._valueFields)&&(e._fields=(e.fields||e._valueFields).concat(e._manuallyAddedFields).map((e=>({label:e.label,value:e.dataField,dataType:e.dataType,filterOperations:e.filterOperations,lookup:e.lookup}))))}_localizeInitialValues(){const e=this;e.$.queryLabel.innerHTML=e.localize("queryLabel"),e._addOptions=[{label:e.localize("addCondition"),value:"addCondition"},{label:e.localize("addGroup"),value:"addGroup"}],e._groupOperationDescriptions=[{label:e.localize("and"),value:"and"},{label:e.localize("or"),value:"or"}],e._defaultFilterOperationDescriptions=e._filterOperationDescriptions=[{label:e.localize("="),value:"=",custom:!1},{label:e.localize("<>"),value:"<>",custom:!1},{label:e.localize(">"),value:">",custom:!1},{label:e.localize(">="),value:">=",custom:!1},{label:e.localize("<"),value:"<",custom:!1},{label:e.localize("<="),value:"<=",custom:!1},{label:e.localize("startswith"),value:"startswith",custom:!1},{label:e.localize("endswith"),value:"endswith",custom:!1},{label:e.localize("contains"),value:"contains",custom:!1},{label:e.localize("notcontains"),value:"notcontains",custom:!1},{label:e.localize("isblank"),value:"isblank",custom:!1},{label:e.localize("isnotblank"),value:"isnotblank",custom:!1}];const t=Smart.Utilities.DateTime.getLocalizedNames(e.locale);e._localizedDays=t.days,e._localizedMonths=t.months}_handleCustomOperations(){const e=this;e._filterOperationDescriptions=e._defaultFilterOperationDescriptions.slice(0);for(let t=0;t<e.customOperations.length;t++){let a=e.customOperations[t],i=e._filterOperationDescriptions.findIndex((e=>e.value===a.name)),o={label:a.label,value:a.name,custom:!0,index:t,editorTemplate:a.editorTemplate,valueTemplate:a.valueTemplate,handleValue:a.handleValue,hideValue:a.hideValue,validateValue:a.validateValue};i>-1?e._filterOperationDescriptions[i]=o:e._filterOperationDescriptions.push(o)}}_editorsContainerKeydownHandler(e){const t=this;if(t._editorIsOpen&&("Escape"===e.key||"Enter"===e.key)){t._closeEditor();const e=t._editor.closest(".filter-builder-item");e&&!e.classList.contains("smart-filter-value")&&t._handleAutoPrompt(e)}}_editorsContainerKeyUpHandler(e){const t=this,a=t._editor;a&&a.contains(e.target)&&t._editorIsOpen&&t.validateOnInput&&t._applyValidationOnInput()}_documentDownHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(a.shadowParent&&a.shadowParent.closest(".smart-input-drop-down-menu")||a.closest(".smart-input-drop-down-menu")||t.$.conditionsMenu.contains(a))return;const i=a.closest(".smart-drop-down");if(a.getRootNode().host===t||a.closest("smart-query-builder")===t||i&&t.contains(i.ownerElement))if(t._isMobile){const a=t.$.scrollableContainer.scrollTop,i=t.getBoundingClientRect().top;setTimeout((function(){if(t.$.scrollableContainer.scrollTop===a&&t.getBoundingClientRect().top===i){const a=t.context;t.context=t,t._clickHandler(e.originalEvent),t.context=a}}),250)}else t._clickHandler(e.originalEvent);else t._editorIsOpen&&!t._scrollBarDown&&t._closeEditor(),delete t._scrollBarDown}_emptyElementsStructure(e){const t=this,a=t.$.contentContainer;for(;a.firstChild;)a.removeChild(a.firstChild);t._valueFlat=e?[]:t._valueFlat,t._lastProcessedItemInCurrentGroup={parentId:null,id:null,position:null}}_resizeHandler(){this.$.scrollableContainer.refresh()}_getTotalConditions(){return this.getElementsByClassName("smart-filter-group-condition").length}_parseLinqToValue(){const e=this,t=e._queryParser;t&&(t.customOperations=e.customOperations,t.fields=e.fields,t.dynamicField="dynamic"===e.fieldsMode?e.getDynamicField:void 0,e.set("value",t.toValue(e.value)))}_validateValue(){const e=this;"string"==typeof e.value&&e._parseLinqToValue();const t=e.properties.value.value;if(Array.isArray(t)&&""!==JSON.stringify(t).replace(/[\[\]]/g,"")){for(3===t.length&&"string"==typeof t[0]&&(e.value=[[t]]),Array.isArray(t[0])&&3===t[0].length&&"string"==typeof t[0][0]&&(e.value=[t]);"string"==typeof t[0];)t.shift();for(;"string"==typeof t[t.length-1];)t.pop();e.value.forEach((e=>{Array.isArray(e)&&0===e.length&&e.push([])}))}else e.value=[[[]]]}_convertValueToFlat(e){const t=this,a=["and","or","notAnd","notOr"];if(!e)return;let i=0,o=0;t._valueFlat=[],function e(l,r){let n;for(let s=0;s<l.length;s++){const d=l[s];let c={htmlNode:null};if("string"==typeof d&&(a.indexOf(d)>-1||t.customOperators[d]))n=(t.customOperators[d]||d).trim();else if(n=n||"and",Array.isArray(d)){let a=t._valueFlat.filter((e=>e.parentId+""==r+"")).length;if(d.find((e=>Array.isArray(e))))c.nodeId=(o+=1)+"",c.type="group",c.data=n,t._valueFlat.push(c),e(d,c.nodeId),n="";else{if(t.maxConditions&&i>=t.maxConditions||t.maxConditionsPerGroup&&a>=t.maxConditionsPerGroup)continue;0!==s&&(t._valueFlat.push({nodeId:r+"."+a,type:"operator",data:n,parentId:r+""}),n="",a++),c.nodeId=r+"."+a,c.parentId=r+"",c.type="condition",c.data=d,i++,t._valueFlat.push(c)}}}}(e,0),delete t._totalGroups}_getFieldsFromValue(){const e=this._valueFlat,t=[],a=[];for(let o=0;o<e.length;o++){const l=e[o];if("condition"===l.type){const e=l.data[0];if(e&&-1===t.indexOf(e)){const o={label:e,dataField:e,dataType:(i=l.data[2],"boolean"==typeof i?"boolean":i instanceof Date?i.getHours()>0||i.getMinutes()>0||i.getSeconds()>0?"dateTime":"date":isNaN(i)?"string":"number"),format:null};t.push(e),a.push(o)}}}var i;this._valueFields=a}_addElement(e,t,a,i){const o=this,l=o._valueFlat.filter((e=>e.parentId===t));let r=0,n="";if(a=a||("group"===e?"or":[]),l.length){let e=l.map((e=>{const t=e.nodeId.split(".");return parseInt(t[t.length-1])}));e=0===e.length?[0]:e,r=e.reduce(((e,t)=>Math.max(e,t)))+1}t&&t.length>0&&(n=".");let s=(t||"")+n+("group"===e?o._valueFlat.filter((e=>"group"===e.type)).length+1:r),d=l[0];if(l.length)for(let e=0;e<l.length;e++){const t=l[e],a=t.nodeId.split(".").pop();parseInt(a)>parseInt(d.nodeId.split(".").pop())&&(d=t)}else d=o._valueFlat.find((e=>e.nodeId===t));let c=d?o._valueFlat.indexOf(d)+1:o._valueFlat.length;"condition"===e&&l.length>0&&(o._valueFlat.splice(c,0,{nodeId:s,parentId:t,type:"operator",data:["and"],htmlNode:null}),s=(t||"")+n+(r+1),c++);const u={nodeId:s,parentId:t,type:e,data:a,htmlNode:null},p=o.autoPrompt;if("condition"===e&&p&&o._fields.length){const e=o._fields[0];if(e){const t=o._getFilterOperations(e);a[0]=e.value||e.label||"",t.length&&(a[1]=t[0].value)}}if(o._valueFlat.splice(c,0,u),"group"===e&&o._addElement("condition",s,[],!0),!i&&(o._refresh(),p&&u.htmlNode)){const e=u.htmlNode,t=e.querySelector(".smart-filter-value");t&&o._clickHandlerFilterButton(e.classList,u.nodeId,t)}}_deleteElement(e,t){const a=this,i="string"==typeof e?e:e.getAttribute("node-id");if(i&&1!==i.length&&("group"===t?r(i):l(i),!t||"condition"===t)){let e=i.split(".");if(e.pop(),e=e.join("."),!a._valueFlat.filter((t=>t.parentId===e)).length&&(a._valueFlat.filter((e=>"group"===e.type)).length>1&&r(e),"0"===e)){const e=a._valueFlat.find((e=>"group"===e.type)),t=e.nodeId;e.nodeId="0",e.htmlNode.setAttribute("node-id","0");const i=a._valueFlat.filter((e=>e.parentId===t));for(let e=0;e<i.length;e++){const t=i[e];t.parentId="0",t.nodeId="0."+e,t.htmlNode.setAttribute("node-id",t.nodeId)}}a._generateValue()}function o(e){const t=a._valueFlat[e];if(t&&"operator"===t.type)return a._valueFlat.splice(e,1),t.htmlNode.parentElement.removeChild(t.htmlNode),!0}function l(e){let t,i=0,l=e.split(".");l.pop(),l=l.join(".");for(let o=0;o<a._valueFlat.length;o++){const r=a._valueFlat[o];if("condition"===r.type){if(r.nodeId===e){t=r;break}r.parentId===l&&i++}}const r=a._valueFlat.indexOf(t);a._valueFlat.splice(r,1),t.htmlNode.parentElement.removeChild(t.htmlNode);const n=o(r-1);i||o(r-(n?1:0));const s=a._valueFlat.filter((e=>e.nodeId===l))[0].htmlNode;s.children[1].childElementCount>0&&s.children[2].hasAttribute("limit-selection")&&!s.children[1].lastElementChild.hasAttribute("limit-selection")&&s.children[2].removeAttribute("limit-selection")}function r(e){const t=a._valueFlat.filter((t=>e===t.nodeId&&"group"===t.type))[0];for(let t=0;t<a._valueFlat.length;t++){const i=a._valueFlat[t],o=i.nodeId;i.parentId===e&&("group"===i.type?r(o):l(o))}a._valueFlat.indexOf(t)>-1&&a._valueFlat.splice(a._valueFlat.indexOf(t),1),t.htmlNode.parentElement.removeChild(t.htmlNode)}}_generateHTMLStructureFromFlatValue(e){const t=this,a=document.createDocumentFragment();if(t._valueFlat&&0!==t._valueFlat.length){for(let e=0;e<t._valueFlat.length;e++){const i=t._valueFlat[e],o=!!t.customOperations&&t.customOperations.find((e=>e.name===i.data[1])),l=i.parentId?(t.shadowRoot||t).querySelector('[node-id="'+i.parentId+'"]').querySelector(".smart-filter-group-condition-container"):t.$.contentContainer;if("group"===i.type){const o=document.createElement("div"),l=t.localize(i.data)||"";o.className="smart-filter-group",o.innerHTML='<div class="smart-filter-group-operator" role="button" aria-expanded="false" aria-haspopup="menu">'+l+'</div><div class="smart-filter-group-condition-container" role="group"></div><div class="smart-filter-add-condition-btn" role="button" aria-label="Add condition"><div>'+t.localize("add")+'</div></div><div class="smart-filter-add-btn" role="button" aria-expanded="false" aria-haspopup="menu" aria-label="Add group"></div>',o.firstElementChild.data=l,a.appendChild(o),o.setAttribute("node-id",i.nodeId),t._valueFlat[e].htmlNode=o}else if("condition"===i.type){const l=t._newFilterConditionRow(i.data);if(l.setAttribute("node-id",i.nodeId),a.appendChild(l),t._valueFlat[e].htmlNode=l,void 0!==i.data[0]&&void 0===i.data[1]){const e=t._getFilterOperations(t._fields.find((e=>e.value===i.data[0])));t._handleOnlyOperation(e,i.data,l)}else(-1!==["isblank","isnotblank"].indexOf(i.data[1])||o&&o.hideValue)&&(i.data.splice(2,1),l.children[2].classList.add("smart-visibility-hidden"))}else{const o=document.createElement("div");o.className="smart-filter-nested-operator",o.setAttribute("node-id",i.nodeId),o.setAttribute("role","button"),o.setAttribute("aria-expanded",!1),o.setAttribute("aria-haspopup","menu"),o.innerHTML=t.localize(i.data),a.appendChild(o),t._valueFlat[e].htmlNode=o}l.appendChild(a)}e&&t._validateValueAdvanced(),t.$.scrollableContainer.refresh()}}_validateValueAdvanced(){const e=this,t=e.value;let a=!1,i=!1,o=0;for(let e=0;e<t.length;e++){const l=t[e];if("string"!=typeof l)for(let e=l.length-1;e>=0;e--){let t=l[e];if(Array.isArray(t)&&0===t.length&&e!==l.length-1)l.splice(e,1),0===e&&l.splice(0,1),a=!0;else if("string"==typeof t){t=t.toLowerCase(),o++,(o>1||"and"!==t&&"or"!==t)&&(i=!0);continue}o=0}}a&&(e._emptyElementsStructure(!0),e._convertValueToFlat(e.value),e._generateHTMLStructureFromFlatValue()),i&&e._generateValue(!0)}_restrictNesting(){Array.from(this.getElementsByClassName("smart-filter-add-condition-btn")).forEach((e=>{const t=e.previousElementSibling.lastElementChild;t&&t.hasAttribute("limit-selection")&&e.setAttribute("limit-selection","")}))}_clickHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(t.disabled||!a||!a.closest||!t._isMobile&&0!==e.button)return;if(t._scrollBarDown)return void delete t._scrollBarDown;const i=a.closest(".smart-drop-down"),o=t._editor&&t._editor.contains(a)||i&&(t._editor.contains(i.ownerElement)||t._editor===i.ownerElement)||a.closest(".smart-custom-editor");t._editor&&t._editorIsOpen&&!o&&t._closeEditor();const l=a.closest(".smart-filter-group-condition")||a.closest(".smart-filter-nested-operator")||a.closest(".smart-filter-group");if(!l)return;const r=t._getItemById(l.getAttribute("node-id"));if(!r)return;if(t.$.fireEvent("itemClick",{id:r.nodeId,type:r.type,data:r.data}),a.closest(".smart-filter-delete-btn"))return void t._clickHandlerDeleteButton(r.htmlNode);const n=a.closest(".smart-filter-add-btn")||a.closest(".smart-filter-add-condition-btn");if(n){const e=n.closest(".smart-filter-group").getAttribute("node-id");return void(n.classList.contains("smart-filter-add-condition-btn")&&(t.maxConditions&&t._getTotalConditions()<t.maxConditions||!t.maxConditions)?t._addElement("condition",e,[]):t._clickHandlerFilterButton(n.classList,r.nodeId,a))}const s=a.closest(".filter-builder-item")||a.closest(".smart-filter-group-operator")||a.closest(".smart-filter-nested-operator");if(s){const e=s.classList;t._clickHandlerFilterButton(e,r.nodeId,a)}}_downHandler(e){const t=this;if(!e.originalEvent||!t._isMobile&&0!==e.button)return;const a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target,i=t.rightToLeft?e.pageX>a.getBoundingClientRect().right:e.pageX<a.getBoundingClientRect().left;if(t.allowDrag&&a.classList.contains("smart-filter-group-condition")&&i){const i=t._valueFlat.filter((e=>"condition"===e.type));if(1===i.length||2===i.length&&i[0].parentId===i[1].parentId&&i[1].htmlNode.hasAttribute("limit-selection"))return;return t._dragDetails={coords:{x:e.pageX,y:e.pageY},item:a,originalEvent:e},t.$.scrollableContainer._scrollView.disableSwipeScroll=!0,t._hoveredCondition=a,void window.getSelection().removeAllRanges()}this._scrollBarDown=a.closest("smart-scroll-bar"),e.stopPropagation(),e.preventDefault()}_scrollableContainerTouchmoveHandler(e){this._dragDetails&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_documentMoveHandler(e){const t=this,a=t._dragDetails;if(!a)return;const i=a.item;if(!a.feedbackShown){if(!(Math.abs(a.coords.x-e.pageX)>5||Math.abs(a.coords.y-e.pageY)>5))return;{const o=t._valueFlat.filter((e=>e.htmlNode===i))[0];if(t.$.fireEvent("dragStart",{data:o.data,item:i,originalEvent:e}).defaultPrevented)return delete t._dragDetails,delete t._hoveredCondition,void(t.$.scrollableContainer._scrollView.disableSwipeScroll=!1);a.allConditions=Array.from((t.shadowRoot||t).querySelectorAll(".smart-filter-group-condition")),a.data=o,a.feedback=t._addDragFeedback(),a.feedbackShown=!0,i.classList.add("dragged")}}const o=e.clientY;let l,r=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(t.$.fireEvent("dragging",{data:a.data,item:i,originalEvent:e}),t.setAttribute("dragging",""),a.feedback.style.left=e.pageX+10+"px",a.feedback.style.top=e.pageY+10+"px",t._isMobile){const a=t._hoveredCondition;a&&(a.classList.remove("drop-target","top","bottom"),delete t._hoveredCondition);const i=document.elementFromPoint(e.clientX,o);i&&(r=i)}let n,s=r.closest(".smart-filter-group-condition");if(s){l=s;const e=l.getBoundingClientRect(),t=Math.abs(o-e.top),a=Math.abs(o-e.bottom);n=t<a?"top":"bottom"}else{let e,t;a.allConditions.forEach((a=>{const i=a.getBoundingClientRect(),l=Math.abs(o-i.top),r=Math.abs(o-i.bottom),s=Math.min(l,r);(void 0===t||s<t)&&(e=a,t=s,n=l<r?"top":"bottom")})),s=e}if(s===i||s.hasAttribute("limit-selection")&&"bottom"===n)s=void 0;else{const e=Array.from(s.parentElement.getElementsByClassName("smart-filter-group-condition")),t=e.indexOf(i);-1!==t&&("top"===n&&s===e[t+1]||"bottom"===n&&s===e[t-1])&&(s=void 0)}if(l=s,a.side=n,clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const a=t.getBoundingClientRect();t.$.scrollableContainer.scrollHeight>0&&a.left<=e.clientX&&a.left+a.width>=e.clientX?o>=a.top&&o<=a.top+36?t.$.scrollableContainer.scrollTop-=t._autoScrollCoefficient:o>=a.top+a.height-36&&o<=a.top+a.height?t.$.scrollableContainer.scrollTop+=t._autoScrollCoefficient:clearInterval(t._dragInterval):clearInterval(t._dragInterval)}),1),l){t._hoveredCondition&&l!==t._hoveredCondition&&t._hoveredCondition.classList.remove("drop-target","top","bottom");const e=l.closest(".smart-filter-group");if(e&&e.hasAttribute("restricted"))return void(t._hoveredCondition=void 0);t._hoveredCondition=l,l.classList.remove("top","bottom"),l.classList.add(n,"drop-target")}else t._hoveredCondition&&(t._hoveredCondition.classList.remove("drop-target","top","bottom"),delete t._hoveredCondition)}_addDragFeedback(){const e=this,t=document.createElement("div");return e.rightToLeft?t.setAttribute("right-to-left",""):t.removeAttribute("right-to-left"),t.className="smart-query-builder-drag-feedback",e.theme&&t.setAttribute("theme",e.theme),document.body.appendChild(t),t}_documentUpHandler(e){const t=this,a=t._dragDetails;if(!a)return void(t.$.conditionsMenu.opened&&t._selectedElement&&!t._selectedElement.classList.contains("smart-filter-add-btn")&&t.$.conditionsMenu._hoverViaKeyboard(t.$.conditionsMenu.querySelector('smart-menu-item[value="'+t._editedItem.data+'"]')));const i=a.item,o=a.data,l=t._hoveredCondition;if(delete t._dragDetails,delete t._hoveredCondition,t.$.scrollableContainer._scrollView.disableSwipeScroll=!1,!t.hasAttribute("dragging"))return;if(clearInterval(t._dragInterval),window.getSelection().removeAllRanges(),t.removeAttribute("dragging"),i.classList.remove("dragged"),a.feedback.remove(),!l)return void t.$.fireEvent("dragEnd",{data:o.data,item:i,originalEvent:e,target:null,targetData:null,targetSide:null});const r=t._valueFlat.filter((e=>e.htmlNode===l))[0],n=t.$.fireEvent("dragEnd",{data:o.data,item:i,originalEvent:e,target:l,targetData:r.data,targetSide:a.side});if(l.classList.remove("drop-target","top","bottom"),n.defaultPrevented)return;const s=t.value,d=o.nodeId.split(".").map((e=>parseFloat(e))),c=s[2*(d[0]-1)],u=r.nodeId.split(".").map((e=>parseFloat(e))),p=s[2*(u[0]-1)];let m="and";c.length>1&&(0===d[1]?(m=c[1],c[1]="!remove!"):(m=c[d[1]-1],c[d[1]-1]="!remove!")),c[d[1]]="!remove!","top"===a.side?p.splice(u[1],0,o.data,m):p.splice(u[1]+1,0,m,o.data);for(let e=0;e<s.length;e++)Array.isArray(s[e])&&(s[e]=s[e].filter((e=>"!remove!"!==e)));for(let e=s.length-1;e>=0;e--)Array.isArray(s[e])&&0===s[e].length&&(0===e?s.splice(0,2):(s.splice(e-1,2),e--));t._emptyElementsStructure(!0),t._convertValueToFlat(s),t._generateHTMLStructureFromFlatValue(),t._validValue=t._getValidValue();const f=JSON.stringify(t._validValue);t._oldValueAsString!==f&&(t._oldValueAsString=f,t.$.fireEvent("change",{value:JSON.parse(f),linq:t._queryParser.toLinq(t._validValue)}))}_clickHandlerDeleteButton(e,t){const a=this;if(e&&e.classList){if(a._closeEditor(),1===a.getElementsByClassName("smart-filter-group-condition").length){const e=a._valueFlat[1].htmlNode.children;a.value=[[[]]],a._validValue=a._getValidValue(),a._valueFlat[1].data=[],a._valueFlat[1].htmlNode.setAttribute("limit-selection",""),e[0].setAttribute("placeholder",""),e[1].setAttribute("placeholder",""),e[2].setAttribute("placeholder",""),e[2].removeAttribute("invalid-value"),e[0].firstElementChild.innerHTML=a.propertyPlaceholder,e[1].firstElementChild.innerHTML=a.operatorPlaceholder,e[2].firstElementChild.innerHTML=a.valuePlaceholder;const t=JSON.stringify(a._validValue);return a._oldValueAsString!==t&&(a._oldValueAsString=t,a.$.fireEvent("change",{value:JSON.parse(t),linq:a._queryParser.toLinq(a._validValue)})),void a._restrictNesting()}if(e.classList.contains("smart-filter-group")){if(t&&a._valueFlat.filter((t=>t.parentId===e.getAttribute("node-id"))).length>0)return;a._deleteElement(e,"group")}else a._deleteElement(e);a._generateValue(),a.$.scrollableContainer.refresh(),Array.from(a.$.contentContainer.children).forEach(((e,t)=>{const i=(t+1).toString();e.setAttribute("node-id",i),a._valueFlat.filter((t=>t.htmlNode===e))[0].nodeId=i,Array.from(e.children[1].children).forEach(((e,t)=>{const o=a._valueFlat.filter((t=>t.htmlNode===e))[0],l=i+"."+t;e.setAttribute("node-id",l),o.parentId=i,o.nodeId=l}))}))}}_menuCloseHandler(){const e=this.$.conditionsMenu.controlledBy;e.setAttribute("aria-expanded",!1),e.removeAttribute("aria-controls"),delete this.$.conditionsMenu.controlledBy}_menuClosingHandler(e){const t=e.detail;"interaction"===t.trigger&&this._selectedElement===t.target&&e.preventDefault()}_menuItemClickHandler(e){const t=this,a=t._selectedElement.closest(".smart-filter-group-operator, .smart-filter-nested-operator"),i=e.detail,o=i.value;let l;if(a){a.innerHTML=t.localize(o)||i.label,a.value=o,l=a.classList.contains("smart-filter-nested-operator")?a.getAttribute("node-id"):a.parentElement.getAttribute("node-id");for(let e=0;e<t._valueFlat.length;e++)if(t._valueFlat[e].nodeId===l){t._valueFlat[e].data=a.value;break}t._generateValue()}else l=t._selectedElement.parentElement.getAttribute("node-id"),t._addElement("group",null,o);t.$.scrollableContainer.refresh()}_newFilterConditionRow(e=[]){const t=this,a=e[0];let i,o=t._fields.find((e=>e.value===a)),l=o?o.label:void 0;void 0===a||!l&&"static"===t.fieldsMode?e.length=0:(l||(o=t._getDynamicFieldInfo(a),l=o.label,e[0]=o.dataField),i=t._getFilterOperations(o).find((t=>t.value===e[1])),i&&(i=i.label));const r=t._formatValueStringRepresentation(e[2],e),n=t._validateValueField(void 0,e[1],e[2]);let s=document.createElement("div"),d="condition"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),c='<div class="filter-builder-item smart-filter-field-name" id="'+d+'Field" '+(l?'><div class="smart-value-container" role="presentation">'+l:'placeholder><div class="smart-value-container" role="presentation">'+t.propertyPlaceholder)+'</div></div><div class="filter-builder-item smart-filter-operation" id="'+d+'Operation" '+(i?'><div class="smart-value-container" role="presentation">'+i:'placeholder><div class="smart-value-container" role="presentation">'+t.operatorPlaceholder)+'</div></div><div class="filter-builder-item smart-filter-value" id="'+d+'Value" '+(n?"":"invalid-value")+(void 0!==e[2]?'><div class="smart-value-container" role="presentation">'+r:'placeholder><div class="smart-value-container" role="presentation">'+t.valuePlaceholder)+'</div></div><div class="smart-filter-delete-btn" role="button" aria-label="Close"></div>';return s.className="smart-filter-group-condition",s.setAttribute("role","group"),s.innerHTML=c,t._setAriaLabel(s),e.length||s.setAttribute("limit-selection",""),s}_setAriaLabel(e){const t=[];for(let a=0;a<e.children.length-1;a++){const i=e.children[a];i.classList.contains("smart-visibility-hidden")||i.hasAttribute("placeholder")||t.push(e.children[a].innerText)}0!==t.length?e.setAttribute("aria-label",t.join(" ")):e.setAttribute("aria-label","Empty condition row")}_formatValueStringRepresentation(e,t){const a=this,i=t[2],o=t[0],l=a._getFieldByFieldName(o);let r,n=t[1];if(!l||!l.dataType)return e;if(null==e)return a.valuePlaceholder;if(void 0!==n&&a.customOperations&&a.customOperations.length>0&&(n=a.customOperations.find((e=>e.name===n)),n&&n.valueTemplate))return"<span>"+n.valueTemplate(a._editor,e)+"</span>";switch(l.dataType.toLowerCase()){case"date":case"datetime":(e=e instanceof Date||"string"==typeof e||"number"==typeof e&&!isNaN(e)?new Smart.Utilities.DateTime(e):e).calendar.days=a._localizedDays,e.calendar.months=a._localizedMonths,e.calendar.locale=a.locale,r=e.toString("date"===l.dataType?a.formatStringDate:a.formatStringDateTime);break;case"array":r="string"==typeof e?e.split(","):e;break;case"object":r="string"==typeof e?e:JSON.stringify(e);break;case"number":r=e;break;case"boolean":r=!!e;break;default:r=e+"",r=r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")}if(!a.valueFormatFunction)return"<span>"+r+"</span>";const s={label:r,value:i,dataField:o,dataType:l.dataType||"string"};return"<span>"+a.valueFormatFunction(s)+"</span>"}_getFieldByFieldName(e){return Object.assign({},this._fields.find((t=>t.value===e)))}_refresh(){const e=this;e._generateValue(),e._emptyElementsStructure(),e._generateHTMLStructureFromFlatValue(),e._restrictNesting()}_generateValue(e){const t=this;let a=[],i=t._valueFlat.slice(0),o=[];for(let e=0;e<i.length;e++){const t=i[e];let o={};"group"===t.type&&(o.nodeId=t.nodeId,o.parentId=t.parentId,o.data=t.data,o.structure=[],a.push(o))}for(let e=0;e<a.length;e++){const t=a[e];for(let e=0;e<i.length;e++){const a=i[e];if(a.parentId===t.nodeId&&"condition"===a.type){const o=i[e-1];o&&o.parentId===t.nodeId&&"operator"===o.type&&t.structure.push(o.data.toString()),t.structure.push(a.data)}}}a=a.filter((e=>e.structure.length>0)),a.sort((function(e,t){return t.nodeId.split(".").length-e.nodeId.split(".").length}));for(let e=0;e<a.length;e++){const t=a[e],i=a.filter((e=>e.nodeId===t.parentId))[0];i&&i.structure?i.structure.push(t.structure):"0"!==t.nodeId?t.data&&(e>0&&o.push(t.data),o.push(t.structure)):o=o.concat(t.structure)}if(t.set("value",o),t._validateValue(),t._validValue=t._getValidValue(),t._updateValidationStatus(),!e){const e=JSON.stringify(t._validValue);t._oldValueAsString!==e&&(t._oldValueAsString=e,t.$.fireEvent("change",{value:JSON.parse(e),linq:t._queryParser.toLinq(t._validValue)}))}}_updateValidationStatus(){const e=this,t=e.customOperations.filter((e=>"function"==typeof e.validateValue)),a=e._valueFlat,i=!!e._validationStatus;let o=!0;for(let e=0,i=a.length;e<i;e+=1){const i=a[e];if("condition"!==i.type)continue;const l=i.data[1],r=t.find((e=>e.name===l));if(r&&0==!!r.validateValue(i.data[2])){o=!1;break}}if(e._validationStatus!==o){const t=void 0!==e._validationStatus;e._validationStatus=o,t&&e.$.fireEvent("validationChange",{oldValue:i,newValue:o})}}_getItemById(e,t){const a=this._valueFlat.filter((a=>t?a.parentId===e:a.nodeId===e));return a.length>0?a[0]:null}_validateStoredValue(e,t){const a=this;if(!t&&!a._editedItem)return e;if(!t&&!(t=a._editedItem.data[0]))return e;const i=a._getFieldByFieldName(t).dataType;if(void 0===i)return e+"";switch(i.toLowerCase()){case"date":case"datetime":e=new Smart.Utilities.DateTime(e).toDate();break;case"number":"number"!=typeof e&&(e=parseFloat(e));break;case"boolean":"boolean"!=typeof e&&(e=!!e);break;case"object":"object"!=typeof e&&(e={});break;case"array":Array.isArray(e)||(e=[e]);break;default:"string"!=typeof e&&(e+="")}return e}_closeEditor(e,t){const a=this;let i;if(!a._editedItem||!a._editorIsOpen)return;const o=a._editedItem,l=a._editor.closest(".filter-builder-item"),r=l.querySelector(".smart-value-container"),n=l.parentElement,s=n.children[2];if(a._editor===a.$.dateTimePickerEditor)a._editor._inputChangeHandler(),i=a._editor.value,i&&(i=i.toDate());else if(a._editor===a.$.checkBoxEditor)i=a._editor.checked;else if(a._editor===a.$.customEditor)a._editor&&Array.from(a._editor.getElementsByTagName("smart-numeric-text-box")).forEach((e=>e._inputBlurHandler())),i=a._validateStoredValue(a._selectedCustomCondition.handleValue(a._editor));else if(a._editor===a.$.numericTextBoxEditor)a._editor._inputBlurHandler(),i=a._editor.value;else if(l.classList.contains("smart-filter-value")){const e=a._getFieldByFieldName(a._editedItem.data[0]);if("array"===e.dataType)i=a._editor.value.split(",");else if("object"===e.dataType)i=JSON.parse(a._editor.value);else{const t=a._editor.value;i=e.lookup&&e.lookup.dataSource?{label:t,value:a._editor.dataset.value||t}:t}}else i=a._editor.value;if(l.classList.contains("smart-filter-field-name")){if(""===i.trim())return void a._hideEditor(l,void 0===o.data[0]);n.hasAttribute("limit-selection")&&(n.removeAttribute("limit-selection"),n.parentElement.nextElementSibling.removeAttribute("limit-selection"));const e=a._fields.find((e=>e.label===i)),t=o.data[0];if(e)o.data[0]=e.value;else{if("dynamic"!==a.fieldsMode){const e=a._fields.find((e=>e.value===t));return e&&(r.innerHTML=e.label),void a._hideEditor(l)}{const e=a._getDynamicFieldInfo(i);i=e.label,o.data[0]=e.dataField}}r.innerHTML=i,a._handleFieldChange([t,o.data[0]],[s,o,n])}else if(l.classList.contains("smart-filter-operation"))a._handleOperationChange([o,i,a._editor.$.input.dataValue],[r,s]);else{let e,t;"object"==typeof i&&void 0!==i.value?(e=i.label,t=i.value,void 0===e&&(e=t)):e=t=i,o.data[2]=t,r.innerHTML=a._formatValueStringRepresentation(e,o.data)}a._validateValueField(s,o.data[1],o.data[2]),a._generateValue(e),!1!==t&&a._hideEditor(l)}_validateValueField(e,t,a){const i=this.customOperations;let o=!0;if(e&&e.removeAttribute("invalid-value"),i&&i.length>0){const l=i.find((e=>e.name===t));l&&"function"==typeof l.validateValue&&(o=!!l.validateValue(a),!o&&e&&e.setAttribute("invalid-value",""))}return o}_getDynamicFieldInfo(e){const t=this,a={label:e,dataField:e,dataType:"string"};if(t.getDynamicField){const i=t.getDynamicField(e);i.label&&(a.label=i.label),i.dataField&&(a.dataField=i.dataField),i.dataType&&(a.dataType=i.dataType),i.filterOperations&&Array.isArray(i.filterOperations)&&i.filterOperations.length>0&&(a.filterOperations=i.filterOperations),i.lookup&&(a.lookup=i.lookup)}return t._manuallyAddedFields.push(a),t._mapFieldsToMenu(),a}_handleFieldChange(e,t){const a=this,i=e[0],o=t[1],l=t[2],r=t[0],n=a._fields.find((t=>t.value===e[1])),s=a._getFilterOperations(n),d=function(){n.value!==i&&a.$.fireEvent("propertySelected",{label:n.label,value:n.value})};if(!i||void 0===o.data[1])return a._handleOnlyOperation(s,o.data,l),void d();const c=a._fields.find((e=>e.value===i)),u=c.dataType,p=n.dataType;if(n!==c&&(p!==u||"enum"===p||n.filterOperations||c.filterOperations)){if(s.find((e=>e.value===o.data[1]))){if(p===u&&"enum"!==p)return;return"date"===p&&"dateTime"===u||"dateTime"===p&&"date"===u?(r.firstElementChild.innerHTML=a._formatValueStringRepresentation(o.data),void d()):(o.data.splice(2,1),r.setAttribute("placeholder",""),r.firstElementChild.innerHTML=a.valuePlaceholder,void d())}o.data.splice(1,2),l.children[1].setAttribute("placeholder",""),l.children[1].firstElementChild.innerHTML=a.operatorPlaceholder,r.setAttribute("placeholder",""),r.firstElementChild.innerHTML=a.valuePlaceholder,r.classList.remove("smart-visibility-hidden"),a._handleOnlyOperation(s,o.data,l),d()}}_handleOnlyOperation(e,t,a){const i=this.autoPrompt;if(1===e.length||i&&"immediately"===this.applyMode&&e.length>1){const i=e[0];t[1]=i.value,a.children[1].removeAttribute("placeholder",""),a.children[1].firstElementChild.innerHTML=e[0].label,("isblank"===i.value||"isnotblank"===i.value||i.custom&&i.hideValue)&&(t.splice(2,1),a.children[2].classList.add("smart-visibility-hidden"))}}_handleOperationChange(e,t){const a=this,i=e[0],o=e[1],l=e[2],r=t[0],n=t[1],s=void 0!==i.data[1]?a._filterOperationDescriptions.find((e=>e.value===i.data[1])):void 0,d=a._filterOperationDescriptions.find((e=>e.value===l));if(!d||d===s)return;const c=d.value;i.data[1]=c;const u=i.data[0],p=i.data[1],m=i.data[2];if(r.innerHTML=o,"isblank"===c||"isnotblank"===c||d.custom&&d.hideValue)i.data.splice(2,1),n.classList.add("smart-visibility-hidden");else if(n.classList.contains("smart-visibility-hidden"))n.setAttribute("placeholder",""),n.classList.remove("smart-visibility-hidden"),n.firstElementChild.innerHTML=a.valuePlaceholder;else if(d.custom){const e=a._getFieldByFieldName(u);if(d.editorTemplate){const t=d.editorTemplate(e.dataType,p,e);t&&(a.$.customEditor.innerHTML="",a.$.customEditor.appendChild(t))}d.valueTemplate?n.firstElementChild.innerHTML=d.valueTemplate(a.$.customEditor,m):void 0===m?(n.setAttribute("placeholder",""),n.firstElementChild.innerHTML=a.valuePlaceholder):n.firstElementChild.innerHTML=m}else void 0===m?(i.data.splice(2,1),n.setAttribute("placeholder",""),n.firstElementChild.innerHTML=a.valuePlaceholder):d.custom||(n.firstElementChild.innerHTML=a._formatValueStringRepresentation(m,i.data))}_hideEditor(e,t){const a=this;t&&e.setAttribute("placeholder",""),e.removeAttribute("edited"),a.$.editorsContainer.removeAttribute("open"),a._editor.close&&a._editor.close(),a._editor.classList.add("smart-hidden"),a._editorIsOpen=a._enterIsPressedInEditor=!1,a.$.scrollableContainer.refresh(),a._setAriaLabel(e.parentElement)}_clickHandlerFilterButton(e,t,a){const i=this;function o(e,t,a){i._contextMenuOptions=0===t.length?i._defaultFilterOperationDescriptions:t,i._handleContextMenu(e),i.$.conditionsMenu.opened&&(i.$.conditionsMenu._discardKeyboardHover(),i.$.conditionsMenu._hoverViaKeyboard(i.$.conditionsMenu.querySelector('smart-menu-item[value="'+a+'"]')))}a.closest(".smart-editors-container")||(i._closeEditor(),i._editedItem=i._getItemById(t),e.contains("smart-filter-add-btn")?o(a,i._groupOperationDescriptions):(e.contains("smart-filter-field-name")||i._editedItem.data&&i._editedItem.data.length)&&(e.contains("smart-filter-group-operator")||e.contains("smart-filter-nested-operator")?o(a,i._groupOperationDescriptions,i._editedItem.data):(a.closest(".filter-builder-item").removeAttribute("placeholder"),i._openEditor(a))))}_handleContextMenu(e){const t=this;if(t._selectedElement===e&&t.$.conditionsMenu.opened)return void t.$.conditionsMenu.close();if(t._closeEditor(),t.disableContextMenu)return void(t._selectedElement=e);const a=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=a.left+t.$.contentContainer.scrollLeft-i.left,l=a.top+t.$.contentContainer.scrollTop-i.top+a.height;e.hasAttribute("aria-haspopup")&&(t.$.conditionsMenu.controlledBy&&(t.$.conditionsMenu.controlledBy.setAttribute("aria-expanded",!1),t.$.conditionsMenu.controlledBy.removeAttribute("aria-controls")),e.setAttribute("aria-controls",t.$.conditionsMenu.id),e.setAttribute("aria-expanded",!0),t.$.conditionsMenu.controlledBy=e),t.$.conditionsMenu.dataSource=t._contextMenuOptions,t.$.conditionsMenu.open(o,l+3),t._selectedElement=e,t.$.scrollableContainer.refresh()}_openEditor(e){const t=this,a=e&&e.closest(".smart-filter-group-condition")?e.closest(".smart-filter-group-condition").getAttribute("node-id"):null,i=e.closest(".filter-builder-item"),o=t._getItemById(a);let l="";void 0!==o.data[0]?l=o.data[0]:t._fields.length&&(l=t._fields[0].value);let r,n,s=t._getFieldByFieldName(l),d="";if(i.classList.contains("smart-filter-field-name"))n=0,t._fields||t._mapFieldsToMenu(),s.lookup={dataSource:t._fields.slice(),readonly:!1},d=s.label||"",r=s.value;else if(i.classList.contains("smart-filter-operation")){n=1;let e=t._getFilterOperations(s);s.lookup={dataSource:e,readonly:!0};let a=e.find((e=>e.value===o.data[n]))||e[0];d=a.label,r=a.value}else n=2,d=o.data[n],void 0===d&&(d="");t._editorIsOpen&&t._closeEditor(),i.setAttribute("edited",""),t._editedItem=o;const c=t._fields.filter((e=>e.value===l)),u=t._filterOperationDescriptions.filter((e=>e.value===o.data[1]&&e.custom)),p=c.length>0?c[0]:null,m=s.lookup&&s.lookup.dataSource?"lookup":p?p.dataType:void 0;if(2===n&&0!==u.length&&u[0].editorTemplate?(t._selectedCustomCondition=u[0],t._openCustomEditor(m,d,s)):t._openEditorByFieldType(m,d,s,r),i.appendChild(t.$.editorsContainer),t._editor.classList.remove("smart-hidden"),t._editorIsOpen=!0,t.$.editorsContainer.setAttribute("open",""),t.$.scrollableContainer.refresh(),t._editor.classList.contains("smart-custom-editor")){const e=t.customOperations[t._selectedCustomCondition.index].onEditorOpen;e&&e(t._editor)}else"immediately"===t.applyMode?requestAnimationFrame((()=>{t.autoApplyValue&&t._editor.closest(".smart-filter-value")?setTimeout((()=>{t._closeEditor(!1,!1),t._editor.querySelector("input").blur()})):t._editor.focus()})):requestAnimationFrame((()=>t._editor.focus()));s.lookup&&!t._valueValidationTimeout&&t._editor.open()}_getFilterOperations(e){const t=this;let a=t._filterOperationDescriptions.slice();if(e.filterOperations)a=t._filterOperationDescriptions.filter((t=>e.filterOperations.indexOf(t.value)>-1));else{let i;switch(e.dataType){case"date":case"dateTime":case"number":i=["=","<>","<",">","<=",">=","isblank","isnotblank"];break;case"boolean":i=["=","<>","isblank","isnotblank"];break;case"object":i=["isblank","isnotblank"];break;case"string":i=["contains","notcontains","startswith","endswith","=","<>","isblank","isnotblank"];break;default:i=["contains","notcontains","startswith","endswith","=","<>","<",">","<=",">=","isblank","isnotblank"]}a=t._filterOperationDescriptions.filter((e=>i.indexOf(e.value)>-1))}return t.showIcons&&a.map((e=>e.icon=t.icons[e.value])),a}_openCustomEditor(e,t,a){const i=this,o=i.customOperations[i._selectedCustomCondition.index].editorTemplate(e,t,a);i.$.customEditor.innerHTML="",o&&i.$.customEditor.appendChild(o),i._editor=i.$.customEditor}_openEditorByFieldType(e,t,a,i){const o=this;if(e)switch(e.toLowerCase()){case"boolean":return o._initializeEditor("checkBox"),void(o._editor.checked=!!t);case"date":case"datetime":return o._initializeEditor("dateTimePicker"),o._editor.formatString="date"===e?o.formatStringDate:o.formatStringDateTime,void(o._editor.value=t);case"number":return o._initializeEditor("numericTextBox"),void(o._editor.value=t||0)}if(o._initializeEditor("input"),o._editor.dropDownWidth=o.dropDownWidth,"lookup"===e){const i=a.lookup.minLength,l=a.lookup.dataSource;if(o._editor.autoCompleteDelay=a.lookup.autoCompleteDelay||100,o._editor.dropDownAppendTo=o.$.container,o._editor.dropDownButtonPosition=o.rightToLeft?"left":"right",o._editor.minLength=isNaN(i)||null===i?1:i,o._editor.readonly=!!a.lookup.readonly,"function"==typeof l?o._editor.dataSource=l:l instanceof Promise?l.then((e=>{if(!(o._editor instanceof Smart.Input))return;const a=o._editor.opened;o._editor.dataSource=e,e.length<12?o._editor.dropDownHeight="auto":o._editor.dropDownHeight=200,a&&(o._editor.open(),""===t&&o._editor.readonly&&e.length&&(o._editor.value=e[0].label||e[0]))})):(o._editor.dataSource=l,l.length<12?o._editor.dropDownHeight="auto":o._editor.dropDownHeight=200),"object"===e)t=JSON.stringify(t||{});else if(""===t&&o._editor.readonly){const e=o._editor.dataSource;if(Array.isArray(e)){const a=e[0];t=a&&(a.value||a.label)||""}else t=""}if(o._editor.isRendered){const e=o._editor.$.input.dataValue;null!=e&&e===t||(o._editor.value=void 0!==t?t+"":"")}else o._editor.value=void 0!==t?t+"":""}else o._editor.dataSource=[],o._editor.dropDownButtonPosition="none",o._editor.readonly=!1,o._editor.value=void 0!==t?t+"":"";i&&"object"!==e&&o._editor.isRendered&&(o._editor.$.input.dataValue=i)}_initializeEditor(e){const t=this;if(t.$[e+"Editor"])return void(t._editor=t.$[e+"Editor"]);const a=document.createElement("smart-"+Smart.Utilities.Core.toDash(e));"numericTextBox"===e?(a.spinButtons=!0,a.inputFormat="floatingPoint"):"dateTimePicker"===e&&(a.dropDownAppendTo=t.$.container,a.calendarButton=!0,a.dropDownDisplayMode="auto",a.enableMouseWheelAction=!0,a.locale=t.locale,a.autoClose=!0,a.messages[t.locale]||(a.messages[t.locale]={}),a.messages[t.locale].dateTabLabel=t.localize("dateTabLabel"),a.messages[t.locale].timeTabLabel=t.localize("timeTabLabel")),a.rightToLeft=t.rightToLeft,a.theme=t.theme,a.animation=t.animation,a.$.addClass("smart-hidden underlined"),t.$.editorsContainer.appendChild(a),t._editor=t.$[e+"Editor"]=a}_getValidValue(){const e=this,t=e.properties.value.value,a=[];let i=!1;return t.forEach((t=>{if(Array.isArray(t)){let o=!1,l=!1;const r=[];t.forEach((t=>{if(Array.isArray(t)){const a=t[0],i=t[1],n=t[2];if(void 0===a||void 0===i)return void(l=!0);if(void 0!==n||"isblank"===i||"isnotblank"===i)return o=!0,void r.push(t);const s=e._filterOperationDescriptions.find((e=>e.value===i));s.custom&&s.hideValue?(o=!0,r.push(t)):l=!0}else l?l=!1:r.push(t)})),o?("string"==typeof r[r.length-1]&&r.pop(),a.push(r)):i=!0}else i?i=!1:a.push(t)})),"string"==typeof a[a.length-1]&&a.pop(),a}}),Smart.Utilities.Assign("QueryParser",class{constructor(e,t,a){const i=this;i.customOperations=t||[],i.fields=e||[],i.dynamicField=a}toLinq(e){return Array.isArray(e)&&this._arePropertiesValid()?this._parseQueryToLinq(e):""}toValue(e){return"string"==typeof e&&this._arePropertiesValid()?this._parseLinqToValue(e):[]}_arePropertiesValid(){return Array.isArray(this.customOperations)?!!Array.isArray(this.fields)||(console.log('Invalid "fields" property.'),!1):(console.log('Invalid "customOperations" property.'),!1)}_parseQueryToLinq(e){const t=this,a={and:"&&",or:"||"};let i="";for(let o=0;o<e.length;o++){const l=e[o];if(Array.isArray(l))if(l.indexOf("and")>-1||l.indexOf("or")>-1||1===l.length&&Array.isArray(l[0])){const e=t._parseQueryToLinq(l);e?i+=l.length>1?"("+e+")":e:/\s(&|\|){2}\s$/gm.test(i)&&(i=i.replace(/\s(&|\|){2}\s$/gm,""))}else i+=t._getExpressionFromQuery(l)||"";else i&&(i+=" "+a[l]+" ")}return i}_getExpressionFromQuery(e){const t=e[0],a=e[1];let i=e[2];const o=this.customOperations.find((e=>e.name===a));return o&&o.expressionTemplate?("string"==typeof i&&i.includes('"')&&o.expressionTemplate.includes('"')&&(i=JSON.stringify(i).slice(1,-1)),o.expressionBuilderCallback?o.expressionBuilderCallback(t,a,i):o.expressionTemplate.replace("{0}",t).replace("{1}",i)):""}_parseLinqToValue(e){const t=this;let a,i=0,o=[];for(let t=0;t<e.length;t++)if("("===e[t])i++,void 0===a&&(a=t);else if(")"===e[t]&&i>0&&(i--,0===i)){let i=e.substring(a,t+1).trim();i.length&&(i.includes("&&")||i.includes("||"))&&o.push({expr:i}),a=void 0}let l,r=[];if(o.length)for(let a=0;a<o.length;a++){let i;o[a].query=t._getQueryFromExpression(o[a].expr),i=l?e.substring(e.indexOf(l)+l.length,e.indexOf(o[a].expr)).trim():e.substring(0,e.indexOf(o[a].expr)).trim(),i&&r.push(i),l=o[a].expr}l?r.push(e.substring(e.indexOf(l)+l.length).trim()):r.push(e.trim());for(let e=0;e<r.length;e++){const a=r[e].replace(/^&{2}|^\|{2}|&{2}$|\|{2}$/gm,"").trim();a.length&&o.push({expr:a,query:t._getQueryFromExpression(a),outher:!0})}return t._constructValueFromQueries(e,o)}_getQueryFromExpression(e){const t=this,a=t.fields,i=t.dynamicField;let o=[],l=e;const r=function(e){let l=[];const r=t.customOperations.filter((e=>e.expressionTemplate));r.sort(((e,t)=>t.expressionTemplate.length-e.expressionTemplate.length));for(let t=0;t<r.length;t++){const a=r[t],i=new RegExp(a.expressionTemplate.replace(/\(/gm,"\\(").replace(/\)/gm,"\\)").replace(/\[/gm,"\\[").replace(/\]/gm,"\\]").replace(/"{\d+}"/gm,'\\W*"([^"]*)[^a-zA-Z0-9-\\s\\)]+').replace(/{\d+}/gm,"([@|$]*\\w+[.]*\\w+(?!\\s)*)\\s{0}").replace(/ /gm,"\\s"),"gm");if(i.test(e)){i.lastIndex=0;let t,o,r=i.exec(e);if(r=r.filter(((e,t)=>r.indexOf(e)===t)),a.expressionReaderCallback){let e=a.expressionReaderCallback(r[0],r.slice(1));e&&(t=e.fieldName,o=e.value)}void 0===t&&(t=r[1]||""),void 0===o&&(o=r[2]||""),l.push({operator:a.name,field:t,value:o,query:r[0]})}}let n=l.find((e=>a.find((t=>t.filterOperations.indexOf(e.operator)>-1&&t.dataField===e.field))));if(!n&&i)for(let e=0;e<l.length;e++){const t=l[e],a=i(t.field);if(a&&Array.isArray(a.filterOperations)&&a.filterOperations.indexOf(t.operator)>-1){n=t;break}}if(n)return o.push({expr:n.query,query:[n.field,n.operator,n.value]}),n.query};if(l){for(;l.length;){l&&(l=l.trim(),"("===l[0]&&")"===l[l.length-1]&&(l=l.trim().replace(/^\(|\)$/gm,"")),l=l.replace(/^&{2}|^\|{2}|&{2}$|\|{2}$/gm,"").trim());const e=r(l);if(!e)break;l=l.replace(e,"").trim()}return t._constructValueFromQueries(e,o)}}_constructValueFromQueries(e,t){let a=[];t.sort(((t,a)=>e.indexOf(t.expr)-e.indexOf(a.expr)));for(let i=0;i<t.length;i++){let o=t[i-1];if(o){const l=e.substring(e.indexOf(o.expr)+o.expr.length,e.indexOf(t[i].expr)).trim();a.push("||"===l?"or":"and")}t[i].outher?t[i].query.forEach((e=>a.push(Array.isArray(e)?[e]:e))):a.push(t[i].query)}return a}});
82
82
  Smart("smart-filter-panel",class extends Smart.BaseElement{static get properties(){return{buttons:{value:["clear","filter"],type:"array"},data:{value:null,type:"array?",reflectToAttribute:!1},dataField:{value:null,type:"string?"},dataSource:{value:null,type:"any",reflectToAttribute:!1},evaluateFilterExpression:{value:null,type:"function?",reflectToAttribute:!1},filterType:{value:"string",allowedValues:["numeric","string","date","boolean"],type:"string"},formatString:{value:"d",type:"string"},messages:{value:{en:{addCondition:"Add Condition",addGroup:"Add Group",and:"and",blanks:"(Blanks)",cancel:"Cancel",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equal:"equal",equalCaseSensitive:"equal (case sensitive)",filter:"Filter",greaterThan:"greater than",greaterThanOrEqual:"greater than or equal",lessThan:"less than",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notEqual:"not equal",notNull:"not null",null:"null ",or:"or",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME"}},type:"object",extend:!0},mode:{value:"default",allowedValues:["basic","default","excel"],type:"string"}}}static get listeners(){return{"cancelButton.click":"cancel","clearButton.click":"clear","filterButton.click":"filter"}}template(){return'<div id="container" class="smart-container" role="presentation">\n <div id="label" class="smart-filter-panel-label"></div>\n <div id="mainContainer" role="presentation"></div>\n <div id="buttonContainer" class="smart-filter-panel-button-container" role="presentation">\n <smart-button id="filterButton" class="primary" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="clearButton" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="cancelButton" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n </div>\n </div>'}static get styleUrls(){return["smart.grid.css","smart.dropdownlist.css","smart.menu.css","smart.filterpanel.css","smart.textbox.css"]}ready(){super.ready()}render(){const e=this,t=e.filterType;e.$.label.id||(e.$.label.id=e.id+"Label"),e.setAttribute("role","dialog"),e.setAttribute("aria-labelledby",e.$.label.id),e._localize(),e._setButtonsVisibility(),e._filterType=t+"Filter",e._filterHandler=new(Smart.Utilities[t.slice(0,1).toUpperCase()+t.slice(1)+"FilterHandler"])(e),super.render()}cancel(){const e=this;e._filterHandler[e.mode+"Cancel"](),e.$.fireEvent("cancel")}clear(){const e=this;e._filterHandler[e.mode+"Clear"](),e.$.fireEvent("clear")}reset(){const e=this;e.$.clearButton.removeAttribute("hover"),e.$.filterButton.removeAttribute("hover"),e.$.cancelButton.removeAttribute("hover"),e._filterHandler.firstInputMatchCase&&e._filterHandler.firstInputMatchCase.classList.remove("active"),e._filterHandler.secondInputMatchCase&&e._filterHandler.secondInputMatchCase.classList.remove("active"),e._filterHandler[e.mode+"Clear"](),e._filterHandler.filterObject=new Smart.Utilities.FilterGroup}getFilter(){if(this._filterHandler){const e=new Smart.Utilities.FilterGroup;for(let t in this._filterHandler.filterObject)e[t]=this._filterHandler.filterObject[t];return e}return null}evaluate(e){try{return this._filterHandler.evaluate(e)}catch(e){return!1}}filter(){const e=this;e._filterHandler[e.mode+"Filter"](),e.$.fireEvent("filter")}getState(){return this._filterHandler.cachedFilter}loadState(e){try{const t=this;t._filterHandler.cachedFilter=e,t._filterHandler[t.mode+"Cancel"]()}catch(e){}}propertyChangedHandler(e,t,l){super.propertyChangedHandler(e,t,l);const a=this,i=a._filterHandler;function s(){a.$.mainContainer.innerHTML="",function(){const e=["cachedFilter","caseSensitive","customExcelFilterObjects","customItems","dataSource","defaultListSelection","defaultListSource","displayMode","filterBuilder","filterBuilderObject","filterBuilderOperations","filterObject","firstInput","firstList","operationsMapping","operatorList","secondInput","secondList","timeOnly","tree"];e.forEach((function(t){delete i[e[t]]})),delete a._filterHandler}(),a._filterHandler=new(Smart.Utilities[a.filterType.slice(0,1).toUpperCase()+a.filterType.slice(1)+"FilterHandler"])(a)}switch(e){case"animation":case"disabled":case"rightToLeft":case"unfocusable":switch(a.mode){case"default":case"basic":[i.firstList,i.firstInput,i.logicalOperatorList,i.secondList,i.secondInput].forEach((function(t){t[e]=l}));break;case"excel":i.tree[e]=l;break;case"filterBuilder":i.filterBuilder[e]=l,i.caseSensitive&&(i.caseSensitive[e]=l)}break;case"buttons":a._setButtonsVisibility();break;case"data":case"dataField":"excel"!==a.mode||Array.isArray(a.dataSource)||s();break;case"dataSource":"excel"===a.mode&&s();break;case"filterType":a._filterType=l+"Filter",s();break;case"mode":s();break;case"formatString":if("date"!==a.filterType)return;switch(a.mode){case"default":case"basic":i.firstInput.formatString=l,i.secondInput.formatString=l;break;case"excel":s();break;case"filterBuilder":i.filterBuilder.formatStringDate=l,i.filterBuilder.formatStringDateTime=l}break;case"locale":case"messages":switch(a._localize(),a.mode){case"default":case"basic":{const t=i.firstList.selectedIndex,l=i.logicalOperatorList.selectedIndex,s=i.secondList.selectedIndex,r=[i.firstInput,i.secondInput];switch(i.setDefaults(),i.firstList.dataSource=JSON.parse(JSON.stringify(i.defaultListSource)),i.logicalOperatorList.dataSource=[{value:0,label:a.localize("and")},{value:1,label:a.localize("or")}],i.secondList.dataSource=JSON.parse(JSON.stringify(i.defaultListSource)),a.filterType){case"date":r.forEach((function(t){t.messages[a.locale]||(t.messages[a.locale]={});const l=a.localize("dateTabLabel");l&&(t.messages[a.locale].dateTabLabel=l);const i=a.localize("timeTabLabel");if(i&&(t.messages[a.locale].timeTabLabel=i),"locale"===e&&(t.locale=a.locale),"timePicker"===t._dropDownDisplayMode){const e=a.localize("placeholderTime");e&&(t.placeholder=e,t.placeholder=e)}else{const e=a.localize("placeholderDate");e&&(t.placeholder=e,t.placeholder=e)}}));break;case"numeric":r[0].placeholder=a.localize("placeholderNumber"),r[1].placeholder=a.localize("placeholderNumber");break;case"string":r[0].placeholder=a.localize("placeholderValue"),r[1].placeholder=a.localize("placeholderValue");break;case"boolean":r[0].placeholder=a.localize("placeholderBoolean"),r[1].placeholder=a.localize("placeholderBoolean")}i.firstList.selectedIndex=t,i.logicalOperatorList.selectedIndex=l,i.secondList.selectedIndex=s;break}case"excel":i.tree.selectAll&&(i.tree.selectAll.label=a.localize("selectAll")),i.tree.blanks&&(i.tree.blanks.label=a.localize("blanks"));break;case"filterBuilder":i.localizeFilterBuilder(),"messages"===e&&(i.filterBuilder._localizeInitialValues(),i.filterBuilder._refresh()),i.filterBuilder.$.scrollableContainer.refresh()}}}_localize(){const e=this;e.localize("showRows")&&(e.$.label.innerHTML=e.localize("showRows")),e.localize("filter")&&(e.$.filterButton.innerHTML=e.localize("filter")),e.localize("clear")&&(e.$.clearButton.innerHTML=e.localize("clear")),e.localize("cancel")&&(e.$.cancelButton.innerHTML=e.localize("cancel"))}_setButtonsVisibility(){const e=this,t=e.buttons;["cancel","clear","filter"].forEach((function(l){-1!==t.indexOf(l)?e["$"+l+"Button"].removeClass("smart-hidden"):e["$"+l+"Button"].addClass("smart-hidden")}))}}),Smart.Utilities.Assign("BaseFilterHandler",class{constructor(e){const t=this;if(t.basicFilter=t.defaultFilter,t.basicClear=t.defaultClear,t.basicCancel=t.defaultCancel,t.context=e,t.filterObject=new Smart.Utilities.FilterGroup,t.setDefaults(),"date"===e.filterType){const l=new Smart.Utilities.DateTime,a=e.formatString,i=l.getParseRegExp(l.calendar,a.replace(/y+/g,"yyyyy"));t.displayMode=Smart.Utilities.DateTime.detectDisplayMode(l,a,i),t.timeOnly="timePicker"===t.displayMode}"default"!==e.mode&&"basic"!==e.mode?(t.operationsMapping={"=":"EQUAL","<>":"NOT_EQUAL","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",isblank:"EMPTY",isnotblank:"NOT_EMPTY",contains:"CONTAINS",notcontains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"},"excel"===e.mode?t.createExcelHTMLStructure():"filterBuilder"===e.mode&&t.createBuilderHTMLStructure()):t.createDefaultHTMLStructure()}setDefaults(){const e=this,t=e.context;e.defaultListSource=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("equal")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("notEqual")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("lessThan")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("lessThanOrEqual")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("greaterThan")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("greaterThanOrEqual")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("null")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("notNull")}],e.filterBuilderOperations=["<","=","<>","<=",">",">=","NULL","NOT_NULL"],e.defaultListSelection=2}createDefaultHTMLStructure(){const e=this,t=e.context,l=document.createElement("smart-input"),a=document.createElement("smart-input"),i=document.createElement("smart-input"),s=document.createDocumentFragment(),r=e=>{e.readonly=!0,e.dropDownButtonPosition="right"};l.classList.add("smart-filter-panel-list"),l.dataSource=JSON.parse(JSON.stringify(this.defaultListSource)),l.selectedIndex=e.defaultListSelection,r(l),a.classList.add("smart-filter-panel-operator-list"),a.dataSource=[{value:0,label:t.localize("and")},{value:1,label:t.localize("or")}],r(a),i.classList.add("smart-filter-panel-list"),i.dataSource=JSON.parse(JSON.stringify(this.defaultListSource)),i.selectedIndex=e.defaultListSelection,r(i),e.firstList=l,e.logicalOperatorList=a,e.secondList=i;const n=document.createElement("span");n.classList.add("smart-icon","smart-icon-font-size"),n.title=t.localize("matchCase");const c=document.createElement("span");c.classList.add("smart-icon","smart-icon-font-size"),c.title=t.localize("matchCase"),e.firstInputMatchCase=n,e.secondInputMatchCase=c,e.appendInputs(),e.firstInput.classList.add("smart-filter-panel-input"),e.secondInput.classList.add("smart-filter-panel-input"),"basic"===t.mode&&(e.secondList.classList.add("smart-hidden"),e.secondInput.classList.add("smart-hidden"),e.logicalOperatorList.classList.add("smart-hidden"),e.secondInputMatchCase.classList.add("smart-hidden")),a.dropDownHeight="auto",a.selectedIndex=0,[l,e.firstInput,e.firstInputMatchCase,a,i,e.secondInput,e.secondInputMatchCase].forEach((function(e){e.animation=t.animation,e.disabled=t.disabled,e.unfocusable=t.unfocusable,e.dropDownPosition="bottom",e.dropDownAppendTo="body",e.dropDownMaxHeight=200,e.rightToLeft=t.rightToLeft,s.appendChild(e)})),e.context.$.mainContainer.appendChild(s),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}cacheFilter(e,t,l){const a=this;a.cachedFilter={firstFilterComparison:e,firstFilterValue:a.firstInput.value,firstFilterCaseSensitive:a.firstInputMatchCase.classList.contains("active"),logicalOperator:t,secondFilterComparison:l,secondFilterValue:a.secondInput.value,secondFilterCaseSensitive:a.secondInputMatchCase.classList.contains("active")}}defaultFilter(){const e=this,t=e.context,l=e.getFilterInputValue(e.firstInput),a=parseFloat(e.logicalOperatorList.selectedValues[0]),i=e.getFilterInputValue(e.secondInput),s=e.filterObject;let r=e.firstList.selectedValues[0],n=e.secondList.selectedValues[0];s.clear();const c=e=>"CONTAINS"===e?"CONTAINS_CASE_SENSITIVE":"DOES_NOT_CONTAIN"===e?"DOES_NOT_CONTAIN_CASE_SENSITIVE":"STARTS_WITH"===e?"STARTS_WITH_CASE_SENSITIVE":"ENDS_WITH"===e?"ENDS_WITH_CASE_SENSITIVE":"EQUAL"===e?"EQUAL_CASE_SENSITIVE":"NOT_EQUAL"===e?"NOT_EQUAL_CASE_SENSITIVE":void 0;if(e.firstInputMatchCase.classList.contains("active")&&(r=c(r)),e.secondInputMatchCase.classList.contains("active")&&(n=c(n)),""!==l||-1!==["NULL","NOT_NULL","EMPTY","NOT_EMPTY"].indexOf(r)){const i=s.createFilter(t._filterType,l,r,void 0,t.formatString,t.locale,"timePicker"===e.firstInput._dropDownDisplayMode);s.addFilter(a,i)}if(""!==i||-1!==["NULL","NOT_NULL","EMPTY","NOT_EMPTY"].indexOf(n)){const l=s.createFilter(t._filterType,i,n,void 0,t.formatString,t.locale,"timePicker"===e.secondInput._dropDownDisplayMode);s.addFilter(a,l)}let o=e.firstList.selectedIndexes[0],d=e.secondList.selectedIndexes[0];const u=s.stringConditions;l&&"string"==typeof l&&(o=u.findIndex((e=>e===r))),i&&"string"==typeof i&&(d=u.findIndex((e=>e===n))),e.cacheFilter(o,e.logicalOperatorList.selectedIndexes[0],d)}getFilterInputValue(e){return e.value}excelFilter(){const e=this,t=e.context;if(Array.isArray(t.dataSource))return void e.customExcelFilter();const l=e.tree,a=e.filterObject;if(a.clear(),e.customItems=[],l._menuItems[0].selected)return void e.excelClear();const i=l.selectedIndexes;if(i.forEach((function(i){const s=l._menuItems[i];if(s instanceof Smart.TreeItem){const l=s.value;if(s.hasAttribute("default-item"))if(l instanceof Date){const i=new Smart.FilterGroup,s=new Date(l.getFullYear(),l.getMonth(),1),r=new Date(l.getFullYear(),l.getMonth()+1,0),n=i.createFilter(t._filterType,s,"GREATER_THAN_OR_EQUAL",void 0,t.formatString,t.locale,e.timeOnly),c=i.createFilter(t._filterType,r,"LESS_THAN_OR_EQUAL",void 0,t.formatString,t.locale,e.timeOnly);i.addFilter("and",n),i.addFilter("and",c),a.addFilter("or",i)}else{const i=e.getExcelComparison(l),s=a.createFilter(t._filterType,l,i,void 0,t.formatString,t.locale,e.timeOnly);a.addFilter("or",s)}else e.customItems.push(s)}})),0===i.length){const l=e.getExcelComparison("Empty Filter"),i=a.createFilter(t._filterType,"Empty Filter",l,void 0,t.formatString,t.locale,e.timeOnly);a.addFilter("or",i)}e.cachedFilter=i.slice(0)}customExcelFilter(){const e=this,t=e.tree;if(delete e.customExcelFilterObjects,t._menuItems[0].selected)return;const l=e.context,a=[],i=t.selectedIndexes;i.forEach((function(i){const s=t._menuItems[i];if(s instanceof Smart.TreeItem){let t=s.value;if(!Array.isArray(t))return;Array.isArray(t[0])||(t=[t]);const i=new Smart.Utilities.FilterGroup;for(let a=0;a<t.length;a++){const s=t[a],r=e.operationsMapping[s[1]],n=i.createFilter(l._filterType,s[2],r,void 0,l.formatString,l.locale,e.timeOnly);i.addFilter("and",n)}a.push(i)}})),e.customExcelFilterObjects=a,e.cachedFilter=i.slice(0)}getExcelComparison(e){return""===e?"NULL":"EQUAL"}filterBuilderFilter(){const e=this,t=e.filterBuilder.value,l="string"===e.context.filterType&&e.caseSensitive.checked,a={filters:[]};!function t(a,i){const s=new Smart.Utilities.FilterGroup,r=a[1];i.logicalOperator=r;for(let n=0;n<a.length;n++){if(1===n)continue;const c=a[n];if(Array.isArray(c))if(Array.isArray(c[0])){const e={filters:[]};i.filters.push(e),t(c,e)}else s.addFilter(r,e.createFilterBuilderFilter(s,c,l))}s.filters.length>0&&i.filters.push(s)}(t,a),e.filterBuilderObject=a,e.cachedFilter={filterBuilder:JSON.parse(JSON.stringify(e.filterBuilder.value),(function(e,t){return/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})Z$/.test(t)?new Date(t):t})),caseSensitive:l}}createFilterBuilderFilter(e,t,l){const a=this.context;let i=this.operationsMapping[t[1]];return l&&-1!==["CONTAINS","DOES_NOT_CONTAIN","STARTS_WITH","ENDS_WITH","EQUAL"].indexOf(i)&&(i+="_CASE_SENSITIVE"),e.createFilter(a._filterType,t[2],i,void 0,a.formatString,a.locale,!1)}defaultClear(){const e=this;e.firstList.selectedIndexes=[e.defaultListSelection],e.firstInput.value="",e.logicalOperatorList.selectedIndexes=[0],e.secondList.selectedIndexes=[e.defaultListSelection],e.secondInput.value="",e.filterObject.clear(),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}excelClear(){const e=this;0!==e.tree.offsetHeight&&e.tree.select("0"),e.filterObject.clear(),e.cachedFilter=e.tree.selectedIndexes.slice(0)}filterBuilderClear(){const e=this;e.filterBuilder.value=["and"],"string"===e.context.filterType&&(e.caseSensitive.checked=!1),e.cachedFilter={filterBuilder:["and"],caseSensitive:!1}}defaultCancel(){const e=this;let t=null,l=null;if(e.filterObject){const a=e.filterObject.stringConditions,i=e.filterObject.numericConditions,s=e.filterObject.booleanConditions,r=e.filterObject.dateConditions;t=a[e.cachedFilter.firstFilterComparison],l=a[e.cachedFilter.secondFilterComparison],e.cachedFilter.firstFilterValue&&"string"!=typeof e.cachedFilter.firstFilterValue&&(!0===e.cachedFilter.firstFilterValue||!1===e.cachedFilter.firstFilterValue?(t=s[e.cachedFilter.firstFilterComparison],l=s[e.cachedFilter.secondFilterComparison]):e.cachedFilter.firstFilterValue&&e.cachedFilter.firstFilterValue instanceof Date?(t=r[e.cachedFilter.firstFilterComparison],l=r[e.cachedFilter.secondFilterComparison]):(t=i[e.cachedFilter.firstFilterComparison],l=i[e.cachedFilter.secondFilterComparison]))}let a=-1;e.firstList.dataSource.find(((e,l)=>{if(e.value===t)return a=l,e}));let i=-1;e.secondList.dataSource.find(((e,t)=>{if(e.value===l)return i=t,e})),e.firstList.selectedIndexes=[a],e.firstInput.value=e.cachedFilter.firstFilterValue,e.cachedFilter.firstFilterCaseSensitive&&e.firstInputMatchCase.classList.add("active"),e.logicalOperatorList.selectedIndexes=[e.cachedFilter.logicalOperator],e.secondList.selectedIndexes=[i],e.secondInput.value=e.cachedFilter.secondFilterValue,e.cachedFilter.firstFilterCaseSensitive&&e.firstInputMatchCase.classList.add("active"),e.cachedFilter.secondFilterCaseSensitive&&e.secondInputMatchCase.classList.add("active")}excelCancel(){const e=this;if(e.cachedFilter&&e.cachedFilter.firstFilterValue){const t=e.cachedFilter.firstFilterValue,l=e.cachedFilter.secondFilterValue,a=e.cachedFilter.firstFilterComparison,i=e.cachedFilter.secondFilterComparison;let s=e.filterObject.stringConditions;if(isNaN(parseFloat(t))||(s=e.filterObject.numericConditions),e.dataSource){let r=[];return e.dataSource.forEach(((e,n)=>{r.push("0."+n),e.label===t||e.label===l?("NOT_EQUAL"!==s[a]&&"DOES_NOT_CONTAIN"!==s[a]||r.pop(),"NOT_EQUAL"!==s[i]&&"DOES_NOT_CONTAIN"!==s[i]||r.pop()):e.label===t&&e.label===l||("EQUAL"!==s[a]&&"EQUAL_CASE_SENSITIVE"!==s[a]&&"CONTAINS"!==s[a]&&"ENDS_WITH"!==s[a]&&"STARTS_WITH"!==s[a]||r.pop(),"EQUAL"!==s[i]&&"EQUAL_CASE_SENSITIVE"!==s[i]&&"CONTAINS"!==s[i]&&"ENDS_WITH"!==s[i]&&"STARTS_WITH"!==s[i]||r.pop())})),void setTimeout((()=>{e.tree.selectedIndexes=r}))}}else if(e.cachedFilter&&e.cachedFilter.filters&&e.dataSource){let t=[];return e.dataSource.forEach(((l,a)=>{t.push("0."+a);let i=!1;e.cachedFilter.filters.forEach((e=>{e.value===l.label&&(i=!0)})),i||t.pop()})),void setTimeout((()=>{e.tree.selectedIndexes=t}))}e.tree.selectedIndexes=e.cachedFilter.slice(0)}filterBuilderCancel(){const e=this;e.filterBuilder.value=e.cachedFilter.filterBuilder,"string"===e.context.filterType&&(e.caseSensitive.checked=e.cachedFilter.caseSensitive)}createExcelHTMLStructure(){const e=this,t=e.context,l=document.createElement("smart-tree"),a={data:t.data,dataField:t.dataField,filterType:t._filterType};if(t.dataSource&&Array.isArray(t.dataSource))e.processCustomDataSource(l);else{if(t.data&&t.dataField||t.error(t.localize("missingProperty")),"date"===t.filterType){a.formatString=t.formatString,a.displayMode=e.displayMode,e.dataSource=e.filterObject.getUniqueValues(a,t);try{e.getHierarchicalDataSource(e.displayMode)}catch(e){t.error(t.localize("mismatchedProperties"))}e.timeOnly?l.classList.add("standard-excel"):l.classList.add("date-excel")}else e.dataSource=e.filterObject.getUniqueValues(a,t),l.classList.add("standard-excel");"function"==typeof t.dataSource&&(e.dataSource=t.dataSource(e.dataSource)||e.dataSource)}l.animation=t.animation,l.disabled=t.disabled,l.unfocusable=t.unfocusable,l.dataSource=[{label:t.localize("selectAll"),value:"",items:e.dataSource,expanded:!0,selected:!0}],l.selectionMode="checkBox",l.hasThreeStates=!0,l.theme=t.theme,l.animation="none",l.toggleMode="arrow",l.rightToLeft=t.rightToLeft,l.addEventListener("collapsing",(function(e){1===e.detail.item.level&&e.preventDefault()})),l._onCompleted=function(){if(e.cachedFilter=l.selectedIndexes.slice(0),l.classList.contains("date-excel"))for(let e in l._menuItems){if("0"===e)continue;const t=l._menuItems[e];t.firstElementChild.style.paddingLeft=20*(t.level-1)-10+"px"}else l._menuItems[0].firstElementChild.style.paddingLeft=0;l.selectAll=l._menuItems[0],l.blanks=l.querySelector('[label="'+t.localize("blanks")+'"]'),"en"!==t.locale&&(l.selectAll&&(l.selectAll.label=t.localize("selectAll")),l.blanks&&(l.blanks.label=t.localize("blanks")))},e.tree=l,t.$.mainContainer.appendChild(l)}processCustomDataSource(e){const t=this.context.dataSource;e.classList.add("standard-excel"),this.dataSource=t}createBuilderHTMLStructure(){const e=this,t=e.context,l=document.createElement("smart-filter-builder"),a=t.dataField,i="numeric"===t.filterType?"number":t.filterType;if(e.filterBuilder=l,l.animation=t.animation,l.disabled=t.disabled,l.unfocusable=t.unfocusable,l.value=["and"],l.fields=[{label:a,dataField:a,dataType:i,filterOperations:e.filterBuilderOperations}],e.localizeFilterBuilder(),t.$.mainContainer.appendChild(l),"string"===i){const l=document.createElement("smart-check-box");l.classList.add("case-sensitive"),l.innerHTML="Case sensitive",l.animation=t.animation,l.disabled=t.disabled,l.unfocusable=t.unfocusable,l.checked=!1,e.caseSensitive=l,t.$.mainContainer.appendChild(l)}e.filterBuilderObject={filters:[]},e.cachedFilter={filterBuilder:["and"],caseSensitive:!1}}localizeFilterBuilder(){const e=this.context,t=this.filterBuilder;let l=t.messages[e.locale];l||(l={},t.messages[e.locale]=l),t.customOperations=[{name:"NULL",label:e.localize("null"),hideValue:!0},{name:"NOT_NULL",label:e.localize("notNull"),hideValue:!0}],l.addCondition=e.localize("addCondition"),l.addGroup=e.localize("addGroup"),l["<"]=e.localize("lessThan"),l["<="]=e.localize("lessThanOrEqual"),l["<>"]=e.localize("notEqual"),l["="]=e.localize("equal"),l[">"]=e.localize("greaterThan"),l[">="]=e.localize("greaterThanOrEqual"),l.and=e.localize("and"),l.contains=e.localize("contains"),l.endswith=e.localize("endsWith"),l.isblank=e.localize("empty"),l.isnotblank=e.localize("notEmpty"),l.notcontains=e.localize("doesNotContain"),l.or=e.localize("or"),l.startswith=e.localize("startsWith"),l.dateTabLabel=e.localize("dateTabLabel"),l.timeTabLabel=e.localize("timeTabLabel"),t.formatStringDate=e.formatString,t.formatStringDateTime=e.formatString,t.locale=e.locale,t.valuePlaceholder=e.localize("filterBuilderPlaceholder")}evaluate(e){const t=this,l=t.context;if("default"===l.mode||"basic"===l.mode)return t.filterObject.evaluate(e);if("excel"===l.mode){let a=!1;if(Array.isArray(l.dataSource)){if(!t.customExcelFilterObjects||0===t.customExcelFilterObjects.length)return!0;for(let l=0;l<t.customExcelFilterObjects.length;l++)a=a||t.customExcelFilterObjects[l].evaluate(e);return a}if(t.customItems&&t.customItems.length>0){if(t.filterObject.filters.length>0&&(a=t.filterObject.evaluate(e)),t.customItems&&l.evaluateFilterExpression)for(let i=0;i<t.customItems.length;i++){const s=l.evaluateFilterExpression(e,t.customItems[i].value);void 0!==s&&(a=a||s)}}else a=t.filterObject.evaluate(e);return a}return!t.filterBuilderObject.logicalOperator||function t(l){let a="and"===l.logicalOperator;for(let i=0;i<l.filters.length;i++){let s;s=l.filters[i]instanceof Smart.Utilities.FilterGroup?l.filters[i].evaluate(e):t(l.filters[i]),a="and"===l.logicalOperator?a&&s:a||s}return a}(t.filterBuilderObject)}}),Smart.Utilities.Assign("NumericFilterHandler",class extends Smart.Utilities.BaseFilterHandler{appendInputs(){let e=this,t=document.createElement("smart-number-input"),l=document.createElement("smart-number-input");t.placeholder=e.context.localize("placeholderNumber"),l.placeholder=e.context.localize("placeholderNumber"),t.nullable=!0,t.spinButtons=!0,t.value=null,l.nullable=!0,l.spinButtons=!0,l.value=null,e.firstInput=t,e.secondInput=l}getFilterInputValue(e){return null===e.value||""===e.value?"":parseFloat(e.value)}}),Smart.Utilities.Assign("StringFilterHandler",class extends Smart.Utilities.BaseFilterHandler{setDefaults(){const e=this,t=e.context;e.defaultListSource=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("empty")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("notEmpty")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("contains")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("doesNotContain")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("startsWith")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("endsWith")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("equal")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("notEqual")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("null")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("notNull")}],e.filterBuilderOperations=["contains","isblank","isnotblank","notcontains","startswith","endswith","=","NULL","NOT_NULL"],e.defaultListSelection=2}appendInputs(){const e=this,t=document.createElement("input"),l=document.createElement("input");t.placeholder=e.context.localize("placeholderValue"),t.setAttribute("aria-label",t.placeholder),l.placeholder=e.context.localize("placeholderValue"),l.setAttribute("aria-label",l.placeholder),t.classList.add("smart-input"),l.classList.add("smart-input"),e.firstInput=t,e.secondInput=l,e.firstInputMatchCase.onclick=()=>{e.firstInputMatchCase.classList.toggle("active")},e.secondInputMatchCase.onclick=()=>{e.secondInputMatchCase.classList.toggle("active")};const a=(e,t,l)=>{if(0===e.selectedValues.length)return t.classList.remove("case-sensitive"),void l.classList.remove("case-sensitive");const a=e.selectedValues[0];t.classList.remove("case-sensitive"),l.classList.remove("case-sensitive"),["EQUAL","NOT_EQUAL","CONTAINS","DOES_NOT_CONTAIN","STARTS_WITH","ENDS_WITH"].indexOf(a)>=0&&(t.classList.add("case-sensitive"),l.classList.add("case-sensitive"))};e.firstList.onchange=()=>{a(e.firstList,e.firstInput,e.firstInputMatchCase)},e.secondList.onchange=()=>{a(e.secondList,e.secondInput,e.secondInputMatchCase)},setTimeout((()=>{a(e.firstList,e.firstInput,e.firstInputMatchCase),a(e.secondList,e.secondInput,e.secondInputMatchCase)}),50)}getExcelComparison(e){return""===e?"EMPTY":"EQUAL_CASE_SENSITIVE"}}),Smart.Utilities.Assign("DateFilterHandler",class extends Smart.Utilities.BaseFilterHandler{cacheFilter(e,t,l){const a=this;a.cachedFilter={firstFilterComparison:e,firstFilterValue:a.firstInput.getValue(),logicalOperator:t,secondFilterComparison:l,secondFilterValue:a.secondInput.getValue()}}appendInputs(){let e=this,t=e.context,l=document.createElement("smart-date-input"),a=document.createElement("smart-date-input");t.formatString&&!(t.formatString.indexOf("d")>=0||t.formatString.indexOf("M")>=0||t.formatString.indexOf("y")>=0)&&(l=document.createElement("smart-time-input"),a=document.createElement("smart-time-input")),l.calendarButton=!0,l.editMode="partial",l.formatString=t.formatString,l.dropDownDisplayMode="auto",l.locale=t.locale,l.autoClose=!0,l.messages[t.locale]||(l.messages[t.locale]={}),l.messages[t.locale].dateTabLabel=t.localize("dateTabLabel"),l.messages[t.locale].timeTabLabel=t.localize("timeTabLabel"),l.nullable=!0,l.value=null,a.autoClose=!0,a.calendarButton=!0,a.formatString=t.formatString,a.dropDownDisplayMode="auto",a.locale=t.locale,a.messages[t.locale]||(a.messages[t.locale]={}),a.messages[t.locale].dateTabLabel=t.localize("dateTabLabel"),a.messages[t.locale].timeTabLabel=t.localize("timeTabLabel"),a.nullable=!0,a.value=null,e.firstInput=l,e.secondInput=a}getFilterInputValue(e){if(null===e.value)return"";const t=e.getDate();return"calendar"===this.displayMode&&t&&t.setHours(0,0,0),t}defaultClear(){const e=this;e.firstList.selectedIndexes=[e.defaultListSelection],e.firstInput.value=null,e.logicalOperatorList.selectedIndexes=[0],e.secondList.selectedIndexes=[e.defaultListSelection],e.secondInput.value=null,e.filterObject.clear(),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}getHierarchicalDataSource(e){const t=this,l=t.dataSource,a={},i=[];let s;if("timePicker"!==e){""===l[l.length-1].value&&(s=l[l.length-1],l.pop()),l.forEach((function(e){const l=e.value,i=l.getFullYear(),s=new Intl.DateTimeFormat(t.context.locale,{month:"long"}).format(l);a[i]||(a[i]={}),a[i][s]||(a[i][s]=e.value)}));for(let e in a){const t={expanded:!0,label:e,items:[],customAttribute:"default-item"};i.push(t);for(let l in a[e]){const i={value:a[e][l],expanded:!0,label:l,items:[],customAttribute:"default-item"};t.items.push(i)}}s&&i.push(s),t.dataSource=i}}}),Smart.Utilities.Assign("BooleanFilterHandler",class extends Smart.Utilities.BaseFilterHandler{cacheFilter(e,t,l){const a=this;a.cachedFilter={firstFilterComparison:e,firstFilterValue:a.firstInput.selectedIndexes.slice(0),logicalOperator:t,secondFilterComparison:l,secondFilterValue:a.secondInput.selectedIndexes.slice(0)}}setDefaults(){const e=this,t=e.context;e.defaultListSource=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("equal")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("notEqual")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("null")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("notNull")}],e.filterBuilderOperations=["=","<>","NULL","NOT_NULL"],e.defaultListSelection=0}appendInputs(){const e=this,t=document.createElement("smart-input"),l=document.createElement("smart-input");t.dataSource=[{value:!0,label:"true"},{value:!1,label:"false"}],t.placeholder=e.context.localize("placeholderBoolean"),t.selectedIndexes=[],t.selectionMode="zeroOrOne",t.readonly=!0,t.dropDownButtonPosition="right",l.dataSource=[{value:!0,label:"true"},{value:!1,label:"false"}],l.placeholder=e.context.localize("placeholderBoolean"),l.selectedIndexes=[],l.selectionMode="zeroOrOne",l.readonly=!0,l.dropDownButtonPosition="right",e.firstInput=t,e.secondInput=l}getFilterInputValue(e){return 0===e.selectedValues.length?"":!0===e.selectedValues[0]}defaultClear(){const e=this;e.firstList.selectedIndexes=[e.defaultListSelection],e.firstInput.selectedIndexes=[],e.logicalOperatorList.selectedIndexes=[0],e.secondList.selectedIndexes=[e.defaultListSelection],e.secondInput.selectedIndexes=[],e.filterObject.clear(),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}defaultCancel(){const e=this;e.firstList.selectedIndexes=[e.cachedFilter.firstFilterComparison],e.firstInput.selectedIndexes=e.cachedFilter.firstFilterValue,e.logicalOperatorList.selectedIndexes=[e.cachedFilter.logicalOperator],e.secondList.selectedIndexes=[e.cachedFilter.secondFilterComparison],e.secondInput.selectedIndexes=e.cachedFilter.secondFilterValue}});
83
83
  Smart("smart-gantt-chart",class extends Smart.ScrollViewer{static get properties(){return{adjustToNonworkingTime:{value:!1,type:"boolean"},autoSchedule:{value:!1,type:"boolean"},autoScheduleStrictMode:{value:!1,type:"boolean"},autoScrollStep:{value:5,type:"number"},columnMenu:{value:!1,type:"boolean"},columnMinWidth:{value:"50px",type:"any"},columnResize:{value:!1,type:"boolean"},columnResizeFeedback:{value:!1,type:"boolean"},currentTime:{value:new Date,type:"any",validator:"_dateValidator"},currentTimeIndicator:{value:!1,type:"boolean"},currentTimeIndicatorInterval:{value:1,validator:"_currentTimeIndicatorIntervalValidator",type:"number"},dataExport:{value:{exportFiltered:{value:!1,type:"boolean"},itemType:{value:"task",type:"string"},fileName:{value:"smartGanttChart",type:"string?"}},type:"object"},dataSource:{value:[],type:"any",reflectToAttribute:!1},dateEnd:{value:"",type:"any",validator:"_dateValidator"},dateStart:{value:"",type:"any",validator:"_dateValidator"},dateMarkers:{value:[],reflectToAttribute:!1,type:"array"},dayFormat:{value:"short",allowedValues:["2-digit","numeric","long","short","narrow"],type:"string"},disableAutoScroll:{value:!1,type:"boolean"},disableTaskDrag:{value:!1,type:"boolean"},disableTaskProgressChange:{value:!1,type:"boolean"},disableTaskResize:{value:!1,type:"boolean"},disableSelection:{value:!1,type:"boolean"},disableSegmentDrag:{value:!1,type:"boolean"},disableSegmentResize:{value:!1,type:"boolean"},disableWindowEditor:{value:!1,type:"boolean"},durationUnit:{value:"milisecond",allowedValues:["day","week","hour","minute","second","milisecond"],type:"string"},filterRow:{value:!1,type:"boolean"},firstDayOfWeek:{value:-1,type:"number"},groupByResources:{value:!1,type:"boolean"},headerTemplate:{value:null,type:"any"},hourFormat:{value:"default",allowedValues:["default","2-digit","numeric"],type:"string"},hideDateMarkers:{value:!1,type:"boolean"},hideTimelineHeaderDetails:{value:!1,type:"boolean"},hideTimelineSecondHeaderDetails:{value:!0,type:"boolean"},hideTimelineHeader:{value:!1,type:"boolean"},hideResourcePanel:{value:!1,type:"boolean"},showSelectionColumn:{value:!1,type:"boolean"},infiniteTimeline:{value:!1,type:"boolean"},infiniteTimelineStep:{value:5,type:"number"},inverted:{value:!1,type:"boolean"},keyboardNavigation:{value:!1,type:"boolean"},messages:{extend:!0,value:{en:{duplicateIds:"{{elementType}}: DataSource contains duplicate ids. Tasks should have unique ids. The following ids are duplicating: {{duplicates}}.",invalidNonworkingRange:"{{elementType}}: Invalid {{property}} value. {{property}} should not contain all possible days/hours because it will result in an endless timeline. The value has been validated by removing the last item from the new value range.",invalidValue:"{{elementType}}: Invalid {{property}} value. {{property}} should be of type {{typeOne}} or {{typeTwo}}.",incorrectArgument:"{{elementType}}: Incorrect argument {{argumentName}} in method {{methodName}}.",outOfBounds:"{{elementType}}: Out of bounds argument {{argumentName}} in method {{methodName}}.",missingReference:"{{elementType}}: Missing reference to {{file}} in method {{methodName}}.",alreadyExists:"{{elementType}}: The item already exists when calling the {{methodName}} method.",notExisting:"{{elementType}}: The item does not exists when calling the {{methodName}} method.",notAProject:"{{elementType}}: The {{argumentName}} argument in {{methodName}} method does not reference an item of type 'project'.",noId:"smartGanttChart requires an id in order to save/load/clear a state.",ok:"Ok",add:"Add",remove:"Remove",cancel:"Cancel",delete:"Delete",confirm:"{{componentName}} will be deleted permanently, <b>are you sure? </b>",taskColumnLabel:"Task Name",resourceColumnLabel:"Resource Name",deleteLink:"Delete link",unassigned:"Unassigned",generalTab:"General",dependencyTab:"Dependency",segmentsTab:"Segments",segment:"Segment",dependencyValidation:"*The Task cannot be connected to itself.",segmentsCountValidation:"*Segmented Tasks must have at least 2 segments. ",segmentConflictError:'*The Segment "{{label}}" is in conflict, because it starts on/before and ends on/after the {{dateConflict}} of Segment "{{conflictLabel}}." ',segmentStartError:'*The Segment "{{label}}" cannot start before it ends and cannot end before it starts.',segmentEndError:'*The Segment "{{label}}" cannot start when it ends.',segmentRangeError:'*The Segment "{{label}}" is out of Task date range. The first segment must start when the task starts and the last segment must end when the task ends.',label:"Label",duration:"Duration",dateStart:"Date Start",dateEnd:"Date End",id:"Id",name:"Name",type:"Type",lag:"Lag",startToStart:"Start-To-Start",endToStart:"End-To-Start",endToEnd:"End-To-End",startToEnd:"Start-To-End",overdue:"Overdue",weeks:"week(s)",days:"day(s)",hours:"hour(s)",minutes:"minute(s)",seconds:"second(s)",miliseconds:"milisecond(s)",task:"Task",resource:"Resource",assignments:"Assignments",startTask:"Task Start",endTask:"Task End",deadline:"Deadline",quarter:"Quarter",quarterShort:"Q"}},type:"object"},monthFormat:{value:"short",allowedValues:["2-digit","numeric","long","short","narrow"],type:"string"},monthScale:{value:"week",allowedValues:["day","week"],type:"string"},max:{value:new Date(2100,0,1),type:"any",validator:"_dateValidator"},min:{value:new Date(1900,0,1),type:"any",validator:"_dateValidator"},nonworkingDays:{value:[],type:"array",validator:"_nonworkingDayValidator"},nonworkingHours:{value:[],type:"array",validator:"_nonworkingTimeValidator"},onTaskRender:{value:null,reflectToAttribute:!1,type:"function?"},popupWindowCustomizationFunction:{value:null,reflectToAttribute:!1,type:"function?"},popupWindowTabs:{value:["general","dependency","segments"],reflectToAttribute:!1,type:"array"},progressLabelFormatFunction:{value:null,reflectToAttribute:!1,type:"function?"},resizeHandlesVisibility:{allowedValues:["auto","hidden","visible"],value:"auto",type:"string"},quarterFormat:{value:"short",allowedValues:["long","short","numeric"],type:"string"},resourceColumns:{value:[{label:"resourceColumnLabel",value:"label"}],type:"array",reflectToAttribute:!1},resourceFiltering:{value:!1,type:"boolean"},resourceGroupFormatFunction:{value:null,reflectToAttribute:!1,type:"function?"},resourcePanelHeaderTemplate:{value:null,type:"any"},resourcePanelMin:{value:100,type:"any"},resourcePanelSize:{value:"",type:"any"},resourcePanelRefreshRate:{value:0,reflectToAttribute:!1,type:"number"},resourceTimelineFormatFunction:{value:null,reflectToAttribute:!1,type:"function?"},resourceTimelineMode:{allowedValues:["diagram","histogram","custom"],value:"diagram",type:"string"},resourceTimelineView:{allowedValues:["hours","tasks","custom"],value:"hours",type:"string"},selectedTaskIds:{value:[],type:"array"},selectedResourceIds:{value:[],type:"array"},shadeUntilCurrentTime:{value:!1,type:"boolean"},showBaseline:{value:!1,type:"boolean"},showProgressLabel:{value:!1,type:"boolean"},snapToNearest:{value:!1,type:"boolean"},sortFunction:{value:null,type:"function?",reflectToAttribute:!1},sortMode:{value:"none",allowedValues:["none","one","many"],type:"string"},taskColumns:{value:[{label:"taskColumnLabel",value:"label"}],type:"array",reflectToAttribute:!1},taskFiltering:{value:!1,type:"boolean"},taskPanelMin:{value:200,type:"any"},taskPanelSize:{value:"",type:"any"},timelineHeaderFormatFunction:{value:null,reflectToAttribute:!1,type:"function?"},timelineMin:{value:200,type:"any"},treeMin:{value:100,type:"any"},treeSize:{value:"20%",type:"any"},tooltip:{value:{enabled:{value:!1,type:"boolean"},arrow:{value:!1,type:"boolean"},delay:{value:50,type:"number"},offset:{value:[0,5],type:"array"}},type:"object"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},view:{value:"year",allowedValues:["day","week","month","quarter","year"],type:"any"},yearFormat:{value:"numeric",allowedValues:["2-digit","numeric"],type:"string"},weekFormat:{value:"long",allowedValues:["long","numeric"],type:"string"}}}template(){return'<div id="container" role="presentation">\n <smart-splitter id="mainSplitter" auto-fit-mode="end" keep-proportions-on-resize right-to-left="[[rightToLeft]]" animation="[[animation]]" orientation="horizontal">\n <smart-splitter-item id="taskSplitterItem" class="smart-task-splitter-item">\n <div id="taskSplitterItemHeader" class="smart-task-panel-header"></div>\n <smart-splitter id="taskSplitter" class="smart-task-splitter" auto-fit-mode="end">\n <smart-splitter-item id="tableSplitterItem">\n <smart-table right-to-left="[[rightToLeft]]" wait id="taskTable" class="smart-task-table" virtualization animation="none" deferred-scroll-delay="0" ></smart-table>\n </smart-splitter-item>\n <smart-splitter-item id="timelineSplitterItem" class="smart-timeline-splitter-item">\n <div id="timeline" class="smart-timeline">\n <div id="timelineHeader" class="smart-timeline-header" role="rowgroup">\n <div id="timelineHeaderContent" class="smart-timeline-header-content">\n <div class="smart-timeline-view-details" id="timelineViewDetails" role="row"></div>\n <div class="smart-timeline-view-details smart-hidden" id="timelineViewSubDetails" role="row"></div>\n <div class="smart-timeline-view-cells" id="timelineViewCells" role="row"></div>\n </div>\n </div>\n <div id="taskTimelineContainer" class="smart-timeline-content-container">\n <div id="timelineContent" class="smart-timeline-content">\n <div id="taskTimelineCellsContainer" class="smart-timeline-cells-container" aria-hidden="true"></div>\n <div id="taskIndicatorsContainer" class="smart-timeline-indicators-container" role="group"></div>\n <div id="timelineConnectionsContainer" class="smart-timeline-connections-container" role="group"></div>\n <div id="timelineBaselinesContainer" class="smart-timeline-baselines-container" role="group"></div>\n <div id="timelineTasksContainer" class="smart-timeline-tasks-container" role="group"></div>\n <div id="timelineMarkers" class="smart-timeline-markers-container" role="group"></div>\n <div id="timelineDeadlines" class="smart-timeline-deadlines-container" role="group"></div>\n </div>\n </div>\n </div>\n <smart-scroll-bar id="verticalScrollBar" class="smart-timeline-scroll-bar" orientation="vertical"\n right-to-left="[[rightToLeft]]" aria-controls="[[id]]">\n </smart-scroll-bar>\n </smart-splitter-item>\n </smart-splitter>\n </smart-splitter-item>\n </smart-splitter>\n <smart-scroll-bar wait id="horizontalScrollBar" class="smart-timeline-scroll-bar"></smart-scroll-bar>\n </div>'}static get listeners(){return{down:"_downHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","document.dragstart":"_dragStartHandler","container.wheel":"_mouseWheelHandler","horizontalScrollBar.change":"_horizontalScrollbarHandler","verticalScrollBar.change":"_verticalScrollbarHandler","resourceVerticalScrollBar.change":"_verticalScrollbarHandler","mainSplitter.resizeEnd":"_resizeEventHandler","mainSplitter.resize":"_resizeEventHandler",move:"_moveHandler","mainSplitter.change":"_tableChangeHandler","mainSplitter.filter":"_tableSortFilterHandler","mainSplitter.sort":"_tableSortFilterHandler","mainSplitter.columnResize":"_tableColumnResizeHandler","taskTable.group":"_taskTableGroupEventHandler","taskTable.collapse":"_taskTableExpandHandler","taskTable.expand":"_taskTableExpandHandler","taskTable.keydown":"_taskTableKeyDownHandler"}}static get styleUrls(){return["smart.ganttchart.css"]}attached(){const e=this;if(super.attached(),e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e.$.taskSplitterItem,e.$.horizontalScrollBar,e.$.verticalScrollBar)),!e._resourceScrollView&&e.$.mainSplitter.contains(e.$.resourceSplitter)&&(e._resourceScrollView=new Smart.Utilities.Scroll(e.$.resourceSplitterItem,e.$.horizontalScrollBar,e.$.resourceVerticalScrollBar)),e.scrollLeft){const t=e._getScrollLeft(e.scrollLeft);e.$.timelineHeader.scrollLeft=e.$.taskTimelineContainer.scrollLeft=t,e.$.mainSplitter.contains(e.$.resourceTimelineHeader)&&(e.$.resourceTimelineHeader.scrollLeft=e.$.resourceTimelineContent.scrollLeft=t)}if(e.scrollTop){const t=e.scrollTop;e.$.taskTimelineContainer.scrollTop=t,e.$.timelineContent.scrollTop=t,e.$.mainSplitter.contains(e.$.resourceTimelineHeader)&&(e.$.resourceTimelineContent.scrollTop=t)}const t=["taskPopupWindow","connectionPopupWindow","confirmPopupWindow"];for(let i=0;i<t.length;i++){const n=t[i];if(e.$[n]&&e.$[n].opened){const t=e["$"+n];e._handleModal(!0),t.listen("close",e._popupWindowCloseHandler.bind(e)),t.listen("closing",e._popupWindowClosingHandler.bind(e)),t.listen("open",e._popupWindowOpenHandler.bind(e)),t.listen("click",e._popupWindowClickHandler.bind(e)),t.listen("change",e._popupWindowChangeHandler.bind(e)),t.listen("transitionend",e._popupWindowTransitionendHandler.bind(e)),e.getShadowRootOrBody().appendChild(e.$[n])}}e._handleTooltipEvents(!0),e._currentTimeIndicatorInterval||!e.currentTimeIndicator&&!e.shadeUntilCurrentTime||e._setCurrentTimeIndicators()}detached(){const e=this;super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._resourceScrollView&&(e._resourceScrollView.unlisten(),delete e._resourceScrollView);const t=["taskPopupWindow","connectionPopupWindow","confirmPopupWindow"];e._handleModal();for(let i=0;i<t.length;i++){const n=t[i],a=e["$"+n];e.$[n]&&e.$[n].remove(),a&&(a.unlisten("open"),a.unlisten("close"),a.unlisten("closing"),a.unlisten("click"),a.unlisten("change"),a.unlisten("transitionend"))}e._handleTooltipEvents(),clearInterval(e._currentTimeIndicatorInterval),delete e._currentTimeIndicatorInterval}propertyChangedHandler(e,t,i){const n=this;switch(e){case"adjustToNonworkingTime":for(let e=0;e<n._tasks.length;e++){const t=n._tasks[e],i=t.$.project;n._validateTaskDates(t,i),n._validateTaskSegments(t),n._synchronizeProjectDates(t,i),n._refreshTableColumnsData(t,["dateEnd","duration"])}n._refreshTimeline();break;case"animation":break;case"autoSchedule":i?n._autoSchedule():n._autoScheduleRestore();break;case"autoScheduleStrictMode":i&&(n._autoSchedule(),n._refreshTimeline());break;case"columnMinWidth":case"columnResizeFeedback":case"columnResize":{const t=n.$.taskTable,a=n.$.resourceTable;t[e]=i,a&&(a[e]=i);break}case"currentTimeIndicator":case"shadeUntilCurrentTime":n._setCurrentTimeIndicators();break;case"dataSource":n.scrollLeft=n.scrollTop=0,n._createTasks(),n._refreshTableDataSource(),n._createTimeline(),n._createResourceTimeline(),n._setAriaControls();break;case"dateMarkers":n._createDateMarkers();break;case"hideDateMarkers":n._recycleDateMarkers();break;case"disableSelection":{const e=n.$.taskTable,t=n.$.resourceTable;e&&(e.selection=!n.disableSelection),t&&(t.selection=!n.disableSelection);break}case"durationUnit":for(let e=0;e<n._tasks.length;e++){const t=n._tasks[e],i=t.$.project;n._validateTaskDuration(t),n._validateTaskDates(t,i),n._validateTaskSegments(t),n._synchronizeProjectDates(t,i)}n._createTimelineCells(),n._insertTimelineTasks(),n.taskColumns.some((e=>(e.value+"").toLowerCase().indexOf("duration")>-1))&&n._refreshTableDataSource();break;case"filterRow":n.$.taskTable[e]=i;break;case"groupByResources":n._setTable(n.$.taskTable),n._createTimelineContent(),n._recycleTimelineTasks(),n._refresh();break;case"infiniteTimeline":i?n._scrollView.hScrollBar.value===n._scrollView.hScrollBar.max&&n._handleInfiniteTimeline():n.set("dateEnd","");break;case"keyboardNavigation":n.$.taskTable[e]=i,n.$.resourceTable&&(n.$.resourceTable[e]=i);break;case"popupWindowTabs":case"popupWindowCustomizationFunction":{const e=n.$.taskPopupWindow;e&&(e.opened&&(e.close(),delete e._target),e.clear());break}case"taskFiltering":n.$.taskTable.filtering=i,n._refresh();break;case"resourceFiltering":{const e=n.$.resourceTable;e&&(e.filtering=i,n._refresh());break}case"tooltip_enabled":{const e=n.$.tooltip;e&&(i||e.remove(),n._handleTooltipEvents(i));break}case"tooltip_arrow":case"tooltip_delay":case"tooltip_offset":{const t=n.$.tooltip;t&&(t[e.replace("tooltip_","")]=i);break}case"headerTemplate":n._handleHeaderTemplate();break;case"inverted":if(n._handleInverted(),n.scrollLeft){const e=n._getScrollLeft(n.scrollLeft);n.$.timelineHeader.scrollLeft=n.$.taskTimelineContainer.scrollLeft=e,n.$.mainSplitter.contains(n.$.resourceTimelineHeader)&&(n.$.resourceTimelineHeader.scrollLeft=n.$.resourceTimelineContent.scrollLeft=e)}break;case"rightToLeft":Array.from(n.querySelectorAll("smart-splitter, smart-table, smart-scroll-bar")).forEach((t=>t[e]=i)),n.closeWindow(),n._handleInverted(),n._refreshTimeline();break;case"firstDayOfWeek":case"dateStart":case"dateEnd":n._refreshTimeline();break;case"messages":case"locale":case"dayFormat":case"hourFormat":case"timelineHeaderFormatFunction":case"monthFormat":case"yearFormat":n._refreshHeaderDate(!0),n._refreshColumnsHeaders(),n._recycleResourceHeaderCells();break;case"hideResourcePanel":n._createResourceTimeline(),n._refreshTimeline();break;case"nonworkingDays":case"nonworkingHours":n._refreshAfterWorkingTimeChange();break;case"selectedTaskIds":n.$.taskTable.selected=n._getSelection("task",i);break;case"selectedResourceIds":n.$.resourceTable&&(n.$.resourceTable.selected=n._getSelection("resource",i));break;case"resourceColumns":n._setTable(n.$.resourceTable),n._highlightAssignedItem("task",n._getSelection("task",n.selectedTaskIds));break;case"resourcePanelHeaderTemplate":n._handleHeaderTemplate("resource");break;case"resourceTimelineView":case"resourceTimelineMode":case"resourceTimelineFormatFunction":n.$.mainSplitter.contains(n.$.resourceSplitter)&&n._resources.forEach((e=>n._refreshResourceTimelineContent(e)));break;case"showProgressLabel":case"progressLabelFormatFunction":n._tasks.forEach((e=>n._setTaskBarProgress(e)));break;case"sortFunction":n.$.taskTable.sort=i,n.$.resourceTable&&(n.$.resourceTable.sort=i);break;case"showSelectionColumn":n.$.taskTable.hideSelectionColumn=!i,n.$.resourceTable&&(n.$.resourceTable.hideSelectionColumn=!i);break;case"columnMenu":case"hideSelectionColumn":case"sortMode":n.$.taskTable[e]=i,n.$.resourceTable&&(n.$.resourceTable[e]=i);break;case"taskColumns":n._setTable(n.$.taskTable);break;case"timelineMin":n.$.timelineSplitterItem.min=i,n.$.taskSplitter.refresh(),n.$.mainSplitter.contains(n.$.resourceSplitter)&&n._synchronizeSplitters(n.$.taskSplitter,n.$.resourceSplitter);break;case"treeMin":case"treeSize":{const t=e.toLowerCase().indexOf("size")>-1?"size":"min";n.$.tableSplitterItem[t]=i,n.$.taskSplitter.refresh(),n.$.mainSplitter.contains(n.$.resourceSplitter)&&n._synchronizeSplitters(n.$.taskSplitter,n.$.resourceSplitter);break}case"taskPanelMin":case"taskPanelSize":case"resourcePanelSize":case"resourcePanelMin":{const t=e.indexOf("Min")>-1?"min":"size",a=e.indexOf("resource")>-1?"resource":"task";n.$.mainSplitter.contains(n.$.resourceSplitter)&&(n.$[`${a}SplitterItem`][t]=i,n.$.taskSplitterItem._setSize("size",n.taskPanelSize),n.refresh());break}case"unfocusable":n._setFocusable();break;case"view":n._refreshTimeline(t);break;default:super.propertyChangedHandler(e,t,i)}}_predefPropertyGetter(e){const t=this;Object.defineProperty(t,e,{get:function(){switch(e){case"dataSource":{if(t.context===t)return t.properties[e].value;const i=function(e){if(!e.length)return e;for(let n=0;n<e.length;n++){const a=e[n];let s=t._getProjectTasks(a);s&&Array.isArray(s)&&(s=i(s.filter((e=>e.$&&e.$.project===a)))),e[n]=t._cloneObject(a),s&&s.length?e[n].tasks=s:delete e[n].tasks}return e},n=t.properties[e].value;return n instanceof Smart.DataAdapter?n:i(n.slice(0))}case"dateStart":case"dateEnd":{const i=t._timelineCells;if(i.length){const n=t._getCellDateRange({_date:i["dateStart"===e?0:i.length-1].date});return new Date(n[e])}return t.properties[e].value}default:return t.properties[e].value}},set(i){t.updateProperty(t,t._properties[e],i)}})}ready(){this._customScrollView=!0,super.ready()}render(){const e=this,t=window.getComputedStyle(e),i=Smart.Utilities.Core;e._isMobile=i.isMobile,e._isFirefox=i.Firefox,e._taskBarMinWidth=parseFloat(t.getPropertyValue("--smart-gantt-chart-timeline-task-min-width"))||0,e._taskDefaultHeight=parseFloat(t.getPropertyValue("--smart-gantt-chart-task-default-height"))||30,e._timelineCellSize=parseFloat(t.getPropertyValue("--smart-gantt-chart-timeline-cell-size"))||0,e._timelineCellMinSize=parseFloat(t.getPropertyValue("--smart-gantt-chart-timeline-cell-min-size"))||0,e._taskConnectionWidth=parseFloat(t.getPropertyValue("--smart-gantt-chart-timeline-task-connection-width"))||1,e._baselineProportion=parseFloat(t.getPropertyValue("--smart-gantt-chart-baseline-proportion"))||0,e._predefPropertyGetter("dataSource"),e._predefPropertyGetter("dateStart"),e._predefPropertyGetter("dateEnd"),e.$.tableSplitterItem.size=e.treeSize,e.$.tableSplitterItem.min=e.treeMin,e.$.timelineSplitterItem.min=e.timelineMin,e._setScrollBars(),e._handleHeaderTemplate(),e._handleInverted(!0),e._createTasks(),e._setTable(),e._createTimeline(),e._createResourceTimeline(),e._setAriaControls(),e._setFocusable(),e.checkLicense(),(e.shadowRoot||e._isFirefox)&&requestAnimationFrame((()=>e.refresh())),super.render()}refresh(e){const t=this;if(e)return t._refreshTimeline(),t._setTable(t.$.taskTable),void t._createResourceTimeline();t.isRendered&&t._resizeEventHandler()}addFilter(e,t){const i=this;if(!i.taskFiltering&&!i.resourceFiltering||!(t instanceof Smart.Utilities.FilterGroup))return;Array.isArray(e)||(e="object"==typeof e?[e]:[]);const n=i.taskColumns,a=i.resourceColumns,s=i.$.taskTable,r=i.$.resourceTable;for(let i=0;i<e.length;i++){const o=e[i],l=o.type,[d,c]="resource"===l||a.includes(o)?[r,a]:[s,n],m=c.find((e=>o.value&&e.value===o.value));m&&d.addFilter(m.value,t)}}clearSelection(){this._unselectAll("task"),this._unselectAll("resource")}static get requires(){return{"Smart.Splitter":"smart.splitter.js","Smart.Tree":"smart.tree.js","Smart.Window":"smart.window.js"}}ensureVisible(e,t="task"){const i=this,n=i._getValidItemAndIndex(e,t);(e=n?n.item:void 0)&&(i._ensureVisible(e,t),i._scrollTo(e.dateStart,!0))}removeAllConnections(){const e=this;e.isCompleted&&(e.$.timelineConnectionsContainer.innerHTML="",e._connections=[],e._tasks.map((e=>e.connections=[])))}removeConnection(){const e=this,t=Array.from(arguments).filter((e=>void 0!==e));if(!e.isCompleted)return;let i;if(1===t.length){if("string"==typeof t[0]){const e=document.getElementById(t[0]);e&&(i=e.getAttribute("connection-id"))}i||(i=(t[0]+"").split("-"),i=e._getValidConnectionId(i[0],i[1],i[2],"removeConnection"))}else 3===t.length&&(i=e._getValidConnectionId(t[0],t[1],t[2],"removeConnection"));i&&(e._removeConnection(i),e.$.fireEvent("itemRemove",{type:"connection",id:`${i[0]}-${i[1]}-${i[2]}`,item:{source:i[0],target:i[1],type:i[2]}}))}removeTaskConnection(e,t){const i=this;if(!i.isCompleted)return;if((e+="").indexOf("-")>-1&&!t){const i=e.split("-");t=i[1],e=i[0]}const n=i._getValidItemAndIndex(e),a=i._getValidItemAndIndex(t);e=n?n.index:void 0,t=a?a.index:void 0,isNaN(e)?i.error(i.localize("incorrectArgument",{elementType:i.nodeName.toLowerCase(),methodName:"removeTaskConnection",argumentName:"taskEndIndex"})):i._removeConnection(""+e+(isNaN(t)?"":t))}beginUpdate(){this._isUpdating={started:!0,type:{}},this.$.fireEvent("beginUpdate")}endUpdate(){const e=this;function t(){e._refreshTableDataSource(),e._createTimelineContent(),e._recycleTimelineTasks(),e._setAriaControls();const t=e._resources;for(let i=0;i<t.length;i++)e._refreshTableColumnsData(t[i],void 0,"resource")}function i(){if(e.hideResourcePanel)return;e._refreshTableDataSource("resource"),e._recycleResourceHeaderCells(),e._createResourceTimelineContent(),e._refresh();const t=e._tasks;for(let i=0;i<t.length;i++)e._refreshTableColumnsData(t[i])}if(!e._isUpdating)return;const n=1===Object.keys(e._isUpdating.type).length?Object.keys(e._isUpdating.type)[0]:void 0;let a,s;switch(e._selected&&({task:a,resource:s}=e._selected),delete e._isUpdating,n){case"task":t();break;case"resource":i();break;default:t(),i()}a&&(e._refreshSelectedItems("task",a),e.$.taskTable.selected=e._getSelection("task",e.selectedTaskIds)),s&&(e._refreshSelectedItems("resource",s),e.$.resourceTable.selected=e._getSelection("resource",e.selectedResourceIds)),e.$.fireEvent("endUpdate")}clearFilters(e){this._resetFromAction(e,"clearFilters")}clearSort(e){const t=this;"task"!==e&&"resource"!==e?(t._resetFromAction("task","clearSort"),t._resetFromAction("resource","clearSort")):t._resetFromAction(e,"clearSort")}clearTasks(){this._clearTasks()}_clearTasks(){const e=this;e._selected&&delete e._selected.task,e.set("selectedTaskIds",[]),e._tasks=[],e._timelineCells=[],e._timelineVCells=[],e._timelineHeaderCells=[],e.$.timelineContent.style.width="",e.$.container.style.removeProperty("--smart-gantt-chart-task-timeline-content-height"),e.$.timelineViewDetails.innerHTML="",e.$.timelineViewCells.innerHTML="",e.$.taskTimelineCellsContainer.innerHTML="",e.$.timelineConnectionsContainer.innerHTML="",e.$.timelineTasksContainer.innerHTML="",e.$.taskIndicatorsContainer.innerHTML="",e.$.timelineContent.style.height="",delete e._hoveredItem,e.$.taskTable.dataSource=[],e._closeTooltip(),e.closeWindow(),e._refresh()}clearResources(){const e=this;e._unselectAll("resource"),e._resources=[],e.$.resourceTable&&(e.$.resourceTable.dataSource=[]),e.$.resourceTimelineCellsContainer.innerHTML="",e._tasks.forEach((t=>{t.resources=[],e._refreshTableColumnsData(t,["resources"])})),e._refreshTimeline(),e._createResourceTimeline()}createConnection(){const e=this,t=e._tasks;let i,n=Array.from(arguments).filter((e=>void 0!==e));if(!e.isCompleted||0===t.length)return;if(i=1===n.length?(n[0]+"").split("-"):n,!e._getValidConnectionId(i[0],i[1],i[2],"createConnection"))return;const a=parseInt(i[3]);e._connectTask([i[0],i[1],i[2],isNaN(a)?0:a]),e._recycleConnections(),e.$.fireEvent("itemInsert",{type:"connection",item:{source:i[0],target:i[1],type:i[2],lag:a}})}collapse(e){this._handleCollapseExpandMethods(e,"collapse")}expand(e){this._handleCollapseExpandMethods(e,"expand")}exportData(e,t){const i=this;if(!Smart.Utilities.DataExporter)return void i.error(i.localize("missingReference",{elementType:i.nodeName.toLowerCase(),methodName:"exportData",file:"smart.export.js"}));try{new JSZip}catch(e){return void i.error(i.localize("missingReference",{elementType:i.nodeName.toLowerCase(),methodName:"exportData",file:"jszip.min.js"}))}if("pdf"===e&!window.pdfMake)return void i.error(i.localize("missingReference",{elementType:i.nodeName.toLowerCase(),methodName:"exportData",file:"pdfMake.min.js"}));const n="task"===i.dataExport.itemType?i.$.taskTable:i.$.resourceTable;return n?n.exportData(e,i.dataExport.fileName,i.dataExport.exportFiltered,t):void 0}print(){const e=this,t=e.dataExport.fileName;e.dataExport.fileName=null;const i=e.exportData("html"),n=window.open("","","width=800,height=500"),a=n.document.open(),s='<!DOCTYPE html><html><head><meta charset="utf-8" /><title>'+t+"</title></head><body>"+i+"</body></html>";try{a.write(s),a.close(),setTimeout((function(){n.print(),n.close()}),100)}catch(e){}e.dataExport.fileName=t}getConnectionDetails(e){const t=this;if("string"!=typeof e)return;const i=t._getConnectionObjById(e);if(!i)return;const n=i.startTask,a=i.endTask,s={startTask:t._cloneObject(i.startTask),endTask:t._cloneObject(i.endTask),startTaskId:"string"==typeof n.id||"number"==typeof n.id?n.id:n.$.id,endTaskId:"string"==typeof a.id||"number"==typeof a.id?a.id:a.$.id,type:i.type};return void 0!==i.lag&&(s.lag=i.lag),s}getConnections(){const e=this;return e._connections.map((t=>{const i=t.startTask,n=t.endTask;return{id:t.startIndex+"-"+t.endIndex+"-"+t.type,startTask:e._cloneObject(i),endTask:e._cloneObject(n),startIndex:t.startIndex,startTaskId:"string"==typeof i.id||"number"==typeof i.id?i.id:i.$.id,endTaskId:"string"==typeof n.id||"number"==typeof n.id?n.id:n.$.id,endIndex:t.endIndex,type:t.type,lag:t.lag}}))}getState(){const e=this,t=e._getTasksJSON(!0)||[];return{tasks:JSON.parse(JSON.stringify(t)),selectedTaskIds:e.selectedTaskIds.slice(0),resources:JSON.parse(JSON.stringify(e._resources.slice(0))),scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}get tasks(){return this.isReady?this.getTasks():[]}get resources(){return this.isReady?this.getResources():[]}getTask(e){const t=this,i=t._getValidItemAndIndex(e);if(i.item)return t._cloneObject(i.item)}getTasks(){const e=this,t=e._tasks;return e.isReady&&t&&t.length?t.map((t=>e._cloneObject(t))):[]}getResource(e){const t=this,i=t._getValidItemAndIndex(e,"resource");if(i.item)return t._cloneObject(i.item)}getResources(){const e=this,t=e._resources;return e.isReady&&t&&t.length?t.map((t=>e._cloneObject(t))):[]}getItemPath(e){if(!e||void 0===e.type)return;const t="string"==typeof e.type?"task":"resource",i=this._getValidItemAndIndex(e,t);return i.item?i.item.$.id:void 0}getTaskIndex(e){const t=this;return"string"==typeof e?t._getTaskIndexById(e):t._getItemIndex(e,"task")}getTaskProject(e){const t=this;if((e=t._tasks[t._getItemIndex(e,"task")])&&e.$&&e.$.project)return t._cloneObject(e.$.project)}getTaskConnections(e){const t=this._getValidItemAndIndex(e,"task");return t&&t.item?this._getTaskConnections(t.item).taskConnections.map((e=>({target:e.endIndex,type:e.type,lag:e.lag}))):[]}getResourceIndex(e){return this._getItemIndex(e,"resource")}getResourceTasks(e){const t=this._getValidItemAndIndex(e,"resource");if(e=t?t.item:void 0)return this._getTasksAssigned(e)}getSelectedIds(){const e=this,t=e.selectedTaskIds,i=e.selectedResourceIds;return e.disableSelection||!t.length&&!i.length?null:{task:t.slice(),resources:i.slice()}}getSelectedTasks(){return this._getSelectedItems("task")}getSelectedResources(){return this._getSelectedItems("resource")}getWorkingHours(){const e=this.nonworkingHours;let t=[];for(let i=0,n=23;i<n;i+=1)e.indexOf(i)<0&&t.push(i);return t}isWorkingDay(e){return e=new Date(e),!isNaN(e.getTime())&&this.nonworkingDays.indexOf(e.getDay())<0}clearState(){const e=this;e.id?window.localStorage.removeItem("smartGanttChart"+e.id):e.warn(e.localize("noId"))}loadState(e){const t=this;if(!e){if(!t.id)return;e=JSON.parse(window.localStorage.getItem("smartGanttChart"+t.id))}if(!e)return;let i=JSON.stringify(e.tasks),n=JSON.stringify(e.selectedTaskIds),a=JSON.stringify(e.resources);if(i&&(i=JSON.parse(i)),n&&(n=JSON.parse(n)),a&&(a=JSON.parse(a)),t._noChangeEvent=!0,Array.isArray(i)&&(t._createTasks(i),t.set("dataSource",i)),Array.isArray(a)){let e=a;for(let i=0;i<e.length;i++){const e=a[i];let n=t._resources.find((t=>t.id&&t.id.toString()===e.id.toString()))||{};t._setResource(n,e),Object.values(n).length&&!t._resources.includes(n)&&t._resources.push(n)}t._refreshItemIds("resource")}"number"==typeof e.scrollLeft&&(t.scrollLeft=e.scrollLeft),"number"==typeof e.scrollTop&&(t.scrollTop=e.scrollTop),t._setTable(t.$.taskTable),t._createTimeline(),t._createResourceTimeline(),Array.isArray(n)&&(t.$.taskTable.selected=t._getSelection("task",n)),delete t._noChangeEvent}saveState(){const e=this;e.id?window.localStorage.setItem("smartGanttChart"+e.id,JSON.stringify(e.getState())):e.warn(e.localize("noId"))}insertTask(e,t,i){const n=this;if("object"!=typeof e)return void n.error(n.localize("incorrectArgument",{elementType:n.nodeName.toLowerCase(),methodName:"insertTask",argumentName:"newTask"}));const a=n._tasks;if(a.indexOf(e)>-1)return void n.error(n.localize("alreadyExists",{elementType:n.nodeName.toLowerCase(),methodName:"insertTask"}));const s=n._createTasks([e],!0);if(!a)return;let r,o,l;const d=n._getSelection("task",n.selectedTaskIds);if("string"==typeof i&&i.indexOf(!1)){const e=i.split(".");i=parseInt(e.slice(-1)),null==t&&(t=e.slice(0,-1).join("."))}if("string"==typeof t?(r=a.find((e=>e.id&&e.id.toString()===t)),r||(r=n._getItemByTableId("task",t))):"number"==typeof t&&(r=a[t]),r){if("project"!==r.type)return void n.error(n.localize("notAProject",{elementType:n.nodeName.toLowerCase(),argumentName:"project",methodName:"insertTask"}));s[0].$.project=r}return n._synchronizeProjectVisibility(s[0].$.project,s[0]),n._insertTasks(s,r,i),n._refreshItemIds(),n._refreshConnectionIds(),n._isUpdating?(n._isUpdating.type.task=!0,void(n._isUpdating.type.resource=!0)):(n._selected&&n._selected.task&&n._setSelection("task",l=n._selected.task.map((e=>e.$.id))),n._refreshTableDataSource(),n._refreshTimeline(),l&&d.toString()!==l.toString()&&(n.$.taskTable.selected=l.slice(0)),n._refreshTaskResources(o),n._ensureVisible(o),n.$.fireEvent("itemInsert",{type:"task",item:n._cloneObject(s[0])}),s[0].id||s[0].$.id+"")}openWindow(e){const t=this;if(t.disableWindowEditor)return;if("string"==typeof e){if(e.indexOf(".")>-1){const i=t._getVCellById("task",e),n=i?i.task:void 0;return void(n&&t._openPopupWindow(n))}if(e.indexOf("-")>-1){let e=(arguments[0]+"").split("-");if(e=t._getValidConnectionId(e[0],e[1],e[2],"openEditor"),e)return void t._openPopupWindow(e)}}const i=t._getValidItemAndIndex(e);i&&t._openPopupWindow(i.item)}closeWindow(){const e=this,t=["confirm","task","connection"];for(let i=0;i<t.length;i++){const n=e.$[t[i]+"PopupWindow"];n&&(n.close(),delete n._target)}}updateTask(e,t){const i=this,n=i._getValidItemAndIndex(e),a=n?n.item:void 0;"object"==typeof a?"object"==typeof t?i._updateTask(a,t):i.error(i.localize("incorrectArgument",{elementType:i.nodeName.toLowerCase(),methodName:"updateTask",argumentName:"taskDetails"})):i.error(i.localize("notExisting",{elementType:i.nodeName.toLowerCase(),methodName:"updateTask",argumentName:"newTask"}))}removeTask(e){const t=this,i=t._tasks,n=t._getValidItemAndIndex(e),a=n?n.item:void 0;i&&i.length&&("object"==typeof a?t._removeTask(a):t.error(t.localize("notExisting",{elementType:t.nodeName.toLowerCase(),methodName:"removeTask",argumentName:"index"})))}setWorkTime(e){this._setWorkTime(e,(function(e,t){for(let i=0,n=e.length;i<n;i+=1){const n=parseInt(e[i]),a=t.indexOf(n);a>-1&&t.splice(a,1)}return t}))}selectTask(e){this._handleItemSelection(e,"task")}selectResource(e){const t=this;t.$.mainSplitter.contains(t.$.resourceTable)&&t._handleItemSelection(e,"resource")}sort(e){const t=this;if("none"===t.sortMode)return;Array.isArray(e)||(e="object"==typeof e?[e]:[]);const i=t.taskColumns,n=t.resourceColumns,a=t.$.taskTable,s=t.$.resourceTable;for(let t=0;t<e.length;t++){const r=e[t],o="desc"===r.sortOrder?"desc":"asc",[l,d]="resource"===r.type||n.includes(r)?[s,n]:[a,i],c=d.find((e=>r.value&&e.value===r.value));c&&l.sortBy(c.value,o)}}unselectTask(e){this._handleItemSelection(e,"task",!0)}unselectResource(e){const t=this;t.$.mainSplitter.contains(t.$.resourceTable)&&t._handleItemSelection(e,"resource",!0)}unsetWorkTime(e){this._setWorkTime(e,(function(e,t){for(let i=0,n=e.length;i<n;i+=1){const n=parseInt(e[i]);t.indexOf(n)<0&&t.push(n)}return t}),!0)}hideTooltip(){this._closeTooltip()}showTooltip(e,t){this._openTooltip(e,void 0,t)}_getSelectedItems(e="task"){const t=this,i=t[`_${e}s`],n=t._getSelection(e,"task"===e?t.selectedTaskIds:t.selectedResourceIds);if(!n.length)return[];let a=[];for(let e=0,s=i.length;e<s;e+=1){const s=i[e];n.indexOf(s.$.id)>-1&&a.push(t._cloneObject(s))}return a}_getTasksAssigned(e){const t=this,i=t._tasks||[];let n=[];for(let a=0;a<i.length;a++){const s=i[a];!s.disableResources&&s.resources.find((t=>t===e.id))&&n.push(t._cloneObject(s))}return n}_getItemIndex(e,t){t||(t="task");const i=this[`_${t}s`];if(e instanceof HTMLElement&&e.classList.contains("smart-timeline-task"))return i.indexOf(e._cellObj[`_${t}`]);const n="resource"===t?["id","label","value","progress"]:["id","label","type","class","dateStart","dateEnd","resources","connections"];if("object"==typeof e)for(let t=0;t<i.length;t++)if(n.every((n=>Array.isArray(e[n])?JSON.stringify(e[n])===JSON.stringify(i[t][n]):n.indexOf("date")>-1?new Date(e[n]).getTime()===new Date(i[t][n]).getTime():e[n]===i[t][n])))return i.indexOf(i[t]);return-1}_handleItemSelection(e,t="task",i){const n=this,a=n._getValidItemAndIndex(e,t);if(a.item){const s=a.item,r=n._getSelection(t,"task"===t?n.selectedTaskIds:n.selectedResourceIds);if(e=s.$.id,i){const i=r.indexOf(e);i>-1&&(r.splice(i,1),n.$[`${t}Table`].selected=r)}else r.indexOf(e)<0&&(r.push(e),n.$[`${t}Table`].selected=r);return"string"==typeof s.id||"number"==typeof s.id?s.id:s.$.id}}_refreshAfterWorkingTimeChange(){const e=this;if(e.adjustToNonworkingTime)for(let t=0;t<e._tasks.length;t++){const i=e._tasks[t],n=i.$.project;e._validateTaskDates(i,n),e._synchronizeProjectDates(i,n),e._refreshTableColumnsData(i,["dateEnd","duration"])}e._refreshTimeline()}_refreshItemIds(e="task"){const t=this[`_${e}s`];if(!t)return;let i={},n=0;for(let e=0,a=t.length;e<a;e+=1){const a=t[e],s=a.$.project;if(void 0!==s){const e=s.$.id;i[e]||(i[e]=0),a.$.id=e+"."+i[e],i[e]++}else a.$.id=n+"",n++}}_refreshConnectionIds(){const e=this._tasks,t=this._connections;if(t&&t.length)for(let i=0,n=t.length;i<n;i+=1){const a=t[i],s=e.indexOf(a.startTask),r=e.indexOf(a.endTask);(s<0||r<0)&&(t.splice(i,1),n--),a.startIndex=s,a.endIndex=r}}_refreshSelectedItems(e="task",t){const i=this,n=i[`_${e}s`];if(n&&(!t&&i._selected&&i._selected[e]&&(t=i._selected[e]),t)){for(let e=0,i=t.length;e<i;e+=1){const a=t[e];(n.indexOf(a)<0||a.hidden)&&(t.splice(e,1),e-=1,i--)}i._setSelection(e,t.map((e=>e.$.id)))}}_resetFromAction(e="task",t="clearSort"){const i=this;function n(){i.$.taskTable[t](),i._createTimelineContent(),i._recycleTimelineTasks()}function a(){const e=i.$.resourceTable;e&&(e[t](),i._createResourceTimelineVCells(),i._recycleResourceContent())}"resource"===e?a():"task"===e?n():(n(),a())}_setWorkTime(e,t,i){const n=this;if("object"!=typeof e)return;let a,s=e.days,r=e.hours;null!=s&&(Array.isArray(s)||(s=[s]),s=n._nonworkingDayValidator(void 0,s),a=t(s,i?n.nonworkingDays:[0,1,2,3,4,5,6]),n.set("nonworkingDays",7===a.length?[]:a),n._refreshAfterWorkingTimeChange()),null!=r&&(Array.isArray(r)||(r=[r]),r=n._nonworkingTimeValidator(void 0,r),a=t(r,i?n.nonworkingHours:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),n.set("nonworkingHours",24===a.length?[]:a),n._refreshAfterWorkingTimeChange())}_getValidConnectionId(e,t,i,n){const a=this,s=a._tasks,r=0===n.indexOf("_");let o;if("string"==typeof e&&(o=a._getTaskIndexById(e),o>=0&&(e=o)),"string"==typeof t&&(o=a._getTaskIndexById(t),o>=0&&(t=o)),e=parseInt(e),t=parseInt(t),i=parseInt(i),isNaN(e)||isNaN(t)||e===t)r||a.error(a.localize("incorrectArgument",{elementType:a.nodeName.toLowerCase(),methodName:n,argumentName:"taskIndex"}));else if(e>=s.length||e<0||t>=s.length||t<0)r||a.error(a.localize("outOfBounds",{elementType:a.nodeName.toLowerCase(),methodName:n,argumentName:"taskIndex"}));else{if(!(isNaN(i)||i<0||i>3))return r?[e,t,i]:e+"-"+t+"-"+i;r||a.error(a.localize("incorrectArgument",{elementType:a.nodeName.toLowerCase(),methodName:n,argumentName:"connectionType"}))}}_autoSchedule(e){const t=this,i=t._tasks;if(t.autoSchedule){e?Array.isArray(e)||(e=[e]):e=i;for(let i=0;i<e.length;i++){const n=e[i];"project"===n.type&&n.synchronized||(n.minDateStart=n.minDateEnd=void 0,t._autoScheduleTasks(n))}t._isUpdateRequired&&(t._createTimelineCells(),t._recycleTimelineTasks(!0),delete t._isUpdateRequired)}}_getTaskConnections(e){const t=this._tasks,i=this._connections;let n=[],a=[];if(t&&t.length&&i&&i.length){const s=t.indexOf(e);for(let e=0;e<i.length;e+=1){const t=i[e];t.startIndex===s?n.push(t):t.endIndex===s&&a.push(t)}}return{taskConnections:n,connectedTasks:a}}_autoScheduleTasks(e){const t=this,i=t._tasks,n=t._getTaskConnections(e),a=n.taskConnections,s=n.connectedTasks;let r,o,l;for(let n=0;n<a.length;n++)t._isAutoScheduled(e,i[a[n].endIndex],!0);for(let n=0;n<s.length;n++){const a=s[n],d=i[a.startIndex],c=a.type,m=a.lag,u=e.$.project;d&&"project"===d.type&&d.synchronized||(0===c||1===c?(l=new Date((0===c?d.dateStart:d.dateEnd).getTime()+m),e.minDateStart=new Date(e.minDateStart?Math.max(e.minDateStart.getTime(),l.getTime()):l),o=e.minDateStart.getTime()-e.dateStart.getTime(),r=new Date(e.dateEnd.getTime()+(t.autoScheduleStrictMode?o:Math.max(0,o))),r.getTime()!==e.dateEnd.getTime()&&(e.dateEnd=r,t._isUpdateRequired=!0),t.autoScheduleStrictMode&&e.minDateStart.getTime()!==e.dateStart.getTime()&&(e.dateStart=e.minDateStart,t._isUpdateRequired=!0)):(l=new Date((2===c?d.dateEnd:d.dateStart).getTime()+m),e.minDateEnd=new Date(e.minDateEnd?Math.min(e.minDateEnd.getTime(),l.getTime()):l),o=e.minDateEnd.getTime()-e.dateEnd.getTime(),r=new Date(e.dateStart.getTime()+(t.autoScheduleStrictMode?o:Math.max(0,o))),r.getTime()!==e.dateStart.getTime()&&(e.dateStart=r,t._isUpdateRequired=!0),t.autoScheduleStrictMode&&e.minDateEnd.getTime()!==e.dateEnd.getTime()&&(e.dateEnd=e.minDateEnd,t._isUpdateRequired=!0)),t._validateTaskDates(e,u),t._synchronizeProjectDates(e,u))}for(let e=0;e<a.length;e++){const n=i[a[e].endIndex];!n||"project"===n.type&&n.synchronized||(n.minDateStart=n.minDateEnd=void 0,t._autoScheduleTasks(n))}}_autoScheduleRestore(e,t){const i=this._tasks;e||(e=i),Array.isArray(e)||(e=[e]);for(let n=0;n<e.length;n++){const a=e[n];i.indexOf(e[n])>-1&&(t?0===t||1===t?a.minDateStart=void 0:a.minDateEnd=void 0:a.minDateStart=a.minDateEnd=void 0)}}_autoScroll(e){const t=this,i=t.hasAttribute("dragged"),n=t.hasAttribute("resized");function a(a,s){if(!t._dragDetails)return clearInterval(t._scrollInterval),t._scrollInterval=void 0,void delete t._autoScrolling;t._autoScrolling=!0,s?i||(t.scrollTop-=t.autoScrollStep*a,t._dragDetails.coordinates.y+=t.autoScrollStep*a):(t.scrollLeft-=(t.rightToLeft?-1:1)*t.autoScrollStep*a,t._dragDetails.coordinates.x+=t.autoScrollStep*a),i?t._handleTaskBarDrag(e):n&&t._handleTaskBarResize(e)}if(t.disableAutoScroll||!e||!i&&!n&&!t.hasAttribute("connecting-task"))return;const s=t.$.timeline.getBoundingClientRect();t._scrollInterval&&clearInterval(t._scrollInterval),t._scrollInterval=setInterval((function(){(t.scrollLeft||t.rightToLeft)&&e.clientX<=s.left+20?a(1):t.scrollLeft!==(t.rightToLeft?0:t.scrollWidth)&&e.clientX>=s.left+s.width-20?a(-1):t.scrollTop&&e.clientY<=s.top+20?a(1,!0):t.scrollTop!==t.scrollHeight&&e.clientY>=s.top+s.height-20?a(-1,!0):(clearInterval(t._scrollInterval),t._scrollInterval=void 0,delete t._autoScrolling)}),1)}_checkTaskBarResizability(e){const t=this;let i=e.originalEvent.target;t.shadowRoot&&i===t&&(i=e.originalEvent.composedPath()[0]);const n=t.$.timeline;if(!i.closest)return void n.removeAttribute("task-bar-hovered");let a,s=i.closest(".smart-timeline-row")||i.closest(".smart-timeline-task");if(t.disabled||t.disableTaskResize||!s||!n.contains(s))return void n.removeAttribute("task-bar-hovered");const r=s._cellObj.task,o=t._getTaskDOMIndex(r);if(s.classList.contains("smart-timeline-row")?a=t.$.timelineTasksContainer.children[o]:s.classList.contains("smart-timeline-task")&&(a=s,s=t.$.taskTimelineCellsContainer.children[o]),!a||a.classList.contains("milestone")||r.synchronized||r.disableResize)return;const l=i.closest(".smart-task-segment"),d=r.segments?r.segments.length:1;if(i.classList&&i.classList.contains("smart-task-connection-point")||l&&(d>1&&t.disableSegmentResize||l._segmentObj&&l._segmentObj.disableResize))return void n.removeAttribute("task-bar-hovered");const c=e.pageX-window.pageXOffset,m="visible"===t.resizeHandlesVisibility||t._isMobile?20:5,u=(l||a).getBoundingClientRect(),h=s.getBoundingClientRect(),g=Math.min(m,c-h.left),f=Math.min(m,h.left+h.width-c);Math.round(u.left)+g>=c&&Math.round(u.left)-g<=c?n.setAttribute("task-bar-hovered","left"):Math.round(u.left+u.width)+f>=c&&Math.round(u.left+u.width)-f<=c?n.setAttribute("task-bar-hovered","right"):n.removeAttribute("task-bar-hovered")}_onShadowDomLoaded(e,t,i){requestAnimationFrame((function n(){const a=(e.shadowRoot||e.getRootNode()).querySelectorAll("link");for(let e=0;e<a.length;e++)if(-1!==a[e].href.indexOf(t))return void i();requestAnimationFrame(n)}))}_getConnectionObjById(e){const t=this._connections;if(!e||!t||!t.length)return;const i=e.split("-"),n=parseInt(i[0]),a=parseInt(i[1]),s=parseInt(i[2]);for(let e=0,i=t.length;e<i;e+=1){const i=t[e];if(i.startIndex===n&&i.endIndex===a&&i.type===s)return i}}_positionWindow(){const e=this,t=e.getShadowRootOrBody(),i=[e.$.taskPopupWindow,e.$.connectionPopupWindow,e.$.confirmPopupWindow];for(let n=0;n<i.length;n++){const a=i[n];if(!a||!t.contains(a))continue;const s=e.getBoundingClientRect();a.opened||(a.style.left=a.style.top=""),e._isMobile?(a.setAttribute("mobile",""),a.style.left=s.left+window.pageXOffset+"px",a.style.top=s.top+window.pageYOffset+"px",a.style.width=s.width+"px",a.style.height=s.height+"px"):(a.style.left=Math.max(s.left+window.pageXOffset,s.left+window.pageXOffset+s.width/2-a.offsetWidth/2)+"px",a.style.top=Math.max(s.top+window.pageYOffset,s.top+window.pageYOffset+s.height/2-a.offsetHeight/2)+"px")}}_openPopupWindow(e,t){const i=this;function n(){function t(){i._positionWindow(),s.opened?(s.bringToFront(),s._onOpenCallback?s._onOpenCallback():s._handleActiveState()):s.open()}if(i.popupWindowCustomizationFunction?i.popupWindowCustomizationFunction(s,a,"connection"===a?e.startIndex+"-"+e.endIndex+"-"+e.type:i._cloneObject(e)):s._onOpenCallback=()=>{const e=(s.shadowRoot||s).querySelectorAll(".smart-gantt-chart-popup-window-editor .smart-input, .smart-popup-window-button");(e[0]||e[1]||s).focus({preventScroll:!0}),s._handleActiveState()},i._setPopupWindowTemplate("header",a,e),i._setPopupWindowTemplate("footer",a,e),i._setPopupWindowTemplate("content",a,e),!i._popupWindow[a+"PopupWindow"]){const e=i["$"+a+"PopupWindow"];e.unlisten("transitionend"),e.unlisten("open"),e.unlisten("close"),e.unlisten("closing"),e.unlisten("click"),e.unlisten("change"),e.listen("transitionend",i._popupWindowTransitionendHandler.bind(i)),e.listen("open",i._popupWindowOpenHandler.bind(i)),e.listen("close",i._popupWindowCloseHandler.bind(i)),e.listen("closing",i._popupWindowClosingHandler.bind(i)),e.listen("click",i._popupWindowClickHandler.bind(i)),e.listen("change",i._popupWindowChangeHandler.bind(i))}s.shadowRoot?(s.importStyle(Smart.Utilities.Core.getScriptLocation()+Smart.StyleBaseUrl.replace("/scoped/","/smart.textbox.css")),i._onShadowDomLoaded(s,"smart.window.css",t)):t();const n=(i.getAttribute("aria-owns")||"")+" "+s.id;i.setAttribute("aria-owns",n.trim()),i._popupWindow[a+"PopupWindow"]=s}if(e&&e.classList)if(e.classList.contains("smart-task-connection"))e=i._getConnectionObjById(e.getAttribute("connection-id"));else if("TR"===e.nodeType){const t=e?"task":"resource",n=i._getVCellById(t,e.getAttribute("row-id"));e=n?n[t]:void 0}else e=e._cellObj.task;if(!e||e.isGroup)return;const a=t?"confirm":"string"==typeof e.type?"task":"connection",s=i._createPopupWindow(a);!t&&i.$.fireEvent("opening",{target:s,type:a}).defaultPrevented||(i._closeTooltip(),s._target=e,i._popupWindow||(i._popupWindow={}),s.parentElement||i.getShadowRootOrBody().appendChild(s),s.isCompleted?n():s.whenReady((()=>n())))}_createPopupWindow(e){const t=this,i=e+"PopupWindow";if(t.$[i])return t.$[i];const n=document.createElement("smart-window");return n.classList.add("smart-"+e+"-popup-window"),n.classList.add("smart-gantt-chart-popup-window"),n.setAttribute("smart-id",i),t.$[i]=n,t["$"+i]=Smart.Utilities.Extend(n),n.rightToLeft=t.rightToLeft,n.theme=t.theme,n.animation=t.animation,n.disableSnap=!0,n.headerButtons=["close"],n}_popupWindowOpenHandler(e){const t=this,i=t["$"+e.target.getAttribute("smart-id")];if(i){const n=e.target.classList.contains("smart-confirm-popup-window")?"confirm":e.target.classList.contains("smart-connection-popup-window")?"connection":"task";t._handleModal(!0),t.$.fireEvent(e.type,Object.assign({type:n,target:e.target},e.detail)),i.unlisten("open")}}_popupWindowClosingHandler(e){const t=this["$"+e.target.getAttribute("smart-id")];if(!t)return;const i=e.target.classList.contains("smart-confirm-popup-window")?"confirm":e.target.classList.contains("smart-connection-popup-window")?"connection":"task";this.$.fireEvent(e.type,{target:e.target,type:i}).defaultPrevented?e.preventDefault():t.unlisten(e.type)}_popupWindowCloseHandler(e){const t=this,i=e.target.getAttribute("smart-id"),n=t["$"+i];if(n){const a=e.target.classList.contains("smart-confirm-popup-window")?"confirm":e.target.classList.contains("smart-connection-popup-window")?"connection":"task";if(t._handleModal(),t.$.fireEvent(e.type,Object.assign({type:a,target:e.target},e.detail)),n.unlisten("close"),n.unlisten("click"),t.hasAttribute("aria-owns")){const e=t.getAttribute("aria-owns").replace(t._popupWindow[i].id,"").trim();e?t.setAttribute("aria-owns",e):t.removeAttribute("aria-owns")}delete t._popupWindow[i];const s=Object.keys(t._popupWindow);1===s.length&&t._popupWindow.confirmPopupWindow&&(delete t._popupWindow.confirmPopupWindow._target,t._popupWindow.confirmPopupWindow.close()),s.length?requestAnimationFrame((()=>{const e=t._popupWindow[s[s.length-1]];e&&e.focus()})):t.keyboardNavigation&&t.$.taskTable.focus({preventScroll:!0})}}_popupWindowTransitionendHandler(e){const t=this,i=e.target;i instanceof Smart.Window&&!i.opened&&"visibility"===e.propertyName&&(t["$"+i.getAttribute("smart-id")].unlisten("transitionend"),i.parentElement&&i.parentElement.removeChild(i))}_handleModal(e){const t=this;let i=(t.shadowRoot||t).querySelector(".smart-popup-window-modal");e?(i||(i=document.createElement("div"),i.classList.add("smart-popup-window-modal")),i.parentElement||(t.$.container.appendChild(i),t.setAttribute("modal",""))):i&&i.parentElement&&Object.keys(t._popupWindow).length<2&&(i.parentElement.removeChild(i),t.removeAttribute("modal"))}_findTaskEditor(e,t){if(!e||!t)return;const i=t.children;for(let t=0,n=i.length;t<n;t+=1){const n=i[t];if(n.getAttribute("value")===e)return n}}_createTaskEditor(e,t,i){const n=this,a=e.value,s=t[e.value];let r,o,l=i.find((e=>e._label===a));if(l)r=l.querySelector(".smart-gantt-chart-label-container"),o=l.lastElementChild;else{const t="editorLabel"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);if(r=document.createElement("div"),r.classList.add("smart-gantt-chart-label-container"),r.innerHTML=`<label id="${t}"></label>`,"deadline"===a){const e=document.createElement("span");e.classList.add("smart-popup-window-editor-toggle"),r.appendChild(e)}if(l=document.createElement("div"),l.classList.add("smart-gantt-chart-popup-window-editor"),l.setAttribute("value",a||""),l._label=a,e.customEditor)return l.appendChild(e.customEditor(a,s)),l;if("number"==typeof s||"string"==typeof s)o=document.createElement("input"),o.classList.add("smart-input");else if(s instanceof Date||"deadline"===a)Smart.DateTimePicker?(o=document.createElement("smart-date-time-picker"),o.locale=n.locale,o.dropDownAppendTo="body",o.calendarButton=!0,o.dropDownDisplayMode="auto",o.enableMouseWheelAction=!0,o.formatString="yyyy-MMM-dd HH:mm:ss"):(o=document.createElement("input"),o.type="datetime-local");else if(Array.isArray(s))if(Smart.DropDownList)o=document.createElement("smart-drop-down-list"),o.virtualized=!0,o.dropDownAppendTo="body",o.selectionMode="zeroOrMany";else{o=document.createElement("input"),o.classList.add("smart-input");const e=document.createElement("datalist");e.id="resourceList",o.setAttribute("list",e.id),l.appendChild(e)}o&&o.setAttribute("aria-labelledby",t)}if(!l.parentElement)return r&&l.appendChild(r),o&&l.appendChild(o),l;n._setPopupWindowEditors(e,t,l)}_setAriaControls(){this.setAttribute("role","treegrid")}_setPopupWindowEditors(e,t,i){const n=this,a=i.querySelector("label"),s=i.querySelector(".smart-popup-window-editor-toggle"),r=i.lastElementChild,o=e.value+"",l=o.split(/(?=[A-Z])/).join(" "),d=t[o];if(e.customEditor)e.setCustomEditorValue&&e.setCustomEditorValue(i,l,d);else{if(a.innerHTML=n.localize(e.value)||l.charAt(0).toUpperCase()+l.slice(1),s)if("deadline"===o){const e=null==d?"add":"remove";r.classList[e]("smart-hidden"),s.textContent=n.localize(e)}else s.remove();if("number"==typeof d)r.value=parseFloat(d);else if("string"==typeof d)r.value=d;else if(d instanceof Date)r.value=new Date(d);else if(Array.isArray(d)){const e=n._resources;if(r.placeholder=n.localize("unassigned"),Smart.DropDownList&&r instanceof Smart.DropDownList)r.dataSource=e.map((e=>({label:e.label,value:e.id}))),r.selectedValues=t.disableResources?[]:t.resources.map((e=>e.toString()));else{let n=i.querySelector("datalist"),a=document.createDocumentFragment();n.innerHTML="";for(let t=0;t<e.length;t++){const i=e[t],n=document.createElement("option");n.value=i.id,n.innerHTML=i.label,a.appendChild(n)}r.value=t.resources.toString(),n.appendChild(a)}}"project"===t.type&&t.synchronized&&["duration","date"].indexOf(l.toLowerCase())>-1||"resources"===l&&t.disableResources?r.disabled=!0:r.disabled=!!e.disableEdit,r.rightToLeft=n.rightToLeft,r.animation=n.animation,r.theme=n.theme}}_setupPopupWindowTabs(e,t){const i=this,n=i.popupWindowTabs,a="milestone"===t.type,s=[{label:i.localize("generalTab"),value:"general"},{label:i.localize("dependencyTab"),value:"dependency"},{label:i.localize("segmentsTab"),value:"segments"}];let r=e.querySelector(".smart-gantt-chart-popup-window-tabs");r||(r=document.createElement("smart-tabs"),r.classList.add("smart-gantt-chart-popup-window-tabs"),e.clear(),e.appendChild(r)),r.animation=i.animation,r.rightToLeft=i.rightToLeft,r.theme=i.theme;const o=r.getTabs().slice(0);for(let e=0,t=s.length;e<t;e+=1){const t=s[e],i=t.value;let l=o[e];n.indexOf(i)<0?l&&r.removeChild(l):(l||(l=document.createElement("smart-tab-item"),r.appendChild(l)),l.label=t.label,l.setAttribute("value",i||""),l.disabled=a&&"segments"===i)}return r}_setPopupWindowContent(e,t){const i=this,n=i.$[e+"PopupWindow"],a=[].slice.call(n.querySelectorAll(".smart-gantt-chart-popup-window-editor"));if(n.content&&(!n.content.innerHTML||a.length))if("task"===e&&t){const e=i.taskColumns;let s=[];const r=i._setupPopupWindowTabs(n,t);0!==r.selectedIndex&&(r.selectedIndex=0);const o=r.getTabs()[0];if("general"!==o.getAttribute("value"))return void i._handleTabsContent(o,n);"string"==typeof o.content?o.content="":o.content.innerHTML="";for(let n=0;n<e.length;n++){const r=e[n],l=r.value;if(void 0===t[l]&&"deadline"!==l||"overdue"===l)continue;let d=i._findTaskEditor(l,o);d||(d=i._createTaskEditor(r,t,a),d&&o.appendChild(d)),d&&(i._setPopupWindowEditors(r,t,d),s.push(d))}for(let e=0,t=a.length;e<t;e+=1){const t=a[e];s.indexOf(t)<0&&t.remove()}t.id&&n.setAttribute("aria-controls",t.id)}else if("confirm"===e){if(n.innerHTML='<div class="smart-gantt-chart-popup-window-editor">'+i.localize("confirm",{componentName:"The task"})+"</div >",i._popupWindow){const e=Object.keys(i._popupWindow);e.length&&n.setAttribute("aria-controls",i._popupWindow[e[e.length-1]].id)}}else{const e=t.startTask,a=t.endTask;n.innerHTML='<div class="smart-gantt-chart-popup-window-editor">'+i.localize("deleteLink")+"<b> "+e.label+" - "+a.label+"?</b></div>"}}_setPopupWindowTemplate(e,t,i){const n=this,a=n.$[t+"PopupWindow"];if("content"!==e){if(a[e+"Template"]||(a[e+"Template"]=n._createPopupWindowTemplate(e,t)),"header"===e&&i&&"string"==typeof i.type){const e=(a.shadowRoot||a).querySelector(".smart-popup-window-label");e&&(e.innerHTML=i.label)}else if("footer"===e){const e=(a.shadowRoot||a).querySelectorAll(".smart-popup-window-button");for(let i=0;i<e.length;i++){const a=e[i];a.innerHTML="task"===t?'<span class="smart-icon"></span>':"",a.theme=n.theme,a.rightToLeft=n.rightToLeft,a.animation=n.animation,a.disabled=!1,a.classList.contains("ok")?(a.innerHTML+=n.localize("ok"),a.setAttribute("aria-label","ok")):a.classList.contains("cancel")?(a.innerHTML+=n.localize("cancel"),a.setAttribute("aria-label","cancel")):a.classList.contains("delete")&&(a.innerHTML+=n.localize("delete"),a.setAttribute("aria-label","delete"));const s=a.querySelector(".smart-ripple");s&&s.parentElement.removeChild(s)}}}else n._setPopupWindowContent(t,i)}_createPopupWindowTemplate(e,t){const i=this,n=document.createElement("template");if("footer"===e)switch(t){case"task":n.innerHTML=`<smart-button class="smart-popup-window-button ok primary"\n animation="${i.animation}" theme="${i.theme}" ${i.rightToLeft?"right-to-left":""}>\n </smart-button>\n <smart-button class="smart-popup-window-button cancel"\n animation="${i.animation}" theme="${i.theme}" ${i.rightToLeft?"right-to-left":""}>\n </smart-button>\n <smart-button class="smart-popup-window-button delete secondary"\n animation="${i.animation}" theme="${i.theme}" ${i.rightToLeft?"right-to-left":""}>\n </smart-button>`;break;case"connection":case"confirm":n.innerHTML=`<smart-button class="smart-popup-window-button ok primary"\n animation="${i.animation}" theme="${i.theme}" ${i.rightToLeft?"right-to-left":""}>\n </smart-button>\n <smart-button class="smart-popup-window-button cancel"\n animation="${i.animation}" theme="${i.theme}" ${i.rightToLeft?"right-to-left":""}>\n </smart-button>`}else"header"!==e||"task"!==t&&"confirm"!==t||(n.innerHTML='<span class="smart-popup-window-label"></span>');return n}_handleTabsContent(e,t){const i=this,n=t._target;if(!e|!n)return;const a=e.getAttribute("value");if("general"===a)return;let s=e.querySelector(".smart-gantt-popup-window-table"),r=e.querySelector(".smart-gantt-window-table-buttons"),o=e.querySelector(".smart-gantt-window-validation-message");r||(r=document.createElement("div"),r.classList.add("smart-gantt-window-table-buttons"),r.innerHTML=`<smart-button class="smart-gantt-chart-button" action="add">${i.localize("add")}</smart-button>\n <smart-button class="smart-gantt-chart-button" disabled action="delete">${i.localize("delete")}</smart-button>`,e.insertBefore(r,s)),s||(s=document.createElement("smart-table"),s.classList.add("smart-gantt-popup-window-table"),s.editing=!0,s.editMode="row",s.keyboardNavigation=!0,s.wait=!0,s.hideSelectionColumn=!0,s.selection=!0,s.selectionMode="one",s.columnMinWidth="10px",s.addEventListener("rowEndEdit",(r=>{const o=r.detail.row;switch(a){case"dependency":{const e=i._tasks,t=o.name,a=e.indexOf(n),r=e.findIndex((e=>e.$.id===t));r>-1&&s.updateRow(o.$.id,{id:`${r}-${a}-${o.type}`});break}case"segments":{const e=o.dateStart,t=o.dateEnd;e.getTime&&t.getTime&&s.updateRow(o.$.id,{duration:parseFloat(i._convertDuration(i.nonworkingDays.length>0||i.nonworkingHours.length>0?i._getWorkingTime(e,t):t.getTime()-e.getTime(),!0).toFixed(2))});break}}i._applyTableValidation(e,s,t),i._isPopupWindowTableModified=!0})),e.innerHTML&&(e.innerHTML=""),e.appendChild(s));const l=i._getTabsTableData(a,n);s.selected.length&&(s.selected=[]),s.dataSource=l.source,s.columns=l.columns,s.wait=!1,delete i._isPopupWindowTableModified,o||(o=document.createElement("label"),o.classList.add("smart-gantt-window-validation-message"),e.appendChild(o)),o.textContent=""}_applyTableValidation(e,t,i){const n=this,a=e.getAttribute("value"),s=e.querySelector(".smart-gantt-window-validation-message"),r=i.querySelector(".smart-popup-window-button.ok"),o=t.dataSource,l=o.length;if(!s)return void(r&&(r.disabled=!1));if(!l)return s.textContent="",void(r&&(r.disabled=!1));let d="";if("segments"===a)if(l<2)d=n.localize("segmentsCountValidation");else{const e=i._target,t=e.dateStart.getTime(),a=e.dateEnd.getTime();let s={};for(let e=0;e<l;e+=1){const i=o[e],r=i.label,l=i.dateStart.getTime(),c=i.dateEnd.getTime();for(let e in s){const t=s[e],a=t.timeStart,r=t.timeEnd,o=l<=a&&c>=a,m=l<=r&&c>=r;(o||m)&&(d+=n.localize("segmentConflictError",{dateConflict:o?"dateStart":"dateEnd",label:i.label,conflictLabel:t.label})+"\r\n")}l>c?d+=n.localize("segmentStartError",{label:i.label})+"\r\n":l===c&&(d+=n.localize("segmentEndError",{label:i.label})+"\r\n"),(l<t||c>a)&&(d+=n.localize("segmentRangeError",{label:i.label})+"\r\n"),void 0===s[e]&&(s[e]={label:r,timeStart:l,timeEnd:c})}}else if("dependency"===a)for(let e=0;e<l;e+=1){const t=o[e].id.split("-");t[0]===t[1]&&(d+=n.localize("dependencyValidation")+"\r\n")}s.textContent=d,r&&(r.disabled=d.length>0)}_getTabsTableData(e,t){const i=this;if("dependency"===e){const e=i._getTaskConnections(t).connectedTasks,n={connectionTypes:[{label:i.localize("startToStart"),value:0},{label:i.localize("endToStart"),value:1},{label:i.localize("endToEnd"),value:2},{label:i.localize("startToEnd"),value:3}],tasks:(()=>{const e=i._tasks;let n=[];for(let i=0,a=e.length;i<a;i+=1){const a=e[i];a!==t&&n.push({value:a.$.id,label:a.label})}return n})()};return{source:new window.Smart.DataAdapter({dataSource:e&&e.length?e.map((e=>({id:e.startIndex+"-"+e.endIndex+"-"+e.type,name:e.startTask.$.id||"",type:e.type,lag:e.lag||0}))):[],dataFields:["id: any","name: any","type: number","lag: number"]}),columns:[{label:i.localize("id"),dataField:"id",dataType:"any",autoWidth:!1,allowEdit:!1},{label:i.localize("name"),dataField:"name",dataType:"any",width:"35%",autoWidth:!1,editor:i._getColumnEditorSetup("name",n),formatFunction:e=>{const t=n.tasks.find((t=>t.value===e.value));t&&(e.value=t.label)}},{label:i.localize("type"),dataField:"type",dataType:"number",width:"25%",autoWidth:!1,editor:i._getColumnEditorSetup("type",n),formatFunction:e=>{const t=n.connectionTypes.find((t=>t.value===e.value));t&&(e.value=t.label)}},{label:i.localize("lag"),dataField:"lag",dataType:"number",autoWidth:!1}]}}if("segments"===e){const e={task:t};return{source:new window.Smart.DataAdapter({dataSource:t.segments,dataFields:["label: string","dateStart: date","dateEnd: date","duration: number"]}),columns:[{label:i.localize("name"),dataField:"label",dataType:"string",autoWidth:!1,width:"20%"},{label:i.localize("dateStart"),dataField:"dateStart",dataType:"date",autoWidth:!1,editor:i._getColumnEditorSetup("dateStart",e),formatFunction:e=>{e.value=i._formatDate(e.data.dateStart)}},{label:i.localize("dateEnd"),dataField:"dateEnd",dataType:"date",autoWidth:!1,editor:i._getColumnEditorSetup("dateEnd",e),formatFunction:e=>{e.value=i._formatDate(e.data.dateEnd)}},{label:i.localize("duration"),dataField:"duration",dataType:"number",autoWidth:!1,width:"15%",allowEdit:!1}]}}return{source:[],columns:[]}}_getColumnEditorSetup(e,t){const i=this;switch(e){case"dateStart":case"dateEnd":return{template:'<smart-date-time-picker drop-down-append-to="body" wait></smart-date-time-picker>',onInit:(e,n,a,s)=>{const r=t.task;s||(s=new Date(r.dateStart)),a.rightToLeft=i.rightToLeft,a.animation=i.animation,a.theme=i.theme,a.min=r.dateStart,a.max=r.dateEnd,a.locale=i.locale,a.calendarButton=!0,a.dropDownDisplayMode="auto",a.enableMouseWheelAction=!0,a.formatString="yyyy-MMM-dd HH:mm:ss",a.value=new Date(Math.max(r.dateStart.getTime(),Math.min(r.dateEnd.getTime(),s.getTime()))),a.removeAttribute("wait")},getValue:e=>e.value.toDate()};case"name":return{template:'<smart-drop-down-list virtualized drop-down-append-to="body" wait></smart-drop-down-list>',onInit:(e,n,a,s)=>{a.rightToLeft=i.rightToLeft,a.animation=i.animation,a.theme=i.theme,a.dataSource=t.tasks,a.selectedValues=[s],a.removeAttribute("wait")},getValue:e=>e.selectedValues[0]};case"type":return{template:"<smart-input wait></smart-input>",onInit:(e,n,a,s)=>{const r=t.connectionTypes,o=r.find((e=>e.value===s));a.readonly=!0,a.rightToLeft=i.rightToLeft,a.animation=i.animation,a.theme=i.theme,a.dropDownButtonPosition="right",a.dataSource=r,a.value=(o||r[0]).label+"",a.removeAttribute("wait")},getValue:e=>{if(e.selectedValues.length)return e.selectedValues[0];const i=t.connectionTypes.find((t=>t.label===e.value));return i?i.value:void 0}}}}_popupWindowChangeHandler(e){const t=this,i=e.target,n=i.closest("smart-window")||(i.getRootNode()&&i.getRootNode().host?i.getRootNode().host:void 0);if(n._target)if(i.classList.contains("smart-gantt-chart-popup-window-tabs")){const a=n.querySelector(".smart-popup-window-button.ok");a&&(a.disabled=!1),t._handleTabsContent(i.getTabs()[e.detail.index],n)}else if(i.classList.contains("smart-gantt-popup-window-table")){const e=i.closest("smart-tab-item").querySelector('.smart-gantt-chart-button[action="delete"]');e&&(e.disabled=0===i.selected.length)}}_popupWindowClickHandler(e){const t=this;let i=(e.originalEvent||e).target;i.shadowRoot&&(i=(e.originalEvent||e).composedPath()[0]);const n=i.closest("smart-window")||(i.getRootNode()&&i.getRootNode().host?i.getRootNode().host:void 0),a=n._target;if(i.closest(".smart-popup-window-button.cancel"))return t._popupWindow&&t._popupWindow.confirmPopupWindow&&n!==t._popupWindow.confirmPopupWindow&&t._popupWindow.confirmPopupWindow.close(),n.close(),void delete n._target;if(i.closest(".smart-popup-window-button.ok")){if(n===t.$.connectionPopupWindow&&"number"==typeof a.type)t._removeConnection(a.startIndex+"-"+a.endIndex+"-"+a.type);else if(n===t.$.confirmPopupWindow){const e=a;void 0!==e.$._resourceId?t._removeResource(e):t._removeTask(e),n.close(),t.$.taskPopupWindow&&t.$.taskPopupWindow.close(),delete n._target}else{const e=n.shadowRoot||n,i=e.querySelectorAll(".smart-gantt-chart-popup-window-editor"),s=a;let r={};for(let e=0;e<i.length;e++){const n=i[e]._label,a=t.taskColumns.find((e=>e.value===n));if(a.customEditor&&a.getCustomEditorValue)r[n]=a.getCustomEditorValue(i[e]);else{const t=i[e].lastElementChild;let a;if(!t)continue;if(t.classList.contains("smart-hidden")){r[n]=void 0;continue}a=Smart.DateTimePicker&&t instanceof Smart.DateTimePicker?t.value.toDate?t.value.toDate():t.value:t instanceof HTMLInputElement&&"datetime-local"===t.type?new Date(t.value):Smart.DropDownList&&t instanceof Smart.DropDownList?t.selectedValues.slice(0):t.hasAttribute("list")?t.value.split(",").map((e=>e.trim())):t.value,a instanceof Date&&isNaN(a.getTime())&&(a=void 0),null!=a&&(r[n]=a)}}if(void 0!==s.$._resourceId)t._updateResource(s,r);else{const i=r.dateStart?r.dateStart:void 0,n=r.dateEnd?r.dateEnd:void 0;if((i&&i.getTime&&i.getTime()!==s.dateStart.getTime()||n&&n.getTime&&n.getTime()!==s.dateEnd.getTime())&&(r.duration=void 0),t._isPopupWindowTableModified){const i=e.querySelectorAll(".smart-gantt-popup-window-table");for(let e=0,n=i.length;e<n;e+=1){const n=i[e];n.closest('.smart-tab-item[value="dependency"]')?t._updateTaskDependencies(n,s):n.closest('.smart-tab-item[value="segments"]')&&t._updateTaskSegments(n,s)}}t._updateTask(s,r)}}return t._popupWindow&&t._popupWindow.confirmPopupWindow&&n!==t._popupWindow.confirmPopupWindow&&t._popupWindow.confirmPopupWindow.close(),n.close(),void delete n._target}if(i.closest(".smart-popup-window-button.delete"))return void t._openPopupWindow(n._target,!0);if(i.closest(".smart-popup-window-editor-toggle")){const e=i.closest('.smart-gantt-chart-popup-window-editor[value="deadline"]'),n=e?e.lastElementChild:void 0;if(n){const e=n.classList.contains("smart-hidden")?"remove":"add";n.classList[e]("smart-hidden"),i.textContent=t.localize(e)}return}const s=i.closest(".smart-gantt-chart-button");if(s){const e=i.closest("smart-tab-item"),r=e.querySelector(".smart-gantt-popup-window-table");if(!r)return;const o=s.getAttribute("action"),l=e.getAttribute("value"),d=a;switch(o){case"add":{let e;e="segments"===l?{label:`${t.localize("segment")} ${r.dataSource.length+1}`,dateStart:new Date(d.dateStart),dateEnd:new Date(d.dateEnd),duration:parseFloat((d.duration||0).toFixed(2))}:{id:"",name:"",type:0,lag:0},r.addRow(e),r.beginEdit(r.rows.length-1),t._isPopupWindowTableModified=!0;break}case"delete":{const e=r.selected;r.beginUpdate();for(let t=0,i=e.length;t<i;t+=1)r.removeRow(e[t]);r.endUpdate(),t._isPopupWindowTableModified=!0;break}}t._applyTableValidation(e,r,n)}}_updateTaskDependencies(e,t){const i=this,n=i._tasks.indexOf(t),a=i._getTaskConnections(t).connectedTasks,s=e.rows;for(let e=0,t=a.length;e<t;e+=1){const t=a[e];i._removeConnection(`${t.startIndex}-${t.endIndex}-${t.type}`)}for(let e=0,t=s.length;e<t;e+=1){const t=s[e].data,a=t.name,r=t.type;if(!i._getValidConnectionId(a,n,r,"_"))continue;const o=parseInt(t.lag);i._connectTask([a,n,r,isNaN(o)?0:o])}i._recycleConnections()}_updateTaskSegments(e,t){const i=e.rows;let n=[];for(let e=0,t=i.length;e<t;e+=1){const t=i[e].data,a=t.label,s=new Date(t.dateStart),r=new Date(t.dateEnd);isNaN(s)||isNaN(r)||n.push({label:"string"==typeof a?a:"",dateStart:s,dateEnd:r})}t.segments=n,this._validateTaskSegments(t)}_createTasks(e,t){const i=this,n={},a=[];e||(e=i.dataSource),i.dataSource instanceof Smart.DataAdapter&&(e=i._parseAdapterData(i.dataSource.toArray())),t||i.clearTasks();let s=[];if(function e(r,o){let l=[];if(!r||0===r.length)return[];for(let d=0;d<r.length;d++){let c,m=r[d];if("object"!=typeof m)continue;if(m=i._validateTaskProperties(m,o),!m)continue;const u=m.tasks,h=m.id;m.$.project=o,m.$.id=o?o.$.id+"."+d:d+"","string"!=typeof h&&"number"!=typeof h||(n[h]?a.push(h):n[h]=1),u instanceof Array&&u.length>0&&(m.synchronized&&(m.dateStart=m.minDateStart=m.maxDateStart=void 0,m.dateEnd=m.minDateEnd=m.maxDateEnd=void 0),m.type="project",c=e(u,m),c.length&&(m.hidden=!c.some((e=>!e.hidden)),m.hidden?c.forEach((e=>e.hidden=m.hidden)):i._synchronizeProjectVisibility(o,m))),(!m.type||["project","task","milestone"].indexOf(m.type)<0)&&(m.type="task"),o&&"project"===m.type&&c&&c.length>0?(l.push(m),l=l.concat(c)):(o||((t&&"project"===m.type&&m.synchronized||m.dateStart&&m.dateEnd&&!isNaN(m.dateStart.getTime())&&!isNaN(m.dateEnd.getTime()))&&s.push(m),c&&(s=s.concat(c))),l.push(m))}return o&&i._synchronizeProjectDates(o,l),l}(e),t)return s.slice(0);a.length&&console.warn(i.localize("duplicateIds",{elementType:i.nodeName.toLowerCase(),duplicates:a.toString()})),i._tasks=s.slice(0),i._handleResources()}_createTimeline(){const e=this;e._tasks&&0!==e._tasks.length?(delete e.__tasks,e._createConnections(),e._autoSchedule(),e._createTimelineCells(),e._insertTimelineTasks(),e.$.taskSplitter.refresh()):e._clearTasks()}_createConnections(){const e=this,t=e._tasks;e._connections=[];for(let i=0,n=t.length;i<n;i+=1)t[i].connections&&e._handleTaskConnections(i)}_createTooltip(){const e=this,t=e.tooltip;let i=e.$.tooltip;if(t.enabled)return i||(e.$.tooltip=i=document.createElement("smart-tooltip"),i.classList.add("smart-gantt-chart-tooltip"),i.setAttribute("smart-id","tooltip")),e.$tooltip||e._handleTooltipEvents(!0),i.rightToLeft=e.rightToLeft,i.theme=e.theme,i.openMode="manual",i.arrow=t.arrow,i.delay=t.delay,i.parentElement||e.$.container.appendChild(i),i;i&&(i.close(),i.remove())}_handleTooltipEvents(e){const t=this,i=t.$.tooltip;if(!i)return;let n=t.$tooltip;e?(n=t.$tooltip=Smart.Utilities.Extend(i),n.listen("close",t._tooltipVisibilityHandler.bind(t)),n.listen("closing",t._tooltipVisibilityHandler.bind(t)),n.listen("open",t._tooltipVisibilityHandler.bind(t)),n.listen("opening",t._tooltipVisibilityHandler.bind(t))):n&&(n.unlisten("close"),n.unlisten("closing"),n.unlisten("open"),n.unlisten("opening"),delete t.$tooltip)}_toggleTooltip(e){const t=this;if(t._dragDetails||!t.tooltip.enabled||!t.$.container.contains(e.target))return void t._closeTooltip();const i=t.getRootNode(),n={"smart-task-segment":null,"smart-timeline-task":null,"smart-gantt-chart-task-indicator":null,"smart-resource-timeline-view-cell":null,"smart-task-connection":null},a=(i.host?i.host.shadowRoot:i).elementsFromPoint(e.clientX,e.clientY);let s;for(let e=0,t=a.length;e<t;e+=1){const t=a[e],i=t.classList;if(i.contains("smart-task-container"))n["smart-timeline-task"]=t.closest(".smart-timeline-task");else for(let e in n)i.contains(e)&&(n[e]=t)}if(n["smart-task-segment"]){const e=n["smart-timeline-task"],t=e?e._cellObj.task:void 0;s=t&&t.segments&&t.segments.length?n["smart-task-segment"]:e}else if(n["smart-gantt-chart-task-indicator"])s=n["smart-gantt-chart-task-indicator"];else for(let e in n)if(n[e]){s=n[e];break}s?t._openTooltip(s,e):t._closeTooltip()}_getConnectionTypeName(e){const t=this;switch(e){case 0:return t.localize("startToStart");case 1:return t.localize("endToStart");case 2:return t.localize("endToEnd");case 3:return t.localize("startToEnd");default:return""}}_getSegmentTask(e){const t=this._tasks;for(let i=0,n=t.length;i<n;i+=1){const n=t[i];if(Array.isArray(n.segments)&&n.segments.indexOf(e)>-1)return n}}_getTooltipContent(e){const t=this;if(!e)return;const i=e.classList;let n,a;if(i.contains("smart-task-segment")){if(a=e._segmentObj,a){let e=a.label;if(void 0===e){const i=t._getSegmentTask(a);i&&(e=i.label)}n=`<label><b>${t.localize("segment")}</b>: ${e||""}</label>\n <label><b>${t.localize("dateStart")}</b>: ${t._formatDate(a.dateStart)||""}</label>\n <label><b>${t.localize("dateEnd")}</b>: ${t._formatDate(a.dateEnd)||""}</label>`}}else if(i.contains("smart-timeline-task"))a=e._cellObj.task,a&&!a.segments&&(n=`<label><b>${t.localize("task")}</b>: ${a.label||""}</label>\n <label><b>${t.localize("dateStart")}</b>: ${t._formatDate(a.dateStart)||""}</label>\n <label><b>${t.localize("dateEnd")}</b>: ${t._formatDate(a.dateEnd)||""}</label>`);else if(i.contains("smart-gantt-chart-task-indicator"))a=e._indicatorObj,a&&(n=a.label||"");else if(i.contains("smart-resource-timeline-view-cell")){if(!e.hasAttribute("load"))return;const i=e.closest(".smart-timeline-cell");if((e=e.closest(".smart-timeline-row"))&&e._cellObj&&(a=e._cellObj.resource),a){const s=t._getResourceTasks(a),r="hours"===t.resourceTimelineView?"h":"",o=t._tasks,l=t.$.resourceTimelineViewCells.children,d=Array.from(e.children).findIndex((e=>e===i));n=`<label><b>${t.localize("resource")}</b>: ${a.label||""}</label>\n <label><b>${t.localize("assignments")}</b>:</label>`;for(let e=0,i=s.length;e<i;e+=1){const i=s[e],c=o.indexOf(i),m=t._getResourceCellCapacity({cellDateRange:t._getCellDateRange(l[d]),cellTaskIndexAssigned:[c],index:d,resource:a,task:i,cellIndex:d});void 0!==m&&(n+=`<label>${t.localize("task")} #${c}: (${parseFloat(m.capacity.toFixed(1))}${r}) ${i.label||""}</label>`)}}}else i.contains("smart-task-connection")&&(a=t.getConnectionDetails(e.getAttribute("connection-id")),void 0!==a&&(n=`<label><b>${t.localize("startTask")}</b>: ${a.startTask.label||""}</label>\n <label><b>${t.localize("endTask")}</b>: ${a.endTask.label||""}</label>\n <label><b>${t.localize("type")}</b>: ${t._getConnectionTypeName(a.type)||""}</label>`,a.lag&&(n+=`<label><b>${t.localize("lag")}</b>: ${parseFloat(a.lag.toFixed(1))}</label>`)));return a?a.tooltip?a.tooltip+"":n||"":void 0}_openTooltip(e,t,i){const n=this,a=n.tooltip;if(i="string"==typeof i?i:n._getTooltipContent(e),!(a.enabled&&i&&e&&e.nodeName))return void n._closeTooltip();const s=n.$.tooltip||n._createTooltip();let r,o;if(i&&s.value!==i&&(s.value=i),s.selector=e,t&&t.pageX){const i=document.body.getBoundingClientRect(),n=e.getBoundingClientRect(),l=a,d=l.offset[0]||0,c=l.offset[1]||0,m=s.offsetWidth,u=s.offsetHeight;let h="bottom";"absolute"!==s.position&&(s.position="absolute",s.offset=[]),o=Math.min(i.left+i.width-m,t.pageX-m/2-d),r=n.top-u-c,r<i.top&&(r=n.bottom+c,h="top"),o<i.left&&(o=i.left+d,h="left"),h!==s.arrowDirection&&(s.arrowDirection=h),s.style.left=o+"px",s.style.top=r+"px"}else"auto"!==s.position&&(s.position="auto",s.offset=a.offset);s.visible||(n.getShadowRootOrBody().appendChild(s),s.open())}_closeTooltip(){const e=this.$.tooltip;e&&e.visible&&e.close()}_tooltipVisibilityHandler(e){const t=this,i=e.type,n=t.$.tooltip;e.target===n&&(e.stopPropagation(),t._fireTooltipVisibilityEvent(e)?e.preventDefault():"opening"===i?n.classList.remove("smart-visibility-hidden"):"closing"===i&&(n.hasAnimation?n.addEventListener("transitionend",(()=>{n.visible||(n.classList.add("smart-visibility-hidden"),n.style.top=n.style.left=0,t.$.container.appendChild(n))}),{once:!0}):t.$.container.appendChild(n)))}_fireTooltipVisibilityEvent(e){const t=this,i=e.type,n=t.$.tooltip,a=e.detail.owner;let s={target:n,owner:a};if(a)if(a.classList.contains("smart-task-connection")){s.type="connection";const e=t.getConnectionDetails(a.getAttribute("connection-id"));e&&(s.item=e)}else if(a.classList.contains("smart-gantt-chart-task-indicator"))s.type="indicator",a._indicatorObj&&(s.item=t._cloneObject(a._indicatorObj));else if(a.classList.contains("smart-task-segment"))s.type="segment",a._segmentObj&&(s.item=t._cloneObject(a._segmentObj));else if(a.classList.contains("smart-timeline-task"))s.type="task",a._cellObj&&a._cellObj.task&&(s.item=t._cloneObject(a._cellObj.task));else if(a.classList.contains("smart-resource-timeline-view-cell")){s.type="resource";const e=a.closest(".smart-timeline-row");e._cellObj&&(s.item=t._cloneObject(e._cellObj.resource))}let r=t.getAttribute("aria-owns")||"";switch(i){case"open":t.setAttribute("aria-owns",(r+" "+n.id).trim()),t.$.fireEvent(i,s);break;case"close":r=r.replace(n.id,"").trim(),r?t.setAttribute("aria-owns",r):t.removeAttribute("aria-owns"),t.$.fireEvent(i,s);break;case"closing":case"opening":if(t.$.fireEvent(i,s).defaultPrevented)return!0}}_parseAdapterData(e){let t={};for(let i=0,n=e.length;i<n;i+=1){const n=e[i],a=Object.assign({},n),s=n.parent,r=n.$.id;if(s&&s!==n){const e=s.$.id;t[e]||(t[e]=Object.assign({},s));const i=t[e];i.tasks||(i.tasks=[]),i.tasks.push(a)}else t[r]=a;delete a.parent,delete a.children,delete a.$}return Object.values(t)}_handleTaskConnections(e){const t=this,i=t._tasks;let n;if("number"==typeof e&&(n=e,e=i[e]),!e)return;void 0===n&&(n=i.indexOf(e));const a=e.connections,s=i.length;for(let e=0;e<a.length;e++){const i=a[e],r=t._getTaskIndexById(i.target);null==r||isNaN(r)||r<0||r>=s||r===n||t._connectTask([n,r,i.type,i.lag])}delete e.connections}_insertTasks(e,t,i){const n=this,a=n._tasks;if(t){const s=n._getProjectTasks(t,!0);if(s.length){const t=s[s.length-1];let r,o;"number"==typeof i&&i<s.length?r=s[i=Math.max(0,i)]:(r=t,o=!0);const l=n._getProjectTasks(r);i=o&&l.length?a.indexOf(l[l.length-1]):a.indexOf(r),a.splice.apply(a,[i+(o?1:0),0].concat(e))}else a.splice.apply(a,[a.indexOf(t)+1,0].concat(e))}else"number"==typeof i?(i+="",(i=a.findIndex((e=>e.$.id===i)))<0&&(i=a.length)):i=a.length,a.splice.apply(a,[i,0].concat(e))}_insertTimelineTasks(){const e=this,t=e._timelineVCells;t&&t.length?(e._recycleTimelineTasks(),e._refresh()):e._resetTimeline()}_recycleTimelineTasks(e){const t=this,i=t.$.taskIndicatorsContainer,n=i.children,a=t.$.taskTimelineCellsContainer.childElementCount,s=t._timelineVCells;for(;i.childElementCount>a;)i.firstElementChild.remove();if(t._closeTooltip(),!s||!s.length)return;const r=s.indexOf(t._getFirstContentCellInView()),o=t._getSelection("task",t.selectedTaskIds),l={timelineStart:t.dateStart.getTime(),timelineEnd:t.dateEnd.getTime()};for(let i=0,d=a;i<d;i++){const a=n[i],d=s[r+i];if(!d){a&&a.remove();continue}const c=d.task;t._snapToNearestDates(c),t._recycleTaskBars(d,i,o),t._setTimelineTaskBar(d,i),t._setTimelineTaskBaseline(d,i),t._setTaskBarProgress(c,i),t._setTaskBarLabel(c,i),t._setTaskIndicators(d,i,l),t._setTaskDeadline(d,i,l),e&&t._refreshTableColumnsData(c)}t._recycleConnections()}_ensureVisible(e,t="task"){const i=this;if(null==e)return;let n,a="task"===t?i._timelineVCells:i._timelineResourceVCells;n||(n=i.$[`${t}Table`]);const s=a.find((i=>i[t]===e));if(!s)return;let r,o;if("task"===t){const t=i._getTimelineTaskCellByDate(e.dateStart);if(r=i.$.taskTimelineContainer.offsetHeight,o=i,t){const e=i.scrollLeft,n=i.$.taskTimelineContainer.offsetWidth;t.left+t.width>e+n?i.scrollLeft=Math.max(0,t.left+t.width-n):t.left<e&&(i.scrollLeft=Math.max(0,t.left))}}else r=i.$.resourceTimelineContent.offsetHeight,o=i._resourceScrollView;const l=o.scrollTop;s.top+s.height>l+r?o.scrollTop=Math.max(0,s.top+s.height-r):s.top<l&&(o.scrollTop=Math.max(0,s.top))}_isTaskExpanded(e,t){if(!e||!e.$)return;let i,n=e.$[this.groupByResources?"group":"project"];if(!n)return!0;for(;n;){if(i=n.expanded,!i)return!1;if(n=n.$.project,n===t)break}return i}_getItemByTreeIndex(e,t,i){if(!t)return;const n=t.split(".");let a=this[`_${e}s`].filter((e=>!e.$.project))[t.split(".")[0]];if(a){if(!a[`${e}s`]||!a[`${e}s`].length)return i?null:a;for(let t=1;t<n.length;t++){const s=a[`${e}s`].filter((e=>!e.hidden&&e.$.project===a))[n[t]];if(!s||i&&"project"!==s.type)break;if(a=s,"project"!==a.type)break}return i?a&&"project"===a.type?a:void 0:a}}_getItemByTableId(e,t,i){if(null==t)return;const n=this[`_${e}s`];let a;for(let e=0,i=n.length;e<i;e+=1){const i=n[e];if(i.$.id===t){a=i;break}}return a?i?"project"===a.type?a:void 0:a:void 0}_tableChangeHandler(e){const t=e.target;(t.classList.contains("smart-task-table")||t.classList.contains("smart-resource-table"))&&(e.stopPropagation(),this._handleTableSelection(t===this.$.taskTable?"task":"resource",t.selected))}_tableColumnResizeHandler(e){const t=e.target,i=e.detail,n=t.classList.contains("smart-task-table");if(!n&&!t.classList.contains("smart-resource-table"))return;e.stopPropagation();const a=i.dataField,s=this[(n?"task":"resource")+"Columns"].find((e=>e.value===a));s&&(s.size=i.width),this.$.fireEvent("columnResize",i)}_tableSortFilterHandler(e){const t=this,i=e.target;let n;i.classList.contains("smart-task-table")?(n="task",t._createTimelineContent(),t._recycleTimelineTasks()):i.classList.contains("smart-resource-table")&&(n="resource",t._createResourceTimelineContent(),t._recycleResourceContent()),n&&(t._refresh(),e.stopPropagation(),t.$.fireEvent(e.type,Object.assign({type:n},e.detail)))}_taskTableExpandHandler(e){const t=this,i=e.target;if(!i.classList.contains("smart-task-table")&&!i.classList.contains("smart-resource-table"))return;const n=i===t.$.taskTable?"task":"resource";if(e.stopPropagation(),!t[`${n}s`]||!t[`${n}s`].length)return;const a=e.detail.record.itemId,s=t._getItemByTableId(n,a,!0);s&&(delete t._hoveredItem,s.expanded="collapse"!==e.type,t._createTimelineContent(),t._refresh(),t._recycleTimelineTasks(),t.$.fireEvent(e.type,{item:t._cloneObject(s),id:s.id||s.$.id,index:t._tasks.indexOf(s),label:s.label,value:s.value}))}_taskTableKeyDownHandler(e){const t=this,i=e.key;if(t.keyboardNavigation&&!t.disabled&&!t.readonly)switch(i){case"Delete":case"Enter":{const e=t.$.taskTable._focusedCell;if(!e||!e.closest)return;const n=e.closest("tbody tr");if(!n)return;const a=t._getVCellById("task",n.getAttribute("row-id"));a&&t._openPopupWindow(a.task,"Delete"===i);break}}}_getVCellById(e="task",t){const i="task"===e?this._timelineVCells:this._timelineResourceVCells;if(i&&i.length)for(let n=0,a=i.length;n<a;n+=1){const a=i[n][e];if(a.$&&a.$.id===t)return i[n]}}_getGroupVCellByPath(e,t){const i="task"===e?this._timelineVCells:this._timelineResourceVCells;if(i&&i.length)for(let n=0,a=i.length;n<a;n+=1){const a=i[n][e];if(a.$&&a.$.id===t)return i[n]}}_taskTableGroupEventHandler(e){const t=this,i=e.detail.action,n=e.target;if(["collapse","expand"].indexOf(i)<0||!n.classList.contains("smart-task-table")&&!n.classList.contains("smart-resource-table"))return;const a=n===t.$.taskTable?"task":"resource",s=t.$.taskTable._getGroupByIndex(e.detail.path),r=t._getGroupVCellByPath(a,s.$.id);if(!r||!r[a].isGroup)return;const o=r[a];e.stopPropagation(),o.expanded="collapse"!==i,t._createTimelineContent(),t._refresh(),t._recycleTimelineTasks(),t.$.fireEvent(i,{isGroup:!0,item:t._cloneObject(o),id:o.$.id,label:o.label})}_resetTimeline(){const e=this,t=e.$.taskTimelineContainer;if(e.$.taskTimelineCellsContainer.innerHTML="",e.$.timelineTasksContainer.innerHTML="",e.$.timelineConnectionsContainer.innerHTML="",e.$.timelineContent.style.height="",e.$.taskIndicatorsContainer.innerHTML="",e.rightToLeft&&e.scrollLeft!==t.scrollLeft){const i=e._getScrollLeft(e.scrollLeft);t.scrollLeft=i,e.$.mainSplitter.contains(e.$.resourceTimelineHeader)&&(e.$.resourceTimelineContent.scrollLeft=i)}e._closeTooltip(),e.$.container.style.removeProperty("--smart-gantt-chart-task-timeline-content-height")}_refreshTimeline(e){const t=this;e||(e=t.view);const i=t._getDateFromCell(t.scrollLeft,t._getFirstCellObjInView(),e),n=t.scrollTop;t.scrollLeft=0,t.scrollTop=0,t.$.mainSplitter.contains(t.$.resourceTimelineHeader)&&t._resourceScrollView&&(t._resourceScrollView.scrollLeft=0),t._resetTimeline(),t._createTimelineCells(),t._recycleTimelineTasks(!0),t.$.mainSplitter.contains(t.$.resourceSplitter)&&t._refreshResourceTimeline(),t._refresh(),t._scrollTo(i),t.scrollTop=n}_scrollTo(e,t){const i=this,n=i._timelineCells;let a;if(void 0!==e&&!isNaN(new Date(e).getTime()))for(let s=0;s<n.length;s++){const r=n[s],o=r.date;switch(i.view){case"quarter":case"year":if(o.getFullYear()===e.getFullYear()&&o.getMonth()===e.getMonth()){if(t){a=r.left;break}let i=new Date(e);i.setMonth(e.getMonth()+1),i.setDate(0),i=i.getDate(),a=r.left+(e.getDate()-1)/i*r.width}break;case"month":{let i=new Date(o),n=new Date(o);i.setDate(i.getDate()-i.getDay()),n.setDate(n.getDate()+(6-n.getDay())+1),n.setMilliseconds(n.getMilliseconds()-1),e.getTime()>=i.getTime()&&e.getTime()<=n.getTime()&&(a=r.left+(t||t?0:e.getDay()/7*r.width));break}case"week":o.getFullYear()===e.getFullYear()&&o.getMonth()===e.getMonth()&&o.getDate()===e.getDate()&&(a=r.left+parseFloat(e.getHours()+"."+e.getMinutes()+e.getSeconds())/24*r.width);break;case"day":o.getFullYear()===e.getFullYear()&&o.getMonth()===e.getMonth()&&o.getDate()===e.getDate()&&o.getHours()===e.getHours()&&(a=r.left+(t?0:parseFloat(e.getMinutes()+e.getSeconds())/60*r.width))}if(void 0!==a)return i.scrollLeft=a,void(i.$.mainSplitter.contains(i.$.resourceTimelineHeader)&&(i.$.resourceTimelineHeader.scrollLeft=i.$.resourceTimelineContent.scrollLeft=a,i._refreshResourceTimeline()))}}_updateConnection(e,t){const i=this,n=i._tasks,[a,s,r,o]=e,l=n[a],d=n[s];if(!l||!d||"number"!=typeof r)return;let c=i._connections,m=-1;c||(c=i._connections=[]);for(let e=0,t=c.length;e<t;e+=1){const t=c[e],i=t.startIndex,n=t.endIndex;if(i===a&&n===s||i===s&&n===a){m=e;break}}if(!t){if(m<0)c.push({startTask:n[a],endTask:n[s],startIndex:a,endIndex:s,type:r,lag:o});else{const e=c[m];if(!e)return;if(e.startIndex=a,e.startTask=n[a],e.endIndex=s,e.endTask=n[s],e.type=r,o!==e.lag){const t=parseInt(o);isNaN(t)||(e.lag=t)}}return!0}m>-1&&c.splice(m,1)}_createTimelineCells(){const e=this,t=e._tasks,i=new Date(e.properties.dateStart.value),n=new Date(e.properties.dateEnd.value);let a,s;if(isNaN(i.getTime())||(a=i),isNaN(n.getTime())||(s=n),t.length>0){let e=t[0].dateStart,i=t[0].dateEnd;for(let n=0;n<t.length;n++)t[n].dateStart&&t[n].dateEnd&&(e||(e=t[n].dateStart),i||(i=t[n].dateEnd),e.getTime()>t[n].dateStart.getTime()&&(e=t[n].dateStart),i.getTime()<t[n].dateEnd.getTime()&&(i=t[n].dateEnd));(!a||a.getTime()>e.getTime())&&(a=e),(!s||s.getTime()<i.getTime())&&(s=i)}a&&s&&(a=e._minMaxDateValidator(a),s=e._minMaxDateValidator(s),e._createTimelineHeader(a,e._getCellsCount(a,s)),e._createTimelineContent(),e._createDateMarkers(),e._refresh())}_getCellsCount(e,t,i){let n,a,s,r,o,l,d=new Date(e),c=new Date(t);const m=this,u=t.getFullYear()-e.getFullYear();if(a=n=Math.round(u)+1,"year"===i)return{year:a};if(d.setHours(d.getHours(),0,0,0),c.setHours(c.getHours(),0,0,0),l=Math.floor((t.getTime()-e.getTime())/36e5),l>0){let e=new Date(d);if(l=1,d.getFullYear()!==c.getFullYear()){let t=new Date(d.getFullYear()+1,0,1,0,0,0,0);for(;e.getTime()!==t.getTime();){const t=e.getTime();e.setHours(e.getHours()+1),e.getTime()===t&&e.setHours(e.getHours()+2),l++}const i=c.getFullYear()-t.getFullYear();for(let t=0;t<i;t++){const t=e.getFullYear();l+=24*((t%100==0?t%400==0:t%4==0)?366:365)-1,e.setFullYear(t+1)}}for(;e.getTime()<c.getTime();){const t=e.getTime();e.setHours(e.getHours()+1),e.getTime()===t&&e.setHours(e.getHours()+2),l++}}if("hour"===i)return{hour:l};if(d.setHours(0,0,0,0),c.setHours(23,59,59,999),o=n=Math.round((c.getTime()-d.getTime())/864e5),"day"===i)return{day:o};if(d.setDate(d.getDate()-d.getDay()),c.setDate(c.getDate()+6-c.getDay()),r=n=Math.round((c.getTime()-d.getTime())/6048e5),"week"===i){if(-1!==m.firstDayOfWeek){const t=e.getDay()-m.firstDayOfWeek;e.setDate(e.getDate()-e.getDay()+m.firstDayOfWeek-(t>=0?0:7))}return{week:r}}if("month"===this.view&&(0!==e.getDay()&&(e=new Date(e.setDate(e.getDate()-e.getDay()))),6!==t.getDay()&&(t=new Date(t.setDate(t.getDate()+6-t.getDay()))),-1!==m.firstDayOfWeek)){const t=e.getDay()-m.firstDayOfWeek;e.setDate(e.getDate()-e.getDay()+m.firstDayOfWeek-(t>=0?0:7))}if(e.getFullYear()!==t.getFullYear()){n=12-e.getMonth();const i=t.getFullYear();for(let a=e.getFullYear()+1;a<=i;a++)n+=a===t.getFullYear()?t.getMonth()+1:12}else n=t.getMonth()-e.getMonth()+1;return s=Math.ceil(n),"months"===i?{month:s}:("day"===this.view&&0===l&&(l=1),{year:a,month:s,week:r,day:o,hour:l})}_recycleTaskBars(e,t,i){const n=this,a=e.task,s=n.$.timelineTasksContainer,r=n.$.taskTimelineCellsContainer,o="project"===a.type&&a.synchronized,l=a.type,d=a.$.id,c=s.children[t],m=r.children[t];m._cellObj=e,m.setAttribute("row-id",d),m.style.top=e.top+"px",m.removeAttribute("hover"),c.removeAttribute("hover"),c.classList.contains(l)||(c.innerHTML="milestone"===l?'<div class="smart-task-container" aria-hidden="true">\n <div class="smart-task-connection-point start"></div>\n <div class="smart-task-segments"></div>\n <div class="smart-task-connection-point end"></div>\n </div>':'<div class="smart-task-container" aria-hidden="true">\n <div class="smart-task-connection-point start"></div>\n <div class="smart-task-segments"></div>\n <div class="smart-timeline-task-progress-thumb"></div>\n <div class="smart-task-connection-point end"></div>\n </div>'),a.connectionType&&(a.connectionType.includes("start")||c.querySelector(".start").classList.add("smart-hidden"),a.connectionType.includes("end")||c.querySelector(".end").classList.add("smart-hidden")),n._recycleSegments(a,c),delete c._cellStart,delete c._cellEnd,a.disableDrag||o&&!a.dragProject?c.setAttribute("disable-drag",""):c.removeAttribute("disable-drag"),a.disableResize||o?c.setAttribute("disable-resize",""):c.removeAttribute("disable-resize"),a.isGroup?c.setAttribute("resource-group",""):c.removeAttribute("resource-group"),i&&(i.indexOf(d)>-1?(c.setAttribute("selected",""),m.setAttribute("selected","")):(c.removeAttribute("selected"),m.removeAttribute("selected"))),a.id?c.id=a.id:c.id="ganttTask"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),c._cellObj=e,c.className="smart-timeline-task "+l,c.setAttribute("row-id",d),a.class&&c.classList.add(a.class),c.setAttribute("aria-label",a.label+" Start date: "+n._toISODate(a.dateStart)+", End date: "+n._toISODate(a.dateEnd)),c.setAttribute("aria-selected","false")}_toISODate(e){const t=e.getFullYear(),i=e.getMonth()+1,n=e.getDate();return t+"-"+(i<10?"0"+i:i)+"-"+(n<10?"0"+n:n)}_recycleSegments(e,t){const i=this,n=t.querySelector(".smart-task-segments");let a,s=e.segments;if(!n)return;for(Array.isArray(s)&&s&&s.length&&"task"===e.type||(s=[e]);n.childElementCount>s.length;)n.children[0].remove();const r=document.createDocumentFragment(),o=n.children,l="milestone"===e.type?'<div class="smart-timeline-task-fill"></div>':'<div class="smart-timeline-task-fill">\n <div class="smart-timeline-task-progress"></div>\n </div>\n <div class="smart-timeline-task-label"></div>';for(let t=0,n=s.length;t<n;t+=1){const n=s[t];let d=o[t];n.dateStart=new Date(Math.max(e.dateStart.getTime(),n.dateStart.getTime())),n.dateEnd=new Date(Math.min(e.dateEnd.getTime(),n.dateEnd.getTime())),d?(delete d._cellStart,delete d._cellEnd):(d=document.createElement("div"),d.classList.add("smart-task-segment"),d.innerHTML=l,r.appendChild(d)),n.disableDrag?d.setAttribute("disable-drag",""):d.removeAttribute("disable-drag"),n.disableResize?d.setAttribute("disable-resize",""):d.removeAttribute("disable-resize"),d._segmentObj=n,d.setAttribute("aria-label",(n.label||"")+" Start date: "+i._toISODate(n.dateStart)+", End date: "+i._toISODate(n.dateEnd)),a=d}r.childElementCount&&n.appendChild(r),i._setTaskBarDeadline(e,a)}_createCells(e){let t,i=document.createDocumentFragment();for(let n=0;n<e;n++)t=document.createElement("div"),t.classList.add("smart-timeline-view-cell"),t.setAttribute("role","columnheader"),i.appendChild(t);return i}_getTimelineVisibleCellsCount(){const e=this,t=e._timelineCells;if(!t)return;const i=e._getFirstCellObjInView();if(!i)return t.length;const n=1-(i.left+i.width-e.scrollLeft)/t[0].width;return Math.min(t.length,Math.ceil(parseFloat((e.$.timeline.offsetWidth/i.width).toFixed(2))+n))}_getHeaderVisibleCellsCount(){const e=this;if(!e._timelineHeaderCells)return;const t=Math.abs(e.scrollLeft),i=e.$.timeline.offsetWidth,n=e._timelineHeaderCells;let a=0;for(let e=0;e<n.length;e++){const s=n[e];s.left+s.width>t&&s.left<i+t&&a++}return a}_getHeaderSubVisibleCellsCount(){const e=this;if(!e._timelineHeaderSubCells)return;const t=Math.abs(e.scrollLeft),i=e.$.timeline.offsetWidth,n=e._timelineHeaderSubCells;let a=0;for(let e=0;e<n.length;e++){const s=n[e];s.left+s.width>t&&s.left<i+t&&a++}return a}_refreshHeaderDate(e){const t=this,i=t._getCellsViewType(),n=t.$.timelineHeader.scrollLeft,a=t.$.timelineViewCells.children,s=t._timelineCells;let r;t._refreshHeaderSubDetailsDate(e),t._refreshHeaderDetailsDate(e);for(let e=0;e<s.length;e++){const t=s[e];if(n<=t.left+t.width){r=e;break}}for(let n=0;n<a.length;n++){const o=a[n],l=s[r];if(!l)break;r++;const d=l.date;o.innerHTML=`<div>${t._getDateString(new Date(d),i)}</div>`,e||(o._date=new Date(d),o.setAttribute("date",d.toLocaleDateString()),o.style.width=l.width+"px",o.style[t.rightToLeft?"right":"left"]=l.left+"px",l.weekend?o.setAttribute("weekend",""):o.removeAttribute("weekend"),l.nonworking?o.setAttribute("nonworking",""):o.removeAttribute("nonworking"))}}_getDateString(e,t,i){const n=this,a=["2-digit","numeric"][n.dayFormat]||"numeric";let s;if("year"===t||"quarter"===t)s=e.toLocaleDateString(n.locale,{year:n.yearFormat});else if("month"===t)s=e.toLocaleDateString(n.locale,{month:n.monthFormat}),"month"===n.view&&(s+=" "+e.toLocaleDateString(n.locale,{year:n.yearFormat}));else if("week"===t)s="numeric"!==n.weekFormat&&i?e.toLocaleDateString(n.locale,{day:a,month:n.monthFormat,year:n.yearFormat}):n._getWeekNumber(e);else if("day"===t)s="month"===n.view?"numeric"!==n.dayFormat&&"2-digit"!==n.dayFormat?e.toLocaleDateString(n.locale,{day:"numeric"})+" "+e.toLocaleDateString(n.locale,{weekday:n.dayFormat}):e.toLocaleDateString(n.locale,{day:"numeric"})+" "+e.toLocaleDateString(n.locale,{weekday:"short"}):e.toLocaleDateString(n.locale,"day"===n.view?{day:a,month:n.monthFormat,year:n.yearFormat}:["long","short","narrow"].indexOf(n.dayFormat)>-1?{weekday:n.dayFormat}:{day:n.dayFormat});else if("hour"===t)if(s="default"===n.hourFormat?e.toLocaleTimeString(n.locale,{hour12:!1}):e.toLocaleDateString(n.locale,{hour:n.hourFormat}),"default"!==n.hourFormat)s.indexOf(",")>=0&&(s=s.substring(s.indexOf(",")+1).trim());else if(s.indexOf(":")!==s.lastIndexOf(":")&&s.indexOf(":")>=0){let e=s.toLowerCase().indexOf("am")>=0?" AM":"";e=s.toLowerCase().indexOf("pm")>=0?" PM":e,s=s.substring(0,s.lastIndexOf(":"))+e}return n.timelineHeaderFormatFunction?n.timelineHeaderFormatFunction(new Date(e),t,i,s):s}_refreshHeaderSubDetailsDate(e){const t=this,i=(t.view,t.scrollLeft),n=t.$.timelineViewSubDetails.children,a=t._timelineHeaderSubCells;let s;if(t.$.timelineViewSubDetails.classList.contains("smart-hidden"))return;for(let e=0;e<a.length;e++){const t=a[e];if(i<=t.left+t.width){s=e;break}}let r=[],o=0;for(let i=0;i<n.length;i++){const l=a[s],d=n[i];if(!l)continue;let c=new Date(l.date);"week"===t.view&&c.setDate(c.getDate()-c.getDay()),s++,c=new Date(Math.max(l.date.getTime(),c.getTime()));const m=e=>{var i,n=e.getMonth();return i=n>=9?4:n>=6?3:n>=3?2:1,"long"===t.quarterFormat?t.localize("quarter")+" "+i:"numeric"===t.quarterFormat?i:t.localize("quarterShort")+i};let u="";"quarter"===t.view||"year"===t.view?(u=m(c),"quarter"===t.view&&t.hideTimelineSecondHeaderDetails&&(u+=" "+c.getFullYear())):"month"===t.view&&(-1===t.firstDayOfWeek?u=t._getWeekNumber(c):((c.getDay()-t.firstDayOfWeek)%7==0&&i>0&&o++,u=o));const h=u+"_"+c.getFullYear();r[h]||(r[h]=[]),d.classList.remove("smart-visibility-hidden"),r[h].push({element:d,cell:l}),d.innerHTML=`<div>${u}</div>`,d.classList.add("middle"),e||(d._date=c,d.style[t.rightToLeft?"right":"left"]=l.left+"px",d.style.width=l.width+"px")}for(let e in r){const i=r[e];let n=0;for(let e=0;e<i.length;e++)n+=i[e].cell.width;if(i[0].element.style.width=n+"px","year"===t.view){const e=i[0].cell.date.toLocaleDateString(t.locale,{month:t.monthFormat}),n=i[i.length-1].cell.date.toLocaleDateString(t.locale,{month:t.monthFormat});i.length>1?i[0].element.innerHTML=`<div>${e}-${n}</div>`:i[0].element.innerHTML=`<div>${e}</div>`}else if("month"===t.view){const e="numeric"!==t.dayFormat&&"2-digit"!==t.dayFormat?t.dayFormat:"short",n=i[0].cell.date.toLocaleDateString(t.locale,{day:"numeric"})+" "+i[0].cell.date.toLocaleDateString(t.locale,{weekday:e}),a=i[i.length-1].cell.date.toLocaleDateString(t.locale,{day:"numeric"})+" "+i[i.length-1].cell.date.toLocaleDateString(t.locale,{weekday:e});i.length>1?i[0].element.innerHTML=`<div>${n}-${a}</div>`:i[0].element.innerHTML=`<div>${n}</div>`,"numeric"===t.weekFormat&&(i[0].element.innerHTML=t._getWeekNumber(i[0].cell.date))}if(t.timelineHeaderFormatFunction){const e=t.timelineHeaderFormatFunction(new Date(i[0].cell.date),t.view,!0,i[0].element.innerHTML);i[0].element.innerHTML!==e&&(i[0].element.innerHTML=e)}for(let e=1;e<i.length;e++)i[e].element.classList.add("smart-visibility-hidden")}}_refreshHeaderDetailsDate(e){const t=this,i=t.view,n=t.scrollLeft,a=t.$.timelineViewDetails.children,s=t._timelineHeaderCells;let r;for(let e=0;e<s.length;e++){const t=s[e];if(n<=t.left+t.width){r=e;break}}for(let n=0;n<a.length;n++){const o=s[r],l=a[n];let d=new Date(o.date);if("week"===t.view)if(-1!==t.firstDayOfWeek){const e=d.getDay()-t.firstDayOfWeek;d.setDate(d.getDate()-d.getDay()+t.firstDayOfWeek-(e>=0?0:7))}else d.setDate(d.getDate()-d.getDay());r++,d=new Date(Math.max(o.date.getTime(),d.getTime())),l.innerHTML=`<div>${t._getDateString(d,i,!0)}</div>`,e||(l._date=d,l.style[t.rightToLeft?"right":"left"]=o.left+"px",l.style.width=o.width+"px")}}_getWeekNumber(e){let t,i=new Date(e.getFullYear(),0,1),n=Math.round((e.getTime()-i.getTime()-6e4*(e.getTimezoneOffset()-i.getTimezoneOffset()))/864e5)+1,a=i.getDay();return a=a>=0?a:a+7,a<4?(t=Math.floor((n+a-1)/7)+1,t>52&&(i=new Date(e.getFullYear()+1,0,1),a=i.getDay(),a=a>=0?a:a+7,t=a<4?1:53)):t="week"===this.view?function(e){var t=new Date(e.valueOf()),i=(e.getDay()+6)%7;t.setDate(t.getDate()-i+3);var n=t.valueOf();return t.setMonth(0,1),4!==t.getDay()&&t.setMonth(0,1+(4-t.getDay()+7)%7),1+Math.ceil((n-t)/6048e5)}(e):Math.round((n+a-1)/7),t}_convertDuration(e,t){if(!e)return 0;let i;switch(this.durationUnit){case"day":i=864e5;break;case"hour":i=36e5;break;case"minute":i=6e4;break;case"second":i=1e3;break;case"milisecond":return e;case"week":i=6048e5}return Math.max(0,t?e/i:e*i)}_createTimelineHeader(e,t){const i=this,n=i._getCellsViewType();if(!e){const t=i.$.timelineViewCells.children;if(0===t.length)return;e=t[0]._date}if("day"!==i.view&&e.setHours(0,0,0,0),-1!==i.firstDayOfWeek){const t=e.getDay()-i.firstDayOfWeek;e.setDate(e.getDate()-e.getDay()+i.firstDayOfWeek-(t>=0?0:7))}if(i.$.timelineContent.offsetWidth===i.$.timeline.offsetWidth&&i._timelineCells&&i._timelineCells[0]&&i._timelineCells[0].date.getTime()===e.getTime()&&i._timelineCells.length===t[i._getCellsViewType()])return void i._refresh();i.$.timelineContent.style.width=i.$.timelineHeaderContent.style.width="",i._createTimelineCellsObj(e,t),i._createTimelineHeaderCellsObj(e,t),i._createTimelineHeaderSubCellsObj(e,t),i.$.timelineViewDetails.innerHTML="",i.$.timelineViewDetails.appendChild(i._createCells(i._getHeaderVisibleCellsCount())),i.$.timelineViewSubDetails.innerHTML="",i.$.timelineViewCells.classList.remove("smart-hidden"),i.$.timelineViewSubDetails.classList.add("smart-hidden");let a=2;if("quarter"===i.view?(a=3,i.$.timelineViewSubDetails.classList.remove("smart-hidden"),i.$.timelineViewSubDetails.appendChild(i._createCells(i._getTimelineVisibleCellsCount()))):"month"===i.view&&"day"===i.monthScale?(a=3,i.$.timelineViewSubDetails.classList.remove("smart-hidden"),i.$.timelineViewSubDetails.appendChild(i._createCells(t.day))):"year"===i.view&&(a=3,i.$.timelineViewSubDetails.classList.remove("smart-hidden"),i.$.timelineViewSubDetails.appendChild(i._createCells(t.month))),i.hideTimelineHeader&&(i.$.timelineViewCells.classList.add("smart-hidden"),a--),i.hideTimelineHeaderDetails&&(i.$.timelineViewDetails.classList.add("smart-hidden"),a--),i.hideTimelineSecondHeaderDetails&&("quarter"===i.view?i.$.timelineViewDetails.classList.add("smart-hidden"):i.$.timelineViewSubDetails.classList.add("smart-hidden"),("year"===i.view||"month"===i.view&&"day"===i.monthScale||"quarter"===i.view)&&a--),i.$.taskTable.style.setProperty("--smart-table-column-header-height","calc("+a+" * var(--smart-gantt-chart-task-default-height) - calc("+a+" * var(--smart-border-width) / "+a+"))"),i.$.timelineViewCells.innerHTML="",i.$.timelineViewCells.appendChild(i._createCells(i._getTimelineVisibleCellsCount())),i.$.timelineContent.style.width=i.$.timelineHeaderContent.style.width=Math.max(t[n]*i._timelineCells[0].width,i.$.timeline.parentElement.offsetWidth)+"px",i.scrollLeft){const e=i._getScrollLeft(i.scrollLeft);i.$.timelineHeader.scrollLeft=e,i.$.mainSplitter.contains(i.$.resourceTimelineHeader)&&(i.$.resourceTimelineHeader.scrollLeft=e)}i._refreshHeaderDate(),i._setCurrentTimeIndicators()}_createTimelineContent(){const e=this,t=e.$.container,i=e.$.timelineContent,n=e._taskDefaultHeight,a=e.$.taskTimelineContainer,s=e.scrollLeft;if(i.style.height="",t.style.removeProperty("--smart-gantt-chart-task-timeline-content-height"),e._createTimelineVCells(n),i.style.height=e._timelineVCells.length*n+"px",t.style.setProperty("--smart-gantt-chart-task-timeline-content-height",e.$.timeline.offsetHeight+"px"),s||s!==a.scrollLeft){const t=e._getScrollLeft(e.scrollLeft);a.scrollLeft=t,e.$.mainSplitter.contains(e.$.resourceTimelineHeader)&&(e.$.resourceTimelineContent.scrollLeft=t)}e.scrollTop&&(a.scrollTop=e.scrollTop),e._recycleContentCells()}_createDateMarkers(){const e=this,t=e.dateMarkers;let i=[];delete e._markers;for(let n=0,a=t.length;n<a;n+=1){const a=t[n],s=e._dateValidator(void 0,a.date);if(s){const e={date:s},t=a.label,n=a.className;("string"==typeof t||"number"==typeof t&&!isNaN(t))&&(e.label=t),"string"==typeof n&&(e.className=n),i.push(e)}}i.length&&(e._markers=i),e._recycleDateMarkers()}_createTimelineRowCells(e,t){const i=this,n=e.children,a=e.querySelectorAll(".smart-task-bar-limiter"),s=document.createDocumentFragment(),[r,o]=i.rightToLeft?["right","left"]:["left","right"];t||(t=i.$.timelineViewCells.children);for(let e=0,t=a.length;e<t;e+=1)a[e].remove();const l=t.length;for(;e.childElementCount>l;)e.lastElementChild.remove();for(let t=e.childElementCount;t<l;t+=1){const e=document.createElement("div");e.classList.add("smart-timeline-cell"),s.appendChild(e)}s.childElementCount&&e.appendChild(s);for(let e=0;e<l;e+=1){const i=t[e],a=n[e];i.hasAttribute("weekend")?a.setAttribute("weekend",""):a.removeAttribute("weekend"),i.hasAttribute("nonworking")?a.setAttribute("nonworking",""):a.removeAttribute("nonworking"),a.style[o]=i.style[o],a.style[r]=i.style[r],a.style.width=i.style.width}for(let t=0,i=a.length;t<i;t+=1)e.appendChild(a[t])}_recycleTimelineRowCells(){const e=this,t=e.$.timelineViewCells.children,i=e.$.taskTimelineCellsContainer.children;for(let n=0,a=i.length;n<a;n+=1)e._createTimelineRowCells(i[n],t)}_createTimelineVCells(e){const t=this,i=t._tasks,n=t.$.taskTable.rows,a=t.groupByResources;let s=0,r={};t._timelineVCells=[];for(let o=0,l=n.length;o<l;o++){const l=n[o].data;let d=i[l.itemIndex];if(a)if(!d&&l.groupDataField){const e=l.$.id;d={$:{id:e,project:void 0},label:t._formatResourceGroupLabel(l.label),value:l.label,expanded:l.expanded,synchronized:!0,isGroup:!0,type:"project"},r[e]=d}else l.parent?(d.$.group=r[l.parent.$.id],t._synchronizeProjectDates(d.$.group,[d])):delete d.$.group;else delete d.$.group;!d.hidden&&t._isTaskExpanded(d)&&(t._timelineVCells.push({top:s,height:e,task:d}),s=parseFloat((s+e).toFixed(2)))}}_getCellsViewType(){const e=this;switch(e.view){case"quarter":case"year":return"month";case"month":return"day"===e.monthScale?"day":"week";case"week":return"day";case"day":return"hour"}}_createTimelineCellsObj(e,t){const i=this,n=i._getCellsViewType();t=t[n];const a=i.$.timeline.parentElement.offsetWidth;let s=Math.max(i._timelineCellSize,i._timelineCellMinSize),r=0,o=new Date(e);t*s<a&&(s=a/t),s=parseFloat(s.toFixed(2)),i._timelineCells=[];for(let e=0;e<t;e++){const e={left:r,width:s};if("year"===n||"quarter"===n)o.setMonth(0),e.date=new Date(o),o.setFullYear(o.getFullYear()+1);else if("month"===n)o.setDate(1),e.date=new Date(o),o.setMonth(o.getMonth()+1);else if("week"===n)o.setHours(0,0,0,0),o.setDate(o.getDate()-o.getDay()),e.date=new Date(o),o.setDate(o.getDate()+7);else if("day"===n)i.nonworkingDays.indexOf(o.getDay())>-1&&(e.nonworking=!0),o.setHours(0,0,0,0),e.date=new Date(o),o.setDate(o.getDate()+1),e.weekend=0===e.date.getDay()||6===e.date.getDay();else if("hour"===n){(i.nonworkingHours.indexOf(o.getHours())>-1||i.nonworkingDays.indexOf(o.getDay())>-1)&&(e.nonworking=!0),o.setHours(o.getHours(),0,0,0),e.date=new Date(o);const t=o.getTime();o.setHours(o.getHours()+1),t===o.getTime()&&o.setHours(o.getHours()+2),e.weekend=0===e.date.getDay()||6===e.date.getDay()}i._timelineCells.push(e),r=parseFloat((r+s).toFixed(2))}}_createTimelineHeaderSubCellsObj(e,t){const i=this,n=i._getCellsViewType();t="month"===i.view&&"day"===i.monthScale?t.day:t[n];const a=i.$.timeline.parentElement.offsetWidth;let s=Math.max(i._timelineCellSize,i._timelineCellMinSize),r=0,o=new Date(e);t*s<a&&(s=a/t),s=parseFloat(s.toFixed(2)),i._timelineHeaderSubCells=[];for(let e=0;e<t;e++){const e={left:r,width:s};if("year"===n||"quarter"===n)o.setMonth(0),e.date=new Date(o),o.setFullYear(o.getFullYear()+1);else if("month"===n)o.setDate(1),e.date=new Date(o),o.setMonth(o.getMonth()+1);else if("week"===n)o.setHours(0,0,0,0),o.setDate(o.getDate()-o.getDay()),e.date=new Date(o),o.setDate(o.getDate()+7);else if("day"===n)i.nonworkingDays.indexOf(o.getDay())>-1&&(e.nonworking=!0),o.setHours(0,0,0,0),e.date=new Date(o),o.setDate(o.getDate()+1),e.weekend=0===e.date.getDay()||6===e.date.getDay();else if("hour"===n){(i.nonworkingHours.indexOf(o.getHours())>-1||i.nonworkingDays.indexOf(o.getDay())>-1)&&(e.nonworking=!0),o.setHours(o.getHours(),0,0,0),e.date=new Date(o);const t=o.getTime();o.setHours(o.getHours()+1),t===o.getTime()&&o.setHours(o.getHours()+2),e.weekend=0===e.date.getDay()||6===e.date.getDay()}i._timelineHeaderSubCells.push(e),r=parseFloat((r+s).toFixed(2))}}_createTimelineHeaderCellsObj(e,t){const i=this;let n=i.view,a=0,s=new Date(e);"quarter"===n&&(n="year"),t=t[n],i._timelineHeaderCells=[];for(let e=0;e<t;e++){const t={};switch(t.date=new Date(s),n){case"quarter":case"year":s.setFullYear(s.getFullYear()+1);break;case"month":s.setDate(1),s.setMonth(s.getMonth()+1);break;case"week":s.setDate(s.getDate()+7);break;case"day":s.setDate(s.getDate()+1)}a=i._refreshViewDetailCell(t,a,e),i._timelineHeaderCells.push(t)}}_minMaxDateValidator(e){if(!e||isNaN(e.getTime()))return e;const t=new Date(this.min),i=new Date(this.max);return t&&(e=new Date(Math.max(t.getTime(),e.getTime()))),i&&(e=new Date(Math.min(i.getTime(),e.getTime()))),e}_dateValidator(e,t){const i=this;let n;if(t instanceof Date)return i._minMaxDateValidator(t);if(Smart.Utilities.DateTime&&t instanceof Smart.Utilities.DateTime)return i._minMaxDateValidator(t.toDate());if("string"!=typeof t)return i._minMaxDateValidator(e);{const e=/\d+:\d+:\d+/;if("new Date()"===t.trim()||"new Smart.Utilities.DateTime()"===t.trim())return i._minMaxDateValidator(new Date);if(isNaN(Date.parse(t))){const i=/(\d+[,-.\/]{1}\s*\d+[,-.\/]{1}\s*\d+)/;if(i.test(t)){const a=i.exec(t)[0].replace(/[,-.\/]/g,",").split(",");if(3===a.length){const[i,s]=parseInt(a[0])<parseInt(a[2])?[a[0],a[2]]:[a[2],a[0]];if(n=new Date(parseInt(s),parseInt(a[1])-1,parseInt(i)),e.test(t)){const i=e.exec(t)[0].split(":");n.setHours(i[0]||0,i[1]||0,i[2]||0)}t=n}}}else n=new Date(Date.parse(t)),e.test(t)||n.setHours(0,0,0,0),t=n}return i._minMaxDateValidator(new Date(t))}_currentTimeIndicatorIntervalValidator(e,t){return Math.max(1,t)}_getTaskBarPositionLimits(e,t){const i=this;function n(e){const t=i._getTimelineTaskCellByDate(e);if(t)return t.left+i._getTimelineTaskOffset(t,e)||0}return{min:n(e["min"+t]),max:n(e["max"+t])}}_getTimelineTaskOffset(e,t){if(!e)return;let i,n;switch(this.view){case"quarter":case"year":{const a=t.getHours()/24+t.getMinutes()/1440+t.getSeconds()/86400;i=new Date(e.date.getFullYear(),e.date.getMonth()+1,0),n=(t.getDate()-1+a)/i.getDate()*e.width;break}case"month":n=t.getDay()/7*e.width;break;case"week":n=parseFloat(t.getHours()+t.getMinutes()/60+t.getSeconds()/3600)/24*e.width;break;case"day":n=parseFloat(t.getMinutes()+t.getSeconds()/60)/60*e.width}return n}_getTaskBarSizeLimits(e,t){const i=this,n=i._getTaskBarDateRange(e);let a,s=0,r=i._convertDuration(e._cellObj.task.minDuration)||i._getMinDuration(e,t),o=i._convertDuration(e._cellObj.task.maxDuration);function l(a,s){if(!a)return;let r,o;"left"===t&&!i.rightToLeft||"right"===t&&i.rightToLeft?(a*=-1,o=n.dateEnd):o=n.dateStart,s&&Math.abs(r)===Math.abs(a)&&(r=0);let l=i._getTaskWorkingDateEnd({dateStart:o},a);const d=l.getTime()+60*(l.getTimezoneOffset()-o.getTimezoneOffset())*1e3,c=i._getTimelineTaskCellByDate(new Date(d));if(!c)return;const m=i._getTimelineTaskOffset(c,new Date(d));return i.rightToLeft?"left"===t?m-(i.$.timelineContent.offsetWidth-e.offsetLeft-e.offsetWidth-c.left):i.$.timelineContent.offsetWidth-e.offsetLeft-c.left-m:"left"===t?e.offsetLeft+e.offsetWidth-c.left-m:c.left-e.offsetLeft+m}if("left"===t&&!i.rightToLeft||"right"===t&&i.rightToLeft){const t=e._cellObj.task.maxDateStart,i=e._cellObj.task.minDateStart;i&&(s=60*(i.getTimezoneOffset()-n.dateEnd.getTimezoneOffset())*1e3,a=Math.abs(i.getTime()-n.dateEnd.getTime())+s,o=o?Math.min(a,o):a),t&&(s=60*(t.getTimezoneOffset()-n.dateEnd.getTimezoneOffset())*1e3,a=Math.abs(t.getTime()-n.dateEnd.getTime())+s,r=r?Math.max(a,r):a)}else{const t=e._cellObj.task.maxDateEnd,i=e._cellObj.task.minDateEnd;i&&(s=60*(i.getTimezoneOffset()-n.dateStart.getTimezoneOffset())*1e3,a=Math.abs(i.getTime()-n.dateStart.getTime())+s,r=r?Math.max(a,r):a),t&&(s=60*(t.getTimezoneOffset()-n.dateStart.getTimezoneOffset())*1e3,a=Math.abs(t.getTime()-n.dateStart.getTime())+s,o=o?Math.min(a,o):a)}return o&&(r=Math.min(r,o)),{min:l(r,!0),max:l(o)}}_getMinDuration(e,t){const i=this,n=i._taskBarMinWidth;if(!n||!i._timelineCells||0===i._timelineCells.length)return;const a=e._cellObj.task;let s,r,o=1;r=i.rightToLeft?parseFloat(e.style.right)||i.$.timelineContent.offsetWidth-e.offsetLeft-e.offsetWidth:parseFloat(e.style.left)||e.offsetLeft,"left"===t?(s=a.dateEnd,r+=parseFloat(e.style.width)||e.offsetWidth,o=-1):s=a.dateStart;const l=r+o*n;let d;for(let e=0;e<i._timelineCells.length;e++){const t=i._timelineCells[e];if(l<t.left)break;d=t}const c=i._getDateFromCell(l,d);return c?Math.abs(s.getTime()-c.getTime()):void 0}_createDelimiter(e,t){const i=this,n=i._dragDetails,a=n.segment,s=e.slice(0,3),r=document.createElement("div");if(r.classList.add("smart-task-bar-limiter",e),e.indexOf("date")>-1){if(!n[s]||!n[s].left)return;const[e,t]=a?[a.element,a.originalPosition.x]:[n.timelineTask,0],o=i.$.taskTimelineCellsContainer.children[i._getTaskDOMIndex(n.task)];s.indexOf("max")>-1?r.style.width=o.offsetWidth-n[s].left-t-e.offsetWidth+"px":r.style.width=n[s].left+t+"px"}else{if(!n[s].width)return;r.style["left"===t?"right":"left"]=n[s].width+"px"}return r}_doubleClickHandler(e){const t=this;let i=e.target;if(t.disabled||t.disableWindowEditor)return;t.shadowRoot&&i===t&&(i=e.composedPath()[0]);let n=i.closest?i.closest(".smart-task-connection"):void 0;if(n)t._openPopupWindow(n);else if(n=i.closest(".smart-timeline-task")||i.closest(".smart-table tbody tr[row-id]"),n&&t.$.taskSplitter.contains(n))if(n.classList.contains("smart-timeline-task"))t._openPopupWindow(n._cellObj.task);else{const e=t._getVCellById("task",n.getAttribute("row-id"));e&&t._openPopupWindow(e.task)}}_checkDoubleClick(e){const t=this;let i=e.target;if(t.shadowRoot&&i===t&&(i=e.composedPath()[0]),void 0===t._dblClickDetails&&(t._dblClickDetails={clicks:0}),clearTimeout(t._dblClickDetails.timeOut),i!==t._dblClickDetails.target&&(t._dblClickDetails.clicks=0),t._dblClickDetails.target=i,t._dblClickDetails.clicks++,t._dblClickDetails.timeOut=setTimeout((function(){t._dblClickDetails&&(t._dblClickDetails.clicks=0)}),250),2===t._dblClickDetails.clicks)return t._doubleClickHandler(e),t._dblClickDetails.clicks=0,!0}_downHandler(e){const t=this,i=e.originalEvent,n=t.shadowRoot||t.isInShadowDOM?i.composedPath()[0]:i.target,a=n.closest?n.closest(".smart-timeline-row")||n.closest(".smart-timeline-task"):null;if(e.stopPropagation(),delete t._itemClickDetails,t._dragDetails)return delete t._dragDetails,void t._setConnectionFeedback();const s=t.$.taskSplitter.contains(n)?"task":"resource";if((n.closest(".smart-timeline-content")||n.closest(`.smart-${s}-table`))&&requestAnimationFrame((()=>t.$[`${s}Table`].focus({preventScroll:!0}))),t._itemClickDetails={target:n},!t._isMobile&&0!==e.button)return;if(!a){if(n.classList.contains("smart-popup-window-modal")){if(t._popupWindow){const e=Object.keys(t._popupWindow);requestAnimationFrame((()=>t._popupWindow[e[e.length-1]].focus()))}return}return void((n.closest(".smart-table tbody tr[row-id]")&&!n.classList.contains("smart-arrow")||n.closest(".smart-task-connection"))&&t._checkDoubleClick(i))}if(n.closest(".smart-resource-timeline-view-cell")||t.disabled)return;const r=Array.from(t.$.timelineTasksContainer.children).find((e=>e._cellObj.task===a._cellObj.task));if(!r)return;const o=r._cellObj.task;if(!o)return;const l=t.$.timeline.getAttribute("task-bar-hovered");if(r.getElementsByClassName("smart-timeline-task-fill")[0]||l){if((n.closest(".smart-timeline-task-fill")||r.classList.contains("milestone")&&n.closest(".smart-task-container"))&&t._checkDoubleClick(i))return;const a=n.closest(".smart-timeline-task-progress-thumb"),s=e.pageX-window.pageXOffset,d=e.pageY-window.pageYOffset,c=t._dragDetails={},m=t.rightToLeft;let u,h=n.closest(".smart-task-segment");if(l&&!h){const e=r.querySelectorAll(".smart-task-segment");c.segments=e,h="left"===l&&!m||"right"===l&&m?e[0]:e[e.length-1]}if(c.target=(a||n).className,c.timelineTask=r,c.task=r._cellObj.task,c.taskDimensions={width:r.offsetWidth,height:r.offsetHeight,left:r.offsetLeft,top:r.offsetTop},c.coordinates={x:s,y:d},!e.ctrlKey&&h&&o.segments&&o.segments.length>1&&!t.disableSegmentDrag){const e=h.getBoundingClientRect(),t=h._segmentObj,i=c.task.segments,n=i.indexOf(t);c.segment={element:h,dimensions:{width:e.width,left:h.offsetLeft},offset:{x:s-e.left},originalSize:{width:e.width},isFirstSegment:0===n,isLastSegment:n===i.length-1,min:{},max:{}},u=c.segment.dimensions}const g=c.taskDimensions;t.rightToLeft?(g.right=t.$.timelineContent.offsetWidth-(g.left+g.width),c.originalPosition={x:g.right,y:g.top},c.segment&&(u.right=g.width-(u.left+u.width),c.segment.originalPosition={x:u.right})):(c.originalPosition={x:g.left,y:g.top},c.segment&&(c.segment.originalPosition={x:u.left}));const f=(a||r).getBoundingClientRect();if(c.offset={x:s-f.left,y:d-f.top},c.originalSize={width:g.width,height:g.height},a||!a&&"project"===o.type&&o.synchronized&&!o.dragProject)return void(n.closest(".smart-task-connection-point")&&(c.timelineTask=void 0,c.relatedConnections={}));("visible"===t.resizeHandlesVisibility||t._isMobile&&"auto"===t.resizeHandlesVisibility)&&(n.closest(".smart-timeline-task-fill")?t._checkTaskBarResizability(e):t.$.timeline.removeAttribute("task-bar-hovered")),c.min={},c.max={},t._setDragLimits(n)}}_documentMoveHandler(e){const t=this;if(!t._dragDetails||!t._dragDetails.target){let i=e.originalEvent.target;t.shadowRoot&&i===t&&(i=e.originalEvent.composedPath()[0]);const n=i.closest&&i.closest(".smart-table tbody tr[row-id]");return n&&n.data?t._handleTableItemHover(n.data.itemId,i):t._handleTimelineHover(e),t._checkTaskBarResizability(e),void t._toggleTooltip(e.originalEvent)}if(t._dragDetails.target.includes("smart-task-connection-point"))return t._setConnectionFeedback(e),t._handleTimelineHover(e),void t._autoScroll(e);if(t._dragDetails.target.includes("smart-timeline-task-progress-thumb"))t._handleTaskProgressChange(e);else if(t._autoScroll(e),!t._autoScrolling)if(t.$.timeline.hasAttribute("task-bar-hovered"))t._handleTaskBarResize(e);else if(t._dragDetails.target.includes("smart-timeline-task-fill")){const i=t._dragDetails.task;if(!i||i.disableDrag||"project"===i.type&&i.synchronized&&!i.dragProject)return;t._handleTaskBarDrag(e)}}_documentUpHandler(e){const t=this,i=e.originalEvent;let n=i.target;if(t._upHandler(),!t._dragDetails)return void t._handleItemClick(i);if(t._scrollView.disableSwipeScroll=t._touchmoveInside=!1,t.shadowRoot&&n===t&&(n=i.composedPath()[0]),t.hasAttribute("connecting-task")){const i=t._connectTask(e),n=t._tasks;if(t._setConnectionFeedback(),i){const e=i.taskStart,a=i.taskEnd,[s,r,o]=[n.indexOf(i.taskStart),n.indexOf(i.taskEnd),i.type];t.$.fireEvent("connectionEnd",{id:`${s}-${r}-${o}`,startIndex:s,startTaskId:"string"==typeof e.id||"number"==typeof e.id?e.id:e.$.id,endIndex:r,endTaskId:"string"==typeof a.id||"number"==typeof a.id?a.id:a.$.id,type:o}),t._autoSchedule(i.taskStart)}return t._isMobile&&t._handleTimelineHover(e,!0),void delete t._dragDetails}const a=t._dragDetails.task;if(!a)return void delete t._dragDetails;let s;const r=t._dragDetails.segment?t._dragDetails.segment.element:void 0;if(s||(s=Array.from(t.$.timelineTasksContainer.children).find((e=>e._cellObj.task===a))),t.hasAttribute("dragged")){t._snapToNearest(s,r),r||t._checkWorkingDays(s,r),t._refreshProject(a.$.project),t.groupByResources&&t._refreshProject(a.$.group),t._autoSchedule(a),t._resourceTreeRefreshTimeout?(clearTimeout(t._resourceTreeRefreshTimeout),delete t._resourceTreeRefreshTimeout,t._refreshAssignedResources(a)):(t.snapToNearest||t.nonworkingDays.length>0||t.nonworkingHours.length>0)&&t._refreshAssignedResources(a),t.removeAttribute("dragged");const e={id:"string"==typeof a.id||"number"==typeof a.id?a.id:a.$.id,item:t._cloneObject(a),dateStart:new Date(a.dateStart),dateEnd:new Date(a.dateEnd)};r&&(e.segment=t._cloneObject(r._segmentObj)),t.$.fireEvent("dragEnd",e)}else if(t.hasAttribute("progress-change"))t._resourceTreeRefreshTimeout&&(clearTimeout(t._resourceTreeRefreshTimeout),delete t._resourceTreeRefreshTimeout,t._refreshAssignedResources(a,["progress"])),t.removeAttribute("progress-change"),t.$.fireEvent("progressChangeEnd",{id:"string"==typeof a.id||"number"==typeof a.id?a.id:a.$.id,item:t._cloneObject(a),progress:a.progress||0});else if(t.hasAttribute("resized")){t._snapToNearest(s,r),t._refreshProject(a.$.project),t.groupByResources&&t._refreshProject(a.$.group),t._resourceTreeRefreshTimeout?(clearTimeout(t._resourceTreeRefreshTimeout),delete t._resourceTreeRefreshTimeout,t._refreshAssignedResources(a,["workload"])):t.snapToNearest&&t._refreshAssignedResources(a,["workload"]),t.removeAttribute("resized");const e={id:"string"==typeof a.id||"number"==typeof a.id?a.id:a.$.id,item:t._cloneObject(a),dateStart:a.dateStart,dateEnd:a.dateEnd};r&&(e.segment=t._cloneObject(r._segmentObj)),t.$.fireEvent("resizeEnd",e),t._autoSchedule(a)}else n.closest(".smart-timeline-task")===s&&(t._select("task",a.$.id,!0),delete t._dragDetails,t._handleItemClick(i));const o=t.$.timelineContent.querySelectorAll(".smart-task-bar-limiter");for(let e=0,t=o.length;e<t;e+=1)o[e].remove();delete t._dragDetails}_handleItemClick(e){const t=this,i=e.target;if(t._dragDetails||!t._itemClickDetails||t._itemClickDetails.target!==i)return void delete t._itemClickDetails;let n,a,s;if(i.closest(".smart-timeline-task-fill"))a=i.closest(".smart-timeline-task")._cellObj.task,s="task";else if(n=i.closest(".smart-task-connection"),n)a=n.getAttribute("connection-id").split("-"),a={source:a[0],target:a[1],type:a[2]},s="connection";else if(i.closest(".milestone"))a=i.closest(".milestone")._cellObj.task,s="milestone";else if(n=i.closest(".smart-table tbody tr"),n){const e=t._getVCellById(s,n.getAttribute("row-id"));s=t.$.taskTable.contains(n)?"task":"resource",a=e?e[s]:void 0}if(!a)return;const r={originalEvent:e,type:s,item:t._cloneObject(a)};r.id="connection"===s?`${a.source}-${a.target}-${a.type}`:"string"==typeof a.id||"number"==typeof a.id?a.id:a.$.id,delete t._itemClickDetails,t.$.fireEvent("itemClick",r)}_moveHandler(e){const t=this;t._isMobile||e.stopPropagation(),(t.hasAttribute("dragged")||t.hasAttribute("progress-change"))&&"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_handleTableItemHover(e,t){const i=this,n=i._hoveredItem;let a,s;if(t&&([a,s]=i.$.taskSplitter.contains(t)?[i.$.taskTable,"task"]:[i.$.resourceTable,"resource"]),n&&"itemType"===n.type&&n.id===e)return;const r=i.$.mainSplitter.querySelectorAll("table tbody tr[hover]");for(let e=0;e<r.length;e++)r[e].removeAttribute("hover");if(void 0===e)return void i._handleTimelineHover({target:i});if(!a)return;i._setTableHoverState(a,e);const o=i.$["task"===s?"taskTimelineCellsContainer":"resourceTimelineCellsContainer"].children;for(let t=0,n=o.length;t<n;t+=1){const n=o[t];if(n._cellObj[s].$.id===e){i._handleTimelineHover({target:n});break}}}_setTableHoverState(e,t){const i=this;e||(e=i.$.taskTable);const n=e===i.$.taskTable?"task":"resource",a=e.querySelectorAll("table tbody tr");if(!i._isMobile&&i[n+"Columns"].length)for(let e=0;e<a.length;e++){let i=a[e];const n=i.data;n&&n.itemId===t&&i.setAttribute("hover","")}}_checkWorkingDays(e){const t=this,i=t._dragDetails;if(!(i&&i._taskDuration||t._timelineCells.length))return;if(!e.classList||!e.classList.contains("smart-timeline-task")||!t.hasAttribute("dragged")||0===t.nonworkingDays.length&&0===t.nonworkingHours.length||!i||!i._taskDuration)return;const n=e._cellObj,a=n.task,s=t._getTaskWorkingDateEnd(a),r=a.segments;let o=new Date(t._timelineCells[t._timelineCells.length-1].date);if("year"===t.view||"quarter"===t.view?(o.setMonth(o.getMonth()+1),o.setDate(0),o.setHours(23,59,59,999)):"month"===t.view?(o.setDate(o.getDate()+6-o.getDay()),o.setHours(23,59,59,999)):"week"===t.view?o.setHours(23,59,59,999):o.setHours(o.getHours(),59,59,999),s&&(a.dateEnd=a.maxDateEnd?new Date(Math.min(s.getTime(),a.maxDateEnd.getTime())):s),a.dateEnd=new Date(Math.min(o.getTime(),a.dateEnd.getTime())),a.duration=t._convertDuration(t.nonworkingDays.length>0||t.nonworkingHours.length>0?t._getWorkingTime(a.dateStart,a.dateEnd):a.dateEnd.getTime()-a.dateStart.getTime(),!0),r&&r.length>1){for(let e=0,i=r.length;e<i;e+=1)t._snapToNearestDates(r[e],!0);t._validateTaskSegments(a),a.segments.length!==r.length&&t._recycleSegments(a,e),t._setTaskBarSegments(n,e,!0),t._setTaskBarProgress(a)}t._setTimelineTaskBar(n,void 0,!0),t._refreshTaskConnections(n.task),t._refreshTableColumnsData(a,["dateEnd","duration","overdue"])}_getTaskWorkingDateEnd(e,t){const i=this;if(!e||!e.dateStart)return;let n,a,s=new Date(e.dateStart);if(t||(t=i._dragDetails?i._dragDetails._taskDuration:i._getWorkingTime(e.dateStart,e.dateEnd)),!i.adjustToNonworkingTime)return new Date(e.dateStart.getTime()+t);const r=t<0?-1:1,o=i.nonworkingDays,l=i.nonworkingHours;for(t=Math.abs(t);t>0;){const e=Math.min(t,36e5-(60*s.getMinutes()*1e3+1e3*s.getSeconds()+s.getMilliseconds()));if(o.indexOf(s.getDay())>-1)a=new Date(s),a.setHours(0,0,0,0),a.setDate(s.getDate()+1*r),n=Math.min(e,a.getTime()-s.getTime()),s=new Date(s.getTime()+n);else if(l.indexOf(s.getHours())>-1){a=new Date(s);const t=a.getTime();a.setHours(s.getHours()+1*r,0,0,0),t===a.getTime()&&a.setHours(s.getHours()+2*r,0,0,0),n=Math.min(e,a.getTime()-s.getTime()),s=new Date(s.getTime()+n)}else t-=e,s=new Date(s.getTime()+r*e)}return s}_createConnectingElement(e,t,i,n,a){const s=this;if(!s._connectionDetails||!s._connectionDetails.start)return;const r=s._connectionDetails,o=r.type,l=s.$.timelineConnectionsContainer;let d=r.connections.shift();d||(d=document.createElement("div"),d.classList.add("smart-task-connection")),d.style.width=d.style.width="","horizontal"===n?(d.style.width=Math.abs(i)+"px",d.style.height=""):(d.style.width="",d.style.height=Math.abs(i)+"px"),d.style[s.rightToLeft?"left":"right"]="",d.style[s.rightToLeft?"right":"left"]=e+"px",d.style.top=t+"px",d.setAttribute("connection-id",r.id);const c=r.start.task.label,m=0===o||3===o?"start":"end",u=r.end.task.label,h=0===o||1===o?"start":"end";if(d.setAttribute("aria-label","Connection between "+c+" ("+m+") and "+u+" ("+h+")"),a){let e=0===o||1===o?"right":"left";s.rightToLeft&&(e="left"===e?"right":"left"),d.setAttribute("arrow-direction",e)}else d.removeAttribute("arrow-direction");d.parentElement||l.appendChild(d)}_getConnectionType(e,t){if(!e||!t)return;let i,n;return"string"==typeof e?i=!e.includes("end"):e instanceof HTMLElement&&(i=!e.classList.contains("end")),"string"==typeof t?n=t.includes("end"):t instanceof HTMLElement&&(n=t.classList.contains("end")),i&&!n?0:i||n?!i&&n?2:i&&n?3:void 0:1}_setConnectionFeedback(e){const t=this,i=t._dragDetails;if(!i||!i.target||!e){const e=t._connectionFeedback;return e&&e.parentElement&&e.remove(),t.removeAttribute("connecting-task"),void delete t._connectionFeedback}if(!i.target||!i.target.includes("smart-task-connection-point"))return;const n=i.task,a=i.taskDimensions;if(!n)return;if(!t.hasAttribute("connecting-task")){if(t.$.fireEvent("connectionStart",{startIndex:t._tasks.indexOf(n)}).defaultPrevented)return void delete t._dragDetails.target;t.setAttribute("connecting-task",""),t._isMobile&&(t._scrollView.disableSwipeScroll=t._touchmoveInside=!0)}const s="milestone"===n.type,r=t.rightToLeft;let o=s?-1*a.height/2:0;t._dragDetails.target.includes("end")&&(o=s?-1*o:a.width),t._connectionFeedback||(t._connectionFeedback=document.createElement("div"),t._connectionFeedback.classList.add("smart-task-connection-feedback"));const l=t._dragDetails.coordinates.x+(r?-1:1)*o,d=t._dragDetails.coordinates.y,c=t._dragDetails.offset.x-(r?a.width:0),m=t._dragDetails.offset.y,u=e.pageX-window.pageXOffset+c,h=e.pageY-window.pageYOffset+m-a.height/2;r?(t._connectionFeedback.style.left="",t._connectionFeedback.style.right=a.right+o+"px"):(t._connectionFeedback.style.left=a.left+o+"px",t._connectionFeedback.style.right=""),t._connectionFeedback.style.top=a.top+a.height/2+"px",t._connectionFeedback.style.width=Math.sqrt(Math.pow(Math.abs(u-l),2)+Math.pow(Math.abs(h-d),2))+"px",t._connectionFeedback.style.transform=t.rightToLeft?"rotate("+180*(Math.atan2(d-h,l-u)||0)/Math.PI+"deg)":"rotate("+180*(Math.atan2(h-d,u-l)||0)/Math.PI+"deg)",t._connectionFeedback.parentElement||t.$.timelineContent.appendChild(t._connectionFeedback)}_connectTask(e){const t=this,i=t._tasks;let n,a,s,r,o,l,d,c,m;if(e.originalEvent){const r=e.originalEvent;let o=t._isMobile?document.elementFromPoint(r.pageX-window.pageXOffset,r.pageY-window.pageYOffset):r.target;if(!(t._dragDetails&&t._dragDetails.target&&o&&o.classList))return;if(t.shadowRoot&&o===t&&(o=t._isMobile?t.shadowRoot.elementFromPoint(r.pageX-window.pageXOffset,r.pageY-window.pageYOffset):r.composedPath()[0]),n=t._dragDetails.target.includes("smart-task-connection-point")?t._dragDetails.target:void 0,a=o.classList.contains("smart-task-connection-point")?o:void 0,n&&(l=t._dragDetails.task),a)s=a.closest(".smart-timeline-task");else if(t._isMobile&&o.classList.contains("smart-timeline-task-fill")&&(s=o.closest(".smart-timeline-task"),s)){const e=r.pageX-window.pageXOffset-s.getBoundingClientRect().left;a=s.querySelector(".smart-task-connection-point."+(e>=s.offsetWidth/2?"end":"start"))}if(!l||!s)return;d=s._cellObj.task;for(let e=0,t=i.length;e<t;e+=1){const t=i[e];if(t!==l)if(t!==d){if(void 0!==c&&void 0!==m)break}else m=e;else c=e}}else{if(!e||e.length<3)return;const n=t._getValidConnectionId(e[0],e[1],e[2],"_connectTask");if(void 0===n)return;[c,m]=[parseInt(n[0]),parseInt(n[1])],[l,d]=[i[c],i[m]],r=parseInt(e[2]),o=e[4]||0}if(!l||!d||l===d||l.isGroup||d.isGroup||t._isAutoScheduled(l,d)||t.hasAttribute("dragged")||t.hasAttribute("resized"))return;void 0===r&&(r=t._getConnectionType(n,a));let u=t._connections;return u||(t._connections=u=[]),t._updateConnection([c,m,r,o])?(e.originalEvent&&t._recycleConnections([{startIndex:c,endIndex:m,type:r}]),e.originalEvent&&t.$.fireEvent("itemInsert",{type:"connection",item:{source:c,target:m,type:r}}),{taskStart:l,taskEnd:d,type:r}):void 0}_recycleConnections(e){const t=this,i=t._tasks;if(e?Array.isArray(e)||(e=[e]):e=t._connections,!i||!i.length||!e)return;const n=t.$.timelineTasksContainer.children,a=t.$.timelineConnectionsContainer;let s,r=[];if(n.length){const a=n[0],o=(()=>{let e=[];for(let t=0,a=n.length;t<a;t+=1)e.push(i.indexOf(n[t]._cellObj.task));return e})(),l=a.querySelector(".smart-task-connection-point."+(t.rightToLeft?"end":"start")),d=t._baselineProportion,c=t.showBaseline?t._taskDefaultHeight/d:0;s={top:l.offsetTop,width:l.offsetWidth},s.offset=Math.abs(l.offsetLeft)-s.width;for(let n=0,a=e.length;n<a;n+=1){const a=e[n],l=a.startIndex,d=a.endIndex;if(o.indexOf(l)<0&&o.indexOf(d)<0)continue;const m=i[l],u=i[d],{vCellStart:h,vCellEnd:g}=t._getTasksVCell(m,u);if(!h||!g)continue;const f=a.type,p={start:{width:s.width,top:s.top,index:l,task:m},end:{width:s.width,top:s.top,index:d,task:u},type:f},_=t._getTaskBarDetails(h,t._getTimelineCellByDate(m.dateStart),t._getTimelineCellByDate(m.dateEnd)),T=t._getTaskBarDetails(g,t._getTimelineCellByDate(u.dateStart),t._getTimelineCellByDate(u.dateEnd));"milestone"===m.type&&(_.width=h.height-c),"milestone"===u.type&&(T.width=h.height-c),p.start.left=0===f||3===f?-1*(s.width+s.offset):_.width+s.offset,p.end.left=0===f||1===f?-1*(s.width+s.offset):T.width+s.offset,t._connectionDetails=p,_.height=T.height=h.height-c,_.type=m.type,T.type=u.type,t._setConnectionDetails(_,T),t._createTaskConnection(),r.push(t._connectionDetails.id),delete t._connectionDetails}}if(arguments.length)return;const o=Array.from(a.children);for(let e=0,t=o.length;e<t;e+=1){const t=o[e];r.indexOf(t.getAttribute("connection-id"))<0&&t.remove()}}_getTasksVCell(e,t){const i=this._timelineVCells;let n,a;for(let s=0,r=i.length;s<r;s+=1){const r=i[s];if(r.task===e&&(n=r),r.task===t&&(a=r),n&&a)break}return{vCellStart:n,vCellEnd:a}}_isAutoScheduled(e,t,i){const n=this,a=n._tasks;let s={};if(n.autoSchedule)return e instanceof HTMLElement&&(e=e._cellObj.task),t instanceof HTMLElement&&(t=t._cellObj.task),function e(t,r){const o=n._getTaskConnections().taskConnections,l=a.indexOf(t);s[l]=!0;for(let t=0;t<o.length;t++){const d=o[t],c=d.endIndex;if(c===r)return i&&n._removeConnection(l+"-"+c+"-"+d.type,!0),!0;if(!s[c]&&e(a[c],r))return!0}}(t,a.indexOf(e))}_setConnectionDetails(e,t){const i=this;if(!i._connectionDetails)return;const n=i._connectionDetails,a=n.start,s=n.end,r=n.type;if(!a||!s)return;let o,l=e.width,d=t.width,c=e.left,m=t.left,u=e.top,h=t.top,g=a.left,f=s.left;const p=a.index,_=s.index;if("milestone"===e.type&&(l=e.height,c-=l/2),"milestone"===t.type&&(d=t.height,m-=d/2),n.id=p+"-"+_+"-"+r,!n.connectionStartOffset||!n.connectionEndOffset){switch(r){case 0:g=Math.abs(g)-a.width,f=Math.abs(f)-s.width;break;case 1:g-=l,f=Math.abs(f)-s.width;break;case 2:g-=l,f-=d;break;default:g=Math.abs(g)-a.width,f-=d}n.start.offset=g+=a.width/2,n.end.offset=f+=s.width/2}if(0===r&&c>m||1===r&&c+l+g>m-f&&h>u||2===r&&m+d>c+l||3===r&&(c-g<m+d+f&&h>u||c-g>m+d+f&&u>h)){o=!0;let i=e;e=t,t=i,i=g,g=f,f=i,i=l,l=d,d=i,i=c,c=m,m=i,i=u,u=h,h=i}let T=c,b=m;!o&&1===r||o&&3===r?T+=l:!o&&3===r||o&&1===r?b+=d:2===r&&(T+=l,b+=d);let k=i.$.timelineConnectionsContainer.querySelectorAll('.smart-task-connection[connection-id^="'+p+"-"+_+'-"]');0===k.length&&(k=i.$.timelineConnectionsContainer.querySelectorAll('.smart-task-connection[connection-id^="'+_+"-"+p+'"]')),n.connections=[].slice.call(k),n.start.x=T,n.start.y=u+a.top,n.end.x=b,n.end.y=h+s.top,n.type=r,n.inverted=o}_createTaskConnection(){const e=this,t=e._connectionDetails;if(!t)return;const i=2*e._taskConnectionWidth,n=t.start.x,a=t.start.y,s=t.start.offset,r=t.start.top,o=t.end.x,l=t.end.y,d=t.end.offset,c=t.type,m=t.inverted,u=!m&&3===c||m&&1===c,h=!m&&1===c||m&&3===c;let g,f,p,_=n,T=o;u?(_=n-d,T=o+d):h&&(_=n+s,T=o-d);const b=_<=T&&u,k=_>=T&&h,y=2===c||h;!function d(u){g!==o&&(u?"horizontal"===u?(p=g-o+(b?-1:1)*s,g=_>T?g-Math.abs(p):g,e._createConnectingElement(g,f,(_===T?0:Math.abs(p))+(y?i:0),"horizontal"),g=_<T?g-p:g,d("vertical")):(p=Math.abs(f-l),f+=a<l?0:-1*p,g-=m&&1===c||!m&&3===c&&a>l?i:0,e._createConnectingElement(g,f,p,"vertical"),d()):(g?(p=Math.abs(g-o),g>=o&&(g+=-1*p,p+=i),e._createConnectingElement(g,f+(a<l?Math.abs(f-l):0),p,"horizontal",!t.inverted),g=o):(g=n,f=a,(0===c||!m&&3===c||m&&1===c)&&(g-=s),e._createConnectingElement(g,f,s,"horizontal",t.inverted),y&&(g+=s-i),b||k?(e._createConnectingElement(g,f-=a>l?r:0,r,"vertical"),f+=a<l?r:0):d("vertical")),d("horizontal")))}(),t.connections.map((e=>e.parentElement.removeChild(e)))}_getTaskIndexById(e,t){const i=this;if(t||(t=i._tasks),"number"==typeof e)return isNaN(parseInt(e))?-1:parseInt(e);if("object"==typeof e)return i._getItemIndex(e,"task");for(let i=0,n=t.length;i<n;i+=1)if(t[i].id===e)return i;return-1}_refreshTaskConnections(e){const t=this,i=e instanceof HTMLElement?e._cellObj.task:e,n=t._tasks.indexOf(i);if(void 0===n||e.classList&&e.classList.contains("smart-visibility-hidden"))return;let a;if(t._dragDetails&&(a=t._dragDetails.relatedConnections[n]),!a){a=[];const e=t._connections;if(!e||!e.length)return;for(let t=0,i=e.length;t<i;t+=1){const i=e[t];i.startIndex!==n&&i.endIndex!==n||a.push(i)}t._dragDetails&&(t._dragDetails.relatedConnections[n]=a)}t._recycleConnections(a)}_dragStartHandler(e){const t=this,i=e.target.closest;(t._dragDetails||i&&i.call(t,"smart-gantt-chart")===t)&&e.preventDefault()}_getFirstCellObjInView(e){const t=this;if(e||(e=t._timelineCells),!e)return;const i=Math.abs(t.scrollLeft);let n,a;for(let t=0;t<e.length;t++){const s=e[t];if(s.left+s.width>i){n=s;break}a=s}return!n&&a&&(n=i>a.left?a:e[0]),n}_getFirstContentCellInView(e="task"){const t=this;let i,n,a,s;if("task"===e?(i=t._timelineVCells,n=t.scrollTop):(i=t._timelineResourceVCells,n=t.$.resourceVerticalScrollBar.value),!i)return 0;for(let e=0;e<i.length;e++){const t=i[e];if(t.top+t.height>n){a=t;break}s=t}return!a&&s&&(a=n>s.left?s:i[0]),a}_getProjectTasks(e,t){const i=this,n=i.groupByResources&&e.isGroup?"group":"project",a=i._tasks;if(!e||"project"!==e.type)return[];let s=[];for(let r=0,o=a.length;r<o;r+=1){const o=a[r];o.$[n]===e&&(s.push(o),"project"!==o.type||t||(s=s.concat(i._getProjectTasks(o,t))))}return s}_getSubTaskLimits(e){const t=this;if(!e)return;const i=e._cellObj.task,n=t._getProjectTasks(i);let a,s;if(!n.length)return;let r=n[0],o=n[0];for(let e=0;e<n.length;e++){const t=n[e];n[e].dateEnd&&n[e].dateStart&&(r.dateStart||(r=t[e]),o.dateEnd||(o=t[e]),n[e].dateEnd.getTime()>o.dateEnd.getTime()&&(o=n[e]),n[e].dateStart.getTime()<r.dateStart.getTime()&&(r=n[e]))}const l=t.$.timelineContent.offsetWidth;let d,c,m;if(r&&(d=t._getTimelineSubTaskOffset(r),d&&(c=d.left,m=d.width,a=Math.max(0,t.rightToLeft?l-e.offsetLeft-e.offsetWidth-(l-c-m):e.offsetLeft-c))),o&&(d=t._getTimelineSubTaskOffset(o),d))if(c=d.left,m=d.width,t.rightToLeft){const t=l-e.offsetLeft-e.offsetWidth;s=Math.max(t,t+l-(l-c))}else s=Math.max(e.offsetLeft,e.offsetLeft+l-(c+m));return{min:a,max:s}}_getTimelineSubTaskOffset(e){const t=this,i=t.$.timelineTasksContainer.children[t._tasks.filter((e=>!e.hidden)).indexOf(e)];let n,a,s;if(i)n=i.offsetLeft,s=i.offsetWidth;else{const i=t._getTimelineTaskCellByDate(e.dateStart),r=t._getTimelineTaskCellByDate(e.dateEnd);i&&(n=i.left+t._getTimelineTaskOffset(i,e.dateStart)||0),r&&(a=r.left+t._getTimelineTaskOffset(r,e.dateEnd)||0),s=a-n}return{left:n,width:s}}_getTaskDragLimits(e){const t=this,i=t._dragDetails,n=i.segment?i.segment.element:void 0,a=n&&n.previousElementSibling?{}:t._getTaskBarPositionLimits(e._cellObj.task,"DateStart"),s=n&&n.nextElementSibling?{}:t._getTaskBarPositionLimits(e._cellObj.task,"DateEnd"),r=t._dragDetails.taskDimensions;let o={};return(a.min||s.min)&&(o.min=Math.max(a.min||0,Math.max(0,(s.min||0)-r.width))),s.max&&(o.max=Math.max(0,s.max-r.width)),a.max&&(o.max=o.max?Math.min(a.max,o.max):a.max),o}_getTaskBarDateRange(e){if(!e)return;const t=this,i=e.classList.contains("milestone"),n=parseFloat(e.style.width)||e.offsetWidth,a=i?n/2:n,s=t.rightToLeft?parseFloat(e.style.right)||t.$.timelineContent.offsetWidth-e.offsetLeft-a:parseFloat(e.style.left)||e.offsetLeft,r=e._cellStart,o=e._cellEnd,l=e._cellObj.task,d=l.minDateStart,c=l.maxDateEnd;let m,u;return m=t._getDateFromCell(s,r),!d||"project"===e._cellObj.task.type&&e._cellObj.task.synchronized||(m=new Date(Math.max(d.getTime(),m.getTime()))),u=i?new Date(m):t._getDateFromCell(s+a,o),!c||"project"===e._cellObj.task.type&&e._cellObj.task.synchronized||(u=new Date(Math.min(c.getTime(),u.getTime()))),{dateStart:m,dateEnd:u}}_getTaskBarDetails(e,t,i){const n=this,a=e.task;if(!e)return;let s=new Date(a.dateStart);const r=new Date(a.dateEnd);if(!n._dragDetails&&n.snapToNearest){let s,r,o=a.dateStart,l=a.dateEnd;const d=new Date(t.date),c=n._getDateFromCell(t.left+t.width,t),m=new Date(i.date),u=n._getDateFromCell(i.left+i.width,i);return s=c.getTime()-o.getTime()>=c.getTime()-d.getTime()?t.left:t.left+t.width,"milestone"!==a.type&&(r=u.getTime()-l.getTime()>=l.getTime()-m.getTime()?i.left-s:i.left-s+i.width),{left:s,width:r,top:e.top}}let o,l,d,c,m,u;switch(n.view){case"quarter":case"year":{d=new Date(s.getFullYear(),s.getMonth()+1,0).getDate(),c=new Date(r.getFullYear(),r.getMonth()+1,0).getDate();const e=s.getHours()/24+s.getMinutes()/1440+s.getSeconds()/86400,n=r.getHours()/24+r.getMinutes()/1440+r.getSeconds()/86400;o=t.left+(s.getDate()-1+e)/d*t.width,l=i.left+(r.getDate()-1+n)/c*i.width-o;break}case"month":m=parseFloat(s.getHours()+"."+s.getMinutes()+s.getSeconds())/24*(t.width/7),u=parseFloat(r.getHours()+"."+r.getMinutes()+r.getSeconds())/24*(t.width/7),o=t.left+s.getDay()/7*t.width+m,l=i.left+r.getDay()/7*i.width-o+u;break;case"week":m=parseFloat(s.getHours()+"."+s.getMinutes()+s.getSeconds())/24*t.width,u=parseFloat(r.getHours()+"."+r.getMinutes()+r.getSeconds())/24*t.width,o=t.left+m,l=i.left+(u-m)-t.left;break;case"day":m=parseFloat(s.getMinutes()+s.getSeconds()/60)/60*t.width,u=parseFloat(r.getMinutes()+r.getSeconds()/60)/60*t.width,o=t.left+m,l=i.left+(u-m)-t.left}return{width:"milestone"===a.type?"":l,left:o,top:e.top}}_snapToNearestDates(e,t){const i=this;if(!i.snapToNearest)return;if(e.classList&&e._cellObj&&(e=e._cellObj.task),!e)return;let n=e.dateStart,a=e.dateEnd;const{cellStart:s,cellEnd:r}={cellStart:i._getTimelineCellByDate(n),cellEnd:i._getTimelineCellByDate(a)},o=new Date(s.date),l=i._getDateFromCell(s.left+s.width,s),d=new Date(r.date),c=i._getDateFromCell(r.left+r.width,r);if(n=l.getTime()-n.getTime()>=l.getTime()-o.getTime()?o:l,"milestone"!==e.type&&(a=c.getTime()-a.getTime()>=c.getTime()-d.getTime()?d:c),e.dateEnd=a,a.getTime()<n.getTime()&&(n=new Date(a)),e.dateStart=n,e.duration=e.duration=i._convertDuration(i.nonworkingDays.length>0||i.nonworkingHours.length>0?i._getWorkingTime(e.dateStart,e.dateEnd):e.dateEnd.getTime()-e.dateStart.getTime(),!0),!t&&e.segments&&e.segments.length>1){const t=e.segments;for(let e=0,n=t.length;e<n;e+=1)i._snapToNearestDates(t[e],!0);i._validateTaskSegments(e)}}_getTimelineTaskCellByDate(e){if(!e)return;const t=this,i=t.view,n=t._timelineCells;for(let a=0;a<n.length;a++){const s=n[a];if(t._isDateInCell(s.date,e,i))return s}}_isDateInCell(e,t,i){switch(i){case"quarter":case"year":if(e.getYear()===t.getYear()&&e.getMonth()===t.getMonth())return!0;break;case"month":{let i=new Date(e);if(i.setDate(i.getDate()+(6-i.getDay())+1),i.setMilliseconds(i.getMilliseconds()-1),t.getTime()>=e.getTime()&&t.getTime()<=i.getTime())return!0;break}case"week":if(e.getYear()===t.getYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate())return!0;break;case"day":if(e.getYear()===t.getYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()&&e.getHours()===t.getHours())return!0}}_handleInverted(e){const t=this;function i(e){e||(e="task");const i=t.$[`${e}Splitter`];if(!t.$.mainSplitter.contains(i))return;const[n,a,s,r,o]="task"===e?[t.$.tableSplitterItem,t.$.timelineSplitterItem,t,t.$.taskTimelineContainer,"scrollTop"]:[t.$.resourceTableItem,t.$.resourceTimelineSplitterItem,t.$.resourceVerticalScrollBar,t.$.resourceTimelineContent,"value"],l=t.treeSize!==n.size?n.style[i._measurements.dimension]:t.treeSize;n.size="",i.removeChild(a),t.inverted&&!t.rightToLeft||!t.inverted&&t.rightToLeft?i.insertBefore(a,n):i.appendChild(a),n.size=l,r.scrollTop=s[o]}(!e||t.inverted||t.rightToLeft)&&(i("task"),i("resource"))}_createResourceTimeline(){const e=this;if(e._handleResourcePanelVisibility(),e.$.taskSplitterItem._setSize("size",e.taskPanelSize),!e._resources||!e.$.mainSplitter.contains(e.$.resourceTable))return;const t=e.$.resourceSplitterItemHeader.innerHTML;(e.resourcePanelHeaderTemplate&&!t||!e.resourcePanelHeaderTemplate&&t)&&e._handleHeaderTemplate("resource"),e._setTable(e.$.resourceTable),e._recycleResourceHeaderCells(),e._createResourceTimelineContent(),e._synchronizeSplitters(e.$.taskSplitter,e.$.resourceSplitter),e.$.resourceTimelineContent.scrollLeft=e.$.resourceTimelineHeader.scrollLeft=e.$.timelineHeader.scrollLeft,e.$.resourceSplitter.refresh(),e._refresh(),e._highlightAssignedItem("task",e._getSelection("task",e.selectedTaskIds))}_createResourceTimelineContent(){const e=this,t=e._timelineVCells,i=t.length?t[0].height:e._taskDefaultHeight;e._createResourceTimelineVCells(i);const n=e._timelineResourceVCells.length*i;e.$.resourceTimelineCellsContainer.style.height=n+"px",e.$.container.style.setProperty("--smart-gantt-chart-resource-timeline-content-height",n+"px"),e._recycleResourceContent()}_recycleResourceContent(){const e=this;if(!e.$.mainSplitter.contains(e.$.resourceSplitterItem))return;const t=e._timelineResourceVCells,i=e.$.resourceTimelineCellsContainer,n=e._getFirstContentCellInView("resource"),a=e.$.tooltip;if(a&&i.contains(a.selector)&&e._closeTooltip(),!n)return void(i.innerHTML="");const s=t.indexOf(n),r=n.height,o=1-(n.top+r-Math.abs(e.$.resourceVerticalScrollBar.value))/r,l=t?t.length:0,d=!e.$.resourceSplitter.offsetHeight,c=e.$.resourceTimelineContent.offsetHeight,m=!d&&c?Math.min(l,Math.ceil((parseFloat((c/r).toFixed(2))+o).toFixed(2))):l,u=i.children,h=e.$.timelineViewCells.children,g=document.createDocumentFragment();for(;i.childElementCount>m;)i.lastElementChild.remove();for(let t=0;t<m;t+=1){let i=u[t];i||(i=document.createElement("div"),i.classList.add("smart-timeline-row"),g.appendChild(i)),e._createTimelineRowCells(i,h)}g.childElementCount&&i.appendChild(g);const f=i.children,p=e._getSelection("resource",e.selectedResourceIds);for(let i=0;i<m;i+=1){const n=t[s+i],a=f[i];if(!n){a&&a.remove();continue}const r=n.resource,o=r.$.id;p.indexOf(o)>-1?a.setAttribute("selected",""):a.removeAttribute("selected"),a._cellObj=n,a.setAttribute("row-id",o),a.style.top=n.top+"px",e._refreshResourceTimelineContent(r,a)}}_createResourceTimelineVCells(e){const t=this,i=t._resources,n=t.$.resourceTable.rows,a=t._timelineResourceVCells=[];let s=0;if(void 0===e){const i=t._timelineVCells;e=i.length?i[0].height:t._taskDefaultHeight}for(let t=0,r=n.length;t<r;t+=1){const r=i[n[t].data.itemIndex];r.hidden||(a.push({top:s,height:e,resource:r}),s=parseFloat((s+e).toFixed(2)))}}_handleResourcePanelVisibility(){const e=this,t=e.$.container,i=e._resources.filter((e=>!e.hidden)),n=e.$.mainSplitter,a=e.$.resourceSplitterItem,s=e.$.taskSplitterItem;if(!i||!i.length||e.hideResourcePanel)return a&&!a.size&&(a._size=a.style[n._measurements.dimension]),e._resourceScrollView&&(e._resourceScrollView.unlisten(),delete e._resourceScrollView),s.size="",s.min="",e.$.resourceTable&&e.$.resourceTable.clearSelection(),n.contains(a)&&(n.removeChild(a),e._refresh()),e._highlightAssignedItem("resource"),void t.removeAttribute("show-resource-panel");n.contains(a)||(s.min=e.taskPanelMin,e._createResourcePanel(),e._setupResourcePanel(),e._resourceScrollView=new Smart.Utilities.Scroll(e.$.resourceSplitterItem,e.$.horizontalScrollBar,e.$.resourceVerticalScrollBar)),t.setAttribute("show-resource-panel",""),e._synchronizeSplitters(e.$.taskSplitter,e.$.resourceSplitter)}_createResourcePanel(){const e=this,t=e.$.mainSplitter;let i=e.$.resourceSplitterItem;if(!i){i=document.createElement("smart-splitter-item"),i.classList.add("smart-resource-splitter-item"),i.innerHTML=`<div smart-id="resourceSplitterItemHeader" class="smart-resource-panel-header"></div>\n <smart-splitter smart-id="resourceSplitter" wait class="smart-resource-splitter" auto-fit-mode="end">\n <smart-splitter-item smart-id="resourceTableItem" class="smart-resource-table-item">\n <smart-table wait smart-id="resourceTable" class="smart-resource-table" virtualization deferred-scroll-delay="0"></smart-table>\n </smart-splitter-item>\n <smart-splitter-item smart-id="resourceTimelineSplitterItem" class="smart-timeline-splitter-item">\n <div class="smart-timeline" smart-id="resourceTimeline">\n <div class="smart-timeline-container" role="presentation">\n <div class="smart-timeline-header" smart-id="resourceTimelineHeader" role="rowgroup">\n <div class="smart-timeline-view-cells" smart-id="resourceTimelineViewCells" role="row"></div>\n </div>\n <div smart-id="resourceTimelineContent" class="smart-timeline-content" role="rowgroup">\n <div smart-id="resourceTimelineCellsContainer" class="smart-timeline-cells-container" aria-hidden="true"></div>\n </div>\n </div>\n </div>\n <smart-scroll-bar wait smart-id="resourceVerticalScrollBar" class="smart-timeline-scroll-bar smart-resource-scroll-bar" \n orientation="vertical" aria-controls="[[${e.id||""}]]">\n </smart-scroll-bar>\n </smart-splitter-item>\n </smart-splitter>`,t.contains(i)||t.appendChild(i);const n=Smart.Utilities,a=i.querySelectorAll(".smart-resource-panel-header, .smart-resource-splitter, .smart-resource-table-item, \n .smart-resource-table, .smart-timeline-splitter-item, .smart-timeline, .smart-timeline-header, .smart-timeline-view-cells, .smart-timeline-content,\n .smart-timeline-cells-container, .smart-timeline-scroll-bar"),[s,r,o,l,d,c,m,u,h,g,f]=a;e.$.resourceSplitterItem=i,e.$resourceSplitterItem=n.Extend(i),e.$.resourceSplitterItemHeader=s,e.$resourceSplitterItemHeader=n.Extend(s),e.$.resourceSplitter=r,r.hasResizeObserver=!1,r.wait=!1,e.$resourceSplitter=n.Extend(r),e.$.resourceTableItem=o,e.$resourceTableItem=n.Extend(o),e.$.resourceTable=l,l.hasResizeObserver=!1,e.$resourceTable=n.Extend(l),e.$.resourceTimelineSplitterItem=d,e.$resourceTimelineSplitterItem=n.Extend(d),e.$.resourceTimelineViewCells=u,e.$resourceTimelineViewCells=n.Extend(u),e.$.resourceTimeline=c,e.$resourceTimeline=n.Extend(c),e.$.resourceTimelineContent=h,e.$resourceTimelineContent=n.Extend(h),e.$.resourceTimelineHeader=m,e.$resourceTimelineHeader=n.Extend(m),e.$.resourceTimelineCellsContainer=g,e.$resourceTimelineCellsContainer=n.Extend(g),e.$.resourceVerticalScrollBar=f,e.$resourceVerticalScrollBar=n.Extend(f)}}_setupResourcePanel(){const e=this,t=e.rightToLeft,i=e.$.resourceSplitterItem,n=e.$.resourceTableItem,a=e.$.resourceTable,s=e.$.resourceTimelineSplitterItem,r=e.$.resourceVerticalScrollBar;e.$.mainSplitter.contains(i)?([e.$.resourceSplitter,a,e.$.resourceVerticalScrollBar].forEach((e=>e.rightToLeft=t)),a.$.virtualizationContainer._scrollView.disableSwipeScroll=!0,a.$.virtualizationContainer.verticalScrollBarVisibility="hidden",a.$.virtualizationContainer.disabled=!0,n.size=e.treeSize,n.min=e.treeMin,s.min=e.timelineMin,i.min=e.resourcePanelMin,i.size=i._size||e.resourcePanelSize,r.hasStyleObserver=!1,r.hasResizeObserver=!1,r.wait=!1):e.$.mainSplitter.appendChild(i)}_refreshResourceTimeline(){const e=this;e._resources&&e.$.mainSplitter.contains(e.$.resourceSplitter)&&(e._recycleResourceHeaderCells(),e._recycleResourceContent())}_getResourceCellWorkTime(e,t){const i=e.dateStart,n=e.dateEnd,a=t.dateStart,s=t.dateEnd,r=e.dateStart.getTime()<a.getTime()?a:i,o=n.getTime()>s.getTime()?s:n,l=Math.round(this._getWorkingTime(r,o)/36e5);return{value:Math.max(0,l),max:r.getTime()===a.getTime()&&o.getTime()===s.getTime()?l:Math.round(this._getWorkingTime(a,s)/36e5)}}_refreshResourceTimelineContent(e,t){const i=this,n=i._resources.indexOf(e),a=i._getResourceTasks(e);if(t||(t=(()=>{const t=i.$.resourceTimelineCellsContainer.children;for(let i=0,n=t.length;i<n;i+=1){const n=t[i];if(n._cellObj&&n._cellObj.resource===e)return n}})()),n<0||!t||!t.childElementCount)return;let s=t.children;const r=i.$.resourceTimelineViewCells.children,o=i._tasks.filter((e=>!e.hidden));for(let t=0,l=s.length;t<l;t+=1){const l=s[t];let d,c=l.firstElementChild;a.length&&!e.hidden?(c?(c.classList.remove("hide-left-border","hide-right-border"),c.removeAttribute("load"),c.innerHTML=c.style.height=""):(c=document.createElement("div"),c.classList.add("smart-resource-timeline-view-cell"),d=!0),e.class&&c.classList.add(e.class),i._setResourceCellLoad({cell:c,cellIndex:t,resource:e,resourceCell:l,resourceIndex:n,resourceTasks:a,tasks:o,viewCells:r}),c.hasAttribute("load")?d&&l.appendChild(c):c.remove()):c&&c.remove()}}_setResourceCellLoad(e){const t=this,i=t.resourceTimelineFormatFunction,{cell:n,cellIndex:a,resource:s,resourceCell:r,resourceIndex:o,resourceTasks:l,tasks:d,viewCells:c}=e;let m={};for(let e=0,u=l.length;e<u;e+=1){const u=l[e];if(u.hidden)continue;const h=d.indexOf(u),g=t._getCellDateRange(c[a]),{dateStart:f,dateEnd:p}=g;if(!f||f.getTime()>=u.dateEnd.getTime()||p.getTime()<=u.dateStart.getTime())continue;if(m[a]&&m[a].indexOf(h)<0?m[a].push(h):m[n]||(m[a]=[h]),"custom"===t.resourceTimelineMode){i&&(n.innerHTML=i.call(t,m[a]||[],o,new Date(f))||"");continue}const _=t._getResourceCellCapacity({cell:n,cellDateRange:g,cellTaskIndexAssigned:m,index:o,resource:s,task:u,cellIndex:a});if(!_)continue;const{capacity:T,maxCapacity:b}=_,k=parseFloat(((parseFloat(n.getAttribute("load"))||0)+(T||0)).toFixed(1));k>b?n.classList.add("warning"):n.classList.remove("warning"),"histogram"!==t.resourceTimelineMode?k&&n.setAttribute("load",k):t._setCellHistogram({cell:n,load:k,maxCapacity:b,previousViewCell:r.previousElementSibling})}}_getResourceCellCapacity(e){const t=this,i=t.resourceTimelineView,{cell:n,cellDateRange:a,cellTaskIndexAssigned:s,index:r,resource:o,task:l,cellIndex:d}=e;let c,m;if("tasks"===i)c=1,m=o.maxCapacity;else if("hours"===i){const e=t._getResourceCellWorkTime(l,a),i=e.max/24;c=parseFloat((e.value/e.max*o.capacity*i).toFixed(1)),m=Math.min(e.max,parseFloat((o.maxCapacity*i).toFixed(1)))}else{const e=t.resourceTimelineFormatFunction;if(!e)return;let i=e.call(t,s[d]||[],r,new Date(a.dateStart));if(null!=i)if(i="object"!=typeof i?[i]:Object.values(i),2===i.length)c=parseFloat(i[0])||0,m=parseFloat(i[1])||0;else if(1===i.length)return void(n&&n.setAttribute("load",i[0]))}return{capacity:c,maxCapacity:m}}_setCellHistogram(e){const{load:t,cell:i,maxCapacity:n,previousViewCell:a}=e,s=Math.min(100,100*parseFloat((t/n).toFixed(2))),r=a?a.firstElementChild:void 0;if(r){const e=parseFloat(r.style.height)||0;s?e===s?(i.classList.add("hide-left-border"),r.classList.add("hide-right-border")):e>s?(i.classList.add("hide-left-border"),r.classList.remove("hide-right-border")):e<s&&(i.classList.remove("hide-left-border"),r.classList.add("hide-right-border")):(i.classList.remove("hide-left-border"),r.classList.remove("hide-right-border"))}i.style.height=s+"%",t&&i.setAttribute("load",t+"/"+n)}_recycleResourceHeaderCells(){const e=this;if(!e.$.mainSplitter.contains(e.$.resourceSplitterItem))return;const t=e.$.resourceTimelineViewCells,i=t.children,n=e.$.timelineViewCells.children;let a=document.createDocumentFragment();for(;i.length>n.length;)i[0].remove();for(let e=0;e<n.length;e++){const t=n[e];let s=i[e];s||(s=t.cloneNode(!0),a.appendChild(s)),s.style.left=t.style.left,s.style.right=t.style.right,s.style.width=t.style.width,s.innerHTML=t.innerHTML,s._date=t._date,t.hasAttribute("weekend")?s.setAttribute("weekend",""):s.removeAttribute("weekend"),t.hasAttribute("nonworking")?s.setAttribute("nonworking",""):s.removeAttribute("nonworking")}a.childElementCount&&t.appendChild(a),e.$.resourceTimelineCellsContainer.style.width=e.$.resourceTimelineViewCells.style.width=e.$.timelineContent.style.width}_refreshResourceScrollBar(){const e=this,t=e.$.resourceVerticalScrollBar;if(!e.$.mainSplitter.contains(e.$.resourceSplitter))return;const i=Math.max(0,e.$.resourceTimelineCellsContainer.offsetHeight-e.$.resourceTimelineContent.offsetHeight);0===i&&"visible"===e.verticalScrollBarVisibility?(t.max=1,e.scrollHeight||e.$container.removeClass("vscroll")):i&&e.$container.addClass("vscroll"),t.max=i,t.disabled="disabled"===e.verticalScrollBarVisibility||e.disabled||i<=0,!e.$.container.classList.contains("vscroll")&&t.disabled?t.classList.add("smart-hidden"):(t.classList.remove("smart-hidden"),t.refresh(),e.$.container.classList.contains("hscroll")?e.$.horizontalScrollBar.classList.add("bottom-corner"):e.$.container.classList.contains("vscroll")||e.$.horizontalScrollBar.classList.remove("bottom-corner"))}_handleResources(e){const t=this,i=e?[e]:t._tasks;t._resources||(t._resources=[]);for(let e=0;e<i.length;e++){let n=i[e].resources;Array.isArray(n)||(n=[n].reduce(((e,t)=>e.concat(t)),[]));for(let a=0;a<n.length;a++){let s=n[a];if("object"!=typeof s||!s||void 0===s.id||null===s.id){"number"==typeof s&&(n[a]=s+"");continue}let r=t._resources.find((e=>e.id&&e.id.toString()===s.id.toString()))||{};t._setResource(r,s,i[e]),n[a]=r.id,Object.values(r).length&&!t._resources.includes(r)&&t._resources.push(r)}}t._refreshItemIds("resource");const n=t._resources;for(let e=0,i=n.length;e<i;e+=1)t._refreshResource(n[e])}_refreshAssignedResources(e,t=[]){const i=this;if(!e.$.id||i._tasks.indexOf(e)<0)return;const n=i._getTaskResources(e);for(let e=0;e<n.length;e++){const a=n[e];let s=[];i.resourceColumns.forEach((e=>{void 0!==e.formatFunction&&s.push(e.value)})),s.concat(t),i.$.mainSplitter.contains(i.$.resourceSplitter)&&i._refreshResourceTimelineContent(a),t.includes("workload")?i._refreshResource(a,"workload"):t.includes("progress")&&i._refreshResource(a,"progress"),s.length&&i._refreshTableColumnsData(a,s,"resource")}}_refreshResource(e,t){const i=this;if(!i._resources.length)return;const n=i._getResourceTasks(e),a=864e5;switch(t){case"progress":e.progress=parseFloat((n.reduce(((e,t)=>e+t.progress),0)/n.length).toFixed(2));break;case"workload":e.workload=parseFloat((i._convertDuration(n.reduce(((e,t)=>e+t.duration),0))/a*e.maxCapacity).toFixed(2));break;default:e.progress=parseFloat((n.reduce(((e,t)=>e+t.progress),0)/n.length).toFixed(2)),e.workload=parseFloat((i._convertDuration(n.reduce(((e,t)=>e+t.duration),0))/a*e.maxCapacity).toFixed(2))}i.$.mainSplitter.contains(i.$.resourceSplitter)&&i._refreshResourceTimelineContent(e)}_setResource(e,t){if(t&&"object"==typeof t)return e.id?e.id=e.id.trim():e.id=(t.id+"").trim(),e.$||(e.$={}),e.class=t.class||e.class,e.minCapacity=t.minCapacity||e.minCapacity||0,e.maxCapacity=t.maxCapacity||e.maxCapacity||24,e.progress=t.progress||e.progress||0,e.capacity=t.capacity||e.capacity||8,e.type=t.type||e.type,e.hidden=!!("boolean"==typeof t.hidden?t.hidden:e.hidden),e.workload=e.workload||0,t.label?e.label=t.label:void 0===e.label&&(e.label=""),t.value&&(e.value=t.value),e}insertResource(e,t){const i=this,n=Array.from(arguments).filter((e=>void 0!==e));let a,s=i._resources;if(1===n.length&&(t=n[0]),"object"!=typeof t)return void i.error(i.localize("incorrectArgument",{elementType:i.nodeName.toLowerCase(),methodName:"insertResources",argumentName:"resource"}));if(t.id&&s.find((e=>e.id&&e.id.toString()===t.id.toString())))return void i.updateResource(t.id,t);if(t.assignedTo&&(a=[t.assignedTo].reduce(((e,t)=>e.concat(t,[])))),!(t=i._setResource({},t)))return;i._refreshItemIds("resource"),s=i._resources;const r=i._getValidItemAndIndex(e,"resource").index;if(r<0?s.push(t):s.splice(r,0,t),i._tasks.length){if(void 0!==a){Array.isArray(a)||(a=[a]);for(let e=0,n=a.length;e<n;e+=1){const n=i._getValidItemAndIndex(a[e],"task");if(n){const e=n.item;!e||e.disableResources||e.resources.includes(t.id.toString())||e.resources.push(t.id)}}if(i._isUpdating)return void(i._isUpdating.type.resource=!0);i._highlightAssignedItem("task",i._getSelection("task",i.selectedTaskIds)),i._refreshResource(t)}if(i._isUpdating)return i._isUpdating.type.resource=!0,void(i._isUpdating.type.task=!0);if(i.groupByResources)i._refreshTableDataSource(),i._refreshTimeline();else if(i.taskColumns.find((e=>"resources"===e.value))){const e=i._tasks.filter((e=>e.resources.includes(t.id)));for(let t=0;t<e.length;t++)i._refreshTableColumnsData(e[t],["resources"])}}i._isUpdating?i._isUpdating.type.resource=!0:(i._createResourceTimeline(),i.$.fireEvent("itemInsert",{type:"resource",item:i._cloneObject(t)}))}_insertTimelineResource(e,t,i){const n=this,a=n.$.resourceTimelineCellsContainer,s=document.createElement("div");s.classList.add("smart-timeline-row"),s._resource=t,n._refreshResourceTimelineContent(t,s),n.$.resourceTimelineCellsContainer.insertBefore(s,e>-1?a.children[e]:void 0),n.$.container.style.setProperty("--smart-gantt-chart-resource-timeline-content-height",a.offsetHeight+"px"),n._refreshResourceScrollBar(),n._insertNewTreeItem(e,t,i,"resource"),n.$.resourceTree.refresh(),n._highlightAssignedItem("task",n._getSelection("task",n.selectedTaskIds))}updateResource(e,t){if(void 0===e)return;const i=this._getValidItemAndIndex(e,"resource");i&&i.item&&this._updateResource(i.item,t)}removeResource(e){if(void 0===e)return;const t=this._getValidItemAndIndex(e,"resource");t&&t.item&&this._removeResource(t.item)}_getResourceTasks(e){const t=this._resources,i=this._tasks;if(!e||!t.length||!i.length)return;let n=[];for(let t=0;t<i.length;t++)i[t].resources.includes(e.id)&&n.push(i[t]);return n}_getTaskResources(e){const t=this;if(!e)return[];const i=[e.resources].reduce(((e,t)=>e.concat(t)),[]);let n=[];for(let e=0;e<i.length;e++){const a=t._resources.find((t=>t.id&&t.id.toString()===i[e].toString()));a&&n.push(a)}return n}_resourceValidator(e,t){const i=this;return Array.isArray(t)||t instanceof Smart.ObservableArray||"number"==typeof t||"string"==typeof t||null==t?t:(i.error(i.localize("invalidValue",{elementType:i.nodeName.toLowerCase(),property:"resources",typeOne:"array",typeTwo:"number"})),null)}_handleTaskProgressChange(e){const t=this,i=t._dragDetails.task,n=t._dragDetails.timelineTask;if(t.disableTaskProgressChange)return;if(!t.hasAttribute("progress-change")){if(t.$.fireEvent("progressChangeStart",{id:"string"==typeof i.id||"number"==typeof i.id?i.id:i.$.id,item:t._cloneObject(i),progress:i.progress||0}).defaultPrevented)return void delete t._dragDetails.target;t._closeTooltip(),t.setAttribute("progress-change",""),t._scrollView.disableSwipeScroll=t._touchmoveInside=!0}const{left:a,width:s}=n.getBoundingClientRect(),r=e.pageX-window.pageXOffset;t._dragDetails.progress||(t._dragDetails.progress=i.progress/100*s),t._dragDetails.progress=Math.max(0,Math.min(s,t._dragDetails.progress+(t.rightToLeft?-1:1)*(r-t._dragDetails.coordinates.x))),t._dragDetails.coordinates.x=Math.max(a+t._dragDetails.offset.x,Math.min(a+s+t._dragDetails.offset.x,r));const o=t._dragDetails.task.progress=t._dragDetails.progress/s*100;i.progress=parseFloat(o.toFixed(2)),t._setTaskBarProgress(i,n),t._refreshTableColumnsData(i,["progress"]),clearTimeout(t._resourceTreeRefreshTimeout),t.$.mainSplitter.contains(t.$.resourceSplitter)&&(t._resourceTreeRefreshTimeout=setTimeout((function(){t._refreshAssignedResources(i,["progress"]),delete t._resourceTreeRefreshTimeout}),t.resourcePanelRefreshRate))}_handleTaskSegmentDrag(e){const t=this,i=t._dragDetails,n=i.segment,a=n.element,s=a._segmentObj;if(!s||s.disableDrag)return;const r=i.task,o=t._dragDetails.timelineTask,l=n.isFirstSegment,d=n.isLastSegment,c=t.rightToLeft,m=c?"right":"left";i.timelineRow||(i.timelineRow=Array.from(t.$.taskTimelineCellsContainer.children).find((e=>e._cellObj.task===r)));const u=i.timelineRow;if(!t.hasAttribute("dragged")){if(t.$.fireEvent("dragStart",{id:"string"==typeof r.id||"number"==typeof r.id?r.id:r.$.id,item:t._cloneObject(r),dateStart:r.dateStart,dateEnd:r.dateEnd,segment:t._cloneObject(s)}).defaultPrevented)return void delete i.timelineTask;if(t.setAttribute("dragged",""),t._closeTooltip(),t._touchmoveInside=!0,l||d){const e=t._createDelimiter("min-date"),i=t._createDelimiter("max-date");e&&u.appendChild(e),i&&u.appendChild(i)}}if(l){const n=i.size?i.size.width:i.originalSize.width;t._handleTaskResize(e,c?"right":"left"),i.segments||(i.segments=o.querySelectorAll(".smart-task-segment"));const a=i.size.width-n,s=i.segments;for(let e=0,t=s.length;e<t;e+=1){const t=s[e];0!==e&&(t.style[m]=(parseFloat(t.style[m])||t.offsetLeft)+a+"px")}}else{if(!d)return void t._handleSegmentDrag(e);{const s=n.dimensions;t._handleTaskResize(e,c?"left":"right"),a.style[m]=i.size.width-s.width+"px"}}t._refreshTask(o,[a]),t._refreshProject(r.$.project),t.groupByResources&&t._refreshProject(r.$.group),clearTimeout(t._resourceTreeRefreshTimeout),t.$.mainSplitter.contains(t.$.resourceSplitter)&&(t._resourceTreeRefreshTimeout=setTimeout((function(){t._refreshAssignedResources(o._cellObj.task),delete t._resourceTreeRefreshTimeout}),t.resourcePanelRefreshRate))}_handleSegmentDrag(e){const t=this,i=t._dragDetails,n=i.segment,a=n.element,s=i.task,r=t._dragDetails.timelineTask,o=t.rightToLeft,l=o?"right":"left";i.timelineRow||(i.timelineRow=Array.from(t.$.taskTimelineCellsContainer.children).find((e=>e._cellObj.task===s)));const d=i.timelineRow,{left:c}=d.getBoundingClientRect(),m=i.taskDimensions.left;n.position||(n.position={x:n.originalPosition.x});const u=r.offsetWidth,h=e.pageX-window.pageXOffset;let g=0,f=n.min.left||0,p=n.max.left;o&&(f=u-(f+n.dimensions.width),p=u-p),n.position.x=Math.max(f,Math.min(p,n.position.x+(o?-1:1)*(h-i.coordinates.x))),void 0!==p&&(g=o?m+n.min.left:m+n.max.left,n.position.x=Math.min(p,n.position.x)),f=m+(o?n.max.left-n.dimensions.width:f),i.coordinates.x=Math.max(c+n.offset.x+f,Math.min(c+n.offset.x+g,h)),a.style[l]=n.position.x+"px",t._refreshTaskSegments(r,[a])}_handleTaskBarDrag(e){const t=this;if(t.disableTaskDrag)return;const i=t._dragDetails;if(Math.abs(e.pageX-i.coordinates.x)<=5)return void(t._scrollView.disableSwipeScroll=!0);if(i.segment)return void t._handleTaskSegmentDrag(e);const n=i.task,a=i.timelineTask;i.timelineRow||(i.timelineRow=Array.from(t.$.taskTimelineCellsContainer.children).find((e=>e._cellObj.task===n)));const s=i.timelineRow;if(!t.hasAttribute("dragged")){if(t.$.fireEvent("dragStart",{id:"string"==typeof n.id||"number"==typeof n.id?n.id:n.$.id,item:t._cloneObject(n),dateStart:n.dateStart,dateEnd:n.dateEnd}).defaultPrevented)return void delete i.timelineTask;t.setAttribute("dragged",""),t._closeTooltip(),t._touchmoveInside=!0;const e=t._createDelimiter("min-date"),a=t._createDelimiter("max-date");e&&s.appendChild(e),a&&s.appendChild(a)}i.position||(i.position={x:i.originalPosition.x,y:i.originalPosition.y});const r=s.getBoundingClientRect().left,o=s.offsetWidth,l=a.offsetWidth,d=i.min.left||0,c=i.max.left,m=e.pageX-window.pageXOffset,u=t.rightToLeft;let h=0;i.position.x=Math.max(d,Math.min(o-l,i.position.x+(u?-1:1)*(m-i.coordinates.x))),void 0!==c&&(i.position.x=Math.min(c,i.position.x),h=o-l-c),i.coordinates.x=u?Math.max(r+i.offset.x+h,Math.min(r+o-(l-i.offset.x+d),m)):Math.max(r+i.offset.x+d,Math.min(r+o-(l-i.offset.x+h),m));const g=n.dateStart.getTime(),f=n.dateEnd.getTime();a.style[u?"right":"left"]=i.position.x+"px",t._refreshTask(a),t._refreshProject(n.$.project),t.groupByResources&&t._refreshProject(n.$.group),"project"===n.type&&n.dragProject&&t._refreshProjectTasks(n,{startTime:n.dateStart.getTime()-g,endTime:n.dateEnd.getTime()-f}),clearTimeout(t._resourceTreeRefreshTimeout),t.$.mainSplitter.contains(t.$.resourceSplitter)&&(t._resourceTreeRefreshTimeout=setTimeout((function(){t._refreshAssignedResources(a._cellObj.task),delete t._resourceTreeRefreshTimeout}),t.resourcePanelRefreshRate))}_handleTaskBarResize(e){const t=this;if(t.disableTaskResize)return;const i=t._dragDetails;if(i.segment)return void t._handleTaskSegmentResize(e);const n=i.timelineTask,a=i.task;if(!t.hasAttribute("resized")){if(t.$.fireEvent("resizeStart",{id:"string"==typeof a.id||"number"==typeof a.id?a.id:a.$.id,item:t._cloneObject(a),dateStart:a.dateStart,dateEnd:a.dateEnd}).defaultPrevented)return void t.$.timeline.removeAttribute("task-bar-hovered");t.setAttribute("resized",""),t._closeTooltip(),t._scrollView.disableSwipeScroll=t._touchmoveInside=!0}t._handleTaskResize(e,t.$.timeline.getAttribute("task-bar-hovered")),t._updateSegmentsOnTaskResize(),t._refreshTask(n),t._refreshProject(a.$.project),t.groupByResources&&t._refreshProject(a.$.group),clearTimeout(t._resourceTreeRefreshTimeout),t.$.mainSplitter.contains(t.$.resourceSplitter)&&(t._resourceTreeRefreshTimeout=setTimeout((function(){t._refreshAssignedResources(n._cellObj.task,["workload"]),delete t._resourceTreeRefreshTimeout}),t.resourcePanelRefreshRate))}_updateSegmentsOnTaskResize(){const e=this,t=e._dragDetails,i=t.task,n=t.timelineTask;if(!i||!i.segments)return;let a;t&&t.segments?a=t.segments:t.segments=a=n.querySelectorAll(".smart-task-segment");const s=a.length,r=t.size.width,o=e.rightToLeft?"right":"left";for(let t=0;t<s;t+=1){const i=a[t],n=i.style.width?parseFloat(i.style.width):i.offsetWidth,l=i.style[o]?parseFloat(i.style[o]):0;if(l+n>r){const t=r-(l+n),a=n+t;a<e._taskBarMinWidth&&(i.style[o]=l+t+"px"),i.style.width=a+"px"}else t===s-1&&(i.style.width=r-l+"px")}}_handleTaskSegmentResize(e){const t=this,i=t._dragDetails,n=i.segment,a=n.element,s=a._segmentObj;if(!s||s.disableResize)return;const r=i.task,o=t._dragDetails.timelineTask,l=n.isFirstSegment,d=n.isLastSegment,c=t.rightToLeft,m=c?"right":"left";if(!t.hasAttribute("resized")){if(t.$.fireEvent("resizeStart",{id:"string"==typeof r.id||"number"==typeof r.id?r.id:r.$.id,item:t._cloneObject(r),dateStart:r.dateStart,dateEnd:r.dateEnd,segment:t._cloneObject(s)}).defaultPrevented)return void t.$.timeline.removeAttribute("task-bar-hovered");t.setAttribute("resized",""),t._closeTooltip(),t._scrollView.disableSwipeScroll=t._touchmoveInside=!0}const u=t.$.timeline.getAttribute("task-bar-hovered");if(l&&("left"===u&&!c||"right"===u&&c)){const s=i.size?i.size.width:i.originalSize.width;void 0===n.size&&(n.size={width:n.originalSize.width}),t._handleTaskResize(e,u),i.segments||(i.segments=o.querySelectorAll(".smart-task-segment"));const r=i.size.width-s,l=i.segments;for(let e=0,t=l.length;e<t;e+=1){const t=l[e];0!==e&&(t.style[m]=(parseFloat(t.style[m])||t.offsetLeft)+r+"px")}a.style.width=(n.size.width+=r)+"px"}else{if(!d||!("right"===u&&!c||"left"===u&&c))return t._handleSegmentResize(e,u),void t._refreshTaskSegments(o,[a]);{const s=i.size?i.size.width:i.originalSize.width;void 0===n.size&&(n.size={width:n.originalSize.width}),t._handleTaskResize(e,u),a.style.width=(n.size.width+=i.size.width-s)+"px"}}t._refreshTask(o,[a]),t._refreshProject(r.$.project),t.groupByResources&&t._refreshProject(r.$.group),clearTimeout(t._resourceTreeRefreshTimeout),t.$.mainSplitter.contains(t.$.resourceSplitter)&&(t._resourceTreeRefreshTimeout=setTimeout((function(){t._refreshAssignedResources(o._cellObj.task,["workload"]),delete t._resourceTreeRefreshTimeout}),t.resourcePanelRefreshRate))}_handleSegmentResize(e,t){const i=this,n=i._dragDetails,a=n.task,s=n.segment,r=s.element,o=i.rightToLeft,l=n.taskDimensions.left;n.timelineRow||(n.timelineRow=Array.from(i.$.taskTimelineCellsContainer.children).find((e=>e._cellObj.task===a)));const d=n.timelineRow;s.position||(s.position={x:s.originalPosition.x}),s.size||(s.size={width:s.originalSize.width});const c=e.pageX-window.pageXOffset;let m=s.size.width,u=s.min.width||0,h=s.max.width,g=s.min.left||0,f=s.max.left,p=r.offsetLeft,{left:_}=d.getBoundingClientRect(),T="object"==typeof e?c-n.coordinates.x:e;if(_+=l,"left"===t&&!o||"right"===t&&o)if(o){const e=n.taskDimensions.width;T=T<0?-1*Math.min(Math.abs(T),m-u):Math.min(h-m,Math.abs(T)),m=Math.max(u,Math.min(h,m+T)),r.style.left="",r.style.right=(p=Math.max(e-g,(parseFloat(r.style.right)||d.offsetWidth-p-m)-T))+"px",n.coordinates.x=Math.max(_+e-p+u,Math.min(_+e-p,c))}else T=T>0?Math.min(T,m-(u||0)):-1*Math.min(h-m,Math.abs(T)),m=Math.max(u,Math.min(p+m,m-T)),r.style.right="",r.style.left=(p=Math.max(g,(parseFloat(r.style.left)||p)+T))+"px",n.coordinates.x=Math.max(_+g+u,Math.min(_+p+m-u,c));else o?(T<0&&(T=-1*Math.min(h-m,Math.abs(T))),m=Math.max(u,Math.min(p+m,m-T)),f-=s.dimensions.width,n.coordinates.x=Math.max(_+f,Math.min(_+f+h,c))):(T>0&&(T=Math.min(h-m,T)),m=Math.max(u,Math.min(h,m+T)),n.coordinates.x=Math.max(_+p+u,Math.min(_+p+h,c)));r.style.width=(s.size.width=m)+"px"}_handleTaskResize(e,t){const i=this,n=i._dragDetails,a=n.task;n.position||(n.position={x:n.originalPosition.x,y:n.originalPosition.y}),n.size||(n.size={width:n.originalSize.width}),n.timelineRow||(n.timelineRow=Array.from(i.$.taskTimelineCellsContainer.children).find((e=>e._cellObj.task===a)));const s=n.timelineRow,r=n.timelineTask,o=n.segment,l=e.pageX-window.pageXOffset;let d=n.size.width,c=n.min.width||0,m=n.max.width,u=s.getBoundingClientRect().left,h=i.rightToLeft,g="object"==typeof e?l-n.coordinates.x:e;if("left"===t&&!h||"right"===t&&h)if(o&&(h?(u-=o.dimensions.width-o.offset.x,c=Math.max(o.max.left+o.min.width,c)):(u+=o.offset.x,c=Math.max(n.taskDimensions.width-o.max.left+o.min.width,c))),h){g<0?g=-1*Math.min(Math.abs(g),d-(c||0)):void 0!==m&&(g=Math.min(m-d,Math.abs(g))),d=n.size.width=Math.max(c,Math.min(s.offsetWidth-r.offsetLeft,d+g));const e=r.offsetLeft;r.style.left="",r.style.right=(n.position.x=Math.max(0,(parseFloat(r.style.right)||s.offsetWidth-r.offsetLeft-r.offsetWidth)-g))+"px",n.coordinates.x=Math.max(u+r.offsetLeft+c,Math.min(u+e+d,l))}else g>0?g=Math.min(g,d-(c||0)):void 0!==m&&(g=-1*Math.min(m-d,Math.abs(g))),d=n.size.width=Math.max(c,Math.min(r.offsetLeft+d,d-g)),r.style.right="",r.style.left=(n.position.x=Math.max(0,(parseFloat(r.style.left)||r.offsetLeft)+g))+"px",n.coordinates.x=Math.max(u+r.offsetLeft,Math.min(u+r.offsetLeft+d-c,l));else h?(o&&(u+=o.offset.x,c=Math.max(n.taskDimensions.width-o.min.left+o.min.width,c)),g<0&&void 0!==m&&(g=-1*Math.min(m-d,Math.abs(g))),d=n.size.width=Math.max(c,Math.min(r.offsetLeft+r.offsetWidth,d-g)),r.style.width=n.size.width+"px",n.coordinates.x=Math.max(u+r.offsetLeft,Math.min(u+r.offsetLeft+d-c,l))):(o&&(u-=o.dimensions.width-o.offset.x,c=Math.max(o.min.left+o.min.width,c)),g>0&&void 0!==m&&(g=Math.min(m-d,g)),d=n.size.width=Math.max(c,Math.min(s.offsetWidth-r.offsetLeft,d+g)),n.coordinates.x=Math.max(u+r.offsetLeft+c,Math.min(u+r.offsetLeft+(m||d),l)));r.style.width=n.size.width+"px"}_handleTimelineConnectionHover(e){const t=this;if(!(t.shadowRoot||t).contains(e))return;const i=t.$.timelineConnectionsContainer.children,n=e.closest(".smart-task-connection");if(n||!t.$.timelineConnectionsContainer.querySelector(".smart-task-connection[hover]")){if(n){const e=n.getAttribute("connection-id");for(let t=0;t<i.length;t++){const n=i[t];n.getAttribute("connection-id")===e?n.setAttribute("hover",""):n.removeAttribute("hover")}t._hoveredConnectionTasks=n.tasks}}else for(let e=0;e<i.length;e++)i[e].removeAttribute("hover")}_resetItemHover(){const e=this;if(e._hoveredItem){const t=e.$.mainSplitter.querySelectorAll(".smart-timeline-task[hover], .smart-timeline-row[hover], tr[hover]");for(let e=0;e<t.length;e++)t[e].removeAttribute("hover");e.$.timeline.removeAttribute("task-bar-hovered"),delete e._hoveredItem}}_handleTimelineHover(e,t){const i=this,n=i._isMobile;if(!e||n)return void i._resetItemHover();const a=e.originalEvent||e;let s="task",r=a.pageX&&n?document.elementFromPoint(a.pageX-window.pageXOffset,a.pageY-window.pageYOffset):a.target;if(a.pageX&&i.shadowRoot&&r===i&&(r=a.pageX&&n?i.shadowRoot.elementFromPoint(a.pageX-window.pageXOffset,a.pageY-window.pageYOffset):a.composedPath()[0]),!r||!r.closest||r===i||t)return void i._resetItemHover();i.$.resourceSplitter&&i.$.resourceSplitter.contains(r)?s="resource":i._handleTimelineConnectionHover(r);let o=r.closest(".smart-timeline-row")||r.closest(".smart-timeline-task");if(!o||!(i.shadowRoot||i).contains(o))return void i._resetItemHover();const l=o._cellObj[s],d=l.$.id,c=i._hoveredItem;if(!(c&&c.type===s&&c.id===d||(i._resetItemHover(),l.isGroup||("task"===s&&o.classList.contains("smart-timeline-row")&&(o=i.$.timelineTasksContainer.querySelector(`.smart-timeline-task[row-id="${d}"]`)),!o||i._connectionFeedback&&o.contains(i._connectionFeedback)||(o.setAttribute("hover",""),i._hoveredItem={id:d,type:s},n))))){const e=("task"===s?i.$.taskTimelineCellsContainer:i.$.resourceTimelineCellsContainer).querySelector(`.smart-timeline-row[row-id="${d}"]`);e&&(e.setAttribute("hover",""),i._handleTableItemHover(d,r))}}_getScrollLeft(e){return this.rightToLeft?e*=-1:e}_synchronizeSplitters(e,t){if(this.$.mainSplitter.contains(this.$.resourceSplitter)){const i=e._measurements,n=e.items,a=t.items,[s,r,o]=[i.dimension,i.minDimension,i.maxDimension],[l,d]=[a[0],n[0]],[c,m]=[a[1],n[1]];t.keepProportionsOnResize=!0,t.setAttribute("orientation-change",""),[r,o,s].forEach((e=>{const t=e===s?"size":e===r?"min":"max";l.set(t,""),c.set(t,""),l[t]=d.style[e],c[t]=m.style[e]})),t.removeAttribute("orientation-change"),t.keepProportionsOnResize=!1}}_resizeEventHandler(e){const t=this,i=t.$.taskSplitter;function n(e){e.refresh(),e===i&&t._synchronizeSplitters(i,t.$.resourceSplitter)}if(e&&"resizeEnd"===e.type){if(e.target===t.$.taskTreeSplitter||e.target===t.$.resourceTreeSplitter)return void n(e.target);e.target===t.$.resourceSplitter&&t._synchronizeSplitters(t.$.resourceSplitter,i)}if(!t._timelineCells)return void t._refresh();t.$.mainSplitter.refresh(),n(i);const a=t._getScrollLeft(t.scrollLeft);t._autoSchedule(),t._createTimelineCells(),t._recycleTimelineTasks(),t._recycleTimelineRowCells(),t._refreshResourceTimeline(),t._refresh(),t.$.taskTable.refresh(),t.$.timelineHeader.scrollLeft=t.$.taskTimelineContainer.scrollLeft=a,t.$.taskTable.scrollTop=t.$.taskTimelineContainer.scrollTop=t.scrollTop,t.$.mainSplitter.contains(t.$.resourceTimelineHeader)&&(t.$.resourceTimelineHeader.scrollLeft=t.$.resourceTimelineContent.scrollLeft=a,t.$.resourceTable.refresh(),t.$.resourceTable.scrollTop=t.$.resourceTimelineContent.scrollTop=t.$.resourceVerticalScrollBar.value),t._positionWindow()}_recycle(e){const t=this,i=e&&"horizontal"===e.context.orientation;if(e&&!i||(t._recycleHeaderCells(t.$.timelineViewCells),t._recycleHeaderCells(t.$.timelineViewDetails),t.$.timelineViewSubDetails.classList.contains("smart-hidden")||t._recycleHeaderSubCells(t.$.timelineViewSubDetails),t._recycleResourceContent()),i)return;if(t._recycleResourceContent(),t._recycleContentCells(),t._recycleTimelineTasks(),!e)return;const n=Math.round(e.detail.value);e.target!==t.$.resourceVerticalScrollBar?t._refreshTableScrollTop(t.$.taskTable,n):t._refreshTableScrollTop(t.$.resourceTable,n)}_recycleContentCells(){const e=this,t=e._getFirstContentCellInView(),i=e.$.taskTimelineCellsContainer,n=e.$.timelineTasksContainer;if(!t)return void(i.innerHTML=n.innerHTML="");const a=t.height,s=1-(t.top+a-Math.abs(e.scrollTop))/a,r=e._timelineVCells?e._timelineVCells.length:0,o=!e.$.taskSplitter.offsetHeight,l=e.$.taskTimelineContainer.offsetHeight,d=!o&&l?Math.min(r,Math.ceil((parseFloat((l/a).toFixed(2))+s).toFixed(2))):r,c=e.$.timelineViewCells.children,m=document.createDocumentFragment();for(;i.childElementCount>d;)i.lastElementChild.remove();for(;n.childElementCount>d;)n.lastElementChild.remove();for(let t=i.childElementCount;t<d;t+=1){const t=document.createElement("div");t.classList.add("smart-timeline-row"),e._createTimelineRowCells(t,c),m.appendChild(t)}m.childElementCount&&i.appendChild(m);for(let e=n.childElementCount;e<d;e+=1){const e=document.createElement("div");e.classList.add("smart-timeline-task"),m.appendChild(e)}m.childElementCount&&n.appendChild(m)}_getCellIndexByDate(e){const t=this._timelineCells;let i=[];if(e&&e.length&&t){Array.isArray(e)||(e=[e]);for(let t=0,n=e.length;t<n;t+=1){const n=e[t];e[t]=n.getTime?n.getTime():n,i[t]=-1}for(let n=0,a=t.length;n<a;n+=1){const a=t[n],s=e.indexOf(a.date.getTime());if(s>-1&&(i[s]=n,i.every((e=>-1!==e))))break}return 1===i.length?i[0]:i}}_recycleDateMarkers(){const e=this,t=e.$.timelineMarkers,i=e._markers;if(!i||e.hideDateMarkers)return void(t.childElementCount&&(t.innerHTML=""));const n=e.$.timelineViewCells.children,a=n[0]._date,s=n[n.length-1]._date,[r,o]=e._getCellIndexByDate([a,s]);if(!a||!s)return;const l=a.getTime(),d=e._getCellDateRange({_date:s}).dateEnd.getTime(),c=t.children,[m,u]=e.rightToLeft?["right","left"]:["left","right"],h=document.createDocumentFragment();let g=0;for(let t=0,n=i.length;t<n;t+=1){const n=i[t],a=i[t].date,s=a.getTime();if(s<l||s>d)continue;const f=e._getTimelineCellByDate(a,r,o);if(f){const t=f.left+e._getTimelineTaskOffset(f,a),i=n.label,s=n.className;let r=c[g];r||(r=document.createElement("div"),h.appendChild(r)),r.className="smart-gantt-chart-date-marker",void 0!==i&&(r.firstElementChild||(r.innerHTML='<div class="smart-gantt-chart-marker-label"></div>'),r.firstElementChild.textContent=i+""),void 0!==s&&r.classList.add(s),r.style[u]="",r.style[m]=t+"px",g++}}for(h.childElementCount&&t.insertBefore(h,t.firstElementChild);c.length>g;)c[c.length-1].remove()}_refreshTableScrollTop(e,t){this.$.mainSplitter.contains(e)&&void 0!==t&&(e.scrollTop=t)}_recycleHeaderCells(e){let t=this,i=e.children,n=t.scrollLeft,a=e===t.$.timelineViewCells,s=a?t._timelineCells:t._timelineHeaderCells;if(e===t.$.timelineViewSubDetails&&(a=!1,s=t._timelineHeaderSubCells),!s.length)return;let r=document.createDocumentFragment();for(;i.length;)r.appendChild(e.firstElementChild);let o=t._getFirstCellObjInView(s),l=1-(o.left+o.width-Math.abs(n))/s[0].width,d=r.children.length,c=a?Math.ceil((parseFloat((t.$.timeline.offsetWidth/o.width).toFixed(2))+l).toFixed(2)):t._getHeaderVisibleCellsCount();if(e===t.$.timelineViewSubDetails&&(c=t._getHeaderSubVisibleCellsCount()),d>c)for(;r.children.length&&r.children.length!==c;)r.removeChild(r.firstElementChild);else if(d<c){const e=t._createCells(c-d);for(;e.children.length;)r.appendChild(e.firstElementChild)}const m=[t.rightToLeft?"right":"left"],u=a?t._getCellsViewType():t.view;let h=s.indexOf(o);for(let e=0;e<r.children.length;e++){const i=r.children[e],n=s[h];if(!n)break;let o=new Date(n.date);a||"week"!==t.view||(o.setDate(o.getDate()-o.getDay()),o=new Date(Math.max(n.date.getTime(),o.getTime()))),i.style[m]=n.left+"px",i.style.width=n.width+"px",i._date=o,i.innerHTML=`<div>${t._getDateString(o,u,!a)}</div>`,n.weekend?i.setAttribute("weekend",""):i.removeAttribute("weekend"),n.nonworking?i.setAttribute("nonworking",""):i.removeAttribute("nonworking"),h++}e.appendChild(r),a&&(t._recycleTimelineRowCells(),t._recycleResourceHeaderCells(),t._recycleDateMarkers(),t._setTodayCell())}_recycleHeaderSubCells(e){let t=this,i=e.children,n=t.scrollLeft,a=t._timelineHeaderSubCells;if(!a.length)return;let s=document.createDocumentFragment();for(;i.length;)s.appendChild(e.firstElementChild);let r=t._getFirstCellObjInView(a),o=(r.left,r.width,Math.abs(n),a[0].width,s.children.length),l=t._getHeaderSubVisibleCellsCount();if(o>l)for(;s.children.length&&s.children.length!==l;)s.removeChild(s.firstElementChild);else if(o<l){const e=t._createCells(l-o);for(;e.children.length;)s.appendChild(e.firstElementChild)}const d=[t.rightToLeft?"right":"left"],c=t.view;let m=a.indexOf(r);for(let e=0;e<s.children.length;e++){const i=s.children[e],n=a[m];if(!n)break;let r=new Date(n.date);"week"===t.view&&(r.setDate(r.getDate()-r.getDay()),r=new Date(Math.max(n.date.getTime(),r.getTime()))),i.style[d]=n.left+"px",i.style.width=n.width+"px",i._date=r,i.innerHTML=`<div>${t._getDateString(r,c,!0)}</div>`,n.weekend?i.setAttribute("weekend",""):i.removeAttribute("weekend"),n.nonworking?i.setAttribute("nonworking",""):i.removeAttribute("nonworking"),m++}e.appendChild(s),t._refreshHeaderSubDetailsDate()}_refresh(){const e=this;let t="disabled"===e.verticalScrollBarVisibility;function i(){const t=e.$.timelineHeader,i=t.scrollWidth-t.offsetWidth;return i>0&&"hidden"!==e.horizontalScrollBarVisibility||"visible"===e.horizontalScrollBarVisibility?e.$container.addClass("hscroll"):e.$container.removeClass("hscroll"),i}function n(){let i=Math.max(0,e.$.timelineContent.offsetHeight-e.$.taskTimelineContainer.offsetHeight);return i>0&&"hidden"!==e.verticalScrollBarVisibility||"visible"===e.verticalScrollBarVisibility?e.$container.addClass("vscroll"):e.$.mainSplitter.contains(e.$.resourceSplitter)?(i=1,t=!0,e.$.resourceVerticalScrollBar.max||e.$container.removeClass("vscroll")):e.$container.removeClass("vscroll"),i}const a=e.scrollWidth,s=e.scrollHeight;let r=i(),o=n();o&&s===o||(r=i()),r&&a===r||(o=n()),e.scrollWidth=r,e.scrollHeight=o,e.$.verticalScrollBar.disabled=t,e.$.horizontalScrollBar.refresh(),e.$.verticalScrollBar.refresh(),e.$.mainSplitter.contains(e.$.resourceSplitter)&&(e._refreshResourceScrollBar(),e._refreshTableScrollTop(e.$.resourceTable))}_refreshProjectTasks(e,t){const i=this,n=i._getProjectTasks(e);if(!n.length)return;const a=i.nonworkingDays,s=i.nonworkingHours,r=i._timelineVCells;for(let e=0,o=n.length;e<o;e++){const o=n[e];if(o){const e=i._getTaskDOMIndex(o),n=r[e],l=o.segments;if(o.dateStart=new Date(Math.max(i.dateStart.getTime(),o.dateStart.getTime()+t.startTime)),o.dateEnd=new Date(Math.min(i.dateEnd.getTime(),o.dateEnd.getTime()+t.endTime)),o.duration=i._convertDuration(a.length>0||s.length>0?i._getWorkingTime(o.dateStart,o.dateEnd):o.dateEnd.getTime()-o.dateStart.getTime(),!0),l&&l.length>1){for(let e=0,i=l.length;e<i;e+=1){const i=l[e];i.dateStart=new Date(i.dateStart.getTime()+t.startTime),i.dateEnd=new Date(i.dateEnd.getTime()+t.endTime)}i._validateTaskSegments(o)}n&&(i._recycleTaskBars(n,e),i._setTimelineTaskBar(n,e),l&&l.length>1&&i._setTaskBarProgress(o),i._refreshTaskConnections(o),i._refreshTableColumnsData(o,["dateStart","dateEnd","duration","overdue"]))}}}_refreshProject(e){const t=this;function i(e){let i,n,a;if(e instanceof HTMLElement)i=e.offsetLeft,a=e.offsetWidth;else if(e){const s=t._getTimelineTaskCellByDate(e.dateStart),r=t._getTimelineTaskCellByDate(e.dateEnd);s&&r&&(i=s.left+t._getTimelineTaskOffset(s,e.dateStart)||0,n=r.left+t._getTimelineTaskOffset(r,e.dateEnd)||0,a=n-i)}return[i,a]}if(!e)return;const n=t.groupByResources&&e.isGroup?"group":"project";if(e.synchronized)for(;e&&e.synchronized;){const a=t._getProjectTasks(e);let s=a[0],r=a[0];for(let e=0;e<a.length;e++)s.dateStart.getTime()>=a[e].dateStart.getTime()&&(s=a[e]),r.dateEnd.getTime()<=a[e].dateEnd.getTime()&&(r=a[e]);const o=t.$.timelineTasksContainer.children,l=t.$.timelineContent.offsetWidth;let d,c,m;for(let t=0,i=o.length;t<i;t+=1){const i=o[t],n=i._cellObj?i._cellObj.task:void 0;n&&(n===e?d=i:n===s?c=i:n===e&&(m=i))}if(!d){s&&(e.dateStart=s.dateStart),r&&(e.dateEnd=r.dateEnd),e=e.$[n];continue}s&&(e.dateStart=s.dateStart);let[u,h]=i(c||s);void 0!==u&&void 0!==h&&(t.rightToLeft?(d.style.width=d.offsetWidth-(l-u-h-(l-d.offsetLeft-d.offsetWidth))+"px",d.style.right=c?c.style.right:u+"px"):(d.style.width=d.offsetWidth-(u-d.offsetLeft)+"px",d.style.left=c?c.style.left:u+"px")),r&&(e.dateEnd=r.dateEnd),[u,h]=i(m||r),void 0!==u&&void 0!==h&&(t.rightToLeft?d.style.width=Math.max(0,d.offsetWidth-(l-d.offsetLeft-(l-u)))+"px":d.style.width=Math.max(0,d.offsetWidth-(d.offsetLeft+d.offsetWidth-(u+h)))+"px"),t._refreshTask(d),e=e.$[n]}else t._refreshProject(e.$[n])}_refreshTask(e,t){const i=this,n=i._getTaskBarCellRange(e),a=n.cellStart,s=n.cellEnd;if(!n||!a||!s)return;e._cellStart=a,e._cellEnd=s;const r=i._getTaskBarDateRange(e);if(!r)return;const o=e._cellObj.task;if(Array.from(i.$.taskTimelineCellsContainer.children).find((e=>e._cellObj.task===o))){if(o.dateStart=r.dateStart,o.dateEnd=r.dateEnd,o.duration=o.duration=i._convertDuration(i.nonworkingDays.length>0||i.nonworkingHours.length>0?i._getWorkingTime(o.dateStart,o.dateEnd):o.dateEnd.getTime()-o.dateStart.getTime(),!0),e.setAttribute("aria-label",o.label+" Start date: "+i._toISODate(o.dateStart)+", End date: "+i._toISODate(o.dateEnd)),i._refreshTaskConnections(e),t)Array.isArray(t)&&i._refreshTaskSegments(e,t);else{const t=i._dragDetails;let n;e.classList.contains("task")?t&&t.segments?n=t.segments:t.segments=n=e.querySelectorAll(".smart-task-segment"):n=e.querySelectorAll(".smart-task-segment"),i._refreshTaskSegments(e,n)}i._refreshTableColumnsData(o,["dateStart","dateEnd","duration","overdue"])}}_refreshTaskSegments(e,t){const i=this,n=e._cellObj.task;if(!n||!n.segments||!n.segments.length)return void i._setTaskBarDeadline(n,t?t[0]:void 0);const a=i.nonworkingDays.length>0||i.nonworkingHours.length>0,s=i.rightToLeft,r=s?"right":"left",o=parseFloat(e.style[r])||e.offsetLeft;let l;for(let n=0,d=t.length;n<d;n+=1){const d=t[n],c=d._segmentObj,m=i._getSegmentCellRange(d),u=m.cellStart,h=m.cellEnd;if(!m||!u||!h)continue;const g=parseFloat(d.style.width)||d.offsetWidth,f=o+parseFloat(d.style[r])||(s?(parseFloat(e.style.width)||e.offsetWidth)-(d.offsetLeft+d.offsetWidth):d.offsetLeft);d._cellStart=u,d._cellEnd=h,l=d;let p=i._getDateFromCell(f,u),_=i._getDateFromCell(f+g,h);c.dateStart=p,c.dateEnd=_,c.duration=i._convertDuration(a?i._getWorkingTime(p,_):_.getTime()-p.getTime(),!0),e.setAttribute("aria-label",(c.label||"")+" Start date: "+i._toISODate(p)+", End date: "+i._toISODate(_))}i._setTaskBarProgress(n,e),i._setTaskBarDeadline(n,l)}_refreshTaskResources(e,t=[]){const i=this;if(e&&(t||(t=i._getTaskResources(e)),t.length))for(let e=0;e<t.length;e++){const n=t[e];i._refreshResource(n),i._refreshTableColumnsData(n,void 0,"resource")}}_refreshTableColumnsData(e,t,i){const n=this;if(i||(i="task"),!e)return;const a=n[`${i}Columns`],s=n.$[`${i}Table`];if(!n.$.mainSplitter.contains(s))return;const r=e.$.id;t=t?t.map((e=>a.find((t=>t.value===e)))):a;for(let i=0;i<t.length;i++){const a=t[i];a&&s.setValue(r,a.value,n._formatColumnData(e,a))}n.$[`${i}Splitter`].refresh()}_removeConnection(e,t){const i=this,n=i.$.connectionPopupWindow,a=i.$.timelineConnectionsContainer;if(e.classList&&e.classList.contains("smart-task-connection")?e=e.getAttribute("connection-id"):e+="",void 0===e)return;const s=a.querySelectorAll('.smart-task-connection[connection-id^="'+e+(e.indexOf("-")<0?"-":"")+'"]'),r=i._tasks,o=e.split("-"),l=parseInt(o[1]);for(let e=0;e<s.length;e++)a.removeChild(s[e]);let d;const c=parseInt(o[0]),m=parseInt(o[1]),u=parseInt(o[2]);if(n&&void 0!==n._target&&"number"==typeof n._target.type){const t=n._target;d=t.startIndex+"-"+t.endIndex+"-"+t.type===e}i._updateConnection([c,m,u],!0),!t&&i.autoSchedule&&(i._autoScheduleRestore(r[l],parseInt(o[2])),i._autoSchedule(r[l])),d&&i.$.fireEvent("itemRemove",{type:"connection",id:`${c}-${m}-${u}`,item:{source:c,target:m,type:u}})}_removeTaskConnections(e,t){const i=this,n=i._connections;if(n&&n.length){for(let t=0,i=n.length;t<i;t+=1)n[t].startTask===e&&(n.splice(t,1),i--);e.connections=[],t&&i._recycleConnections()}}_removeTask(e){const t=this,i=t._tasks;if(!e||!i||!i.length)return;const n=t._getSelection("task",t.selectedTaskIds),a=t.$.taskPopupWindow;let s;if(t._highlightAssignedItem("task",[e]),a&&a._target===e&&a.close(),"project"===e.type){const n=t._getProjectTasks(e);for(let e=0,t=n.length;e<t;e+=1)i.splice(i.indexOf(n[e]),1)}if(i.splice(i.indexOf(e),1),t._refreshItemIds(),t._refreshConnectionIds(),t._isUpdating)return t._isUpdating.type.task=!0,void(t._isUpdating.type.resource=!0);t._refreshSelectedItems(),t._refreshTableDataSource(),t._refreshTimeline(),t._selected&&t._selected.task&&(s=t._selected.task.map((e=>e.$.id)),n.toString()!==s.toString()&&(t.$.taskTable.selected=t._getSelection("task",t.selectedTaskIds))),t.$.fireEvent("itemRemove",{type:"task",id:"string"==typeof e.id||"number"==typeof e.id?e.id:e.$.id,item:t._cloneObject(e)})}_removeResource(e){const t=this,i=t._resources,n=i.indexOf(e);if(e&&!(n<0)){if(t._isUpdating)return i.splice(n,1),t._isUpdating.type.resource=!0,void(t._isUpdating.type.task=!0);if(i.splice(n,1),t.groupByResources)t._refreshTableDataSource(),t._createTimelineContent(),t._refresh(),t._recycleTimelineTasks();else if(t.taskColumns.find((e=>"resources"===e.value))){const i=t._tasks.filter((t=>t.resources.includes(e.id)));for(let e=0;e<i.length;e++)t._refreshTableColumnsData(i[e],["resources"])}if(!i.filter((e=>!e.hidden)).length)return t._createResourceTimeline(),t._resizeEventHandler(),void a();t._refreshResourceTimeline(),t._refreshTableDataSource("resource"),t.$.mainSplitter.contains(t.$.resourceSplitter)?(t._refreshResourceScrollBar(),t._resizeEventHandler(),a()):a()}function a(){t.$.fireEvent("itemRemove",{type:"resource",id:"string"==typeof e.id||"number"==typeof e.id?e.id:e.$.id,item:t._cloneObject(e)})}}_updateTask(e,t){const i=this,n=i._tasks;if(!e||!n||!n.length)return;const a=i.$.taskPopupWindow,s=i._getSelection("task",i.selectedTaskIds);a&&a._target===e&&a.close();let r,o=i._getTaskResources(e);for(let a in t){let s=e[a],l=t[a];if("type"===a&&s!==l&&["task","project","milestone"].indexOf(l)>-1&&"project"===s){const t=i._getProjectTasks(e);for(let e=0,i=t.length;e<i;e+=1)n.splice(n.indexOf(t[e]),1);delete e.tasks}if("project"!==e.type||!e.synchronized||!(a.toLowerCase().indexOf("date")>-1||a.toLowerCase().indexOf("duration")>-1))if("dateEnd"===a&&new Date(s).getTime()!==new Date(l).getTime()&&(r=!0),"tasks"!==a)"connections"===a&&(i._removeTaskConnections(e),i._handleTaskConnections(e)),e[a]=l,"resources"===a&&(i._handleResources(e),e.disableResources||(o=o.concat(i._getTaskResources(e)),o=o.filter(((e,t)=>o.indexOf(e)===t)))),"milestone"!==e.type||"dateStart"!==a&&"dateEnd"!==a||(e.dateEnd=e.dateStart=l);else if("project"===e.type){const t=i._getProjectTasks(e);for(let e=0,i=t.length;e<i;e+=1)n.splice(n.indexOf(t[e]),1);const a=i._createTasks(l,!0);for(let t=0,i=a.length;t<i;t+=1)a[t].$.project=e;i._insertTasks(a,e,n.indexOf(e))}}r&&delete e.duration;const l=e.$,d=e.$.project;if(i._validateTaskProperties(e,d),e.$=l,d&&i._synchronizeProjectDates(d),"project"===e.type&&e.hidden&&i._getProjectTasks(e).forEach((t=>t.hidden=e.hidden)),i._synchronizeProjectVisibility(e.$.project,e),i._refreshItemIds(),i._refreshConnectionIds(),i._isUpdating)return void(i._isUpdating.type.task=!0);let c;i._selected&&i._selected.task&&i._setSelection("task",c=i._selected.task.map((e=>e.$.id))),i._refreshTableDataSource(),i._refreshTimeline(),i._ensureVisible(e),c&&s.toString()!==c.toString()&&(i.$.taskTable.selected=c.slice(0)),i._refreshTaskResources(e,o),i._highlightAssignedItem("task",i._getSelection("task",i.selectedTaskIds)),i.$.fireEvent("itemUpdate",{type:"task",id:"string"==typeof e.id||"number"==typeof e.id?e.id:e.$.id,item:i._cloneObject(e)})}_updateResource(e,t){const i=this;if(!e)return;const n=e.hidden;if(i._setResource(e,t),i._isUpdating)i._isUpdating.type.resource=!0;else{if(i.groupByResources)i._refreshTableDataSource(),i._refreshTimeline();else if(i.taskColumns.find((e=>"resources"===e.value))){const t=i._tasks.filter((t=>t.resources.includes(e.id)));for(let e=0;e<t.length;e++)i._refreshTableColumnsData(t[e],["resources"])}if(n!==e.hidden)return i._createResourceTimeline(),void i.$.fireEvent("itemUpdate",{type:"resource",id:"string"==typeof e.id||"number"==typeof e.id?e.id:e.$.id,item:i._cloneObject(e)});if(i._refreshTableColumnsData(e,void 0,"resource"),i.$.mainSplitter.contains(i.$.resourceTimelineCellsContainer)){const t=i.$.resourceTimelineCellsContainer.children;for(let n=0;n<t.length;n++){const a=t[n];a._resource===e&&i._refreshResourceTimelineContent(e,a)}}i.$.fireEvent("itemUpdate",{type:"resource",id:"string"==typeof e.id||"number"==typeof e.id?e.id:e.$.id,item:i._cloneObject(e)})}}_select(e="task",t){const i=this;if(i.disableSelection||!t)return void i._unselectAll(e);let n,a;"task"===e?(n="selectedTaskIds",a=i._tasks):(n="selectedResourceIds",a=i._resources);const s=a.findIndex((e=>e.$.id===t)),r=i._getSelection(e,i[n]);s<0||(r.indexOf(t)>-1?i.$[`${e}Table`].unselect(t):i.$[`${e}Table`].select(t))}_handleTableSelection(e="task",t){const i=this;if(i.disableSelection||!t.length)return void i._unselectAll(e);let n,a,s,r,o,l=i._selected;l||(l=i._selected={});const d=t[t.length-1],c=l[e]=[];"task"===e?(o=i._tasks,n="selectedTaskIds",a=i.$.taskTimelineCellsContainer.children,s=i.$.timelineTasksContainer.children):(o=i._resources,n="selectedResourceIds",a=i.$.resourceTimelineCellsContainer.children,s=[]);for(let e=0,i=o.length;e<i;e+=1){const i=o[e];t.indexOf(i.$.id)>-1&&c.push(i)}for(let i=0,n=a.length;i<n;i+=1){const n=a[i],o=s[i],l=n._cellObj[e].$.id;d===l&&(r=s[i]),t.indexOf(l)>-1?(n.setAttribute("selected",""),n.setAttribute("aria-selected","true"),o&&o.setAttribute("selected","")):(n.removeAttribute("selected"),n.setAttribute("aria-selected","false"),o&&o.removeAttribute("selected"))}const m=i[n].slice(0);if(i._setSelection(e,t),!i._tableChangeEventFired){const n=document.scrollingElement||document.documentElement,a=n.scrollLeft,s=n.scrollTop;i._highlightAssignedItem(e,t),i.$[`${e}Table`].focus({preventScroll:!0}),window.scrollTo(a,s)}if("task"===e&&r){const e=r._cellStart;if(i.scrollLeft>e.left||e.left+r.offsetWidth>i.scrollLeft+i.$.timeline.offsetWidth){const t=i._timelineCells.indexOf(e);i._scrollTo((i._timelineCells[t-1]?i._timelineCells[t-1]:e).date)}}i._noChangeEvent||i.$.fireEvent("change",{type:e,value:i[n].slice(0),oldValue:m})}_setSelection(e="task",t){const i=this;let[n,a]="task"===e?[i._tasks,"selectedTaskIds"]:[i._resources,"selectedResourceIds"],s=[];for(let e=0,i=t.length;e<i;e+=1){const i=t[e],a=n.find((e=>e.$.id===i));a&&s.push(void 0!==a.id?a.id:i)}i.set(a,s)}_getSelection(e="task",t){const i="task"===e?this._tasks:this._resources;let n=t.slice(0);if(!t||!t.length)return n;for(let e=0,a=i.length;e<a;e+=1){const a=i[e],s=t.indexOf(a.id);s>-1&&(n[s]=a.$.id)}return n}_highlightAssignedItem(e,t){const i=this,[n,a]="task"===e?["resource","_getTaskResources"]:["task","_getResourceTasks"],s=i.$[`${n}Table`],r=i[`_${n}s`];if(!s||!i.$.mainSplitter.contains(s)||!r.length)return;t&&Array.isArray(t)||(t=[]);let o=[];for(let n=0,s=t.length;n<s;n+=1){const s=i._getValidItemAndIndex(t[n],e);s&&(o=o.concat(i[a](s.item).filter((e=>!e.hidden))))}i._tableChangeEventFired=!0,s.selected=o.map((e=>e.$.id)),o.length&&i._ensureVisible(o[0],n),delete i._tableChangeEventFired}_selectResource(e){const t=this,i=t._resources.indexOf(e);if(i<0)return void t._unselectAll("resource");const n=t.$.resourceTimelineCellsContainer.children[i];n&&n.hasAttribute("selected")?t._unselectAllTasks():t.$.resourceTree.focus({preventScroll:!0})}_snapToNearest(e,t){const i=this;if(!(i.snapToNearest&&e&&e.classList&&e.classList.contains("smart-timeline-task")&&e._cellObj))return;const n=e._cellObj.task,a=n.segments;if(t&&t.classList.contains("smart-task-segment")){const n=a.indexOf(t._segmentObj),s=0===n,r=n===a.length-1;if(i._handleSnapToNearestSegment(e,t,s?"first":r?"last":void 0),i._refreshTaskSegments(e,[t]),!s&&!r)return;i._refreshTask(e,!0)}else i._handleSnapToNearest(i._getTaskBarCellRange(e),e),i._refreshTask(e);if(a&&a.length>1){for(let e=0,t=a.length;e<t;e+=1)i._snapToNearestDates(a[e],!0);i._validateTaskSegments(n),n.segments.length!==a.length&&i._recycleSegments(n,e),i._setTaskBarSegments(e._cellObj,e,!0),i._setTaskBarProgress(n)}if("project"!==n.type||!n.dragProject)return;const s=i._getProjectTasks(n);if(s&&Array.isArray(s))for(let e=0;e<s.length;e++){const t=i.$.timelineTasksContainer.children[i._tasks.indexOf(s[e])];t&&i._snapToNearest(t)}}_handleSnapToNearestSegment(e,t,i){const n=this,a=n.rightToLeft,s=a?"right":"left",r=parseFloat(e.style[s])||0,o=t,l=n._getSegmentCellRange(t),d=l.cellStart,c=l.cellEnd,m="first"===i,u="last"===i;let h=parseFloat(o.style.width)||o.offsetWidth,g=parseFloat(o.style[s])||0,f=r+g;if(n.hasAttribute("dragged")){const t=c.width-(f+h-c.left);let n;if(f-d.left<=t?(n=d.left-r,o.style[s]=Math.max(0,m?0:n)+"px"):(n=g+t,o.style[s]=Math.max(0,m?0:n)+"px"),i){const t=parseFloat(e.style.width)||e.offsetWidth;m&&(e.style[s]=r+(n-g)+"px"),e.style.width=t+(m?-1:1)*(n-g)+"px"}}else if(n.hasAttribute("resized")){const t=d===c?n._taskBarMinWidth:0;let l;if("left"===n.$.timeline.getAttribute("task-bar-hovered")){if(l=f-d.left,l-=l>=d.width/2?d.width-t:0,f-=l,o.style[s]=Math.max(0,m?0:f-r)+"px",l=f+h>c.left+c.width/2?c.left+c.width-(f+h):c.left-(f+h),o.style.width=Math.max(t,h+l)+"px",i){const t=parseFloat(e.style.width)||e.offsetWidth;m&&!a&&(e.style[s]=f+"px",e.style.width=t+l+"px"),u&&a&&(e.style.width=t+l+"px")}}else if(f>d.left+d.width/2?(f=d.left+d.width,o.style[s]=Math.max(0,m?0:f-r)+"px"):(f=d.left,o.style[s]=Math.max(0,m?0:f-r)+"px"),l=f+h-c.left,l=-1*(l-(l>=d.width/2?c.width:t)),o.style.width=h+l+"px",i){const t=parseFloat(e.style.width)||e.offsetWidth;m&&a&&(e.style[s]=f+"px",e.style.width=t+l+"px"),u&&!a&&(e.style.width=t+l+"px")}}}_handleSnapToNearest(e,t){const i=this;if(!e)return;const n=i.rightToLeft?"right":"left",a=e.cellStart,s=e.cellEnd;let r=parseFloat(t.style.width)||t.offsetWidth,o=parseFloat(t.style[n])||0;if(i.hasAttribute("dragged")){const e=s.width-(o+r-s.left);o-a.left<=e?t.style[n]=a.left+"px":t.style[n]=o+e+"px"}else if(i.hasAttribute("resized")){const e=a===s?i._taskBarMinWidth:0;let l;"left"===i.$.timeline.getAttribute("task-bar-hovered")?(l=o-a.left,l-=l>=a.width/2?a.width-e:0,t.style[n]=(o-=l)+"px",l=o+r>s.left+s.width/2?s.left+s.width-(o+r):s.left-(o+r),t.style.width=Math.max(e,r+l)+"px"):(o>a.left+a.width/2?t.style[n]=a.left+a.width+"px":t.style[n]=a.left+"px",o=parseFloat(t.style[n])||0,l=o+r-s.left,l=-1*(l-(l>=a.width/2?s.width:e)),t.style.width=r+l+"px")}}_setDragLimits(e){const t=this,i=t._dragDetails;if(!i)return;const n=i.timelineTask;if(!n||!e)return;const a=t.$.timeline.getAttribute("task-bar-hovered"),s=n._cellObj.task;if(a){if(s.disableResize)return void delete t._dragDetails;const e=t._getTaskBarSizeLimits(n,a);i.min.width=e.min,i.max.width=e.max,t._setSegmentLimits(a);const r=t._createDelimiter("min",a),o=t._createDelimiter("max",a);r&&n.appendChild(r),o&&n.appendChild(o)}else if(e.closest(".smart-task-connection-point"))i.timelineTask=void 0;else if(e.closest(".smart-timeline-task")===n){let e;if(t._connections){const i=t._tasks.indexOf(n._cellObj.task);e=t._connections.some((e=>e.startIndex===i||e.endIndex===i))}if(s.disableDrag||e&&t.autoSchedule&&t.autoScheduleStrictMode)return void delete i.target;i._taskDuration=t._getWorkingTime(s.dateStart,s.dateEnd),n.classList.contains("milestone")&&(i.target="smart-timeline-task-fill");const a=t._getTaskDragLimits(n),r=t.rightToLeft?t.$.timelineContent.offsetWidth-n.offsetLeft-n.offsetWidth:n.offsetLeft;if(void 0!==a.min&&(i.min.left=a.min,"project"===n._cellObj.task.type&&a.min>r&&(i.min.left=r)),void 0!==a.max&&(i.max.left=a.max,"project"===n._cellObj.task.type&&a.max<r&&(i.max.left=r)),"project"===s.type&&s.dragProject&&!t.synchronized){const e=t._getSubTaskLimits(n);void 0!==e.min&&(i.min.left=i.min.left?Math.max(i.min.left,e.min):e.min),void 0!==e.max&&(i.max.left=i.max.left?Math.min(i.max.left,e.max):e.max)}else"milestone"===s.type&&(i.target="smart-timeline-task-fill");t._setSegmentLimits()}else i.timelineTask=void 0;i.relatedConnections={}}_setSegmentLimits(e){const t=this,i=t._dragDetails;if(!i||!i.segment)return;const n=i.segment;if(n){const a=n.element,s=n.dimensions,r=a.previousElementSibling,o=a.nextElementSibling;if(n.min.width=e?t._taskBarMinWidth:0,t.rightToLeft){if(r)n.min.left="left"===e?s.left+s.width:r.offsetLeft-(e?0:s.width),"right"===e&&(n.max.width=r.offsetLeft-s.left);else if(!e){const e=t._getTaskBarSizeLimits(i.timelineTask,"right");i.min.width=e.min,i.max.width=e.max}if(o)n.max.left="right"===e?n.dimensions.left:o.offsetLeft+o.offsetWidth+s.width,e&&"left"!==e||(n.max.width=s.left+s.width-(o.offsetLeft+o.offsetWidth));else if(!e){const e=t._getTaskBarSizeLimits(i.timelineTask,"left");i.min.width=e.min,i.max.width=e.max}}else{if(r)n.min.left="right"===e?s.left:r.offsetLeft+r.offsetWidth+(e||o?0:s.width),"left"===e&&(n.max.width=s.left+s.width-n.min.left);else if(!e){const e=t._getTaskBarSizeLimits(i.timelineTask,"left");i.min.width=e.min,i.max.width=e.max}if(o)n.max.left="left"===e?s.left+s.width:o.offsetLeft-s.width,e&&"right"!==e||(n.max.width=o.offsetLeft-s.left);else if(!e){const e=t._getTaskBarSizeLimits(i.timelineTask,"right");i.min.width=e.min,i.max.width=e.max}}}}_setScrollBars(){const e=this;e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e.$.taskSplitterItem,e.$.horizontalScrollBar,e.$.verticalScrollBar));const t=e._scrollView.vScrollBar,i=e._scrollView.hScrollBar;i.$.addClass("smart-hidden"),t.$.addClass("smart-hidden"),t.hasStyleObserver=!1,i.hasStyleObserver=!1,t.hasResizeObserver=!1,i.hasResizeObserver=!1,t.rightToLeft=i.rightToLeft=e.rightToLeft,i.wait=!1,e._refresh()}_getWorkingTime(e,t){const i=this;if(!e||!t)return;if(!i.adjustToNonworkingTime)return t.getTime()-e.getTime();const n=i.nonworkingHours,a=i.nonworkingDays;function s(e,t){let i,s,r=t.getTime()-e.getTime(),o=new Date(e),l=0;for(;r>0;){const e=Math.min(r,36e5-(60*o.getMinutes()*1e3+1e3*o.getSeconds()+o.getMilliseconds()));if(a.indexOf(o.getDay())>-1)s=new Date(o),s.setHours(0,0,0,0),s.setDate(o.getDate()+1),i=Math.min(e,s.getTime()-o.getTime()),o=new Date(o.getTime()+i),r-=i;else if(n.indexOf(o.getHours())>-1){s=new Date(o);const t=s.getTime();s.setHours(o.getHours()+1,0,0,0),t===s.getTime()&&s.setHours(o.getHours()+2,0,0,0),i=Math.min(e,s.getTime()-o.getTime()),o=new Date(o.getTime()+i),r-=i}else l+=e,r-=e,o=new Date(o.getTime()+e)}return l}if(e.getFullYear()===t.getFullYear())return s(e,t);let r=new Date(e.getFullYear()+1,0,1,0,0,0,0),o=s(e,r);if(t.getFullYear()>r.getFullYear()){const e=Math.max(0,t.getFullYear()-r.getFullYear());for(let t=0;t<e;t++){let e=i._getWorkingDaysBetweenDays(r);o+=60*(24*e-e*i.nonworkingHours.length)*60*1e3,r.setFullYear(r.getFullYear()+1)}}return o+=s(r,t),o}_getWorkingDaysBetweenDays(e){const t=this,i=e.getFullYear(),n=(i%100==0?i%400==0:i%4==0)?366:365;let a=new Date(e),s=0;for(let e=0;e<n;e++)t.nonworkingDays.indexOf(a.getDay())<0&&s++,a.setDate(a.getDate()+1);return s}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.tabIndex=-1:e.tabIndex=e.tabIndex>0?e.tabIndex:0}_setTaskBarLabel(e,t){const i=this;void 0===t&&(t=i._getTaskDOMIndex(e));const n=i.$.timelineTasksContainer.children[t];if(!n)return;const a=n.querySelector(".smart-task-segments").children;let s=e.segments;Array.isArray(s)&&s&&s.length&&"task"===e.type||(s=[e]);for(let r=0,o=s.length;r<o;r+=1){const o=s[r],l=a[r],d=l?l.getElementsByClassName("smart-timeline-task-label")[0]:void 0;if(!d)continue;d.firstElementChild||(d.innerHTML="<div></div>");let c=d.firstElementChild;"string"==typeof o.label||"number"==typeof o.label?c.textContent=o.formatFunction?o.formatFunction(o.label||"",t)||"":o.label||"":c.textContent=e.formatFunction?o.formatFunction(e.label||"",t)||"":e.label||"",i.onTaskRender&&i.onTaskRender(e,o,n,l,c),e.onRender&&e.onRender(e,o,n,l,c)}}_setTaskBarProgress(e,t){const i=this;if("number"==typeof t?t=i.$.timelineTasksContainer.children[t]:void 0===t&&(t=i.$.timelineTasksContainer.children[i._getTaskDOMIndex(e)]),!t||!e)return;let n=e.progress;const a=t.querySelector(".smart-timeline-task-progress-thumb");if(!a)return;n=Math.min(100,Math.max(0,n))||0;const s=e.dateStart.getTime(),r=e.dateEnd.getTime(),o=t.querySelector(".smart-task-segments").children;let l,d,c=e.segments,m=0;c&&c.length||(c=[e]);for(let e=0,t=c.length;e<t;e+=1){const t=c[e],i=o[e],a=i?i.querySelector(".smart-timeline-task-progress"):void 0;if(!a)continue;const u=(t.dateStart.getTime()-s)/(r-s)*100,h=(t.dateEnd.getTime()-s)/(r-s)*100,g=Math.max(0,Math.min(100,(n-u)/(h-u)*100));a.style.width=g+"%",a.removeAttribute("value"),i.removeAttribute("show-progress-label"),n>=u?(m=Math.max(u,Math.min(n,h)),l=a,d=i):l||(l=a,d=i)}if(a.style[i.rightToLeft?"left":"right"]="",a.style[i.rightToLeft?"right":"left"]=m+"%",!l||!i.showProgressLabel)return;const u=i.progressLabelFormatFunction;d.setAttribute("show-progress-label",""),l.setAttribute("value",u?u(n)+"":parseFloat(n.toFixed(2))+"%")}_setTaskDeadline(e,t,i){const n=this,a=e.task,{timelineStart:s,timelineEnd:r}=i,o=a.deadline,l=n.$.timelineDeadlines,d=l.children,c=o&&o.getTime&&!isNaN(o.getTime())?o.getTime():void 0;let m;for(let e=0,i=d.length;e<i;e+=1){const i=d[e];if(parseInt(i.getAttribute("task-index"))===t){m=i;break}}if(!c||c<s||c>r)return void(m&&m.remove());const u=n._getTimelineCellByDate(o),[h,g]=n.rightToLeft?["right","left"]:["left","right"];m||(m=document.createElement("div"),m.classList.add("smart-gantt-chart-task-deadline"),m.setAttribute("task-index",t),l.appendChild(m)),m.setAttribute("date",o.toString()),m.setAttribute("title",n._formatDate(o)),m.style.top=e.top+"px",m.style[g]="",m.style[h]=u.left+(n._getTimelineTaskOffset(u,o)||0)+"px"}_setTaskBarDeadline(e,t){const i=this,n=e.deadline;if(!n||!n.getTime||isNaN(n)||!t)return;const a=e.deadline.getTime()-e.dateEnd.getTime();if(!e.deadline||a>0)return t.removeAttribute("deadline"),void(e.overdue=!1);e.overdue=!0,t.setAttribute("deadline",`${i.localize("overdue")}: ${Math.round(i._convertDuration(Math.abs(a),!0))} ${i.durationUnit+"s"}`)}_setTaskIndicators(e,t,i){const n=this,a=e.task,{timelineStart:s,timelineEnd:r}=i,[o,l]=n.rightToLeft?["right","left"]:["left","right"],d=n.$.taskIndicatorsContainer,c=d.children,m=a.indicators;let u;for(let e=0,i=c.length;e<i;e+=1){const i=c[e];if(parseInt(i.getAttribute("task-index"))===t){u=i;break}}if(!Array.isArray(m))return void(u&&u.remove());const h=document.createDocumentFragment(),g=document.createDocumentFragment();u||(u=document.createElement("div"),u.classList.add("smart-gantt-chart-indicator"),u.setAttribute("task-index",t),h.appendChild(u));const f=u.children;for(;f.childElementCount>m.length;)f.firstElementChild.remove();for(let t=0,i=m.length;t<i;t+=1){let i=f[t];const a=m[t],d=a.date;if(!d||!d.getTime){i&&i.remove();continue}const c=d.getTime();if(c<s||c>r){i&&i.remove();continue}const u=n._getTimelineCellByDate(d),h=a.label,p=a.className,_=a.icon;i||(i=document.createElement("div"),g.appendChild(i)),i.className="smart-gantt-chart-task-indicator",i._indicatorObj=a;const T=i.classList;"string"==typeof p&&T.add(p),_?(T.add("icon"),i.style.setProperty("--smart-gantt-chart-indicator-icon",`'${_}'`)):T.contains("icon")&&(T.remove("icon"),i.style.removeProperty("--smart-gantt-chart-indicator-icon")),i.textContent=h||"",i.style.top=e.top+"px",i.style[l]="",i.style[o]=u.left+(n._getTimelineTaskOffset(u,d)||0)+"px"}g.childElementCount&&u.appendChild(g),h.childElementCount&&d.appendChild(h)}_setTimelineTaskBar(e,t,i){const n=this,a=e.task,s=void 0===t?n._getTaskDOMIndex(a):t,r=n.$.timelineTasksContainer.children,o=r[s];let l,d;if(0===r.length||!o||!o.classList||!o.classList.contains("smart-timeline-task"))return;const c=a.dateStart instanceof Date?a.dateStart:new Date(a.dateStart),m=a.dateEnd instanceof Date?a.dateEnd:new Date(a.dateEnd);if(l=!i&&o._cellStart||n._getTimelineCellByDate(c),d=!i&&o._cellEnd||n._getTimelineCellByDate(m),!l||!d)return void o.classList.add("smart-visibility-hidden");o._cellStart=l,o._cellEnd=d,o.classList.remove("smart-visibility-hidden");const u=n._getTaskBarDetails(e,l,d);u&&(o.style[n.rightToLeft?"left":"right"]="",o.style[n.rightToLeft?"right":"left"]=u.left+"px",o.style.width=u.width?u.width+"px":"",o.style.top=u.top+"px"),n._setTaskBarSegments(e,o,i)}_setTimelineTaskBaseline(e,t){const i=this,n=e.task,a=i.$.timelineBaselinesContainer;if(!i.showBaseline)return void(a.innerHTML&&(a.innerHTML=""));const s=n.planned,r=a.children;let o;for(let e=0,i=r.length;e<i;e+=1){const i=r[e];if(parseInt(i.getAttribute("task-index"))===t){o=i;break}}if(!s||"milestone"===n.type||!s.dateStart||!s.dateEnd)return void(o&&o.remove());const l=s.dateStart,d=s.dateEnd,c=i._getTimelineCellByDate(l),m=i._getTimelineCellByDate(d);if(!c||!m)return;o||(o=document.createElement("div"),o.classList.add("smart-gantt-chart-task-baseline"),o.setAttribute("task-index",t),a.appendChild(o));const[u,h]=i.rightToLeft?["right","left"]:["left","right"],g=i._getTaskBarDetails(e,c,m);if(g){const e=o.style;e.width=g.width?g.width+"px":"",e.top=g.top+"px",e[u]=g.left+"px",e[h]=""}o.setAttribute("aria-label",n.label+" Start date: "+i._toISODate(l)+", End date: "+i._toISODate(d))}_setTaskBarSegments(e,t,i){const n=this,a=e.task,s=t.querySelector(".smart-task-segments").children;let r,o,l=a.segments;if(Array.isArray(l)&&l&&l.length&&"task"===a.type||(l=[a]),1===l.length){const e=s[0].style;return void(e.right=e.left=e.width="")}const d=n.rightToLeft,c=parseFloat(t.style[d?"right":"left"]);let m;for(let e=0,t=l.length;e<t;e+=1){const t=l[e],a=s[e];if(!a)continue;const u=t.dateStart instanceof Date?t.dateStart:new Date(t.dateStart),h=t.dateEnd instanceof Date?t.dateEnd:new Date(t.dateEnd);r=!i&&a._cellStart||n._getTimelineCellByDate(u),o=!i&&a._cellEnd||n._getTimelineCellByDate(h),a._cellStart=r,a._cellEnd=o;const g=n._getTaskBarDetails({task:t},r,o);g&&(a.style[d?"left":"right"]="",a.style[d?"right":"left"]=Math.max(0,g.left-c)+"px",a.style.width=g.width+"px"),m=a}n._setTaskBarDeadline(a,m)}_setCurrentTimeIndicators(){const e=this;if(clearInterval(e._currentTimeIndicatorInterval),delete e._currentTimeIndicatorInterval,e.currentTimeIndicator||e.shadeUntilCurrentTime)e._refreshTimeIndicators(),e._currentTimeIndicatorInterval=setInterval(e._refreshTimeIndicators.bind(e),1e3*e.currentTimeIndicatorInterval);else{const t=e.$.timelineIndicatorsContainer;t&&t.remove()}}_refreshTimeIndicators(){const e=this,t=e.currentTime,i=e.view,n=e._getTodayCellObj(t);let a=e.$.timelineIndicatorsContainer;if(!n)return a&&a.remove(),clearInterval(e._currentTimeIndicatorInterval),void delete e._currentTimeIndicatorInterval;a||(e.$.timelineIndicatorsContainer=a=document.createElement("div"),a.classList.add("smart-gantt-chart-time-indicators-container"),a.setAttribute("role","presentation"));const s=new Date(n.date);let r,o,l=t.getMinutes();switch(i){case"quarter":case"year":{const e=new Date(t.getFullYear(),t.getMonth()+1,1,0,0,0,0);e.setDate(0),l+=24*t.getDate()*60,r=24*e.getDate()*60;break}case"month":l+=24*(t.getDay()+1)*60,r=10080;break;case"week":l+=60*t.getHours(),r=1440;break;case"day":r=s.getHours()+60}o={cellObj:n,minutes:l,max:r,today:t},e._refreshCurrentTimeShader(o),e._refreshCurrentTimeIndicator(o),a.childElementCount||(clearInterval(e._currentTimeIndicatorInterval),delete e._currentTimeIndicatorInterval),a.parentElement||e.$.timelineContent.appendChild(a)}_refreshCurrentTimeIndicator(e){const t=this,i=t.$.timelineIndicatorsContainer;let n=i.querySelector(".smart-gantt-chart-current-time-indicator");if(!t.currentTimeIndicator||!e)return void(n&&n.remove());const{cellObj:a,minutes:s,max:r}=e;n||(n=document.createElement("div"),n.classList.add("smart-gantt-chart-current-time-indicator")),t.rightToLeft?n.style.right=a.left+a.width*(s/r)+"px":n.style.left=a.left+a.width*(s/r)+"px",n.setAttribute("aria-label","Current Time Indicator"),n.parentElement||i.appendChild(n),t._setTodayCell(a.date)}_refreshCurrentTimeShader(e){const t=this.$.timelineIndicatorsContainer;let i=t.querySelector(".smart-gantt-chart-current-time-shader");if(!this.shadeUntilCurrentTime||!e)return void(i&&i.remove());const{cellObj:n,minutes:a,max:s}=e;i||(i=document.createElement("div"),i.classList.add("smart-gantt-chart-current-time-shader")),i.style.width=n.left+n.width*(a/s)+"px",i.setAttribute("aria-label","Current Time Shader"),i.parentElement||t.appendChild(i)}_setTodayCell(e){const t=this;if(e)e instanceof Date&&(e=e.getTime());else{let i=0;e=t.currentTime,"day"===t.view&&(i=e.getHours()),e.setHours(i,0,0,0),e=e.getTime()}if("number"!=typeof e)return;const i=t.$.timelineViewCells.children;for(let t=0;t<i.length;t++){const n=i[t],a=new Date(n._date);a&&(a.getTime()===e?n.setAttribute("current",""):n.removeAttribute("current"))}}_getTodayCellObj(e){const t=this,i=t.view,n=t._timelineCells;e&&e.getTime||(e=t.currentTime);for(let t=0,a=n.length;t<a;t+=1){const a=n[t],s=a.date;switch(i){case"quarter":case"year":if(e.getFullYear()===s.getFullYear()&&e.getMonth()===s.getMonth())return a;break;case"month":{const t=new Date(e);if(t.setDate(e.getDate()-e.getDay()),e.getFullYear()===s.getFullYear()&&e.getMonth()===s.getMonth()&&t.getDate()===s.getDate())return a;break}case"week":if(e.getFullYear()===s.getFullYear()&&e.getMonth()===s.getMonth()&&e.getDate()===s.getDate())return a;break;case"day":if(e.getFullYear()===s.getFullYear()&&e.getMonth()===s.getMonth()&&e.getDate()===s.getDate()&&s.getHours()===e.getHours())return a}}}_getTaskDOMIndex(e){const t=this.$.timelineTasksContainer.children;if(!e||void 0===e.$.id)return-1;for(let i=0,n=t.length;i<n;i+=1)if(t[i]._cellObj.task===e)return i;return-1}_getTimelineCellByDate(e,t,i){const n=this,a=n._timelineCells;if(!a||0===a.length)return;const s=a.length-1;i=Math.min(s,"number"==typeof i?i:s);for(let s=t=Math.min(i,Math.max(0,"number"==typeof t?t:0));s<=i;s++){const t=a[s];if(!t)continue;const i=t.date;switch(n.view){case"quarter":case"year":if(i.getFullYear()===e.getFullYear()&&i.getMonth()===e.getMonth())return t;break;case"month":{const n=new Date(i);let a=new Date(i);if(a.setDate(a.getDate()+(6-a.getDay())+1),a.setMilliseconds(a.getMilliseconds()-1),e.getTime()>=n.getTime()&&e.getTime()<=a.getTime())return t;break}case"week":if(i.getFullYear()===e.getFullYear()&&i.getMonth()===e.getMonth()&&i.getDate()===e.getDate())return t;break;case"day":if(i.getFullYear()===e.getFullYear()&&i.getMonth()===e.getMonth()&&i.getDate()===e.getDate()&&i.getHours()===e.getHours())return t}}const r=a[0],o=a[a.length-1];return e.getTime()<r.date.getTime()?r:e.getTime()>o.date.getTime()?o:void 0}_refreshViewDetailCell(e,t,i){const n=this,a=n._timelineCells,s=e.date;let r=0,o=0===i?0:void 0;for(void 0===t&&(t=0);t<a.length;t++){const e=a[t],i=n._getCellWidth(e,s);if(i)void 0===o&&(o=e.left+e.width-i),r+=i;else if(e.date.getTime()>s.getTime())break}return n._isLastWeekCellNotFull&&(delete n._isLastWeekCellNotFull,t--),e.width=r,e.left=o,t}_getCellWidth(e,t){const i=this,n=e.date,a=(e,t)=>e.getFullYear()===t.getFullYear(),s=(e,t)=>e.getMonth()===t.getMonth(),r=e.width;switch(i.view){case"month":{let e=new Date(n),o=new Date(e),l=0;for(o.setDate(o.getDate()+(6-e.getDay())+1),o.setMilliseconds(o.getMilliseconds()-1);e.getTime()<=o.getTime();)a(e,t)&&s(e,t)&&l++,e.setDate(e.getDate()+1);if(0===l)return;"day"!==i.monthScale&&(i._isLastWeekCellNotFull=l/7!=1);let d=r*l/7;return d<70?70:d}case"quarter":case"year":if(a(n,t))return r;break;case"week":{const e=new Date(t),a=new Date(t);if(-1!==i.firstDayOfWeek){const t=e.getDay()-i.firstDayOfWeek;e.setDate(e.getDate()-e.getDay()+i.firstDayOfWeek-(t>=0?0:7)),a.setDate(e.getDate()+6)}else e.setDate(t.getDate()-t.getDay()),a.setDate(t.getDate()+(6-t.getDay()));if(n.getTime()>=e.getTime()&&n.getTime()<=a.getTime())return r;break}case"day":if(a(n,t)&&s(n,t)&&n.getDate()===t.getDate())return r}}_getCellByOffsetLeft(e){const t=this._timelineCells;if(!e)return;let i;for(let n=0;n<t.length&&!(t[n].left>=e);n++)i=t[n];return i}_unselectAll(e,t){const i=this,n=i.$[`${e}TimelineCellsContainer`];let a;delete i._selected;const s=n.querySelectorAll(".smart-timeline-row[selected]");for(let e=0;e<s.length;e++)s[e].removeAttribute("selected");if("task"===e){a="selectedTaskIds";const e=i.$.timelineTasksContainer.querySelectorAll(".smart-timeline-task[selected]");for(let t=0;t<e.length;t++)e[t].removeAttribute("selected"),e[t].setAttribute("aria-selected","false")}else a="selectedResourceIds";if(i[`_${e}TreeChangeEventFired`]||i.$[e+"Table"].clearSelection(),i._highlightAssignedItem(e),t)return;const r=i[a].slice(0);r.length&&(i[a]=[],i._noChangeEvent||i.$.fireEvent("change",{value:[],oldValue:r,type:e}))}_getSegmentCellRange(e){const t=this;if(!e.classList||!e.classList.contains("smart-task-segment"))return;const i=e.closest(".smart-timeline-task");if(!i)return;let n,a,s=i._cellStart,r=i._cellEnd;s&&r||({cellStart:s,cellEnd:r}=t._getTaskBarCellRange(i));const o=t.rightToLeft,l=parseFloat(e.style.width)||e.offsetWidth,d=t._timelineCells;let c=parseFloat(i.style[o?"right":"left"]);c&&!isNaN(c)||(c=i.offsetLeft,o&&(c=t.$.timelineContent.offsetWidth-c));const m=c+parseFloat(e.style[o?"right":"left"])||(o?(parseFloat(i.style.width)||i.offsetWidth)-(e.offsetLeft+e.offsetWidth):e.offsetLeft),u=parseFloat((m+l).toFixed(2));for(let e=d.indexOf(s),t=d.indexOf(r);e<=t;e++){const t=d[e],i=t.left,s=t.width,r=parseFloat((i+s).toFixed(2));if(m>=i&&m<=r&&(n=t),!a&&u>i&&u<=r&&(a=t),n&&a)break}return n||(n=a||d[0]),a||(a=d[d.length-1]),{cellStart:n,cellEnd:a}}_getTaskBarCellRange(e){const t=this;if(!e.classList||!e.classList.contains("smart-timeline-task"))return;let i=parseFloat(e.style.width)||e.offsetWidth;const n=t._timelineCells,a=t.$.timelineContent,s=parseFloat(e.style[t.rightToLeft?"right":"left"])||(t.rightToLeft?(parseFloat(a.style.width)||a.offsetWidth)-(e.offsetLeft+e.offsetWidth):e.offsetLeft);let r,o;e.classList.contains("milestone")&&(i/=2);const l=parseFloat((s+i).toFixed(2));for(let e=0;e<n.length;e++){const t=n[e],i=t.left,a=t.width,d=parseFloat((i+a).toFixed(2));if(s>=i&&s<=d&&(r=t),!o&&l>i&&l<=d&&(o=t),r&&o)break}return r||(r=e.classList.contains("milestone")&&o?o:n[0]),o||(o=n[n.length-1]),{cellStart:r,cellEnd:o}}_getDateFromCell(e,t,i){if(!t)return new Date;const n=this,a=new Date(t.date);let s,r=0,o=0,l=new Date(a);switch(l.setHours(0,0,0,0),i||(i=n.view),i){case"quarter":case"year":s=new Date(a.getFullYear(),a.getMonth()+1,0).getDate(),r=1,l.setDate(s);break;case"month":r=a.getDate(),s=7,l.setDate(l.getDate()+6);break;case"week":s=1,r=a.getDate();break;case"day":s=1/24,r=a.getDate(),o=a.getHours()}l.setHours(23,59,59,999);const d=parseFloat(((e-t.left)/t.width*s).toFixed(12)),c=Math.min(s,Math.floor(d)),m=d%1*24,u=Math.floor(m),h=60*Math.abs(m-u),g=Math.floor(h),f=60*Math.abs(h-g),p=Math.floor(f),_=1e3*Math.abs(f-p),T=Math.floor(_),b=new Date(a.getFullYear(),a.getMonth(),r+c,o+u,g,p,T);return b.getTime()>l?l:b}_getCellDateRange(e){if(!e||!e._date)return;const t=new Date(e._date);let i=new Date(t);switch(i.setHours(0,0,0,0),this.view){case"quarter":case"year":i.setDate(1),i.setMonth(i.getMonth()+1),i.setDate(0);break;case"month":i.setDate(i.getDate()+6);break;case"day":return i.setHours(t.getHours(),59,59,999),{dateStart:t,dateEnd:i}}return i.setHours(23,59,59,999),{dateStart:t,dateEnd:i}}_getTasksJSON(){const e=this;let t=e._tasks;return function t(i,n){if(!i)return;let a=[];for(let s=0;s<i.length;s++){const r=i[s];let o;if(!r.$.project&&!n||r.$.project===n){const i=e._getTaskConnections(r).taskConnections;o=e._cloneObject(r,!0),i.length&&(o.connections=i.map((e=>{const t={target:e.endIndex,type:e.type};return e.lag&&(t.lag=e.lag),t}))),o.tasks=t(e._getProjectTasks(r),r),delete o.$,a.push(o)}}return a}(t)}_cloneObject(e,t){let i={};for(let n in e){let a=e[n];"tasks"!==n&&("connections"!==n?a instanceof Date?i[n]=t?a.toISOString():new Date(a):i[n]=a:i[n]=JSON.parse(JSON.stringify(a)))}return t||delete i.$,i}_setTable(e){const t=this;e||(e=t.$.taskTable);const[i,n]=e===t.$.taskTable?[t.taskColumns,"task"]:[t.resourceColumns,"resource"];if(!t.contains(e))return;if(!i.length)return void(t.$[n+"Table"].dataSource=[]);const a=t._getTableColumns(n);"task"===n&&(e.filterRow=t.filterRow,[e.grouping,e.groupFormatFunction]=t.groupByResources?[!0,t._formatResourceGroups.bind(t)]:[!1,null]),e.isRendered&&e.resetState("expanded"),e.style.setProperty("--smart-table-row-height",""),e.columns=a,e.dataSource=t._getTableDataSource(n,a),e.wait&&(t.$.taskTable.hasResizeObserver=!1,e.$.virtualizationContainer._scrollView.disableSwipeScroll=!0,e.$.virtualizationContainer.verticalScrollBarVisibility="hidden",e.$.virtualizationContainer.disabled=!0,e.columnMinWidth=t.columnMinWidth,e.columnResize=t.columnResize,e.columnResizeFeedback=t.columnResizeFeedback,e.filtering=t[`${n}Filtering`],e.sort=t.sortFunction,e.sortMode=t.sortMode,e.keyboardNavigation=t.keyboardNavigation,e.selectionByHierarchy=!1,e.selection=!t.disableSelection,e.hideSelectionColumn=!t.showSelectionColumn,e.onKeyboardScroll=(i,n)=>{const a=e===t.$.taskTable?t:t._resourceScrollView;n!==a.scrollTop&&(a.scrollTop=n)},e.wait=!1),e.$.virtualizationContainer.scrollTop="task"===n?t.scrollTop:t.$.resourceVerticalScrollBar.value,t._refresh()}_formatResourceGroups(e){const t=this,i=t._resources,n=e.data.data.resources.split(",");let a=[];for(let e=0,t=i.length;e<t;e+=1){const t=i[e],s=t.id+"";n.indexOf(s)>-1&&a.push(t.label||t.value||t.id)}t.resourceGroupFormatFunction?e.template=t.resourceGroupFormatFunction(n):e.template="<strong>"+(a.length?a.join(", "):t.localize("unassigned"))+"</strong>"}_formatResourceGroupLabel(e){const t=this,i=t._resources,n=e.split(",");if(!e)return t.localize("unassigned");let a=[];for(let e=0,t=i.length;e<t;e+=1){const t=i[e],s=t.id+"";n.indexOf(s)>-1&&a.push(t.label||t.value||t.id)}return a.length?a.join(", "):t.localize("unassigned")}_getTableColumns(e="task"){const t=this,i=["dateStart","dateEnd","minDateStart","maxDateStart","minDateEnd","maxDateEnd"],n=["progress","capacity","workload","maxCapacity","minCapacity"];let a="task"===e?t.taskColumns:t.resourceColumns,s=[];"task"===e&&t.groupByResources&&!a.find((e=>"resources"===e.value))&&(a=a.slice(0),a.push({label:"",value:"resources",hidden:!0}));for(let r=0,o=a.length;r<o;r++){const o=a[r],l=o.value,d={};d.label=t.localize(o.label)||o.label,d.dataField=l,l.startsWith("date")||i.indexOf(l)>-1?d.dataType="date":d.dataType="overdue"===l?"boolean":l.startsWith("duration")||n.indexOf(l)>-1?"number":"string",o.hidden&&(d.visible=!1),"function"==typeof o.formatFunction?d.formatFunction=i=>{const n=t._getValidItemAndIndex(i.data.itemId,e).item,a=i.column.toLowerCase();let s=i.value;a.indexOf("date")>-1?s=new Date(s):"resources"===a&&(s=s?s.split(","):[]),i.template=o.formatFunction.call(t,s,n?t._cloneObject(n):void 0)}:["date","number"].indexOf(d.dataType)>-1?d.formatFunction=i=>{const n=t._getValidItemAndIndex(i.data.itemId,e).item,a=t._formatColumnData(t._cloneObject(n),o);i.template=a}:"overdue"===l&&(d.formatFunction=e=>{const t=e.cell;e.value+""=="true"?t.setAttribute("overdue",""):t.removeAttribute("overdue"),e.value=""},d.width=t._taskDefaultHeight),o.size&&(d.width=o.size),s.push(d)}return s}_getTableDataSource(e="task",t){const i=this,n="task"===e?i._getTableData(i._tasks,i.taskColumns,e):i._getTableData(i._resources,i.resourceColumns,e),a=i.groupByResources,s=(()=>{let e=[];e.push("itemId: string"),e.push("projectId: string"),e.push("itemIndex: number"),a&&e.push("resources: string");for(let i=0,n=t.length;i<n;i+=1){const n=t[i];e.push(`${n.dataField}: ${n.dataType}`)}return e})();return i.groupByResources?new window.Smart.DataAdapter({dataFields:s,dataSource:n,groupBy:["resources"],id:"itemId"}):new window.Smart.DataAdapter({dataFields:s,dataSource:n,keyDataField:"itemId",parentDataField:"projectId",id:"itemId"})}_refreshTableDataSource(e="task"){const t=this,i="task"===e?t.$.taskTable:t.$.resourceTable;t.contains(i)&&(i.resetState("expanded"),i.dataSource=t._getTableDataSource(e,t._getTableColumns(e)))}_refreshColumnsHeaders(e){const t=this;e||(e="task");const i=t.$[`${e}Table`].columns,n=t[`${e}Columns`];for(let e=0,a=i.length;e<a;e++)i[e].label=t.localize(n[e].label)||n[e].label;!arguments.length&&t.$.mainSplitter.contains(t.$.resourceSplitter)&&t._refreshColumnsHeaders("resource")}_getTaskResourceIds(e){const t=e.resources,i=this._resources.map((e=>e.id));let n=[];if(Array.isArray(t))for(let e=0,a=t.length;e<a;e+=1){const a=t[e].id||t[e];i.indexOf(a)>-1&&n.push(a)}return n.sort()}_getTableData(e,t,i){const n=this,a=n.groupByResources;i||(i="task");const s=t.map((e=>e.value));let r=[],o=[];for(let l=0,d=e.length;l<d;l+=1){const d=e[l];if(d.hidden||a&&d.disableResources)continue;const c={},m=d.$.project,u=n._getTaskResourceIds(d);for(let e=0,a=s.length;e<a;e+=1)c[s[e]]=n._formatColumnData(d,t[e],i);c.expanded=a||d.expanded,c.itemId=d.$.id||d.id||"",c.itemIndex=l,u&&u.length?c.resources=u.toString():delete c.resources,d.$&&m&&(m.$.id?c.projectId=d.$.project.$.id:o.push(((e,t)=>{e.projectId=t.$.id}).bind(null,d,m))),r.push(c)}for(let e=0,t=o.length;e<t;e+=1)o[e]();return r}_formatColumnData(e,t){const i=this,n=t.value;let a=e[n];if(n){const e=(n+"").toLowerCase();if(e.indexOf("date")>-1||t.dateFormat)return i._formatDate(a,t);if(e.indexOf("duration")>-1||t.numberFormat){const e=parseFloat(a.toFixed(1));return t.numberFormat?i._formatNumber(e,t.numberFormat):e}}return null!=a?a.toString():i.localize("unassigned")}_formatDate(e,t){const i=this;if(e=Date.parse(e),!isNaN(e)){let n=t?t.dateFormat:void 0;if("string"==typeof n)return new Smart.Utilities.DateTime(new Date(e)).toString(n);if("object"==typeof n)n=t.dateFormat;else{const e=i.view;n={year:"numeric",month:"2-digit",day:"numeric"},["day","week"].indexOf(e)>-1&&(n.hour="numeric",n.minute="numeric",n.second="numeric")}return new Intl.DateTimeFormat(i.locale,n).format(new Date(e))}}_formatNumber(e,t,i){const n=this;if("object"==typeof t)return new Intl.NumberFormat(n.locale,t).format(""+e);i||(i={percentSymbol:"%",currencySymbol:"$",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","});const a=e=>"number"==typeof e&&isFinite(e);if(""===t||null===t)return e;let s;a(e)||(e*=1),t.length>1&&(s=parseInt(t.slice(1),10));let r={},o=t.charAt(0).toUpperCase();switch(r.thousandsSeparator=i.thousandsSeparator,r.decimalSeparator=i.decimalSeparator,o){case"D":case"d":case"F":case"f":r.decimalPlaces=s;break;case"N":case"n":r.decimalPlaces=0;break;case"C":case"c":r.decimalPlaces=s,"before"===i.currencySymbolPosition?r.prefix=i.currencySymbol:r.suffix=i.currencySymbol;break;case"P":case"p":r.suffix=i.percentSymbol,r.decimalPlaces=s;break;default:throw"Bad number format specifier: "+o}if(a(e)){const t=e<0;let i=e+"";const n=r.decimalSeparator?r.decimalSeparator:".";let s;if(a(r.decimalPlaces)){var l=r.decimalPlaces,d=Math.pow(10,l);if(i=(e*d).toFixed(0)/d+"",s=i.lastIndexOf("."),l>0)for(s<0?(i+=n,s=i.length-1):"."!==n&&(i=i.replace(".",n));i.length-1-s<l;)i+="0"}else{let t=e+"";s=t.lastIndexOf("."),s>0&&void 0===l&&"."!==n&&(t=t.replace(".",n))}if(r.thousandsSeparator){const e=r.thousandsSeparator;s=i.lastIndexOf(n),s=s>-1?s:i.length;let a=i.substring(s),o=-1;for(var c=s;c>0;c--)o++,o%3==0&&c!==s&&(!t||c>1)&&(a=e+a),a=i.charAt(c-1)+a;i=a}return i=r.prefix?r.prefix+i:i,i=r.suffix?i+r.suffix:i,i}return e}_validateDate(e,t){return e[t]=this._dateValidator(void 0,e[t]),e[t]&&!isNaN(e[t].getTime())||(e[t]=void 0),e[t]}_validateTaskProperties(e,t){const i=this;if(e.$={},e.tasks instanceof Array&&e.tasks.length>0?e.type="project":(!e.type||["project","task","milestone"].indexOf(e.type)<0)&&(e.type="task"),i._validateTaskDuration(e),void 0===e.hidden&&t&&(e.hidden=t.hidden),e.hidden=!!e.hidden,void 0===e.resources?e.resources=[]:e.resources=[e.resources].reduce(((e,t)=>e.concat(t)),[]),"project"===e.type?e.expanded=!!e.expanded:delete e.expanded,e.progress=Math.min(Math.max(0,parseFloat(e.progress)||0),100),i._validateTaskDates(e,t),i._validateTaskSegments(e),i._validateTaskIndicators(e),i._validateTaskPlannedDates(e),e.deadline){const t=i._validateDate(e,"deadline");!t||isNaN(t.getTime())?delete e.deadline:e.dateEnd&&(e.overdue=e.deadline.getTime()-e.dateEnd.getTime()<0)}else e.overdue=!1,delete e.deadline;if(!e.dateStart&&!e.dateEnd&&"project"===e.type&&!e.synchronized)return;const n=e.connections;if(n instanceof Array){for(let e=0;e<n.length;e++){const t=n[e],i=t.target="string"==typeof t.target?t.target:parseInt(t.target),a=t.type=parseInt(t.type);null==i||"number"==typeof i&&isNaN(i)||isNaN(a)?(n.splice(n.indexOf(t),1),e--):t.lag=parseInt(t.lag)||0}e.connections=e.connections.map((e=>Object.assign({},e)))}else e.connections=[];return e.class=e.class?e.class+"":"",e.class=void 0!==e.class&&null!==e.class?e.class:"",e}_validateTaskIndicators(e){const t=this,i=e.indicators;if(!i||!Array.isArray(i)||!i.length)return void delete e.indicators;let n=[];for(let e=0,a=i.length;e<a;e+=1){const a=i[e];if("object"!=typeof a)continue;const s=t._validateDate(a,"date");s&&s.getTime&&!isNaN(s.getTime())&&n.push(a)}e.indicators=n}_validateTaskSegments(e){const t=this,i=e.segments;if(!i||!Array.isArray(i)||i.length<2||"task"!==e.type)return void delete e.segments;const n=t.nonworkingDays.length>0||t.nonworkingHours.length>0;let a,s=[],r=[];for(let e=0,n=i.length;e<n;e+=1){const n=i[e];if("object"!=typeof n)continue;let a=parseFloat(n.duration);isNaN(a)&&delete n.duration,t._validateTaskDates(n),n.dateStart&&n.dateEnd&&s.push(n)}s.sort(((e,t)=>e.dateStart.getTime()-t.dateStart.getTime()));for(let i=0,o=s.length;i<o;i+=1){const o=s[i];let l=o.dateStart,d=o.dateEnd;o.dateStart=l=new Date(Math.max(e.dateStart.getTime(),l.getTime())),o.dateEnd=d=new Date(Math.min(e.dateEnd.getTime(),d.getTime())),a&&a.dateEnd.getTime()>l.getTime()&&(o.dateStart=l=new Date(a.dateEnd.getTime()+1e3),l.getTime()>=d.getTime())||l.getTime()>d.getTime()||(o.duration=t._convertDuration(n?t._getWorkingTime(l,d):d.getTime()-l.getTime(),!0),a=o,r.push(o))}r.length<2?delete e.segments:(r[0].dateStart=new Date(e.dateStart),r[r.length-1].dateEnd=new Date(e.dateEnd),e.segments=r)}_validateTaskDuration(e){const t=this;let i=t._convertDuration(parseFloat(e.duration))||0,n=t._convertDuration(parseFloat(e.minDuration))||0,a=t._convertDuration(parseFloat(e.maxDuration))||0;n&&a&&(a=Math.max(n,a)),i&&(n?i=Math.max(n,i):a&&(i=Math.min(i,a))),e.duration=t._convertDuration(i,!0),e.minDuration=t._convertDuration(n,!0),e.maxDuration=t._convertDuration(a,!0)}_validateTaskDates(e,t){const i=this,n=i._convertDuration(e.minDuration),a=i._convertDuration(e.maxDuration);let s=i._convertDuration(e.duration);if(void 0!==e.minDateStart&&(e.minDateStart=i._validateDate(e,"minDateStart")),void 0!==e.maxDateStart&&(e.maxDateStart=i._validateDate(e,"maxDateStart")),e.minDateStart&&e.maxDateStart&&(e.maxDateStart=new Date(Math.max(e.minDateStart.getTime(),e.maxDateStart.getTime()))),void 0!==e.minDateEnd&&(e.minDateEnd=i._validateDate(e,"minDateEnd")),void 0!==e.maxDateEnd&&(e.maxDateEnd=i._validateDate(e,"maxDateEnd")),e.minDateEnd&&e.maxDateEnd&&(e.maxDateEnd=new Date(Math.max(e.minDateEnd.getTime(),e.maxDateEnd.getTime()))),e.dateStart=i._validateDate(e,"dateStart"),e.dateEnd=i._validateDate(e,"dateEnd"),e.dateStart||(e.minDateStart?e.dateStart=e.minDateStart:e.maxDateStart?e.dateStart=e.maxDateStart:e.dateStart=i.dateStart),e.dateEnd||(e.minDateEnd?e.dateEnd=e.minDateEnd:e.maxDateEnd&&(e.dateEnd=e.maxDateEnd)),e.minDateStart&&(e.dateStart=new Date(Math.max(e.minDateStart.getTime(),e.dateStart.getTime()))),e.maxDateStart&&(e.dateStart=new Date(Math.min(e.maxDateStart.getTime(),e.dateStart.getTime()))),e.minDateEnd&&(e.dateEnd=new Date(Math.max(e.minDateEnd.getTime(),e.dateEnd.getTime()))),e.maxDateEnd&&(e.dateEnd=new Date(Math.min(e.maxDateEnd.getTime(),e.dateEnd.getTime()))),e.dateStart&&(i.min&&(s=Math.min(e.dateStart.getTime()-i.min.getTime(),s),e.duration=i._convertDuration(s,!0)),i.max&&(s=Math.min(i.max.getTime()-e.dateStart.getTime(),s),e.duration=i._convertDuration(s,!0))),!e.dateStart&&s&&e.dateEnd&&(e.dateStart=new Date(e.dateEnd.getTime()-s)),"task"!==e.type||e.dateStart&&!isNaN(e.dateStart.getTime())||!t||(e.dateStart=new Date(t.dateStart)),n&&e.dateStart)if(i.adjustToNonworkingTime&&(i.nonworkingDays.length>0||i.nonworkingHours.length>0)){const t=i._getTaskWorkingDateEnd(e,n);e.dateEnd=new Date(Math.max(e.dateEnd?e.dateEnd.getTime():0,t.getTime()))}else e.dateEnd=new Date(Math.max(e.dateEnd?e.dateEnd.getTime():0,e.dateStart.getTime()+n));if(s&&e.dateStart&&(i.adjustToNonworkingTime&&(i.nonworkingDays.length>0||i.nonworkingHours.length>0)?e.dateEnd=i._getTaskWorkingDateEnd(e,s):e.dateEnd=new Date(e.dateStart.getTime()+s)),s||a){let t;t=i.adjustToNonworkingTime&&(i.nonworkingDays.length>0||i.nonworkingHours.length>0)?i._getTaskWorkingDateEnd(e,Math.max(s,a)):new Date(e.dateStart.getTime()+Math.max(s,a)),e.dateEnd.getTime()>t.getTime()&&(e.dateEnd=t)}"task"===e.type&&!e.dateEnd&&t&&(e.dateEnd=new Date(t.dateEnd)),e.dateStart=i._minMaxDateValidator(e.dateStart),e.dateEnd=i._minMaxDateValidator(e.dateEnd),"milestone"===e.type&&(e.dateStart=i._validateDate(e,"dateStart"),e.dateEnd=i._validateDate(e,"dateEnd"),e.dateStart=e.dateEnd=new Date(Math.max(e.dateStart?e.dateStart.getTime():0,e.dateEnd?e.dateEnd.getTime():0))),(e.dateStart||e.dateEnd||"project"!==e.type||e.synchronized)&&("milestone"!==e.type&&e.dateStart&&(e.dateEnd&&e.dateStart.getTime()>e.dateEnd.getTime()||!e.dateEnd)&&(e.dateEnd=new Date(e.dateStart.getTime()+36e5*("day"===i.view?1:24))),e.dateStart&&e.dateEnd&&(e.duration=i._convertDuration(i.nonworkingDays.length>0||i.nonworkingHours.length>0?i._getWorkingTime(e.dateStart,e.dateEnd):e.dateEnd.getTime()-e.dateStart.getTime(),!0)))}_validateTaskPlannedDates(e){const t=this;if(!e)return;const i=e.type,n=e.planned;if("milestone"===i||!n)return;const a=t._validateDate(n,"dateStart"),s=t._validateDate(n,"dateEnd");a&&s&&(n.duration=t._convertDuration(t.nonworkingDays.length>0||t.nonworkingHours.length>0?t._getWorkingTime(a,s):s.getTime()-a.getTime(),!0))}_synchronizeProjectDates(e,t){const i=this;if(e){void 0===t&&(t=i._getProjectTasks(e));for(let a=0,s=t.length;a<s;a+=1){const s=t[a];e.synchronized&&(s.dateStart&&(e.dateStart=n(s,"dateStart","min")),s.dateEnd&&(e.dateEnd=n(s,"dateEnd","max")),s.minDateStart&&(e.minDateStart=n(s,"minDateStart","max")),s.maxDateStart&&(e.maxDateStart=n(s,"maxDateStart","min")),s.minDateEnd&&(e.minDateEnd=n(s,"minDateEnd","max")),s.maxDateEnd&&(e.maxDateEnd=n(s,"maxDateEnd","min")),e.dateStart&&e.dateEnd&&(e.duration=i._convertDuration(i.nonworkingDays.length>0||i.nonworkingHours.length>0?i._getWorkingTime(e.dateStart,e.dateEnd):e.dateEnd.getTime()-e.dateStart.getTime(),!0)))}e.$&&i._synchronizeProjectDates(e.$.project,t)}function n(t,i,n){const a=e[i];let s=t[i];return void 0===a?new Date(s):s instanceof Date?new Date(Math[n](a.getTime(),s.getTime())):void 0}}_synchronizeProjectVisibility(e,t){const i=this;e&&e.hidden&&!t.hidden&&(e.hidden=t.hidden,e.$&&i._synchronizeProjectVisibility(e.$.project,e))}_mouseWheelHandler(e){const t=this,i=(t.shadowRoot||t).querySelector(".smart-task-popup-window");if(i&&i.modal&&i.opened)return void e.stopPropagation();if(t.disabled||!t.computedHorizontalScrollBarVisibility&&!t.computedVerticalScrollBarVisibility)return;if(e.shiftKey)return void t._handleHorizontalScroll(e);const n=t.$.resourceSplitterItem;t.$.mainSplitter.contains(n)&&n.contains(e.target)?t._handleVerticalScroll(e,!0):t.$.taskSplitterItem.contains(e.target)&&t._handleVerticalScroll(e)}_handleVerticalScroll(e,t){const i=this;let n,a,s,r;if(t){if(n=i.$.resourceVerticalScrollBar,n.classList.contains("smart-hidden")||n.disabled)return!0;a=n.value,s=n.max,r=i._resourceScrollView}else{if(!i.computedVerticalScrollBarVisibility||i.$.verticalScrollBar.disabled)return!0;a=i.scrollTop,s=i.scrollHeight,r=i}if(0===a&&e.deltaY<0||a===s&&e.deltaY>0)return void e.stopPropagation();const o=i.$[t?"resourceTable":"taskTable"];if(e.stopPropagation(),e.preventDefault(),a+=i._getScrollCoefficient(e,i.offsetHeight),r){const e=o.$.virtualizationContainer;e.scrollHeight!==r.scrollHeight&&(e.scrollHeight=r.scrollHeight),r.scrollTo(a,void 0)}o.scrollTop=a,i._hoveredItem&&i._handleTableItemHover()}_handleHorizontalScroll(e){const t=this;if(!t.computedHorizontalScrollBarVisibility)return!0;const i=t.scrollLeft;(0===i&&e.deltaX<0||i===t.scrollHeight&&e.deltaX>0)&&e.stopPropagation(),e.stopPropagation(),e.preventDefault(),t.scrollWidth>0&&t.scrollTo(void 0,t.scrollLeft+t._getScrollCoefficient(e,t.offsetWidth))}_handleHeaderTemplate(e="task"){const t=this;if(!("content"in document.createElement("template")))return void t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()}));const i=t.$[`${e}SplitterItemHeader`],n=t.$[`${e}SplitterItem`],a="task"===e?"headerTemplate":"resourcePanelHeaderTemplate";let s=t[a];if(n.removeAttribute("show-header"),i.innerHTML="",!s)return;if("function"==typeof s)return s(i,{}),void(i.innerHTML?n.setAttribute("show-header",""):n.removeAttribute("show-header"));if("string"==typeof s&&(s=document.getElementById(s)),null===s||!("content"in s))return void t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:a}));let r=document.importNode(s.content,!0);if(n.setAttribute("show-header",""),t.shadowRoot)return i.innerHTML="<slot></slot>",void t.appendChild(r);i.appendChild(r)}_handleCollapseExpandMethods(e,t){const i=this,n=i._tasks;if(null==e||!n||!n.length)return;const a=i._getValidItemAndIndex(e);if(!a||!a.item)return void i.error(i.localize("incorrectArgument",{elementType:i.nodeName.toLowerCase(),methodName:"collapse",argumentName:"task"}));let s=a.item;"project"!==s.type&&(s=s.$.project),s&&(s.hidden?s.expanded="expand"===t:i.$.taskTable["expand"===t?"expandRow":"collapseRow"](s.$.id))}_getValidItemAndIndex(e,t="task"){const i=this,n="task"===t?i._tasks:i._resources;let a;if(null==e||!n||!n.length)return{};if("string"==typeof e||"number"==typeof e){const t=e.toString();let i,s;for(let a=0,r=n.length;a<r;a+=1){const r=n[a];if(!i){const n=r.id;if(null!=n&&n.toString&&n.toString()===t){i=r,e=a;break}}r.$.id===t&&(s=r,e=a)}a=i||s}else"object"==typeof e&&(a=n[i._getItemIndex(e,t)],e=n.indexOf(a));return{item:a,index:e}}_horizontalScrollbarHandler(e){const t=this,i=t._getScrollLeft(e.detail.value);e.stopPropagation&&e.stopPropagation(),t.$.timelineHeader.scrollLeft=t.$.taskTimelineContainer.scrollLeft=i,t.$.mainSplitter.contains(t.$.resourceTimelineHeader)&&(t.$.resourceTimelineHeader.scrollLeft=t.$.resourceTimelineContent.scrollLeft=i),t._recycle(e),e.context.min!==e.context.value?e.context.max===e.context.value&&(t._handleInfiniteTimeline(),t.$.fireEvent("scrollRightReached")):t.$.fireEvent("scrollLeftReached")}_verticalScrollbarHandler(e){const t=this,i=e.target,n=Math.round(e.detail.value);e.stopPropagation&&e.stopPropagation(),i&&i===t.$.resourceVerticalScrollBar?t.$.resourceTable.scrollTop=t.$.resourceTimelineContent.scrollTop=n:(t.$.taskTimelineContainer.scrollTop=n,t.$.taskTable.scrollTop=n),t._recycle(e),e.context.max!==e.context.value?e.context.min===e.context.value&&t.$.fireEvent("scrollTopReached"):t.$.fireEvent("scrollBottomReached")}_handleInfiniteTimeline(){const e=this,t=e._timelineCells;if(!e.infiniteTimeline||!t||!t.length)return;const i=e.infiniteTimelineStep,n=t[t.length-1].date;switch(e.view){case"quarter":case"year":n.setMonth(n.getMonth()+i);break;case"month":n.setDate(n.getDate()+7*i);break;case"week":n.setDate(n.getDate()+i);break;case"day":n.setHours(n.getHours()+i)}e.set("dateEnd",n),e._createTimelineCells(),e._recycleTimelineTasks(!0),e.$.mainSplitter.contains(e.$.resourceSplitter)&&e._refreshResourceTimeline(),e._refresh()}_nonworkingDayValidator(e,t){return this._nonworkingDateTimeValidator(e,t)}_nonworkingTimeValidator(e,t){return this._nonworkingDateTimeValidator(e,t,!0)}_nonworkingDateTimeValidator(e,t,i){const n=this,[a,s,r]=i?[0,23,24]:[0,6,7];let o=[];function l(e){let t=Math.max(a,Math.min(s,parseInt(e[0]))),i=Math.max(a,Math.min(s,parseInt(e[1])));if(!isNaN(t)&&!isNaN(i)){for(;t!==i;)o.push(t),t=t===s?a:++t;o.push(t)}return o}for(let e=0;e<t.length;e++){const i=t[e];"number"!=typeof i||isNaN(i)?"string"==typeof i?o=l(i.split("-").map((e=>parseInt(e)))):Array.isArray(i)&&(o=l(i)):o.push(Math.max(a,Math.min(s,parseInt(i))))}return o.length===r&&(o.pop(),n.warn(n.localize("invalidNonworkingRange",{elementType:n.nodeName.toLowerCase(),property:i?"nonworkingHours":"nonworkingDays"}))),o}});
84
- Smart("smart-list-item",class extends Smart.ContentElement{static get properties(){return{alternationIndex:{value:-1,type:"int"},color:{value:"",type:"string"},displayMode:{allowedValues:["plain","checkBox","radioButton"],value:"plain",type:"string"},grouped:{value:!1,type:"boolean"},selected:{value:!1,type:"boolean"},value:{value:"",type:"string"},label:{value:"",type:"string"},details:{value:"",type:"string"},group:{value:"",type:"string"},hidden:{value:!1,type:"boolean"},readonly:{value:!1,type:"boolean"}}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}get _focused(){const e=this;return void 0===e.__focused&&(e.__focused=!1),e.__focused}set _focused(e){const t=this;t.__focused=e,e?(t.setAttribute("focus",""),t.ownerListBox&&t.ownerListBox.ownerElement&&Smart.ComboBox&&t.ownerListBox.ownerElement instanceof Smart.ComboBox&&t.ownerListBox.ownerElement.$.input.setAttribute("aria-activedescendant",t.id)):t.removeAttribute("focus")}template(){return'<div id="container">\n <span id=\'itemInput\' class=\'smart-input smart-hidden\'></span>\n <span class="smart-overlay" id="overlay"></span>\n <div id="itemContainer" class="smart-content smart-list-item-container"><span class="smart-content-label" inner-h-t-m-l=\'[[innerHTML]]\' role="presentation"><content></content></span><span inner-h-t-m-l=\'[[details]]\' id="details" class="smart-content-details"></span></div>\n </div>'}appendChild(e){const t=this;if(!t.isCompleted||e.classList&&e.classList.contains("smart-ripple")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}window.smartBlazor?t.$.itemContainer.appendChild(e):(t.$.itemContainer.innerHTML="",e instanceof HTMLElement&&t.$.itemContainer.appendChild(e))}insertBefore(e,t){const i=this;if(!i.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(i,e.concat(Array.prototype.slice.call(arguments)))}t.parentNode.insertBefore(e,t)}removeChild(e){const t=this;if(!t.isCompleted||e.classList.contains("smart-ripple")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement&&t.$.itemContainer.removeChild(e)}attached(){super.attached(),this.ownerListBox=this.getListBox()}static get listeners(){return{mouseenter:"_itemOnMouseEnter",mouseleave:"_itemOnMouseLeave"}}ready(){super.ready();const e=this;if(e.setAttribute("role","option"),""!==e.label){let t=e.label;t&&"string"==typeof t&&(t=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")),e.innerHTML=t}else""!==e.innerHTML&&(e.label=e.innerHTML);e._setDisplayMode(e.displayMode),e._setItemColor(),e.$.container.noRipple=!0;const t=e.closest("smart-list-box");if(t&&t.isRendered){if(cancelAnimationFrame(Smart.ListBox.processTimer),t._inLazyInit||t._isUpdating)return;Smart.ListBox.processTimer=requestAnimationFrame((()=>{t._lazyInitItems()}))}}propertyChangedHandler(e,t,i){const r=this;if(super.propertyChangedHandler(e,t,i),"hidden"===e)i?r.$.addClass("smart-hidden"):r.$.removeClass("smart-hidden");else if("color"===e)r._setItemColor();else if("displayMode"===e)r._setDisplayMode(i);else if("label"===e||"value"===e){const t=r.context;r.context=document,"label"===e&&(r.innerHTML=i);const o=r.getListBox();o&&(o._applyTemplate(r),o.onItemUpdated(r)),r.context=t}else if("details"===e){const e=r.context;r.context=document,r.$.details.innerHTML=i;const t=r.getListBox();t&&t.onItemUpdated(r),r.context=e}else if("innerHTML"===e){const e=r.getListBox();e&&e.onItemUpdated(r)}else if("selected"===e)if(i)r.setAttribute("aria-selected",!0);else{const e=r.getListBox();r.readonly||r.disabled||!e||-1===["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox"].indexOf(e.selectionMode)?r.removeAttribute("aria-selected"):r.setAttribute("aria-selected",!1)}}getListBox(){const e=this;if(!Smart.ListBox)return e.getRootNode().host;let t=e.parentNode;for(;t instanceof Smart.ListBox==0&&null!==t;)t=t.parentNode;return!t&&Smart.EnableShadowDOM?e.getRootNode().host:t}_itemOnMouseEnter(){const e=this;!e.disabled&&e.ownerListBox&&(Smart.ListBox.DragDrop.Dragging&&e.ownerListBox.allowDrop&&(Smart.ListBox.DragDrop.DropDetails={item:e,position:"bottom"}),e.ownerListBox.$.verticalScrollBar.thumbCapture||e.ownerListBox.$.horizontalScrollBar.thumbCapture||e.setAttribute("hover",""))}_itemOnMouseMove(e){const t=this;if(t.ownerListBox&&Smart.ListBox.DragDrop.Dragging&&t.ownerListBox.allowDrop&&!Smart.Utilities.Core.isMobile){const i=[].slice.call(t.ownerListBox.getElementsByClassName("smart-list-item-bottom-line-feedback"));for(let e=0;e<i.length;e++)i[e].$.removeClass("smart-list-item-line-feedback"),i[e].$.removeClass("smart-list-item-bottom-line-feedback");if(Smart.ListBox.DragDrop.DropDetails={item:t,position:"top"},!t.ownerListBox._areCSSVarsSupported){if(t.ownerListBox._indexOf(t)===t.ownerListBox._items.length-1||t.parentNode.lastElementChild===t){const i=t.getBoundingClientRect();e.pageY-window.pageYOffset>i.top+i.height/2-1&&(Smart.ListBox.DragDrop.DropDetails={item:t,position:"bottom"})}return}if(t.$.removeClass("smart-list-item-line-feedback"),t.$.removeClass("smart-list-item-bottom-line-feedback"),t.ownerListBox.sorted&&t.ownerListBox.autoSort)return;const r=t.ownerListBox._items.filter((e=>!e.hidden));if(r.indexOf(t)===r.length-1||t.parentNode.lastElementChild===t){const i=t.getBoundingClientRect();e.pageY-window.pageYOffset>i.top+i.height/2-1?(t.$.addClass("smart-list-item-bottom-line-feedback"),Smart.ListBox.DragDrop.DropDetails={item:t,position:"bottom"}):arguments[1]||t.$.addClass("smart-list-item-line-feedback")}else arguments[1]||t.$.addClass("smart-list-item-line-feedback")}}_itemOnMouseLeave(){const e=this;e.ownerListBox&&(Smart.ListBox.DragDrop.Dragging&&(e.$.removeClass("smart-list-item-line-feedback"),e.$.removeClass("smart-list-item-bottom-line-feedback")),e.removeAttribute("hover"))}_setDisplayMode(e){const t=this,i=t.getListBox();if(i){const r="checkBox"===i.selectionMode||"radioButton"===i.selectionMode?i.selectionMode:"plain";t.displayMode=e=r}"plain"!==e?t.$itemInput.removeClass("smart-hidden"):t.$itemInput.addClass("smart-hidden")}_setItemColor(){const e=this,t=e.querySelector(".smart-content-label"),i=/(^#[0-9A-F]{3}$)|(^#[0-9A-F]{6}$)|(^#[0-9A-F]{8}$)/i.test(e.color)?e.color:"";t.style.backgroundColor=i,t.style.color=e._getContrastColor(i)}_getContrastColor(e){if(!e)return"";let t=(i=e.slice(1,3),r=e.slice(3,5),o=e.slice(5,7),[parseInt(i,16),parseInt(r,16),parseInt(o,16)]);var i,r,o;return parseFloat(((.299*t[0]+.61*t[1]+.114*t[2])/255).toFixed(2))>.65?"#000000":"#FFFFFF"}}),Smart("smart-list-items-group",class extends Smart.ContentElement{static get properties(){return{label:{value:"",type:"string"}}}get enableShadowDOM(){return!1}template(){return'<div id="container" role="presentation">\n <span id="itemsLabel" class="smart-list-items-group-label">[[label]]</span>\n <div id="listItemsGroupContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-list-items-group-container" role="presentation">\n <content></content>\n </div>\n </div>'}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement&&t.$.listItemsGroupContainer.appendChild(e)}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 instanceof HTMLElement&&t.$.listItemsGroupContainer.removeChild(e)}getListBox(){let e=this.parentNode;for(;e instanceof Smart.ListBox==0&&null!==e;)e=e.parentNode;return e}attached(){const e=this;super.attached(),e.ownerListBox||(e.ownerListBox=e.getListBox()),e.setAttribute("role","group"),e.$.itemsLabel.id||(e.$.itemsLabel.id=e.id+"Label"),e.setAttribute("aria-labelledby",e.$.itemsLabel.id)}}),Smart("smart-list-box",class extends Smart.ScrollViewer{static get properties(){return{allowDrag:{value:!1,type:"boolean"},allowDrop:{value:!1,type:"boolean"},alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},autoSort:{value:!0,type:"boolean"},dataSource:{value:null,type:"any?",reflectToAttribute:!1},dragFeedbackFormatFunction:{value:null,type:"function?"},dragOffset:{value:[10,10],type:"array"},displayLoadingIndicator:{value:!1,type:"boolean"},displayMember:{value:"",type:"string"},shadowDomMode:{allowedValues:["light","shadow"],value:"shadow",type:"string"},dropAction:{value:"move",type:"string",allowedValues:["copy","move","none"]},editable:{value:!1,type:"boolean"},filterable:{value:!1,type:"boolean"},filterCallback:{value:null,type:"function?"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase","custom"],type:"string"},filterInputPlaceholder:{value:"",type:"string"},grouped:{value:!1,type:"boolean"},groupMember:{value:"",type:"string"},itemTemplate:{value:null,type:"any"},itemHeight:{value:null,type:"number?"},incrementalSearchDelay:{value:700,type:"number?"},incrementalSearchMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},itemMeasureMode:{value:"auto",allowedValues:["auto","precise"],type:"string"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{extend:!0,value:{en:{overridingProperties:'{{elementType}}: Overriding properties {{property1}} and {{property2}} applied. The "{{property1}}" property is used by default.',invalidIndex:'{{elementType}}: "{{method}}" method accepts an index of type number or an Array of numbers.',indexOutOfBound:'{{elementType}}: Out of bound index/indexes in "{{method}}" method.',invalidItem:'{{elementType}}: "{{method}}" method accepts an object or an array of objects as it\'s second parameter.',invalidSettings:'{{elementType}}: "{{method}}" method accepts a string or an object as it\'s second parameter.'}},type:"object"},name:{value:"",type:"string"},placeholder:{value:"No Items",type:"string"},selectedIndexes:{value:[],type:"array"},selectedValues:{value:[],type:"array"},selectionMode:{value:"oneOrManyExtended",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectionChangeAction:{value:"release",allowedValues:["press","release"],type:"string"},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},topVisibleIndex:{value:-1,type:"int"},type:{value:"list",type:"string",defaultReflectToAttribute:!0,readonly:!0},valueMember:{value:"",type:"string"},virtualized:{value:!1,type:"boolean"}}}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}static get styleUrls(){return["smart.listbox.css","smart.dropdown.css","smart.scrollbar.css"]}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler","container.wheel":"_mouseWheelHandler","editInput.change":"_editInputEventHandler","editInput.blur":"_editInputEventHandler","editInput.keydown":"_editInputEventHandler","horizontalScrollBar.change":"_horizontalScrollbarHandler","itemsInnerContainer.down":"_downHandler","itemsInnerContainer.dblclick":"_dblclickEventHandler","itemsInnerContainer.move":"_itemsContainerMoveHandler","itemsContainer.mouseleave":"_mouseLeaveHandler","itemsInnerContainer.touchmove":"_touchmoveHandler","itemsInnerContainer.touchstart":"_touchstartHandler","document.move":"_moveHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler",selectstart:"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",touchmove:"_overriddenHandler",touchstart:"_overriddenHandler","verticalScrollBar.change":"_verticalScrollbarHandler"}}template(){return'<div id="container" class="smart-container" role="presentation">\n <div class="smart-list-box-filter-input-container smart-hidden" id="filterInputContainer" role="presentation"><input id="filterInput" disabled="[[disabled]]" placeholder=\'[[filterInputPlaceholder]]\' role="searchbox" aria-label="[[filterInputPlaceholder]]"></div>\n <div id="itemsContainer" class="smart-list-items-container" role="presentation">\n <div id="placeholder" class="smart-placeholder" role="presentation" aria-hidden="true">[[placeholder]]</div>\n <div id="itemsInnerContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-list-items-inner-container" role="presentation">\n <content></content>\n </div>\n <input type="text" id="editInput" class= "smart-hidden"/>\n </div>\n <smart-scroll-bar wait theme="[[theme]]" right-to-left="[[rightToLeft]]" id="verticalScrollBar" disabled="[[disabled]]" orientation="vertical"></smart-scroll-bar>\n <smart-scroll-bar wait theme="[[theme]]" right-to-left="[[rightToLeft]]" id="horizontalScrollBar" disabled="[[disabled]]"></smart-scroll-bar>\n <div id="loadingIndicatorContainer" class="smart-loader-container" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>'}get value(){const e=this;return e.isRendered&&e._selectedItems.length>0?e._selectedItems.map((e=>({label:e.label,value:e.value}))):null}set value(e){const t=this;if(Array.isArray(e)){const i=t.context;t.context=t,t._isUpdating++,t.selectedValues=[],t.clearSelection();for(let i=0;i<e.length;i++){const r=e[i],o=t.getItem(r);o&&("oneOrManyExtended"===t.selectionMode?t._select(o):t.select(o))}return t.context=i,void t._isUpdating--}const i=t.getItem(e);i&&t.select(i)}get _selectedItems(){const e=this,t=[];if(e.isRendered)for(let i=0;i<e._items.length;i++){const r=e._items[i];r.selected&&t.push(r)}return t}_mouseLeaveHandler(){const e=[].slice.call(this.getElementsByClassName("smart-list-item-bottom-line-feedback"));for(let t=0;t<e.length;t++)e[t].$.removeClass("smart-list-item-line-feedback"),e[t].$.removeClass("smart-list-item-bottom-line-feedback")}_downHandler(e){const t=this;if(t.disabled||t.displayLoadingIndicator||t.readonly)return;let i=e.originalEvent.target,r=null;if(!(i instanceof Smart.ListItem)||i.disabled||i.hidden||i instanceof Smart.ListItemsGroup)for(;i.parentElement;){if(i instanceof Smart.ListItem&&!i.disabled&&!i.hidden&&!(i instanceof Smart.ListItemsGroup)){r=i.dataItem;break}i=i.parentElement}else r=i.dataItem;Smart.ListBox.DragDrop.StartTime=new Date,Smart.ListBox.DragDrop.StartPosition={left:e.pageX,top:e.pageY},r&&(e.stopPropagation(),t.hasRippleAnimation&&(r.readonly||r.disabled||Smart.Utilities.Animation.Ripple.animate(i.$.overlay,e.pageX,e.pageY)),Smart.Utilities.Core.isMobile||"press"!==t.selectionChangeAction||(t._focus(r),t.select(r)),!Smart.ListBox.DragDrop.Feedback&&t.allowDrag&&(Smart.ListBox.DragDrop.DraggedFrom=t,Smart.ListBox.DragDrop.Feedback=document.createElement("span"),t.rightToLeft?Smart.ListBox.DragDrop.Feedback.setAttribute("right-to-left",!0):Smart.ListBox.DragDrop.Feedback.removeAttribute("right-to-left"),t.dragFeedbackFormatFunction?Smart.ListBox.DragDrop.Feedback.innerHTML=t.dragFeedbackFormatFunction(r):Smart.ListBox.DragDrop.Feedback.appendChild(r.offsetHeight?r.cloneNode(!0):t._createItem(r)),Smart.ListBox.DragDrop.Item=r,Smart.Utilities.Extend(Smart.ListBox.DragDrop.Feedback).addClass("smart-popup smart-list-item smart-list-item-feedback")))}_dblclickEventHandler(e){const t=this;if(!t.editable)return;const i=e.target.closest("smart-list-item");i instanceof Smart.ListItem&&!i.disabled&&!i.readonly?(t.$.editInput.dir=t.rightToLeft?"rtl":"ltr",t.$.editInput.style.width=t.$.itemsInnerContainer.offsetWidth+"px",t.$.editInput.owner=i,t.$.editInput.value=i.label,t.$.editInput.style.height=i.offsetHeight+"px",t.$.editInput.style.top=i.offsetTop+t.$.itemsInnerContainer.offsetTop+"px",t.$.editInput.setAttribute("aria-label","Edit item "+i.label),t.$editInput.hasClass("smart-hidden")&&t.$editInput.removeClass("smart-hidden"),t.$.editInput.focus({preventScroll:!0})):t.$editInput.addClass("smart-hidden")}_editInputEventHandler(e){const t=this;if("blur"===e.type||"keydown"===e.type&&"Escape"===e.key)return t.$editInput.hasClass("smart-hidden")||t.$editInput.addClass("smart-hidden"),void t.focus();if("keydown"===e.type||t.$editInput.hasClass("smart-hidden"))return;const i=e.target;if(e.stopPropagation(),i.owner.label!==i.value&&(i.owner.label=i.value,t.itemTemplate&&t._applyTemplate(i.owner),t.dataSource)){const e=i.owner.dataIndex,r=t.dataSource[e];r&&(t.displayMember?r[t.displayMember]=i.value:r.label=i.value)}t.$editInput.addClass("smart-hidden"),t.$.fireEvent("itemLabelChange",{selected:i.owner.selected,disabled:i.owner.disabled,index:t._indexOf(i.owner),label:i.owner.label,value:i.owner.value})}_pointerUpHandler(e){const t=this;let i=e.originalEvent,r=i.target;(t.shadowRoot||t.isInShadowDOM)&&(r=i.originalEvent?i.originalEvent.composedPath()[0]:i.composedPath()[0]);const o=e=>{const i=e.ownerListBox;i.disabled||i!==t||i.displayLoadingIndicator||"none"===i.selectionMode||e.grouped||e.readonly||(i._focus(e),i.select(e),Smart.ListBox.DragDrop.StartPosition=null,t.$.fireEvent("itemClick",{selected:r.selected,disabled:r.disabled,index:t._indexOf(r),label:r.label,value:r.value}))};if(!(i.target instanceof Smart.ListItem)||i.target.disabled||i.target instanceof Smart.ListItemsGroup){for(;r.parentElement;){if(r instanceof Smart.ListItem&&!r.disabled&&!(r instanceof Smart.ListItemsGroup))return void o(r.dataItem);r=r.parentElement}if(this.shadowRoot&&"shadow"===this.shadowDomMode){const e=i.composedPath();for(let t=0;t<e.length;t++){const i=e[t];i instanceof Smart.ListItem&&!i.disabled&&o(i.dataItem)}}}else o(r.dataItem)}_upHandler(e){const t=this;if(super._upHandler(),!t.disabled&&!t.readonly&&Smart.ListBox.DragDrop.StartPosition){if(Smart.Utilities.Core.isMobile&&!Smart.ListBox.DragDrop.Dragging){const i=Math.abs(e.pageX-Smart.ListBox.DragDrop.StartPosition.left),r=Math.abs(e.pageY-Smart.ListBox.DragDrop.StartPosition.top);let o=i>=0&&i<=3&&r>=0&&r<=3;if(Smart.Utilities.Core.isMobile&&new Date-Smart.ListBox.DragDrop.StartTime>=300&&(o=!1,Smart.ListBox.DragDrop.StartTime=null),o){const i=e.originalEvent.target.closest("smart-list-box");i?i._pointerUpHandler(e):t._pointerUpHandler(e),Smart.ListBox.DragDrop.StartPosition=null}else{let t=e.originalEvent.target;if(!(e.target instanceof Smart.ListItem)||t.readonly||e.target.disabled||e.target instanceof Smart.ListItemsGroup)for(;t.parentElement;){if(t instanceof Smart.ListItem&&!t.readonly&&!t.disabled&&!(t instanceof Smart.ListItemsGroup)){e.stopPropagation();break}t=t.parentElement}else e.stopPropagation()}}else if(!Smart.Utilities.Core.isMobile&&!Smart.ListBox.DragDrop.Dragging&&"release"===t.selectionChangeAction){const i=(t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest("smart-list-box");i.upTimer&&clearTimeout(i.upTimer),i.upTimer=setTimeout((()=>{i?i._pointerUpHandler(e):t._pointerUpHandler(e)}))}if(Smart.ListBox.DragDrop.Feedback){let i;if(Smart.ListBox.DragDrop.Feedback.parentNode&&Smart.ListBox.DragDrop.Feedback.parentNode.removeChild(Smart.ListBox.DragDrop.Feedback),Smart.ListBox.DragDrop.Feedback=null,Smart.Utilities.Core.isMobile&&Smart.ListBox.DragDrop.Dragging)for(let t=0;t<Smart.ListBox.DragDrop.ListBoxes.length;t++){const r=Smart.ListBox.DragDrop.ListBoxes[t],o=r.getBoundingClientRect();if(r.allowDrop&&!r.closest(".smart-visibility-hidden")&&o.left<=e.clientX&&e.clientX<=o.left+o.width&&o.top<=e.clientY&&e.clientY<=o.top+o.height){i=r;const t=r._items.filter((e=>!e.hidden));for(let i=0;i<t.length;i++){const s=t[i],n=s.getBoundingClientRect();if((t.indexOf(s)===t.length-1||s.parentNode.lastElementChild===s)&&e.clientY>=o.top+s.offsetTop-r.scrollTop+n.height/2&&e.clientY<=o.top-r.scrollTop+s.offsetTop+n.height){Smart.ListBox.DragDrop.DropDetails={item:s,position:"bottom"};break}if(e.clientY>=o.top+s.offsetTop-r.scrollTop&&e.clientY<=o.top+s.offsetTop+n.height-r.scrollTop){Smart.ListBox.DragDrop.DropDetails={item:s,position:"top"};break}}}}if(Smart.ListBox.DragDrop.Dragging){if(Smart.ListBox.DragDrop.DropDetails){let r=Smart.ListBox.DragDrop.DropDetails.item,o=Smart.ListBox.DragDrop.Item;const s=o.ownerListBox;let n=e.originalEvent.target;if(t.isInShadowDOM&&(n=e.originalEvent?e.originalEvent.composedPath()[0]:e.composedPath()[0]),i=!i&&n.closest?n.closest("smart-list-box"):i,document.body.classList.remove("smart-dragging"),r.$.removeClass("smart-list-item-line-feedback"),r.$.removeClass("smart-list-item-bottom-line-feedback"),i&&r.ownerListBox!==i&&i.items.length>0&&(r=i.items[i.items.length-1]),Smart.ListBox.DragDrop.Item===r||i!==r.ownerListBox&&!Smart.Utilities.Core.isMobile)i&&0===i._items.length&&"none"!==i.dropAction&&("move"===i.dropAction?Smart.ListBox.DragDrop.Item.ownerListBox.removeChild(Smart.ListBox.DragDrop.Item):"copy"===i.dropAction&&(o=o.cloneNode(!0)),i.appendChild(o));else if("none"!==o.ownerListBox.dropAction){r.ownerListBox!==o.ownerListBox&&"move"===o.ownerListBox.dropAction&&Smart.ListBox.DragDrop.Item.ownerListBox.removeChild(Smart.ListBox.DragDrop.Item),"copy"===o.ownerListBox.dropAction&&(o=o.cloneNode(!0)),Smart.ListBox.DragDrop.Item.group=r.group;const e=r.ownerListBox;"checkBox"!==e.selectionMode&&"radioButton"!==e.selectionMode&&e.clearSelection(),"top"===Smart.ListBox.DragDrop.DropDetails.position?e.insertBefore(o,r):r.parentNode.lastElementChild===r?e.appendChild(o):e.appendChild(o,r),e.ensureVisible(o),"checkBox"===e.selectionMode||"radioButton"===e.selectionMode?(e._focus(o),e._refreshSelection()):(e.clearSelection(),e.select(o))}o.selected&&i!==s&&s._refreshSelection();const l=Smart.ListBox.DragDrop.Item,a=l.ownerListBox;l.displayMode="checkBox"===a.selectionMode||"radioButton"===a.selectionMode?a.selectionMode:"plain",a.$.fireEvent("dragEnd",{item:l,target:r,data:Smart.ListBox.DragDrop,previousContainer:s,container:i,originalEvent:e}),a._focus(l)}else{const t=Smart.ListBox.DragDrop.Item,i=t.ownerListBox;t.displayMode="checkBox"===i.selectionMode||"radioButton"===i.selectionMode?i.selectionMode:"plain",document.body.classList.remove("smart-dragging"),i.$.fireEvent("dragEnd",{item:t,target:null,data:Smart.ListBox.DragDrop,previousContainer:i,container:i,originalEvent:e}),i._focus(t)}e.preventDefault()}delete Smart.ListBox.DragDrop.DraggedFrom,Smart.ListBox.DragDrop.Dragging=!1,Smart.ListBox.DragDrop.Item=null,Smart.ListBox.DragDrop.DropDetails=null}for(let e=0;e<Smart.ListBox.DragDrop.ListBoxes.length;e++){const t=Smart.ListBox.DragDrop.ListBoxes[e];t._dragInterval&&clearInterval(t._dragInterval)}}}_itemsContainerMoveHandler(e){const t=this;if(Smart.ListBox.DragDrop.Dragging)return t._applyItemFeedback(e),t._moveHandler(e),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}_touchmoveHandler(e){if(Smart.ListBox.DragDrop.Dragging&&e.cancelable)return e.preventDefault(),void e.stopPropagation();super._touchmoveHandler(e)}_applyItemFeedback(e){const t=this,i=e.originalEvent.target,r=i.closest?i.closest("smart-list-item"):i;Smart.Utilities.Core.isMobile?Smart.ListBox.DragDrop.DropDetails={item:Smart.ListBox.DragDrop.Item,position:"bottom"}:0!==t.items.length&&(r?r._itemOnMouseMove(e):t.items[t.items.length-1]._itemOnMouseMove(e,!0))}_moveHandler(e){const t=this;if(!Smart.ListBox.DragDrop.Feedback||Smart.ListBox.DragDrop.DraggedFrom!==t)return;const i=t.dragOffset;if(Smart.ListBox.DragDrop.Dragging){Smart.ListBox.DragDrop.Feedback.style.left=i[0]+e.pageX+"px",Smart.ListBox.DragDrop.Feedback.style.top=i[1]+e.pageY+"px",t.$.fireEvent("dragging",{item:Smart.ListBox.DragDrop.Item,data:Smart.ListBox.DragDrop,originalEvent:e.originalEvent});for(let t=0;t<Smart.ListBox.DragDrop.ListBoxes.length;t++){const i=Smart.ListBox.DragDrop.ListBoxes[t];i._dragInterval&&clearInterval(i._dragInterval),i._dragInterval=setInterval((function(){const t=i.getBoundingClientRect();t.left<=e.clientX&&t.left+t.width>=e.clientX&&(e.clientY>=t.top&&e.clientY<=t.top+20?i.scrollTop-=2:e.clientY>=t.top+t.height-20&&e.clientY<=t.top+t.height&&(i.scrollTop+=2))}),1)}return e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}{const r=Math.abs(e.pageX-Smart.ListBox.DragDrop.StartPosition.left),o=Math.abs(e.pageY-Smart.ListBox.DragDrop.StartPosition.top),s=new Date-Smart.ListBox.DragDrop.StartTime;let n=r>=5&&r<=15||o>=5&&o<=15;if(Smart.Utilities.Core.isMobile&&(s<300||s>1e3)&&(n=!1),n){Smart.ListBox.DragDrop.Dragging=!0,Smart.ListBox.DragDrop.Feedback.style.left=i[0]+e.pageX+"px",Smart.ListBox.DragDrop.Feedback.style.top=i[1]+e.pageY+"px",t.getShadowRootOrBody().appendChild(Smart.ListBox.DragDrop.Feedback),e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation();const r=Smart.ListBox.DragDrop.Item,o=r.ownerListBox;o.$.fireEvent("dragStart",{item:r,data:Smart.ListBox.DragDrop,container:o,previousContainer:o,originalEvent:e.originalEvent}),document.body.classList.add("smart-dragging")}}}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.isVirtualized?(t._items.indexOf(e)>-1&&t._items.splice(t._items.indexOf(e),1),t._items.push(e)):(e.dataItem=e,t.shadowRoot&&"light"===t.shadowDomMode?t.appendChild(e):t.$.itemsInnerContainer.appendChild(e),t._items.indexOf(e)>-1&&t._items.splice(t._items.indexOf(e),1),t._items.push(e)),t._refreshItems(),t._refreshSelection()}insertBefore(e,t){const i=this;if(!i.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(i,e.concat(Array.prototype.slice.call(arguments)))}i.isVirtualized?(i._items.indexOf(e)>-1&&i._items.splice(i._items.indexOf(e),1),i._items.splice(i._indexOf(t),0,e)):(e.dataItem=e,t.parentNode.insertBefore(e,t),i._items.indexOf(e)>-1&&i._items.splice(i._items.indexOf(e),1),i._items.splice(i._indexOf(t),0,e)),i._refreshItems(),i._refreshSelection()}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)))}if(t.isVirtualized)t._items.splice(t._indexOf(e),1);else if(e.parentNode){const i=t.selectedIndexes.slice(0),r=t.selectedValues.slice(0),o=i.indexOf(e.dataIndex);e.parentNode.removeChild(e),o>-1&&(i.splice(o,1),r.splice(o,1),t.selectedIndexes=i,t.selectedValues=r)}t._refreshItems()}propertyChangedHandler(e,t,i){if("dataSource"===e&&(!i||i&&Array.isArray(i)&&0===i.length))return void this.clearItems();super.propertyChangedHandler(e,t,i);const r=this;switch(e){case"innerHTML":r.clearSelection(),r._dataBind(),r.innerHTML=r.content=Smart.Utilities.Core.html(r.$.content);break;case"dataSource":case"valueMember":case"groupMember":case"displayMember":r.clearSelection(),r._dataBind(),r._applyDefaultSelection();break;case"disabled":case"unfocusable":r._setFocusable();break;case"displayLoadingIndicator":r._setLoadingIndicatorVisibility();break;case"filterable":r._refreshFilter(),r._refreshLayout();break;case"grouped":if(i?r._group():r._ungroup(),"radioButton"===r.selectionMode){if(r.selectedValues.length>0){const e=r.selectedValues;r.clearSelection(),r.select(e[0])}}else r._refreshSelection();r._refreshLayout();break;case"itemTemplate":{if(null===i||""===i)return r._items.map((e=>e.innerHTML=e.label)),delete r._bindingDetails,void r._refreshLayout();const e=r.querySelectorAll("smart-list-item"),t=function(){r._handleItemTemplate(i)&&(r._items.map((e=>r._applyTemplate(e))),r._refreshLayout()),r.ownerElement&&r.ownerElement._setDropDownSize&&r.ownerElement._setDropDownSize(),r.$.fireEvent("bindingComplete")};0===e.length?t():r._ensureItemsReady(e,t);break}case"selectedIndexes":case"selectedValues":{let o=r.selectedIndexes.slice(0),s=r.selectedValues.slice(0);if(!r._items||0===r._items.length)return r.selectedIndexes=[],r.selectedValues=[],void(r.$.hiddenInput.value=r.selectedValues.toString());if(r._propertyChanging=!0,"selectedIndexes"===e){o=t.slice(0),r.clearSelection();for(let e=0;e<i.length;e++){const t=i[e],o=r._items[t];o&&("oneOrManyExtended"===r.selectionMode||"oneOrMany"===r.selectionMode?(r.selectedIndexes.length>0&&0===e&&r.clearSelection(),r._select(o)):r.select(o))}}else{s=t.slice(0),r.selectedValues=[],r.clearSelection();for(let e=0;e<i.length;e++){const t=i[e],o=r.getItem(t);o&&("oneOrManyExtended"===r.selectionMode?r._select(o):r.select(o))}}if(r.selectedIndexes.length>0&&r._focus(r._items[r.selectedIndexes[0]]),r._propertyChanging=!1,JSON.stringify(s)!==JSON.stringify(r.selectedValues.slice(0))){let e=[],t=[];for(let e=0;e<o.length;e++)r.selectedIndexes.indexOf(o[e])<0&&t.push(r._items[o[e]]);for(let t=0;t<r.selectedIndexes.length;t++)o.indexOf(r.selectedIndexes[t])<0&&e.push(r._items[r.selectedIndexes[t]]);let i={addedItems:e,removedItems:t};if(r.selectedIndexes.length>0){const e=r._items[r.selectedIndexes[r.selectedIndexes.length-1]];void 0!==e&&(i.selected=e.selected,i.disabled=e.disabled,i.index=r._indexOf(e),i.label=e.label,i.value=e.value)}else i.selected=!1,i.disabled=!1,i.index=-1,i.label="",i.value="";r.$.fireEvent("change",i),r._updateTargetValue()}break}case"selectionMode":{const e="checkBox"===r.selectionMode||"radioButton"===r.selectionMode?r.selectionMode:"plain",o=r.selectedIndexes.slice(0),s=r.selectedValues.slice(0);r._propertyChanging=!0;const n=r.selectedValues;r.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(i)),r.selectedValues=[],r.clearSelection();for(let e=0;e<n.length;e++){const t=n[e],i=r.getItem(t);i&&("oneOrManyExtended"===r.selectionMode?r._select(i):r.select(i))}if(r._items.forEach((t=>t.displayMode=e)),r._recycle(),r._propertyChanging=!1,JSON.stringify(s)!==JSON.stringify(r.selectedValues.slice(0))){let e=[],t=[];for(let e=0;e<o.length;e++)r.selectedIndexes.indexOf(o[e])<0&&t.push(r._items[o[e]]);for(let t=0;t<r.selectedIndexes.length;t++)o.indexOf(r.selectedIndexes[t])<0&&e.push(r._items[r.selectedIndexes[t]]);let i={addedItems:e,removedItems:t};if(o.length>0){const e=r._items[o[o.length-1]];e&&(i.selected=e.selected,i.disabled=e.disabled,i.index=r._indexOf(e),i.label=e.label,i.value=e.value)}r.$.fireEvent("change",i),r._updateTargetValue()}r._applyAriaSelected(),"checkBox"!==i&&"radioButton"!==i&&"checkBox"!==t&&"radioButton"!==t||r._refreshLayout();break}case"topVisibleIndex":r._setTopVisibleIndex(i);break;case"autoSort":r._canSort=i;break;case"alternationStart":case"alternationEnd":case"alternationCount":r._refreshItems(),r._refreshLayout();break;case"sortDirection":case"sorted":{r._canSort=!0,i?r._sort():r._unsort();const e=r.selectedValues;r.selectedValues=[],r._refreshSelection();for(let t=0;t<e.length;t++){const i=e[t],o=r.getItem(i);o&&("oneOrManyExtended"===r.selectionMode?r._select(o):r.select(o))}r._refreshLayout(),r._canSort=r.autoSort;break}}}_refreshSelection(){const e=this;if(!e._items||0===e._items.length)return;const t=e.selectedValues;e.selectedIndexes=[],e.selectedValues=[];for(let i=0;i<e._items.length;i++){const r=e._items[i];r.selected=!1,t.indexOf(r.value)>-1&&e.select(r)}e._recycle()}clearSelection(){const e=this;if(!e._items||0===e._items.length)return;let t=[];for(let i=0;i<e._items.length;i++)e._items[i].selected&&t.push(e._items[i]);e._items.map((e=>e.selected=!1)),e.selectedValues.slice(0);const i=e.selectedIndexes.slice(0);if(e.selectedIndexes=[],e.selectedValues=[],e.$.hiddenInput.value=e.selectedValues.toString(),e._recycle(),e.context!==e){let r={addedItems:[],removedItems:t};if(i.length>0){const t=e._items[i[i.length-1]];t&&(r.selected=t.selected,r.disabled=t.disabled,r.index=e._indexOf(t),r.label=t.label,r.value=t.value)}e.$.fireEvent("change",r),e._updateTargetValue()}}ensureVisible(e){const t=this;if(e)return!("string"==typeof e&&!(e=t.getItem(e))||(t.isVirtualized||t.$.itemsContainer.scrollTop===t.scrollTop||(t.scrollTop=t.$.itemsContainer.scrollTop),e.top+e.height>=t.scrollTop+t.offsetHeight&&(t.scrollTop=t.scrollTop+e.height,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),(e.top<=t.scrollTop||e.top>=t.scrollTop+t.$.itemsContainer.offsetHeight)&&(t.scrollTop=e.top,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),0===t._indexOf(e)||1===t._indexOf(e)&&t._items.length>1&&t._items[0].grouped?(t.scrollTop=0,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)):t._indexOf(e)===t._items.length-1&&(t.scrollTop=t.scrollHeight,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),0))}get items(){const e=this;if(!window.__karma__&&!window.karma&&e instanceof Element&&e.isRendered&&e.hasAttribute&&e.hasAttribute("smart-blazor")){let t=[];for(let i=0;i<e._items.length;i++){const r=e._items[i];t.push({label:r.label,value:r.value})}return t}return e._filteredItems?e._filteredItems:e._items}getItems(){const e=this,t=e._filteredItems?e._filteredItems:e._items;let i=[];if(t&&t.length>0)for(let e=0;e<t.length;e++){const r=t[e];i.push({label:r.label,value:r.value})}return i}ready(){super.ready();const e=this;if(e.shadowRoot&&"light"===e.shadowDomMode){const t=document.createDocumentFragment();[].slice.call(e.$.itemsInnerContainer.children).map((e=>t.appendChild(e))),e.appendChild(t),e.$.itemsInnerContainer.appendChild(document.createElement("slot"))}e._areCSSVarsSupported=Smart.Utilities.Core.CSSVariablesSupport(),e.isUpdating=0,e._scrollView&&(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar),e._scrollView.hScrollBar.$.addClass("smart-hidden"),e._scrollView.vScrollBar.$.addClass("smart-hidden"));const t=e._scrollView.vScrollBar,i=e._scrollView.hScrollBar;t.hasStyleObserver=!1,i.hasStyleObserver=!1,t.hasResizeObserver=!1,i.hasResizeObserver=!1,t.wait=!1,i.wait=!1,e._setFocusable()}render(){const e=this;e.setAttribute("role","listbox"),e.setAttribute("aria-orientation","vertical"),e.$.verticalScrollBar.setAttribute("aria-controls",e.id),e.$.horizontalScrollBar.setAttribute("aria-controls",e.id),e._keysPressed={},e._incrementalSearchQuery="",e._incrementalSearchItems=[],e._canSort=!0,e._previousEntry="",e._setLoadingIndicatorVisibility(),e._refreshFilter(),e._initializeInnerHTML(),e._dataBind(),e._applyDefaultSelection(),e.enableShadowDOM&&HTMLElement.prototype.appendChild.apply(e,[e.$.hiddenInput]),e.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(e.selectionMode)),super.render()}_lazyInitItems(){const e=this;if(e._inLazyInit)return cancelAnimationFrame(Smart.ListBox.processTimer),void delete Smart.ListBox.processTimer;e._inLazyInit=!0,e.dataSource||(e.clearSelection(),e._dataBind(),e._applyDefaultSelection()),cancelAnimationFrame(Smart.ListBox.processTimer),delete Smart.ListBox.processTimer,e._inLazyInit=!1}_applyDefaultSelection(){const e=this;!e._focusedItem&&e._items&&e._items.length>0&&0===e.selectedIndexes.length&&("one"!==e.selectionMode&&"oneOrMany"!==e.selectionMode&&"oneOrManyExtended"!==e.selectionMode||e.select(e._items[0]))}attached(){const e=this;super.attached(),Smart.ListBox.DragDrop||(Smart.ListBox.DragDrop={ListBoxes:[]}),Smart.ListBox.DragDrop.ListBoxes.push(e),e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.selectedIndexes.length>0&&e._items&&e.ensureVisible(e._items[e.selectedIndexes[0]])}detached(){const e=this;if(super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),Smart.ListBox.DragDrop&&Smart.ListBox.DragDrop.ListBoxes){const t=Smart.ListBox.DragDrop.ListBoxes.indexOf(e);Smart.ListBox.DragDrop.ListBoxes.splice(t,1)}}_createItem(e,t,i){const r=this,o="checkBox"===r.selectionMode||"radioButton"===r.selectionMode?r.selectionMode:"plain",s=i?{}:document.createElement("smart-list-item");s.ownerListBox=r,"number"==typeof e&&(e=""+e);const n=function(t,i){return void 0!==e[t]?""+e[t]:e[i]};let l="string"==typeof e?e:n(r.displayMember,"label"),a="string"==typeof e?e:n(r.valueMember,"value"),d=n(r.groupMember,"group");return void 0===l&&(l=void 0!==t?""+t:""),s.label=s.innerHTML=""+l,void 0===a&&(a=void 0!==t?""+t:l),e.color&&(s.color=e.color),s.value=""+a,s.displayMode=o,s.selected=!!e.selected&&e.selected,s.disabled=!!e.disabled&&e.disabled,s.dataItem=s,void 0!==t&&(s.dataIndex=t),r._alternateItem(s),e.title&&(s.title=e.title),d&&(s.group=""+d),s}_alternateItem(e){const t=this,i=t.alternationStart,r=t.alternationEnd>0?t.alternationEnd:1/0;t.alternationCount<=0||(void 0===t._alternationIndexCounter&&(t._alternationIndexCounter=0),e.dataIndex>=i&&e.dataIndex<=r&&(e.alternationIndex=t._alternationIndexCounter++,t._alternationIndexCounter===t.alternationCount&&(t._alternationIndexCounter=0)))}_beginUpdate(){this.isUpdating++}_isUpdating(){return this.isUpdating>0}_endUpdate(){this.isUpdating--}get _scrollHeight(){const e=this;if(0===e._items.length||e._items.filter((e=>!e.hidden)).length<1)return 0;let t=0;if(e.isVirtualized){if(e.__scrollHeight)return e.__scrollHeight;if(0===e._items.length)return 0;e.isUpdating++;const i=e._createItem(e.dataSource[0]);e.$.itemsInnerContainer.appendChild(i);for(let r=0;r<e._items.length;r++){const o=e._items[r];o.hidden?(o.height=0,o.top=t):(e.itemHeight?(e.itemHeight<32&&(e.itemHeight=32),o.height=e.itemHeight):(i.$&&i.$.itemContainer?i.$.itemContainer.firstElementChild.innerHTML=o.label:i.label=o.label,o.height=i.offsetHeight),o.top=t,t+=o.height)}e.$.itemsInnerContainer.removeChild(i),e.__scrollHeight=t-e.$.itemsInnerContainer.offsetHeight,e.filterable&&(e.__scrollHeight+=e.$.filterInput.offsetHeight),t=e.__scrollHeight,e.isUpdating--}else{for(let i=0;i<e._items.length;i++){const r=e._items[i];r.hidden?(r.height=0,r.top=t):(e.itemHeight?"auto"!==e.itemHeight&&(r.height=e.itemHeight,r.style.height=r.height+"px"):r.height=r.offsetHeight,r.top=r.offsetTop,t+=r.height)}t=e.$.itemsInnerContainer.scrollHeight-e.$.itemsInnerContainer.offsetHeight,e.filterable&&t>0&&(t+=e.$.filterInput.offsetHeight),e.__scrollHeight=t}return t}_initializeRecyclingItems(){const e=this;if(!e.dataSource||e.dataSource&&0===e.dataSource.length||!e.isVirtualized)return;let t=0,i=e.offsetHeight||400;e.$.itemsInnerContainer.innerHTML="",e._recyclingItems=[];const r=function(){for(let r=0;r<e.dataSource.length;r++){const o=e.dataSource[r],s=e._createItem(o);if(e.itemHeight&&"auto"!==e.itemHeight&&(s.style.height=e.itemHeight+"px"),e.$.itemsInnerContainer.appendChild(s),t+=s.offsetHeight,s.dataItem=e._items[r],e._recyclingItems.push(s),t>1.5*i)break}};r();let o=0;for(;t<1.5*i&&++o<5;)r()}_dataBind(){const e=this;if(e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),"function"==typeof e.dataSource&&(e._items=[],delete e._filteredItems),"string"==typeof e.dataSource&&(e.dataSource=JSON.parse(e.dataSource)),null!==e.dataSource&&Array.isArray(e.dataSource)){e.isUpdating++;const t=t=>{e._items=[],e._groups=[],delete e._filteredItems;const i=e.dataSource;for(let r=0;r<i.length;r++){const o=i[r],s=e._createItem(o,r,!t);e._items[r]=s,t&&t.appendChild(s)}};if(e.isVirtualized)t(),e._initializeRecyclingItems();else{const i=document.createDocumentFragment();e.$.itemsInnerContainer.innerHTML="",t(i),e.$.itemsInnerContainer.appendChild(i)}e.isUpdating--}const t=e.shadowRoot?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item"),i=function(){e.isUpdating++,e.dataSource||(e._initializeHtmlListItems(),e._initializeHtmlListGroups()),e.grouped&&e._group(),e.sorted&&e._sort(),e._refreshLayout(),e._initializeSelection(),e.isInitialized=!0,e._canSort=e.autoSort,e.isUpdating--,e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&(e._items.map((t=>e._applyTemplate(t))),e._refreshLayout()),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted()),e.topVisibleIndex>-1&&e._setTopVisibleIndex(e.topVisibleIndex),e.$.fireEvent("bindingComplete"),e._updateTopVisibleIndex(),0===e._items.length&&e.clearItems(),e._applyAriaSelected()};0===t.length?i():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(t,i))}_ensureItemsReady(e,t){const i=this,r=function(){const i=function(t){for(let i=0;i<e.length;i++)e[i].context="node"===t?e[i]:document};i("node"),t(),i()};if(0===e.length)r();else{i._nodesReadyListeners=0;for(let t=0;t<e.length;t++){const o=e[t],s=function(){i._nodesReadyListeners--,0===i._nodesReadyListeners&&(r(),delete i._nodesReadyListeners)}.bind(i);o.isCompleted||(i._nodesReadyListeners++,o._onCompleted=s)}0===i._nodesReadyListeners&&r()}}_initializeInnerHTML(){const e=this;e.$.itemsInnerContainer.innerHTML.indexOf("<option")>=0?e.$.itemsInnerContainer.innerHTML=e.$.itemsInnerContainer.innerHTML.replace(/<optgroup/gi,"<smart-list-items-group").replace(/<\/optgroup/gi,"</smart-list-items-group").replace(/<option/gi,"<smart-list-item").replace(/<\/option/gi,"</smart-list-item"):e.$.itemsInnerContainer.innerHTML.indexOf("<ul")>=0&&(e.$.itemsInnerContainer.innerHTML=e.$.itemsInnerContainer.innerHTML.replace(/<ul/gi,"<smart-list-items-group").replace(/<\/ul/gi,"</smart-list-items-group").replace(/<li/gi,"<smart-list-item").replace(/<\/li/gi,"</smart-list-item"))}_initializeHtmlListItems(){const e=this,t=e.shadowRoot&&"shadow"===e.shadowDomMode?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item"),i="checkBox"===e.selectionMode||"radioButton"===e.selectionMode?e.selectionMode:"plain",r=function(e,t,i){return void 0!==e[t]?""+e[t]:e[i]};e._items=[];let o=0;for(let s=0;s<t.length;s++){const n=t[s];n.dataIndex=s,n.label=n.innerHTML,n.dataItem=n,n.top||(n.top=o),n.height||(n.height=n.offsetHeight),o+=n.height,n.value||(n.value=""+s);const l=r(n,e.displayMember,"label"),a=r(n,e.valueMember,"value"),d=r(n,e.groupMember,"group");n.label!==l&&(n.label=l),n.value!==a&&(n.value=a),n.group!==d&&(n.group=d);const c=n.context;n.context=document,n.displayMode=i,n.context=c,e._alternateItem(n),n.selected&&(e.selectedIndexes.push(s),e.selectedValues.push(n.value)),e._items.push(n)}e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&e._items.map((t=>e._applyTemplate(t)))}_group(){const e=this;e.isUpdating++;let t=[],i=[];e._canSort&&e._unsort();for(let i=0;i<e._items.length;i++){const r=e._items[i];let o=r.group?r.group.trim():r.innerHTML.charAt(0)||r.label.charAt(0);o+=" ",t[o]?t[o].items.push(r):t[t.length++]=t[o]={items:[r],label:o}}if(e.isVirtualized){e._groups=[];for(let e=0;e<t.length;e++){const r=t[e];r.dataIndex=e,r.grouped=!0,r.hidden=!1,r.displayMode="plain",i.push(r);for(let o=0;o<t[e].items.length;o++){const e=r.items[o];e.group=r,i.push(e)}}e._groups=t,e._items=i}else{for(;e.$.itemsInnerContainer.firstChild;)e.$.itemsInnerContainer.removeChild(e.$.itemsInnerContainer.firstChild);const r=document.createDocumentFragment();e._groups=[];for(let o=0;o<t.length;o++){const s=t[o],n=document.createElement("smart-list-items-group");n.label=s.label,n.dataIndex=o;for(let e=0;e<t[o].items.length;e++){const t=s.items[e];i.push(t),t.group=s.label,n.appendChild(t)}e._groups.push(n),r.appendChild(n)}e._items=i,/Trident|Edge/.test(navigator.userAgent)?setTimeout((function(){e.$.itemsInnerContainer.appendChild(r)}),50):e.$.itemsInnerContainer.appendChild(r)}e.sorted&&e._sort(),e.isUpdating--}_ungroup(){const e=this;e.isUpdating++,e._groups=[],e._canSort&&e._unsort();let t=[];if(e.isVirtualized)for(let i=0;i<e._items.length;i++){const r=e._items[i];r.grouped||t.push(r)}else{const i=document.createDocumentFragment();for(let r=0;r<e._items.length;r++){const o=e._items[r];i.appendChild(o),t.push(o)}t.length>0&&(e.$.itemsInnerContainer.innerHTML="",e.$.itemsInnerContainer.appendChild(i))}e._items=t,e.sorted&&e._sort(),e.isUpdating--}_initializeHtmlListGroups(){const e=this,t=e.$.itemsInnerContainer.querySelectorAll("smart-list-items-group");e._groups=[];for(let i=0;i<t.length;i++){const r=t[i];r.dataIndex=i,e._groups.push(r)}}_initializeSelection(){const e=this,t=e.selectedIndexes.slice(0),i=e.selectedValues.slice(0);e.clearSelection(),"oneOrManyExtended"===e.selectionMode&&(e._keysPressed.Control=!0);for(let r=0;r<e._items.length;r++){const o=e._items[r];(t.indexOf(r)>=0||i.indexOf(o.value||o.label)>=0)&&(e._focusedItem&&(e._focusedItem._focused=!1),e._focusedItem=null,e.select(o))}"oneOrManyExtended"===e.selectionMode&&(e._keysPressed.Control=!1)}onItemUpdated(){const e=this;e.isInitialized&&!e._isUpdating()&&(e.isUpdating++,e._refreshLayout(),e.isUpdating--)}_refreshItems(){const e=this;if(e.isInitialized&&!e._isUpdating()){if(e.isUpdating++,e.grouped?e._ungroup():e.sorted&&e._canSort&&e._unsort(),!e.isVirtualized){e._items=[];const t=e.shadowRoot?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item");for(let i=0;i<t.length;i++)t[i].dataIndex=i,e._alternateItem(t[i]),e._items.push(t[i])}e.grouped?e._group():e.sorted&&e._sort(),e._refreshLayout(),e.isUpdating--}}_applyIncrementalSearch(e){const t=this;null===t.incrementalSearchDelay||isNaN(t.incrementalSearchDelay)||["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control","Home","End","PageUp","PageDown"].indexOf(e)>-1||(0!==t._incrementalSearchQuery.indexOf(e)&&(t._incrementalSearchQuery+=e),t._incrementalSearchTimer&&clearTimeout(t._incrementalSearchTimer),t._incrementalSearch(),t._incrementalSearchTimer=setTimeout((function(){t._incrementalSearchQuery=""}),t.incrementalSearchDelay))}select(e){const t=this;if(("string"!=typeof e||(e=t.getItem(e)))&&("number"!=typeof e||(e=t.getItem(e)))&&!(e.grouped||e.readonly||!t._items.length||e instanceof HTMLElement&&!t.contains(e))){if("none"===t.selectionMode)return t.selectedIndexes=[],void(t.selectedValues=[]);switch(!t._focusedItem!==e&&"none"!==t.selectionMode&&(t._focusedItem&&(t._focusedItem._focused=!1),t._focusedItem=e,e._focused=!0),t.selectionMode){case"one":case"zeroAndOne":return(1!==t.selectedIndexes.length||t.selectedIndexes[0]!==t._indexOf(e))&&(t._previouslySelectedIndexes=t.selectedIndexes,t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e),delete t._previouslySelectedIndexes,!0);case"zeroOrOne":return 1===t.selectedIndexes.length&&t.selectedIndexes[0]===t._indexOf(e)?(t.unselect(e),!0):(t._previouslySelectedIndexes=t.selectedIndexes,t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e),delete t._previouslySelectedIndexes,!0);case"radioButton":if(t._previouslySelectedIndexes=t.selectedIndexes,t.$.itemsInnerContainer.querySelectorAll("smart-list-items-group").length>0){const i=e.parentNode;if(!e.selected){for(let e in i.children){const r=i.children[e];r.selected&&t.unselect(r)}t._select(e)}return delete t._previouslySelectedIndexes,!0}if(t.isVirtualized&&t._groups.length>0){const i=e.group;if(!e.selected){for(let e in i.items){const r=i.items[e];r.selected&&t.unselect(r)}t._select(e)}return delete t._previouslySelectedIndexes,!0}return e.selected||(t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e)),delete t._previouslySelectedIndexes,!0;case"oneOrMany":return e.selected?t.selectedIndexes.length>1&&t.unselect(e):t._select(e),!0;case"zeroOrMany":case"checkBox":return e.selected?t.unselect(e):t._select(e),!0;case"oneOrManyExtended":{const i=t.selectedValues;if(t._keysPressed.Control)return t.selectedIndexes.length>1&&e.selected?(t.unselect(e),t._focus(t._items[t.selectedIndexes[0]])):t._select(e),!0;if(t._keysPressed.Shift){const r=t._items[t.selectedIndexes[0]];let o;t.clearSelection();const s=i.indexOf(r.value)>=0||r.selected;if(t._select(r,s),t._indexOf(r)>t._indexOf(e))for(o=t._indexOf(r)-1;o>=t._indexOf(e);){const e=t._items[o],r=i.indexOf(e.value)>=0||e.selected;t._select(e,r),o--}else for(o=t._indexOf(r)+1;o<=t._indexOf(e);){const e=t._items[o],r=i.indexOf(e.value)>=0||e.selected;t._select(e,r),o++}const n=[];for(let e=0;e<i.length;e++)n.push(t.getItem(i[e]));if(n.length>0&&!t._propertyChanging){let r=[];for(let e=0;e<t.selectedValues.length;e++){const o=t.selectedValues[e];i.indexOf(o)<0&&r.push(t.getItem(o))}t.$.fireEvent("change",{addedItems:r,removedItems:n,selected:e.selected,disabled:e.disabled,index:t._indexOf(e),label:e.label,value:e.value}),t._updateTargetValue()}return!0}for(let r=0;r<i.length;r++){const o=i[r],s=t.getItem(o);e!==s&&t.unselect(s)}return t.clearSelection(),t._select(e,i.indexOf(e.value)>=0),!0}}return!1}}_applyTemplate(e,t){const i=this;if(null===i.itemTemplate)return;if("function"==typeof i.itemTemplate)return void i.itemTemplate(e,{label:e.label,value:e.value,index:i._items.indexOf(e)});if(!i._bindingDetails||0===i._bindingDetails.length)return;const r=i._bindingDetails.length;let o,s,n=document.importNode(i._template.content,!0);for(let t=0;t<r;t++){o=n.childNodes[i._bindingDetails[t].childNodeIndex],s=i._bindingDetails[t].bindingString.length;for(let r=0;r<s;r++){const s=i._bindingDetails[t].bindingString[r],n=s.indexOf("label")>=0?e.label:e.value;o.innerHTML=o.innerHTML.replace(s,n)}}e.innerHTML="";for(let t=0;t<n.childNodes.length;t++)n.childNodes[t].outerHTML&&(e.innerHTML+=n.childNodes[t].outerHTML);!1!==t&&(i._scrollHeightTimer&&(clearInterval(i._scrollHeightTimer),i._scrollHeightCounter=0),i._scrollHeightTimer=setInterval((function(){i._lastScrollHeight===i.$.itemsInnerContainer.scrollHeight&&10!==i._scrollHeightCounter||(i._refreshLayout(),clearInterval(i._scrollHeightTimer)),i._lastScrollHeight=i.$.itemsInnerContainer.scrollHeight,i._scrollHeightCounter++}),50))}_filterItems(e,t,i){const r=this,o=r.$.filterInput.value;let s,n;const l=function(){if(0===n.length)return r._filteredItems=[],void(t&&t());s=r._queryItems(o,r.filterMode);for(let e=0;e<n.length;e++)n[e].hidden=!0,n[e].$&&n[e].$.addClass("smart-hidden");for(let e=0;e<s.length;e++){const t=s[e];t.hidden=!1,n[e].$&&t.$.removeClass("smart-hidden")}if(r.grouped&&r.isVirtualized)for(let e=0;e<r._groups.length;e++){const t=r._groups[e],i=t.items;let o=!0;for(let e=0;e<i.length;e++)i[e].hidden||(o=!1);o&&(t.hidden=!0)}if(r.grouped&&!r.isVirtualized)for(let e=0;e<r._groups.length;e++){const t=r._groups[e],i=[].concat(...t.querySelectorAll("smart-list-item"));let o=!0;for(let e=0;e<i.length;e++)i[e].$.hasClass("smart-hidden")||(o=!1);o?t.$.addClass("smart-hidden"):t.$.removeClass("smart-hidden")}if(r._filteredItems=s,r._refreshLayout(),t&&t(),e)return;const i=r._propertyChanging;r._propertyChanging=!0,r._refreshSelection(),r._propertyChanging=i};if("function"==typeof r.dataSource)if(o||i){const e=function(e){(o||i)&&r.isAttached&&(r._updateListBoxAfterQuery=function(){s=n=r._items,l()},r.clearItems(),r.insert(0,e))},t=r.dataSource(o,e);if(t){if(!o&&!i)return;r._updateListBoxAfterQuery=function(){s=n=r._items,l()},r.clearItems(),r.insert(0,t)}}else r.clearItems(),s=n=r._items,l(),r.$.fireEvent("bindingComplete");else{if(n=r._items,0===n.length)return;l()}}_getNextItem(e){const t=this._items,i=this._items.length;let r=Math.max(e+1,0);for(;r<i;){const e=t[r];if(!(e.disabled||e.hidden||e.grouped||e.readonly))return e;r++}return t[e]}_getPreviousItem(e){const t=this._items;let i=Math.max(e-1,0);for(;i>-1;){const e=t[i];if(!(e.disabled||e.hidden||e.grouped||e.readonly))return e;i--}return t[e]}get _scrollWidth(){const e=this,t=e._items;return e.__scrollWidth||(e.__scrollWidth=(()=>{const e=this,i=e.virtualized,r=e.itemMeasureMode;let o=0,s="";function n(t){const i=e._createItem({label:t});i.style.position="absolute",e.$.itemsContainer.appendChild(i),i.label=t,i.style.width="auto",i.isCompleted&&(i.$.itemContainer.style.width="auto");const r=getComputedStyle(i),o=parseInt(r.paddingLeft)+parseInt(r.paddingRight),s=i.$.itemContainer||i,n=s.offsetWidth+s.offsetLeft+o;return i.parentNode.removeChild(i),n}for(let e=0;e<t.length;e++){const l=t[e];if(!l.hidden)if("auto"===r){const e=i?l.label:l.textContent.trim();e.length>s.length&&(s=e)}else o=Math.max(o,n(l.label))}return"auto"===r?n(s):o})()),e.__scrollWidth}update(e,t){const i=this,r=i._items[e];if(r){if("string"==typeof t)r.label=t,void 0===r.value&&(r.value=t);else for(let e in t)"selected"===e&&r[e]!==t[e]?i.select(r):r[e]=t[e],"group"===e&&i._refreshItems();(i.sorted||i.grouped||i.isVirtualized)&&(i._refreshItems(),i._refreshSelection())}else i.error(i.localize("indexOutOfBound",{elementType:i.nodeName.toLowerCase(),method:"update"}))}insert(e,t){const i=this;let r=[];if((!e||e<0)&&(e=0),Array.isArray(t)){i.isUpdating++;for(let o=0;o<t.length;o++){const s=t[o],n=i._createItem(s);r.push(n),e>=i._items.length||0===i._items.length?i.appendChild(n):i.insertBefore(n,i._items[e])}i.isUpdating--}else{const o=i._createItem(t);r.push(o),e>=i._items.length||0===i._items.length?i.appendChild(o):i.insertBefore(o,i._items[e])}r.length>0?(r.map((e=>i._applyTemplate(e))),i._ensureItemsReady(r,(function(){i._refreshItems(),0!==i._items.length&&(i._updateListBoxAfterQuery&&(i._updateListBoxAfterQuery(),delete i._updateListBoxAfterQuery),i._refreshSelection(),i.$.fireEvent("bindingComplete"))}))):i._updateListBoxAfterQuery&&(i._updateListBoxAfterQuery(),delete i._updateListBoxAfterQuery)}removeAt(e){const t=this,i=t._items[e];i?(i.selected&&t.unselect(i),t.isVirtualized?t._items.splice(e,1):i.parentNode.removeChild(i),t._refreshItems(),t._refreshSelection(),0===t.selectedIndexes.length&&t._items.length>0&&("oneOrMany"!==t.selectionMode&&"one"!==t.selectionMode&&"oneOrManyExtended"!==t.selectionMode||t.select(t._items[0]))):t.error(t.localize("indexOutOfBound",{elementType:t.nodeName.toLowerCase(),method:"remove"}))}_queryItems(e,t){const i=this,r=[],o=function(r,o){if(r.grouped)return r;switch(t){case"startsWith":if(0===r.label.indexOf(o))return r;break;case"startsWithIgnoreCase":if(0===r.label.toLowerCase().indexOf(o.toLowerCase()))return r;break;case"doesNotContain":if(r.label.indexOf(o)<0)return r;break;case"doesNotContainIgnoreCase":if(r.label.toLowerCase().indexOf(o.toLowerCase())<0)return r;break;case"contains":if(r.label.indexOf(o)>-1)return r;break;case"containsIgnoreCase":if(r.label.toLowerCase().indexOf(o.toLowerCase())>-1)return r;break;case"equals":if(0===r.label.localeCompare(o))return r;break;case"equalsIgnoreCase":if(0===r.label.toLowerCase().localeCompare(o.toLowerCase()))return r;break;case"endsWith":if(r.label.endsWith(o))return r;break;case"endsWithIgnoreCase":if(r.label.toLowerCase().endsWith(o.toLowerCase()))return r;break;case"custom":if(i.filterCallback(r,e))return r}return null};if(0===e.length)return i._items;for(let t=0;t<i._items.length;t++){const s=o(i._items[t],e);s&&r.push(s)}return r}_select(e,t){const i=this,r=i.selectedIndexes.indexOf(i._indexOf(e)),o=i.selectedIndexes.slice(0),s=i.selectedValues.slice(0);if(e.selected=!0,-1!==r)return i._recycle(),!1;if(o.push(i._indexOf(e)),s.push(e.value||e.label),i.selectedIndexes=o,i.selectedValues=s,i._recycle(),i.$.hiddenInput.value=s.toString(),!i.isCompleted||t||!i.isInitialized||i._propertyChanging)return;let n=[];if(i._previouslySelectedIndexes){for(let e=0;e<i._previouslySelectedIndexes.length;e++)i.selectedIndexes.indexOf(i._previouslySelectedIndexes[e])<0&&n.push(i._items[i._previouslySelectedIndexes[e]]);delete i._previouslySelectedIndexes}return i.$.fireEvent("change",{addedItems:[e],removedItems:n,selected:e.selected,disabled:e.disabled,index:i._indexOf(e),label:e.label,value:e.value}),i._updateTargetValue(),!0}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const i=e.dataset.property,r=e.value;i&&void 0!==t[i]&&(t[i]=r)}}}_setTopVisibleIndex(e){const t=this;if("number"==typeof e&&(t.topVisibleIndex=Math.max(0,e),e=t._items[t.topVisibleIndex]),!e)return!1;e.top!==t.scrollTop&&(t.scrollTop=e.top,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop),t.scrollHeight===t.scrollTop&&t._updateTopVisibleIndex())}_updateTopVisibleIndex(){const e=this,t=e.scrollTop+e._scrollView.verticalScrollBar.offsetHeight-e.offsetHeight;let i;if(e.scrollTop<e.scrollHeight/2){for(let r=0;r<e._items.length;r++)if(e._items[r].top>=t){i=e._items[r];break}}else for(let r=e._items.length-1;r>=0&&!(e._items[r].top<t);r--)i=e._items[r];if(i){const t=e.context;e.context=e,e.topVisibleIndex=i.dataIndex,e.context=t}}unselect(e){const t=this;if(!e)return;if("string"==typeof e&&!(e=t.getItem(e)))return;if("none"===t.selectionMode)return void t.clearSelection();const i=t.selectedIndexes.indexOf(t._indexOf(e)),r=t.selectedIndexes.slice(0),o=t.selectedValues.slice(0);return e.selected=!1,i>=0&&(r.splice(i,1),o.splice(i,1),t.selectedIndexes=r,t.selectedValues=o,t.$.hiddenInput.value=o.toString(),t.isCompleted&&!t._propertyChanging?(t.$.fireEvent("change",{addedItems:[],removedItems:[e],selected:e.selected,disabled:e.disabled,index:t._indexOf(e),label:e.label,value:e.value}),t._updateTargetValue(),t._recycle(),!0):void 0)}_handleItemTemplate(e){if(null===e||!e)return;if("function"==typeof e)return e;const t=this;if(!("content"in document.createElement("template")))return t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()})),void(t.itemTemplate=null);if(null===(e=document.getElementById(e))||!("content"in e))return t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:"itemTemplate"})),void(t.itemTemplate=null);const i=e.content,r=i.childNodes.length,o=/{{\w+}}/g;let s,n;t._bindingDetails=[],t._template=e;for(let e=0;e<r;e++){for(n=[];s=o.exec(i.childNodes[e].innerHTML);)n.push(s[0]);n.length>0&&t._bindingDetails.push({childNodeIndex:e,bindingString:n})}return!0}_handleKeyStrokes(e){const t=this,i="radioButton"===t.selectionMode||"checkBox"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode;let r=t._items;if(t.filterable&&t.$.filterInput.value.length>0&&(r=t._filteredItems),!t.disabled&&!t.readonly&&r.length){switch(e){case"ArrowLeft":case"ArrowUp":t._handleArrowKeys(!0);break;case"ArrowRight":case"ArrowDown":t._handleArrowKeys(!1);break;case" ":{if(t.selectedIndexes.length<1&&!t._focusedItem)return;const e=t._focusedItem?t._focusedItem:t._items[t.selectedIndexes[t.selectedIndexes.length-1]],i=e=>{e.selected&&"radioButton"!==t.selectionMode?t.unselect(e):t.select(e)};if("oneOrMany"===t.selectionMode)return void(e.selected&&t.selectedIndexes.length>1?i(e):e.selected||i(e));i(e);break}case"Home":if(0===r.length)return;i||(t._keysPressed.Shift||t.clearSelection(),t.select(r[0])),t._focus(r[0]),t.scrollTop=0;break;case"End":if(0===r.length)return;i||(t._keysPressed.Shift||t.clearSelection(),t.select(r[r.length-1])),t._focus(r[r.length-1]),t.scrollTop=t.scrollHeight;break;case"PageUp":t._pageUpKeyHandler(r);break;case"PageDown":t._pageDownKeyHandler(r)}t._recycle()}}_horizontalScrollbarHandler(e){const t=this;e&&e.stopPropagation&&e.stopPropagation(),t.isVirtualized?t._recycle():t.$.itemsContainer.scrollLeft=t._getScrollLeft(e.detail.value)}_getScrollLeft(e,t){const i=this;if(!i.rightToLeft)return e;if(Smart.Utilities.Core.Browser.Chrome){if(!t){const e=2*(parseInt(getComputedStyle(i.$.itemsInnerContainer).getPropertyValue("--smart-list-item-horizontal-offset"))||0);t=i._scrollWidth-i.$.itemsContainer.offsetWidth-e}e=t-e}else e*=-1;return e}_unsort(){const e=this;e.isUpdating++;const t=function(e,t){let i=e.dataIndex,r=t.dataIndex;return i<r?-1:i>r?1:0};if(e.isVirtualized)if(e._groups.length>0){e._groups.sort(t);let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.items);s.sort(t),i.push(o),i=i.concat(s)}e._items=i}else e._items.sort(t);else{if(e._groups.length>0){e._groups.sort(t);let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.querySelectorAll("smart-list-item"));s.sort(t),i=i.concat(s)}e._items=i}else e._items.sort(t);e._applySortOrder()}e.isUpdating--}_applySortOrder(){const e=function(e){for(let t=0;t<e.length;t++){const i=e[t],r=i.parentNode;r&&r.appendChild(i)}};e(this._items),e(this._groups)}_sort(){const e=this;if(!e._canSort)return;e.isUpdating++;const t=function(t,i){let r=t.label,o=i.label;if("asc"===e.sortDirection){if(r<o)return-1;if(r>o)return 1}else{if(r<o)return 1;if(r>o)return-1}return 0};if(e._groups.sort(t),e.isVirtualized)if(e._groups.length>0){let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.items);i.push(o),s.sort(t),i=i.concat(s)}e._items=i}else e._items.sort(t);else{if(e._groups.length>0){let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.querySelectorAll("smart-list-item"));s.sort(t),i=i.concat(s)}e._items=i}else e._items.sort(t);e._applySortOrder()}e.isUpdating--}getItem(e){const t=this;for(let i=0;i<t._items.length;i++)if(t._items[i].value===e)return t._items[i];return null}_focus(e){const t=this;!e||"none"===t.selectionMode||t.disabled||t.readonly||(t._focusedItem&&(t._focusedItem._focused=!1),t._focusedItem=e,t._focusedItem._focused=!0)}_keyDownHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;let r=e.key;if(e.metaKey&&(r="Control"),!t.disabled&&!t.readonly&&(!t.filterable||t.$.filterInput!==i)&&t._focused&&0!==t._items.length&&!t.disabled&&!t.displayLoadingIndicator){if(t.editable){if("F2"===r)return void t._dblclickEventHandler({target:t._focusedItem});if(t.$.editInput===i)return}if("none"!==t.selectionMode){switch(e.stopPropagation(),r){case"Down":case"Right":case"Left":case"Up":r="Arrow"+r}if(t.filterable)switch(r){case"ArrowLeft":case"ArrowRight":return;case"ArrowUp":case"ArrowDown":e.preventDefault()}if(t._applyIncrementalSearch(r),!(["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control"," ","Home","End","PageUp","PageDown"].indexOf(r)<0))if(e.preventDefault(),!t._focusedItem&&t._items.length>0)"one"===t.selectionMode||"oneOrMany"===t.selectionMode||"oneOrManyExtended"===t.selectionMode?t.select(t._items[0]):t._focus(t._items[0]);else switch(t.selectionMode){case"one":case"zeroAndOne":if("Shift"===r||"Control"===r||" "===r)return;t._handleKeyStrokes(r);break;case"oneOrMany":case"zeroOrOne":case"zeroOrMany":case"radioButton":case"checkBox":if("Shift"===r||"Control"===r)return;t._handleKeyStrokes(r);break;case"oneOrManyExtended":if(" "===r)return;t._keysPressed[r]="keydown"===e.type,t._handleKeyStrokes(r)}}}}_keyUpHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;if(!t.editable||t.$.editInput!==i){if(t.filterable&&t.$.filterInput===i)return t._filterTimer&&clearTimeout(t._filterTimer),void(t._filterTimer=setTimeout((function(){const e=t.context;t.context=t,t._filterItems(),t.scrollTop=t.$.itemsContainer.scrollTop=0,t.scrollLeft=t.$.itemsContainer.scrollLeft=t._getScrollLeft(0),t.context=e}),300));if(t._focused){if(t._focusedItem&&t._focusedItem.hidden&&t._filteredItems.length>0){let e=t._filteredItems[0];e.grouped&&t._filteredItems.length>1&&(e=t._filteredItems[1]),t._focus(e),t._recycle()}e.stopPropagation(),e.preventDefault(),t.disabled||("Escape"===e.key&&Smart.ListBox.DragDrop.Dragging&&t._cancelDrag(),["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control"," ","PageUp","PageDown"].indexOf(e.key)<0||(t._keysPressed[e.key]=!1))}}}_cancelDrag(){if(!Smart.ListBox.DragDrop.Dragging)return;Smart.ListBox.DragDrop.Feedback.parentNode&&Smart.ListBox.DragDrop.Feedback.parentNode.removeChild(Smart.ListBox.DragDrop.Feedback);const e=Smart.ListBox.DragDrop.Item,t=e.ownerListBox;if(t.$.fireEvent("dragCancel",{item:e,data:Smart.ListBox.DragDrop,container:t,previousContainer:t}),Smart.ListBox.DragDrop.Feedback=null,Smart.ListBox.DragDrop.DropDetails){let e=Smart.ListBox.DragDrop.DropDetails.item;e&&(e.$.removeClass("smart-list-item-line-feedback"),e.$.removeClass("smart-list-item-bottom-line-feedback"))}document.body.classList.remove("smart-dragging"),delete Smart.ListBox.DragDrop.DraggedFrom,Smart.ListBox.DragDrop.Dragging=!1,Smart.ListBox.DragDrop.Item=null,Smart.ListBox.DragDrop.DropDetails=null}_mouseWheelHandler(e){const t=this;if((t.computedHorizontalScrollBarVisibility||t.computedVerticalScrollBarVisibility)&&!t.disabled&&t.computedVerticalScrollBarVisibility){const i=t.scrollTop;if(0===i&&e.deltaY<0||i===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault(),t.scrollTo(i+t._getScrollCoefficient(e,t.offsetHeight))}}_pageDownKeyHandler(e){const t=this;if(0===e.length)return;let i,r=t._items[t.selectedIndexes[t.selectedIndexes.length-1]];if("checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._focusedItem&&(r=t._focusedItem),!r)return;const o=t._indexOf(r);let s=r.top+t.$.itemsContainer.offsetHeight-r.height;for(let t=o;t<e.length;t++)if(e[t].top>=s){i=e[t];break}i||(i=e[e.length-1]),"checkBox"===t.selectionMode||"radioButton"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode?t._focus(i):i.selected||(t._keysPressed.Shift||t.clearSelection(),t.select(i),t._focus(i)),(i.height+i.top>t.$.itemsContainer.scrollTop+t.$.itemsContainer.offsetHeight||i.top<t.$.itemsContainer.scrollTop)&&(t.scrollTop=i.top-t.$.itemsContainer.offsetHeight+i.height)}_pageUpKeyHandler(e){const t=this;if(0===e.length)return;let i=t._items[t.selectedIndexes[t.selectedIndexes.length-1]];if("checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._focusedItem&&(i=t._focusedItem),!i)return;const r=i.top-t.$.itemsContainer.offsetHeight;let o;for(let s=t._indexOf(i);s>0;s--)if(e[s].top<=r){o=e[s];break}o||(o=e[0]),"checkBox"===t.selectionMode||"radioButton"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode?t._focus(o):o.selected||(t._keysPressed.Shift||t.clearSelection(),t.select(o),t._focus(o)),t.scrollTop=o.top,0===t._indexOf(o)&&(t.scrollTop=0)}clearItems(){const e=this;e.clearSelection(),e.$.itemsInnerContainer.innerHTML="",e._items=[],delete e._focusedItem,e.$placeholder.removeClass("smart-hidden"),e.refresh()}_resizeHandler(e){this.refresh(e)}refresh(e){const t=this;if(!e&&!t._isUpdatingScrollBars&&t.isInitialized)return t._isUpdatingScrollBars=!0,t._initializeRecyclingItems(),t._refreshLayout(),void(t._isUpdatingScrollBars=!1);e&&e.target===t&&!t._isUpdatingScrollBars&&(t._isUpdatingScrollBars=!0,t._initializeRecyclingItems(),t._refreshLayout(),t._isUpdatingScrollBars=!1)}_indexOf(e){const t=this;if(!e)return-1;let i=t._items.indexOf(e);return-1===i&&(i=t._items.indexOf(t.getItem(e.value))),i}_incrementalSearch(){const e=this,t="radioButton"!==e.selectionMode&&"checkBox"!==e.selectionMode&&"zeroOrMany"!==e.selectionMode&&"oneOrMany"!==e.selectionMode&&"zeroOrOne"!==e.selectionMode;let i,r=0;switch(e.incrementalSearchMode){case"containsIgnoreCase":case"equalsIgnoreCase":case"startsWithIgnoreCase":case"endsWithIgnoreCase":i=e._incrementalSearchQuery.toLowerCase();break;default:i=e._incrementalSearchQuery}const o=function(i){i.grouped||i.readonly||(t?(e.selectedIndexes.length>0&&e.clearSelection(),e._focus(i),e.select(i)):e._focus(i),(i.height+i.top>e.$.itemsContainer.scrollTop+e.$.itemsContainer.offsetHeight||i.top<e.scrollTop)&&(e.scrollTop=i.top),0===e._indexOf(i)&&(e.scrollTop=0),e._indexOf(i)===e._items.length-1&&(e.scrollTop=e.scrollHeight))};0!==e._previousEntry.localeCompare(i)&&(e._incrementalSearchItems=e._queryItems(e._incrementalSearchQuery,e.incrementalSearchMode),delete e._itemPosition),e._previousEntry=i;const s=e._incrementalSearchItems.length;if(0!==s)if(1!==s)for(void 0!==e._itemPosition?e._itemPosition<s-1?r=e._itemPosition:(r=0,t?(e._incrementalSearchItems[e._itemPosition].selected=!1,e.selectedIndexes=[],e.selectedValues=[]):e._incrementalSearchItems[e._itemPosition]._focused=!1):t&&e.clearSelection();r<s;r++)if(e._incrementalSearchItems[r].selected&&t)e._incrementalSearchItems[r].selected=!1,e.selectedIndexes=[],e.selectedValues=[];else{if(t||!e._incrementalSearchItems[r]._focused)return o(e._incrementalSearchItems[r]),void(e._itemPosition=r);e._incrementalSearchItems[r]._focused=!1}else o(e._incrementalSearchItems[0])}_selectStartHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement;t.$.filterInput!==i&&t.$.editInput!==i&&e.preventDefault()}_handleArrowKeys(e){const t=this,i="radioButton"!==t.selectionMode&&"checkBox"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode;if(t.disabled||t.readonly)return;let r;if(t._focusedItem&&!t._keysPressed.Shift)r=t._indexOf(t._focusedItem),t._focusedItem._focused=!1;else{if(0===t.selectedIndexes.length)return;r=t.selectedIndexes[t.selectedIndexes.length-1]}const o=e?t._getPreviousItem(r):t._getNextItem(r);t._focus(o),i&&(t._keysPressed.Shift?t.select(o):t._items[r]!==o&&(t.clearSelection(),t.select(o))),t.ensureVisible(o)}_refreshFilter(){const e=this;if(e.filterable)return e.$.filterInput.disabled=!(!e.disabled&&!e.displayLoadingIndicator),e.$filterInputContainer.removeClass("smart-hidden"),void e.$itemsContainer.addClass("filter");e.$.filterInput.disabled=!0,e.$filterInputContainer.addClass("smart-hidden"),e.$itemsContainer.removeClass("filter")}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.tabIndex>0?e.tabIndex:0}_setLoadingIndicatorVisibility(){const e=this;e.displayLoadingIndicator?e.$loadingIndicatorContainer.hasClass("smart-visibility-hidden")?e.$loadingIndicatorContainer.removeClass("smart-visibility-hidden"):e.$loadingIndicatorContainer.removeClass("smart-hidden"):e._areCSSVarsSupported?e.$loadingIndicatorContainer.addClass("smart-hidden"):e.$loadingIndicatorContainer.addClass("smart-visibility-hidden")}_refreshLayout(){const e=this,t=e._filteredItems||e._items;if(e.__scrollHeight=null,e.__scrollWidth=null,e._height=null,e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.$itemsContainer.removeClass("hscroll"),e.$itemsContainer.removeClass("vscroll"),!t||null===t||0===t.length)return e.scrollWidth=0,e.scrollHeight=0,e.$filterInputContainer.removeClass("vscroll"),e.$placeholder.removeClass("smart-hidden"),e.isVirtualized&&e._recycle(),void(e.$.itemsInnerContainer.style.width="");e.$placeholder.addClass("smart-hidden");const i=2*(parseInt(getComputedStyle(e.$.itemsContainer).getPropertyValue("--smart-list-item-horizontal-offset"))||0);let r=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,o=e._scrollHeight;if(e._refreshHorizontalScrollBarVisibility(r),e._refreshVerticalScrollBarVisibility(o),e.$.itemsInnerContainer.style.width="","hidden"===e.horizontalScrollBarVisibility?e.$.itemsInnerContainer.style.width=e.$.itemsContainer.offsetWidth-i:e.$.itemsInnerContainer.style.width=Math.max(e.$.itemsContainer.offsetWidth-i,-i+e.__scrollWidth)+"px",e.computedVerticalScrollBarVisibility)return r=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,e._refreshHorizontalScrollBarVisibility(r),"hidden"!==e.horizontalScrollBarVisibility&&(e.$.itemsInnerContainer.style.width="",e.$.itemsInnerContainer.style.width=Math.max(e.$.itemsContainer.offsetWidth-i,-i+e.__scrollWidth)+"px"),e.computedHorizontalScrollBarVisibility&&(("visible"!==e.horizontalScrollBarVisibility||0!==e.scrollWidth||"visible"===e.horizontalScrollBarVisibility)&&(e.__scrollHeight+=e._scrollView.hScrollBar.offsetHeight),e.scrollHeight=e.__scrollHeight,e._scrollView.hScrollBar.$.hasClass("bottom-corner")&&e._scrollView.hScrollBar.refresh()),void(e.isVirtualized&&e._recycle());r=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,e._refreshHorizontalScrollBarVisibility(r),e.computedHorizontalScrollBarVisibility&&(e.scrollHeight=e._scrollHeight,e._refreshVerticalScrollBarVisibility(e.scrollHeight),e.computedVerticalScrollBarVisibility&&(r=e._scrollWidth-e.$.itemsContainer.offsetWidth-e._scrollView.vScrollBar.offsetWidth,e._refreshHorizontalScrollBarVisibility(r)),e._scrollView.vScrollBar.$.hasClass("bottom-corner")&&e._scrollView.vScrollBar.refresh(),e._scrollView.hScrollBar.$.hasClass("bottom-corner")&&e._scrollView.hScrollBar.refresh()),e.isVirtualized&&e._recycle();const s=/Trident|Edge/.test(navigator.userAgent);!e.isRefreshing&&s&&setTimeout((function(){e.isRefreshing=!0,e._refreshLayout(),e.isRefreshing=!1}),50)}_styleChangedHandler(){this._refreshLayout()}_swipeLeftHandler(){}_swipeRightHandler(){}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility?(t.scrollLeft=t._getScrollLeft(t.$.itemsContainer.scrollLeft,e),t.$itemsContainer.addClass("hscroll")):t.$itemsContainer.removeClass("hscroll")}_refreshVerticalScrollBarVisibility(e){const t=this;t.scrollHeight=e,t.computedVerticalScrollBarVisibility?(t.$itemsContainer.addClass("vscroll"),t.$filterInputContainer.addClass("vscroll")):(t.$itemsContainer.removeClass("vscroll"),t.$filterInputContainer.removeClass("vscroll"))}_validateTemplate(e,t){if(null===t||!t)return;const i=this;return"content"in document.createElement("template")?null!==(t=document.getElementById(t))&&"content"in t?t:(i.error(i.localize("invalidTemplate",{elementType:i.nodeName.toLowerCase(),property:e})),void(i[e]=null)):(i.error(i.localize("htmlTemplateNotSuported",{elementType:i.nodeName.toLowerCase()})),void(i[e]=null))}_getItemIndexByPosition(e){const t=this;return(i=>{let r=0,o=i.length-1;if(e<=0)return 0;if(i[i.length-1].top<=e)return i.length-1;for(;;){const s=Math.floor((r+o)/2),n=i[s];if(t._isItemInPosition(n,e))return s;n.top<e?r=s+1:n.top>e&&(o=s-1)}})(t.filterable&&t.$.filterInput.value.length>0?t._filteredItems:t._items)}_isItemInPosition(e,t){const i=e.top,r=e.top+e.height;return i<=t&&r>t}get isVirtualized(){const e=this;return e.virtualized&&e.dataSource&&e.dataSource.length>0}_recycle(){const e=this;if(!e._recyclingItems)return;let t=e._height;e._height||(t=e._height=e.$.itemsContainer.offsetHeight);let i=0;const r=e.scrollTop,o=e._getItemIndexByPosition(r),s=e.filterable&&e.$.filterInput.value.length>0?e._filteredItems:e._items,n=s[o];let l=n?n.top:0;if(e.$.itemsInnerContainer.style.left=-e.scrollLeft+"px",e.$.itemsInnerContainer.style.top=-r+l+"px",e.isUpdating++,o>=0){const n=s.length;for(let a=o;a<n;a++){const o=s[a];if(0!==o.height){if(!(l+o.height>=r&&l<=r+t))break;{const t=e._recyclingItems[i++];if(!t)break;t.setAttribute("aria-setsize",n),t.setAttribute("aria-posinset",a),t.context=document,t.dataItem=o,t.label=o.label,t.value=o.value,t.selected=o.selected,t._focused=o._focused,t.hidden=o.hidden,t.grouped=o.grouped,t.readonly=o.readonly,t.style.height=o.height+"px",e._alternateItem(t),o.title?t.title=o.title:t.title="",o.grouped?t.displayMode="plain":t.displayMode=o.displayMode,e.scrollWidth>0&&(t.style.width=e.$.itemsInnerContainer.offsetWidth+e.scrollWidth+"px"),e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&e._applyTemplate(t,!1)}l+=o.height}}}if(i<e._recyclingItems.length)for(let t=i;t<e._recyclingItems.length;t++){const t=e._recyclingItems[i++],r=t.context;t.context=document,t.hidden=!0,t.context=r}e.isUpdating--}_verticalScrollbarHandler(e){const t=this,i=e.detail.value;e&&e.stopPropagation&&e.stopPropagation(),t.isVirtualized?t._recycle():t.$.itemsContainer.scrollTop=i,t._updateTopVisibleIndex(),e.context.max!==e.context.value?e.context.min===e.context.value&&t.$.fireEvent("scrollTopReached"):t.$.fireEvent("scrollBottomReached")}_applyAriaSelected(){const e=this,t=e.isVirtualized?e._recyclingItems:e._items,i=e.selectionMode;for(let e=0;e<t.length;e++){const r=t[e];r.selected?r.setAttribute("aria-selected",!0):r.readonly||r.disabled||-1===["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox"].indexOf(i)?r.removeAttribute("aria-selected"):r.setAttribute("aria-selected",!1)}}});
84
+ Smart("smart-list-item",class extends Smart.ContentElement{static get properties(){return{alternationIndex:{value:-1,type:"int"},color:{value:"",type:"string"},displayMode:{allowedValues:["plain","checkBox","radioButton"],value:"plain",type:"string"},grouped:{value:!1,type:"boolean"},selected:{value:!1,type:"boolean"},value:{value:"",type:"string"},label:{value:"",type:"string"},details:{value:"",type:"string"},group:{value:"",type:"string"},hidden:{value:!1,type:"boolean"},readonly:{value:!1,type:"boolean"}}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}get _focused(){const e=this;return void 0===e.__focused&&(e.__focused=!1),e.__focused}set _focused(e){const t=this;t.__focused=e,e?(t.setAttribute("focus",""),t.ownerListBox&&t.ownerListBox.ownerElement&&Smart.ComboBox&&t.ownerListBox.ownerElement instanceof Smart.ComboBox&&t.ownerListBox.ownerElement.$.input.setAttribute("aria-activedescendant",t.id)):t.removeAttribute("focus")}template(){return'<div id="container">\n <span id=\'itemInput\' class=\'smart-input smart-hidden\'></span>\n <span class="smart-overlay" id="overlay"></span>\n <div id="itemContainer" class="smart-content smart-list-item-container"><span class="smart-content-label" inner-h-t-m-l=\'[[innerHTML]]\' role="presentation"><content></content></span><span inner-h-t-m-l=\'[[details]]\' id="details" class="smart-content-details"></span></div>\n </div>'}appendChild(e){const t=this;if(!t.isCompleted||e.classList&&e.classList.contains("smart-ripple")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}window.smartBlazor?t.$.itemContainer.appendChild(e):(t.$.itemContainer.innerHTML="",e instanceof HTMLElement&&t.$.itemContainer.appendChild(e))}insertBefore(e,t){const i=this;if(!i.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(i,e.concat(Array.prototype.slice.call(arguments)))}t.parentNode.insertBefore(e,t)}removeChild(e){const t=this;if(!t.isCompleted||e.classList.contains("smart-ripple")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement&&t.$.itemContainer.removeChild(e)}attached(){super.attached(),this.ownerListBox=this.getListBox()}static get listeners(){return{mouseenter:"_itemOnMouseEnter",mouseleave:"_itemOnMouseLeave"}}ready(){super.ready();const e=this;if(e.setAttribute("role","option"),""!==e.label){let t=e.label;t&&"string"==typeof t&&(t=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")),e.innerHTML=t}else""!==e.innerHTML&&(e.label=e.innerHTML);e._setDisplayMode(e.displayMode),e._setItemColor(),e.$.container.noRipple=!0;const t=e.closest("smart-list-box");if(t&&t.isRendered){if(cancelAnimationFrame(Smart.ListBox.processTimer),t._inLazyInit||t._isUpdating)return;Smart.ListBox.processTimer=requestAnimationFrame((()=>{t._lazyInitItems()}))}}propertyChangedHandler(e,t,i){const r=this;if(super.propertyChangedHandler(e,t,i),"hidden"===e)i?r.$.addClass("smart-hidden"):r.$.removeClass("smart-hidden");else if("color"===e)r._setItemColor();else if("displayMode"===e)r._setDisplayMode(i);else if("label"===e||"value"===e){const t=r.context;r.context=document,"label"===e&&(r.innerHTML=i);const o=r.getListBox();o&&(o._applyTemplate(r),o.onItemUpdated(r)),r.context=t}else if("details"===e){const e=r.context;r.context=document,r.$.details.innerHTML=i;const t=r.getListBox();t&&t.onItemUpdated(r),r.context=e}else if("innerHTML"===e){const e=r.getListBox();e&&e.onItemUpdated(r)}else if("selected"===e)if(i)r.setAttribute("aria-selected",!0);else{const e=r.getListBox();r.readonly||r.disabled||!e||-1===["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox"].indexOf(e.selectionMode)?r.removeAttribute("aria-selected"):r.setAttribute("aria-selected",!1)}}getListBox(){const e=this;if(!Smart.ListBox)return e.getRootNode().host;let t=e.parentNode;for(;t instanceof Smart.ListBox==0&&null!==t;)t=t.parentNode;return!t&&Smart.EnableShadowDOM?e.getRootNode().host:t}_itemOnMouseEnter(){const e=this;!e.disabled&&e.ownerListBox&&(Smart.ListBox.DragDrop.Dragging&&e.ownerListBox.allowDrop&&(Smart.ListBox.DragDrop.DropDetails={item:e,position:"bottom"}),e.ownerListBox.$.verticalScrollBar.thumbCapture||e.ownerListBox.$.horizontalScrollBar.thumbCapture||e.setAttribute("hover",""))}_itemOnMouseMove(e){const t=this;if(t.ownerListBox&&Smart.ListBox.DragDrop.Dragging&&t.ownerListBox.allowDrop&&!Smart.Utilities.Core.isMobile){const i=[].slice.call(t.ownerListBox.getElementsByClassName("smart-list-item-bottom-line-feedback"));for(let e=0;e<i.length;e++)i[e].$.removeClass("smart-list-item-line-feedback"),i[e].$.removeClass("smart-list-item-bottom-line-feedback");if(Smart.ListBox.DragDrop.DropDetails={item:t,position:"top"},!t.ownerListBox._areCSSVarsSupported){if(t.ownerListBox._indexOf(t)===t.ownerListBox._items.length-1||t.parentNode.lastElementChild===t){const i=t.getBoundingClientRect();e.pageY-window.pageYOffset>i.top+i.height/2-1&&(Smart.ListBox.DragDrop.DropDetails={item:t,position:"bottom"})}return}if(t.$.removeClass("smart-list-item-line-feedback"),t.$.removeClass("smart-list-item-bottom-line-feedback"),t.ownerListBox.sorted&&t.ownerListBox.autoSort)return;const r=t.ownerListBox._items.filter((e=>!e.hidden));if(r.indexOf(t)===r.length-1||t.parentNode.lastElementChild===t){const i=t.getBoundingClientRect();e.pageY-window.pageYOffset>i.top+i.height/2-1?(t.$.addClass("smart-list-item-bottom-line-feedback"),Smart.ListBox.DragDrop.DropDetails={item:t,position:"bottom"}):arguments[1]||t.$.addClass("smart-list-item-line-feedback")}else arguments[1]||t.$.addClass("smart-list-item-line-feedback")}}_itemOnMouseLeave(){const e=this;e.ownerListBox&&(Smart.ListBox.DragDrop.Dragging&&(e.$.removeClass("smart-list-item-line-feedback"),e.$.removeClass("smart-list-item-bottom-line-feedback")),e.removeAttribute("hover"))}_setDisplayMode(e){const t=this,i=t.getListBox();if(i){const r="checkBox"===i.selectionMode||"radioButton"===i.selectionMode?i.selectionMode:"plain";t.displayMode=e=r}"plain"!==e?t.$itemInput.removeClass("smart-hidden"):t.$itemInput.addClass("smart-hidden")}_setItemColor(){const e=this,t=e.querySelector(".smart-content-label"),i=/(^#[0-9A-F]{3}$)|(^#[0-9A-F]{6}$)|(^#[0-9A-F]{8}$)/i.test(e.color)?e.color:"";t.style.backgroundColor=i,t.style.color=e._getContrastColor(i)}_getContrastColor(e){if(!e)return"";let t=(i=e.slice(1,3),r=e.slice(3,5),o=e.slice(5,7),[parseInt(i,16),parseInt(r,16),parseInt(o,16)]);var i,r,o;return parseFloat(((.299*t[0]+.61*t[1]+.114*t[2])/255).toFixed(2))>.65?"#000000":"#FFFFFF"}}),Smart("smart-list-items-group",class extends Smart.ContentElement{static get properties(){return{label:{value:"",type:"string"}}}get enableShadowDOM(){return!1}template(){return'<div id="container" role="presentation">\n <span id="itemsLabel" class="smart-list-items-group-label">[[label]]</span>\n <div id="listItemsGroupContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-list-items-group-container" role="presentation">\n <content></content>\n </div>\n </div>'}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement&&t.$.listItemsGroupContainer.appendChild(e)}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 instanceof HTMLElement&&t.$.listItemsGroupContainer.removeChild(e)}getListBox(){let e=this.parentNode;for(;e instanceof Smart.ListBox==0&&null!==e;)e=e.parentNode;return e}attached(){const e=this;super.attached(),e.ownerListBox||(e.ownerListBox=e.getListBox()),e.setAttribute("role","group"),e.$.itemsLabel.id||(e.$.itemsLabel.id=e.id+"Label"),e.setAttribute("aria-labelledby",e.$.itemsLabel.id)}}),Smart("smart-list-box",class extends Smart.ScrollViewer{static get properties(){return{allowDrag:{value:!1,type:"boolean"},allowDrop:{value:!1,type:"boolean"},alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},autoSort:{value:!0,type:"boolean"},dataSource:{value:null,type:"any?",reflectToAttribute:!1},dragFeedbackFormatFunction:{value:null,type:"function?"},dragOffset:{value:[10,10],type:"array"},displayLoadingIndicator:{value:!1,type:"boolean"},displayMember:{value:"",type:"string"},shadowDomMode:{allowedValues:["light","shadow"],value:"shadow",type:"string"},dropAction:{value:"move",type:"string",allowedValues:["copy","move","none"]},editable:{value:!1,type:"boolean"},filterable:{value:!1,type:"boolean"},filterCallback:{value:null,type:"function?"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase","custom"],type:"string"},filterInputPlaceholder:{value:"",type:"string"},grouped:{value:!1,type:"boolean"},groupMember:{value:"",type:"string"},itemTemplate:{value:null,type:"any"},itemHeight:{value:null,type:"number?"},incrementalSearchDelay:{value:700,type:"number?"},incrementalSearchMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},itemMeasureMode:{value:"auto",allowedValues:["auto","precise"],type:"string"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{extend:!0,value:{en:{overridingProperties:'{{elementType}}: Overriding properties {{property1}} and {{property2}} applied. The "{{property1}}" property is used by default.',invalidIndex:'{{elementType}}: "{{method}}" method accepts an index of type number or an Array of numbers.',indexOutOfBound:'{{elementType}}: Out of bound index/indexes in "{{method}}" method.',invalidItem:'{{elementType}}: "{{method}}" method accepts an object or an array of objects as it\'s second parameter.',invalidSettings:'{{elementType}}: "{{method}}" method accepts a string or an object as it\'s second parameter.'}},type:"object"},name:{value:"",type:"string"},placeholder:{value:"No Items",type:"string"},selectedIndexes:{value:[],type:"array"},selectedValues:{value:[],type:"array"},selectionMode:{value:"oneOrManyExtended",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectionChangeAction:{value:"release",allowedValues:["press","release"],type:"string"},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},topVisibleIndex:{value:-1,type:"int"},type:{value:"list",type:"string",defaultReflectToAttribute:!0,readonly:!0},valueMember:{value:"",type:"string"},virtualized:{value:!1,type:"boolean"}}}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}static get styleUrls(){return["smart.listbox.css","smart.dropdown.css","smart.scrollbar.css"]}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler","container.wheel":"_mouseWheelHandler","editInput.change":"_editInputEventHandler","editInput.blur":"_editInputEventHandler","editInput.keydown":"_editInputEventHandler","horizontalScrollBar.change":"_horizontalScrollbarHandler","itemsInnerContainer.down":"_downHandler","itemsInnerContainer.dblclick":"_dblclickEventHandler","itemsInnerContainer.move":"_itemsContainerMoveHandler","itemsContainer.mouseleave":"_mouseLeaveHandler","itemsInnerContainer.touchmove":"_touchmoveHandler","itemsInnerContainer.touchstart":"_touchstartHandler","document.move":"_moveHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler",selectstart:"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",touchmove:"_overriddenHandler",touchstart:"_overriddenHandler","verticalScrollBar.change":"_verticalScrollbarHandler"}}template(){return'<div id="container" class="smart-container" role="presentation">\n <div class="smart-list-box-filter-input-container smart-hidden" id="filterInputContainer" role="presentation"><input id="filterInput" disabled="[[disabled]]" placeholder=\'[[filterInputPlaceholder]]\' role="searchbox" aria-label="[[filterInputPlaceholder]]"></div>\n <div id="itemsContainer" class="smart-list-items-container" role="presentation">\n <div id="placeholder" class="smart-placeholder" role="presentation" aria-hidden="true">[[placeholder]]</div>\n <div id="itemsInnerContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-list-items-inner-container" role="presentation">\n <content></content>\n </div>\n <input type="text" id="editInput" class= "smart-hidden"/>\n </div>\n <smart-scroll-bar wait theme="[[theme]]" right-to-left="[[rightToLeft]]" id="verticalScrollBar" disabled="[[disabled]]" orientation="vertical"></smart-scroll-bar>\n <smart-scroll-bar wait theme="[[theme]]" right-to-left="[[rightToLeft]]" id="horizontalScrollBar" disabled="[[disabled]]"></smart-scroll-bar>\n <div id="loadingIndicatorContainer" class="smart-loader-container" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>'}get value(){const e=this;return e.isRendered&&e._selectedItems.length>0?e._selectedItems.map((e=>({label:e.label,value:e.value}))):null}set value(e){const t=this;if(Array.isArray(e)){const i=t.context;t.context=t,t._isUpdating++,t.selectedValues=[],t.clearSelection();for(let i=0;i<e.length;i++){const r=e[i],o=t.getItem(r);o&&("oneOrManyExtended"===t.selectionMode?t._select(o):t.select(o))}return t.context=i,void t._isUpdating--}const i=t.getItem(e);i&&t.select(i)}get _selectedItems(){const e=this,t=[];if(e.isRendered)for(let i=0;i<e._items.length;i++){const r=e._items[i];r.selected&&t.push(r)}return t}_mouseLeaveHandler(){const e=[].slice.call(this.getElementsByClassName("smart-list-item-bottom-line-feedback"));for(let t=0;t<e.length;t++)e[t].$.removeClass("smart-list-item-line-feedback"),e[t].$.removeClass("smart-list-item-bottom-line-feedback")}_downHandler(e){const t=this;if(t.disabled||t.displayLoadingIndicator||t.readonly)return;let i=e.originalEvent.target,r=null;if(!(i instanceof Smart.ListItem)||i.disabled||i.hidden||i instanceof Smart.ListItemsGroup)for(;i.parentElement;){if(i instanceof Smart.ListItem&&!i.disabled&&!i.hidden&&!(i instanceof Smart.ListItemsGroup)){r=i.dataItem;break}i=i.parentElement}else r=i.dataItem;Smart.ListBox.DragDrop.StartTime=new Date,Smart.ListBox.DragDrop.StartPosition={left:e.pageX,top:e.pageY},r&&(e.stopPropagation(),t.hasRippleAnimation&&(r.readonly||r.disabled||Smart.Utilities.Animation.Ripple.animate(i.$.overlay,e.pageX,e.pageY)),Smart.Utilities.Core.isMobile||"press"!==t.selectionChangeAction||(t._focus(r),t.select(r)),!Smart.ListBox.DragDrop.Feedback&&t.allowDrag&&(Smart.ListBox.DragDrop.DraggedFrom=t,Smart.ListBox.DragDrop.Feedback=document.createElement("span"),t.rightToLeft?Smart.ListBox.DragDrop.Feedback.setAttribute("right-to-left",!0):Smart.ListBox.DragDrop.Feedback.removeAttribute("right-to-left"),t.dragFeedbackFormatFunction?Smart.ListBox.DragDrop.Feedback.innerHTML=t.dragFeedbackFormatFunction(r):Smart.ListBox.DragDrop.Feedback.appendChild(r.offsetHeight?r.cloneNode(!0):t._createItem(r)),Smart.ListBox.DragDrop.Item=r,Smart.Utilities.Extend(Smart.ListBox.DragDrop.Feedback).addClass("smart-popup smart-list-item smart-list-item-feedback")))}_dblclickEventHandler(e){const t=this;if(!t.editable)return;const i=e.target.closest("smart-list-item");i instanceof Smart.ListItem&&!i.disabled&&!i.readonly?(t.$.editInput.dir=t.rightToLeft?"rtl":"ltr",t.$.editInput.style.width=t.$.itemsInnerContainer.offsetWidth+"px",t.$.editInput.owner=i,t.$.editInput.value=i.label,t.$.editInput.style.height=i.offsetHeight+"px",t.$.editInput.style.top=i.offsetTop+t.$.itemsInnerContainer.offsetTop+"px",t.$.editInput.setAttribute("aria-label","Edit item "+i.label),t.$editInput.hasClass("smart-hidden")&&t.$editInput.removeClass("smart-hidden"),t.$.editInput.focus({preventScroll:!0})):t.$editInput.addClass("smart-hidden")}_editInputEventHandler(e){const t=this;if("blur"===e.type||"keydown"===e.type&&"Escape"===e.key)return t.$editInput.hasClass("smart-hidden")||t.$editInput.addClass("smart-hidden"),void t.focus();if("keydown"===e.type||t.$editInput.hasClass("smart-hidden"))return;const i=e.target;if(e.stopPropagation(),i.owner.label!==i.value&&(i.owner.label=i.value,t.itemTemplate&&t._applyTemplate(i.owner),t.dataSource)){const e=i.owner.dataIndex,r=t.dataSource[e];r&&(t.displayMember?r[t.displayMember]=i.value:r.label=i.value)}t.$editInput.addClass("smart-hidden"),t.$.fireEvent("itemLabelChange",{selected:i.owner.selected,disabled:i.owner.disabled,index:t._indexOf(i.owner),label:i.owner.label,value:i.owner.value})}_pointerUpHandler(e){const t=this;let i=e.originalEvent,r=i.target;(t.shadowRoot||t.isInShadowDOM)&&(r=i.originalEvent?i.originalEvent.composedPath()[0]:i.composedPath()[0]);const o=e=>{const i=e.ownerListBox;i.disabled||i!==t||i.displayLoadingIndicator||"none"===i.selectionMode||e.grouped||e.readonly||(i._focus(e),i.select(e),Smart.ListBox.DragDrop.StartPosition=null,t.$.fireEvent("itemClick",{selected:r.selected,disabled:r.disabled,index:t._indexOf(r),label:r.label,value:r.value}))};if(!(i.target instanceof Smart.ListItem)||i.target.disabled||i.target instanceof Smart.ListItemsGroup){for(;r.parentElement;){if(r instanceof Smart.ListItem&&!r.disabled&&!(r instanceof Smart.ListItemsGroup))return void o(r.dataItem);r=r.parentElement}if(this.shadowRoot&&"shadow"===this.shadowDomMode){const e=i.composedPath();for(let t=0;t<e.length;t++){const i=e[t];i instanceof Smart.ListItem&&!i.disabled&&o(i.dataItem)}}}else o(r.dataItem)}_upHandler(e){const t=this;if(super._upHandler(),!t.disabled&&!t.readonly&&Smart.ListBox.DragDrop.StartPosition){if(Smart.Utilities.Core.isMobile&&!Smart.ListBox.DragDrop.Dragging){const i=Math.abs(e.pageX-Smart.ListBox.DragDrop.StartPosition.left),r=Math.abs(e.pageY-Smart.ListBox.DragDrop.StartPosition.top);let o=i>=0&&i<=3&&r>=0&&r<=3;if(Smart.Utilities.Core.isMobile&&new Date-Smart.ListBox.DragDrop.StartTime>=300&&(o=!1,Smart.ListBox.DragDrop.StartTime=null),o){const i=e.originalEvent.target.closest("smart-list-box");i?i._pointerUpHandler(e):t._pointerUpHandler(e),Smart.ListBox.DragDrop.StartPosition=null}else{let t=e.originalEvent.target;if(!(e.target instanceof Smart.ListItem)||t.readonly||e.target.disabled||e.target instanceof Smart.ListItemsGroup)for(;t.parentElement;){if(t instanceof Smart.ListItem&&!t.readonly&&!t.disabled&&!(t instanceof Smart.ListItemsGroup)){e.stopPropagation();break}t=t.parentElement}else e.stopPropagation()}}else if(!Smart.Utilities.Core.isMobile&&!Smart.ListBox.DragDrop.Dragging&&"release"===t.selectionChangeAction){const i=(t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest("smart-list-box");i&&(i.upTimer&&clearTimeout(i.upTimer),i.upTimer=setTimeout((()=>{i?i._pointerUpHandler(e):t._pointerUpHandler(e)})))}if(Smart.ListBox.DragDrop.Feedback){let i;if(Smart.ListBox.DragDrop.Feedback.parentNode&&Smart.ListBox.DragDrop.Feedback.parentNode.removeChild(Smart.ListBox.DragDrop.Feedback),Smart.ListBox.DragDrop.Feedback=null,Smart.Utilities.Core.isMobile&&Smart.ListBox.DragDrop.Dragging)for(let t=0;t<Smart.ListBox.DragDrop.ListBoxes.length;t++){const r=Smart.ListBox.DragDrop.ListBoxes[t],o=r.getBoundingClientRect();if(r.allowDrop&&!r.closest(".smart-visibility-hidden")&&o.left<=e.clientX&&e.clientX<=o.left+o.width&&o.top<=e.clientY&&e.clientY<=o.top+o.height){i=r;const t=r._items.filter((e=>!e.hidden));for(let i=0;i<t.length;i++){const s=t[i],n=s.getBoundingClientRect();if((t.indexOf(s)===t.length-1||s.parentNode.lastElementChild===s)&&e.clientY>=o.top+s.offsetTop-r.scrollTop+n.height/2&&e.clientY<=o.top-r.scrollTop+s.offsetTop+n.height){Smart.ListBox.DragDrop.DropDetails={item:s,position:"bottom"};break}if(e.clientY>=o.top+s.offsetTop-r.scrollTop&&e.clientY<=o.top+s.offsetTop+n.height-r.scrollTop){Smart.ListBox.DragDrop.DropDetails={item:s,position:"top"};break}}}}if(Smart.ListBox.DragDrop.Dragging){if(Smart.ListBox.DragDrop.DropDetails){let r=Smart.ListBox.DragDrop.DropDetails.item,o=Smart.ListBox.DragDrop.Item;const s=o.ownerListBox;let n=e.originalEvent.target;if(t.isInShadowDOM&&(n=e.originalEvent?e.originalEvent.composedPath()[0]:e.composedPath()[0]),i=!i&&n.closest?n.closest("smart-list-box"):i,document.body.classList.remove("smart-dragging"),r.$.removeClass("smart-list-item-line-feedback"),r.$.removeClass("smart-list-item-bottom-line-feedback"),i&&r.ownerListBox!==i&&i.items.length>0&&(r=i.items[i.items.length-1]),Smart.ListBox.DragDrop.Item===r||i!==r.ownerListBox&&!Smart.Utilities.Core.isMobile)i&&0===i._items.length&&"none"!==i.dropAction&&("move"===i.dropAction?Smart.ListBox.DragDrop.Item.ownerListBox.removeChild(Smart.ListBox.DragDrop.Item):"copy"===i.dropAction&&(o=o.cloneNode(!0)),i.appendChild(o));else if("none"!==o.ownerListBox.dropAction){r.ownerListBox!==o.ownerListBox&&"move"===o.ownerListBox.dropAction&&Smart.ListBox.DragDrop.Item.ownerListBox.removeChild(Smart.ListBox.DragDrop.Item),"copy"===o.ownerListBox.dropAction&&(o=o.cloneNode(!0)),Smart.ListBox.DragDrop.Item.group=r.group;const e=r.ownerListBox;"checkBox"!==e.selectionMode&&"radioButton"!==e.selectionMode&&e.clearSelection(),"top"===Smart.ListBox.DragDrop.DropDetails.position?e.insertBefore(o,r):r.parentNode.lastElementChild===r?e.appendChild(o):e.appendChild(o,r),e.ensureVisible(o),"checkBox"===e.selectionMode||"radioButton"===e.selectionMode?(e._focus(o),e._refreshSelection()):(e.clearSelection(),e.select(o))}o.selected&&i!==s&&s._refreshSelection();const l=Smart.ListBox.DragDrop.Item,a=l.ownerListBox;l.displayMode="checkBox"===a.selectionMode||"radioButton"===a.selectionMode?a.selectionMode:"plain",a.$.fireEvent("dragEnd",{item:l,target:r,data:Smart.ListBox.DragDrop,previousContainer:s,container:i,originalEvent:e}),a._focus(l)}else{const t=Smart.ListBox.DragDrop.Item,i=t.ownerListBox;t.displayMode="checkBox"===i.selectionMode||"radioButton"===i.selectionMode?i.selectionMode:"plain",document.body.classList.remove("smart-dragging"),i.$.fireEvent("dragEnd",{item:t,target:null,data:Smart.ListBox.DragDrop,previousContainer:i,container:i,originalEvent:e}),i._focus(t)}e.preventDefault()}delete Smart.ListBox.DragDrop.DraggedFrom,Smart.ListBox.DragDrop.Dragging=!1,Smart.ListBox.DragDrop.Item=null,Smart.ListBox.DragDrop.DropDetails=null}for(let e=0;e<Smart.ListBox.DragDrop.ListBoxes.length;e++){const t=Smart.ListBox.DragDrop.ListBoxes[e];t._dragInterval&&clearInterval(t._dragInterval)}}}_itemsContainerMoveHandler(e){const t=this;if(Smart.ListBox.DragDrop.Dragging)return t._applyItemFeedback(e),t._moveHandler(e),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}_touchmoveHandler(e){if(Smart.ListBox.DragDrop.Dragging&&e.cancelable)return e.preventDefault(),void e.stopPropagation();super._touchmoveHandler(e)}_applyItemFeedback(e){const t=this,i=e.originalEvent.target,r=i.closest?i.closest("smart-list-item"):i;Smart.Utilities.Core.isMobile?Smart.ListBox.DragDrop.DropDetails={item:Smart.ListBox.DragDrop.Item,position:"bottom"}:0!==t.items.length&&(r?r._itemOnMouseMove(e):t.items[t.items.length-1]._itemOnMouseMove(e,!0))}_moveHandler(e){const t=this;if(!Smart.ListBox.DragDrop.Feedback||Smart.ListBox.DragDrop.DraggedFrom!==t)return;const i=t.dragOffset;if(Smart.ListBox.DragDrop.Dragging){Smart.ListBox.DragDrop.Feedback.style.left=i[0]+e.pageX+"px",Smart.ListBox.DragDrop.Feedback.style.top=i[1]+e.pageY+"px",t.$.fireEvent("dragging",{item:Smart.ListBox.DragDrop.Item,data:Smart.ListBox.DragDrop,originalEvent:e.originalEvent});for(let t=0;t<Smart.ListBox.DragDrop.ListBoxes.length;t++){const i=Smart.ListBox.DragDrop.ListBoxes[t];i._dragInterval&&clearInterval(i._dragInterval),i._dragInterval=setInterval((function(){const t=i.getBoundingClientRect();t.left<=e.clientX&&t.left+t.width>=e.clientX&&(e.clientY>=t.top&&e.clientY<=t.top+20?i.scrollTop-=2:e.clientY>=t.top+t.height-20&&e.clientY<=t.top+t.height&&(i.scrollTop+=2))}),1)}return e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}{const r=Math.abs(e.pageX-Smart.ListBox.DragDrop.StartPosition.left),o=Math.abs(e.pageY-Smart.ListBox.DragDrop.StartPosition.top),s=new Date-Smart.ListBox.DragDrop.StartTime;let n=r>=5&&r<=15||o>=5&&o<=15;if(Smart.Utilities.Core.isMobile&&(s<300||s>1e3)&&(n=!1),n){Smart.ListBox.DragDrop.Dragging=!0,Smart.ListBox.DragDrop.Feedback.style.left=i[0]+e.pageX+"px",Smart.ListBox.DragDrop.Feedback.style.top=i[1]+e.pageY+"px",t.getShadowRootOrBody().appendChild(Smart.ListBox.DragDrop.Feedback),e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation();const r=Smart.ListBox.DragDrop.Item,o=r.ownerListBox;o.$.fireEvent("dragStart",{item:r,data:Smart.ListBox.DragDrop,container:o,previousContainer:o,originalEvent:e.originalEvent}),document.body.classList.add("smart-dragging")}}}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.isVirtualized?(t._items.indexOf(e)>-1&&t._items.splice(t._items.indexOf(e),1),t._items.push(e)):(e.dataItem=e,t.shadowRoot&&"light"===t.shadowDomMode?t.appendChild(e):t.$.itemsInnerContainer.appendChild(e),t._items.indexOf(e)>-1&&t._items.splice(t._items.indexOf(e),1),t._items.push(e)),t._refreshItems(),t._refreshSelection()}insertBefore(e,t){const i=this;if(!i.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(i,e.concat(Array.prototype.slice.call(arguments)))}i.isVirtualized?(i._items.indexOf(e)>-1&&i._items.splice(i._items.indexOf(e),1),i._items.splice(i._indexOf(t),0,e)):(e.dataItem=e,t.parentNode.insertBefore(e,t),i._items.indexOf(e)>-1&&i._items.splice(i._items.indexOf(e),1),i._items.splice(i._indexOf(t),0,e)),i._refreshItems(),i._refreshSelection()}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)))}if(t.isVirtualized)t._items.splice(t._indexOf(e),1);else if(e.parentNode){const i=t.selectedIndexes.slice(0),r=t.selectedValues.slice(0),o=i.indexOf(e.dataIndex);e.parentNode.removeChild(e),o>-1&&(i.splice(o,1),r.splice(o,1),t.selectedIndexes=i,t.selectedValues=r)}t._refreshItems()}propertyChangedHandler(e,t,i){if("dataSource"===e&&(!i||i&&Array.isArray(i)&&0===i.length))return void this.clearItems();super.propertyChangedHandler(e,t,i);const r=this;switch(e){case"innerHTML":r.clearSelection(),r._dataBind(),r.innerHTML=r.content=Smart.Utilities.Core.html(r.$.content);break;case"dataSource":case"valueMember":case"groupMember":case"displayMember":r.clearSelection(),r._dataBind(),r._applyDefaultSelection();break;case"disabled":case"unfocusable":r._setFocusable();break;case"displayLoadingIndicator":r._setLoadingIndicatorVisibility();break;case"filterable":r._refreshFilter(),r._refreshLayout();break;case"grouped":if(i?r._group():r._ungroup(),"radioButton"===r.selectionMode){if(r.selectedValues.length>0){const e=r.selectedValues;r.clearSelection(),r.select(e[0])}}else r._refreshSelection();r._refreshLayout();break;case"itemTemplate":{if(null===i||""===i)return r._items.map((e=>e.innerHTML=e.label)),delete r._bindingDetails,void r._refreshLayout();const e=r.querySelectorAll("smart-list-item"),t=function(){r._handleItemTemplate(i)&&(r._items.map((e=>r._applyTemplate(e))),r._refreshLayout()),r.ownerElement&&r.ownerElement._setDropDownSize&&r.ownerElement._setDropDownSize(),r.$.fireEvent("bindingComplete")};0===e.length?t():r._ensureItemsReady(e,t);break}case"selectedIndexes":case"selectedValues":{let o=r.selectedIndexes.slice(0),s=r.selectedValues.slice(0);if(!r._items||0===r._items.length)return r.selectedIndexes=[],r.selectedValues=[],void(r.$.hiddenInput.value=r.selectedValues.toString());if(r._propertyChanging=!0,"selectedIndexes"===e){o=t.slice(0),r.clearSelection();for(let e=0;e<i.length;e++){const t=i[e],o=r._items[t];o&&("oneOrManyExtended"===r.selectionMode||"oneOrMany"===r.selectionMode?(r.selectedIndexes.length>0&&0===e&&r.clearSelection(),r._select(o)):r.select(o))}}else{s=t.slice(0),r.selectedValues=[],r.clearSelection();for(let e=0;e<i.length;e++){const t=i[e],o=r.getItem(t);o&&("oneOrManyExtended"===r.selectionMode?r._select(o):r.select(o))}}if(r.selectedIndexes.length>0&&r._focus(r._items[r.selectedIndexes[0]]),r._propertyChanging=!1,JSON.stringify(s)!==JSON.stringify(r.selectedValues.slice(0))){let e=[],t=[];for(let e=0;e<o.length;e++)r.selectedIndexes.indexOf(o[e])<0&&t.push(r._items[o[e]]);for(let t=0;t<r.selectedIndexes.length;t++)o.indexOf(r.selectedIndexes[t])<0&&e.push(r._items[r.selectedIndexes[t]]);let i={addedItems:e,removedItems:t};if(r.selectedIndexes.length>0){const e=r._items[r.selectedIndexes[r.selectedIndexes.length-1]];void 0!==e&&(i.selected=e.selected,i.disabled=e.disabled,i.index=r._indexOf(e),i.label=e.label,i.value=e.value)}else i.selected=!1,i.disabled=!1,i.index=-1,i.label="",i.value="";r.$.fireEvent("change",i),r._updateTargetValue()}break}case"selectionMode":{const e="checkBox"===r.selectionMode||"radioButton"===r.selectionMode?r.selectionMode:"plain",o=r.selectedIndexes.slice(0),s=r.selectedValues.slice(0);r._propertyChanging=!0;const n=r.selectedValues;r.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(i)),r.selectedValues=[],r.clearSelection();for(let e=0;e<n.length;e++){const t=n[e],i=r.getItem(t);i&&("oneOrManyExtended"===r.selectionMode?r._select(i):r.select(i))}if(r._items.forEach((t=>t.displayMode=e)),r._recycle(),r._propertyChanging=!1,JSON.stringify(s)!==JSON.stringify(r.selectedValues.slice(0))){let e=[],t=[];for(let e=0;e<o.length;e++)r.selectedIndexes.indexOf(o[e])<0&&t.push(r._items[o[e]]);for(let t=0;t<r.selectedIndexes.length;t++)o.indexOf(r.selectedIndexes[t])<0&&e.push(r._items[r.selectedIndexes[t]]);let i={addedItems:e,removedItems:t};if(o.length>0){const e=r._items[o[o.length-1]];e&&(i.selected=e.selected,i.disabled=e.disabled,i.index=r._indexOf(e),i.label=e.label,i.value=e.value)}r.$.fireEvent("change",i),r._updateTargetValue()}r._applyAriaSelected(),"checkBox"!==i&&"radioButton"!==i&&"checkBox"!==t&&"radioButton"!==t||r._refreshLayout();break}case"topVisibleIndex":r._setTopVisibleIndex(i);break;case"autoSort":r._canSort=i;break;case"alternationStart":case"alternationEnd":case"alternationCount":r._refreshItems(),r._refreshLayout();break;case"sortDirection":case"sorted":{r._canSort=!0,i?r._sort():r._unsort();const e=r.selectedValues;r.selectedValues=[],r._refreshSelection();for(let t=0;t<e.length;t++){const i=e[t],o=r.getItem(i);o&&("oneOrManyExtended"===r.selectionMode?r._select(o):r.select(o))}r._refreshLayout(),r._canSort=r.autoSort;break}}}_refreshSelection(){const e=this;if(!e._items||0===e._items.length)return;const t=e.selectedValues;e.selectedIndexes=[],e.selectedValues=[];for(let i=0;i<e._items.length;i++){const r=e._items[i];r.selected=!1,t.indexOf(r.value)>-1&&e.select(r)}e._recycle()}clearSelection(){const e=this;if(!e._items||0===e._items.length)return;let t=[];for(let i=0;i<e._items.length;i++)e._items[i].selected&&t.push(e._items[i]);e._items.map((e=>e.selected=!1)),e.selectedValues.slice(0);const i=e.selectedIndexes.slice(0);if(e.selectedIndexes=[],e.selectedValues=[],e.$.hiddenInput.value=e.selectedValues.toString(),e._recycle(),e.context!==e){let r={addedItems:[],removedItems:t};if(i.length>0){const t=e._items[i[i.length-1]];t&&(r.selected=t.selected,r.disabled=t.disabled,r.index=e._indexOf(t),r.label=t.label,r.value=t.value)}e.$.fireEvent("change",r),e._updateTargetValue()}}ensureVisible(e){const t=this;if(e)return!("string"==typeof e&&!(e=t.getItem(e))||(t.isVirtualized||t.$.itemsContainer.scrollTop===t.scrollTop||(t.scrollTop=t.$.itemsContainer.scrollTop),e.top+e.height>=t.scrollTop+t.offsetHeight&&(t.scrollTop=t.scrollTop+e.height,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),(e.top<=t.scrollTop||e.top>=t.scrollTop+t.$.itemsContainer.offsetHeight)&&(t.scrollTop=e.top,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),0===t._indexOf(e)||1===t._indexOf(e)&&t._items.length>1&&t._items[0].grouped?(t.scrollTop=0,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)):t._indexOf(e)===t._items.length-1&&(t.scrollTop=t.scrollHeight,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),0))}get items(){const e=this;if(!window.__karma__&&!window.karma&&e instanceof Element&&e.isRendered&&e.hasAttribute&&e.hasAttribute("smart-blazor")){let t=[];for(let i=0;i<e._items.length;i++){const r=e._items[i];t.push({label:r.label,value:r.value})}return t}return e._filteredItems?e._filteredItems:e._items}getItems(){const e=this,t=e._filteredItems?e._filteredItems:e._items;let i=[];if(t&&t.length>0)for(let e=0;e<t.length;e++){const r=t[e];i.push({label:r.label,value:r.value})}return i}ready(){super.ready();const e=this;if(e.shadowRoot&&"light"===e.shadowDomMode){const t=document.createDocumentFragment();[].slice.call(e.$.itemsInnerContainer.children).map((e=>t.appendChild(e))),e.appendChild(t),e.$.itemsInnerContainer.appendChild(document.createElement("slot"))}e._areCSSVarsSupported=Smart.Utilities.Core.CSSVariablesSupport(),e.isUpdating=0,e._scrollView&&(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar),e._scrollView.hScrollBar.$.addClass("smart-hidden"),e._scrollView.vScrollBar.$.addClass("smart-hidden"));const t=e._scrollView.vScrollBar,i=e._scrollView.hScrollBar;t.hasStyleObserver=!1,i.hasStyleObserver=!1,t.hasResizeObserver=!1,i.hasResizeObserver=!1,t.wait=!1,i.wait=!1,e._setFocusable()}render(){const e=this;e.setAttribute("role","listbox"),e.setAttribute("aria-orientation","vertical"),e.$.verticalScrollBar.setAttribute("aria-controls",e.id),e.$.horizontalScrollBar.setAttribute("aria-controls",e.id),e._keysPressed={},e._incrementalSearchQuery="",e._incrementalSearchItems=[],e._canSort=!0,e._previousEntry="",e._setLoadingIndicatorVisibility(),e._refreshFilter(),e._initializeInnerHTML(),e._dataBind(),e._applyDefaultSelection(),e.enableShadowDOM&&HTMLElement.prototype.appendChild.apply(e,[e.$.hiddenInput]),e.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(e.selectionMode)),super.render()}_lazyInitItems(){const e=this;if(e._inLazyInit)return cancelAnimationFrame(Smart.ListBox.processTimer),void delete Smart.ListBox.processTimer;e._inLazyInit=!0,e.dataSource||(e.clearSelection(),e._dataBind(),e._applyDefaultSelection()),cancelAnimationFrame(Smart.ListBox.processTimer),delete Smart.ListBox.processTimer,e._inLazyInit=!1}_applyDefaultSelection(){const e=this;!e._focusedItem&&e._items&&e._items.length>0&&0===e.selectedIndexes.length&&("one"!==e.selectionMode&&"oneOrMany"!==e.selectionMode&&"oneOrManyExtended"!==e.selectionMode||e.select(e._items[0]))}attached(){const e=this;super.attached(),Smart.ListBox.DragDrop||(Smart.ListBox.DragDrop={ListBoxes:[]}),Smart.ListBox.DragDrop.ListBoxes.push(e),e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.selectedIndexes.length>0&&e._items&&e.ensureVisible(e._items[e.selectedIndexes[0]])}detached(){const e=this;if(super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),Smart.ListBox.DragDrop&&Smart.ListBox.DragDrop.ListBoxes){const t=Smart.ListBox.DragDrop.ListBoxes.indexOf(e);Smart.ListBox.DragDrop.ListBoxes.splice(t,1)}}_createItem(e,t,i){const r=this,o="checkBox"===r.selectionMode||"radioButton"===r.selectionMode?r.selectionMode:"plain",s=i?{}:document.createElement("smart-list-item");s.ownerListBox=r,"number"==typeof e&&(e=""+e);const n=function(t,i){return void 0!==e[t]?""+e[t]:e[i]};let l="string"==typeof e?e:n(r.displayMember,"label"),a="string"==typeof e?e:n(r.valueMember,"value"),d=n(r.groupMember,"group");return void 0===l&&(l=void 0!==t?""+t:""),s.label=s.innerHTML=""+l,void 0===a&&(a=void 0!==t?""+t:l),e.color&&(s.color=e.color),s.value=""+a,s.displayMode=o,s.selected=!!e.selected&&e.selected,s.disabled=!!e.disabled&&e.disabled,s.dataItem=s,void 0!==t&&(s.dataIndex=t),r._alternateItem(s),e.title&&(s.title=e.title),d&&(s.group=""+d),s}_alternateItem(e){const t=this,i=t.alternationStart,r=t.alternationEnd>0?t.alternationEnd:1/0;t.alternationCount<=0||(void 0===t._alternationIndexCounter&&(t._alternationIndexCounter=0),e.dataIndex>=i&&e.dataIndex<=r&&(e.alternationIndex=t._alternationIndexCounter++,t._alternationIndexCounter===t.alternationCount&&(t._alternationIndexCounter=0)))}_beginUpdate(){this.isUpdating++}_isUpdating(){return this.isUpdating>0}_endUpdate(){this.isUpdating--}get _scrollHeight(){const e=this;if(0===e._items.length||e._items.filter((e=>!e.hidden)).length<1)return 0;let t=0;if(e.isVirtualized){if(e.__scrollHeight)return e.__scrollHeight;if(0===e._items.length)return 0;e.isUpdating++;const i=e._createItem(e.dataSource[0]);e.$.itemsInnerContainer.appendChild(i);for(let r=0;r<e._items.length;r++){const o=e._items[r];o.hidden?(o.height=0,o.top=t):(e.itemHeight?(e.itemHeight<32&&(e.itemHeight=32),o.height=e.itemHeight):(i.$&&i.$.itemContainer?i.$.itemContainer.firstElementChild.innerHTML=o.label:i.label=o.label,o.height=i.offsetHeight),o.top=t,t+=o.height)}e.$.itemsInnerContainer.removeChild(i),e.__scrollHeight=t-e.$.itemsInnerContainer.offsetHeight,e.filterable&&(e.__scrollHeight+=e.$.filterInput.offsetHeight),t=e.__scrollHeight,e.isUpdating--}else{for(let i=0;i<e._items.length;i++){const r=e._items[i];r.hidden?(r.height=0,r.top=t):(e.itemHeight?"auto"!==e.itemHeight&&(r.height=e.itemHeight,r.style.height=r.height+"px"):r.height=r.offsetHeight,r.top=r.offsetTop,t+=r.height)}t=e.$.itemsInnerContainer.scrollHeight-e.$.itemsInnerContainer.offsetHeight,e.filterable&&t>0&&(t+=e.$.filterInput.offsetHeight),e.__scrollHeight=t}return t}_initializeRecyclingItems(){const e=this;if(!e.dataSource||e.dataSource&&0===e.dataSource.length||!e.isVirtualized)return;let t=0,i=e.offsetHeight||400;e.$.itemsInnerContainer.innerHTML="",e._recyclingItems=[];const r=function(){for(let r=0;r<e.dataSource.length;r++){const o=e.dataSource[r],s=e._createItem(o);if(e.itemHeight&&"auto"!==e.itemHeight&&(s.style.height=e.itemHeight+"px"),e.$.itemsInnerContainer.appendChild(s),t+=s.offsetHeight,s.dataItem=e._items[r],e._recyclingItems.push(s),t>1.5*i)break}};r();let o=0;for(;t<1.5*i&&++o<5;)r()}_dataBind(){const e=this;if(e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),"function"==typeof e.dataSource&&(e._items=[],delete e._filteredItems),"string"==typeof e.dataSource&&(e.dataSource=JSON.parse(e.dataSource)),null!==e.dataSource&&Array.isArray(e.dataSource)){e.isUpdating++;const t=t=>{e._items=[],e._groups=[],delete e._filteredItems;const i=e.dataSource;for(let r=0;r<i.length;r++){const o=i[r],s=e._createItem(o,r,!t);e._items[r]=s,t&&t.appendChild(s)}};if(e.isVirtualized)t(),e._initializeRecyclingItems();else{const i=document.createDocumentFragment();e.$.itemsInnerContainer.innerHTML="",t(i),e.$.itemsInnerContainer.appendChild(i)}e.isUpdating--}const t=e.shadowRoot?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item"),i=function(){e.isUpdating++,e.dataSource||(e._initializeHtmlListItems(),e._initializeHtmlListGroups()),e.grouped&&e._group(),e.sorted&&e._sort(),e._refreshLayout(),e._initializeSelection(),e.isInitialized=!0,e._canSort=e.autoSort,e.isUpdating--,e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&(e._items.map((t=>e._applyTemplate(t))),e._refreshLayout()),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted()),e.topVisibleIndex>-1&&e._setTopVisibleIndex(e.topVisibleIndex),e.$.fireEvent("bindingComplete"),e._updateTopVisibleIndex(),0===e._items.length&&e.clearItems(),e._applyAriaSelected()};0===t.length?i():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(t,i))}_ensureItemsReady(e,t){const i=this,r=function(){const i=function(t){for(let i=0;i<e.length;i++)e[i].context="node"===t?e[i]:document};i("node"),t(),i()};if(0===e.length)r();else{i._nodesReadyListeners=0;for(let t=0;t<e.length;t++){const o=e[t],s=function(){i._nodesReadyListeners--,0===i._nodesReadyListeners&&(r(),delete i._nodesReadyListeners)}.bind(i);o.isCompleted||(i._nodesReadyListeners++,o._onCompleted=s)}0===i._nodesReadyListeners&&r()}}_initializeInnerHTML(){const e=this;e.$.itemsInnerContainer.innerHTML.indexOf("<option")>=0?e.$.itemsInnerContainer.innerHTML=e.$.itemsInnerContainer.innerHTML.replace(/<optgroup/gi,"<smart-list-items-group").replace(/<\/optgroup/gi,"</smart-list-items-group").replace(/<option/gi,"<smart-list-item").replace(/<\/option/gi,"</smart-list-item"):e.$.itemsInnerContainer.innerHTML.indexOf("<ul")>=0&&(e.$.itemsInnerContainer.innerHTML=e.$.itemsInnerContainer.innerHTML.replace(/<ul/gi,"<smart-list-items-group").replace(/<\/ul/gi,"</smart-list-items-group").replace(/<li/gi,"<smart-list-item").replace(/<\/li/gi,"</smart-list-item"))}_initializeHtmlListItems(){const e=this,t=e.shadowRoot&&"shadow"===e.shadowDomMode?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item"),i="checkBox"===e.selectionMode||"radioButton"===e.selectionMode?e.selectionMode:"plain",r=function(e,t,i){return void 0!==e[t]?""+e[t]:e[i]};e._items=[];let o=0;for(let s=0;s<t.length;s++){const n=t[s];n.dataIndex=s,n.label=n.innerHTML,n.dataItem=n,n.top||(n.top=o),n.height||(n.height=n.offsetHeight),o+=n.height,n.value||(n.value=""+s);const l=r(n,e.displayMember,"label"),a=r(n,e.valueMember,"value"),d=r(n,e.groupMember,"group");n.label!==l&&(n.label=l),n.value!==a&&(n.value=a),n.group!==d&&(n.group=d);const c=n.context;n.context=document,n.displayMode=i,n.context=c,e._alternateItem(n),n.selected&&(e.selectedIndexes.push(s),e.selectedValues.push(n.value)),e._items.push(n)}e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&e._items.map((t=>e._applyTemplate(t)))}_group(){const e=this;e.isUpdating++;let t=[],i=[];e._canSort&&e._unsort();for(let i=0;i<e._items.length;i++){const r=e._items[i];let o=r.group?r.group.trim():r.innerHTML.charAt(0)||r.label.charAt(0);o+=" ",t[o]?t[o].items.push(r):t[t.length++]=t[o]={items:[r],label:o}}if(e.isVirtualized){e._groups=[];for(let e=0;e<t.length;e++){const r=t[e];r.dataIndex=e,r.grouped=!0,r.hidden=!1,r.displayMode="plain",i.push(r);for(let o=0;o<t[e].items.length;o++){const e=r.items[o];e.group=r,i.push(e)}}e._groups=t,e._items=i}else{for(;e.$.itemsInnerContainer.firstChild;)e.$.itemsInnerContainer.removeChild(e.$.itemsInnerContainer.firstChild);const r=document.createDocumentFragment();e._groups=[];for(let o=0;o<t.length;o++){const s=t[o],n=document.createElement("smart-list-items-group");n.label=s.label,n.dataIndex=o;for(let e=0;e<t[o].items.length;e++){const t=s.items[e];i.push(t),t.group=s.label,n.appendChild(t)}e._groups.push(n),r.appendChild(n)}e._items=i,/Trident|Edge/.test(navigator.userAgent)?setTimeout((function(){e.$.itemsInnerContainer.appendChild(r)}),50):e.$.itemsInnerContainer.appendChild(r)}e.sorted&&e._sort(),e.isUpdating--}_ungroup(){const e=this;e.isUpdating++,e._groups=[],e._canSort&&e._unsort();let t=[];if(e.isVirtualized)for(let i=0;i<e._items.length;i++){const r=e._items[i];r.grouped||t.push(r)}else{const i=document.createDocumentFragment();for(let r=0;r<e._items.length;r++){const o=e._items[r];i.appendChild(o),t.push(o)}t.length>0&&(e.$.itemsInnerContainer.innerHTML="",e.$.itemsInnerContainer.appendChild(i))}e._items=t,e.sorted&&e._sort(),e.isUpdating--}_initializeHtmlListGroups(){const e=this,t=e.$.itemsInnerContainer.querySelectorAll("smart-list-items-group");e._groups=[];for(let i=0;i<t.length;i++){const r=t[i];r.dataIndex=i,e._groups.push(r)}}_initializeSelection(){const e=this,t=e.selectedIndexes.slice(0),i=e.selectedValues.slice(0);e.clearSelection(),"oneOrManyExtended"===e.selectionMode&&(e._keysPressed.Control=!0);for(let r=0;r<e._items.length;r++){const o=e._items[r];(t.indexOf(r)>=0||i.indexOf(o.value||o.label)>=0)&&(e._focusedItem&&(e._focusedItem._focused=!1),e._focusedItem=null,e.select(o))}"oneOrManyExtended"===e.selectionMode&&(e._keysPressed.Control=!1)}onItemUpdated(){const e=this;e.isInitialized&&!e._isUpdating()&&(e.isUpdating++,e._refreshLayout(),e.isUpdating--)}_refreshItems(){const e=this;if(e.isInitialized&&!e._isUpdating()){if(e.isUpdating++,e.grouped?e._ungroup():e.sorted&&e._canSort&&e._unsort(),!e.isVirtualized){e._items=[];const t=e.shadowRoot?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item");for(let i=0;i<t.length;i++)t[i].dataIndex=i,e._alternateItem(t[i]),e._items.push(t[i])}e.grouped?e._group():e.sorted&&e._sort(),e._refreshLayout(),e.isUpdating--}}_applyIncrementalSearch(e){const t=this;null===t.incrementalSearchDelay||isNaN(t.incrementalSearchDelay)||["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control","Home","End","PageUp","PageDown"].indexOf(e)>-1||(0!==t._incrementalSearchQuery.indexOf(e)&&(t._incrementalSearchQuery+=e),t._incrementalSearchTimer&&clearTimeout(t._incrementalSearchTimer),t._incrementalSearch(),t._incrementalSearchTimer=setTimeout((function(){t._incrementalSearchQuery=""}),t.incrementalSearchDelay))}select(e){const t=this;if(("string"!=typeof e||(e=t.getItem(e)))&&("number"!=typeof e||(e=t.getItem(e)))&&!(e.grouped||e.readonly||!t._items.length||e instanceof HTMLElement&&!t.contains(e))){if("none"===t.selectionMode)return t.selectedIndexes=[],void(t.selectedValues=[]);switch(!t._focusedItem!==e&&"none"!==t.selectionMode&&(t._focusedItem&&(t._focusedItem._focused=!1),t._focusedItem=e,e._focused=!0),t.selectionMode){case"one":case"zeroAndOne":return(1!==t.selectedIndexes.length||t.selectedIndexes[0]!==t._indexOf(e))&&(t._previouslySelectedIndexes=t.selectedIndexes,t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e),delete t._previouslySelectedIndexes,!0);case"zeroOrOne":return 1===t.selectedIndexes.length&&t.selectedIndexes[0]===t._indexOf(e)?(t.unselect(e),!0):(t._previouslySelectedIndexes=t.selectedIndexes,t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e),delete t._previouslySelectedIndexes,!0);case"radioButton":if(t._previouslySelectedIndexes=t.selectedIndexes,t.$.itemsInnerContainer.querySelectorAll("smart-list-items-group").length>0){const i=e.parentNode;if(!e.selected){for(let e in i.children){const r=i.children[e];r.selected&&t.unselect(r)}t._select(e)}return delete t._previouslySelectedIndexes,!0}if(t.isVirtualized&&t._groups.length>0){const i=e.group;if(!e.selected){for(let e in i.items){const r=i.items[e];r.selected&&t.unselect(r)}t._select(e)}return delete t._previouslySelectedIndexes,!0}return e.selected||(t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e)),delete t._previouslySelectedIndexes,!0;case"oneOrMany":return e.selected?t.selectedIndexes.length>1&&t.unselect(e):t._select(e),!0;case"zeroOrMany":case"checkBox":return e.selected?t.unselect(e):t._select(e),!0;case"oneOrManyExtended":{const i=t.selectedValues;if(t._keysPressed.Control)return t.selectedIndexes.length>1&&e.selected?(t.unselect(e),t._focus(t._items[t.selectedIndexes[0]])):t._select(e),!0;if(t._keysPressed.Shift){const r=t._items[t.selectedIndexes[0]];let o;t.clearSelection();const s=i.indexOf(r.value)>=0||r.selected;if(t._select(r,s),t._indexOf(r)>t._indexOf(e))for(o=t._indexOf(r)-1;o>=t._indexOf(e);){const e=t._items[o],r=i.indexOf(e.value)>=0||e.selected;t._select(e,r),o--}else for(o=t._indexOf(r)+1;o<=t._indexOf(e);){const e=t._items[o],r=i.indexOf(e.value)>=0||e.selected;t._select(e,r),o++}const n=[];for(let e=0;e<i.length;e++)n.push(t.getItem(i[e]));if(n.length>0&&!t._propertyChanging){let r=[];for(let e=0;e<t.selectedValues.length;e++){const o=t.selectedValues[e];i.indexOf(o)<0&&r.push(t.getItem(o))}t.$.fireEvent("change",{addedItems:r,removedItems:n,selected:e.selected,disabled:e.disabled,index:t._indexOf(e),label:e.label,value:e.value}),t._updateTargetValue()}return!0}for(let r=0;r<i.length;r++){const o=i[r],s=t.getItem(o);e!==s&&t.unselect(s)}return t.clearSelection(),t._select(e,i.indexOf(e.value)>=0),!0}}return!1}}_applyTemplate(e,t){const i=this;if(null===i.itemTemplate)return;if("function"==typeof i.itemTemplate)return void i.itemTemplate(e,{label:e.label,value:e.value,index:i._items.indexOf(e)});if(!i._bindingDetails||0===i._bindingDetails.length)return;const r=i._bindingDetails.length;let o,s,n=document.importNode(i._template.content,!0);for(let t=0;t<r;t++){o=n.childNodes[i._bindingDetails[t].childNodeIndex],s=i._bindingDetails[t].bindingString.length;for(let r=0;r<s;r++){const s=i._bindingDetails[t].bindingString[r],n=s.indexOf("label")>=0?e.label:e.value;o.innerHTML=o.innerHTML.replace(s,n)}}e.innerHTML="";for(let t=0;t<n.childNodes.length;t++)n.childNodes[t].outerHTML&&(e.innerHTML+=n.childNodes[t].outerHTML);!1!==t&&(i._scrollHeightTimer&&(clearInterval(i._scrollHeightTimer),i._scrollHeightCounter=0),i._scrollHeightTimer=setInterval((function(){i._lastScrollHeight===i.$.itemsInnerContainer.scrollHeight&&10!==i._scrollHeightCounter||(i._refreshLayout(),clearInterval(i._scrollHeightTimer)),i._lastScrollHeight=i.$.itemsInnerContainer.scrollHeight,i._scrollHeightCounter++}),50))}_filterItems(e,t,i){const r=this,o=r.$.filterInput.value;let s,n;const l=function(){if(0===n.length)return r._filteredItems=[],void(t&&t());s=r._queryItems(o,r.filterMode);for(let e=0;e<n.length;e++)n[e].hidden=!0,n[e].$&&n[e].$.addClass("smart-hidden");for(let e=0;e<s.length;e++){const t=s[e];t.hidden=!1,n[e].$&&t.$.removeClass("smart-hidden")}if(r.grouped&&r.isVirtualized)for(let e=0;e<r._groups.length;e++){const t=r._groups[e],i=t.items;let o=!0;for(let e=0;e<i.length;e++)i[e].hidden||(o=!1);o&&(t.hidden=!0)}if(r.grouped&&!r.isVirtualized)for(let e=0;e<r._groups.length;e++){const t=r._groups[e],i=[].concat(...t.querySelectorAll("smart-list-item"));let o=!0;for(let e=0;e<i.length;e++)i[e].$.hasClass("smart-hidden")||(o=!1);o?t.$.addClass("smart-hidden"):t.$.removeClass("smart-hidden")}if(r._filteredItems=s,r._refreshLayout(),t&&t(),e)return;const i=r._propertyChanging;r._propertyChanging=!0,r._refreshSelection(),r._propertyChanging=i};if("function"==typeof r.dataSource)if(o||i){const e=function(e){(o||i)&&r.isAttached&&(r._updateListBoxAfterQuery=function(){s=n=r._items,l()},r.clearItems(),r.insert(0,e))},t=r.dataSource(o,e);if(t){if(!o&&!i)return;r._updateListBoxAfterQuery=function(){s=n=r._items,l()},r.clearItems(),r.insert(0,t)}}else r.clearItems(),s=n=r._items,l(),r.$.fireEvent("bindingComplete");else{if(n=r._items,0===n.length)return;l()}}_getNextItem(e){const t=this._items,i=this._items.length;let r=Math.max(e+1,0);for(;r<i;){const e=t[r];if(!(e.disabled||e.hidden||e.grouped||e.readonly))return e;r++}return t[e]}_getPreviousItem(e){const t=this._items;let i=Math.max(e-1,0);for(;i>-1;){const e=t[i];if(!(e.disabled||e.hidden||e.grouped||e.readonly))return e;i--}return t[e]}get _scrollWidth(){const e=this,t=e._items;return e.__scrollWidth||(e.__scrollWidth=(()=>{const e=this,i=e.virtualized,r=e.itemMeasureMode;let o=0,s="";function n(t){const i=e._createItem({label:t});i.style.position="absolute",e.$.itemsContainer.appendChild(i),i.label=t,i.style.width="auto",i.isCompleted&&(i.$.itemContainer.style.width="auto");const r=getComputedStyle(i),o=parseInt(r.paddingLeft)+parseInt(r.paddingRight),s=i.$.itemContainer||i,n=s.offsetWidth+s.offsetLeft+o;return i.parentNode.removeChild(i),n}for(let e=0;e<t.length;e++){const l=t[e];if(!l.hidden)if("auto"===r){const e=i?l.label:l.textContent.trim();e.length>s.length&&(s=e)}else o=Math.max(o,n(l.label))}return"auto"===r?n(s):o})()),e.__scrollWidth}update(e,t){const i=this,r=i._items[e];if(r){if("string"==typeof t)r.label=t,void 0===r.value&&(r.value=t);else for(let e in t)"selected"===e&&r[e]!==t[e]?i.select(r):r[e]=t[e],"group"===e&&i._refreshItems();(i.sorted||i.grouped||i.isVirtualized)&&(i._refreshItems(),i._refreshSelection())}else i.error(i.localize("indexOutOfBound",{elementType:i.nodeName.toLowerCase(),method:"update"}))}insert(e,t){const i=this;let r=[];if((!e||e<0)&&(e=0),Array.isArray(t)){i.isUpdating++;for(let o=0;o<t.length;o++){const s=t[o],n=i._createItem(s);r.push(n),e>=i._items.length||0===i._items.length?i.appendChild(n):i.insertBefore(n,i._items[e])}i.isUpdating--}else{const o=i._createItem(t);r.push(o),e>=i._items.length||0===i._items.length?i.appendChild(o):i.insertBefore(o,i._items[e])}r.length>0?(r.map((e=>i._applyTemplate(e))),i._ensureItemsReady(r,(function(){i._refreshItems(),0!==i._items.length&&(i._updateListBoxAfterQuery&&(i._updateListBoxAfterQuery(),delete i._updateListBoxAfterQuery),i._refreshSelection(),i.$.fireEvent("bindingComplete"))}))):i._updateListBoxAfterQuery&&(i._updateListBoxAfterQuery(),delete i._updateListBoxAfterQuery)}removeAt(e){const t=this,i=t._items[e];i?(i.selected&&t.unselect(i),t.isVirtualized?t._items.splice(e,1):i.parentNode.removeChild(i),t._refreshItems(),t._refreshSelection(),0===t.selectedIndexes.length&&t._items.length>0&&("oneOrMany"!==t.selectionMode&&"one"!==t.selectionMode&&"oneOrManyExtended"!==t.selectionMode||t.select(t._items[0]))):t.error(t.localize("indexOutOfBound",{elementType:t.nodeName.toLowerCase(),method:"remove"}))}_queryItems(e,t){const i=this,r=[],o=function(r,o){if(r.grouped)return r;switch(t){case"startsWith":if(0===r.label.indexOf(o))return r;break;case"startsWithIgnoreCase":if(0===r.label.toLowerCase().indexOf(o.toLowerCase()))return r;break;case"doesNotContain":if(r.label.indexOf(o)<0)return r;break;case"doesNotContainIgnoreCase":if(r.label.toLowerCase().indexOf(o.toLowerCase())<0)return r;break;case"contains":if(r.label.indexOf(o)>-1)return r;break;case"containsIgnoreCase":if(r.label.toLowerCase().indexOf(o.toLowerCase())>-1)return r;break;case"equals":if(0===r.label.localeCompare(o))return r;break;case"equalsIgnoreCase":if(0===r.label.toLowerCase().localeCompare(o.toLowerCase()))return r;break;case"endsWith":if(r.label.endsWith(o))return r;break;case"endsWithIgnoreCase":if(r.label.toLowerCase().endsWith(o.toLowerCase()))return r;break;case"custom":if(i.filterCallback(r,e))return r}return null};if(0===e.length)return i._items;for(let t=0;t<i._items.length;t++){const s=o(i._items[t],e);s&&r.push(s)}return r}_select(e,t){const i=this,r=i.selectedIndexes.indexOf(i._indexOf(e)),o=i.selectedIndexes.slice(0),s=i.selectedValues.slice(0);if(e.selected=!0,-1!==r)return i._recycle(),!1;if(o.push(i._indexOf(e)),s.push(e.value||e.label),i.selectedIndexes=o,i.selectedValues=s,i._recycle(),i.$.hiddenInput.value=s.toString(),!i.isCompleted||t||!i.isInitialized||i._propertyChanging)return;let n=[];if(i._previouslySelectedIndexes){for(let e=0;e<i._previouslySelectedIndexes.length;e++)i.selectedIndexes.indexOf(i._previouslySelectedIndexes[e])<0&&n.push(i._items[i._previouslySelectedIndexes[e]]);delete i._previouslySelectedIndexes}return i.$.fireEvent("change",{addedItems:[e],removedItems:n,selected:e.selected,disabled:e.disabled,index:i._indexOf(e),label:e.label,value:e.value}),i._updateTargetValue(),!0}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const i=e.dataset.property,r=e.value;i&&void 0!==t[i]&&(t[i]=r)}}}_setTopVisibleIndex(e){const t=this;if("number"==typeof e&&(t.topVisibleIndex=Math.max(0,e),e=t._items[t.topVisibleIndex]),!e)return!1;e.top!==t.scrollTop&&(t.scrollTop=e.top,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop),t.scrollHeight===t.scrollTop&&t._updateTopVisibleIndex())}_updateTopVisibleIndex(){const e=this,t=e.scrollTop+e._scrollView.verticalScrollBar.offsetHeight-e.offsetHeight;let i;if(e.scrollTop<e.scrollHeight/2){for(let r=0;r<e._items.length;r++)if(e._items[r].top>=t){i=e._items[r];break}}else for(let r=e._items.length-1;r>=0&&!(e._items[r].top<t);r--)i=e._items[r];if(i){const t=e.context;e.context=e,e.topVisibleIndex=i.dataIndex,e.context=t}}unselect(e){const t=this;if(!e)return;if("string"==typeof e&&!(e=t.getItem(e)))return;if("none"===t.selectionMode)return void t.clearSelection();const i=t.selectedIndexes.indexOf(t._indexOf(e)),r=t.selectedIndexes.slice(0),o=t.selectedValues.slice(0);return e.selected=!1,i>=0&&(r.splice(i,1),o.splice(i,1),t.selectedIndexes=r,t.selectedValues=o,t.$.hiddenInput.value=o.toString(),t.isCompleted&&!t._propertyChanging?(t.$.fireEvent("change",{addedItems:[],removedItems:[e],selected:e.selected,disabled:e.disabled,index:t._indexOf(e),label:e.label,value:e.value}),t._updateTargetValue(),t._recycle(),!0):void 0)}_handleItemTemplate(e){if(null===e||!e)return;if("function"==typeof e)return e;const t=this;if(!("content"in document.createElement("template")))return t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()})),void(t.itemTemplate=null);if(null===(e=document.getElementById(e))||!("content"in e))return t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:"itemTemplate"})),void(t.itemTemplate=null);const i=e.content,r=i.childNodes.length,o=/{{\w+}}/g;let s,n;t._bindingDetails=[],t._template=e;for(let e=0;e<r;e++){for(n=[];s=o.exec(i.childNodes[e].innerHTML);)n.push(s[0]);n.length>0&&t._bindingDetails.push({childNodeIndex:e,bindingString:n})}return!0}_handleKeyStrokes(e){const t=this,i="radioButton"===t.selectionMode||"checkBox"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode;let r=t._items;if(t.filterable&&t.$.filterInput.value.length>0&&(r=t._filteredItems),!t.disabled&&!t.readonly&&r.length){switch(e){case"ArrowLeft":case"ArrowUp":t._handleArrowKeys(!0);break;case"ArrowRight":case"ArrowDown":t._handleArrowKeys(!1);break;case" ":{if(t.selectedIndexes.length<1&&!t._focusedItem)return;const e=t._focusedItem?t._focusedItem:t._items[t.selectedIndexes[t.selectedIndexes.length-1]],i=e=>{e.selected&&"radioButton"!==t.selectionMode?t.unselect(e):t.select(e)};if("oneOrMany"===t.selectionMode)return void(e.selected&&t.selectedIndexes.length>1?i(e):e.selected||i(e));i(e);break}case"Home":if(0===r.length)return;i||(t._keysPressed.Shift||t.clearSelection(),t.select(r[0])),t._focus(r[0]),t.scrollTop=0;break;case"End":if(0===r.length)return;i||(t._keysPressed.Shift||t.clearSelection(),t.select(r[r.length-1])),t._focus(r[r.length-1]),t.scrollTop=t.scrollHeight;break;case"PageUp":t._pageUpKeyHandler(r);break;case"PageDown":t._pageDownKeyHandler(r)}t._recycle()}}_horizontalScrollbarHandler(e){const t=this;e&&e.stopPropagation&&e.stopPropagation(),t.isVirtualized?t._recycle():t.$.itemsContainer.scrollLeft=t._getScrollLeft(e.detail.value)}_getScrollLeft(e,t){const i=this;if(!i.rightToLeft)return e;if(Smart.Utilities.Core.Browser.Chrome){if(!t){const e=2*(parseInt(getComputedStyle(i.$.itemsInnerContainer).getPropertyValue("--smart-list-item-horizontal-offset"))||0);t=i._scrollWidth-i.$.itemsContainer.offsetWidth-e}e=t-e}else e*=-1;return e}_unsort(){const e=this;e.isUpdating++;const t=function(e,t){let i=e.dataIndex,r=t.dataIndex;return i<r?-1:i>r?1:0};if(e.isVirtualized)if(e._groups.length>0){e._groups.sort(t);let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.items);s.sort(t),i.push(o),i=i.concat(s)}e._items=i}else e._items.sort(t);else{if(e._groups.length>0){e._groups.sort(t);let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.querySelectorAll("smart-list-item"));s.sort(t),i=i.concat(s)}e._items=i}else e._items.sort(t);e._applySortOrder()}e.isUpdating--}_applySortOrder(){const e=function(e){for(let t=0;t<e.length;t++){const i=e[t],r=i.parentNode;r&&r.appendChild(i)}};e(this._items),e(this._groups)}_sort(){const e=this;if(!e._canSort)return;e.isUpdating++;const t=function(t,i){let r=t.label,o=i.label;if("asc"===e.sortDirection){if(r<o)return-1;if(r>o)return 1}else{if(r<o)return 1;if(r>o)return-1}return 0};if(e._groups.sort(t),e.isVirtualized)if(e._groups.length>0){let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.items);i.push(o),s.sort(t),i=i.concat(s)}e._items=i}else e._items.sort(t);else{if(e._groups.length>0){let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.querySelectorAll("smart-list-item"));s.sort(t),i=i.concat(s)}e._items=i}else e._items.sort(t);e._applySortOrder()}e.isUpdating--}getItem(e){const t=this;for(let i=0;i<t._items.length;i++)if(t._items[i].value===e)return t._items[i];return null}_focus(e){const t=this;!e||"none"===t.selectionMode||t.disabled||t.readonly||(t._focusedItem&&(t._focusedItem._focused=!1),t._focusedItem=e,t._focusedItem._focused=!0)}_keyDownHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;let r=e.key;if(e.metaKey&&(r="Control"),!t.disabled&&!t.readonly&&(!t.filterable||t.$.filterInput!==i)&&t._focused&&0!==t._items.length&&!t.disabled&&!t.displayLoadingIndicator){if(t.editable){if("F2"===r)return void t._dblclickEventHandler({target:t._focusedItem});if(t.$.editInput===i)return}if("none"!==t.selectionMode){switch(e.stopPropagation(),r){case"Down":case"Right":case"Left":case"Up":r="Arrow"+r}if(t.filterable)switch(r){case"ArrowLeft":case"ArrowRight":return;case"ArrowUp":case"ArrowDown":e.preventDefault()}if(t._applyIncrementalSearch(r),!(["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control"," ","Home","End","PageUp","PageDown"].indexOf(r)<0))if(e.preventDefault(),!t._focusedItem&&t._items.length>0)"one"===t.selectionMode||"oneOrMany"===t.selectionMode||"oneOrManyExtended"===t.selectionMode?t.select(t._items[0]):t._focus(t._items[0]);else switch(t.selectionMode){case"one":case"zeroAndOne":if("Shift"===r||"Control"===r||" "===r)return;t._handleKeyStrokes(r);break;case"oneOrMany":case"zeroOrOne":case"zeroOrMany":case"radioButton":case"checkBox":if("Shift"===r||"Control"===r)return;t._handleKeyStrokes(r);break;case"oneOrManyExtended":if(" "===r)return;t._keysPressed[r]="keydown"===e.type,t._handleKeyStrokes(r)}}}}_keyUpHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;if(!t.editable||t.$.editInput!==i){if(t.filterable&&t.$.filterInput===i)return t._filterTimer&&clearTimeout(t._filterTimer),void(t._filterTimer=setTimeout((function(){const e=t.context;t.context=t,t._filterItems(),t.scrollTop=t.$.itemsContainer.scrollTop=0,t.scrollLeft=t.$.itemsContainer.scrollLeft=t._getScrollLeft(0),t.context=e}),300));if(t._focused){if(t._focusedItem&&t._focusedItem.hidden&&t._filteredItems.length>0){let e=t._filteredItems[0];e.grouped&&t._filteredItems.length>1&&(e=t._filteredItems[1]),t._focus(e),t._recycle()}e.stopPropagation(),e.preventDefault(),t.disabled||("Escape"===e.key&&Smart.ListBox.DragDrop.Dragging&&t._cancelDrag(),["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control"," ","PageUp","PageDown"].indexOf(e.key)<0||(t._keysPressed[e.key]=!1))}}}_cancelDrag(){if(!Smart.ListBox.DragDrop.Dragging)return;Smart.ListBox.DragDrop.Feedback.parentNode&&Smart.ListBox.DragDrop.Feedback.parentNode.removeChild(Smart.ListBox.DragDrop.Feedback);const e=Smart.ListBox.DragDrop.Item,t=e.ownerListBox;if(t.$.fireEvent("dragCancel",{item:e,data:Smart.ListBox.DragDrop,container:t,previousContainer:t}),Smart.ListBox.DragDrop.Feedback=null,Smart.ListBox.DragDrop.DropDetails){let e=Smart.ListBox.DragDrop.DropDetails.item;e&&(e.$.removeClass("smart-list-item-line-feedback"),e.$.removeClass("smart-list-item-bottom-line-feedback"))}document.body.classList.remove("smart-dragging"),delete Smart.ListBox.DragDrop.DraggedFrom,Smart.ListBox.DragDrop.Dragging=!1,Smart.ListBox.DragDrop.Item=null,Smart.ListBox.DragDrop.DropDetails=null}_mouseWheelHandler(e){const t=this;if((t.computedHorizontalScrollBarVisibility||t.computedVerticalScrollBarVisibility)&&!t.disabled&&t.computedVerticalScrollBarVisibility){const i=t.scrollTop;if(0===i&&e.deltaY<0||i===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault(),t.scrollTo(i+t._getScrollCoefficient(e,t.offsetHeight))}}_pageDownKeyHandler(e){const t=this;if(0===e.length)return;let i,r=t._items[t.selectedIndexes[t.selectedIndexes.length-1]];if("checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._focusedItem&&(r=t._focusedItem),!r)return;const o=t._indexOf(r);let s=r.top+t.$.itemsContainer.offsetHeight-r.height;for(let t=o;t<e.length;t++)if(e[t].top>=s){i=e[t];break}i||(i=e[e.length-1]),"checkBox"===t.selectionMode||"radioButton"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode?t._focus(i):i.selected||(t._keysPressed.Shift||t.clearSelection(),t.select(i),t._focus(i)),(i.height+i.top>t.$.itemsContainer.scrollTop+t.$.itemsContainer.offsetHeight||i.top<t.$.itemsContainer.scrollTop)&&(t.scrollTop=i.top-t.$.itemsContainer.offsetHeight+i.height)}_pageUpKeyHandler(e){const t=this;if(0===e.length)return;let i=t._items[t.selectedIndexes[t.selectedIndexes.length-1]];if("checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._focusedItem&&(i=t._focusedItem),!i)return;const r=i.top-t.$.itemsContainer.offsetHeight;let o;for(let s=t._indexOf(i);s>0;s--)if(e[s].top<=r){o=e[s];break}o||(o=e[0]),"checkBox"===t.selectionMode||"radioButton"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode?t._focus(o):o.selected||(t._keysPressed.Shift||t.clearSelection(),t.select(o),t._focus(o)),t.scrollTop=o.top,0===t._indexOf(o)&&(t.scrollTop=0)}clearItems(){const e=this;e.clearSelection(),e.$.itemsInnerContainer.innerHTML="",e._items=[],delete e._focusedItem,e.$placeholder.removeClass("smart-hidden"),e.refresh()}_resizeHandler(e){this.refresh(e)}refresh(e){const t=this;if(!e&&!t._isUpdatingScrollBars&&t.isInitialized)return t._isUpdatingScrollBars=!0,t._initializeRecyclingItems(),t._refreshLayout(),void(t._isUpdatingScrollBars=!1);e&&e.target===t&&!t._isUpdatingScrollBars&&(t._isUpdatingScrollBars=!0,t._initializeRecyclingItems(),t._refreshLayout(),t._isUpdatingScrollBars=!1)}_indexOf(e){const t=this;if(!e)return-1;let i=t._items.indexOf(e);return-1===i&&(i=t._items.indexOf(t.getItem(e.value))),i}_incrementalSearch(){const e=this,t="radioButton"!==e.selectionMode&&"checkBox"!==e.selectionMode&&"zeroOrMany"!==e.selectionMode&&"oneOrMany"!==e.selectionMode&&"zeroOrOne"!==e.selectionMode;let i,r=0;switch(e.incrementalSearchMode){case"containsIgnoreCase":case"equalsIgnoreCase":case"startsWithIgnoreCase":case"endsWithIgnoreCase":i=e._incrementalSearchQuery.toLowerCase();break;default:i=e._incrementalSearchQuery}const o=function(i){i.grouped||i.readonly||(t?(e.selectedIndexes.length>0&&e.clearSelection(),e._focus(i),e.select(i)):e._focus(i),(i.height+i.top>e.$.itemsContainer.scrollTop+e.$.itemsContainer.offsetHeight||i.top<e.scrollTop)&&(e.scrollTop=i.top),0===e._indexOf(i)&&(e.scrollTop=0),e._indexOf(i)===e._items.length-1&&(e.scrollTop=e.scrollHeight))};0!==e._previousEntry.localeCompare(i)&&(e._incrementalSearchItems=e._queryItems(e._incrementalSearchQuery,e.incrementalSearchMode),delete e._itemPosition),e._previousEntry=i;const s=e._incrementalSearchItems.length;if(0!==s)if(1!==s)for(void 0!==e._itemPosition?e._itemPosition<s-1?r=e._itemPosition:(r=0,t?(e._incrementalSearchItems[e._itemPosition].selected=!1,e.selectedIndexes=[],e.selectedValues=[]):e._incrementalSearchItems[e._itemPosition]._focused=!1):t&&e.clearSelection();r<s;r++)if(e._incrementalSearchItems[r].selected&&t)e._incrementalSearchItems[r].selected=!1,e.selectedIndexes=[],e.selectedValues=[];else{if(t||!e._incrementalSearchItems[r]._focused)return o(e._incrementalSearchItems[r]),void(e._itemPosition=r);e._incrementalSearchItems[r]._focused=!1}else o(e._incrementalSearchItems[0])}_selectStartHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement;t.$.filterInput!==i&&t.$.editInput!==i&&e.preventDefault()}_handleArrowKeys(e){const t=this,i="radioButton"!==t.selectionMode&&"checkBox"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode;if(t.disabled||t.readonly)return;let r;if(t._focusedItem&&!t._keysPressed.Shift)r=t._indexOf(t._focusedItem),t._focusedItem._focused=!1;else{if(0===t.selectedIndexes.length)return;r=t.selectedIndexes[t.selectedIndexes.length-1]}const o=e?t._getPreviousItem(r):t._getNextItem(r);t._focus(o),i&&(t._keysPressed.Shift?t.select(o):t._items[r]!==o&&(t.clearSelection(),t.select(o))),t.ensureVisible(o)}_refreshFilter(){const e=this;if(e.filterable)return e.$.filterInput.disabled=!(!e.disabled&&!e.displayLoadingIndicator),e.$filterInputContainer.removeClass("smart-hidden"),void e.$itemsContainer.addClass("filter");e.$.filterInput.disabled=!0,e.$filterInputContainer.addClass("smart-hidden"),e.$itemsContainer.removeClass("filter")}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.tabIndex>0?e.tabIndex:0}_setLoadingIndicatorVisibility(){const e=this;e.displayLoadingIndicator?e.$loadingIndicatorContainer.hasClass("smart-visibility-hidden")?e.$loadingIndicatorContainer.removeClass("smart-visibility-hidden"):e.$loadingIndicatorContainer.removeClass("smart-hidden"):e._areCSSVarsSupported?e.$loadingIndicatorContainer.addClass("smart-hidden"):e.$loadingIndicatorContainer.addClass("smart-visibility-hidden")}_refreshLayout(){const e=this,t=e._filteredItems||e._items;if(e.__scrollHeight=null,e.__scrollWidth=null,e._height=null,e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.$itemsContainer.removeClass("hscroll"),e.$itemsContainer.removeClass("vscroll"),!t||null===t||0===t.length)return e.scrollWidth=0,e.scrollHeight=0,e.$filterInputContainer.removeClass("vscroll"),e.$placeholder.removeClass("smart-hidden"),e.isVirtualized&&e._recycle(),void(e.$.itemsInnerContainer.style.width="");e.$placeholder.addClass("smart-hidden");const i=2*(parseInt(getComputedStyle(e.$.itemsContainer).getPropertyValue("--smart-list-item-horizontal-offset"))||0);let r=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,o=e._scrollHeight;if(e._refreshHorizontalScrollBarVisibility(r),e._refreshVerticalScrollBarVisibility(o),e.$.itemsInnerContainer.style.width="","hidden"===e.horizontalScrollBarVisibility?e.$.itemsInnerContainer.style.width=e.$.itemsContainer.offsetWidth-i:e.$.itemsInnerContainer.style.width=Math.max(e.$.itemsContainer.offsetWidth-i,-i+e.__scrollWidth)+"px",e.computedVerticalScrollBarVisibility)return r=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,e._refreshHorizontalScrollBarVisibility(r),"hidden"!==e.horizontalScrollBarVisibility&&(e.$.itemsInnerContainer.style.width="",e.$.itemsInnerContainer.style.width=Math.max(e.$.itemsContainer.offsetWidth-i,-i+e.__scrollWidth)+"px"),e.computedHorizontalScrollBarVisibility&&(("visible"!==e.horizontalScrollBarVisibility||0!==e.scrollWidth||"visible"===e.horizontalScrollBarVisibility)&&(e.__scrollHeight+=e._scrollView.hScrollBar.offsetHeight),e.scrollHeight=e.__scrollHeight,e._scrollView.hScrollBar.$.hasClass("bottom-corner")&&e._scrollView.hScrollBar.refresh()),void(e.isVirtualized&&e._recycle());r=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,e._refreshHorizontalScrollBarVisibility(r),e.computedHorizontalScrollBarVisibility&&(e.scrollHeight=e._scrollHeight,e._refreshVerticalScrollBarVisibility(e.scrollHeight),e.computedVerticalScrollBarVisibility&&(r=e._scrollWidth-e.$.itemsContainer.offsetWidth-e._scrollView.vScrollBar.offsetWidth,e._refreshHorizontalScrollBarVisibility(r)),e._scrollView.vScrollBar.$.hasClass("bottom-corner")&&e._scrollView.vScrollBar.refresh(),e._scrollView.hScrollBar.$.hasClass("bottom-corner")&&e._scrollView.hScrollBar.refresh()),e.isVirtualized&&e._recycle();const s=/Trident|Edge/.test(navigator.userAgent);!e.isRefreshing&&s&&setTimeout((function(){e.isRefreshing=!0,e._refreshLayout(),e.isRefreshing=!1}),50)}_styleChangedHandler(){this._refreshLayout()}_swipeLeftHandler(){}_swipeRightHandler(){}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility?(t.scrollLeft=t._getScrollLeft(t.$.itemsContainer.scrollLeft,e),t.$itemsContainer.addClass("hscroll")):t.$itemsContainer.removeClass("hscroll")}_refreshVerticalScrollBarVisibility(e){const t=this;t.scrollHeight=e,t.computedVerticalScrollBarVisibility?(t.$itemsContainer.addClass("vscroll"),t.$filterInputContainer.addClass("vscroll")):(t.$itemsContainer.removeClass("vscroll"),t.$filterInputContainer.removeClass("vscroll"))}_validateTemplate(e,t){if(null===t||!t)return;const i=this;return"content"in document.createElement("template")?null!==(t=document.getElementById(t))&&"content"in t?t:(i.error(i.localize("invalidTemplate",{elementType:i.nodeName.toLowerCase(),property:e})),void(i[e]=null)):(i.error(i.localize("htmlTemplateNotSuported",{elementType:i.nodeName.toLowerCase()})),void(i[e]=null))}_getItemIndexByPosition(e){const t=this;return(i=>{let r=0,o=i.length-1;if(e<=0)return 0;if(i[i.length-1].top<=e)return i.length-1;for(;;){const s=Math.floor((r+o)/2),n=i[s];if(t._isItemInPosition(n,e))return s;n.top<e?r=s+1:n.top>e&&(o=s-1)}})(t.filterable&&t.$.filterInput.value.length>0?t._filteredItems:t._items)}_isItemInPosition(e,t){const i=e.top,r=e.top+e.height;return i<=t&&r>t}get isVirtualized(){const e=this;return e.virtualized&&e.dataSource&&e.dataSource.length>0}_recycle(){const e=this;if(!e._recyclingItems)return;let t=e._height;e._height||(t=e._height=e.$.itemsContainer.offsetHeight);let i=0;const r=e.scrollTop,o=e._getItemIndexByPosition(r),s=e.filterable&&e.$.filterInput.value.length>0?e._filteredItems:e._items,n=s[o];let l=n?n.top:0;if(e.$.itemsInnerContainer.style.left=-e.scrollLeft+"px",e.$.itemsInnerContainer.style.top=-r+l+"px",e.isUpdating++,o>=0){const n=s.length;for(let a=o;a<n;a++){const o=s[a];if(0!==o.height){if(!(l+o.height>=r&&l<=r+t))break;{const t=e._recyclingItems[i++];if(!t)break;t.setAttribute("aria-setsize",n),t.setAttribute("aria-posinset",a),t.context=document,t.dataItem=o,t.label=o.label,t.value=o.value,t.selected=o.selected,t._focused=o._focused,t.hidden=o.hidden,t.grouped=o.grouped,t.readonly=o.readonly,t.style.height=o.height+"px",e._alternateItem(t),o.title?t.title=o.title:t.title="",o.grouped?t.displayMode="plain":t.displayMode=o.displayMode,e.scrollWidth>0&&(t.style.width=e.$.itemsInnerContainer.offsetWidth+e.scrollWidth+"px"),e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&e._applyTemplate(t,!1)}l+=o.height}}}if(i<e._recyclingItems.length)for(let t=i;t<e._recyclingItems.length;t++){const t=e._recyclingItems[i++],r=t.context;t.context=document,t.hidden=!0,t.context=r}e.isUpdating--}_verticalScrollbarHandler(e){const t=this,i=e.detail.value;e&&e.stopPropagation&&e.stopPropagation(),t.isVirtualized?t._recycle():t.$.itemsContainer.scrollTop=i,t._updateTopVisibleIndex(),e.context.max!==e.context.value?e.context.min===e.context.value&&t.$.fireEvent("scrollTopReached"):t.$.fireEvent("scrollBottomReached")}_applyAriaSelected(){const e=this,t=e.isVirtualized?e._recyclingItems:e._items,i=e.selectionMode;for(let e=0;e<t.length;e++){const r=t[e];r.selected?r.setAttribute("aria-selected",!0):r.readonly||r.disabled||-1===["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox"].indexOf(i)?r.removeAttribute("aria-selected"):r.setAttribute("aria-selected",!1)}}});
85
85
  Smart("smart-map",class extends Smart.BaseElement{static get properties(){return{apiKey:{type:"string",value:""},query:{type:"string",value:"sofia"},mode:{allowedTypes:["place","search","view","directions","streetview"],type:"string",value:"place"},mapType:{allowedTypes:["roadmap","satellite","hybrid","terrain"],value:"",type:"string"},heading:{type:"string",value:"210"},pitch:{type:"string",value:"10"},terrain:{type:"string",value:"terrain"},zoom:{type:"string",value:"12"}}}static get styleUrls(){return["smart.map.css"]}template(){return'<div id=mapId><iframe width="100%" height="100%" id="map" mode=\'[[mode]]\' class="smart-map-container" api-key=\'apiKey\' map-type=\'[[mapType]]\' query=\'[[query]]\' frameborder="0" alllowfullscreen aria-hidden="false" tabindex="0"> </iframe></div>'}render(){const e=this;if("roadmap"===e.$.map.mapType||"satellite"===e.mapType)return e.$.map.src="https://www.google.com/maps/embed/v1/"+e.mode+"?key="+e.apiKey+"&maptype="+e.mapType+"&q="+e.query,void super.render();if("streetview"===e.$.map.mode){const a=e.query;let t,r;window.initMap=function(){(new window.google.maps.Geocoder).geocode({address:a},(function(a,o){return o===window.google.maps.GeocoderStatus.OK?(t=a[0].geometry.location.lat(),r=a[0].geometry.location.lng()):console.error("Loading the map was not successful for the following reason: "+o),e.$.map.src="https://www.google.com/maps/embed/v1/"+e.mode+"?key="+e.apiKey+"&location="+t+","+r+"&heading="+e.heading+"&pitch="+e.pitch+"&fov=35"}))};const o=document.createElement("script");o.type="text/javascript",o.src="https://maps.googleapis.com/maps/api/js?key="+e.apiKey+"&callback=initMap&libraries=&v=weekly",o.defer=!0,document.body.appendChild(o)}if("terrain"===e.$.map.mapType){const o=e.query;var a,t,r;if(window.initTerrainMap=function(){(new window.google.maps.Geocoder).geocode({address:o},(function(o,n){if(n===window.google.maps.GeocoderStatus.OK){a=o[0].geometry.location.lat(),t=o[0].geometry.location.lng(),r=new window.google.maps.LatLng(a,t),e.querySelectorAll(".smart-container").length;const n=new window.google.maps.Map(e.querySelectorAll(".smart-container")[0],{zoom:parseInt(e.zoom),center:r,mapTypeId:"terrain"});new window.google.maps.Marker({position:r,map:n})}else console.error("Loading the map was not successful for the following reason: "+n)}))},e.querySelectorAll(".smart-container").length<2){const a=document.createElement("script");a.type="text/javascript",a.src="https://maps.googleapis.com/maps/api/js?key="+e.apiKey+"&callback=initTerrainMap",a.defer=!0,document.head.appendChild(a)}}super.render()}propertyChangedHandler(e,a,t){super.propertyChangedHandler(e,a,t),this.render()}});
86
86
  Smart("smart-numeric-text-box",class extends Smart.BaseElement{static get properties(){return{decimalSeparator:{value:".",type:"string"},dropDownAppendTo:{value:null,type:"any"},enableMouseWheelAction:{value:!1,type:"boolean"},inputFormat:{value:"integer",allowedValues:["integer","floatingPoint","complex"],type:"string"},hint:{value:"",type:"string"},label:{value:"",type:"string"},leadingZeros:{value:!1,type:"boolean"},max:{value:null,type:"any"},messages:{value:{en:{binary:"BIN",octal:"OCT",decimal:"DEC",hexadecimal:"HEX",integerOnly:"smartNumericTextBox: The property {{property}} can only be set when inputFormat is integer.",noInteger:"smartNumericTextBox: the property {{property}} cannot be set when inputFormat is integer.",significantPrecisionDigits:"smartNumericTextBox: the properties significantDigits and precisionDigits cannot be set at the same time."}},type:"object",extend:!0},min:{value:null,type:"any"},name:{value:"",type:"string"},nullable:{value:!1,type:"boolean"},opened:{value:!1,type:"boolean"},outputFormatString:{value:null,type:"string?"},placeholder:{value:"",type:"string"},dropDownEnabled:{value:!1,type:"boolean"},precisionDigits:{value:null,type:"number?"},radix:{value:10,allowedValues:["2","8","10","16",2,8,10,16,"binary","octal","decimal","hexadecimal"],type:"any"},radixDisplay:{value:!1,type:"boolean"},radixDisplayPosition:{value:"left",allowedValues:["left","right"],type:"string"},scientificNotation:{value:!1,type:"boolean"},showDropDownValues:{value:!1,type:"boolean"},showUnit:{value:!1,type:"boolean"},significantDigits:{value:null,type:"number?"},spinButtons:{value:!1,type:"boolean"},spinButtonsDelay:{value:75,type:"number"},spinButtonsInitialDelay:{value:0,type:"number"},spinButtonsPosition:{value:"right",allowedValues:["left","right"],type:"string"},spinButtonsStep:{value:"1",type:"any"},type:{value:"numeric",type:"string",defaultReflectToAttribute:!0,readonly:!0},unit:{value:"kg",type:"string"},validation:{value:"strict",allowedValues:["strict","interaction"],type:"string"},value:{value:"0",type:"any?"},wordLength:{value:"int32",allowedValues:["int8","uint8","int16","uint16","int32","uint32","int64","uint64"],type:"string"}}}static get listeners(){return{mouseenter:"_mouseenterMouseleaveHandler",mouseleave:"_mouseenterMouseleaveHandler",resize:"_resizeHandler","downButton.click":"_downButtonClickHandler","downButton.mouseenter":"_mouseenterMouseleaveHandler","downButton.mouseleave":"_mouseenterMouseleaveHandler","dropDown.click":"_dropDownItemClickHandler","dropDown.mouseout":"_mouseenterMouseleaveHandler","dropDown.mouseover":"_mouseenterMouseleaveHandler","input.blur":"_inputBlurHandler","input.change":"_inputChangeHandler","input.focus":"_inputFocusHandler","input.keydown":"_inputKeydownHandler","input.keyup":"_inputKeyupHandler","input.paste":"_inputPasteHandler","input.wheel":"_inputWheelHandler","radixDisplayButton.click":"_radixDisplayButtonClickHandler","radixDisplayButton.mouseenter":"_mouseenterMouseleaveHandler","radixDisplayButton.mouseleave":"_mouseenterMouseleaveHandler","upButton.click":"_upButtonClickHandler","upButton.mouseenter":"_mouseenterMouseleaveHandler","upButton.mouseleave":"_mouseenterMouseleaveHandler","document.down":"_documentMousedownHandler","document.up":"_documentMouseupHandler"}}static get requires(){return window.NIComplex?{"Smart.Button":"smart.button.js","Smart.Utilities.BigNumber":"smart.math.js","Smart.Utilities.NumericProcessor":"smart.numeric.js"}:{"Smart.Button":"smart.button.js","Smart.Utilities.Complex":"smart.complex.js","Smart.Utilities.BigNumber":"smart.math.js","Smart.Utilities.NumericProcessor":"smart.numeric.js"}}static get styleUrls(){return["smart.button.css","smart.numerictextbox.css"]}template(){return'<div id="container" class="smart-container" role="presentation">\n <span id="label" inner-h-t-m-l="[[label]]" class="smart-label"></span>\n <div id="radixDisplayButton" class="smart-unselectable smart-input-addon smart-drop-down-button smart-numeric-text-box-component smart-numeric-text-box-radix-display" role="button" aria-haspopup="listbox"></div>\n <input id="input" type="text" spellcheck="false" class="smart-input smart-numeric-text-box-component" placeholder="[[placeholder]]" readonly="[[readonly]]" disabled="[[disabled]]" name="[[name]]" aria-label="[[placeholder]]" />\n <div id="unitDisplay" class="smart-unselectable smart-input-addon smart-drop-down-button smart-numeric-text-box-component smart-numeric-text-box-unit-display" role="presentation"></div>\n <div id="spinButtonsContainer" class="smart-input-addon smart-numeric-text-box-component smart-spin-buttons-container" role="presentation">\n <smart-repeat-button initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" animation="[[animation]]" unfocusable id="upButton" class="smart-spin-button" aria-label="Increment" right-to-left="[[rightToLeft]]">\n <div class="smart-arrow smart-arrow-up" role="presentation" aria-hidden="true"></div>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" animation="[[animation]]" unfocusable id="downButton" class="smart-spin-button" aria-label="Decrement" right-to-left="[[rightToLeft]]">\n <div class="smart-arrow smart-arrow-down" role="presentation" aria-hidden="true"></div>\n </smart-repeat-button>\n </div>\n <ul id="dropDown" class="smart-visibility-hidden smart-drop-down smart-numeric-text-box-drop-down" role="listbox">\n <li id="dropDownItem2" class="smart-list-item" data-value="2" role="option"></li>\n <li id="dropDownItem8" class="smart-list-item" data-value="8" role="option"></li>\n <li id="dropDownItem10" class="smart-list-item" data-value="10" role="option"></li>\n <li id="dropDownItem16" class="smart-list-item" data-value="16" role="option"></li>\n </ul>\n <span id="hint" class="smart-hint smart-hidden" inner-h-t-m-l="[[hint]]"></span>\n </div>'}attached(){const e=this;super.attached(),e.isCompleted&&(e._positionDetection.dropDownAttached(),e._positionDetection.checkBrowserBounds())}detached(){const e=this;super.detached(),e.opened&&e._closeRadix(!0),e._positionDetection&&e._positionDetection.dropDownDetached()}ready(){super.ready()}render(){const e=this;e._numericProcessor=new Smart.Utilities.NumericProcessor(e,"inputFormat"),e._numberRenderer=new Smart.Utilities.NumberRenderer,e._numberRenderer.localizationObject.decimalseparator=e.decimalSeparator,e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDown,e.$.container,"_closeRadix"),e._positionDetection.getDropDownParent(!0),e._dropDownListPosition="bottom",e.rightToLeft&&(e.spinButtonsPosition="right"===e.spinButtonsPosition?"left":"right"),e._setIds(),e.setAttribute("aria-describedby",e.$.unitDisplay.id+" "+e.$.hint.id),e.getAttribute("aria-labelledby")||e.setAttribute("aria-labelledby",e.$.label.id),e.$.radixDisplayButton.setAttribute("aria-owns",e.$.dropDown.id),e.rightToLeft&&null!==e.dropDownAppendTo&&e.$.dropDown.setAttribute("right-to-left",""),e._radixPrefixes={10:"d",2:"b",8:"o",16:"x"},e._regex={2:new RegExp(/^[0-1]+$/),8:new RegExp(/^[0-7]+$/),10:new RegExp(/^[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?$/),16:new RegExp(/^[0-9a-f]+$/i)},e._regexSpecial={nan:new RegExp(/^(nan)$/i),inf:new RegExp(/^((-?inf(inity)?)|([+\-]?∞))$/i),nonNumericValue:new RegExp(/^$|(^((nan)|((-?inf(inity)?)|([+\-]?∞))|(null))$)/i),exaValue:new RegExp(/^[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[E])([+\-]\d*)?i$/)},e._initialDropDownOptionsSet=!1,"left"===e.spinButtonsPosition&&e.$.container.insertBefore(e.$.spinButtonsContainer,e.$.label.nextElementSibling),"right"===e.radixDisplayPosition&&e.$.container.insertBefore(e.$.radixDisplayButton,e.$.unitDisplay.nextElementSibling),e._setInitialComponentDisplay(),e._initialAdjustments(),e._refreshShape(),e._initialized=!0,super.render()}_setIds(){const e=this;e.$.label.id||(e.$.label.id=e.id+"Label"),e.$.radixDisplayButton.id||(e.$.radixDisplayButton.id=e.id+"RadixDisplayButton"),e.$.unitDisplay.id||(e.$.unitDisplay.id=e.id+"UnitDisplay"),e.$.dropDown.id||(e.$.dropDown.id=e.id+"DropDown"),e.$.hint.id||(e.$.hint.id=e.id+"Hint")}_refreshShape(){const e=this.$.container.querySelectorAll(".smart-numeric-text-box-component:not(.smart-hidden)");Array.from(this.$.container.getElementsByClassName("smart-numeric-text-box-component")).forEach((e=>e.classList.remove("smart-numeric-text-box-component-border-left","smart-numeric-text-box-component-border-right"))),e.length>0&&(e[0].classList.add("smart-numeric-text-box-component-border-left"),e[e.length-1].classList.add("smart-numeric-text-box-component-border-right"))}val(e,t){const n=this,i=null!==e&&"object"==typeof e&&0===Object.keys(e).length;if(void 0===e||!1!==i)return n.value;{const i=n.value;if((""===e||null===e)&&null===i)return null;if(null===e)return n._triggerChangeEvent="strict"===n.validation,n._validate(!1,null),n._triggerChangeEvent=!1,void(n._programmaticValueIsSet=!0);if((e=e.toString()).toUpperCase()===i.toString().toUpperCase())return e;void 0===t?(n._triggerChangeEvent="strict"===n.validation,n._validate(!1,e),n._triggerChangeEvent=!1):n._setValue(e),n._programmaticValueIsSet=!0}}focus(){this.$.input.focus()}_updateSpinButtonsStepObject(){const e=this;e._spinButtonsStepObject=e._numericProcessor.createDescriptor(e.spinButtonsStep,!0)}_setInitialComponentDisplay(){const e=this;!1===e.spinButtons&&e.$spinButtonsContainer.addClass("smart-hidden"),!1===e.radixDisplay&&e.$radixDisplayButton.addClass("smart-hidden"),!1===e.showUnit&&e.$unitDisplay.addClass("smart-hidden")}_initialAdjustments(){const e=this;e._radixNumber=e._getRadix(e.radix),e._wordLengthNumber=e._numericProcessor.getWordLength(e.wordLength),e._validatePropertyCompatibility(),e._numericProcessor.validateMinMax(!0,!0),e._updateSpinButtonsStepObject(),e._validate(!0),e._programmaticValueIsSet=!0,e._cachedInputValue=e.$.input.value,void 0===e._editableValue&&(e._editableValue=e._cachedInputValue),e.$.radixDisplayButton.innerHTML=e._radixPrefixes[e._radixNumber],e.$.unitDisplay.innerHTML=e.unit,e.disabled&&(e.$.upButton.disabled=!0,e.$.downButton.disabled=!0),e.opened&&(e.dropDownEnabled&&!e.disabled&&null!==e.value?e._openRadix():e.opened=!1),e.$.radixDisplayButton.setAttribute("aria-expanded",e.opened),e._setFocusable()}_validatePropertyCompatibility(){const e=this;"integer"!==e.inputFormat?(10!==e._radixNumber&&e.error(e.localize("integerOnly",{property:"radix"})),e.radixDisplay&&e.error(e.localize("integerOnly",{property:"radixDisplay"})),e.dropDownEnabled&&e.error(e.localize("integerOnly",{property:"dropDownEnabled"})),"int32"!==e.wordLength&&e.error(e.localize("integerOnly",{property:"wordLength"}))):null!==e.precisionDigits&&e.error(e.localize("noInteger",{property:"precisionDigits"})),null===e.significantDigits&&null===e.precisionDigits?e.significantDigits=8:null!==e.significantDigits&&null!==e.precisionDigits&&e.error(e.localize("significantPrecisionDigits"))}_validate(e,t){const n=this;let i;if(e)i=n.value,void 0===i&&(i=n.nullable?null:"0");else if(void 0===t||null===t&&!n.nullable){if(i=n.$.input.value,i===n.value&&!0!==n._programmaticValueIsSet)return void(n.$.input.value=n._cachedInputValue)}else i=t;if(n.nullable&&(null===i||""===i))return n.value=null,n._number=null,n.$.input.value="",n._cachedInputValue="",n._editableValue="",void n._disableComponents();const a=n._numericProcessor.prepareForValidation(e,t,i);if(void 0===a)return void n._disableComponents();const r=n._numericProcessor.createDescriptor(a.value,!0,!0,!e&&void 0===t||"strict"===n.validation,e||void 0!==t,a.enteredComplexNumber);if(e){n._number=r;let e=n._renderValue(r);n.value=r.toString(),n.$.input.value=e}else n._updateValue(r);n._programmaticValueIsSet=!1,n._disableComponents()}_handleNonNumericValue(e,t,n){const i=this;if("integer"!==i.inputFormat){if(i._regexSpecial.nan.test(n))return void i._handleNaN(e);if(i._regexSpecial.inf.test(n))return void i._handleInfinity(e,t,n)}if(e){let e=i._numericProcessor.createDescriptor(0);i._number=i._validateRange(e);const t=i._renderValue(i._number);i.value=i._number.toString(),i.$.input.value=t}else if(void 0===t)i.$.input.value=i._cachedInputValue;else{const e=i._number.toString();i.value!==e&&(i.value=e)}}_handleNaN(e){const t=this;if(t.$.input.value="NaN",e)t.value=NaN,t._number=NaN;else{const e=t.value;null!==e&&"NaN"===e.toString()||(t.value=NaN,t._number=NaN,t._cachedInputValue="NaN",t._editableValue="NaN",t._triggerChangeEvent&&(t.$.fireEvent("change",{value:NaN,oldValue:e,radix:t._radixNumber}),t._updateTargetValue()))}}_handleInfinity(e,t,n){const i=this;let a,r;if("-"===n.charAt(0)?(a="∞"===n.charAt(1)?"-∞":"-Inf",r=-1/0):(a=-1!==n.indexOf("∞")?"∞":"Inf",r=1/0),r===-1/0&&i.min===-1/0||r===1/0&&i.max===1/0||void 0!==t)if(e)i.value=r,i._number=r,i.$.input.value=a;else{const e=i.value;n!==a&&(i.$.input.value=a),e!==r&&(i.value=r,i._number=r,i._cachedInputValue=a,i._editableValue=a,i._triggerChangeEvent&&(i.$.fireEvent("change",{value:r,oldValue:e,radix:i._radixNumber}),i._updateTargetValue()))}else r===-1/0?i._validate(!1,i.min):i._validate(!1,i.max)}_updateTargetValue(e){const t=this;if(t.dataset.target){const n=document.querySelector(t.dataset.target);if(n){const i=t.dataset.property,a=t.value;i&&void 0!==n[i]&&(n[i]=void 0!==e?e:a)}}}_validateRange(e){const t=this;return e=t._numericProcessor.validate(e,t._minObject,t._maxObject)}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const i=this,a=i.$.input;function r(){!0===i._initialDropDownOptionsSet&&i._setDropDownOptions(!0),2!==i._radixNumber&&16!==i._radixNumber||(i._cachedInputValue=i._number.toString(i._radixNumber,i._wordLengthNumber,i.leadingZeros),i._editableValue=i._cachedInputValue,i.$.input.value=i._cachedInputValue)}if(n!=t)switch(e){case"disabled":i._setFocusable(),!0===n?(i.$.upButton.disabled=!0,i.$.downButton.disabled=!0):i._disableComponents();break;case"dropDownAppendTo":i._positionDetection.dropDownAppendToChangedHandler(),i.$.dropDown.removeAttribute("right-to-left"),i.rightToLeft&&null!==n&&i.$.dropDown.setAttribute("right-to-left","");break;case"unfocusable":i._setFocusable();break;case"enableMouseWheelAction":case"placeholder":case"readonly":case"spinButtonsDelay":case"spinButtonsInitialDelay":break;case"value":{if(""===n&&null===t)return;if(null===n||""===n||null===t)return i.value=t,i._triggerChangeEvent="strict"===i.validation,i._validate(!1,n),i._triggerChangeEvent=!1,void(i._programmaticValueIsSet=!0);const e=n.toString(),a=t.toString();a!==e&&(a.toUpperCase()===e.toUpperCase()&&(i.value=t),i._triggerChangeEvent="strict"===i.validation,i._validate(!1,e),i._triggerChangeEvent=!1,i._programmaticValueIsSet=!0);break}case"radix":"integer"===i.inputFormat?i._changeRadix(n):i.error(i.localize("integerOnly",{property:"radix"}));break;case"rightToLeft":null!==i.dropDownAppendTo&&(n?i.$.dropDown.setAttribute("right-to-left",""):i.$.dropDown.removeAttribute("right-to-left")),i.spinButtonsPosition=i.rightToLeft?"left":"right","left"===i.spinButtonsPosition?i.$.container.insertBefore(i.$.spinButtonsContainer,i.$.label.nextElementSibling):i.$.container.insertBefore(i.$.spinButtonsContainer,i.$.dropDown),i._refreshShape();break;case"leadingZeros":"integer"===i.inputFormat&&null!==i._number&&r();break;case"min":case"max":if(null!==n&&(i[`_${e}IsNull`]=!1),i._numericProcessor.validateMinMax("min"===e,"max"===e),"strict"===i.validation)i._triggerChangeEvent=!0,i._validate(!1,i.value),i._triggerChangeEvent=!1;else if(!1===i._regexSpecial.nonNumericValue.test(i.value)){const e=i._numericProcessor.createDescriptor(i._number),t=i._validateRange(e);!0===i._numericProcessor.compare(i.value,t)&&(i._programmaticValueIsSet=!0)}break;case"opened":n?i.dropDownEnabled&&!i.disabled&&null!==i.value?i._openRadix():(i.opened=!1,i.$.radixDisplayButton.setAttribute("aria-expanded",!1)):i._closeRadix(!1,!0);break;case"outputFormatString":n?(i._cachedInputValue=i._numberRenderer.formatNumber(i._number,n),i.$.input.value=i._cachedInputValue):(i._cachedInputValue=i._editableValue,i.$.input.value=i._editableValue);break;case"dropDownEnabled":n?("integer"!==i.inputFormat&&i.error(i.localize("integerOnly",{property:"dropDownEnabled"})),!0===i._initialDropDownOptionsSet&&i._setDropDownOptions(!0)):i.opened&&i._closeRadix(!0);break;case"spinButtons":n?i.$spinButtonsContainer.removeClass("smart-hidden"):i.$spinButtonsContainer.addClass("smart-hidden"),i._refreshShape();break;case"spinButtonsStep":i._updateSpinButtonsStepObject();break;case"significantDigits":case"precisionDigits":if("precisionDigits"===e&&"integer"===i.inputFormat&&i.error(i.localize("noInteger",{property:e})),"significantDigits"===e&&null!==i.precisionDigits?i.precisionDigits=null:"precisionDigits"===e&&null!==i.significantDigits&&(i.significantDigits=null),!1===i._regexSpecial.nonNumericValue.test(i.value)){const e=i._renderValue(i._number);a.value=e}break;case"decimalSeparator":{i._numberRenderer.localizationObject.decimalseparator=i.decimalSeparator;const e=i._discardDecimalSeparator(a.value,t),n=i._applyDecimalSeparator(e),r=i._applyDecimalSeparator(i._discardDecimalSeparator(i._editableValue,t));a.value=n,i._editableValue=r;break}case"spinButtonsPosition":"left"===n?i.$.container.insertBefore(i.$.spinButtonsContainer,i.$.label.nextElementSibling):i.$.container.insertBefore(i.$.spinButtonsContainer,i.$.dropDown),i._refreshShape();break;case"wordLength":if(i._wordLengthNumber=i._numericProcessor.getWordLength(n),"integer"===i.inputFormat&&(i._numericProcessor.validateMinMax(!0,!0),null!==i._number)){let e=i._validateRange(new Smart.Utilities.BigNumber(i._number));i._updateValue(e),i.leadingZeros&&r()}break;case"radixDisplay":n?("integer"!==i.inputFormat&&i.error(i.localize("integerOnly",{property:"radixDisplay"})),i.$radixDisplayButton.removeClass("smart-hidden")):i.$radixDisplayButton.addClass("smart-hidden"),i._refreshShape();break;case"radixDisplayPosition":"left"===n?i.$.container.insertBefore(i.$.radixDisplayButton,i.$.input):i.$.container.insertBefore(i.$.radixDisplayButton,i.$.unitDisplay.nextElementSibling),i._refreshShape();break;case"inputFormat":i._changeInputFormat(t,n);break;case"showUnit":n?i.$unitDisplay.removeClass("smart-hidden"):i.$unitDisplay.addClass("smart-hidden"),i._refreshShape();break;case"unit":i.$.unitDisplay.innerHTML=n;break;case"scientificNotation":if(!1===i._regexSpecial.nonNumericValue.test(i.value)){const e=i._renderValue(i._number);a.value=e}break;case"locale":case"messages":case"showDropDownValues":i.opened?i._setDropDownOptions():i._initialDropDownOptionsSet=!1;break;case"nullable":!0===t&&null===i.value&&i._validate(!1,"0");break;case"validation":"strict"===n&&(i._triggerChangeEvent=!0,i._validate(!1,i.value),i._triggerChangeEvent=!1)}else"string"!=typeof n&&"string"==typeof t&&(i[e]=t);i._cachedInputValue=a.value}_changeInputFormat(e,t){const n=this;n._numericProcessor=new Smart.Utilities.NumericProcessor(n,"inputFormat"),"complex"!==e?("integer"===t&&"floatingPoint"===e&&n._changeFromFloatingPointToIntegerInputFormat(),"floatingPoint"===t&&"integer"===e&&n._changeFromIntegerToFloatingPointInputFormat(),"complex"===t&&n._changeToComplexInputFormat(e),n._updateSpinButtonsStepObject(),null!==n.value&&(n._inputFormatChangedFlag=!0,n._validate(void 0,n._number.toString()),n._inputFormatChangedFlag=!1)):n._changeFromComplexInputFormat(t)}_changeFromComplexInputFormat(e){const t=this;if(t.spinButtonsStep=t._spinButtonsStepObject.realPart,t._updateSpinButtonsStepObject(),"integer"===e?(t.min===-1/0?t.min=null:t.min=t._minObject.realPart,t.max===1/0?t.max=null:t.max=t._maxObject.realPart):(t.min!==-1/0&&(t.min=t._minObject.realPart),t.max!==1/0&&(t.max=t._maxObject.realPart)),t._numericProcessor.validateMinMax(!0,!0),null!==t.value){const e=t._number;t._inputFormatChangedFlag=!0,t._validate(void 0,(void 0!==e.realPart?e.realPart:e).toString()),t._inputFormatChangedFlag=!1}}_changeFromFloatingPointToIntegerInputFormat(){const e=this;e.min===-1/0&&(e.min=null),e.max===1/0&&(e.max=null),e._numericProcessor.validateMinMax(!0,!0)}_changeFromIntegerToFloatingPointInputFormat(){const e=this;e.radixDisplay&&(e.radixDisplay=!1,e.$radixDisplayButton.addClass("smart-hidden")),10!==e._radixNumber&&(e.radix=10,e._radixNumber=10),e._minIsNull?(e.min=-1/0,e._minObject=-1/0):e._minObject=parseFloat(e._minObject.toString()),e._maxIsNull?(e.max=1/0,e._maxObject=1/0):e._maxObject=parseFloat(e._maxObject.toString()),e.dropDownEnabled&&(e.dropDownEnabled=!1)}_changeToComplexInputFormat(e){const t=this;"integer"===e&&(t.radixDisplay&&(t.radixDisplay=!1,t.$radixDisplayButton.addClass("smart-hidden")),t._minIsNull&&(t.min=null),t._maxIsNull&&(t.max=null),t.dropDownEnabled&&(t.dropDownEnabled=!1)),t._numericProcessor.validateMinMax(t.min!==-1/0,t.max!==1/0)}_updateValue(e){const t=this,n=t.$.input.value,i=e.toString(t._radixNumber,t._wordLengthNumber,t.leadingZeros),a=t._renderValue(e),r=t.value,o=t._regexSpecial.nonNumericValue.test(i);if(n===i&&n===t._cachedInputValue||(t.$.input.value=a,t._cachedInputValue=a),t._inputFormatChangedFlag||o&&a!==r||!1===o&&t._numericProcessor.compare(e,t._number)){t._number=t._numericProcessor.createDescriptor(e);const n=t._number.toString();t.value=n,t._setDropDownOptions(!0),t._triggerChangeEvent&&(t.$.fireEvent("change",{value:n,oldValue:r,radix:t._radixNumber}),t._updateTargetValue())}else t.value=t._number.toString()}_setValue(e){const t=this;t.value=e,t.$.input.value=e,t._number=t._numericProcessor.createDescriptor(e,!0),t._setDropDownOptions(!0)}_changeRadix(e){const t=this,n=t._getRadix(e),i=t.radix;if(n===t._radixNumber)return;t.radix=e,t._radixNumber=n;const a=t.$.input,r=a.value;let o,l;null!==t.value?(o=t._number.toString(n,t._wordLengthNumber,t.leadingZeros),l=t._renderValue(o)):l="",a.value=l,t._cachedInputValue=l,t.$.radixDisplayButton.innerHTML=t._radixPrefixes[n],t.$.fireEvent("radixChange",{radix:e,oldRadix:i,displayedValue:l,oldDisplayedValue:r})}_openRadix(){const e=this;if(e.$.fireEvent("opening").defaultPrevented)return void(e.opened=!1);!1===e._initialDropDownOptionsSet&&(e._setDropDownOptions(),e._initialDropDownOptionsSet=!0),null!==e._dropDownParent&&(e.$.dropDown.style.width=e.offsetWidth+"px"),e.$radixDisplayButton.addClass("smart-numeric-text-box-pressed-component"),e.$dropDown.removeClass("smart-visibility-hidden"),e.$.dropDown.style.marginTop=null,e.opened=!0,e._positionDetection.positionDropDown();const t=(1===window.devicePixelRatio?document.documentElement.clientHeight:window.innerHeight)-e.$.dropDown.getBoundingClientRect().top-e.$.dropDown.offsetHeight-parseFloat(getComputedStyle(e.$.dropDown).marginBottom);t<0&&(e.$.dropDown.style.marginTop=t+"px"),e.$.fireEvent("open",{dropDown:e.$.dropDown}),e.$.radixDisplayButton.setAttribute("aria-expanded",!0)}_closeRadix(e,t){const n=this;(n.opened||t)&&(!n.$.fireEvent("closing").defaultPrevented||e?(n.$radixDisplayButton.removeClass("smart-numeric-text-box-pressed-component"),n.$dropDown.addClass("smart-visibility-hidden"),n.opened=!1,n.$.fireEvent("close",{dropDown:n.$.dropDown}),n.$.radixDisplayButton.setAttribute("aria-expanded",!1)):n.opened=!0)}_isLeftButtonPressed(e){const t=0===e.buttons||1===e.which;return 1===e.detail.buttons||t}_isIncrementOrDecrementAllowed(){const e=this;return!e.disabled&&!e.readonly&&!1===e._regexSpecial.nonNumericValue.test(e.$.input.value)}_upButtonClickHandler(e){const t=this;t._isLeftButtonPressed(e)&&t._isIncrementOrDecrementAllowed()&&(t._up||t.$upButton.addClass("smart-numeric-text-box-pressed-component"),t._incrementOrDecrement("add"))}_downButtonClickHandler(e){const t=this;t._isLeftButtonPressed(e)&&t._isIncrementOrDecrementAllowed()&&(t._up||t.$downButton.addClass("smart-numeric-text-box-pressed-component"),t._incrementOrDecrement("subtract"))}_documentMousedownHandler(e){const t=this;if(t._up=!1,!t.opened)return;let n=e.originalEvent.target;(t.shadowRoot||t.isInShadowDOM)&&(n=e.originalEvent.composedPath()[0]),(t.shadowRoot||t).contains(n)||t.$.dropDown.contains(n)||t._closeRadix()}_documentMouseupHandler(){const e=this;e._up=!0,e.$upButton.removeClass("smart-numeric-text-box-pressed-component"),e.$downButton.removeClass("smart-numeric-text-box-pressed-component")}_radixDisplayButtonClickHandler(){const e=this;e.dropDownEnabled&&!e.disabled&&null!==e.value&&(e.opened?e._closeRadix():e._openRadix())}_dropDownItemClickHandler(e){if(e.target.$.hasClass("smart-list-item")){const t=this;let n=e.target.getAttribute("data-value");t._changeRadix(parseInt(n,10)),t._closeRadix()}}_mouseenterMouseleaveHandler(e){const t=this;e.target===t.$.dropDown||t.disabled||t.readonly||("mouseenter"===e.type?e.target.setAttribute("hover",""):e.target.removeAttribute("hover"))}_inputKeydownHandler(e){const t=this,n=e.charCode?e.charCode:e.which;40===n&&t._isIncrementOrDecrementAllowed()?t._incrementOrDecrement("subtract"):38===n&&t._isIncrementOrDecrementAllowed()&&t._incrementOrDecrement("add"),t._keydownInfo={value:t.$.input.value,specialKey:e.altKey||e.ctrlKey||e.shiftKey}}_inputKeyupHandler(e){const t=this;if(13===e.keyCode)t._suppressBlurEvent=!0,t.$.input.value!==t._cachedInputValue&&(t._triggerChangeEvent=!0,t._validate(),t._triggerChangeEvent=!1,t.$.input.blur());else if(27===e.keyCode)t.$.input.value=t._editableValue;else{const n=t.$.input.value;""!==n&&t._regex[t._radixNumber].test(n)?(t.$.upButton.disabled=!1,t.$.downButton.disabled=!1):""===n&&(t.$.upButton.disabled=!0,t.$.downButton.disabled=!0),!t._keydownInfo||t._keydownInfo.value===n||t._keydownInfo.specialKey||e.altKey||e.ctrlKey||e.shiftKey||"Control"===e.key||(t.$.fireEvent("changing",{currentValue:n,validValue:t.value,radix:t._radixNumber}),t._updateTargetValue(n))}e.preventDefault()}_inputBlurHandler(){const e=this;!0===e._suppressBlurEvent?(e._suppressBlurEvent=!1,e._formattedValue&&(e._cachedInputValue=e._formattedValue,e.$.input.value=e._formattedValue,delete e._formattedValue)):e.$.input.value!==e._editableValue?(e._triggerChangeEvent=!0,e._validate(),e._triggerChangeEvent=!1):e.$.input.value=e._cachedInputValue,e.radixDisplay&&e.$.radixDisplayButton.removeAttribute("focus"),e.opened&&e._closeRadix(),e.spinButtons&&e.$.spinButtonsContainer.removeAttribute("focus"),e.showUnit&&e.$.unitDisplay.removeAttribute("focus"),e.removeAttribute("focus"),e.$.fireEvent("blur")}_inputFocusHandler(){const e=this;e.spinButtons&&e.$.spinButtonsContainer.setAttribute("focus",""),e.radixDisplay&&e.$.radixDisplayButton.setAttribute("focus",""),e.showUnit&&e.$.unitDisplay.setAttribute("focus",""),e.opened&&e._closeRadix(),e.setAttribute("focus",""),e.outputFormatString&&(e.$.input.value=e._editableValue),e.$.fireEvent("focus")}_inputChangeHandler(e){e.stopPropagation(),e.preventDefault()}_inputPasteHandler(){const e=this;requestAnimationFrame((()=>e.$.fireEvent("changing",{currentValue:e.$.input.value,validValue:e.value,radix:e._radixNumber})))}_inputWheelHandler(e){const t=this,n=t.shadowRoot&&t.shadowRoot.activeElement||document.activeElement;t.$.input===n&&t.enableMouseWheelAction&&t._isIncrementOrDecrementAllowed()&&(e.stopPropagation(),e.preventDefault(),e.wheelDelta>0?t._incrementOrDecrement("add"):t._incrementOrDecrement("subtract"))}_getRadix(e){switch(e.toString()){case"10":case"decimal":return 10;case"2":case"binary":return 2;case"8":case"octal":return 8;case"16":case"hexadecimal":return 16}}_setDropDownOptions(e){const t=this;if(!1===t.dropDownEnabled||null===t._number)return;if(!t.showDropDownValues){if(e)return;return t.$.dropDownItem2.innerHTML=t.localize("binary"),t.$.dropDownItem8.innerHTML=t.localize("octal"),t.$.dropDownItem10.innerHTML=t.localize("decimal"),void(t.$.dropDownItem16.innerHTML=t.localize("hexadecimal"))}const n=t._wordLengthNumber,i=t.leadingZeros;t.$.dropDownItem2.innerHTML=`${t._number.toString(2,n,i)} (${t.localize("binary")})`,t.$.dropDownItem8.innerHTML=`${t._number.toString(8,n)} (${t.localize("octal")})`,t.$.dropDownItem10.innerHTML=`${t._renderValue(t._number.toString(10,n),!0)} (${t.localize("decimal")})`,t.$.dropDownItem16.innerHTML=`${t._number.toString(16,n,i)} (${t.localize("hexadecimal")})`}_incrementOrDecrement(e){const t=this,n=t.shadowRoot&&t.shadowRoot.activeElement||document.activeElement;let i=t._cachedInputValue;if(t.$.input===n&&(i=t._editableValue,t._suppressBlurEvent=!0),(t.$.input.value!==i||t._programmaticValueIsSet&&"interaction"===t.validation)&&(t._triggerChangeEvent=!0,t._validate(),t._triggerChangeEvent=!1,!1===t._isIncrementOrDecrementAllowed()))return;const a=t._numericProcessor.incrementDecrement(t._number,e,t._spinButtonsStepObject),r=t._validateRange(a);t._triggerChangeEvent=!0,t._updateValue(r),t._triggerChangeEvent=!1}_toBigNumberDecimal(e,t){const n=this;let i;return 10===t?i=new Smart.Utilities.BigNumber(e):n._unsigned||!1===n._isNegative(e,t)?n._wordLengthNumber<64?(i=parseInt(e,t),i=new Smart.Utilities.BigNumber(i)):i=n._getBigNumberFrom64BitBinOctHex(e,t):(i=n._getNegativeDecimal(e,t),i=new Smart.Utilities.BigNumber(i)),i}_isNegative(e,t){const n=this,i=e.length,a=e.charAt(0).toLowerCase();if(2===t)return i===n._wordLengthNumber&&"1"===a;if(8!==t)return i===n._wordLengthNumber/4&&-1!==["8","9","a","b","c","d","e","f"].indexOf(a);switch(n._wordLengthNumber){case 8:return 3===i&&("2"===a||"3"===a);case 16:return 5===i&&"1"===a;case 32:return 11===i&&("2"===a||"3"===a);case 64:return 22===i&&"1"===a}}_getBigNumberFrom64BitBinOctHex(e,t){let n=new Smart.Utilities.BigNumber(0);for(let i=e.length-1;i>=0;i--){let a=new Smart.Utilities.BigNumber(parseInt(e.charAt(i),t));n=n.add(a.multiply(new Smart.Utilities.BigNumber(t).pow(e.length-1-i)))}return n}_getNegativeDecimal(e,t){const n=this;let i=e;if(8===t){let t=[];for(let n=0;n<e.length;n++){let i=parseInt(e.charAt(n),8).toString(2);for(;3!==i.length;)i=`0${i}`;t.push(i)}for(i=t.join("");"0"===i.charAt(0);)i=i.slice(1)}else if(16===t){let t=[];for(let n=0;n<e.length;n++){let i=parseInt(e.charAt(n),16).toString(2);for(;4!==i.length;)i=`0${i}`;t.push(i)}i=t.join("")}let a=i.replace(/0/g,"a");return a=a.replace(/1/g,"b"),a=a.replace(/a/g,"1"),a=a.replace(/b/g,"0"),this._wordLengthNumber<64?a=-1*(parseInt(a,2)+1):(a=n._getBigNumberFrom64BitBinOctHex(a,t),a=a.add(1).negate()),a}_discardDecimalSeparator(e,t){if(void 0===t&&(t=this.decimalSeparator),"."!==t&&e!==1/0&&e!==-1/0){let n=new RegExp(t,"g");return e.replace(n,".")}return e}_applyDecimalSeparator(e){const t=this;return"string"!=typeof e&&(e=e.toString()),"."!==t.decimalSeparator&&(e=e.replace(/\./g,t.decimalSeparator)),e}_renderValue(e,t){const n=this,i=e,a=10===n._radixNumber||!0===t;if(e=n._numericProcessor.render(e,a),"."!==n.decimalSeparator&&a&&(e=n._applyDecimalSeparator(e)),!0!==t&&(n._editableValue=e,n.outputFormatString&&10===n._radixNumber)){const e=(n.shadowRoot||n.getRootNode()).activeElement||document.activeElement,t=n._numberRenderer.formatNumber(i,n.outputFormatString);if(e!==n.$.input)return t;n._formattedValue=t}return e}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.$.input.tabIndex=-1:e.$.input.removeAttribute("tabindex")}_disableComponents(){const e=this;if(e.disabled)return;const t=e.value;null===t||"NaN"===t.toString()||Math.abs(t)===1/0?(e.$.upButton.disabled=!0,e.$.downButton.disabled=!0):(e.$.upButton.disabled=!1,e.$.downButton.disabled=!1)}_resizeHandler(){this.refresh()}refresh(){const e=this;e.opened&&e._closeRadix(!0)}});
87
- Smart("smart-pager",class extends Smart.BaseElement{static get properties(){return{autoEllipsis:{value:"none",type:"string",allowedValues:["none","before","after","both"]},messages:{value:{en:{firstButton:"First",lastButton:"Last",previousButton:"Previous",nextButton:"Next",navigateToLabel:"Go to:",pageSizeLabel:"Show:",navigateToInputPlaceholder:"",ellipsis:"...",summaryString:"of",summaryPrefix:"of",summarySuffix:""}},type:"object",extend:!0},navigationButtonsPosition:{value:"both",allowedValues:["near","far","both"],type:"string"},navigationInputPosition:{value:"far",allowedValues:["near","far"],type:"string"},pageIndex:{value:0,type:"number"},pageIndexSelectors:{value:0,type:"any"},pagesCount:{value:100,type:"number?"},pageSize:{value:10,type:"number"},pageSizeSelectorPosition:{value:"far",allowedValues:["near","far"],type:"string"},pageSizeSelectorDataSource:{value:[10,25,50],type:"array"},showPrevNextNavigationButtons:{value:!1,type:"boolean"},showFirstLastNavigationButtons:{value:!1,type:"boolean"},showNavigationButtonLabels:{value:!1,type:"boolean"},showNavigationInput:{value:!1,type:"boolean"},showSummary:{value:!1,type:"boolean"},showPageSizeSelector:{value:!1,type:"boolean"},showPageIndexSelectors:{value:!1,type:"boolean"},summaryPosition:{value:"far",allowedValues:["near","far"],type:"string"},totalRecords:{value:null,type:"int?"}}}static get listeners(){return{click:"_navigationButtonsClickHandler","nextEllipsisButton.click":"_nextEllipsisButtonClickHandler","previousEllipsisButton.click":"_previousEllipsisButtonClickHandler",down:"_navigationButtonsDownHandler","navigateToInput.change":"_navigateToInputChangeHandler","nextButton.pointerenter":"_updateInBoundsFlag","nextButton.pointerleave":"_updateInBoundsFlag","pageIndexSelectorsContainer.click":"_pageIndexSelectorsContainerClickHandler","pageSizeSelector.change":"_pageSizeSelectorChangeHandler","previousButton.pointerenter":"_updateInBoundsFlag","previousButton.pointerleave":"_updateInBoundsFlag",keydown:"_keyDownHandler",resize:"_resizeHandler","document.up":"_stopRepeat"}}static get requires(){return{"Smart.DropDownList":"smart.dropdownlist.js"}}static get styleUrls(){return["smart.dropdown.css","smart.dropdownlist.css","smart.pager.css"]}template(){return'<div id="container" role="presentation">\n <div id="nearButtonsContainer" class="smart-pager-near-buttons-container" role="presentation">\n <div id="firstButton" class="smart-first-button smart-pager-button smart-unselectable" role="button" aria-label="First"></div>\n <div id="previousButton" class="smart-previous-page-button smart-pager-button smart-unselectable" role="button" aria-label="Previous"></div>\n </div>\n <div id="middleButtonsContainer" class="smart-pager-middle-buttons-container" role="presentation">\n <span id="previousEllipsisButton" class="smart-previous-ellipsis-button smart-pager-page-index-selector" role="button" aria-label="Previous group of pages"></span>\n <div id="pageIndexSelectorsContainer" tabindex="0" class="smart-pager-page-index-selectors-container" role="list"></div>\n <span id="nextEllipsisButton" class="smart-next-ellipsis-button smart-pager-page-index-selector" role="button" aria-label="Next group of pages"</span>\n </div>\n <div id="farButtonsContainer" class="smart-pager-far-buttons-container" role="presentation">\n <div id="nextButton" class="smart-next-page-button smart-pager-button smart-unselectable" role="button" aria-label="Next"></div>\n <div id="lastButton" class="smart-last-button smart-pager-button smart-unselectable" role="button" aria-label="Last"></div>\n </div>\n <div id="pagerInputAndLabelContainer" class="smart-pager-input-and-label-container" role="presentation">\n <span id="navigateToLabel" class="smart-pager-label"></span>\n <input type="text" id="navigateToInput" class="smart-pager-input smart-input" />\n </div>\n <div id="pagerSizeSelectorAndLabelContainer" class="smart-pager-size-selector-and-label-container">\n <span id="pageSizeLabel" class="smart-pager-label"></span>\n <smart-input id="pageSizeSelector" class="smart-page-size-selector"\n animation="[[animation]]"\n data-source="[[pageSizeSelectorDataSource]]"\n right-to-left="[[rightToLeft]]"\n drop-down-height="auto"\n drop-down-width="auto"\n drop-down-button-position="right"\n readonly\n selected-index="0"\n disabled="[[disabled]]"\n unfocusable="[[unfocusable]]">\n </smart-input>\n </div>\n <span id="pagerSummaryContainer" class="smart-pager-summary-container smart-pager-label"></span>\n </div>'}ready(){super.ready()}render(){const e=this;e.$.navigateToLabel.id||(e.$.navigateToLabel.id=e.id+"NavigateToLabel"),e.$.pageSizeLabel.id||(e.$.pageSizeLabel.id=e.id+"PageSizeLabel"),e.$.pagerSummaryContainer.id||(e.$.pagerSummaryContainer.id=e.id+"SummaryContainer"),e.setAttribute("role","navigation"),e.setAttribute("aria-labelledby",e.$.pagerSummaryContainer.id),e.$.navigateToInput.setAttribute("aria-labelledby",e.$.navigateToLabel.id),e.$.pageSizeSelector.setAttribute("aria-labelledby",e.$.pageSizeLabel.id),e.$.pageSizeSelector.dropDownWidth=e.$.pageSizeSelector.offsetWidth,e._render(),super.render()}refresh(){this._render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"navigationButtonsPosition":return void n._renderButtons();case"navigationInputPosition":case"pageSizeSelectorPosition":case"summaryPosition":case"totalRecords":return void n._renderSettings()}n._render()}next(){this.navigateTo(this.pageIndex+1)}prev(){this.navigateTo(this.pageIndex-1)}beginUpdate(){this._updating=!0}endUpdate(){this._updating=!1,this._render()}_render(){const e=this;if(!e._updating&&(e.$.navigateToInput.value=(1+e.pageIndex).toString(),e._renderButtons(),e._renderPageIndexSelectors(),e._renderSettings(),e._renderVisibility(),e._localize(),e.$.pageSizeSelector&&e.showPageSizeSelector)){const t=e.pageSizeSelectorDataSource.indexOf(e.pageSize);t>=0&&(e.$.pageSizeSelector.selectedIndex=t)}}_resizeHandler(){this._renderVisibility()}_renderVisibility(){const e=this,t=e.offsetWidth-20;e._pageIndexSelectorsVisibleCount=e._pageIndexSelectorsCount,e.showSummary?e.$pagerSummaryContainer.removeClass("smart-hidden"):e.$pagerSummaryContainer.addClass("smart-hidden"),e.showPageIndexSelectors?e.$middleButtonsContainer.removeClass("smart-hidden"):e.$middleButtonsContainer.addClass("smart-hidden"),e.showNavigationInput?(e.$navigateToLabel.removeClass("smart-hidden"),e.$navigateToInput.removeClass("smart-hidden")):(e.$navigateToLabel.addClass("smart-hidden"),e.$navigateToInput.addClass("smart-hidden")),e.showPageSizeSelector?(e.$pageSizeLabel.removeClass("smart-hidden"),e.$pageSizeSelector.removeClass("smart-hidden")):(e.$pageSizeLabel.addClass("smart-hidden"),e.$pageSizeSelector.addClass("smart-hidden")),e.showFirstLastNavigationButtons?(e.$firstButton.removeClass("smart-hidden"),e.$lastButton.removeClass("smart-hidden")):(e.$firstButton.addClass("smart-hidden"),e.$lastButton.addClass("smart-hidden")),e.showPrevNextNavigationButtons?(e.$previousButton.removeClass("smart-hidden"),e.$nextButton.removeClass("smart-hidden")):(e.$previousButton.addClass("smart-hidden"),e.$nextButton.addClass("smart-hidden")),e.$previousEllipsisButton.addClass("smart-hidden"),e.$nextEllipsisButton.addClass("smart-hidden"),"after"!==e.autoEllipsis&&"none"!==e.autoEllipsis&&e.pageIndex>=e._pageIndexSelectorsCount&&e.$previousEllipsisButton.removeClass("smart-hidden"),"before"!==e.autoEllipsis&&"none"!==e.autoEllipsis&&e.pageIndex<e.pagesCount-e._pageIndexSelectorsCount&&e.$nextEllipsisButton.removeClass("smart-hidden");for(let t=0;t<e._pageIndexSelectorsCount&&e.$.pageIndexSelectorsContainer.children[t];t++)e.$.pageIndexSelectorsContainer.children[t].classList.remove("smart-hidden");const a=e.$.pagerSummaryContainer.offsetWidth?Math.max(100,e.$.pagerSummaryContainer.offsetWidth):0;let n=e.$.nearButtonsContainer.offsetWidth+e.$.middleButtonsContainer.offsetWidth+e.$.farButtonsContainer.offsetWidth+a+e.$.pagerInputAndLabelContainer.offsetWidth+e.$.pagerSizeSelectorAndLabelContainer.offsetWidth;if(n>0&&n>t&&(n-=e.$.pagerSummaryContainer.offsetWidth,e.$pagerSummaryContainer.addClass("smart-hidden"),n>t&&(n-=e.$.navigateToLabel.offsetWidth,n-=e.$.navigateToInput.offsetWidth,e.$navigateToLabel.addClass("smart-hidden"),e.$navigateToInput.addClass("smart-hidden"),n>t))){if(n-=e.$.pageSizeLabel.offsetWidth,n-=e.$.pageSizeSelector.offsetWidth,e.$pageSizeLabel.addClass("smart-hidden"),e.$pageSizeSelector.addClass("smart-hidden"),n>t){e.$previousEllipsisButton.addClass("smart-hidden"),e.$nextEllipsisButton.addClass("smart-hidden"),n-=e.$.previousEllipsisButton.offsetWidth,n-=e.$.nextEllipsisButton.offsetWidth;for(let a=e._pageIndexSelectorsCount-1;a>=0;a--){const s=e.$.pageIndexSelectorsContainer.children[a];if(n<t||!s)break;e._pageIndexSelectorsVisibleCount--,n-=s.offsetWidth,s.hasAttribute("selected")||s.classList.add("smart-hidden")}}n>t&&e.showFirstLastNavigationButtons&&(e.$firstButton.addClass("smart-hidden"),e.$lastButton.addClass("smart-hidden"))}}_renderSettings(){const e=this,t=e.totalRecords;let a=e.pageIndex*e.pageSize,n=(e.pageIndex+1)*e.pageSize,s=e.pagesCount*e.pageSize;null!==t&&(n===s&&(n=t),s=t,0===t&&(a=-1)),e.$pagerSummaryContainer.removeClass("near"),e.$pagerSizeSelectorAndLabelContainer.removeClass("near"),e.$pagerInputAndLabelContainer.removeClass("near"),"near"===e.summaryPosition&&e.$pagerSummaryContainer.addClass("near"),"near"===e.pageSizeSelectorPosition&&e.$pagerSizeSelectorAndLabelContainer.addClass("near"),"near"===e.navigationInputPosition&&e.$pagerInputAndLabelContainer.addClass("near"),e.$.pagerSummaryContainer.innerHTML='<span class="smart-summary-start" role="presentation">'+(1+a)+'</span> <span class="smart-summary-hyphen" role="presentation">-</span> <span class="smart-summary-end" role="presentation">'+n+'</span><span class="smart-summary-prefix" role="presentation">'+e.localize("summaryPrefix")+'</span> <span class="smart-summary-total-end" role="presentation">'+s+'</span> <span class="smart-summary-suffix" role="presentation">'+e.localize("summarySuffix")+"</span>"}get _pageIndexSelectorsCount(){const e=this;let t=parseInt(e.pageIndexSelectors);return Array.isArray(e.pageIndexSelectors)&&(t=e.pageIndexSelectors.length),t}_renderPageIndexSelectors(){const e=this;if(e.pageIndex<0||e.pageIndex>=e.pagesCount)return void(e.$.pageIndexSelectorsContainer.innerHTML="");e.$.pageIndexSelectorsContainer.innerHTML="";let t=!1;Array.isArray(e.pageIndexSelectors)&&(t=!0);let a=Math.floor(e.pageIndex/e._pageIndexSelectorsCount)*e._pageIndexSelectorsCount,n=Math.min(e.pagesCount,a+e._pageIndexSelectorsCount),s=0;for(let r=a;r<n;r++){const a=document.createElement("span");let n=r+1;if(a.className="smart-pager-page-index-selector",t){const t=e.pageIndexSelectors[s++];t&&(t.label?n=e.pageIndexSelectors[r].label:"string"==typeof t&&(n=t),t.value&&a.setAttribute("value",e.pageIndexSelectors[r].value))}a.index=r,a.innerHTML=n,a.setAttribute("role","listitem"),e.$.pageIndexSelectorsContainer.appendChild(a),r===e.pageIndex&&(a.classList.add("smart-selected"),a.setAttribute("selected",""),a.setAttribute("aria-current","page"))}}_lastButtonClickHandler(){this.last()}last(){this.navigateTo(this.pagesCount-1)}_firstButtonClickHandler(){this.first()}first(){this.navigateTo(0)}_renderButtons(){const e=this;switch(0===e.pageIndex?(e.$.firstButton.setAttribute("disabled",""),e.$.previousButton.setAttribute("disabled","")):(e.$.firstButton.removeAttribute("disabled"),e.$.previousButton.removeAttribute("disabled")),e.pageIndex===e.pagesCount-1?(e.$.nextButton.setAttribute("disabled",""),e.$.lastButton.setAttribute("disabled","")):(e.$.nextButton.removeAttribute("disabled"),e.$.lastButton.removeAttribute("disabled")),e.pagesCount<=0&&(e.$.firstButton.setAttribute("disabled",""),e.$.previousButton.setAttribute("disabled",""),e.$.nextButton.setAttribute("disabled",""),e.$.lastButton.setAttribute("disabled","")),e.$nearButtonsContainer.removeClass("far"),e.$farButtonsContainer.removeClass("far"),e.$nearButtonsContainer.removeClass("near"),e.$farButtonsContainer.removeClass("near"),e.navigationButtonsPosition){case"near":e.$nearButtonsContainer.addClass("near"),e.$farButtonsContainer.addClass("near");break;case"far":e.$nearButtonsContainer.addClass("far"),e.$farButtonsContainer.addClass("far");break;case"both":e.$nearButtonsContainer.addClass("near"),e.$farButtonsContainer.addClass("far")}}_navigateToInputChangeHandler(){const e=this;let t=parseInt(e.$.navigateToInput.value)-1;isNaN(t)&&(e.$.navigateToInput.value="1",t=parseInt(e.$.navigateToInput.value-1)),e.navigateTo(t)}_pageIndexSelectorsContainerClickHandler(e){const t=this.enableShadowDOM?e.composedPath()[0].closest(".smart-pager-page-index-selector"):e.target.closest(".smart-pager-page-index-selector");t&&!t.classList.contains("smart-selected")&&this.navigateTo(t.index)}_pageSizeSelectorChangeHandler(e){const t=this;!t.showPageSizeSelector||t.disabled||t._updating||(t.pageSize=parseInt(e.detail.value),t.$.fireEvent("pageSizeChanged",{value:parseInt(e.detail.value)}))}_keyDownHandler(e){const t=this;if(!t.disabled&&(t.enableShadowDOM&&t.shadowRoot.activeElement||document.activeElement)!==t.$.navigateToInput&&null===t.$.pageSizeSelector.getAttribute("focus"))switch(e.key){case"End":t.last(),e.preventDefault();break;case"Home":t.first(),e.preventDefault();break;case"PageDown":case"ArrowDown":case"ArrowLeft":t.prev(),e.preventDefault();break;case"PageUp":case"ArrowUp":case"ArrowRight":t.next(),e.preventDefault()}}_nextButtonClickHandler(){this.next()}_previousButtonClickHandler(){this.prev()}navigateTo(e){const t=this,a=t.pageIndex;t.disabled||t.pageIndex===e||e<0||e>=t.pagesCount||(t.pageIndex=e,t._render(),t.$.fireEvent("change",{oldIndex:a,index:e}))}_localize(){const e=this,t=["firstButton","lastButton","previousButton","nextButton"];for(let a=0;a<t.length;a++){const n=e.$[t[a]];!e.showNavigationButtonLabels&&a<2?(n.innerHTML="",0===a?n.classList.add("smart-arrow-left-first"):n.classList.add("smart-arrow-right-last")):!e.showNavigationButtonLabels&&a>=2?(n.innerHTML="",2===a?n.classList.add("smart-arrow-left"):n.classList.add("smart-arrow-right")):(n.classList.remove("smart-arrow-left"),n.classList.remove("smart-arrow-right"),n.classList.remove("smart-arrow-left-first"),n.classList.remove("smart-arrow-right-last"),n.innerHTML=e.localize(t[a]))}e.$.pageSizeLabel.innerHTML=e.localize("pageSizeLabel"),e.$.navigateToLabel.innerHTML=e.localize("navigateToLabel"),e.$.previousEllipsisButton.innerHTML=e.localize("ellipsis"),e.$.nextEllipsisButton.innerHTML=e.localize("ellipsis"),e.$.navigateToInput.placeholder=e.localize("navigateToInputPlaceholder")}_nextEllipsisButtonClickHandler(){const e=this;e.navigateTo(e._pageIndexSelectorsCount+e.pageIndex)}_previousEllipsisButtonClickHandler(){const e=this;e.navigateTo(-e._pageIndexSelectorsCount+e.pageIndex)}_navigationButtonsClickHandler(e){const t=this;if(!t.disabled)switch(t.enableShadowDOM?e.composedPath()[0].closest(".smart-pager-button"):e.target.closest(".smart-pager-button")){case t.$.firstButton:t._firstButtonClickHandler(e);break;case t.$.lastButton:t._lastButtonClickHandler(e);break;case t.$.previousButton:t._previousButtonClickHandler(e);break;case t.$.nextButton:t._nextButtonClickHandler(e)}}_navigationButtonsDownHandler(e){const t=this,a=t.enableShadowDOM?e.originalEvent.composedPath()[0].closest(".smart-pager-button")||e.originalEvent.composedPath()[0].closest(".smart-pager-page-index-selector"):e.originalEvent.target.closest(".smart-pager-button")||e.originalEvent.target.closest(".smart-pager-page-index-selector");!t.disabled&&a&&(t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(a,e.pageX,e.pageY),a!==t.$.previousButton&&a!==t.$.nextButton||t._startRepeat(e,a))}_updateInBoundsFlag(e){const t=this,a=t.enableShadowDOM?e.composedPath()[0]:e.target;a._isPointerInBounds=!0,-1!==e.type.indexOf("leave")&&(a._isPointerInBounds=!1),1!==("buttons"in e?e.buttons:e.which)&&t._stopRepeat()}_startRepeat(e,t){const a=this;a._initialTimer||(a._initialTimer=setTimeout((function(){a._repeatTimer=setInterval((()=>{t._isPointerInBounds&&(t===a.$.previousButton?a._previousButtonClickHandler(e):a._nextButtonClickHandler(e))}),50)}),150))}_stopRepeat(){const e=this;e._repeatTimer&&(clearInterval(e._repeatTimer),e._repeatTimer=null),e._initialTimer&&(clearTimeout(e._initialTimer),e._initialTimer=null)}});
87
+ Smart("smart-pager",class extends Smart.BaseElement{static get properties(){return{autoEllipsis:{value:"none",type:"string",allowedValues:["none","before","after","both"]},messages:{value:{en:{firstButton:"First",lastButton:"Last",previousButton:"Previous",nextButton:"Next",navigateToLabel:"Go to:",pageSizeLabel:"Show:",navigateToInputPlaceholder:"",ellipsis:"...",summaryString:"of",summaryPrefix:"of",summarySuffix:""}},type:"object",extend:!0},navigationButtonsPosition:{value:"both",allowedValues:["near","far","both"],type:"string"},navigationInputPosition:{value:"far",allowedValues:["near","far"],type:"string"},pageIndex:{value:0,type:"number"},pageIndexSelectors:{value:0,type:"any"},pagesCount:{value:100,type:"number?"},pageSize:{value:10,type:"number"},pageSizeSelectorPosition:{value:"far",allowedValues:["near","far"],type:"string"},pageSizeSelectorDataSource:{value:[10,25,50],type:"array"},showPrevNextNavigationButtons:{value:!1,type:"boolean"},showFirstLastNavigationButtons:{value:!1,type:"boolean"},showNavigationButtonLabels:{value:!1,type:"boolean"},showNavigationInput:{value:!1,type:"boolean"},showSummary:{value:!1,type:"boolean"},showPageSizeSelector:{value:!1,type:"boolean"},showPageIndexSelectors:{value:!1,type:"boolean"},summaryPosition:{value:"far",allowedValues:["near","far"],type:"string"},totalRecords:{value:null,type:"int?"}}}static get listeners(){return{click:"_navigationButtonsClickHandler","nextEllipsisButton.click":"_nextEllipsisButtonClickHandler","previousEllipsisButton.click":"_previousEllipsisButtonClickHandler",down:"_navigationButtonsDownHandler","navigateToInput.change":"_navigateToInputChangeHandler","nextButton.pointerenter":"_updateInBoundsFlag","nextButton.pointerleave":"_updateInBoundsFlag","pageIndexSelectorsContainer.click":"_pageIndexSelectorsContainerClickHandler","pageSizeSelector.change":"_pageSizeSelectorChangeHandler","previousButton.pointerenter":"_updateInBoundsFlag","previousButton.pointerleave":"_updateInBoundsFlag",keydown:"_keyDownHandler",resize:"_resizeHandler","document.up":"_stopRepeat"}}static get requires(){return{"Smart.DropDownList":"smart.dropdownlist.js"}}static get styleUrls(){return["smart.dropdown.css","smart.dropdownlist.css","smart.pager.css"]}template(){return'<div id="container" role="presentation">\n <div id="nearButtonsContainer" class="smart-pager-near-buttons-container" role="presentation">\n <div id="firstButton" class="smart-first-button smart-pager-button smart-unselectable" role="button" aria-label="First"></div>\n <div id="previousButton" class="smart-previous-page-button smart-pager-button smart-unselectable" role="button" aria-label="Previous"></div>\n </div>\n <div id="middleButtonsContainer" class="smart-pager-middle-buttons-container" role="presentation">\n <span id="previousEllipsisButton" class="smart-previous-ellipsis-button smart-pager-page-index-selector" role="button" aria-label="Previous group of pages"></span>\n <div id="pageIndexSelectorsContainer" tabindex="0" class="smart-pager-page-index-selectors-container" role="list"></div>\n <span id="nextEllipsisButton" class="smart-next-ellipsis-button smart-pager-page-index-selector" role="button" aria-label="Next group of pages"</span>\n </div>\n <div id="farButtonsContainer" class="smart-pager-far-buttons-container" role="presentation">\n <div id="nextButton" class="smart-next-page-button smart-pager-button smart-unselectable" role="button" aria-label="Next"></div>\n <div id="lastButton" class="smart-last-button smart-pager-button smart-unselectable" role="button" aria-label="Last"></div>\n </div>\n <div id="pagerInputAndLabelContainer" class="smart-pager-input-and-label-container" role="presentation">\n <span id="navigateToLabel" class="smart-pager-label"></span>\n <input type="text" id="navigateToInput" class="smart-pager-input smart-input" />\n </div>\n <div id="pagerSizeSelectorAndLabelContainer" class="smart-pager-size-selector-and-label-container">\n <span id="pageSizeLabel" class="smart-pager-label"></span>\n <smart-input id="pageSizeSelector" class="smart-page-size-selector"\n animation="[[animation]]"\n data-source="[[pageSizeSelectorDataSource]]"\n right-to-left="[[rightToLeft]]"\n drop-down-height="auto"\n drop-down-width="auto"\n drop-down-button-position="right"\n readonly\n selected-index="0"\n disabled="[[disabled]]"\n unfocusable="[[unfocusable]]">\n </smart-input>\n </div>\n <span id="pagerSummaryContainer" class="smart-pager-summary-container smart-pager-label"></span>\n </div>'}ready(){super.ready()}render(){const e=this;e.$.navigateToLabel.id||(e.$.navigateToLabel.id=e.id+"NavigateToLabel"),e.$.pageSizeLabel.id||(e.$.pageSizeLabel.id=e.id+"PageSizeLabel"),e.$.pagerSummaryContainer.id||(e.$.pagerSummaryContainer.id=e.id+"SummaryContainer"),e.setAttribute("role","navigation"),e.setAttribute("aria-labelledby",e.$.pagerSummaryContainer.id),e.$.navigateToInput.setAttribute("aria-labelledby",e.$.navigateToLabel.id),e.$.pageSizeSelector.setAttribute("aria-labelledby",e.$.pageSizeLabel.id),e.$.pageSizeSelector.dropDownWidth=e.$.pageSizeSelector.offsetWidth,e._render(),super.render()}refresh(){this._render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"navigationButtonsPosition":return void n._renderButtons();case"navigationInputPosition":case"pageSizeSelectorPosition":case"summaryPosition":case"totalRecords":return void n._renderSettings()}n._render()}next(){this.navigateTo(this.pageIndex+1)}prev(){this.navigateTo(this.pageIndex-1)}beginUpdate(){this._updating=!0}endUpdate(){this._updating=!1,this._render()}_render(){const e=this;if(!e._updating&&(e.$.navigateToInput.value=(1+e.pageIndex).toString(),e._renderButtons(),e._renderPageIndexSelectors(),e._renderSettings(),e._renderVisibility(),e._localize(),e.$.pageSizeSelector&&e.showPageSizeSelector)){const t=e.pageSizeSelectorDataSource.indexOf(e.pageSize);if(t>=0){const a=e.$.pageSizeSelector.context;e.$.pageSizeSelector.context=e.$.pageSizeSelector,e.$.pageSizeSelector.selectedIndex=t,e.$.pageSizeSelector._setSelection(!1),e.$.pageSizeSelector.content=a}}}_resizeHandler(){this._renderVisibility()}_renderVisibility(){const e=this,t=e.offsetWidth-20;e._pageIndexSelectorsVisibleCount=e._pageIndexSelectorsCount,e.showSummary?e.$pagerSummaryContainer.removeClass("smart-hidden"):e.$pagerSummaryContainer.addClass("smart-hidden"),e.showPageIndexSelectors?e.$middleButtonsContainer.removeClass("smart-hidden"):e.$middleButtonsContainer.addClass("smart-hidden"),e.showNavigationInput?(e.$navigateToLabel.removeClass("smart-hidden"),e.$navigateToInput.removeClass("smart-hidden")):(e.$navigateToLabel.addClass("smart-hidden"),e.$navigateToInput.addClass("smart-hidden")),e.showPageSizeSelector?(e.$pageSizeLabel.removeClass("smart-hidden"),e.$pageSizeSelector.removeClass("smart-hidden")):(e.$pageSizeLabel.addClass("smart-hidden"),e.$pageSizeSelector.addClass("smart-hidden")),e.showFirstLastNavigationButtons?(e.$firstButton.removeClass("smart-hidden"),e.$lastButton.removeClass("smart-hidden")):(e.$firstButton.addClass("smart-hidden"),e.$lastButton.addClass("smart-hidden")),e.showPrevNextNavigationButtons?(e.$previousButton.removeClass("smart-hidden"),e.$nextButton.removeClass("smart-hidden")):(e.$previousButton.addClass("smart-hidden"),e.$nextButton.addClass("smart-hidden")),e.$previousEllipsisButton.addClass("smart-hidden"),e.$nextEllipsisButton.addClass("smart-hidden"),"after"!==e.autoEllipsis&&"none"!==e.autoEllipsis&&e.pageIndex>=e._pageIndexSelectorsCount&&e.$previousEllipsisButton.removeClass("smart-hidden"),"before"!==e.autoEllipsis&&"none"!==e.autoEllipsis&&e.pageIndex<e.pagesCount-e._pageIndexSelectorsCount&&e.$nextEllipsisButton.removeClass("smart-hidden");for(let t=0;t<e._pageIndexSelectorsCount&&e.$.pageIndexSelectorsContainer.children[t];t++)e.$.pageIndexSelectorsContainer.children[t].classList.remove("smart-hidden");const a=e.$.pagerSummaryContainer.offsetWidth?Math.max(100,e.$.pagerSummaryContainer.offsetWidth):0;let n=e.$.nearButtonsContainer.offsetWidth+e.$.middleButtonsContainer.offsetWidth+e.$.farButtonsContainer.offsetWidth+a+e.$.pagerInputAndLabelContainer.offsetWidth+e.$.pagerSizeSelectorAndLabelContainer.offsetWidth;if(n>0&&n>t&&(n-=e.$.pagerSummaryContainer.offsetWidth,e.$pagerSummaryContainer.addClass("smart-hidden"),n>t&&(n-=e.$.navigateToLabel.offsetWidth,n-=e.$.navigateToInput.offsetWidth,e.$navigateToLabel.addClass("smart-hidden"),e.$navigateToInput.addClass("smart-hidden"),n>t))){if(n-=e.$.pageSizeLabel.offsetWidth,n-=e.$.pageSizeSelector.offsetWidth,e.$pageSizeLabel.addClass("smart-hidden"),e.$pageSizeSelector.addClass("smart-hidden"),n>t){e.$previousEllipsisButton.addClass("smart-hidden"),e.$nextEllipsisButton.addClass("smart-hidden"),n-=e.$.previousEllipsisButton.offsetWidth,n-=e.$.nextEllipsisButton.offsetWidth;for(let a=e._pageIndexSelectorsCount-1;a>=0;a--){const s=e.$.pageIndexSelectorsContainer.children[a];if(n<t||!s)break;e._pageIndexSelectorsVisibleCount--,n-=s.offsetWidth,s.hasAttribute("selected")||s.classList.add("smart-hidden")}}n>t&&e.showFirstLastNavigationButtons&&(e.$firstButton.addClass("smart-hidden"),e.$lastButton.addClass("smart-hidden"))}}_renderSettings(){const e=this,t=e.totalRecords;let a=e.pageIndex*e.pageSize,n=(e.pageIndex+1)*e.pageSize,s=e.pagesCount*e.pageSize;null!==t&&(n===s&&(n=t),s=t,0===t&&(a=-1)),e.$pagerSummaryContainer.removeClass("near"),e.$pagerSizeSelectorAndLabelContainer.removeClass("near"),e.$pagerInputAndLabelContainer.removeClass("near"),"near"===e.summaryPosition&&e.$pagerSummaryContainer.addClass("near"),"near"===e.pageSizeSelectorPosition&&e.$pagerSizeSelectorAndLabelContainer.addClass("near"),"near"===e.navigationInputPosition&&e.$pagerInputAndLabelContainer.addClass("near"),e.$.pagerSummaryContainer.innerHTML='<span class="smart-summary-start" role="presentation">'+(1+a)+'</span> <span class="smart-summary-hyphen" role="presentation">-</span> <span class="smart-summary-end" role="presentation">'+n+'</span><span class="smart-summary-prefix" role="presentation">'+e.localize("summaryPrefix")+'</span> <span class="smart-summary-total-end" role="presentation">'+s+'</span> <span class="smart-summary-suffix" role="presentation">'+e.localize("summarySuffix")+"</span>"}get _pageIndexSelectorsCount(){const e=this;let t=parseInt(e.pageIndexSelectors);return Array.isArray(e.pageIndexSelectors)&&(t=e.pageIndexSelectors.length),t}_renderPageIndexSelectors(){const e=this;if(e.pageIndex<0||e.pageIndex>=e.pagesCount)return void(e.$.pageIndexSelectorsContainer.innerHTML="");e.$.pageIndexSelectorsContainer.innerHTML="";let t=!1;Array.isArray(e.pageIndexSelectors)&&(t=!0);let a=Math.floor(e.pageIndex/e._pageIndexSelectorsCount)*e._pageIndexSelectorsCount,n=Math.min(e.pagesCount,a+e._pageIndexSelectorsCount),s=0;for(let r=a;r<n;r++){const a=document.createElement("span");let n=r+1;if(a.className="smart-pager-page-index-selector",t){const t=e.pageIndexSelectors[s++];t&&(t.label?n=e.pageIndexSelectors[r].label:"string"==typeof t&&(n=t),t.value&&a.setAttribute("value",e.pageIndexSelectors[r].value))}a.index=r,a.innerHTML=n,a.setAttribute("role","listitem"),e.$.pageIndexSelectorsContainer.appendChild(a),r===e.pageIndex&&(a.classList.add("smart-selected"),a.setAttribute("selected",""),a.setAttribute("aria-current","page"))}}_lastButtonClickHandler(){this.last()}last(){this.navigateTo(this.pagesCount-1)}_firstButtonClickHandler(){this.first()}first(){this.navigateTo(0)}_renderButtons(){const e=this;switch(0===e.pageIndex?(e.$.firstButton.setAttribute("disabled",""),e.$.previousButton.setAttribute("disabled","")):(e.$.firstButton.removeAttribute("disabled"),e.$.previousButton.removeAttribute("disabled")),e.pageIndex===e.pagesCount-1?(e.$.nextButton.setAttribute("disabled",""),e.$.lastButton.setAttribute("disabled","")):(e.$.nextButton.removeAttribute("disabled"),e.$.lastButton.removeAttribute("disabled")),e.pagesCount<=0&&(e.$.firstButton.setAttribute("disabled",""),e.$.previousButton.setAttribute("disabled",""),e.$.nextButton.setAttribute("disabled",""),e.$.lastButton.setAttribute("disabled","")),e.$nearButtonsContainer.removeClass("far"),e.$farButtonsContainer.removeClass("far"),e.$nearButtonsContainer.removeClass("near"),e.$farButtonsContainer.removeClass("near"),e.navigationButtonsPosition){case"near":e.$nearButtonsContainer.addClass("near"),e.$farButtonsContainer.addClass("near");break;case"far":e.$nearButtonsContainer.addClass("far"),e.$farButtonsContainer.addClass("far");break;case"both":e.$nearButtonsContainer.addClass("near"),e.$farButtonsContainer.addClass("far")}}_navigateToInputChangeHandler(){const e=this;let t=parseInt(e.$.navigateToInput.value)-1;isNaN(t)&&(e.$.navigateToInput.value="1",t=parseInt(e.$.navigateToInput.value-1)),e.navigateTo(t)}_pageIndexSelectorsContainerClickHandler(e){const t=this.enableShadowDOM?e.composedPath()[0].closest(".smart-pager-page-index-selector"):e.target.closest(".smart-pager-page-index-selector");t&&!t.classList.contains("smart-selected")&&this.navigateTo(t.index)}_pageSizeSelectorChangeHandler(e){const t=this;!t.showPageSizeSelector||t.disabled||t._updating||(t.pageSize=parseInt(e.detail.value),t.$.fireEvent("pageSizeChanged",{value:parseInt(e.detail.value)}))}_keyDownHandler(e){const t=this;if(!t.disabled&&(t.enableShadowDOM&&t.shadowRoot.activeElement||document.activeElement)!==t.$.navigateToInput&&null===t.$.pageSizeSelector.getAttribute("focus"))switch(e.key){case"End":t.last(),e.preventDefault();break;case"Home":t.first(),e.preventDefault();break;case"PageDown":case"ArrowDown":case"ArrowLeft":t.prev(),e.preventDefault();break;case"PageUp":case"ArrowUp":case"ArrowRight":t.next(),e.preventDefault()}}_nextButtonClickHandler(){this.next()}_previousButtonClickHandler(){this.prev()}navigateTo(e){const t=this,a=t.pageIndex;t.disabled||t.pageIndex===e||e<0||e>=t.pagesCount||(t.pageIndex=e,t._render(),t.$.fireEvent("change",{oldIndex:a,index:e}))}_localize(){const e=this,t=["firstButton","lastButton","previousButton","nextButton"];for(let a=0;a<t.length;a++){const n=e.$[t[a]];!e.showNavigationButtonLabels&&a<2?(n.innerHTML="",0===a?n.classList.add("smart-arrow-left-first"):n.classList.add("smart-arrow-right-last")):!e.showNavigationButtonLabels&&a>=2?(n.innerHTML="",2===a?n.classList.add("smart-arrow-left"):n.classList.add("smart-arrow-right")):(n.classList.remove("smart-arrow-left"),n.classList.remove("smart-arrow-right"),n.classList.remove("smart-arrow-left-first"),n.classList.remove("smart-arrow-right-last"),n.innerHTML=e.localize(t[a]))}e.$.pageSizeLabel.innerHTML=e.localize("pageSizeLabel"),e.$.navigateToLabel.innerHTML=e.localize("navigateToLabel"),e.$.previousEllipsisButton.innerHTML=e.localize("ellipsis"),e.$.nextEllipsisButton.innerHTML=e.localize("ellipsis"),e.$.navigateToInput.placeholder=e.localize("navigateToInputPlaceholder")}_nextEllipsisButtonClickHandler(){const e=this;e.navigateTo(e._pageIndexSelectorsCount+e.pageIndex)}_previousEllipsisButtonClickHandler(){const e=this;e.navigateTo(-e._pageIndexSelectorsCount+e.pageIndex)}_navigationButtonsClickHandler(e){const t=this;if(!t.disabled)switch(t.enableShadowDOM?e.composedPath()[0].closest(".smart-pager-button"):e.target.closest(".smart-pager-button")){case t.$.firstButton:t._firstButtonClickHandler(e);break;case t.$.lastButton:t._lastButtonClickHandler(e);break;case t.$.previousButton:t._previousButtonClickHandler(e);break;case t.$.nextButton:t._nextButtonClickHandler(e)}}_navigationButtonsDownHandler(e){const t=this,a=t.enableShadowDOM?e.originalEvent.composedPath()[0].closest(".smart-pager-button")||e.originalEvent.composedPath()[0].closest(".smart-pager-page-index-selector"):e.originalEvent.target.closest(".smart-pager-button")||e.originalEvent.target.closest(".smart-pager-page-index-selector");!t.disabled&&a&&(t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(a,e.pageX,e.pageY),a!==t.$.previousButton&&a!==t.$.nextButton||t._startRepeat(e,a))}_updateInBoundsFlag(e){const t=this,a=t.enableShadowDOM?e.composedPath()[0]:e.target;a._isPointerInBounds=!0,-1!==e.type.indexOf("leave")&&(a._isPointerInBounds=!1),1!==("buttons"in e?e.buttons:e.which)&&t._stopRepeat()}_startRepeat(e,t){const a=this;a._initialTimer||(a._initialTimer=setTimeout((function(){a._repeatTimer=setInterval((()=>{t._isPointerInBounds&&(t===a.$.previousButton?a._previousButtonClickHandler(e):a._nextButtonClickHandler(e))}),50)}),150))}_stopRepeat(){const e=this;e._repeatTimer&&(clearInterval(e._repeatTimer),e._repeatTimer=null),e._initialTimer&&(clearTimeout(e._initialTimer),e._initialTimer=null)}});
88
88
  Smart("smart-base-progress-bar",class extends Smart.BaseElement{static get properties(){return{indeterminate:{value:!1,type:"boolean"},inverted:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function"},max:{value:100,type:"number"},min:{value:0,type:"number"},showProgressValue:{value:!1,type:"boolean"},value:{value:0,type:"number?"}}}static get styleUrls(){return["smart.progressbar.css"]}render(){const e=this;e.$.label.id||(e.$.label.id=e.id+"Label"),e.setAttribute("role","progressbar"),e.setAttribute("aria-labelledby",e.$.label.id),e.setAttribute("aria-valuemin",e.min),e.setAttribute("aria-valuemax",e.max),null===e.value||e.indeterminate||(e.$.value.style.transition="none"),e._updateProgress(),requestAnimationFrame((()=>e.$.value.style.transition="")),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const r=this;r._updateProgress(),"value"===e?r.$.fireEvent("change",{value:a,oldValue:t,changeType:"api"}):"min"!==e&&"max"!==e||r.setAttribute("aria-value"+e,a)}_updateProgress(){const e=this,t=e.value;null===t||e.indeterminate?e.removeAttribute("aria-valuenow"):e.setAttribute("aria-valuenow",t)}get _percentageValue(){const e=this,t=Math.max(e.min,e.max),a=Math.min(e.min,e.max);return(Math.min(t,Math.max(a,e.value))-a)/(t-a)}}),Smart("smart-circular-progress-bar",class extends Smart.BaseProgressBar{template(){return'<div id="container" role="presentation">\n <svg width="100%" height="100%" viewPort="0 0 100 100" viewBox="0 0 100 100" role="presentation" aria-hidden="true">\n <circle id="value" class="smart-value-path" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n <circle id="value" class="smart-value" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n </svg>\n <div class="smart-label-container" role="presentation">\n <content></content>\n <span id="label" class="smart-label"></span>\n </div>\n </div>'}static get listeners(){return{resize:"_resizeHandler"}}render(){const e=this;e.$.container.style.width=e.$.container.style.height=Math.min(e.offsetWidth,e.offsetHeight)+"px",e.$.hasClass("echo-animation")&&(e.value=e.max,e._updateProgress()),super.render()}_resizeHandler(){this.refresh()}refresh(){const e=this;e.$.container.style.width=e.$.container.style.height=Math.min(e.offsetWidth,e.offsetHeight)+"px"}async _updateProgress(){super._updateProgress();const e=this,t=e.indeterminate?100*Math.PI:100*Math.PI-e._percentageValue*Math.PI*100,a=!!document.documentMode,r=!a&&!!window.StyleMedia;if(e.showProgressValue){const t=parseInt(100*e._percentageValue);e.$.label.innerHTML=t+"%",e.formatFunction&&(e.$.label.innerHTML=await e.formatFunction(t))}else e.$.label.innerHTML="";if(a||r)return null===e.value||e.indeterminate?(e.$.value.style.strokeDashoffset="",void e.$.value.setAttribute("class","smart-value smart-value-animation-ms")):(e.$.value.setAttribute("class","smart-value"),void(e.$.value.style.strokeDashoffset=e.inverted&&!e.rightToLeft||!e.inverted&&e.rightToLeft?-t:t));e.$.value.style.strokeDashoffset=e.inverted&&!e.rightToLeft||!e.inverted&&e.rightToLeft?-t:t,null===e.value||e.indeterminate?e.$value.addClass("smart-value-animation"):e.$value.removeClass("smart-value-animation")}}),Smart("smart-progress-bar",class extends Smart.BaseProgressBar{static get properties(){return{orientation:{value:"horizontal",allowedValues:["horizontal","vertical"],type:"string"}}}template(){return'<div role="presentation">\n <div id="value" class="smart-value"></div>\n <div id="label" class="smart-label"></div>\n </div>'}async _updateProgress(){super._updateProgress();const e=this;if(e.showProgressValue){const t=parseInt(100*e._percentageValue);e.$.label.innerHTML=t+"%",e.formatFunction&&(e.$.label.innerHTML=await e.formatFunction(t))}else e.$.label.innerHTML="";null===e.value||e.indeterminate?e.$value.addClass("smart-value-animation"):e.$value.removeClass("smart-value-animation"),e.$.value.style.transform="horizontal"===e.orientation?"scaleX("+e._percentageValue+")":"scaleY("+e._percentageValue+")"}});
89
89
  Smart("smart-scroll-bar",class extends Smart.BaseElement{static get properties(){return{clickRepeatDelay:{type:"integer",value:50},largeStep:{type:"integer",value:100},min:{type:"integer",value:0},max:{type:"integer",value:1e3},mechanicalAction:{value:"switchWhileDragging",allowedValues:["switchUntilReleased","switchWhenReleased","switchWhileDragging"],type:"string"},orientation:{type:"string",value:"horizontal",allowedValues:["horizontal","vertical"]},step:{type:"integer",value:10},showButtons:{type:"boolean",value:!0,defaultReflectToAttribute:!0},value:{type:"integer",value:0}}}static get styleUrls(){return["smart.scrollbar.css"]}template(){return'<div id="container" class="smart-container" role="presentation">\n <div id="nearButton" class="smart-scroll-button smart-arrow-left" role="presentation" aria-hidden="true"></div>\n <div id="track" class="smart-track" role="presentation">\n <div id="thumb" class="smart-thumb" role="presentation"></div>\n </div>\n <div id="farButton" class="smart-scroll-button smart-arrow-right" role="presentation" aria-hidden="true"></div>\n </div>'}static get listeners(){return{"nearButton.click":"_nearButtonClickHandler","nearButton.down":"_startRepeat","nearButton.up":"_stopRepeat","nearButton.pointerenter":"_updateInBoundsFlag","nearButton.pointerleave":"_updateInBoundsFlag","farButton.click":"_farButtonClickHandler","farButton.down":"_startRepeat","farButton.up":"_stopRepeat","farButton.pointerenter":"_updateInBoundsFlag","farButton.pointerleave":"_updateInBoundsFlag","track.down":"_trackDownHandler","track.click":"_trackClickHandler","track.move":"_trackMoveHandler","thumb.down":"_dragStartHandler","document.move":"_dragHandler","document.up":"_dragEndHandler",up:"_dragEndHandler","document.selectstart":"_selectStartHandler",resize:"_resizeHandler"}}_updateInBoundsFlag(t){const e=this,a=t.target;a._isPointerInBounds=!0,-1!==t.type.indexOf("leave")&&(a._isPointerInBounds=!1),1!==("buttons"in t?t.buttons:t.which)&&e._stopRepeat(t)}_startRepeat(t){const e=this;if(e.disabled)return;const a=t.target;a._initialTimer||(a._initialTimer=setTimeout((function(){a._repeatTimer=setInterval((()=>{if(a._isPointerInBounds){const e="buttons"in t?t.buttons:t.which;a.$.fireEvent("click",{buttons:e,clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,screenX:t.screenX,screenY:t.screenY})}}),e.clickRepeatDelay)}),3*e.clickRepeatDelay))}_stopRepeat(t){if(this.disabled)return;const e=t.target;e._repeatTimer&&(clearInterval(e._repeatTimer),e._repeatTimer=null),e._initialTimer&&(clearTimeout(e._initialTimer),e._initialTimer=null)}_calculateThumbSize(t){const e=this,a=e.max-e.min,r="horizontal"===e.orientation?e.$.track.offsetWidth>10:e.$.track.offsetHeight>10;let n=0;return a>=1&&r?(n=t/(a+t)*t,e.$.thumb.className.indexOf("smart-hidden")>=0&&e.$thumb.removeClass("smart-hidden")):e.$thumb.addClass("smart-hidden"),Math.max(10,Math.min(n,t))}_dragStartHandler(t){const e=this;e.disabled||(e.thumbCapture=!0,e.dragStartX=t.clientX,e.dragStartY=t.clientY,e.dragStartValue=e.value,t.stopPropagation(),t.preventDefault())}_dragHandler(t){const e=this;if(!0!==e.thumbCapture)return;e._isThumbDragged=!0;const a=(e.max-e.min)/(e.scrollBarSize-e.thumbSize),r="horizontal"===e.orientation?(t.clientX-e.dragStartX)*a:(t.clientY-e.dragStartY)*a;let n=r;e.rightToLeft&&"horizontal"===e.orientation&&(n=-r),e._updateValue(e.dragStartValue+n),t.stopPropagation(),t.preventDefault(),t.originalEvent&&(t.originalEvent.stopPropagation(),t.originalEvent.preventDefault())}_dragEndHandler(t){const e=this;e._trackDownTimer&&(clearInterval(e._trackDownTimer),e._trackDownTimer=null),e.thumbCapture&&(e.thumbCapture=!1,e._isThumbDragged=!1,"switchWhenReleased"===e.mechanicalAction?e._updateValue(e.dragStartValue,e.value):"switchUntilReleased"===this.mechanicalAction&&e._updateValue(e.dragStartValue),t.preventDefault(),t.stopPropagation(),t.originalEvent.preventDefault(),t.originalEvent.stopPropagation())}_farButtonClickHandler(){const t=this;if(t.disabled)return;const e=t.value;t._updateValue(t.value+("horizontal"===t.orientation&&t.rightToLeft?-1:1)*t.step),"switchUntilReleased"===t.mechanicalAction&&t._updateValue(e)}_nearButtonClickHandler(){const t=this;if(t.disabled)return;const e=t.value;t._updateValue(t.value-("horizontal"===t.orientation&&t.rightToLeft?-1:1)*t.step),"switchUntilReleased"===t.mechanicalAction&&t._updateValue(e)}propertyChangedHandler(t,e,a){super.propertyChangedHandler(t,e,a);const r=this;switch(t){case"min":case"max":case"orientation":case"showButtons":r._layout(),"min"===t?r.setAttribute("aria-valuemin",a):"max"===t?r.setAttribute("aria-valuemax",a):"orientation"===t&&r.setAttribute("aria-orientation",a);break;case"value":r._updateValue(e,a);break;default:r._layout()}}render(){const t=this;t.setAttribute("role","scrollbar"),t.setAttribute("aria-orientation",t.orientation),t.setAttribute("aria-valuemin",t.min),t.setAttribute("aria-valuemax",t.max),t.setAttribute("aria-valuenow",t.value),t._layout(),super.render()}_resizeHandler(){this._layout()}refresh(){this._layout()}beginUpdate(){this._isUpdating=!0}endUpdate(){this._isUpdating=!1,this.refreshValue()}refreshValue(){const t=this;t._layout(),t._updateValue(t.value)}_layout(){const t=this;t._isUpdating||(t.scrollBarSize="horizontal"===t.orientation?t.$.track.offsetWidth:t.$.track.offsetHeight,t.thumbSize=t._calculateThumbSize(t.scrollBarSize),"horizontal"===t.orientation&&t.$.thumb.style.width!==t.thumbSize+"px"?t.$.thumb.style.width=t.thumbSize+"px":"vertical"===t.orientation&&t.$.thumb.style.height!==t.thumbSize+"px"&&(t.$.thumb.style.height=t.thumbSize+"px"),"horizontal"===t.orientation?(t.$.nearButton.classList.contains("smart-arrow-up")&&t.$.nearButton.classList.remove("smart-arrow-up"),t.$.farButton.classList.contains("smart-arrow-down")&&t.$.farButton.classList.remove("smart-arrow-down"),t.$.nearButton.classList.contains("smart-arrow-left")||t.$.nearButton.classList.add("smart-arrow-left"),t.$.farButton.classList.contains("smart-arrow-right")||t.$.farButton.classList.add("smart-arrow-right")):(t.$.nearButton.classList.contains("smart-arrow-left")&&t.$.nearButton.classList.remove("smart-arrow-left"),t.$.farButton.classList.contains("smart-arrow-right")&&t.$.farButton.classList.remove("smart-arrow-right"),t.$.nearButton.classList.contains("smart-arrow-up")||t.$.nearButton.classList.add("smart-arrow-up"),t.$.farButton.classList.contains("smart-arrow-down")||t.$.farButton.classList.add("smart-arrow-down")),t._updateThumbPosition(),(t.value>t.max||t.value<t.min)&&t._updateValue(t.value,t.value>t.max?t.max:t.min))}_selectStartHandler(t){this.thumbCapture&&t.preventDefault()}_trackDownHandler(t){const e=this;t.target===e.$.track&&(e._trackDownTimer&&clearInterval(e._trackDownTimer),e.thumbCapture||(e._trackDownTimer=setInterval((function(){e._trackClickHandler(t)}),e.clickRepeatDelay),t.stopPropagation(),t.preventDefault()))}_trackClickHandler(t){const e=this;if(e.disabled)return;if(e._isThumbDragged)return clearInterval(e._trackDownTimer),void(e._trackDownTimer=null);const a=e.$.thumb.getBoundingClientRect(),r=t.pageX-window.pageXOffset,n=t.pageY-window.pageYOffset,i=(e.rightToLeft?-1:1)*e.value;"horizontal"===e.orientation?r>(e._isThumbDragged?e.dragStartX:a.right)?e._updateValue(e.value+(e.rightToLeft?-1:1)*e.largeStep):r<(e._isThumbDragged?e.dragStartX:a.left)&&e._updateValue(e.value-(e.rightToLeft?-1:1)*e.largeStep):n>(e._isThumbDragged?e.dragStartY:a.bottom)?e._updateValue(e.value+e.largeStep):n<(e._isThumbDragged?e.dragStartY:a.top)&&e._updateValue(e.value-e.largeStep),"switchUntilReleased"===e.mechanicalAction&&e._updateValue(i)}_trackMoveHandler(t){"touchmove"===t.originalEvent.type&&t.originalEvent.preventDefault()}_updateValue(t,e){const a=this;if(!a._isUpdating&&(1===arguments.length&&(e=t,t=a.value),(void 0===e||isNaN(e))&&(e=a.min),e>a.max&&(e=a.max),e<a.min&&(e=a.min),a.value=e,t!==e)){if(a.setAttribute("aria-valuenow",e),a._updateThumbPosition(),a.thumbCapture&&"switchWhenReleased"===a.mechanicalAction)return;if(a.onChange)return void a.onChange({value:a.value,oldValue:t,min:a.min,max:a.max,context:a});a.$.fireEvent("change",{value:a.value,oldValue:t,min:a.min,max:a.max})}}_updateThumbPosition(){const t=this,e="horizontal"===t.orientation?t.$.track.offsetWidth:t.$.track.offsetHeight,a=t._calculateThumbSize(e),r=e-a;let n=(e-a)/(t.max-t.min)*(t.value-t.min);t.rightToLeft&&"horizontal"===t.orientation&&(n=(e-a)/(t.max-t.min)*(t.max-t.value-t.min)),n=Math.min(r,Math.max(0,n)),"vertical"===t.orientation&&t.$.thumb.style.top!==n+"px"?t.$.thumb.style.top=n+"px":"horizontal"===t.orientation&&t.$.thumb.style.left!==n+"px"&&(t.$.thumb.style.left=n+"px")}});
90
90
  Smart("smart-splitter-item",class extends Smart.ContentElement{static get properties(){return{collapsed:{value:!1,type:"boolean"},collapsible:{value:!1,type:"boolean"},locked:{value:!1,type:"boolean"},max:{value:"",type:"any",validator:"_propertyValidator"},min:{value:"",type:"any",validator:"_propertyValidator"},size:{value:"",type:"any",validator:"_propertyValidator"}}}get enableShadowDOM(){return!1}template(){return'<div id="container" role="presentation">\n <div class="smart-content" id="content" inner-h-t-m-l="[[innerHTML]]" role="presentation">\n <content></content>\n </div>\n </div>'}static get listeners(){return{mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler",styleChanged:"_styleChangedEventHandler"}}propertyChangedHandler(e,t,i){const s=this;switch(e){case"collapsed":s._ignorePropertyValue=!0,i?s.collapse():s.expand();break;case"collapsible":s._updateNearSplitterBars();break;case"size":case"min":case"max":s._setSize(e,i);break;default:super.propertyChangedHandler(e,t,i)}}attached(){super.attached();const e=this;e._sizeLimits||(e._sizeLimits={});const t=getComputedStyle(e);e.min||(e._sizeLimits.minWidth=parseFloat(t.getPropertyValue("min-width"))||0,e._sizeLimits.minHeight=parseFloat(t.getPropertyValue("min-height"))||0),e.max||(e._sizeLimits.maxWidth=parseFloat(t.getPropertyValue("max-width"))||0,e._sizeLimits.maxHeight=parseFloat(t.getPropertyValue("max-height"))||0)}detached(){super.detached(),this.$.removeClass("animate")}appendChild(e){const t=this;if(e){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)))}t.$.content.appendChild(e)}else t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}collapse(e){const t=this;if(t.collapsible){if(t._ignorePropertyValue||!t.collapsed){const i=t.closest("smart-splitter")||(t.getRootNode()&&t.getRootNode().host?t.getRootNode().host.closest("smart-splitter"):void 0);if(!i)return;const s=i._items.indexOf(t);s===i._items.length-1?e=!0:0===s&&(e=!1);const n=e?-1:1;let a,r=s+n,o=i._items[r];for(;o&&o.collapsed;)r+=n,o=i._items[r];if(!o)return void(t.collapsed=!1);delete t._ignorePropertyValue,t._sizeBeforeCollapse||(t._sizeBeforeCollapse=t[i._measurements.size]),o._sizeBeforeCollapse||(o._sizeBeforeCollapse=o[i._measurements.size]),t.previousElementSibling instanceof Smart.SplitterBar?a=t.previousElementSibling:t.nextElementSibling instanceof Smart.SplitterBar&&(a=t.nextElementSibling);const l=o[i._measurements.size]+t[i._measurements.size],m=a?a[i._measurements.size]:t._sizeLimits[i._measurements.minDimension],d=l-m;if(l&&d<m)return void(t.collapsed=!1);if(i.hasAnimation&&!i._isInitializing&&(t.style[i._measurements.dimension]||(t.style[i._measurements.dimension]=t[i._measurements.size]+"px"),t.$.addClass("animate"),o.$.addClass("animate"),t.addEventListener("transitionend",t._transitionEndHandler,{once:!0}),t.addEventListener("transitioncancel",t._transitionEndHandler,{once:!0}),o.addEventListener("transitionend",t._transitionEndHandler,{once:!0}),o.addEventListener("transitioncancel",t._transitionEndHandler,{once:!0})),!t._paddings){const e=getComputedStyle(t);t._paddings=(parseFloat(e.getPropertyValue("padding-"+i._measurements.position))||0)+(parseFloat(e.getPropertyValue("padding-"+i._measurements.position2))||0)}void 0!==o._sizeBeforeCollapse&&(o._sizeBeforeCollapse=o._sizeBeforeCollapse+t._sizeBeforeCollapse),o._sizeLimits&&o._sizeLimits[i._measurements.maxDimension]&&l>o._sizeLimits[i._measurements.maxDimension]&&(o._sizeLimits.ignoreUpdate=!0,o._sizeBeforeCollapse?o.style[i._measurements.maxDimension]=o._sizeBeforeCollapse+"px":o.style[i._measurements.maxDimension]=""),o.set("size",""),o._sizeBeforeCollapse&&(o.style[i._measurements.dimension]=o._sizeBeforeCollapse+"px"),t.style[i._measurements.dimension]=t.style[i._measurements.minDimension]="0",t.style.padding="0",t._neighbourItem=o,t.collapsed=!0,i.$.fireEvent("collapse",{itemIndex:i._items.indexOf(t)}),e?(t.previousElementSibling.itemCollapsed=!0,t.previousElementSibling.showFarButton=!(t.previousElementSibling.showNearButton=!1)):(t.nextElementSibling.itemCollapsed=!0,t.nextElementSibling.showNearButton=!(t.nextElementSibling.showFarButton=!1))}}else t.collapsed=!1}expand(){const e=this;if(e._ignorePropertyValue||e.collapsed){const t=e.closest("smart-splitter")||(e.getRootNode()&&e.getRootNode().host?e.getRootNode().host.closest("smart-splitter"):void 0);if(!t)return void(e.collapsed=!0);if(!e._neighbourItem)return void(e.collapsed=!0);if(delete e._ignorePropertyValue,!e._neighbourItem._ignorePropertyValue&&e._neighbourItem.collapsed){let i=t._items.indexOf(e._neighbourItem);const s=t._items.indexOf(e)>t._items.indexOf(e._neighbourItem)?-1:1;for(e._neighbourItem=t._items[i];e._neighbourItem&&e._neighbourItem.collapsed;)i+=s,e._neighbourItem=t._items[i]}if(!e._neighbourItem)return void(e.collapsed=!0);e.min&&e._setSize("min",e.min,!0);const i=e._neighbourItem._sizeBeforeCollapse,s=e._sizeLimits[t._measurements.minDimension],n=e._neighbourItem._sizeLimits[t._measurements.minDimension],a=i-s;if(i&&a<n)return void(e.collapsed=!0);if(!e._neighbourItem._paddings){const i=getComputedStyle(e._neighbourItem);e._neighbourItem._paddings=(parseFloat(i.getPropertyValue("padding-"+t._measurements.position))||0)+(parseFloat(i.getPropertyValue("padding-"+t._measurements.position2))||0)}if(!e._paddings){const i=getComputedStyle(e);e._paddings=(parseFloat(i.getPropertyValue("padding-"+t._measurements.position))||0)+(parseFloat(i.getPropertyValue("padding-"+t._measurements.position2))||0)}if((e.size+"").indexOf("%")>-1&&(!e._sizeBeforeCollapse||0===e._sizeBeforeCollapse)&&e._neighbourItem._sizeBeforeCollapse){let i=0;t._items.map((e=>i+=e.collapsed?0:e.style[t._measurements.dimension]&&e.style[t._measurements.dimension].indexOf("%")<-1&&e._sizeBeforeCollapse?e._sizeBeforeCollapse:e.getBoundingClientRect()[t._measurements.dimension])),e._sizeBeforeCollapse=i*parseFloat(e.size)/100}const r=Math.min(Math.max(s,e._sizeBeforeCollapse),i-e._neighbourItem._paddings-e._paddings-n);if(r<0)return void(e.collapsed=!0);e.min&&(e.style[t._measurements.minDimension]=0),e.hasAnimation&&!t._isInitializing&&(e.$.addClass("animate"),e._neighbourItem.$.addClass("animate"),e.addEventListener("transitionend",e._transitionEndHandler,{once:!0}),e.addEventListener("transitioncancel",e._transitionEndHandler,{once:!0}),e._neighbourItem.addEventListener("transitionend",e._transitionEndHandler,{once:!0}),e._neighbourItem.addEventListener("transitioncancel",e._transitionEndHandler,{once:!0})),e.style.padding="",e.min&&(e.style[t._measurements.minDimension]=e._sizeLimits[t._measurements.minDimension]+"px"),e.style[t._measurements.dimension]=(e._sizeBeforeCollapse=r)+"px",e._neighbourItem.style[t._measurements.dimension]=(e._neighbourItem._sizeBeforeCollapse=Math.max(e._neighbourItem._sizeLimits[t._measurements.minDimension],i-r))+"px",e._neighbourItem._sizeLimits[t._measurements.maxDimension]&&(e._neighbourItem.style[t._measurements.maxDimension]=e._neighbourItem._sizeLimits[t._measurements.maxDimension]+"px"),e.collapsed=!1,t.$.fireEvent("expand",{itemIndex:t._items.indexOf(e)}),t._items.indexOf(e)>t._items.indexOf(e._neighbourItem)?(e.previousElementSibling.itemCollapsed=!1,e.previousElementSibling.showNearButton=e._neighbourItem.collapsible):(e.nextElementSibling.itemCollapsed=!1,e.nextElementSibling.showFarButton=e._neighbourItem.collapsible);const o=t._items[t._items.indexOf(e)-1],l=t._items[t._items.indexOf(e)+1];if(o){const t=o.nextElementSibling;t&&t instanceof Smart.SplitterBar&&(o.collapsed?t.showNearButton=e.collapsible:(t.itemCollapsed=!1,t.showNearButton=o.collapsible,t.showFarButton=e.collapsible))}if(l){const t=l.previousElementSibling;t&&t instanceof Smart.SplitterBar&&(l.collapsed?t.showFarButton=l.collapsed:(t.itemCollapsed=!1,t.showNearButton=e.collapsible,t.showFarButton=l.collapsible))}delete e._neighbourItem}}insertBefore(e,t){const i=this;if(e){if(!i.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(i,e.concat(Array.prototype.slice.call(arguments)))}i.$.content.insertBefore(e,t||null)}else i.error(i.localize("invalidNode",{elementType:i.nodeName.toLowerCase(),method:"insertBefore",node:"node"}))}lock(){this.locked=!0}unlock(){this.locked=!1}ready(){super.ready()}render(){const e=this,t=e.closest("smart-splitter"),i=t&&t.isCompleted;e.setAttribute("role","region"),e._sizeLimits={};let s="string"==typeof e.min&&e.min.indexOf("%")>-1;const n=isNaN(parseFloat(e.min))?0:parseFloat(e.min),a=isNaN(parseFloat(e.max))?0:parseFloat(e.max);if(e._sizeLimits.minWidth=e._sizeLimits.minHeight=s&&i?n*t[t._measurements.size]/100:n,s="string"==typeof e.max&&e.max.indexOf("%")>-1,e._sizeLimits.maxWidth=e._sizeLimits.maxHeight=s&&i?a*t[t._measurements.size]/100:a,e.size){s="string"==typeof e.size&&e.size.indexOf("%")>-1;const n="auto"===e.size?e.size:isNaN(parseFloat(e.size))?0:parseFloat(e.size)+(s?"%":"px");i?e.style[t._measurements.dimension]=n:e.style.width=e.style.height=n}e.min&&e._setSize("min",e.min),e.max&&e._setSize("max",e.max),e._updateNearSplitterBars(),e.checkLicense(),super.render()}removeChild(e){const t=this;if(e){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)))}t.$.content.removeChild(e)}else t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}_expand(){const e=this;if(e._neighbourItem&&e._neighbourItem.parentElement)return void e.expand();const t=e.closest("smart-splitter");t&&(delete e._neighbourItem,e.collapsed=!1,t.$.fireEvent("expand",{itemIndex:t._items.indexOf(e)}),e.style[t._measurements.minDimension]=e.min?e._sizeLimits[t._measurements.minDimension]+"px":"",e.style[t._measurements.dimension]=e._sizeBeforeCollapse+"px",t._items.length<2||e.previousElementSibling instanceof Smart.SplitterBar&&(e.previousElementSibling.itemCollapsed=!1,e.previousElementSibling.showNearButton=t._items[t._items.indexOf(e)-1].collapsible))}_mouseEventsHandler(e){const t=this.closest("smart-splitter")||this.getRootNode().host;(t&&!t.disabled||Smart.Utilities.Core.isMobile)&&("mouseenter"===e.type?this.setAttribute("hover",""):this.removeAttribute("hover"))}_propertyValidator(e,t){return"number"!=typeof t&&"string"!=typeof t?e:t}_setSize(e,t,i){const s=this;if(s.isCompleted&&s.locked)return;const n=s.closest("smart-splitter");if(!n)return;if(!n.isCompleted)return void n.whenReady((()=>s._setSize(e,t)));const a="string"==typeof t&&t.indexOf("%")>-1,r=function(){const e=n.bars;let t=0;for(let i=0;i<e.length;i++)t+=e[i][n._measurements.size];return n.$.container[n._measurements.size]-t}(),o=e=>100*e/r;switch(t=isNaN(parseFloat(t))?"":parseFloat(t),s._sizeLimits||(s._sizeLimits={}),e){case"size":{const e=s[n._measurements.size];"auto"!==arguments[1]&&arguments[1]?a?(s.style[n._measurements.dimension]=t+"%",s._sizeBeforeCollapse=t*r/100):s.style[n._measurements.dimension]=(s._sizeBeforeCollapse=t||0)+"px":(s.style[n._measurements.dimension]=arguments[1],s._sizeBeforeCollapse=s[n._measurements.size]),s._validateSize();const i=e-s._sizeBeforeCollapse;if(s._originalSize&&(s._originalSize=a?t+"%":s._sizeBeforeCollapse),n.hasAttribute("orientation-change"))break;const o=n._items[n._items.length-1];if(s===o){let e=n._items.find((e=>e!==s&&!e.collapsed&&!e.locked&&!e.size));if(!e)for(let t=Math.max(0,n._items.length-2);t>=0;t--)if(!n._items[t].collapsed&&!n._items[t].locked&&n._items[t]!==s){e=n._items[t];break}e&&(e.style[n._measurements.dimension]=(e._sizeBeforeCollapse=Math.max(0,e[n._measurements.size]+i))+"px")}break}case"min":if(t=a?t*r/100:t,s._sizeLimits.minWidth=s._sizeLimits.minHeight=t,s.style[n._measurements.minDimension]=s.collapsed||!t?"":a?o(t)+"%":t+"px",s.style["min"+n._measurements.restricredDimension]="",s._validateSize(),t||n._noNeighbourValidation||n._validateNeighbourSizeLimits(s),s.size)return void s._setSize("size",s.size,i);break;case"max":if(s._sizeLimits.maxWidth=s._sizeLimits.maxHeight=a?t*r/100:t,s.style[n._measurements.maxDimension]=t?a?o(t)+"%":t+"px":"",s.style["max"+n._measurements.restricredDimension]="",s._validateSize(),t||n._noNeighbourValidation||n._validateNeighbourSizeLimits(s),s.size)return void s._setSize("size",s.size,i)}i||n._noItemSizeValidation||n._validateItemSize(!0)}_validateSize(){const e=this,t=e.closest("smart-splitter");if(e.collapsed&&!t)return;const i=t._measurements,s=e._sizeBeforeCollapse?e._sizeBeforeCollapse:e.getBoundingClientRect()[i.dimension];function n(t){const n=t+"Dimension",a=e.style[i[n]],r=e._sizeLimits[i[n]];var o;("min"===t&&s<r||"max"===t&&s>r)&&(e.style[i.dimension]="string"==typeof(o=a)&&o.indexOf("%")>-1?a:r+"px",e._sizeBeforeCollapse=r)}e.min&&n("min"),e.max&&n("max")}_styleChangedEventHandler(e){const t=this;if(t.locked)return;if(t._sizeLimits.ignoreUpdate)return void delete t._sizeLimits.ignoreUpdate;if(t.collapsed)return;const i=t.closest("smart-splitter");let s;e.detail.styleProperties["min-width"]?(s=e.detail.styleProperties["min-width"][i&&"horizontal"===i.orientation?"oldValue":"value"],t._sizeLimits.minWidth=(parseFloat(s)||0)*(s&&s.indexOf("%")>-1?i[i._measurements.size]/100:1)):e.detail.styleProperties["max-width"]?(s=e.detail.styleProperties["max-width"][i&&"horizontal"===i.orientation?"oldValue":"value"],t._sizeLimits.maxWidth=(parseFloat(s)||0)*(s&&s.indexOf("%")>-1?i[i._measurements.size]/100:1)):e.detail.styleProperties["min-height"]?(s=e.detail.styleProperties["min-height"][i&&"horizontal"===i.orientation?"value":"oldValue"],t._sizeLimits.minHeight=(parseFloat(s)||0)*(s&&s.indexOf("%")>-1?i[i._measurements.size]/100:1)):e.detail.styleProperties["max-height"]&&(s=e.detail.styleProperties["max-height"][i&&"horizontal"===i.orientation?"value":"oldValue"],t._sizeLimits.maxHeight=(parseFloat(s)||0)*(s&&s.indexOf("%")>-1?i[i._measurements.size]/100:1))}_transitionEndHandler(){const e=this;(e.isCompleted||!e.$.hasClass("animate"))&&(e.$.removeClass("animate"),e._neighbourItem&&e._neighbourItem.$.hasClass("animate")&&e._neighbourItem.$.removeClass("animate"),(e.size+"").indexOf("%")>-1||e._neighbourItem&&(e._neighbourItem.size+"").indexOf("%")>-1)&&((e.shadowRoot&&e.getRootNode()?e.getRootNode().host:null)||e.closest("smart-splitter"))._validateItemSize()}_updateNearSplitterBars(){const e=this;e.previousElementSibling instanceof Smart.SplitterBar&&(e.previousElementSibling.showFarButton=e.collapsible),e.nextElementSibling instanceof Smart.SplitterBar&&(e.nextElementSibling.showNearButton=e.collapsible)}}),Smart("smart-splitter-bar",class extends Smart.BaseElement{static get properties(){return{showNearButton:{value:!1,type:"boolean"},showFarButton:{value:!1,type:"boolean"},itemCollapsed:{value:!1,type:"boolean"},locked:{value:!1,type:"boolean"}}}get enableShadowDOM(){return!1}template(){return'<div id="container" role="presentation">\n <div class="smart-splitter-far-collapse-button" id="farCollapseButton" role="button" aria-label="Collapse next">\n <span id="arrowNear" class="smart-arrow" aria-hidden="true"></span>\n </div>\n <div class="smart-splitter-resize-button" id="resizeButton" aria-hidden="true">\n <span></span>\n </div>\n <div class="smart-splitter-near-collapse-button" id="nearCollapseButton" role="button" aria-label="Collapse previous">\n <span id="arrowFar" class="smart-arrow" aria-hidden="true"></span>\n </div>\n </div>'}static get listeners(){return{mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler",mouseover:"_mouseEventsHandler",mouseout:"_mouseEventsHandler",focus:"_focusEventHandler",blur:"_focusEventHandler"}}propertyChangedHandler(e,t,i){const s=this;switch(e){case"unfocusable":s._setFocusable();break;default:super.propertyChangedHandler(e,t,i)}}ready(){super.ready();const e=this;e.setAttribute("role","separator"),e.setAttribute("aria-label","Resize"),e._setFocusable()}hide(){const e=this,t=e.closest("smart-splitter");if(e.$.addClass("smart-hidden"),t){const i=t.items;if(t.hasAnimation){let t;for(let s=0;s<i.length;s++)i[s].$.hasClass("animate")&&(t=!0,i[s].addEventListener("transitionend",(function(){e.closest("smart-splitter")._autoFitItems()}),{once:!0}));if(t)return}t._autoFitItems()}}show(){const e=this,t=e.closest("smart-splitter");if(e.$.removeClass("smart-hidden"),t){const i=t.items;if(t.hasAnimation){let t;for(let s=0;s<i.length;s++)i[s].$.hasClass("animate")&&(t=!0,i[s].addEventListener("transitionend",(function(){e.closest("smart-splitter")._validateItemSize()}),{once:!0}));if(t)return}t._validateItemSize()}}lock(){const e=this;e.locked=e.unfocusable=!0,e.showNearButton||e.showFarButton||e._setFocusable()}unlock(){const e=this;e.locked=e.unfocusable=!1,e._setFocusable()}_focusEventHandler(e){"focus"===e.type?this.setAttribute("focus",""):this.removeAttribute("focus")}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.tabIndex>0?e.tabIndex:0}_handleHoveredState(e,t){const i=this;switch(t){case"mouseenter":if(!e._getTargetItem(i,"previousElementSibling")||!("adjacent"===e.resizeMode?e._getTargetItem(i,"nextElementSibling"):e._getTargetItem(i,"previousElementSibling",!0)))return;i.setAttribute("hover","");break;case"mouseleave":i.removeAttribute("hover")}}_mouseEventsHandler(e){const t=this,i=t.closest("smart-splitter")||t.getRootNode().host;i&&i.disabled||Smart.Utilities.Core.isMobile||("mouseenter"!==e.type&&"mouseleave"!==e.type?e.target.closest(".smart-splitter-far-collapse-button")!==t.$.farCollapseButton?e.target.closest(".smart-splitter-near-collapse-button")!==t.$.nearCollapseButton?e.target.closest(".smart-splitter-resize-button")===t.$.resizeButton&&("mouseover"===e.type?t.$.resizeButton.setAttribute("hover",""):t.$.resizeButton.removeAttribute("hover")):"mouseover"===e.type?t.$.nearCollapseButton.setAttribute("hover",""):t.$.nearCollapseButton.removeAttribute("hover"):"mouseover"===e.type?t.$.farCollapseButton.setAttribute("hover",""):t.$.farCollapseButton.removeAttribute("hover"):t._handleHoveredState(i,e.type))}}),Smart("smart-splitter",class extends Smart.ContentElement{static get properties(){return{autoFitMode:{allowedValues:["end","proportional","overflow"],value:"proportional",type:"string"},dataSource:{value:null,type:"object?",reflectToAttribute:!1},orientation:{allowedValues:["horizontal","vertical"],value:"vertical",type:"string"},keepProportionsOnResize:{value:!1,type:"boolean"},resizeMode:{allowedValues:["none","adjacent","end","proportional"],value:"adjacent",type:"string"},resizeStep:{value:5,type:"number"},liveResize:{value:!1,type:"boolean"},messages:{extend:!0,value:{en:{invalidIndex:'{{elementType}}: "{{method}}" method accepts an index of type number.',indexOutOfBound:'{{elementType}}: Out of bound index/indexes in "{{method}}" method.',invalidNode:'{{elementType}}: "{{method}}" method accepts an object or an array of objects as it\'s second parameter.',invalidSettings:'{{elementType}}: "{{method}}" method accepts a string or an object as it\'s second parameter.',invalidType:'{{elementType}}: "{{propertyName}}" must be of type string or number.'}},type:"object"}}}static get listeners(){return{focus:"_focusHandler",blur:"_focusHandler",down:"_downHandler",move:"_moveHandler","document.dragstart":"_dragStartHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler",keydown:"_keyDownHandler",resize:"_resizeEventHandler"}}get enableShadowDOM(){const e=this,t=Smart.EnableShadowDOM;return e._isInShadowDOM?!e._isInShadowDOM:e.isCompleted?null!==e.shadowRoot:t}static get styleUrls(){return["smart.button.css","smart.splitter.css"]}template(){return'<div id="container" role="presentation">\n <content></content>\n </div>'}propertyChangedHandler(e,t,i){const s=this;switch(e){case"autoFitMode":s._validateItemSize();break;case"dataSource":s._createLayout();break;case"resizeMode":delete s._dragDetails;break;case"orientation":s.bars.forEach((e=>e.setAttribute("aria-orientation",i))),s._setMeasurements(),s.setAttribute("orientation-change","");for(let e=0;e<s._items.length;e++){const t=s._items[e];t.collapsed?(t.style[s._measurements.dimension]="",t.style[s._measurements.restricredDimension.toLowerCase()]="100%"):(t.size?(t.style[s._measurements.dimension]="",t._setSize("size",t.size,!0)):t.style[s._measurements.dimension]=t["offset"+s._measurements.restricredDimension]+"px",t.style[s._measurements.restricredDimension.toLowerCase()]="100%",t._setSize("min",t.min,!0),t._setSize("max",t.max,!0))}s._validateItemSize(),s.removeAttribute("orientation-change");break;case"unfocusable":s._setFocusable();break;default:super.propertyChangedHandler(e,t,i)}}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.SplitterItem?t.insertBefore(e,null):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}attached(){super.attached();const e=this;e.isRendered&&e._validateItemSize()}collapse(e,t){const i=this;if("number"==typeof e&&(e=i._items[e]),!e)return;const s=i.closest("smart-splitter")||(i.getRootNode()&&i.getRootNode().host?i.getRootNode().host.closest("smart-splitter"):void 0);e instanceof Smart.SplitterItem&&s===i||"number"==typeof e&&i._items[e]?e.collapse(t):i.error(i.localize("invalidIndex",{elementType:i.nodeName.toLowerCase(),method:"collapse"}))}expand(e){const t=this;if("number"==typeof e&&(e=t._items[e]),!e)return;const i=t.closest("smart-splitter")||(t.getRootNode()&&t.getRootNode().host?t.getRootNode().host.closest("smart-splitter"):void 0);e instanceof Smart.SplitterItem&&i===t||"number"==typeof e&&t._items[e]?e.expand():t.error(t.localize("invalidIndex",{elementType:t.nodeName.toLowerCase(),method:"expand"}))}hideBar(e){const t=this;"number"==typeof e&&(e=t.bars[e]),e instanceof Smart.SplitterBar?e instanceof Smart.SplitterBar&&(t.enableShadowDOM?e.getRootNode().host:e.closest("smart-splitter"))===t&&e.hide():t.error(t.localize("indexOutOfBound",{elementType:t.nodeName.toLowerCase(),method:"hideBar"}))}get items(){if(!this.isReady)return[];const e=this.$.container.children;let t=[];for(let i=0;i<e.length;i++)(e[i]instanceof Smart.SplitterItem||"smart-splitter-item"===e[i].tagName.toLowerCase())&&t.push(e[i]);return t}insert(e,t){const i=this;if("string"==typeof t&&(t={content:t}),!t||"object"!=typeof t)return void i.error(i.localize("invalidSettings",{elementType:i.nodeName.toLowerCase(),method:"insert"}));if("number"!=typeof e)return void i.error(i.localize("invalidIndex",{elementType:i.nodeName.toLowerCase(),method:"insert"}));const s=t instanceof Smart.SplitterItem?t:i._createItem(t);if(i.contains(s)){if(i._items.indexOf(s)===e)return;i.removeChild(s)}e>=i._items.length||0===i._items.length?i.appendChild(s):i.insertBefore(s,i._items[e])}insertBefore(e,t){const i=this;function s(){const s=function(){let t=e.previousElementSibling;for(;t;){if(t instanceof Smart.SplitterItem)return t;t=t.previousElementSibling}}(),a=i._items[0];if("overflow"!==i.autoFitMode&&1===i._items.length){const e=a.locked;a.locked=!1,a._setSize("size",a.size||"",!0),a.locked=e}i._resizeHostItemOnInsert(s,e,n),i._items&&i._items.splice(t?i._items.indexOf(t):i._items.length,0,e),s&&(s.max&&s._setSize("max",s.max,!0),s.min&&s._setSize("min",s.min,!0)),i._validateItemSize()}if(!i.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(i,e.concat(Array.prototype.slice.call(arguments)))}if(!(e&&e instanceof Smart.SplitterItem))return void i.error(i.localize("invalidNode",{elementType:i.nodeName.toLowerCase(),method:"insertBefore",node:"newNode/referenceNode"}));if(t&&!(t instanceof Smart.SplitterItem))return void i.error(i.localize("invalidNode",{elementType:i.nodeName.toLowerCase(),method:"insertBefore",node:"newNode/referenceNode"}));if(e.style[i._measurements.restricredDimension.toLowerCase()]="100%",e.size){const t="string"==typeof e.size&&e.size.indexOf("%")>-1?"%":"px";e.style[i._measurements.dimension]="auto"===e.size?e.size:isNaN(parseFloat(e.size))?"":parseFloat(e.size)+t,"overflow"!==i.autoFitMode&&1===i._items.length&&(i._items[0].size="")}else e.style[i._measurements.dimension]="";if(e._sizeBeforeCollapse)if(e.size){const t="string"==typeof e.size&&e.size.indexOf("%")>-1?"%":"px";e.style[i._measurements.dimension]="auto"===e.size?e.size:isNaN(parseFloat(e.size))?0:parseFloat(e.size)+t,e._sizeBeforeCollapse=e[i._measurements.size]}else delete e._sizeBeforeCollapse;e.style["max"+i._measurements.restricredDimension]="none",e.style[i._measurements.maxDimension]=e._sizeLimits&&e.max?e._sizeLimits[i._measurements.maxDimension]+"px":"",e.collapsed?(e.style.minWidth=e.style.minHeight="",e.style[i._measurements.minDimension]=e.style[i._measurements.dimension]="0"):e.style[i._measurements.minDimension]=e._sizeLimits&&e.min?e._sizeLimits[i._measurements.minDimension]+"px":"";for(let e=0;e<i._items.length;e++)i._items[e]._sizeBeforeCollapse||(i._items[e]._sizeBeforeCollapse=i._items[e][i._measurements.size]);let n;i.$.container.insertBefore(e,t||null);const a=i.bars;e.previousElementSibling instanceof Smart.SplitterItem?(n=i._createBar(e,e.previousElementSibling),i.$.container.insertBefore(n,e)):e.nextElementSibling instanceof Smart.SplitterItem&&(n=i._createBar(e,e.nextElementSibling),i.$.container.insertBefore(n,e.nextElementSibling)),n&&a.length>0&&(n.style[i._measurements.restricredDimension.toLowerCase()]=a[0].style[i._measurements.restricredDimension.toLowerCase()]),e.isCompleted?s():(e.__onCompleted=e._onCompleted,e._onCompleted=function(){e.__onCompleted&&(e.__onCompleted(),delete e.__onCompleted),s()})}lockItem(e){const t=this;e instanceof Smart.SplitterItem?e.lock():"number"==typeof e&&t._items[e]?(e=t._items[e])&&e.lock():t.error(t.localize("invalidIndex",{elementType:t.nodeName.toLowerCase(),method:"lockItem"}))}lockBar(e){const t=this;e instanceof Smart.SplitterBar?e.lock():"number"==typeof e?(e=t.bars[e])&&e.lock():t.error(t.localize("invalidIndex",{elementType:t.nodeName.toLowerCase(),method:"lockBar"}))}get hasStyleObserver(){return"resize"}ready(){super.ready()}render(){const e=this;e.setAttribute("role","group"),e._isInitializing=!0,e._createLayout(),delete e._isInitializing,e._setFocusable(),super.render()}refresh(){this._resizeEventHandler()}removeAt(e){const t=this;e instanceof Smart.SplitterItem&&e.closest("smart-splitter")===t?t.removeChild(e):"number"==typeof e?e>t._items.length||e<0?t.error(t.localize("indexOutOfBound",{elementType:t.nodeName.toLowerCase(),method:"remove"})):t.removeChild(t._items[e]):t.error(t.localize("invalidIndex",{elementType:t.nodeName.toLowerCase(),method:"remove"}))}removeAll(){this._items=[],this.$.container.innerHTML=""}removeChild(e){const t=this;function i(e,i,s){let n=e,a=t._items[n];for(;a&&a.collapsed;)a=t._items[n+=s];return a}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)))}if(!(e&&e instanceof Smart.SplitterItem))return void t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}));if(!t._items)return;let s=t._items.indexOf(e);e.collapsed?t.$.container.removeChild(t._items.indexOf(e._neighbourItem)>s?e.nextElementSibling:e.previousElementSibling):e.previousElementSibling instanceof Smart.SplitterBar?t.$.container.removeChild(e.previousElementSibling):e.nextElementSibling instanceof Smart.SplitterBar&&t.$.container.removeChild(e.nextElementSibling),t._items.splice(s,1),s=Math.max(0,s-1);let n=0;const a=t._items.filter((e=>!e.collapsed&&!e.locked)),r=e._sizeBeforeCollapse||e[t._measurements.size];if(a.map((e=>n+=(e.style[t._measurements.dimension]?e._sizeBeforeCollapse:0)||e[t._measurements.size])),t.$.content.removeChild(e),1===t._items.length&&t._items[0].collapsed||t._items.length>0&&t._items.map((e=>e.collapsed)).indexOf(!1)<0){const e=t._items[t._items.length-1];let i=e.context;e.context=e,e._expand(),e.context=i}for(let n=0;n<t._items.length;n++)if(t._items[n].collapsed&&t._items[n]._neighbourItem===e){let e,a;t._items[n]._neighbourItem=i(s,t._items[n],1),t._items[n]._neighbourItem?(e=t._items[n].nextElementSibling,e&&(a=e.context,e.context=e,e.itemCollapsed=!0,e.showNearButton=!(e.showFarButton=!1),e.context=a)):(t._items[n]._neighbourItem=i(s,t._items[n],-1),e=t._items[n].previousElementSibling,e&&(a=e.context,e.context=e,e.itemCollapsed=!0,e.showFarButton=!(e.showNearButton=!1),e.context=a))}if("proportional"===t.autoFitMode){let e,i,s;for(let o=0;o<a.length;o++)e=a[o]._sizeBeforeCollapse||a[o][t._measurements.size],i=e+r*(e/n),s=a[o]._sizeLimits[t._measurements.minDimension]||0,a[o].style[t._measurements.dimension]=(a[o]._sizeBeforeCollapse=Math.max(0,i))+"px",s>e&&(a[o][t._measurements.minDimension]=i+"px")}t._autoFitItems()}showBar(e){const t=this;e instanceof Smart.SplitterBar?e.show():"number"==typeof e?(e=t.bars[e])instanceof Smart.SplitterBar?e.show():t.error(t.localize("indexOutOfBound",{elementType:t.nodeName.toLowerCase(),method:"showBar"})):t.error(t.localize("invalidIndex",{elementType:t.nodeName.toLowerCase(),method:"showBar"}))}get bars(){if(!this.isReady)return[];const e=this.$.container.children;let t=[];for(let i=0;i<e.length;i++)(e[i]instanceof Smart.SplitterBar||"smart-splitter-bar"===e[i].tagName.toLowerCase())&&t.push(e[i]);return t}unlockItem(e){const t=this;e instanceof Smart.SplitterItem?e.unlock():"number"==typeof e&&t._items[e]?(e=t._items[e])&&e.unlock():t.error(t.localize("invalidIndex",{elementType:t.nodeName.toLowerCase(),method:"unlockItem"}))}unlockBar(e){const t=this;e instanceof Smart.SplitterBar?e.unlock():"number"==typeof e?(e=t.bars[e])&&e.unlock():t.error(t.localize("invalidIndex",{elementType:t.nodeName.toLowerCase(),method:"unlockBar"}))}update(e,t){const i=this;if("number"!=typeof e||(e=i._items[e])){if(e instanceof Smart.SplitterItem&&t&&(i.enableShadowDOM?e.getRootNode().host:i.closest("smart-splitter"))===i)for(let i in t)void 0!==e[i]&&(e[i]=t[i])}else i.error(i.localize("invalidIndex",{elementType:i.nodeName.toLowerCase(),method:"update"}))}_autoFitItems(){const e=this,t=e._items.length;if(0===t||"overflow"===e.autoFitMode)return;let i,s=[],n=[],a=[];for(let r=t-1;r>=0;r--)e._items[r].collapsed?n.push(e._items[r]):e._items[r].locked?s.push(e._items[r]):i?e._items[r].size||a.push(e._items[r]):i=e._items[r];i&&i.size&&a.length>0&&(i=a.filter((t=>!t.max&&!t._sizeLimits[e._measurements.maxDimension]))[0]||i),n.length===t&&(i=n[0],i.expand(),i.unlock()),e._autoFitLastItem(i,n,s)}_autoFitLastItem(e,t,i){const s=this,n=s._items.length;let a;if(1===n&&s._items[0].locked&&(a=s._items[0],a.locked=!1),i.length===n&&i[0].unlock(),e||(e=i[0]).unlock(),1===s._items.length)e._setSize("size","100%",!0),delete e._originalSize;else{const t="offset"+("width"===s._measurements.dimension?"Width":"Height");let i=0,n=0;s._items.map((e=>i+=e.collapsed?0:e.style[s._measurements.dimension]&&e.style[s._measurements.dimension].indexOf("%")<-1&&e._sizeBeforeCollapse?e._sizeBeforeCollapse:e[t])),s.bars.map((e=>n+=e[s._measurements.size]));const a=i+n,r=s.$.container[t];if(a!==r){let i;i=e.style[s._measurements.dimension].indexOf("%")<-1&&e._sizeBeforeCollapse?e._sizeBeforeCollapse:e[t];let n=Math.abs(r-a),o=a<r?1:-1;const l=Math.max(0,i+o*n);e.style[s._measurements.dimension]=(e._sizeBeforeCollapse=l)+"px",delete e._originalSize,s._validateItemLimits(e,l)}}a&&(a.locked=!0)}_validateItemLimits(e,t){const i=this,s=i.$.container.getBoundingClientRect()[i._measurements.dimension];let n,a,r;r=e._min||e.min,r&&(n="string"==typeof r&&r.indexOf("%")>-1,a=n?parseFloat(r)*s/100:parseFloat(r),a>t?(e.style[i._measurements.minDimension]=n?100*t/s+"%":t+"px",e._sizeLimits[i._measurements.minDimension]=t,e._min=r,e.set("min",e.style[i._measurements.minDimension])):a<t&&(e.style[i._measurements.minDimension]=n?100*a/s+"%":a+"px",e._sizeLimits[i._measurements.minDimension]=a,e.set("min",r),delete e._min)),r=e._max||e.max,r&&(n="string"==typeof r&&r.indexOf("%")>-1,a=n?parseFloat(r)*s/100:parseFloat(r),a<t?(e.style[i._measurements.maxDimension]=n?100*t/s+"%":t+"px",e._sizeLimits[i._measurements.maxDimension]=t,e._max=r,e.set("max",e.style[i._measurements.maxDimension])):a>t&&(e.style[i._measurements.maxDimension]=n?100*a/s+"%":a+"px",e._sizeLimits[i._measurements.maxDimension]=a,e.set("max",r),delete e._max))}_autoFitItemsProportionally(e,t){const i=this,s=i._items.filter((e=>!e.collapsed&&!e.locked));let n,a,r,o=e[i._measurements.size],l=0;if(s.map((e=>l+=e._sizeBeforeCollapse||e[i._measurements.size])),t&&(l-=t[i._measurements.size]),e.size&&!e.isCompleted&&(e._setSize("size",o),o=e._sizeBeforeCollapse),o=Math.min(i.$.container[i._measurements.size]/2,e[i._measurements.size]),"string"==typeof e.size&&e.size.indexOf("%")>-1){const t=i.$.container.getBoundingClientRect()[i._measurements.dimension];e._sizeBeforeCollapse=o,e.style[i._measurements.dimension]=100*o/t+"%"}else e.style[i._measurements.dimension]=(e._sizeBeforeCollapse=o)+"px";for(let e=0;e<s.length;e++)n=s[e]._sizeBeforeCollapse||s[e][i._measurements.size],a=n/l*(l-o),r=s[e]._sizeLimits[i._measurements.minDimension]||0,s[e].style[i._measurements.dimension]=(s[e]._sizeBeforeCollapse=Math.max(r,a))+"px",delete s[e]._originalSize}_createLayout(){const e=this;if(e._items=[],"string"==typeof e.dataSource&&(e.dataSource=JSON.parse(e.dataSource)),null!==e.dataSource&&Array.isArray(e.dataSource)){e.$.container.innerHTML="";let t,i=document.createDocumentFragment();for(let s=0;s<e.dataSource.length;s++)t=e._createItem(e.dataSource[s]),i.appendChild(t);e._handleSplitterBars(i)}else e._handleSplitterBars(e.$.container)}_createBar(e,t){const i=this,s=document.createElement("smart-splitter-bar");return e.collapsed?(s.itemCollapsed=!0,i._items.indexOf(e)===i._items.length-1?s.showNearButton=!0:s.showFarButton=!0):(e.collapsible&&(s.showNearButton=!0),t&&t instanceof Smart.SplitterItem&&t.collapsible&&(t===e.nextElementSibling?s.showFarButton=!0:s.showNearButton=!0)),s.setAttribute("aria-controls",e.id+(t?" "+t.id:"")),s.setAttribute("aria-orientation",i.orientation),s}_createItem(e){const t=document.createElement("smart-splitter-item");return e.id&&(t.id=e.id),t.innerHTML=e.content||"",t.collapsible=e.collapsible||!1,t.collapsed=e.collapsed||!1,t.locked=e.locked||!1,e.max&&(t.max=e.max),e.min&&(t.min=e.min),e.size&&(t.size=e.size),t}_completeResizing(e){const t=this;if(t._dragDetails){if(t._splitBarDummy&&t._splitBarDummy.parentElement){if(!e)if(t._dragDetails.firstItem.style[t._measurements.dimension]=(t._dragDetails.firstItem._sizeBeforeCollapse=t._dragDetails.firstItem.currentSize+t._dragDetails.firstItem._paddings)+"px",delete t._dragDetails.firstItem._originalSize,"proportional"!==t.resizeMode)t._dragDetails.secondItem.style[t._measurements.dimension]=(t._dragDetails.secondItem._sizeBeforeCollapse=t._dragDetails.splitAreaSize-t._dragDetails.firstItem.currentSize+t._dragDetails.secondItem._paddings)+"px",delete t._dragDetails.secondItem._originalSize;else{const e=t._dragDetails.itemProportions.length;if(e>1)for(let i=0;i<e;i++)t._dragDetails.itemProportions[i].item.style[t._measurements.dimension]=(t._dragDetails.itemProportions[i].item._sizeBeforeCollapse=t._dragDetails.itemProportions[i].currentSize+t._dragDetails.itemProportions[i].item._paddings)+"px",delete t._dragDetails.itemProportions[i]._originalSize;else t._dragDetails.secondItem[0].style[t._measurements.dimension]=(t._dragDetails.secondItem[0]._sizeBeforeCollapse=Math.floor(t._dragDetails.splitAreaSize-t._dragDetails.firstItem.currentSize+t._dragDetails.firstItem._paddings))+"px",delete t._dragDetails.secondItem[0]._originalSize}t._validateBarsSize(),t.$.fireEvent("resizeEnd",{firstItem:{index:t._items.indexOf(t._dragDetails.firstItem),oldSize:t._dragDetails.firstItem.originalSize,newSize:t._dragDetails.firstItem[t._measurements.size]},secondItem:Array.isArray(t._dragDetails.secondItem)?{index:t._dragDetails.secondItem.map((e=>t._items.indexOf(e))),oldSize:t._dragDetails.secondItem.map((e=>e.originalSize)),newSize:t._dragDetails.secondItem.map((e=>e[t._measurements.size]))}:{index:t._items.indexOf(t._dragDetails.secondItem),oldSize:t._dragDetails.secondItem.originalSize,newSize:t._dragDetails.secondItem[t._measurements.size]}}),t._splitBarDummy.classList.remove("limit-reached"),t._splitBarDummy.parentElement.removeChild(t._splitBarDummy)}t.removeAttribute("dragged"),delete t._dragDetails,delete t._keyboardResizing}}_dragStartHandler(e){this._dragDetails&&e.preventDefault()}_downHandler(e){const t=this;if(e.stopPropagation(),t.disabled)return;if(t._keyboardResizing)return void t._completeResizing();const i=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;let s=i.closest("smart-splitter");s||(s=i.getRootNode()&&i.getRootNode().host?i.getRootNode().host.closest("smart-splitter"):void 0);const n=i&&i.closest?i.closest("smart-splitter-bar"):null;if(n&&s===t){if(i.closest(".smart-splitter-near-collapse-button")===n.$.nearCollapseButton)return void(t._collapseButtonPressed={splitBar:n,item:n.previousElementSibling,target:n.$.nearCollapseButton,farCollapse:!1});if(i.closest(".smart-splitter-far-collapse-button")===n.$.farCollapseButton)return void(t._collapseButtonPressed={splitBar:n,item:n.nextElementSibling,target:n.$.farCollapseButton,farCollapse:!0});n.itemCollapsed||n.locked||"none"===t.resizeMode||t._setDragDetails(n,e)}}_moveHandler(){this.hasAttribute("dragged")&&Smart.Utilities.Core.isMobile&&event.originalEvent.preventDefault()}_documentMoveHandler(e){const t=this;t._keyboardResizing||t.disabled||t._resize(e)}_documentUpHandler(e){const t=this;if(t.removeAttribute("dragging-not-allowed"),t.removeAttribute("show-locked-items"),t.disabled)return delete t._dragDetails,void delete t._collapseButtonPressed;const i=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;return t._completeResizing(),t._collapseButtonPressed&&i.closest("."+t._collapseButtonPressed.target.classList[0])===t._collapseButtonPressed.target?(t._collapseButtonPressed.item.collapsed?t.expand(t._collapseButtonPressed.item):t.collapse(t._collapseButtonPressed.item,t._collapseButtonPressed.farCollapse),void delete t._collapseButtonPressed):void 0}_ensureItemsReady(e,t){const i=this,s=function(){const i=function(t){for(let i=0;i<e.length;i++)e[i].context="node"===t?e[i]:document};i("node"),t(),i()};if(0===e.length)s();else{i._nodesReadyListeners=0;for(let t=0;t<e.length;t++){const n=e[t],a=function(){i._nodesReadyListeners--,0===i._nodesReadyListeners&&(s(),delete i._nodesReadyListeners)}.bind(i);n.isCompleted||(i._nodesReadyListeners++,n._onCompleted=a)}0===i._nodesReadyListeners&&s()}}_focusHandler(e){"focus"===e.type?this.setAttribute("focus",""):this.removeAttribute("focus")}_getTargetItem(e,t,i){const s=this;let n=i?s._items[s._items.length-1]:e[t];for(;n;){if(n instanceof Smart.SplitterItem&&!n.collapsed){if(!n.locked)return n;s._dragDetails&&!s._dragDetails.firstItem&&(s._dragDetails.lockedItemsSize+=n[s._measurements.size]+(n.previousElementSibling instanceof Smart.SplitterBar?n.previousElementSibling[s._measurements.size]:0))}n=n[t]}}_handleSplitterBars(e){const t=this;if(t._items.length<1&&(t._items=e.parentElement?t.items:Array.from(e.children)),t._measurements||t._setMeasurements(),t._items.length<2){const i=t.bars;for(let t=0;t<i.length;t++)e.removeChild(i[t])}let i;t._noItemSizeValidation=!0,e.parentElement||e===t.$.container||(t.$.container.appendChild(e),e=t.$.container),t._noItemSizeValidation=!1;for(let s=0;s<t._items.length;s++){if(i=t._items[s],0===s)for(;e.firstElementChild&&e.firstElementChild!==i;)e.removeChild(e.firstElementChild);i.style[t._measurements.restricredDimension.toLowerCase()]="100%",i.style["max"+t._measurements.restricredDimension]="none",i.size||(i.style[t._measurements.dimension]=i._sizeBeforeCollapse?i._sizeBeforeCollapse+"px":"");const n=i.min,a=i.max;if("string"==typeof n&&n.indexOf("%")>-1&&i._setSize("min",n),"string"==typeof a&&a.indexOf("%")>-1&&i._setSize("max",a),i.style[t._measurements.maxDimension]=i.max?i._sizeLimits[t._measurements.maxDimension]+"px":"",i.nextElementSibling){let e=i.nextElementSibling;if(e instanceof Smart.SplitterItem||"smart-splitter-item"===e.tagName.toLowerCase())i.parentNode.insertBefore(t._createBar(i,i.nextElementSibling),i.nextElementSibling);else for((e instanceof Smart.SplitterBar||"smart-splitter-bar"===e.tagName.toLowerCase())&&(e=e.nextElementSibling);e&&(!(e instanceof Smart.SplitterItem)||"smart-splitter-item"!==e.tagName.toLowerCase());)e.parentNode.removeChild(e),e=e.nextElementSibling}if(i.collapsed){const e=i.collapsible;i.style.minWidth=i.style.minHeight="",i.style[t._measurements.minDimension]="0",i._ignorePropertyValue=!0,i.collapsible=!0,i.collapse(),i.collapsible=e}else i.style[t._measurements.minDimension]=i._sizeLimits&&i.min?i._sizeLimits[t._measurements.minDimension]+"px":""}if(i)for(;e.lastElementChild!==i;)e.removeChild(e.lastElementChild);t._ensureItemsReady(t._items,t._validateItemSize.bind(t))}_keyDownHandler(e){const t=this;if(t.disabled)return;let i=t.enableShadowDOM?t.shadowRoot.activeElement:document.activeElement;if("w"===e.key&&e.altKey){e.preventDefault();const s=t.enableShadowDOM?t.shadowRoot.querySelector("smart-splitter-bar"):t.querySelector("smart-splitter-bar");return i!==s&&t._completeResizing(!0),void s.focus()}if(!e.ctrlKey&&t._splitBarDummy&&t._splitBarDummy.parentElement)i=t._splitBarDummy;else if(!(i instanceof Smart.SplitterBar))return;if((t.enableShadowDOM?i.getRootNode().host:i.closest("smart-splitter"))===t)switch(e.key){case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{if(("ArrowUp"===e.key||"ArrowDown"===e.key)&&"vertical"===t.orientation)return;if(("ArrowLeft"===e.key||"ArrowRight"===e.key)&&"horizontal"===t.orientation)return;e.preventDefault();const s="ArrowLeft"===e.key||"ArrowUp"===e.key?-1:1;if(e.ctrlKey){let e,n;return t._completeResizing(!0),s<0?(n=i.previousElementSibling,e=i.nextElementSibling):(e=i.previousElementSibling,n=i.nextElementSibling),void(e.collapsed?e.expand():n.collapse(s>0))}if(i.locked)return;if("none"===t.resizeMode)return;let n;t._keyboardResizing=!0,t._dragDetails?n=t._dragDetails.position+s*t.resizeStep:(t._setDragDetails(i),n=i[t._measurements.offset]+s*t.resizeStep),t._resize({pageX:n,pageY:n});break}case"Enter":t._completeResizing();break;case"Escape":case"Tab":t._completeResizing(!0)}}_mouseEventsHandler(e){"mouseenter"!==e.type||Smart.Utilities.Core.isMobile?this.removeAttribute("hover"):this.setAttribute("hover","")}_recalcItemSize(e,t,i){const s=this;let n,a;if(i||(i=t),e>0)for(let r=0;r<t;r++)a=s._dragDetails.itemProportions[r].item._sizeLimits[s._measurements.minDimension],s._dragDetails.itemProportions[r].currentSize>a&&(n=s._dragDetails.itemProportions[r].currentSize-a<e/i?s._dragDetails.itemProportions[r].currentSize-a:e/i,e-=n,s._dragDetails.itemProportions[r].currentSize=Math.max(a,s._dragDetails.itemProportions[r].currentSize-n),delete s._dragDetails.itemProportions[r]._originalSize),i=Math.max(1,i-1);else{const a=s._dragDetails.splitAreaSize-s._dragDetails.firstItem.currentSize-(t>1?s._dragDetails.secondItemTotalMinSize-s._dragDetails.itemProportions[0].item._sizeLimits[s._measurements.minDimension]:0);let r;for(let o=0;o<t;o++)r=s._dragDetails.itemProportions[o].item._sizeLimits[s._measurements.maxDimension]?Math.min(s._dragDetails.itemProportions[o].item._sizeLimits[s._measurements.maxDimension],a):a,s._dragDetails.itemProportions[o].currentSize<r&&(n=s._dragDetails.itemProportions[o].currentSize-e/i>r?-1*(r-s._dragDetails.itemProportions[o].currentSize):e/i,e-=n,s._dragDetails.itemProportions[o].currentSize=Math.min(r,s._dragDetails.itemProportions[o].currentSize-n),delete s._dragDetails.itemProportions[o]._originalSize),i=Math.max(1,i-1)}Math.abs(e)>.1&&s._recalcItemSize(e,t,i)}_resize(e){const t=this;if(!t._dragDetails)return;let i,s=e[t._measurements.pagePosition]-t._dragDetails.position;const n=Math.sign(s),a=t._dragDetails.firstItem._sizeLimits[t._measurements.minDimension],r=t._dragDetails.firstItem._sizeLimits[t._measurements.maxDimension];let o,l;if(t.hasAttribute("dragged")||t.$.fireEvent("resizeStart",{firstItem:{index:t._items.indexOf(t._dragDetails.firstItem),size:t._dragDetails.firstItem[t._measurements.size]},secondItem:Array.isArray(t._dragDetails.secondItem)?{index:t._dragDetails.secondItem.map((e=>t._items.indexOf(e))),size:t._dragDetails.secondItem.map((e=>e[t._measurements.size]))}:{index:t._items.indexOf(t._dragDetails.secondItem),size:t._dragDetails.secondItem[t._measurements.size]}}),t.setAttribute("dragged",""),Math.abs(s)<t.resizeStep)return;let m=Math.max(t.resizeStep,Math.floor(Math.abs(s)/t.resizeStep)*t.resizeStep);const d=s-n*m;switch(t.resizeMode){case"adjacent":case"end":for(n>0?(o=t._dragDetails.splitAreaSize-t._dragDetails.firstItem.currentSize,l=()=>o-t._dragDetails.secondItemTotalMinSize>=m||r&&t._dragDetails.firstItem.currentSize+t.resizeStep<=r,i=()=>r&&t._dragDetails.firstItem.currentSize===r||o-t.resizeStep<=t._dragDetails.secondItemTotalMinSize):(o=t._dragDetails.firstItem.currentSize,l=()=>o-a>=m||t._dragDetails.secondItemTotalMaxSize&&t._dragDetails.splitAreaSize-t._dragDetails.firstItem.currentSize+t.resizeStep<=t._dragDetails.secondItemTotalMaxSize,i=()=>t._dragDetails.secondItemTotalMaxSize&&t._dragDetails.splitAreaSize-t._dragDetails.firstItem.currentSize===t._dragDetails.secondItemTotalMaxSize||o-t.resizeStep<=a),s=0;m>0;)l()&&(s+=n*t.resizeStep),m-=t.resizeStep;t._resizeItem(e,s,d);break;case"proportional":{const s=t._dragDetails.splitAreaSize-t._dragDetails.firstItem.currentSize;let _,p;for(n>0?(o=Math.abs(s-t._dragDetails.secondItemTotalMinSize),l=()=>o>=m||r&&t._dragDetails.firstItem.currentSize+t.resizeStep<=r,i=()=>r&&t._dragDetails.firstItem.currentSize===r||t._dragDetails.splitAreaSize-t._dragDetails.firstItem.currentSize-t.resizeStep<t._dragDetails.secondItemTotalMinSize):(o=t._dragDetails.firstItem.currentSize,l=()=>o-a>=m&&(!t._dragDetails.secondItemTotalMaxSize||t._dragDetails.splitAreaSize-t._dragDetails.firstItem.currentSize+t.resizeStep<=t._dragDetails.secondItemTotalMaxSize),i=()=>t._dragDetails.secondItemTotalMaxSize&&t._dragDetails.splitAreaSize+t.resizeStep-t._dragDetails.firstItem.currentSize>=t._dragDetails.secondItemTotalMaxSize||t._dragDetails.firstItem.currentSize-t.resizeStep<a);m>0;)l()&&(p=!0,_=Math.min(r?Math.min(r,t._dragDetails.splitAreaSize-t._dragDetails.secondItemTotalMinSize):t._dragDetails.splitAreaSize-t._dragDetails.secondItemTotalMinSize,Math.max(a,t._dragDetails.firstItem.currentSize+n*t.resizeStep)),t._dragDetails.firstItem.currentSize=t._dragDetails.firstItem._sizeBeforeCollapse=Math.floor(_)),m-=t.resizeStep;if(!p)break;const c=t._dragDetails.splitAreaSize-t._dragDetails.firstItem.currentSize,u=t._dragDetails.itemProportions.length;if(t._recalcItemSize(s-c,u),t.liveResize)if(t._dragDetails.firstItem.style[t._measurements.dimension]=t._dragDetails.firstItem.currentSize+t._dragDetails.firstItem._paddings+"px",u>1)for(let e=0;e<u;e++)t._dragDetails.itemProportions[e].item.style[t._measurements.dimension]=t._dragDetails.itemProportions[e].item._sizeBeforeCollapse=t._dragDetails.itemProportions[e].currentSize+t._dragDetails.itemProportions[e].item._paddings+"px";else t._dragDetails.secondItem[0].style[t._measurements.dimension]=(t._dragDetails.secondItem[0]._sizeBeforeCollapse=Math.floor(c+t._dragDetails.itemProportions[0].item._paddings))+"px";else t._splitBarDummy.style[t._measurements.position]=t._dragDetails.firstItem[t._measurements.offset]+t._dragDetails.firstItem.currentSize+t._dragDetails.lockedItemsSize+t._dragDetails.firstItem._paddings+"px";const g=t._dragDetails.firstItem.getBoundingClientRect()["vertical"===t.orientation?"left":"top"]+t._dragDetails.splitBarOffset,f=r&&t._dragDetails.splitAreaSize-r>t._dragDetails.secondItemTotalMinSize?r:t._dragDetails.splitAreaSize-t._dragDetails.secondItemTotalMinSize;t._dragDetails.position=Math.max(g+(t._dragDetails.secondItemTotalMaxSize?Math.max(t._dragDetails.splitAreaSize-t._dragDetails.secondItemTotalMaxSize,a):a)+t._dragDetails.lockedItemsSize+t._dragDetails.firstItem._paddings,Math.min(g+f+t._dragDetails.lockedItemsSize+t._dragDetails.firstItem._paddings,e[t._measurements.pagePosition]-d));break}}t.liveResize||(i()?t._splitBarDummy.classList.add("limit-reached"):t._splitBarDummy.classList.remove("limit-reached")),t._validateBarsSize()}_resizeEventHandler(e){const t=this;if(t._items){if(e&&(t.enableShadowDOM?e.composedPath()[0]:e.target)!==t)return;t._resizeEventFired=!0,t._validateItemSize(),t._resizeEventFired=!1}}_resizeHostItemOnInsert(e,t,i){const s=this;if("proportional"===s.autoFitMode)return void s._autoFitItemsProportionally(t,i);if(!e||e.locked||"overflow"===s.autoFitMode)return;t.size&&(e=function(){let e=t.previousElementSibling;for(;e;){if(e instanceof Smart.SplitterItem&&!e.size)return e;e=e.previousElementSibling}}()||e);const n=e[s._measurements.size]-t[s._measurements.size]-i[s._measurements.size],a=Math.max(e._sizeLimits[s._measurements.minDimension],n);e.style[s._measurements.maxDimension]=e.max?isNaN(parseFloat(e.max))?"":parseFloat(e.max)+typeof e.max=="string"&&e.max.indexOf("%")>-1?"%":"px":"";const r=e.style[s._measurements.maxDimension]?parseFloat(e.style[s._measurements.maxDimension]):0;t.size?e.style[s._measurements.dimension]=(e._sizeBeforeCollapse=r?Math.min(r,a):a)+"px":(e.style[s._measurements.dimension]=e.size?"auto"===e.size?e.size:isNaN(parseFloat(e.size))?0:parseFloat(e.size)+("string"==typeof e.size&&e.size.indexOf("%")>-1?"%":"px"):"",e._sizeBeforeCollapse=e[s._measurements.size])}_resizeItem(e,t,i){const s=this;let n=Math.max(s._dragDetails.firstItem._sizeLimits[s._measurements.minDimension]||0,Math.min(s._dragDetails.splitAreaSize-s._dragDetails.secondItem._sizeLimits[s._measurements.minDimension],s._dragDetails.firstItem._sizeLimits[s._measurements.maxDimension]?Math.min(s._dragDetails.firstItem._sizeLimits[s._measurements.maxDimension],s._dragDetails.firstItem.currentSize+t):s._dragDetails.firstItem.currentSize+t)),a=s._dragDetails.firstItem._sizeLimits[s._measurements.minDimension]||0;s._dragDetails.secondItem._sizeLimits[s._measurements.maxDimension]&&s._dragDetails.splitAreaSize-n>s._dragDetails.secondItem._sizeLimits[s._measurements.maxDimension]&&(a=n=s._dragDetails.splitAreaSize-(s._dragDetails.secondItem._sizeLimits[s._measurements.maxDimension]||0)),s._dragDetails.firstItem.currentSize=n,s.liveResize?(s._dragDetails.firstItem.style[s._measurements.dimension]=(s._dragDetails.firstItem._sizeBeforeCollapse=n+s._dragDetails.firstItem._paddings)+"px",s._dragDetails.secondItem.style[s._measurements.dimension]=(s._dragDetails.secondItem._sizeBeforeCollapse=s._dragDetails.splitAreaSize-n+s._dragDetails.firstItem._paddings)+"px",delete s._dragDetails.firstItem._originalSize,delete s._dragDetails._originalSize):s._splitBarDummy.style[s._measurements.position]=s._dragDetails.firstItem[s._measurements.offset]+n+s._dragDetails.lockedItemsSize+s._dragDetails.firstItem._paddings+"px";const r=s._dragDetails.firstItem.getBoundingClientRect()["vertical"===s.orientation?"left":"top"]+s._dragDetails.splitBarOffset;s._dragDetails.position=Math.max(r+a+s._dragDetails.firstItem._paddings,Math.min(r+s._dragDetails.splitAreaSize-(s._dragDetails.secondItem._sizeLimits[s._measurements.minDimension]||0)+s._dragDetails.lockedItemsSize+s._dragDetails.firstItem._paddings,e[s._measurements.pagePosition]-i)),s._dragDetails.firstItem._sizeLimits[s._measurements.maxDimension]&&(s._dragDetails.position=Math.min(r+s._dragDetails.firstItem._sizeLimits[s._measurements.maxDimension],s._dragDetails.position))}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.tabIndex>0?e.tabIndex:0}_setDragDetails(e,t){const i=this;if(i._dragDetails={},i._measurements||i._setMeasurements(),i._dragDetails.scrollAmount=e.parentElement[i._measurements.scroll],i._dragDetails.lockedItemsSize=0,i.setAttribute("show-locked-items",""),!(i._dragDetails.firstItem=i._getTargetItem(e,"previousElementSibling")))return delete i._dragDetails,void i.setAttribute("dragging-not-allowed","");i._dragDetails.firstItem.set("size",""),i._dragDetails.firstItem.currentSize=i._dragDetails.firstItem[i._measurements.size],i._dragDetails.firstItem.originalSize=i._dragDetails.firstItem.currentSize;let s,n=getComputedStyle(i._dragDetails.firstItem);if(i._dragDetails.firstItem._paddings=(parseFloat(n.getPropertyValue("padding-"+i._measurements.position))||0)+(parseFloat(n.getPropertyValue("padding-"+i._measurements.position2))||0),i._dragDetails.firstItem.currentSize-=i._dragDetails.firstItem._paddings,i._dragDetails.splitAreaSize=0,i._dragDetails.secondItemTotalMaxSize=0,i._dragDetails.secondItemTotalMinSize=0,"proportional"===i.resizeMode){if(i._setProportionalDetails())return}else if(i._setAdjacentOrEndDetails(e))return;t&&"object"==typeof t?s=e.getBoundingClientRect()[i._measurements.position]:(t={pageX:e[i._measurements.offset],pageY:e[i._measurements.offset]},s=e[i._measurements.offset]),i._dragDetails.position=t[i._measurements.pagePosition],i._dragDetails.splitBarOffset=i._dragDetails.position-s,i.liveResize||(i._splitBarDummy||(i._splitBarDummy=document.createElement("div"),i._splitBarDummy.classList.add("smart-splitter-bar-feedback"),i._splitBarDummy.setAttribute(i.orientation,"")),i._splitBarDummy.style.width=e.offsetWidth+"px",i._splitBarDummy.style.height=e.offsetHeight+"px",i._splitBarDummy.style.top=e.offsetTop+"px",i._splitBarDummy.style.left=e.offsetLeft+"px",i._splitBarDummy.setAttribute(i.orientation,""),e.parentElement.appendChild(i._splitBarDummy))}_setAdjacentOrEndDetails(e){const t=this;if(!(t._dragDetails.secondItem="adjacent"===t.resizeMode?t._getTargetItem(e,"nextElementSibling"):t._getTargetItem(e,"previousElementSibling",!0)))return delete t._dragDetails,t.setAttribute("dragging-not-allowed",""),!0;t._dragDetails.secondItem.set("size",""),t._dragDetails.secondItem.currentSize=t._dragDetails.secondItem[t._measurements.size],t._dragDetails.secondItem.originalSize=t._dragDetails.secondItem.currentSize;const i=getComputedStyle(t._dragDetails.secondItem);t._dragDetails.secondItem._paddings=(parseFloat(i.getPropertyValue("padding-"+t._measurements.position))||0)+(parseFloat(i.getPropertyValue("padding-"+t._measurements.position2))||0),t._dragDetails.secondItem.currentSize-=t._dragDetails.secondItem._paddings,t._dragDetails.splitAreaSize=t._dragDetails.firstItem.currentSize+t._dragDetails.secondItem.currentSize,t._dragDetails.secondItemTotalMaxSize=t._dragDetails.secondItem._sizeLimits[t._measurements.maxDimension],t._dragDetails.secondItemTotalMinSize=t._dragDetails.secondItem._sizeLimits[t._measurements.minDimension]}_setMeasurements(){const e=this;e._measurements={},"horizontal"===e.orientation?(e._measurements.dimension="height",e._measurements.minDimension="minHeight",e._measurements.maxDimension="maxHeight",e._measurements.restricredDimension="Width",e._measurements.size="offsetHeight",e._measurements.offset="offsetTop",e._measurements.position="top",e._measurements.position2="bottom",e._measurements.pagePosition="pageY",e._measurements.scroll="scrollTop"):(e._measurements.dimension="width",e._measurements.minDimension="minWidth",e._measurements.maxDimension="maxWidth",e._measurements.restricredDimension="Height",e._measurements.size="offsetWidth",e._measurements.offset="offsetLeft",e._measurements.position="left",e._measurements.position2="right",e._measurements.pagePosition="pageX",e._measurements.scroll="scrollLeft"),e._measurements.overflow=getComputedStyle(e).getPropertyValue("overflow")}_setProportionalDetails(){const e=this;if(e._dragDetails.secondItem=e._items.slice(e._items.indexOf(e._dragDetails.firstItem)+1).filter((e=>!e.collapsed&&!e.locked)),0===e._dragDetails.secondItem.length)return delete e._dragDetails,!0;let t;e._dragDetails.splitAreaSize+=e._dragDetails.firstItem.currentSize,e._dragDetails.itemProportions=[];for(let i=0;i<e._dragDetails.secondItem.length;i++){e._dragDetails.secondItem[i].set("size",""),e._dragDetails.secondItem[i].currentSize=e._dragDetails.secondItem[i][e._measurements.size],e._dragDetails.secondItem[i].originalSize=e._dragDetails.secondItem[i].currentSize;const s=getComputedStyle(e._dragDetails.secondItem[i]);e._dragDetails.secondItem[i]._paddings=(parseFloat(s.getPropertyValue("padding-"+e._measurements.position))||0)+(parseFloat(s.getPropertyValue("padding-"+e._measurements.position2))||0),e._dragDetails.secondItem[i].currentSize-=e._dragDetails.secondItem[i]._paddings,e._dragDetails.splitAreaSize+=e._dragDetails.secondItem[i].currentSize,e._dragDetails.itemProportions.push({item:e._dragDetails.secondItem[i],currentSize:e._dragDetails.secondItem[i].currentSize}),e._dragDetails.secondItem[i]._sizeLimits[e._measurements.maxDimension]||(t=!0),e._dragDetails.secondItemTotalMinSize+=e._dragDetails.secondItem[i]._sizeLimits[e._measurements.minDimension],e._dragDetails.secondItemTotalMaxSize+=e._dragDetails.secondItem[i]._sizeLimits[e._measurements.maxDimension]}t&&(e._dragDetails.secondItemTotalMaxSize=0)}_validateBarsSize(){const e=this;if("100%"!==(getComputedStyle(e).getPropertyValue("--smart-splitter-bar-fit-size")+"").trim())return void e.bars.forEach((t=>t.style[e._measurements.restricredDimension.toLowerCase()]=null));if(!e._dragDetails&&"vertical"===e.orientation&&e.resizeTrigger){const t=e.offsetHeight;if(e.resizeTrigger.style.display="none",e.offsetHeight===t)return e.resizeTrigger.style.display=null,void e.bars.forEach((t=>t.style[e._measurements.restricredDimension.toLowerCase()]=null));e.resizeTrigger.style.display=null}let t=e._items[0];const i="offset"+e._measurements.restricredDimension,s=e.bars;if(0!==s.length){for(let s=0;s<e._items.length;s++)e._items[s][i]>t[i]&&(t=e._items[s]);t&&t[i]!==s[0][i]&&s.forEach((s=>s.style[e._measurements.restricredDimension.toLowerCase()]=t[i]+"px"))}}_validateItemSize(e){const t=this;if("overflow"===t.autoFitMode)return void t._validateBarsSize();const i=t._items,s=t._measurements.dimension,n="offset"+("width"===s?"Width":"Height"),a=t.$.container[n],r=e=>"string"==typeof e&&e.indexOf("%")>-1;let o=0;for(let e=0;e<i.length;e++){const l=i[e];if(l.min&&r(l.min)&&(l._sizeLimits[t._measurements.minDimension]=parseFloat(l.min)*a/100),l.max&&r(l.max)&&(l._sizeLimits[t._measurements.maxDimension]=parseFloat(l.max)*a/100),!l.collapsed){const e=l.style[s];o+=e&&e.indexOf("%")<-1&&l._sizeBeforeCollapse?l._sizeBeforeCollapse:l[n]}}if(t.keepProportionsOnResize&&t._resizeEventFired)t._keepItemProportionsOnResize();else{if("horizontal"===t.orientation&&t.resizeTrigger){const e=t.offsetHeight;if(t.resizeTrigger.style.display="none",t.offsetHeight!==e)return void(t.resizeTrigger.style.display=null);t.resizeTrigger.style.display=null}let i=o+t.bars.reduce(((e,i)=>e+i[t._measurements.size]),0)-a;i>0?t._validateItemsSizeOverflowing(i,e):i<0&&t._validateItemsSizeUnderflowing(i,e)}if(t._autoFitItems(),t._validateBarsSize(),t._splitterSize=a,t.enableShadowDOM){const e=t.getRootNode().host;e&&e.enableShadowDOM&&e.isCompleted&&e._validateItemSize&&e._validateItemSize()}}_validateNeighbourSizeLimits(e){const t=this;function i(e){e&&(e.min&&e._setSize("min",e.min,!0),e.max&&e._setSize("max",e.max,!0))}if(!t._items||!t._items.length)return;t._noNeighbourValidation=!0;const s=t._items.indexOf(e);i(t._items[s-1]),i(t._items[s+1]),delete t._noNeighbourValidation}_keepItemProportionsOnResize(){const e=this;let t=0,i=[];for(let s=0;s<e._items.length;s++)e._items[s].collapsed||(i.push(e._items[s]),t+=e._items[s]._sizeBeforeCollapse||e._items[s][e._measurements.size]);if(e._splitterSize&&(t=e._splitterSize),1===e._items.length)return;const s=e.$.container.getBoundingClientRect()[e._measurements.dimension];for(let n=0;n<i.length;n++){const a=i[n],r=a.style[e._measurements.dimension],o=a.style[e._measurements.minDimension];if(r.indexOf("%")>-1||o.indexOf("%")>-1){e._validateItemLimits(a,a[e._measurements.size]/t*s);continue}const l=a._sizeBeforeCollapse||a[e._measurements.size],m=l/t*s;if(l!==m){if(a.style[e._measurements.dimension]=m+"px",s!==e.$.container.getBoundingClientRect()[e._measurements.dimension])return void(a.style[e._measurements.dimension]=l+"px");a.style[e._measurements.dimension]=(a._sizeBeforeCollapse=m)+"px",e._validateItemLimits(a,m)}}}_validateItemsSizeOverflowing(e,t){const i=this,s=i._items.length;let n,a,r,o,l=0,m=[],d="offset"+("width"===i._measurements.dimension?"Width":"Height"),_=i.$.container;for(let e=0;e<i._items.length;e++){const t=i._items[e];r=t.style[i._measurements.dimension],r||(r=window.getComputedStyle(i).getPropertyValue("--smart-splitter-item-size")||""),a=r.indexOf("%")>-1?r:t[i._measurements.size],r||t.size||0===t.size||delete t._originalSize;const s="auto"===a&&t.size&&isNaN(parseFloat(t.size))||"auto"===t.size;t._originalSize=t._originalSize&&!s?t._originalSize:a,m.push(t.locked)}m.indexOf(!1)<0&&(o=i._items[i._items.length-1],o.locked=!1);for(let t=s-1;t>=0;t--){const s=i._items[t];s.collapsed||s.locked||0===e||((s._originalSize+"").indexOf("%")>-1?(n=s.style[i._measurements.dimension]||s[i._measurements.size],"string"==typeof n&&n.indexOf("%")>-1&&(n=parseFloat(n)/100*_[d]),s.style[i._measurements.dimension]=s._originalSize,s._sizeBeforeCollapse=_[d]*parseFloat(s._originalSize)/100,e-=parseFloat(n)-s._sizeBeforeCollapse):(n=s[d],l=n-e,s.style[i._measurements.dimension]=(s._sizeBeforeCollapse=Math.max(s._sizeLimits?s._sizeLimits[i._measurements.minDimension]:0,l))+"px",e-=n-s._sizeBeforeCollapse))}if(e>0)for(let a=s-1;a>=0;a--){const s=i._items[a];if(s.collapsed||s.locked)continue;n=s[d],l=n-e;let r=s._sizeLimits[i._measurements.minDimension]||s.min;r&&(r=(r+"").indexOf("%")>-1?parseFloat(r)/100*s.parentElement[i._measurements.size]:parseFloat(r),r>l&&(s._sizeLimits.ignoreUpdate=!t,s.style[i._measurements.minDimension]=Math.max(0,l)+"px")),0===e&&s._originalSize&&(s._originalSize+"").indexOf("%")>-1||(s._sizeLimits.ignoreUpdate=!t,s.style[i._measurements.dimension]=(s._sizeBeforeCollapse=Math.max(0,l))+"px",e-=n-s._sizeBeforeCollapse)}o&&(o.locked=!0)}_validateItemsSizeUnderflowing(e,t){const i=this,s=i._items.length;let n,a,r=0;e=Math.abs(e),i._items.length>0&&i._items.map((e=>e.locked)).indexOf(!1)<0&&(a=i._items[i._items.length-1],a.locked=!1);for(let a=0;a<s;a++){const s=i._items[a];if(!(s.collapsed||s[i._measurements.size]>=(s._sizeLimits?s._sizeLimits[i._measurements.minDimension]:0))&&(n=s[i._measurements.size],r=s[i._measurements.size]+e,s[i._measurements.size]<s._sizeLimits[i._measurements.minDimension]&&(s._sizeLimits.ignoreUpdate=!t,s.style[i._measurements.minDimension]=(s._sizeBeforeCollapse=Math.max(0,Math.min(s._sizeLimits[i._measurements.minDimension],r)))+"px"),(e-=(s._sizeBeforeCollapse||s[i._measurements.size])-n)<=0))break}const o=i.$.container["offset"+("width"===i._measurements.dimension?"Width":"Height")];if(e>0)for(let t=0;t<s;t++){const s=i._items[t];let n;if(!s.collapsed&&!s.locked&&void 0!==s._originalSize){if((s._originalSize+"").indexOf("%")>-1){const t=parseFloat(s._originalSize)*o/100;r=Math.min(t,s[i._measurements.size]+e),n=r-s[i._measurements.size],s[i._measurements.minDimension]<s._sizeLimits[i._measurements.minDimension]&&(s.style[i._measurements.minDimension]=Math.min(s._sizeLimits[i._measurements.minDimension],r)+"px"),s.style[i._measurements.dimension]=t===r?s._originalSize:r+"px",s._sizeBeforeCollapse=Math.max(0,r),e-=n}else s[i._measurements.size]>=s._originalSize?(e+=s[i._measurements.size]-s._originalSize,s.style[i._measurements.dimension]=(s._sizeBeforeCollapse=s._originalSize)+"px"):(r=Math.min(s._originalSize,s[i._measurements.size]+e),n=r-s[i._measurements.size],s[i._measurements.minDimension]<s._sizeLimits[i._measurements.minDimension]&&(s.style[i._measurements.minDimension]=Math.min(s._sizeLimits[i._measurements.minDimension],r)+"px"),s.style[i._measurements.dimension]=(s._sizeBeforeCollapse=Math.max(0,Math.min(r,s._originalSize)))+"px",e-=n);if(e<=0)break}}a&&(a.locked=!0)}});