smart-webcomponents 15.0.1 → 15.0.11
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.
- package/bootstrap/source/smart.element.js +1 -1
- package/framework/smart.element.js +1 -1
- package/package.json +1 -1
- package/source/angular/accordion/index.ts +1 -0
- package/source/angular/accordion/public_api.ts +5 -0
- package/source/angular/accordion/smart.accordion.module.ts +13 -0
- package/source/angular/accordion/smart.accordion.ts +370 -0
- package/source/angular/accordion/smart.accordionitem.ts +142 -0
- package/source/angular/accordion/smart.element.ts +104 -0
- package/source/angular/array/index.ts +1 -0
- package/source/angular/array/public_api.ts +3 -0
- package/source/angular/array/smart.array.module.ts +12 -0
- package/source/angular/array/smart.array.ts +817 -0
- package/source/angular/array/smart.element.ts +104 -0
- package/source/angular/barcode/index.ts +1 -0
- package/source/angular/barcode/public_api.ts +3 -0
- package/source/angular/barcode/smart.barcode.module.ts +12 -0
- package/source/angular/barcode/smart.barcode.ts +288 -0
- package/source/angular/barcode/smart.element.ts +104 -0
- package/source/angular/bootstrap/bootstrap.button.ts +160 -0
- package/source/angular/bootstrap/bootstrap.checkbox.ts +165 -0
- package/source/angular/bootstrap/bootstrap.circular.ts +151 -0
- package/source/angular/bootstrap/bootstrap.dropdown.ts +253 -0
- package/source/angular/bootstrap/bootstrap.fileinput.ts +133 -0
- package/source/angular/bootstrap/bootstrap.input.ts +160 -0
- package/source/angular/bootstrap/bootstrap.inputgroup.ts +178 -0
- package/source/angular/bootstrap/bootstrap.modal.ts +204 -0
- package/source/angular/bootstrap/bootstrap.progressbar.ts +151 -0
- package/source/angular/bootstrap/bootstrap.radiobutton.ts +156 -0
- package/source/angular/bootstrap/bootstrap.range.ts +133 -0
- package/source/angular/bootstrap/bootstrap.splitbutton.ts +253 -0
- package/source/angular/bootstrap/bootstrap.switchbutton.ts +165 -0
- package/source/angular/bootstrap/bootstrap.tabs.ts +175 -0
- package/source/angular/bootstrap/bootstrap.textarea.ts +160 -0
- package/source/angular/bootstrap/bootstrap.togglebutton.ts +156 -0
- package/source/angular/bootstrap/index.ts +1 -0
- package/source/angular/bootstrap/public_api.ts +17 -0
- package/source/angular/bootstrap/smart.element.ts +104 -0
- package/source/angular/breadcrumb/index.ts +1 -0
- package/source/angular/breadcrumb/public_api.ts +3 -0
- package/source/angular/breadcrumb/smart.breadcrumb.module.ts +12 -0
- package/source/angular/breadcrumb/smart.breadcrumb.ts +306 -0
- package/source/angular/breadcrumb/smart.element.ts +104 -0
- package/source/angular/button/index.ts +1 -0
- package/source/angular/button/public_api.ts +9 -0
- package/source/angular/button/smart.button.module.ts +15 -0
- package/source/angular/button/smart.button.ts +230 -0
- package/source/angular/button/smart.element.ts +104 -0
- package/source/angular/button/smart.powerbutton.ts +283 -0
- package/source/angular/button/smart.repeatbutton.ts +214 -0
- package/source/angular/button/smart.togglebutton.ts +235 -0
- package/source/angular/buttongroup/index.ts +1 -0
- package/source/angular/buttongroup/public_api.ts +3 -0
- package/source/angular/buttongroup/smart.buttongroup.module.ts +12 -0
- package/source/angular/buttongroup/smart.buttongroup.ts +229 -0
- package/source/angular/buttongroup/smart.element.ts +104 -0
- package/source/angular/calendar/index.ts +1 -0
- package/source/angular/calendar/public_api.ts +3 -0
- package/source/angular/calendar/smart.calendar.module.ts +12 -0
- package/source/angular/calendar/smart.calendar.ts +787 -0
- package/source/angular/calendar/smart.element.ts +104 -0
- package/source/angular/card/index.ts +1 -0
- package/source/angular/card/public_api.ts +3 -0
- package/source/angular/card/smart.card.module.ts +12 -0
- package/source/angular/card/smart.card.ts +220 -0
- package/source/angular/card/smart.element.ts +104 -0
- package/source/angular/cardview/index.ts +1 -0
- package/source/angular/cardview/public_api.ts +3 -0
- package/source/angular/cardview/smart.cardview.module.ts +12 -0
- package/source/angular/cardview/smart.cardview.ts +573 -0
- package/source/angular/cardview/smart.element.ts +104 -0
- package/source/angular/carousel/index.ts +1 -0
- package/source/angular/carousel/public_api.ts +3 -0
- package/source/angular/carousel/smart.carousel.module.ts +12 -0
- package/source/angular/carousel/smart.carousel.ts +414 -0
- package/source/angular/carousel/smart.element.ts +104 -0
- package/source/angular/chart/index.ts +1 -0
- package/source/angular/chart/public_api.ts +3 -0
- package/source/angular/chart/smart.chart.module.ts +12 -0
- package/source/angular/chart/smart.chart.ts +930 -0
- package/source/angular/chart/smart.element.ts +104 -0
- package/source/angular/checkbox/index.ts +1 -0
- package/source/angular/checkbox/public_api.ts +3 -0
- package/source/angular/checkbox/smart.checkbox.module.ts +12 -0
- package/source/angular/checkbox/smart.checkbox.ts +341 -0
- package/source/angular/checkbox/smart.element.ts +104 -0
- package/source/angular/checkinput/index.ts +1 -0
- package/source/angular/checkinput/public_api.ts +3 -0
- package/source/angular/checkinput/smart.checkinput.module.ts +12 -0
- package/source/angular/checkinput/smart.checkinput.ts +497 -0
- package/source/angular/checkinput/smart.element.ts +104 -0
- package/source/angular/chip/index.ts +1 -0
- package/source/angular/chip/public_api.ts +3 -0
- package/source/angular/chip/smart.chip.module.ts +12 -0
- package/source/angular/chip/smart.chip.ts +221 -0
- package/source/angular/chip/smart.element.ts +104 -0
- package/source/angular/colorinput/index.ts +1 -0
- package/source/angular/colorinput/public_api.ts +3 -0
- package/source/angular/colorinput/smart.colorinput.module.ts +12 -0
- package/source/angular/colorinput/smart.colorinput.ts +456 -0
- package/source/angular/colorinput/smart.element.ts +104 -0
- package/source/angular/colorpanel/index.ts +1 -0
- package/source/angular/colorpanel/public_api.ts +3 -0
- package/source/angular/colorpanel/smart.colorpanel.module.ts +12 -0
- package/source/angular/colorpanel/smart.colorpanel.ts +501 -0
- package/source/angular/colorpanel/smart.element.ts +104 -0
- package/source/angular/colorpicker/index.ts +1 -0
- package/source/angular/colorpicker/public_api.ts +3 -0
- package/source/angular/colorpicker/smart.colorpicker.module.ts +12 -0
- package/source/angular/colorpicker/smart.colorpicker.ts +756 -0
- package/source/angular/colorpicker/smart.element.ts +104 -0
- package/source/angular/columnpanel/index.ts +1 -0
- package/source/angular/columnpanel/public_api.ts +3 -0
- package/source/angular/columnpanel/smart.columnpanel.module.ts +12 -0
- package/source/angular/columnpanel/smart.columnpanel.ts +183 -0
- package/source/angular/columnpanel/smart.element.ts +104 -0
- package/source/angular/combobox/index.ts +1 -0
- package/source/angular/combobox/public_api.ts +7 -0
- package/source/angular/combobox/smart.combobox.module.ts +14 -0
- package/source/angular/combobox/smart.combobox.ts +1125 -0
- package/source/angular/combobox/smart.element.ts +104 -0
- package/source/angular/combobox/smart.listitem.ts +162 -0
- package/source/angular/combobox/smart.listitemsgroup.ts +72 -0
- package/source/angular/countryinput/index.ts +1 -0
- package/source/angular/countryinput/public_api.ts +3 -0
- package/source/angular/countryinput/smart.countryinput.module.ts +12 -0
- package/source/angular/countryinput/smart.countryinput.ts +391 -0
- package/source/angular/countryinput/smart.element.ts +104 -0
- package/source/angular/customizationdialog/index.ts +1 -0
- package/source/angular/customizationdialog/public_api.ts +3 -0
- package/source/angular/customizationdialog/smart.customizationdialog.module.ts +12 -0
- package/source/angular/customizationdialog/smart.customizationdialog.ts +311 -0
- package/source/angular/customizationdialog/smart.element.ts +104 -0
- package/source/angular/dateinput/index.ts +1 -0
- package/source/angular/dateinput/public_api.ts +3 -0
- package/source/angular/dateinput/smart.dateinput.module.ts +12 -0
- package/source/angular/dateinput/smart.dateinput.ts +465 -0
- package/source/angular/dateinput/smart.element.ts +104 -0
- package/source/angular/daterangeinput/index.ts +1 -0
- package/source/angular/daterangeinput/public_api.ts +3 -0
- package/source/angular/daterangeinput/smart.daterangeinput.module.ts +12 -0
- package/source/angular/daterangeinput/smart.daterangeinput.ts +456 -0
- package/source/angular/daterangeinput/smart.element.ts +104 -0
- package/source/angular/datetimepicker/index.ts +1 -0
- package/source/angular/datetimepicker/public_api.ts +3 -0
- package/source/angular/datetimepicker/smart.datetimepicker.module.ts +12 -0
- package/source/angular/datetimepicker/smart.datetimepicker.ts +835 -0
- package/source/angular/datetimepicker/smart.element.ts +104 -0
- package/source/angular/dockinglayout/index.ts +1 -0
- package/source/angular/dockinglayout/public_api.ts +3 -0
- package/source/angular/dockinglayout/smart.dockinglayout.module.ts +12 -0
- package/source/angular/dockinglayout/smart.dockinglayout.ts +866 -0
- package/source/angular/dockinglayout/smart.element.ts +104 -0
- package/source/angular/dropdownbutton/index.ts +1 -0
- package/source/angular/dropdownbutton/public_api.ts +3 -0
- package/source/angular/dropdownbutton/smart.dropdownbutton.module.ts +12 -0
- package/source/angular/dropdownbutton/smart.dropdownbutton.ts +542 -0
- package/source/angular/dropdownbutton/smart.element.ts +104 -0
- package/source/angular/dropdownlist/index.ts +1 -0
- package/source/angular/dropdownlist/public_api.ts +7 -0
- package/source/angular/dropdownlist/smart.dropdownlist.module.ts +14 -0
- package/source/angular/dropdownlist/smart.dropdownlist.ts +1082 -0
- package/source/angular/dropdownlist/smart.element.ts +104 -0
- package/source/angular/dropdownlist/smart.listitem.ts +162 -0
- package/source/angular/dropdownlist/smart.listitemsgroup.ts +72 -0
- package/source/angular/editor/index.ts +1 -0
- package/source/angular/editor/public_api.ts +3 -0
- package/source/angular/editor/smart.editor.module.ts +12 -0
- package/source/angular/editor/smart.editor.ts +1307 -0
- package/source/angular/editor/smart.element.ts +104 -0
- package/source/angular/element/index.ts +1 -0
- package/source/angular/element/public_api.ts +3 -0
- package/source/angular/element/smart.element.module.ts +10 -0
- package/source/angular/element/smart.element.ts +104 -0
- package/source/angular/fileupload/index.ts +1 -0
- package/source/angular/fileupload/public_api.ts +3 -0
- package/source/angular/fileupload/smart.element.ts +104 -0
- package/source/angular/fileupload/smart.fileupload.module.ts +12 -0
- package/source/angular/fileupload/smart.fileupload.ts +517 -0
- package/source/angular/filterbuilder/index.ts +1 -0
- package/source/angular/filterbuilder/public_api.ts +3 -0
- package/source/angular/filterbuilder/smart.element.ts +104 -0
- package/source/angular/filterbuilder/smart.filterbuilder.module.ts +12 -0
- package/source/angular/filterbuilder/smart.filterbuilder.ts +506 -0
- package/source/angular/filterpanel/index.ts +1 -0
- package/source/angular/filterpanel/public_api.ts +3 -0
- package/source/angular/filterpanel/smart.element.ts +104 -0
- package/source/angular/filterpanel/smart.filterpanel.module.ts +12 -0
- package/source/angular/filterpanel/smart.filterpanel.ts +334 -0
- package/source/angular/form/index.ts +1 -0
- package/source/angular/form/public_api.ts +7 -0
- package/source/angular/form/smart.element.ts +104 -0
- package/source/angular/form/smart.form.module.ts +14 -0
- package/source/angular/form/smart.form.ts +288 -0
- package/source/angular/form/smart.formcontrol.ts +336 -0
- package/source/angular/form/smart.formgroup.ts +220 -0
- package/source/angular/ganttchart/index.ts +1 -0
- package/source/angular/ganttchart/public_api.ts +3 -0
- package/source/angular/ganttchart/smart.element.ts +104 -0
- package/source/angular/ganttchart/smart.ganttchart.module.ts +12 -0
- package/source/angular/ganttchart/smart.ganttchart.ts +2142 -0
- package/source/angular/gauge/index.ts +1 -0
- package/source/angular/gauge/public_api.ts +3 -0
- package/source/angular/gauge/smart.element.ts +104 -0
- package/source/angular/gauge/smart.gauge.module.ts +12 -0
- package/source/angular/gauge/smart.gauge.ts +650 -0
- package/source/angular/grid/index.ts +1 -0
- package/source/angular/grid/public_api.ts +3 -0
- package/source/angular/grid/smart.element.ts +104 -0
- package/source/angular/grid/smart.grid.module.ts +12 -0
- package/source/angular/grid/smart.grid.ts +3091 -0
- package/source/angular/grouppanel/index.ts +1 -0
- package/source/angular/grouppanel/public_api.ts +3 -0
- package/source/angular/grouppanel/smart.element.ts +104 -0
- package/source/angular/grouppanel/smart.grouppanel.module.ts +12 -0
- package/source/angular/grouppanel/smart.grouppanel.ts +220 -0
- package/source/angular/index.d.ts +32978 -0
- package/source/angular/input/index.ts +1 -0
- package/source/angular/input/public_api.ts +3 -0
- package/source/angular/input/smart.element.ts +104 -0
- package/source/angular/input/smart.input.module.ts +12 -0
- package/source/angular/input/smart.input.ts +590 -0
- package/source/angular/kanban/index.ts +1 -0
- package/source/angular/kanban/public_api.ts +3 -0
- package/source/angular/kanban/smart.element.ts +104 -0
- package/source/angular/kanban/smart.kanban.module.ts +12 -0
- package/source/angular/kanban/smart.kanban.ts +1682 -0
- package/source/angular/layout/index.ts +1 -0
- package/source/angular/layout/public_api.ts +11 -0
- package/source/angular/layout/smart.element.ts +104 -0
- package/source/angular/layout/smart.layout.module.ts +16 -0
- package/source/angular/layout/smart.layout.ts +363 -0
- package/source/angular/layout/smart.layoutgroup.ts +140 -0
- package/source/angular/layout/smart.layoutitem.ts +129 -0
- package/source/angular/layout/smart.tablayoutgroup.ts +147 -0
- package/source/angular/layout/smart.tablayoutitem.ts +138 -0
- package/source/angular/led/index.ts +1 -0
- package/source/angular/led/public_api.ts +3 -0
- package/source/angular/led/smart.element.ts +104 -0
- package/source/angular/led/smart.led.module.ts +12 -0
- package/source/angular/led/smart.led.ts +280 -0
- package/source/angular/listbox/index.ts +1 -0
- package/source/angular/listbox/public_api.ts +7 -0
- package/source/angular/listbox/smart.element.ts +104 -0
- package/source/angular/listbox/smart.listbox.module.ts +14 -0
- package/source/angular/listbox/smart.listbox.ts +1007 -0
- package/source/angular/listbox/smart.listitem.ts +162 -0
- package/source/angular/listbox/smart.listitemsgroup.ts +72 -0
- package/source/angular/listmenu/index.ts +1 -0
- package/source/angular/listmenu/public_api.ts +7 -0
- package/source/angular/listmenu/smart.element.ts +104 -0
- package/source/angular/listmenu/smart.listmenu.module.ts +14 -0
- package/source/angular/listmenu/smart.listmenu.ts +597 -0
- package/source/angular/listmenu/smart.menuitem.ts +126 -0
- package/source/angular/listmenu/smart.menuitemsgroup.ts +153 -0
- package/source/angular/map/index.ts +1 -0
- package/source/angular/map/public_api.ts +3 -0
- package/source/angular/map/smart.element.ts +104 -0
- package/source/angular/map/smart.map.module.ts +12 -0
- package/source/angular/map/smart.map.ts +128 -0
- package/source/angular/maskedtextbox/index.ts +1 -0
- package/source/angular/maskedtextbox/public_api.ts +3 -0
- package/source/angular/maskedtextbox/smart.element.ts +104 -0
- package/source/angular/maskedtextbox/smart.maskedtextbox.module.ts +12 -0
- package/source/angular/maskedtextbox/smart.maskedtextbox.ts +539 -0
- package/source/angular/menu/index.ts +1 -0
- package/source/angular/menu/public_api.ts +7 -0
- package/source/angular/menu/smart.element.ts +104 -0
- package/source/angular/menu/smart.menu.module.ts +14 -0
- package/source/angular/menu/smart.menu.ts +695 -0
- package/source/angular/menu/smart.menuitem.ts +126 -0
- package/source/angular/menu/smart.menuitemsgroup.ts +153 -0
- package/source/angular/multicolumnfilterpanel/index.ts +1 -0
- package/source/angular/multicolumnfilterpanel/public_api.ts +3 -0
- package/source/angular/multicolumnfilterpanel/smart.element.ts +104 -0
- package/source/angular/multicolumnfilterpanel/smart.multicolumnfilterpanel.module.ts +12 -0
- package/source/angular/multicolumnfilterpanel/smart.multicolumnfilterpanel.ts +256 -0
- package/source/angular/multicomboinput/index.ts +1 -0
- package/source/angular/multicomboinput/public_api.ts +3 -0
- package/source/angular/multicomboinput/smart.element.ts +104 -0
- package/source/angular/multicomboinput/smart.multicomboinput.module.ts +12 -0
- package/source/angular/multicomboinput/smart.multicomboinput.ts +542 -0
- package/source/angular/multiinput/index.ts +1 -0
- package/source/angular/multiinput/public_api.ts +3 -0
- package/source/angular/multiinput/smart.element.ts +104 -0
- package/source/angular/multiinput/smart.multiinput.module.ts +12 -0
- package/source/angular/multiinput/smart.multiinput.ts +497 -0
- package/source/angular/multilinetextbox/index.ts +1 -0
- package/source/angular/multilinetextbox/public_api.ts +7 -0
- package/source/angular/multilinetextbox/smart.element.ts +104 -0
- package/source/angular/multilinetextbox/smart.listitem.ts +162 -0
- package/source/angular/multilinetextbox/smart.listitemsgroup.ts +72 -0
- package/source/angular/multilinetextbox/smart.multilinetextbox.module.ts +14 -0
- package/source/angular/multilinetextbox/smart.multilinetextbox.ts +561 -0
- package/source/angular/multisplitbutton/index.ts +1 -0
- package/source/angular/multisplitbutton/public_api.ts +7 -0
- package/source/angular/multisplitbutton/smart.element.ts +104 -0
- package/source/angular/multisplitbutton/smart.listitem.ts +162 -0
- package/source/angular/multisplitbutton/smart.listitemsgroup.ts +72 -0
- package/source/angular/multisplitbutton/smart.multisplitbutton.module.ts +14 -0
- package/source/angular/multisplitbutton/smart.multisplitbutton.ts +620 -0
- package/source/angular/numberinput/index.ts +1 -0
- package/source/angular/numberinput/public_api.ts +3 -0
- package/source/angular/numberinput/smart.element.ts +104 -0
- package/source/angular/numberinput/smart.numberinput.module.ts +12 -0
- package/source/angular/numberinput/smart.numberinput.ts +398 -0
- package/source/angular/numerictextbox/index.ts +1 -0
- package/source/angular/numerictextbox/public_api.ts +3 -0
- package/source/angular/numerictextbox/smart.element.ts +104 -0
- package/source/angular/numerictextbox/smart.numerictextbox.module.ts +12 -0
- package/source/angular/numerictextbox/smart.numerictextbox.ts +644 -0
- package/source/angular/pager/index.ts +1 -0
- package/source/angular/pager/public_api.ts +3 -0
- package/source/angular/pager/smart.element.ts +104 -0
- package/source/angular/pager/smart.pager.module.ts +12 -0
- package/source/angular/pager/smart.pager.ts +386 -0
- package/source/angular/passwordinput/index.ts +1 -0
- package/source/angular/passwordinput/public_api.ts +3 -0
- package/source/angular/passwordinput/smart.element.ts +104 -0
- package/source/angular/passwordinput/smart.passwordinput.module.ts +12 -0
- package/source/angular/passwordinput/smart.passwordinput.ts +218 -0
- package/source/angular/passwordtextbox/index.ts +1 -0
- package/source/angular/passwordtextbox/public_api.ts +3 -0
- package/source/angular/passwordtextbox/smart.element.ts +104 -0
- package/source/angular/passwordtextbox/smart.passwordtextbox.module.ts +12 -0
- package/source/angular/passwordtextbox/smart.passwordtextbox.ts +463 -0
- package/source/angular/path/index.ts +1 -0
- package/source/angular/path/public_api.ts +3 -0
- package/source/angular/path/smart.element.ts +104 -0
- package/source/angular/path/smart.path.module.ts +12 -0
- package/source/angular/path/smart.path.ts +491 -0
- package/source/angular/phoneinput/index.ts +1 -0
- package/source/angular/phoneinput/public_api.ts +3 -0
- package/source/angular/phoneinput/smart.element.ts +104 -0
- package/source/angular/phoneinput/smart.phoneinput.module.ts +12 -0
- package/source/angular/phoneinput/smart.phoneinput.ts +493 -0
- package/source/angular/pivottable/index.ts +1 -0
- package/source/angular/pivottable/public_api.ts +3 -0
- package/source/angular/pivottable/smart.element.ts +104 -0
- package/source/angular/pivottable/smart.pivottable.module.ts +12 -0
- package/source/angular/pivottable/smart.pivottable.ts +840 -0
- package/source/angular/progressbar/index.ts +1 -0
- package/source/angular/progressbar/public_api.ts +5 -0
- package/source/angular/progressbar/smart.circularprogressbar.ts +223 -0
- package/source/angular/progressbar/smart.element.ts +104 -0
- package/source/angular/progressbar/smart.progressbar.module.ts +13 -0
- package/source/angular/progressbar/smart.progressbar.ts +235 -0
- package/source/angular/qrcode/index.ts +1 -0
- package/source/angular/qrcode/public_api.ts +3 -0
- package/source/angular/qrcode/smart.element.ts +104 -0
- package/source/angular/qrcode/smart.qrcode.module.ts +12 -0
- package/source/angular/qrcode/smart.qrcode.ts +306 -0
- package/source/angular/querybuilder/index.ts +1 -0
- package/source/angular/querybuilder/public_api.ts +3 -0
- package/source/angular/querybuilder/smart.element.ts +104 -0
- package/source/angular/querybuilder/smart.querybuilder.module.ts +12 -0
- package/source/angular/querybuilder/smart.querybuilder.ts +460 -0
- package/source/angular/radiobutton/index.ts +1 -0
- package/source/angular/radiobutton/public_api.ts +3 -0
- package/source/angular/radiobutton/smart.element.ts +104 -0
- package/source/angular/radiobutton/smart.radiobutton.module.ts +12 -0
- package/source/angular/radiobutton/smart.radiobutton.ts +350 -0
- package/source/angular/rating/index.ts +1 -0
- package/source/angular/rating/public_api.ts +3 -0
- package/source/angular/rating/smart.element.ts +104 -0
- package/source/angular/rating/smart.rating.module.ts +12 -0
- package/source/angular/rating/smart.rating.ts +309 -0
- package/source/angular/scheduler/index.ts +1 -0
- package/source/angular/scheduler/public_api.ts +3 -0
- package/source/angular/scheduler/smart.element.ts +104 -0
- package/source/angular/scheduler/smart.scheduler.module.ts +12 -0
- package/source/angular/scheduler/smart.scheduler.ts +2328 -0
- package/source/angular/scrollbar/index.ts +1 -0
- package/source/angular/scrollbar/public_api.ts +3 -0
- package/source/angular/scrollbar/smart.element.ts +104 -0
- package/source/angular/scrollbar/smart.scrollbar.module.ts +12 -0
- package/source/angular/scrollbar/smart.scrollbar.ts +260 -0
- package/source/angular/slider/index.ts +1 -0
- package/source/angular/slider/public_api.ts +3 -0
- package/source/angular/slider/smart.element.ts +104 -0
- package/source/angular/slider/smart.slider.module.ts +12 -0
- package/source/angular/slider/smart.slider.ts +632 -0
- package/source/angular/sortable/index.ts +1 -0
- package/source/angular/sortable/public_api.ts +3 -0
- package/source/angular/sortable/smart.element.ts +104 -0
- package/source/angular/sortable/smart.sortable.module.ts +12 -0
- package/source/angular/sortable/smart.sortable.ts +217 -0
- package/source/angular/sortpanel/index.ts +1 -0
- package/source/angular/sortpanel/public_api.ts +3 -0
- package/source/angular/sortpanel/smart.element.ts +104 -0
- package/source/angular/sortpanel/smart.sortpanel.module.ts +12 -0
- package/source/angular/sortpanel/smart.sortpanel.ts +180 -0
- package/source/angular/splitter/index.ts +1 -0
- package/source/angular/splitter/public_api.ts +7 -0
- package/source/angular/splitter/smart.element.ts +104 -0
- package/source/angular/splitter/smart.splitter.module.ts +14 -0
- package/source/angular/splitter/smart.splitter.ts +530 -0
- package/source/angular/splitter/smart.splitterbar.ts +121 -0
- package/source/angular/splitter/smart.splitteritem.ts +192 -0
- package/source/angular/switchbutton/index.ts +1 -0
- package/source/angular/switchbutton/public_api.ts +3 -0
- package/source/angular/switchbutton/smart.element.ts +104 -0
- package/source/angular/switchbutton/smart.switchbutton.module.ts +12 -0
- package/source/angular/switchbutton/smart.switchbutton.ts +386 -0
- package/source/angular/table/index.ts +1 -0
- package/source/angular/table/public_api.ts +3 -0
- package/source/angular/table/smart.element.ts +104 -0
- package/source/angular/table/smart.table.module.ts +12 -0
- package/source/angular/table/smart.table.ts +1493 -0
- package/source/angular/tabs/index.ts +1 -0
- package/source/angular/tabs/public_api.ts +7 -0
- package/source/angular/tabs/smart.element.ts +104 -0
- package/source/angular/tabs/smart.tabitem.ts +126 -0
- package/source/angular/tabs/smart.tabitemsgroup.ts +81 -0
- package/source/angular/tabs/smart.tabs.module.ts +14 -0
- package/source/angular/tabs/smart.tabs.ts +622 -0
- package/source/angular/tank/index.ts +1 -0
- package/source/angular/tank/public_api.ts +3 -0
- package/source/angular/tank/smart.element.ts +104 -0
- package/source/angular/tank/smart.tank.module.ts +12 -0
- package/source/angular/tank/smart.tank.ts +593 -0
- package/source/angular/textarea/index.ts +1 -0
- package/source/angular/textarea/public_api.ts +3 -0
- package/source/angular/textarea/smart.element.ts +104 -0
- package/source/angular/textarea/smart.textarea.module.ts +12 -0
- package/source/angular/textarea/smart.textarea.ts +484 -0
- package/source/angular/textbox/index.ts +1 -0
- package/source/angular/textbox/public_api.ts +7 -0
- package/source/angular/textbox/smart.element.ts +104 -0
- package/source/angular/textbox/smart.listitem.ts +162 -0
- package/source/angular/textbox/smart.listitemsgroup.ts +72 -0
- package/source/angular/textbox/smart.textbox.module.ts +14 -0
- package/source/angular/textbox/smart.textbox.ts +708 -0
- package/source/angular/threedchart/index.ts +1 -0
- package/source/angular/threedchart/public_api.ts +3 -0
- package/source/angular/threedchart/smart.element.ts +104 -0
- package/source/angular/threedchart/smart.threedchart.module.ts +12 -0
- package/source/angular/threedchart/smart.threedchart.ts +1043 -0
- package/source/angular/timeinput/index.ts +1 -0
- package/source/angular/timeinput/public_api.ts +3 -0
- package/source/angular/timeinput/smart.element.ts +104 -0
- package/source/angular/timeinput/smart.timeinput.module.ts +12 -0
- package/source/angular/timeinput/smart.timeinput.ts +427 -0
- package/source/angular/timepicker/index.ts +1 -0
- package/source/angular/timepicker/public_api.ts +3 -0
- package/source/angular/timepicker/smart.element.ts +104 -0
- package/source/angular/timepicker/smart.timepicker.module.ts +12 -0
- package/source/angular/timepicker/smart.timepicker.ts +370 -0
- package/source/angular/toast/index.ts +1 -0
- package/source/angular/toast/public_api.ts +3 -0
- package/source/angular/toast/smart.element.ts +104 -0
- package/source/angular/toast/smart.toast.module.ts +12 -0
- package/source/angular/toast/smart.toast.ts +405 -0
- package/source/angular/tooltip/index.ts +1 -0
- package/source/angular/tooltip/public_api.ts +3 -0
- package/source/angular/tooltip/smart.element.ts +104 -0
- package/source/angular/tooltip/smart.tooltip.module.ts +12 -0
- package/source/angular/tooltip/smart.tooltip.ts +339 -0
- package/source/angular/tree/index.ts +1 -0
- package/source/angular/tree/public_api.ts +7 -0
- package/source/angular/tree/smart.element.ts +104 -0
- package/source/angular/tree/smart.tree.module.ts +14 -0
- package/source/angular/tree/smart.tree.ts +1042 -0
- package/source/angular/tree/smart.treeitem.ts +135 -0
- package/source/angular/tree/smart.treeitemsgroup.ts +135 -0
- package/source/angular/validator/index.ts +1 -0
- package/source/angular/validator/public_api.ts +3 -0
- package/source/angular/validator/smart.element.ts +104 -0
- package/source/angular/validator/smart.validator.module.ts +12 -0
- package/source/angular/validator/smart.validator.ts +124 -0
- package/source/angular/window/index.ts +1 -0
- package/source/angular/window/public_api.ts +3 -0
- package/source/angular/window/smart.element.ts +104 -0
- package/source/angular/window/smart.window.module.ts +12 -0
- package/source/angular/window/smart.window.ts +1180 -0
- package/source/components/smart.ui.chart.js +1 -1
- package/source/components/smart.ui.pivottable.js +1 -1
- package/source/modules/smart.3dchart.js +1 -1
- package/source/modules/smart.accordion.js +1 -1
- package/source/modules/smart.array.js +1 -1
- package/source/modules/smart.barcode.js +1 -1
- package/source/modules/smart.breadcrumb.js +1 -1
- package/source/modules/smart.button.js +1 -1
- package/source/modules/smart.buttongroup.js +1 -1
- package/source/modules/smart.calendar.js +1 -1
- package/source/modules/smart.card.js +1 -1
- package/source/modules/smart.cardview.js +1 -1
- package/source/modules/smart.carousel.js +1 -1
- package/source/modules/smart.chart.js +2 -2
- package/source/modules/smart.checkbox.js +1 -1
- package/source/modules/smart.checkinput.js +1 -1
- package/source/modules/smart.chip.js +1 -1
- package/source/modules/smart.colorinput.js +1 -1
- package/source/modules/smart.colorpanel.js +1 -1
- package/source/modules/smart.colorpicker.js +1 -1
- package/source/modules/smart.combobox.js +1 -1
- package/source/modules/smart.common.js +1 -1
- package/source/modules/smart.countryinput.js +1 -1
- package/source/modules/smart.dateinput.js +1 -1
- package/source/modules/smart.daterangeinput.js +1 -1
- package/source/modules/smart.datetimepicker.js +1 -1
- package/source/modules/smart.dockinglayout.js +1 -1
- package/source/modules/smart.dropdownbutton.js +1 -1
- package/source/modules/smart.dropdownlist.js +1 -1
- package/source/modules/smart.editor.js +1 -1
- package/source/modules/smart.element.js +1 -1
- package/source/modules/smart.fileupload.js +1 -1
- package/source/modules/smart.form.js +1 -1
- package/source/modules/smart.formulaparser.js +1 -1
- package/source/modules/smart.ganttchart.js +1 -1
- package/source/modules/smart.gauge.js +1 -1
- package/source/modules/smart.grid.js +1 -1
- package/source/modules/smart.gridpanel.js +1 -1
- package/source/modules/smart.input.js +1 -1
- package/source/modules/smart.kanban.js +1 -1
- package/source/modules/smart.layout.js +1 -1
- package/source/modules/smart.led.js +1 -1
- package/source/modules/smart.listbox.js +1 -1
- package/source/modules/smart.listmenu.js +1 -1
- package/source/modules/smart.map.js +1 -1
- package/source/modules/smart.maskedtextbox.js +1 -1
- package/source/modules/smart.menu.js +1 -1
- package/source/modules/smart.multicomboinput.js +1 -1
- package/source/modules/smart.multiinput.js +1 -1
- package/source/modules/smart.multilinetextbox.js +1 -1
- package/source/modules/smart.multisplitbutton.js +1 -1
- package/source/modules/smart.numberinput.js +1 -1
- package/source/modules/smart.numerictextbox.js +1 -1
- package/source/modules/smart.pager.js +1 -1
- package/source/modules/smart.passwordinput.js +1 -1
- package/source/modules/smart.passwordtextbox.js +1 -1
- package/source/modules/smart.path.js +1 -1
- package/source/modules/smart.phoneinput.js +1 -1
- package/source/modules/smart.pivottable.js +2 -2
- package/source/modules/smart.progressbar.js +1 -1
- package/source/modules/smart.qrcode.js +1 -1
- package/source/modules/smart.querybuilder.js +1 -1
- package/source/modules/smart.radiobutton.js +1 -1
- package/source/modules/smart.rating.js +1 -1
- package/source/modules/smart.router.js +1 -1
- package/source/modules/smart.scheduler.js +1 -1
- package/source/modules/smart.scrollbar.js +1 -1
- package/source/modules/smart.slider.js +1 -1
- package/source/modules/smart.sortable.js +1 -1
- package/source/modules/smart.splitter.js +1 -1
- package/source/modules/smart.switchbutton.js +1 -1
- package/source/modules/smart.table.js +1 -1
- package/source/modules/smart.tabs.js +1 -1
- package/source/modules/smart.tank.js +1 -1
- package/source/modules/smart.textarea.js +1 -1
- package/source/modules/smart.textbox.js +1 -1
- package/source/modules/smart.timeinput.js +1 -1
- package/source/modules/smart.timepicker.js +1 -1
- package/source/modules/smart.toast.js +1 -1
- package/source/modules/smart.tooltip.js +1 -1
- package/source/modules/smart.tree.js +1 -1
- package/source/modules/smart.validator.js +1 -1
- package/source/modules/smart.window.js +1 -1
- package/source/react/accordion/accordion.jsx +462 -0
- package/source/react/accordion/accordion.tsx +466 -0
- package/source/react/accordion/accordionitem.jsx +211 -0
- package/source/react/accordion/accordionitem.tsx +229 -0
- package/source/react/alertwindow/alertwindow.jsx +1391 -0
- package/source/react/alertwindow/alertwindow.tsx +1349 -0
- package/source/react/array/array.jsx +907 -0
- package/source/react/array/array.tsx +909 -0
- package/source/react/barcode/barcode.jsx +372 -0
- package/source/react/barcode/barcode.tsx +394 -0
- package/source/react/breadcrumb/breadcrumb.jsx +399 -0
- package/source/react/breadcrumb/breadcrumb.tsx +405 -0
- package/source/react/button/button.jsx +331 -0
- package/source/react/button/button.tsx +359 -0
- package/source/react/button/powerbutton.jsx +301 -0
- package/source/react/button/powerbutton.tsx +323 -0
- package/source/react/button/repeatbutton.jsx +325 -0
- package/source/react/button/repeatbutton.tsx +347 -0
- package/source/react/button/togglebutton.jsx +337 -0
- package/source/react/button/togglebutton.tsx +351 -0
- package/source/react/buttongroup/buttongroup.jsx +340 -0
- package/source/react/buttongroup/buttongroup.tsx +362 -0
- package/source/react/calendar/calendar.jsx +868 -0
- package/source/react/calendar/calendar.tsx +866 -0
- package/source/react/card/card.jsx +313 -0
- package/source/react/card/card.tsx +323 -0
- package/source/react/cardview/cardview.jsx +664 -0
- package/source/react/cardview/cardview.tsx +656 -0
- package/source/react/carousel/carousel.jsx +546 -0
- package/source/react/carousel/carousel.tsx +556 -0
- package/source/react/chart/chart.jsx +1014 -0
- package/source/react/chart/chart.tsx +996 -0
- package/source/react/checkbox/checkbox.jsx +361 -0
- package/source/react/checkbox/checkbox.tsx +375 -0
- package/source/react/checkinput/checkinput.jsx +566 -0
- package/source/react/checkinput/checkinput.tsx +588 -0
- package/source/react/chip/chip.jsx +329 -0
- package/source/react/chip/chip.tsx +351 -0
- package/source/react/colorinput/colorinput.jsx +516 -0
- package/source/react/colorinput/colorinput.tsx +538 -0
- package/source/react/colorpanel/colorpanel.jsx +570 -0
- package/source/react/colorpanel/colorpanel.tsx +580 -0
- package/source/react/colorpicker/colorpicker.jsx +846 -0
- package/source/react/colorpicker/colorpicker.tsx +824 -0
- package/source/react/columnpanel/columnpanel.jsx +276 -0
- package/source/react/columnpanel/columnpanel.tsx +294 -0
- package/source/react/combobox/combobox.jsx +1212 -0
- package/source/react/combobox/combobox.tsx +1198 -0
- package/source/react/combobox/listitem.jsx +279 -0
- package/source/react/combobox/listitem.tsx +305 -0
- package/source/react/combobox/listitemsgroup.jsx +159 -0
- package/source/react/combobox/listitemsgroup.tsx +185 -0
- package/source/react/countryinput/countryinput.jsx +409 -0
- package/source/react/countryinput/countryinput.tsx +423 -0
- package/source/react/customizationdialog/customizationdialog.jsx +425 -0
- package/source/react/customizationdialog/customizationdialog.tsx +435 -0
- package/source/react/dateinput/dateinput.jsx +513 -0
- package/source/react/dateinput/dateinput.tsx +535 -0
- package/source/react/daterangeinput/daterangeinput.jsx +516 -0
- package/source/react/daterangeinput/daterangeinput.tsx +538 -0
- package/source/react/datetimepicker/datetimepicker.jsx +967 -0
- package/source/react/datetimepicker/datetimepicker.tsx +973 -0
- package/source/react/dialogwindow/dialogwindow.jsx +1391 -0
- package/source/react/dialogwindow/dialogwindow.tsx +1349 -0
- package/source/react/dockinglayout/dockinglayout.jsx +923 -0
- package/source/react/dockinglayout/dockinglayout.tsx +925 -0
- package/source/react/dropdownbutton/dropdownbutton.jsx +665 -0
- package/source/react/dropdownbutton/dropdownbutton.tsx +659 -0
- package/source/react/dropdownlist/dropdownlist.jsx +1148 -0
- package/source/react/dropdownlist/dropdownlist.tsx +1130 -0
- package/source/react/dropdownlist/listitem.jsx +279 -0
- package/source/react/dropdownlist/listitem.tsx +305 -0
- package/source/react/dropdownlist/listitemsgroup.jsx +159 -0
- package/source/react/dropdownlist/listitemsgroup.tsx +185 -0
- package/source/react/editor/editor.jsx +1373 -0
- package/source/react/editor/editor.tsx +1287 -0
- package/source/react/element/element.jsx +392 -0
- package/source/react/element/element.tsx +410 -0
- package/source/react/fileupload/fileupload.jsx +643 -0
- package/source/react/fileupload/fileupload.tsx +641 -0
- package/source/react/filterbuilder/filterbuilder.jsx +608 -0
- package/source/react/filterbuilder/filterbuilder.tsx +594 -0
- package/source/react/filterpanel/filterpanel.jsx +433 -0
- package/source/react/filterpanel/filterpanel.tsx +447 -0
- package/source/react/form/form.jsx +383 -0
- package/source/react/form/form.tsx +413 -0
- package/source/react/form/formcontrol.jsx +495 -0
- package/source/react/form/formcontrol.tsx +521 -0
- package/source/react/form/formgroup.jsx +310 -0
- package/source/react/form/formgroup.tsx +336 -0
- package/source/react/ganttchart/ganttchart.jsx +2202 -0
- package/source/react/ganttchart/ganttchart.tsx +2116 -0
- package/source/react/gauge/gauge.jsx +755 -0
- package/source/react/gauge/gauge.tsx +777 -0
- package/source/react/grid/grid.jsx +2906 -0
- package/source/react/grid/grid.tsx +2782 -0
- package/source/react/grouppanel/grouppanel.jsx +313 -0
- package/source/react/grouppanel/grouppanel.tsx +323 -0
- package/source/react/input/input.jsx +626 -0
- package/source/react/input/input.tsx +632 -0
- package/source/react/kanban/kanban.jsx +1824 -0
- package/source/react/kanban/kanban.tsx +1736 -0
- package/source/react/layout/layout.jsx +449 -0
- package/source/react/layout/layout.tsx +451 -0
- package/source/react/layout/layoutgroup.jsx +233 -0
- package/source/react/layout/layoutgroup.tsx +259 -0
- package/source/react/layout/layoutitem.jsx +219 -0
- package/source/react/layout/layoutitem.tsx +245 -0
- package/source/react/layout/tablayoutgroup.jsx +243 -0
- package/source/react/layout/tablayoutgroup.tsx +269 -0
- package/source/react/layout/tablayoutitem.jsx +231 -0
- package/source/react/layout/tablayoutitem.tsx +257 -0
- package/source/react/led/led.jsx +412 -0
- package/source/react/led/led.tsx +434 -0
- package/source/react/listbox/listbox.jsx +1044 -0
- package/source/react/listbox/listbox.tsx +1030 -0
- package/source/react/listbox/listitem.jsx +279 -0
- package/source/react/listbox/listitem.tsx +305 -0
- package/source/react/listbox/listitemsgroup.jsx +159 -0
- package/source/react/listbox/listitemsgroup.tsx +185 -0
- package/source/react/listmenu/listmenu.jsx +740 -0
- package/source/react/listmenu/listmenu.tsx +746 -0
- package/source/react/listmenu/menuitem.jsx +231 -0
- package/source/react/listmenu/menuitem.tsx +257 -0
- package/source/react/listmenu/menuitemsgroup.jsx +267 -0
- package/source/react/listmenu/menuitemsgroup.tsx +293 -0
- package/source/react/map/map.jsx +233 -0
- package/source/react/map/map.tsx +259 -0
- package/source/react/maskedtextbox/maskedtextbox.jsx +617 -0
- package/source/react/maskedtextbox/maskedtextbox.tsx +631 -0
- package/source/react/menu/menu.jsx +817 -0
- package/source/react/menu/menu.tsx +807 -0
- package/source/react/menu/menuitem.jsx +231 -0
- package/source/react/menu/menuitem.tsx +257 -0
- package/source/react/menu/menuitemsgroup.jsx +267 -0
- package/source/react/menu/menuitemsgroup.tsx +293 -0
- package/source/react/multicolumnfilterpanel/multicolumnfilterpanel.jsx +361 -0
- package/source/react/multicolumnfilterpanel/multicolumnfilterpanel.tsx +371 -0
- package/source/react/multicomboinput/multicomboinput.jsx +626 -0
- package/source/react/multicomboinput/multicomboinput.tsx +648 -0
- package/source/react/multiinput/multiinput.jsx +566 -0
- package/source/react/multiinput/multiinput.tsx +588 -0
- package/source/react/multilinetextbox/listitem.jsx +279 -0
- package/source/react/multilinetextbox/listitem.tsx +305 -0
- package/source/react/multilinetextbox/listitemsgroup.jsx +159 -0
- package/source/react/multilinetextbox/listitemsgroup.tsx +185 -0
- package/source/react/multilinetextbox/multilinetextbox.jsx +638 -0
- package/source/react/multilinetextbox/multilinetextbox.tsx +664 -0
- package/source/react/multilinewindow/multilinewindow.jsx +1391 -0
- package/source/react/multilinewindow/multilinewindow.tsx +1349 -0
- package/source/react/multisplitbutton/listitem.jsx +279 -0
- package/source/react/multisplitbutton/listitem.tsx +305 -0
- package/source/react/multisplitbutton/listitemsgroup.jsx +159 -0
- package/source/react/multisplitbutton/listitemsgroup.tsx +185 -0
- package/source/react/multisplitbutton/multisplitbutton.jsx +751 -0
- package/source/react/multisplitbutton/multisplitbutton.tsx +745 -0
- package/source/react/numberinput/numberinput.jsx +413 -0
- package/source/react/numberinput/numberinput.tsx +435 -0
- package/source/react/numerictextbox/numerictextbox.jsx +721 -0
- package/source/react/numerictextbox/numerictextbox.tsx +719 -0
- package/source/react/pager/pager.jsx +524 -0
- package/source/react/pager/pager.tsx +542 -0
- package/source/react/passwordinput/passwordinput.jsx +317 -0
- package/source/react/passwordinput/passwordinput.tsx +335 -0
- package/source/react/passwordtextbox/passwordtextbox.jsx +523 -0
- package/source/react/passwordtextbox/passwordtextbox.tsx +541 -0
- package/source/react/path/path.jsx +629 -0
- package/source/react/path/path.tsx +623 -0
- package/source/react/phoneinput/phoneinput.jsx +481 -0
- package/source/react/phoneinput/phoneinput.tsx +495 -0
- package/source/react/pivottable/pivottable.jsx +990 -0
- package/source/react/pivottable/pivottable.tsx +980 -0
- package/source/react/progressbar/circularprogressbar.jsx +337 -0
- package/source/react/progressbar/circularprogressbar.tsx +359 -0
- package/source/react/progressbar/progressbar.jsx +351 -0
- package/source/react/progressbar/progressbar.tsx +375 -0
- package/source/react/progresswindow/progresswindow.jsx +1391 -0
- package/source/react/progresswindow/progresswindow.tsx +1349 -0
- package/source/react/promptwindow/promptwindow.jsx +1391 -0
- package/source/react/promptwindow/promptwindow.tsx +1349 -0
- package/source/react/qrcode/qrcode.jsx +396 -0
- package/source/react/qrcode/qrcode.tsx +418 -0
- package/source/react/querybuilder/querybuilder.jsx +589 -0
- package/source/react/querybuilder/querybuilder.tsx +587 -0
- package/source/react/radiobutton/radiobutton.jsx +373 -0
- package/source/react/radiobutton/radiobutton.tsx +387 -0
- package/source/react/rating/rating.jsx +315 -0
- package/source/react/rating/rating.tsx +337 -0
- package/source/react/scheduler/scheduler.jsx +2452 -0
- package/source/react/scheduler/scheduler.tsx +2336 -0
- package/source/react/scrollbar/scrollbar.jsx +380 -0
- package/source/react/scrollbar/scrollbar.tsx +402 -0
- package/source/react/slider/slider.jsx +731 -0
- package/source/react/slider/slider.tsx +753 -0
- package/source/react/sortable/sortable.jsx +319 -0
- package/source/react/sortable/sortable.tsx +341 -0
- package/source/react/sortpanel/sortpanel.jsx +273 -0
- package/source/react/sortpanel/sortpanel.tsx +291 -0
- package/source/react/splitter/splitter.jsx +613 -0
- package/source/react/splitter/splitter.tsx +627 -0
- package/source/react/splitter/splitterbar.jsx +205 -0
- package/source/react/splitter/splitterbar.tsx +231 -0
- package/source/react/splitter/splitteritem.jsx +288 -0
- package/source/react/splitter/splitteritem.tsx +314 -0
- package/source/react/switchbutton/switchbutton.jsx +421 -0
- package/source/react/switchbutton/switchbutton.tsx +435 -0
- package/source/react/table/table.jsx +1628 -0
- package/source/react/table/table.tsx +1590 -0
- package/source/react/tabs/tabitem.jsx +219 -0
- package/source/react/tabs/tabitem.tsx +245 -0
- package/source/react/tabs/tabitemsgroup.jsx +171 -0
- package/source/react/tabs/tabitemsgroup.tsx +197 -0
- package/source/react/tabs/tabs.jsx +720 -0
- package/source/react/tabs/tabs.tsx +722 -0
- package/source/react/tabswindow/tabswindow.jsx +1391 -0
- package/source/react/tabswindow/tabswindow.tsx +1349 -0
- package/source/react/tank/tank.jsx +680 -0
- package/source/react/tank/tank.tsx +702 -0
- package/source/react/textarea/textarea.jsx +541 -0
- package/source/react/textarea/textarea.tsx +559 -0
- package/source/react/textbox/listitem.jsx +279 -0
- package/source/react/textbox/listitem.tsx +305 -0
- package/source/react/textbox/listitemsgroup.jsx +159 -0
- package/source/react/textbox/listitemsgroup.tsx +185 -0
- package/source/react/textbox/textbox.jsx +842 -0
- package/source/react/textbox/textbox.tsx +864 -0
- package/source/react/threedchart/threedchart.jsx +1124 -0
- package/source/react/threedchart/threedchart.tsx +1106 -0
- package/source/react/timeinput/timeinput.jsx +463 -0
- package/source/react/timeinput/timeinput.tsx +485 -0
- package/source/react/timepicker/timepicker.jsx +406 -0
- package/source/react/timepicker/timepicker.tsx +428 -0
- package/source/react/toast/toast.jsx +510 -0
- package/source/react/toast/toast.tsx +508 -0
- package/source/react/tooltip/tooltip.jsx +453 -0
- package/source/react/tooltip/tooltip.tsx +463 -0
- package/source/react/tree/tree.jsx +1176 -0
- package/source/react/tree/tree.tsx +1158 -0
- package/source/react/tree/treeitem.jsx +243 -0
- package/source/react/tree/treeitem.tsx +269 -0
- package/source/react/tree/treeitemsgroup.jsx +243 -0
- package/source/react/tree/treeitemsgroup.tsx +269 -0
- package/source/react/validator/validator.jsx +202 -0
- package/source/react/validator/validator.tsx +228 -0
- package/source/react/waitwindow/waitwindow.jsx +1391 -0
- package/source/react/waitwindow/waitwindow.tsx +1349 -0
- package/source/react/window/window.jsx +1375 -0
- package/source/react/window/window.tsx +1349 -0
- package/source/smart.3dchart.js +6 -0
- package/source/smart.accordion.js +6 -0
- package/source/smart.ajax.js +5 -0
- package/source/smart.array.js +6 -0
- package/source/smart.barcode.js +6 -0
- package/source/smart.bootstrap.js +6 -0
- package/source/smart.breadcrumb.js +6 -0
- package/source/smart.button.js +6 -0
- package/source/smart.buttongroup.js +6 -0
- package/source/smart.calendar.js +6 -0
- package/source/smart.card.js +6 -0
- package/source/smart.cardview.js +6 -0
- package/source/smart.carousel.js +6 -0
- package/source/smart.chart.annotations.js +6 -0
- package/source/smart.chart.api.js +6 -0
- package/source/smart.chart.core.js +6 -0
- package/source/smart.chart.js +6 -0
- package/source/smart.chart.rangeselector.js +6 -0
- package/source/smart.chart.waterfall.js +6 -0
- package/source/smart.checkbox.js +6 -0
- package/source/smart.checkinput.js +6 -0
- package/source/smart.chip.js +6 -0
- package/source/smart.colorinput.js +6 -0
- package/source/smart.colorpanel.js +6 -0
- package/source/smart.colorpicker.js +6 -0
- package/source/smart.combobox.js +6 -0
- package/source/smart.complex.js +6 -0
- package/source/smart.core.js +6 -0
- package/source/smart.countryinput.js +6 -0
- package/source/smart.data.js +6 -0
- package/source/smart.date.js +6 -0
- package/source/smart.dateformatpanel.js +6 -0
- package/source/smart.dateinput.js +6 -0
- package/source/smart.daterangeinput.js +6 -0
- package/source/smart.datetimepicker.js +6 -0
- package/source/smart.dockinglayout.js +6 -0
- package/source/smart.draw.js +6 -0
- package/source/smart.dropdownbutton.js +6 -0
- package/source/smart.dropdownlist.js +6 -0
- package/source/smart.editor.js +6 -0
- package/source/smart.element.js +6 -0
- package/source/smart.elements.js +3 -3
- package/source/smart.export.js +6 -0
- package/source/smart.fileupload.js +6 -0
- package/source/smart.filter.js +6 -0
- package/source/smart.filterbuilder.js +6 -0
- package/source/smart.filterpanel.js +6 -0
- package/source/smart.form.js +6 -0
- package/source/smart.format.js +6 -0
- package/source/smart.formulaparser.js +6 -0
- package/source/smart.ganttchart.js +6 -0
- package/source/smart.gauge.js +6 -0
- package/source/smart.grid.cell.js +6 -0
- package/source/smart.grid.chart.js +6 -0
- package/source/smart.grid.column.js +6 -0
- package/source/smart.grid.core.js +6 -0
- package/source/smart.grid.dialog.js +6 -0
- package/source/smart.grid.edit.js +6 -0
- package/source/smart.grid.export.js +6 -0
- package/source/smart.grid.filter.js +6 -0
- package/source/smart.grid.group.js +6 -0
- package/source/smart.grid.js +6 -0
- package/source/smart.grid.menu.js +6 -0
- package/source/smart.grid.pager.js +6 -0
- package/source/smart.grid.reorder.js +6 -0
- package/source/smart.grid.resize.js +6 -0
- package/source/smart.grid.row.js +6 -0
- package/source/smart.grid.select.js +6 -0
- package/source/smart.grid.sort.js +6 -0
- package/source/smart.grid.toolbar.js +6 -0
- package/source/smart.grid.tree.js +6 -0
- package/source/smart.grid.view.js +6 -0
- package/source/smart.gridpanel.js +6 -0
- package/source/smart.input.js +6 -0
- package/source/smart.kanban.js +6 -0
- package/source/smart.layout.js +6 -0
- package/source/smart.led.js +6 -0
- package/source/smart.listbox.js +6 -0
- package/source/smart.listmenu.js +6 -0
- package/source/smart.map.js +6 -0
- package/source/smart.maskedtextbox.js +6 -0
- package/source/smart.math.js +6 -0
- package/source/smart.menu.js +6 -0
- package/source/smart.multicomboinput.js +6 -0
- package/source/smart.multiinput.js +6 -0
- package/source/smart.multilinetextbox.js +6 -0
- package/source/smart.multisplitbutton.js +6 -0
- package/source/smart.numberformatpanel.js +6 -0
- package/source/smart.numberinput.js +6 -0
- package/source/smart.numeric.js +6 -0
- package/source/smart.numerictextbox.js +6 -0
- package/source/smart.pager.js +6 -0
- package/source/smart.passwordinput.js +6 -0
- package/source/smart.passwordtextbox.js +6 -0
- package/source/smart.path.js +6 -0
- package/source/smart.phoneinput.js +6 -0
- package/source/smart.pivottable.js +6 -0
- package/source/smart.powerbutton.js +6 -0
- package/source/smart.progressbar.js +6 -0
- package/source/smart.qrcode.js +6 -0
- package/source/smart.radiobutton.js +6 -0
- package/source/smart.rating.js +6 -0
- package/source/smart.router.js +6 -0
- package/source/smart.scheduler.js +6 -0
- package/source/smart.scrollbar.js +6 -0
- package/source/smart.slider.js +6 -0
- package/source/smart.sortable.js +6 -0
- package/source/smart.splitter.js +6 -0
- package/source/smart.switchbutton.js +6 -0
- package/source/smart.table.js +6 -0
- package/source/smart.tabs.js +6 -0
- package/source/smart.tank.js +6 -0
- package/source/smart.textarea.js +6 -0
- package/source/smart.textbox.js +6 -0
- package/source/smart.tickintervalhandler.js +6 -0
- package/source/smart.timeinput.js +6 -0
- package/source/smart.timepicker.js +6 -0
- package/source/smart.toast.js +6 -0
- package/source/smart.tooltip.js +6 -0
- package/source/smart.tree.js +6 -0
- package/source/smart.validationpanel.js +6 -0
- package/source/smart.validator.js +6 -0
- package/source/smart.window.js +6 -0
package/source/smart.elements.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI v15.0.
|
|
2
|
+
/* Smart UI v15.0.11 (2023-02-01)
|
|
3
3
|
Copyright (c) 2011-2023 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
@@ -32,7 +32,7 @@ Smart("smart-led",class extends Smart.ToggleButton{static get properties(){retur
|
|
|
32
32
|
Smart("smart-power-button",class extends Smart.ToggleButton{static get styleUrls(){return["smart.powerbutton.css"]}template(){return"<div id='container' class='smart-container'>\n <div id='powerButtonAnimation' class='smart-animation'></div>\n <span id='button' class='smart-input' aria-hidden=\"true\"></span>\n <input id='hiddenInput' class='smart-hidden-input' type='hidden'>\n </div>"}ready(){super.ready(),this._updateHidenInputNameAndValue()}});
|
|
33
33
|
Smart("smart-radio-button",class extends Smart.ToggleButton{static get properties(){return{checkMode:{value:"both",allowedValues:["both","input","label"],type:"string"},type:{value:"radio",type:"string",defaultReflectToAttribute:!0,readonly:!0},groupName:{value:"",type:"string"}}}template(){return"<div id='container' class='smart-container'>\n <div class ='smart-overlay'></div>\n <span id='radioButtonInput' class ='smart-input'></span>\n <span id='radioButtonLabel' inner-h-t-m-l='[[innerHTML]]' class ='smart-label'><content></content></span>\n <input id='hiddenInput' class ='smart-hidden-input' type='hidden'>\n </div>"}static get listeners(){return{down:"_downHandler","document.up":"_documentUpHandler",mouseenter:"_elementMouseEnterHandler","radioButtonInput.mouseenter":"_radioMouseEnterHandler","radioButtonInput.mouseleave":"_radioMouseLeaveHandler",focus:"_focusHandler",blur:"_blurHandler"}}static get styleUrls(){return["smart.toggle.css"]}_radioMouseEnterHandler(){this.$.setAttributeValue("hover",!0)}_radioMouseLeaveHandler(){this.$.setAttributeValue("hover",!1)}_focusHandler(){this.$.setAttributeValue("focus",!0)}_blurHandler(){this.$.setAttributeValue("focus",!1)}_mouseEnterHandler(){this.$.setAttributeValue("hover",!0)}_mouseLeaveHandler(){this.$.setAttributeValue("hover",!1)}ready(){const e=this;super.ready(),e.classList.add("smart-toggle-box"),e._handleMultipleCheckedInstances(),e._updateHidenInputNameAndValue(),e._updateGroupValue()}_downHandler(e){const t=this,a=t.enableShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(!(t.disabled||t.readonly||"input"===t.checkMode&&a!==t.$.radioButtonInput||"label"===t.checkMode&&a!==t.$.radioButtonLabel)){if(t.$.setAttributeValue("active",!0),t.hasRippleAnimation){const e=t.$.radioButtonInput.getBoundingClientRect(),a=window.scrollX||window.pageXOffset,n=window.scrollY||window.pageYOffset;Smart.Utilities.Animation.Ripple.animate(t.$.radioButtonInput,e.left+e.width/2+a,e.top+e.height/2+n)}t._preventAction?t._preventAction=!1:("release"!==t.clickMode&&"pressAndRelease"!==t.clickMode||(t._pressed=!0),"press"!==t.clickMode&&"pressAndRelease"!==t.clickMode||("pressAndRelease"===t.clickMode&&(""===t.groupName?t._checkedBeforeChange=t.parentNode.querySelector("smart-radio-button[checked]"):t._checkedBeforeChange=document.querySelector('smart-radio-button[group-name="'+t.groupName+'"][checked]')),t._handleMouseInteraction()))}}_elementMouseEnterHandler(){const e=this;"hover"!==e.clickMode||e.disabled||e.readonly||e._handleMouseInteraction()}_documentUpHandler(e){const t=this,a=t.enableShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;!t._pressed||t.disabled||t.readonly||"input"===t.checkMode&&a!==t.$.radioButtonInput||"label"===t.checkMode&&a!==t.$.radioButtonLabel||"pointercancel"===e.originalEvent.type||("release"===t.clickMode?t._handleMouseInteraction():(null===t._checkedBeforeChange?(t.$.fireEvent("change",{value:!1,oldValue:!0,changeType:"pointer"}),t.$.fireEvent("uncheckValue",{changeType:"pointer"}),t.checked=!1):t._checkedBeforeChange._changeCheckState("pointer"),t.focus(),t._updateHidenInputNameAndValue()),t.$.setAttributeValue("active",!1),t._pressed=!1)}_handleMouseInteraction(){const e=this;e._handleTextSelection(),e._changeCheckState("pointer"),e.focus(),e._updateHidenInputNameAndValue()}_handleMultipleCheckedInstances(){const e=Array.from(document.querySelectorAll('smart-radio-button[group-name="'+this.groupName+'"][checked]')),t=Array.from(document.querySelectorAll('smart-ui-radio-button[group-name="'+this.groupName+'"][checked]')),a=e.length+t.length;a<2||e.concat(...t).forEach(((e,t)=>t<a-1&&(e.checked=!1)))}_changeCheckState(e){const t=this;let a=document.querySelectorAll('smart-radio-button[group-name="'+t.groupName+'"]'),n=document.querySelectorAll('smart-ui-radio-button[group-name="'+t.groupName+'"]'),o=Array.from(a).concat(...n);if(!0===t.checked&&"api"===e||!1===t.checked)if(o.length>0)t._changeCheckStateInGroup(o,e);else{let r=t.parentNode;t.getRootNode().host?(r=t.getRootNode().host.parentNode,a=r.querySelectorAll("smart-radio-button:not([group-name])"),n=r.querySelectorAll("smart-ui-radio-button:not([group-name])"),o=Array.from(a).concat(...n)):o=r.querySelectorAll("smart-radio-button:not([group-name])"),t._changeCheckStateInGroup(o,e)}}_updateGroupValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t&&e.checked){const a=e.dataset.property,n=e.dataset.value;if(a&&void 0!==t[a]){let e=n;"true"===e&&(e=!0),"false"===e&&(e=!1),t[a]=e}else e.name?(t.value=e.name,e.id&&t.setAttribute("data-id",e.id)):e.id&&(t.value=e.id),e._targetDispatchTimer&&clearTimeout(e._targetDispatchTimer),e._targetDispatchTimer=setTimeout((()=>{t.dispatchEvent(new Event("change"))}),100)}}}_changeCheckStateInGroup(e,t){const a=this,n=a.getRootNode().host?a.getRootNode().host:a;for(let t=0;t<e.length;t++)e[t]._isUpdating=!0,e[t]===n?n.checked=!0:e[t].checked&&(e[t].checked=!1),e[t]._isUpdating=!1;n.nativeElement?(n.nativeElement.$.fireEvent("change",{value:!0,oldValue:!1,changeType:t}),n.nativeElement.$.fireEvent("checkValue",{changeType:t})):(n.$.fireEvent("change",{value:!0,oldValue:!1,changeType:t}),n.$.fireEvent("checkValue",{changeType:t})),a._updateGroupValue()}propertyChangedHandler(e,t,a){const n=this;switch(e){case"value":n._updateHidenInputNameAndValue();break;case"checked":n._isUpdating||n._changeCheckState("api"),n._updateHidenInputNameAndValue();break;case"name":n._updateHidenInputName();break;default:super.propertyChangedHandler(e,t,a)}}});
|
|
34
34
|
Smart("smart-switch-button",class extends Smart.ToggleButton{static get properties(){return{inverted:{value:!1,type:"boolean"},orientation:{value:"horizontal",allowedValues:["horizontal","vertical"],type:"string"},switchMode:{value:"default",allowedValues:["default","click","drag","none"],type:"string"},clickMode:{value:"release",allowedValues:["press","release","pressAndRelease"],type:"string"}}}static get listeners(){return{"container.down":"_mouseDownHandler","document.move":"_drag","container.move":"_moveHandler","document.up":"_switchThumbDropHandler",mouseenter:"_switchButtonOnMouseEnter",mouseleave:"_switchButtonOnMouseLeave",resize:"_resizeHandler","container.resize":"_resizeHandler","document.selectstart":"_selectStartHandler"}}static get styleUrls(){return["smart.switchbutton.css"]}propertyChangedHandler(e,t,n){const i=this;switch(super.propertyChangedHandler(e,t,n),i._updateContentProperties(),e){case"indeterminate":n?(i._valueCache=i.checked,i.checked=null):i.checked=i._valueCache,i._setAriaState();break;case"trueContent":i.trueContent=n;break;case"falseContent":i.falseContent=n;break;case"orientation":i._resizeHandler()}i._getContainersSizeAndBreakPoint(),i._removeDragStyles(),i._resizeHandler()}template(){return"<div id='container' class='smart-container' role=\"presentation\">\n <div id='innerContainer' class='smart-inner-container' role=\"presentation\">\n <span id='falseContentContainer' inner-h-t-m-l='[[falseContent]]' class='smart-false-content-container'></span>\n <span id='switchThumb' class='smart-thumb' role=\"presentation\"></span>\n <span id='trueContentContainer' inner-h-t-m-l='[[trueContent]]' class='smart-true-content-container'></span>\n </div>\n <input id='hiddenInput' class='smart-hidden-input' type='hidden'>\n </div>"}ready(){const e=this;super.ready(),e.setAttribute("role","switch");let t=e.animation;e.hasAnimation&&(e.animation="none"),e._supportCSSVariables=Smart.Utilities.Core.CSSVariablesSupport()&&Boolean(window.getComputedStyle(e.$.container).getPropertyValue("--smart-switch-button-default-width")),e._htmlBindOnInitialization(),e._resizeHandler(),e._initializePrivateVariables(),e._getContainersSizeAndBreakPoint(),e.indeterminate&&(e._valueCache=e.checked,e.checked=null),e._setAriaState(),e._handleTemplate(!0),e._handleTemplate(!1),e._handleTemplate(),e._updateHidenInputNameAndValue(),e._updateThumbPosition(),e.animation=t}_mouseDownHandler(e){const t=this;t.disabled||t.readonly||"none"===t.switchMode||(e.originalEvent.target.closest(".smart-thumb")!==t.$.switchThumb||"default"!==t.switchMode&&"drag"!==t.switchMode||t._switchThumbDragStartHandler(e),t._isSwitchClicked=t,t._updateContentProperties(),"release"!==t.clickMode&&"click"===t.switchMode&&(t._updateStateOnClick(),t.$.fireEvent("click"),t.indeterminate=!1,t._updateHidenInputNameAndValue()))}_updateStateOnClick(){this._changeCheckState(),this.focus()}_drag(e){this._mouseDown&&(Smart.Utilities.Core.isMobile&&e.originalEvent.preventDefault(),this._switchThumbDragHandler(e))}_switchThumbDragStartHandler(e){const t=this;t.disabled||("click"===t.switchMode&&"release"!==t.clickMode&&(e.preventDefault(),e.stopPropagation()),t._isInactiveOn("drag")||(t._mouseDown=!0,t._getContainersSizeAndBreakPoint(),t._pointerPosition="vertical"===t.orientation?e.pageY:e.pageX,e.preventDefault()))}_selectStartHandler(e){this._mouseDown&&e.preventDefault()}_switchThumbDragHandler(e){const t=this;if(t._isInactiveOn("drag"))return;if(!1===t._mouseDown)return void t._removeDragStyles();if(!t.hasAttribute("dragged")){if(Math.abs(("vertical"===t.orientation?e.pageY:e.pageX)-t._pointerPosition)<=1.5)return;t.setAttribute("dragged","")}let n=t.$.innerContainer,i=t.$.container.getBoundingClientRect(),r="vertical"===t.orientation?document.body.scrollTop||document.documentElement.scrollTop:document.body.scrollLeft||document.documentElement.scrollLeft,a="vertical"===t.orientation?i.top+r:i.left+r,o="vertical"===t.orientation?t._pointerPosition-n.offsetTop:t._pointerPosition-n.offsetLeft,s=t._pointerPosition>=a&&t._pointerPosition<=a+t._switchContainerSize;const l=-1*(t.offsetWidth-t.$.switchThumb.offsetWidth),c=-1*(t.offsetHeight-t.$.switchThumb.offsetHeight);if(t._pointerPosition="vertical"===t.orientation?e.pageY:e.pageX,s){let e=t._pointerPosition-o;e<-t._switchTrackLength&&(e=-t._switchTrackLength),e>0&&(e=0),"vertical"===t.orientation?t.$.innerContainer.style.top=Math.max(c,e)+"px":t.$.innerContainer.style.left=Math.max(l,e)+"px"}}_switchThumbDropHandler(){const e=this;e.hasAttribute("dragged")?e._endDrag():e._isSwitchClicked&&e._endClick(),e._mouseDown=!1,delete e._isSwitchClicked}_endDrag(){const e=this,t=e.inverted&&!e.rightToLeft||!e.inverted&&e.rightToLeft;if(e.indeterminate=!1,e._updateHidenInputNameAndValue(),e._isInactiveOn("drag")||!e._mouseDown)return;e.removeAttribute("dragged"),delete e._pointerPosition;const n=("vertical"===e.orientation?e.$.innerContainer.offsetTop+e.$.switchThumb.offsetTop+e.$.switchThumb.clientHeight/2:e.$.innerContainer.offsetLeft+e.$.switchThumb.offsetLeft+e.$.switchThumb.clientWidth/2)>e._switchBreakPoint;null!==e.checked?!t==(n===e.checked)&&e._changeCheckState(!e.checked):n?e._changeCheckState(t):e._changeCheckState(!t),e._removeDragStyles(),e._updateThumbPosition()}_endClick(){const e=this;e._resizeHandler(),e.disabled||e.readonly||e._isInactiveOn("click")||("release"!==e.clickMode&&"pressAndRelease"!==e.clickMode||e._updateStateOnClick(),e.indeterminate=!1,e._updateHidenInputNameAndValue())}_switchButtonOnMouseEnter(){const e=this;e.disabled||e.readonly||e.$.addClass("hovered")}_switchButtonOnMouseLeave(){const e=this;e.disabled||e.readonly||e.$.removeClass("hovered")}_isInactiveOn(e){const t=this,n=t.disabled||t.readonly||t.switchMode!==e;return"default"!==t.switchMode&&n}_keyUpHandler(e){const t=this;t.disabled||t.readonly||32!==e.keyCode||"none"===t.switchMode||(t._getContainersSizeAndBreakPoint(),t._changeCheckState())}_initializePrivateVariables(){const e=this;e._switchContainerSize=e._switchTrackLength=e._switchBreakPoint=e._pointerPosition=0,e._mouseDown=!1}_changeCheckState(e){const t=this;let n=t.checked;if(null===n&&void 0!==e)return t.$.fireEvent("change",{value:e,oldValue:null,changeType:"pointer"}),t.$.fireEvent("uncheckValue",{changeType:"pointer"}),t.checked=e,void t._updateThumbPosition();null===t.checked?t.checked=!0:t.checked=!t.checked,t._setAriaState(),t._updateThumbPosition(),t.$.fireEvent("change",{value:t.checked,oldValue:n,changeType:"pointer"}),t.checked?t.$.fireEvent("checkValue",{changeType:"pointer"}):t.$.fireEvent("uncheckValue",{changeType:"pointer"}),t._updateHidenInputNameAndValue()}_getContainersSizeAndBreakPoint(){const e=this;e._switchContainerSize="vertical"===e.orientation?e.$.container.offsetHeight:e.$.container.offsetWidth,e._switchTrackLength="vertical"===e.orientation?e._switchContainerSize-e.$.switchThumb.offsetHeight:e._switchContainerSize-e.$.switchThumb.offsetWidth,e._switchBreakPoint=e._switchContainerSize/2}_removeDragStyles(){const e=this;e._supportCSSVariables?e.$.innerContainer.removeAttribute("style"):e.$.innerContainer.style.left="",e._supportCSSVariables?e.$.innerContainer.removeAttribute("style"):e.$.innerContainer.style.top="",e._mouseDown=!1}_moveHandler(e){"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_resizeHandler(){const e=this;if(!document.body.contains(e))return;const t=window.getComputedStyle(e,null),n=parseInt(t.getPropertyValue("border-top-width")),i=parseInt(t.getPropertyValue("border-right-width")),r=parseInt(t.getPropertyValue("border-bottom-width")),a=parseInt(t.getPropertyValue("border-left-width")),o="vertical"===e.orientation?e.offsetHeight-(n+r):e.offsetWidth-(a+i);e._getContainersSizeAndBreakPoint(),e._supportCSSVariables?e.$.container.style.setProperty("--smart-switch-button-default-width",o+"px"):(e._innerContainerSize=o,e.$.innerContainer.style.height=e.$.innerContainer.style.width="",e.$.trueContentContainer.style.height=e.$.trueContentContainer.style.width="",e.$.falseContentContainer.style.height=e.$.falseContentContainer.style.width="","horizontal"===e.orientation?(e.$.innerContainer.style.setProperty("width",2*o-e.$.switchThumb.clientWidth+"px"),e.$.trueContentContainer.style.setProperty("width",e._switchTrackLength+"px"),e.$.falseContentContainer.style.setProperty("width",e._switchTrackLength+"px")):(e.$.innerContainer.style.setProperty("height",2*o-e.$.switchThumb.clientHeight+"px"),e.$.trueContentContainer.style.setProperty("height",e._switchTrackLength+"px"),e.$.falseContentContainer.style.setProperty("height",e._switchTrackLength+"px")),e._updateThumbPosition())}_updateThumbPosition(){const e=this,t=e.inverted&&!e.rightToLeft||!e.inverted&&e.rightToLeft;!e._supportCSSVariables&&(t?!0!==e.checked:!1!==e.checked)&&e._innerContainerSize?((t?!1===e.checked:e.checked)&&("horizontal"===e.orientation?(e.$.innerContainer.style.left=-1*(e._innerContainerSize-e.$.switchThumb.offsetWidth)+"px",e.$.innerContainer.style.top=""):(e.$.innerContainer.style.top=-1*(e._innerContainerSize-e.$.switchThumb.offsetHeight)+"px",e.$.innerContainer.style.left="")),null===e.checked&&("horizontal"===e.orientation?(e.$.innerContainer.style.left=-1*(e._innerContainerSize/2-e.$.switchThumb.offsetWidth/2)+"px",e.$.innerContainer.style.top=""):(e.$.innerContainer.style.top=-1*(e._innerContainerSize/2-e.$.switchThumb.offsetHeight/2)+"px",e.$.innerContainer.style.left=""))):e.$.innerContainer.style.left=e.$.innerContainer.style.top=""}_setAriaState(){const e=this,t=!!e.checked;e.setAttribute("aria-checked",t),t?(e.$.falseContentContainer.setAttribute("aria-hidden",!0),e.$.trueContentContainer.removeAttribute("aria-hidden")):(e.$.trueContentContainer.setAttribute("aria-hidden",!0),e.$.falseContentContainer.removeAttribute("aria-hidden"))}});
|
|
35
|
-
Smart("smart-chart",class extends Smart.BaseElement{static get properties(){return{animationDuration:{value:300,type:"number"},backgroundColor:{value:null,type:"string?"},backgroundImage:{value:"",type:"string"},borderLineColor:{value:null,type:"string?"},borderLineWidth:{value:1,type:"number"},caption:{value:"Caption",type:"string"},clip:{value:!0,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},columnSeriesOverlap:{value:!1,type:"boolean"},crosshairsColor:{value:null,type:"string?"},crosshairsDashStyle:{value:"2,2",type:"string"},crosshairsLineWidth:{value:1,type:"number"},dataSource:{value:[],type:"object",reflectToAttribute:!1},description:{value:"Description",type:"string"},draw:{value:null,type:"function?"},drawBefore:{value:null,type:"function?"},enableAxisTextAnimation:{value:!1,type:"boolean"},enableCrosshairs:{value:!1,type:"boolean"},greyScale:{value:!1,type:"boolean"},legendLayout:{value:{flow:{value:"horizontal",allowedValues:["horizontal","vertical"],type:"string"},height:{value:null,type:"number?"},left:{value:null,type:"number?"},top:{value:null,type:"number?"},width:{value:null,type:"number?"}},type:"object?"},localization:{value:{decimalSeparator:{value:".",type:"string"},patterns:{value:null,type:"object?"},thousandsSeparator:{value:"",type:"string"}},type:"object"},messages:{value:{en:{invalidRadiusDataField:"smart-chart: Invalid radiusDataField value at [{{index}}]",invalidSeries:"smart-chart: Invalid property: each series group must have a 'series' property which must be a valid array.",invalidSeriesGroups:"smart-chart: Invalid property: 'seriesGroups' property is required and must be a valid array.",invalidType:'smart-chart: Invalid serie type "{{type}}".',missingAxis:"smart-chart: seriesGroup[{{index}}] is missing {{axis}} definition.",missingReference:"smart-chart: Missing reference to {{files}}.",missingType:"smart-chart: Invalid property: each series group must have a valid 'type' property."}},type:"object",extend:!0},padding:{value:{bottom:{value:5,type:"number"},left:{value:5,type:"number"},right:{value:5,type:"number"},top:{value:5,type:"number"}},type:"object"},renderEngine:{value:"",allowedValues:["","SVG","HTML5"],type:"string"},rightToLeft:{value:!1,type:"boolean"},seriesGroups:{value:[],type:"any",reflectToAttribute:!1},showBorderLine:{value:!0,type:"boolean"},showLegend:{value:!0,type:"boolean"},showToolTips:{value:!0,type:"boolean"},showToolTipsOnAllSeries:{value:!1,type:"boolean"},theme:{value:"light",allowedValues:["light","dark"],type:"string"},titlePadding:{value:{bottom:{value:10,type:"number"},left:{value:5,type:"number"},right:{value:5,type:"number"},top:{value:5,type:"number"}},type:"object"},toolTipBackground:{value:null,type:"string?"},toolTipFormatFunction:{value:null,type:"function?"},toolTipHideDelay:{value:4e3,type:"number"},toolTipLineColor:{value:null,type:"string?"},toolTipShowDelay:{value:300,type:"number"},valueAxis:{value:{alternatingBackgroundColor:{value:"",type:"string"},alternatingBackgroundColor2:{value:"",type:"string"},alternatingBackgroundOpacity:{value:1,type:"number"},axisSize:{value:null,type:"any"},bands:{value:null,type:"array?"},baselineValue:{value:0,type:"any"},customDraw:{value:!1,type:"boolean"},flip:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},gridLines:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},labels:{value:{angle:{value:0,type:"number"},autoRotate:{value:!1,type:"boolean"},class:{value:null,type:"string?"},custom:{value:null,type:"array?"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},offset:{value:{x:{value:0,type:"number"},y:{value:0,type:"number"}},type:"object"},rotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"any"}},type:"object"},line:{value:{color:{value:"",type:"string"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},visible:{value:!0,type:"any"}},type:"object"},logarithmicScale:{value:!1,type:"boolean"},logarithmicScaleBase:{value:10,type:"number"},maxValue:{value:NaN,type:"any"},minValue:{value:NaN,type:"any"},padding:{value:{bottom:{value:0,type:"number"},left:{value:0,type:"number"},right:{value:0,type:"number"},top:{value:0,type:"number"}},type:"object"},position:{value:"left",allowedValues:["left","right","top","bottom"],type:"string"},textRotationAngle:{value:null,type:"number?"},textRotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},tickMarks:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},size:{value:4,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},title:{value:{class:{value:null,type:"string?"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},text:{value:"",type:"string"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"boolean"}},type:"object"},unitInterval:{value:null,type:"number?"},valuesOnTicks:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"},xAxis:{value:{alternatingBackgroundColor:{value:"",type:"string"},alternatingBackgroundColor2:{value:"",type:"string"},alternatingBackgroundOpacity:{value:1,type:"number"},axisSize:{value:null,type:"any"},bands:{value:null,type:"array?"},baseUnit:{value:null,allowedValues:["year","month","day","hour","minute","second","millisecond",null],type:"string?"},customDraw:{value:!1,type:"boolean"},dataField:{value:"",type:"string"},dateFormat:{value:null,type:"string?"},displayText:{value:null,type:"string?"},flip:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},gridLines:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},labels:{value:{angle:{value:0,type:"number"},autoRotate:{value:!1,type:"boolean"},class:{value:null,type:"string?"},custom:{value:null,type:"array?"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},offset:{value:{x:{value:0,type:"number"},y:{value:0,type:"number"}},type:"object"},rotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"any"}},type:"object"},line:{value:{color:{value:"",type:"string"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},visible:{value:!0,type:"any"}},type:"object"},logarithmicScale:{value:!1,type:"boolean"},logarithmicScaleBase:{value:10,type:"number"},maxValue:{value:NaN,type:"any"},minValue:{value:NaN,type:"any"},padding:{value:{bottom:{value:0,type:"number"},left:{value:0,type:"number"},right:{value:0,type:"number"},top:{value:0,type:"number"}},type:"object"},position:{value:"bottom",allowedValues:["bottom","top","left","right"],type:"string"},rangeSelector:{value:{backgroundColor:{value:null,type:"string?"},backgroundImage:{value:"",type:"string"},baseUnit:{value:null,allowedValues:["year","month","day","hour","minute","second","millisecond",null],type:"string?"},borderLineColor:{value:null,type:"string?"},borderLineWidth:{value:null,type:"number?"},caption:{value:"",type:"string"},colorScheme:{value:null,type:"string?"},columnSeriesOverlap:{value:!1,type:"boolean"},columnsGapPercent:{value:25,type:"number"},dataField:{value:null,type:"string?"},description:{value:"",type:"string"},greyScale:{value:null,type:"boolean?"},gridLines:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},labels:{value:{angle:{value:0,type:"number"},autoRotate:{value:!1,type:"boolean"},class:{value:null,type:"string?"},custom:{value:null,type:"array?"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},offset:{value:{x:{value:0,type:"number"},y:{value:0,type:"number"}},type:"object"},rotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"any"}},type:"object"},maxValue:{value:NaN,type:"any"},minValue:{value:NaN,type:"any"},padding:{value:{bottom:{value:0,type:"number"},left:{value:0,type:"number"},right:{value:0,type:"number"},top:{value:0,type:"number"}},type:"object"},position:{value:null,allowedValues:["bottom","top","left","right"],type:"string?"},renderTo:{value:null,type:"any"},rightToLeft:{value:null,type:"boolean?"},seriesGapPercent:{value:10,type:"number"},seriesGroups:{value:null,type:"array?"},serieType:{value:"area",type:"string"},showBorderLine:{value:null,type:"boolean?"},size:{value:null,type:"number?"},skipOverlappingPoints:{value:!0,type:"boolean"},titlePadding:{value:{bottom:{value:10,type:"number"},left:{value:5,type:"number"},right:{value:5,type:"number"},top:{value:5,type:"number"}},type:"object"},unitInterval:{value:null,type:"number?"},valueAxis:{value:{alternatingBackgroundColor:{value:"",type:"string"},alternatingBackgroundColor2:{value:"",type:"string"},alternatingBackgroundOpacity:{value:1,type:"number"},axisSize:{value:null,type:"any"},bands:{value:null,type:"array?"},baselineValue:{value:0,type:"any"},customDraw:{value:!1,type:"boolean"},flip:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},gridLines:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},labels:{value:{angle:{value:0,type:"number"},autoRotate:{value:!1,type:"boolean"},class:{value:null,type:"string?"},custom:{value:null,type:"array?"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},offset:{value:{x:{value:0,type:"number"},y:{value:0,type:"number"}},type:"object"},rotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"any"}},type:"object"},line:{value:{color:{value:"",type:"string"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},visible:{value:!0,type:"any"}},type:"object"},logarithmicScale:{value:!1,type:"boolean"},logarithmicScaleBase:{value:10,type:"number"},maxValue:{value:NaN,type:"any"},minValue:{value:NaN,type:"any"},padding:{value:{bottom:{value:0,type:"number"},left:{value:0,type:"number"},right:{value:0,type:"number"},top:{value:0,type:"number"}},type:"object"},position:{value:"left",allowedValues:["left","right","top","bottom"],type:"string"},textRotationAngle:{value:null,type:"number?"},textRotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},tickMarks:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},size:{value:4,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},title:{value:{class:{value:null,type:"string?"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},text:{value:"",type:"string"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"boolean"}},type:"object"},unitInterval:{value:null,type:"number?"},valuesOnTicks:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object"},textRotationAngle:{value:null,type:"number?"},textRotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},tickMarks:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},size:{value:4,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},title:{value:{class:{value:null,type:"string?"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},text:{value:"",type:"string"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"boolean"}},type:"object"},toolTipFormatFunction:{value:null,type:"function?"},toolTipFormatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},type:{value:"auto",allowedValues:["auto","date","basic","linear"],type:"string"},unitInterval:{value:null,type:"number?"},valuesOnTicks:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object",reflectToAttribute:!1}}}get _legendLayout(){const e=this.legendLayout;return null!==e.height||null!==e.left||null!==e.top||null!==e.width||"vertical"===e.flow}_getFormatSettings(e,t){if(!e)return null;const i=e[t||"formatSettings"];return i&&(i.dateFormat||null!==i.decimalPlaces||i.decimalSeparator||i.negativeWithBrackets||i.prefix||i.sufix||i.thousandsSeparator)?i:null}static get listeners(){return{click:"_clickHandler",down:"_downMoveHandler",mouseleave:"_mouseleaveHandler",move:"_moveHandler",resize:"_resizeHandler","document.move":"_downMoveHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.Utilities.Draw":"smart.draw.js"}}static get styleUrls(){return["smart.chart.css"]}template(){return'<div role="presentation"></div>'}ready(){super.ready(),this.checkLicense()}render(){const e=this;e._observeSeriesGroups(),e._isTouchDevice=Smart.Utilities.Core.isMobile,e._setDefaults(),e._createColorsCache(),e.refresh(),e._setAriaProperties(),super.render()}attached(){const e=this;super.attached(),e.isCompleted&&!e._isRangeSelectorInstance&&Object.values(e._rangeSelectorInstances).forEach((e=>{e.parentDiv.parentDiv.appendChild(e.parentDiv)}))}detached(){const e=this;super.detached(),e._isRangeSelectorInstance||(e._ttEl&&e._ttEl.box&&e._ttEl.box.remove(),delete e._ttEl,Object.values(e._rangeSelectorInstances).forEach((e=>{e.parentDiv.remove()})))}_setAriaProperties(){const e=this;if(e._isRangeSelectorInstance)return;const t=e.xAxis,i=e.valueAxis,r=e.seriesGroups;let s=e.$.content.children[1],a="",l=!0;function n(e,t){e&&(e.title&&e.title.text||e.description||e.dataField)&&(a+='; "',e.title&&e.title.text?a+=e.title.text:a+=e.description||e.dataField,a+='" on the '+t,isNaN(e.minValue)||(a+=" from "+e.minValue),isNaN(e.maxValue)||(a+=" up to "+e.maxValue))}e.setAttribute("role","figure"),s||(s=document.createElement("div"),s.id=e.id+"DescriptionContainer",s.className="smart-hidden",e.$.content.appendChild(s)),e.setAttribute("aria-labelledby",e.id+"TitleText"),e.setAttribute("aria-describedby",e.id+"TitleDescription "+s.id),a+="This chart displays:",n(t,"x-axis"),n(i,"y-axis");for(let e=0;e<r.length;e++){const t=r[e];if(n(t.valueAxis,"y-axis"),t.series){l=l&&"horizontal"===t.orientation;for(let i=0;i<t.series.length;i++){const r=t.series[i];0===i&&(a+=0===e?" for ":"; "),a+='"'+(r.displayText||r.dataField)+'"',i!==t.series.length-1&&(a+=", ")}}}a=a.replace(":;",":"),a=a.replace(/<.+?>/g,""),l&&(a=a.replace(/x-axis/g,"@@@"),a=a.replace(/y-axis/g,"x-axis"),a=a.replace(/@@@/g,"y-axis")),e.description&&(a="; "+a),s.innerHTML=a}_observeSeriesGroups(){const e=this;function t(t){e.context!==e&&t.newValue!==t.oldValue&&e.update()}if(e._validateSeriesGroups(),Array.isArray(e.seriesGroups)){e.seriesGroups=new Smart.ObservableArray(e.seriesGroups),e.seriesGroups.canNotify=!0;for(let i=0;i<e.seriesGroups.length;i++)Array.isArray(e.seriesGroups[i].series)&&(e.seriesGroups[i].series=new Smart.ObservableArray(e.seriesGroups[i].series),e.seriesGroups[i].series.canNotify=!0,e.seriesGroups[i].series.notify(t));e.seriesGroups.notify(t)}}_downMoveHandler(e){const t=this;let i=e.originalEvent.target;t.shadowRoot&&i===t&&(i=e.originalEvent.composedPath()[0]);const r=i.closest(".smart-chart-range-selector");if(!r)return;const s=r.firstElementChild,a=s.parentChart;t!==s&&t!==a||a["_onSliderMouse"+e.type.slice(0,1).toUpperCase()+e.type.slice(1)](e)}_documentUpHandler(e){const t=this;t._draggingRangeSelector&&t._onSliderMouseUp(e)}_setDefaults(){const e=this;e.axisPadding=5,e.enableEvents=!0,e.enableSampling=!0,e._itemsToggleState=[],e._isToggleRefresh=!1,e._isSelectorRefresh=!1,e._sliders=[],e._selectorRange=[],e._rangeSelectorInstances={},e._resizeState={},e._isRangeSelectorInstance=e._isRangeSelectorInstance||!1,e._renderData={},e._smartPlot=null,e._animTickInt=50,e._seriesTypes=["line","stackedline","stackedline100","spline","stackedspline","stackedspline100","stepline","stackedstepline","stackedstepline100","area","stackedarea","stackedarea100","splinearea","stackedsplinearea","stackedsplinearea100","steparea","stackedsteparea","stackedsteparea100","rangearea","splinerangearea","steprangearea","column","stackedcolumn","stackedcolumn100","rangecolumn","scatter","stackedscatter","stackedscatter100","bubble","stackedbubble","stackedbubble100","pie","donut","candlestick","ohlc","waterfall","stackedwaterfall"],e.colorSchemes=[{name:"scheme01",colors:["#307DD7","#AA4643","#89A54E","#71588F","#4198AF"]},{name:"scheme02",colors:["#7FD13B","#EA157A","#FEB80A","#00ADDC","#738AC8"]},{name:"scheme03",colors:["#E8601A","#FF9639","#F5BD6A","#599994","#115D6E"]},{name:"scheme04",colors:["#D02841","#FF7C41","#FFC051","#5B5F4D","#364651"]},{name:"scheme05",colors:["#25A0DA","#309B46","#8EBC00","#FF7515","#FFAE00"]},{name:"scheme06",colors:["#0A3A4A","#196674","#33A6B2","#9AC836","#D0E64B"]},{name:"scheme07",colors:["#CC6B32","#FFAB48","#FFE7AD","#A7C9AE","#888A63"]},{name:"scheme08",colors:["#3F3943","#01A2A6","#29D9C2","#BDF271","#FFFFA6"]},{name:"scheme09",colors:["#1B2B32","#37646F","#A3ABAF","#E1E7E8","#B22E2F"]},{name:"scheme10",colors:["#5A4B53","#9C3C58","#DE2B5B","#D86A41","#D2A825"]},{name:"scheme11",colors:["#993144","#FFA257","#CCA56A","#ADA072","#949681"]},{name:"scheme12",colors:["#105B63","#EEEAC5","#FFD34E","#DB9E36","#BD4932"]},{name:"scheme13",colors:["#BBEBBC","#F0EE94","#F5C465","#FA7642","#FF1E54"]},{name:"scheme14",colors:["#60573E","#F2EEAC","#BFA575","#A63841","#BFB8A3"]},{name:"scheme15",colors:["#444546","#FFBB6E","#F28D00","#D94F00","#7F203B"]},{name:"scheme16",colors:["#583C39","#674E49","#948658","#F0E99A","#564E49"]},{name:"scheme17",colors:["#142D58","#447F6E","#E1B65B","#C8782A","#9E3E17"]},{name:"scheme18",colors:["#4D2B1F","#635D61","#7992A2","#97BFD5","#BFDCF5"]},{name:"scheme19",colors:["#844341","#D5CC92","#BBA146","#897B26","#55591C"]},{name:"scheme20",colors:["#56626B","#6C9380","#C0CA55","#F07C6C","#AD5472"]},{name:"scheme21",colors:["#96003A","#FF7347","#FFBC7B","#FF4154","#642223"]},{name:"scheme22",colors:["#5D7359","#E0D697","#D6AA5C","#8C5430","#661C0E"]},{name:"scheme23",colors:["#16193B","#35478C","#4E7AC7","#7FB2F0","#ADD5F7"]},{name:"scheme24",colors:["#7B1A25","#BF5322","#9DA860","#CEA457","#B67818"]},{name:"scheme25",colors:["#0081DA","#3AAFFF","#99C900","#FFEB3D","#309B46"]},{name:"scheme26",colors:["#0069A5","#0098EE","#7BD2F6","#FFB800","#FF6800"]},{name:"scheme27",colors:["#FF6800","#A0A700","#FF8D00","#678900","#0069A5"]},{name:"scheme28",colors:["#3A43BA","#281E5D","#48AAAD","#0492C2","#1E456E","#59788D","#52B2C0","#82EDFD"]},{name:"scheme29",colors:["#003F5C","#BC5090","#58508D","#FF6361","#FFA600"]},{name:"scheme30",colors:["#16736F","#A2D56A","#1C515C","#62B773","#EEEF63","#1F313F","#309577"]},{name:"scheme31",colors:["#74CC66","#191A4D","#2D867A","#EEE3CD","#224D19","#0D261B","#5771C7","#B6D7E7","#206052","#6B5724","#C3AF4B","#603620","#536722","#B6E7B9","#34819D","#94ACDB"]},{name:"scheme32",colors:["#87C5FF","#5B5B60","#9BE076","#F7A384","#7479D3","#F13A80","#E4D388","#2BC6B2","#F45B14"]}]}_clickHandler(e){const t=this;if(t.disabled||t._isRangeSelectorInstance)return;let i=e.pageX||e.clientX||e.screenX,r=e.pageY||e.clientY||e.screenY;const s=t.getBoundingClientRect();t._isTouchDevice&&(i=e.pageX,r=e.pageY),i-=s.left,r-=s.top,t._mouseX=i,t._mouseY=r,!isNaN(t._lastClickTs)&&(new Date).valueOf()-t._lastClickTs<100||(this._hostClickTimer=setTimeout((function(){if(t._isTouchDevice||(t._cancelTooltipTimer(),t._hideToolTip(),t._unselect()),t._pointMarker&&t._pointMarker.element){const i=t.seriesGroups[t._pointMarker.gidx],r=i.series[t._pointMarker.sidx];e.stopImmediatePropagation(),t._raiseItemEvent("click",i,r,t._pointMarker.iidx)}}),100),"HTML5"===t.renderEngine&&t._canvasClickHandler(i,r))}_canvasClickHandler(e,t){const i=this,r=i.renderer._elements;let s;for(let i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&"0"!==i){const a=r[i];if(t>a.y&&t<a.y+a.height&&e>a.x&&e<a.x+a.width){s=a;break}}if(s&&s.purpose&&"legend-toggle"===s.purpose){const e=s.data;i._toggleSerie(e.groupIndex,e.seriesIndex,e.itemIndex)}}_mouseleaveHandler(){const e=this;if(e.disabled||e._isRangeSelectorInstance)return;const t=e._mouseX,i=e._mouseY,r=e._plotRect;r&&t>=r.x&&t<=r.x+r.width&&i>=r.y&&i<=r.y+r.height||(e._cancelTooltipTimer(),e._hideToolTip(0),e._unselect())}_moveHandler(e){const t=this;if(t.disabled)return;if(t._isRangeSelectorInstance){const i=t.parentChart;null===i.xAxis.rangeSelector.renderTo&&(i._unselect(),i._hideToolTip()),"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}else t.style.cursor="default";let i=e.pageX||e.clientX||e.screenX,r=e.pageY||e.clientY||e.screenY;const s=t.getBoundingClientRect();t._isTouchDevice&&(i=e.pageX,r=e.pageY),i-=s.left,r-=s.top,t.onmousemove(i,r)}_resizeHandler(){const e=this,t=e.animation;e._isRangeSelectorInstance||(e.animation="none",e.refresh(),e.animation=t)}propertyChangedHandler(e,t,i){const r=this;switch(e){case"animation":case"theme":r._ttEl&&r._ttEl.box.setAttribute(e,i);break;case"rightToLeft":if(!r._ttEl||!r._ttEl.box)break;i?r._ttEl.box.setAttribute("right-to-left",i):r._ttEl.box.removeAttribute("right-to-left");break;case"seriesGroups":r._observeSeriesGroups();break;case"xAxis_rangeSelector_renderTo":if(null===i){const e=t.getElementsByClassName("smart-chart-range-selector")[0];e.parentElement.removeChild(e)}}this.refresh()}_initRenderer(){const e=this;e._draw=new Smart.Utilities.Draw(e.$.content,e.renderEngine),e.renderer=e._draw.renderer,e._smartPlot||(e._smartPlot=new Smart.Utilities.Plot(e.renderer)),e.$.content.firstElementChild.setAttribute("role","presentation")}_internalRefresh(){const e=this;if(!(e.offsetWidth||e.offsetHeight||e.getClientRects().length))return;e._stopAnimations(),e.renderer&&(e._isToggleRefresh||e._isUpdate)||(e._hideToolTip(0),e.$.content.innerHTML="",e._initRenderer());const t=e.renderer;if(!t)return;const i=t.getRect();e._render({x:1,y:1,width:i.width,height:i.height}),this.$.fireEvent("refreshBegin",{instance:this}),t instanceof Smart.Utilities.HTML5Renderer&&t.refresh(),e._isUpdate=!1,this.$.fireEvent("refreshEnd",{instance:this})}saveAsPNG(e){return this._saveAsImage("png",e)}saveAsJPEG(e){return this._saveAsImage("jpeg",e)}saveAsPDF(e,t){return this._saveAsImage("pdf",e,t)}print(){return this._saveAsImage("print")}_saveAsImage(e,t,i){const r=this;return r._draw._widgetToImage(r,e,t,r._hasRangeSelector?r._selectorSaveAsImageCallback:void 0,i)}_selectorSaveAsImageCallback(e,t){let i=e;for(let e=0;e<i.seriesGroups.length;e++){let r=i._getXAxis(e);if(!r||!r.rangeSelector||!r.rangeSelector.visible||r.rangeSelector.renderTo)continue;let s=i._rangeSelectorInstances[e];if(!s)continue;let a=s.renderer.getRect(),l=s.renderer.getContainer().getElementsByTagName("canvas")[0].getContext("2d"),n=i._sliders[e],o="horizontal"===i.seriesGroups[e].orientation,h=o?"height":"width",d=o?"width":"height",u=o?"y":"x",g=o?"x":"y",f={};f[u]=n.startOffset+n.rect[u],f[g]=n.rect[g],f[h]=n.endOffset-n.startOffset,f[d]=n.rect[d];let p=r.rangeSelector.colorSelectedRange||"blue",c=r.rangeSelector.colorRangeLine||"grey",m=[];m.push(s.renderer.rect(f.x,f.y,f.width,f.height,{fill:p,opacity:.1}));const y=i.renderer;o?(m.push(s.renderer.line(y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(n.rect.y),y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(f.y),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(f.y+f.height),y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(n.rect.y+n.rect.height),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(n.rect.x),y._ptrnd(f.y),y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(f.y),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(n.rect.x),y._ptrnd(f.y+f.height),y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(f.y+f.height),{stroke:c,opacity:.5}))):(m.push(s.renderer.line(y._ptrnd(n.rect.x),y._ptrnd(n.rect.y),y._ptrnd(f.x),y._ptrnd(n.rect.y),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(f.x+f.width),y._ptrnd(n.rect.y),y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(n.rect.y),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(f.x),y._ptrnd(n.rect.y),y._ptrnd(f.x),y._ptrnd(n.rect.y+n.rect.height),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(f.x+f.width),y._ptrnd(n.rect.y),y._ptrnd(f.x+f.width),y._ptrnd(n.rect.y+n.rect.height),{stroke:c,opacity:.5}))),s.renderer.refresh();let _=l.getImageData(a.x,a.y,a.width,a.height);const x=t.getContext("2d"),v=i.getBoundingClientRect(),b=s.getBoundingClientRect();x.putImageData(_,b.left-v.left,b.top-v.top,1,1,a.width,a.height);for(let e=0;e<m.length;e++)s.renderer.removeElement(m[e]);s.renderer.refresh()}return!0}refresh(){this._internalRefresh(),this._setAriaProperties()}update(){this._isUpdate=!0,this._internalRefresh()}clear(){const e=this;e.caption="",e.description="",e.refresh()}_validateSeriesGroups(){const e=this;Array.isArray(this.seriesGroups)||e.seriesGroups instanceof Smart.ObservableArray||e.error(e.localize("invalidSeriesGroups"));for(let t=0;t<this.seriesGroups.length;t++){const i=this.seriesGroups[t];i.type||e.error(e.localize("missingType")),Array.isArray(i.series)||i.series instanceof Smart.ObservableArray||e.error(e.localize("invalidSeries"))}}_render(e){var t=this,i=t.renderer;t._colorsCache.clear(),!t._isToggleRefresh&&t._isUpdate&&t._renderData&&t._renderDataClone(),t._renderData=[],i.clear(),t._unselect(),t._hideToolTip(0);var r=t.backgroundImage;t.style.backgroundImage=null==r||""===r?"":-1!==r.indexOf("(")?r:'url("'+r+'")',t._rect=e;var s=t.padding||{left:5,top:5,right:5,bottom:5},a=i.createClipRect(e),l=i.beginGroup();i.setClip(l,a);var n=i.rect(e.x,e.y,e.width-2,e.height-2);if(null==r||""===r?i.attr(n,{fill:t.backgroundColor||t._getThemeColor("background")}):i.attr(n,{fill:"transparent"}),!1!==t.showBorderLine){var o=this.borderLineWidth;(isNaN(o)||o<0||o>10)&&(o=1),i.attr(n,{"stroke-width":o,stroke:t.borderLineColor||t._getThemeColor("line")})}"function"==typeof t.drawBefore&&t.drawBefore(i,e);var h={x:s.left,y:s.top,width:e.width-s.left-s.right,height:e.height-s.top-s.bottom};t._paddedRect=h;var d,u=t.titlePadding||{left:2,top:2,right:2,bottom:2};t.caption&&t.caption.length>0&&(d=i.measureText(t.caption,0,{class:"smart-chart-title-text"}),i.text(t.caption,h.x+u.left,h.y+u.top,h.width-(u.left+u.right),d.height,0,{class:"smart-chart-title-text"},!0,"center","center").id=t.id+"TitleText",h.y+=d.height,h.height-=d.height),t.description&&t.description.length>0&&(d=i.measureText(t.description,0,{class:"smart-chart-title-description"}),i.text(t.description,h.x+u.left,h.y+u.top,h.width-(u.left+u.right),d.height,0,{class:"smart-chart-title-description"},!0,"center","center").id=t.id+"TitleDescription",h.y+=d.height,h.height-=d.height),(t.caption||t.description)&&(h.y+=u.bottom+u.top,h.height-=u.bottom+u.top);var g={x:h.x,y:h.y,width:h.width,height:h.height};t._plotRect=g,t._buildStats(g);var f,p=t._isPieOnlySeries(),c=t.seriesGroups,m={xAxis:{},valueAxis:{}};for(let e=0;e<c.length&&!p;e++){if("pie"===c[e].type||"donut"===c[e].type)continue;var y=t._getXAxis(e);y||t.error(t.localize("missingAxis",{index:e,axis:"xAxis"}));let i=y===t._getXAxis()?-1:e;m.xAxis[i]=0}var _=t.axisPadding;isNaN(_)&&(_=5);var x={left:0,right:0,leftCount:0,rightCount:0},v=[];for(let e=0;e<c.length;e++){const i=c[e];if("pie"===i.type||"donut"===i.type||!0===i.spider||!0===i.polar){v.push({width:0,position:0,xRel:0});continue}f="horizontal"===i.orientation;let r=t._getXAxis(e),s=r===t._getXAxis()?-1:e;var b=t._getValueAxis(e),N=b===t._getValueAxis()?-1:e,M=f?r.axisSize:b.axisSize,A={x:0,y:g.y,width:g.width,height:g.height},w=f?t._getXAxis(e).position:b.position;M&&"auto"!==M||(f?(M=this._renderXAxis(e,A,!0,g).width,1==(1&m.xAxis[s])?M=0:M>0&&(m.xAxis[s]|=1)):(M=t._renderValueAxis(e,A,!0,g).width,1==(1&m.valueAxis[N])?M=0:M>0&&(m.valueAxis[N]|=1))),"left"!==w&&!0===t.rightToLeft&&(w="right"),"right"!==w&&(w="left"),x[w+"Count"]>0&&x[w]>0&&M>0&&(x[w]+=_),v.push({width:M,position:w,xRel:x[w]}),x[w]+=M,x[w+"Count"]++}var S=Math.max(1,Math.max(e.width,e.height)),C={top:0,bottom:0,topCount:0,bottomCount:0},k=[];for(let e=0;e<c.length;e++){const i=c[e];if("pie"===i.type||"donut"===i.type||!0===i.spider||!0===i.polar){k.push({height:0,position:0,yRel:0});continue}f="horizontal"===i.orientation;let r=this._getValueAxis(e),s=r===t._getValueAxis()?-1:e,a=t._getXAxis(e),l=a===t._getXAxis()?-1:e,n=f?r.axisSize:a.axisSize,o=f?r.position:a.position;n&&"auto"!==n||(f?(n=t._renderValueAxis(e,{x:0,y:0,width:S,height:0},!0,g).height,2==(2&m.valueAxis[s])?n=0:n>0&&(m.valueAxis[s]|=2)):(n=t._renderXAxis(e,{x:0,y:0,width:S,height:0},!0).height,2==(2&m.xAxis[l])?n=0:n>0&&(m.xAxis[l]|=2))),"top"!==o&&(o="bottom"),C[o+"Count"]>0&&C[o]>0&&n>0&&(C[o]+=_),k.push({height:n,position:o,yRel:C[o]}),C[o]+=n,C[o+"Count"]++}t._createAnimationGroup("series");const D=!1!==t.showLegend,T=t._legendLayout;var F=D?t._renderLegend(T?t._rect:h,!0):{width:0,height:0};if(!T||isNaN(this.legendLayout.left)&&isNaN(this.legendLayout.top)||(F={width:0,height:0}),h.height<C.top+C.bottom+F.height||h.width<x.left+x.right)i.endGroup();else{g.height-=C.top+C.bottom+F.height,g.x+=x.left,g.width-=x.left+x.right,g.y+=C.top;var O=[];if(!p)for(let e=0;e<c.length;e++){const i=c[e];if(!0===i.polar||!0===i.spider||"pie"===i.type||"donut"===i.type)continue;f="horizontal"===i.orientation;let r=t._getXAxis(e)===t._getXAxis()?-1:e,s=t._getValueAxis(e)===t._getValueAxis()?-1:e,a={x:g.x,y:0,width:g.width,height:k[e].height};if("top"!==k[e].position?a.y=g.y+g.height+k[e].yRel:a.y=g.y-k[e].yRel-k[e].height,f){if(4==(4&m.valueAxis[s]))continue;if(!t._isGroupVisible(e))continue;t._renderValueAxis(e,a,!1,g),m.valueAxis[s]|=4}else{if(O.push(a),4==(4&m.xAxis[r]))continue;if(!t._isGroupVisible(e))continue;t._renderXAxis(e,a,!1,g),m.xAxis[r]|=4}}if(D){const e=t._legendLayout,i=e?t._rect:h;let r=h.x+this.renderer._ptrnd((h.width-F.width)/2),s=g.y+g.height+C.bottom,a=h.width,l=F.height;e&&(isNaN(t.legendLayout.left)||(r=t.legendLayout.left),isNaN(t.legendLayout.top)||(s=t.legendLayout.top),isNaN(t.legendLayout.width)||(a=t.legendLayout.width),isNaN(t.legendLayout.height)||(l=t.legendLayout.height)),r+a>i.x+i.width&&(a=i.x+i.width-r),s+l>i.y+i.height&&(l=i.y+i.height-s),t._renderLegend({x:r,y:s,width:a,height:l})}if(t._hasHorizontalLines=!1,!p)for(let e=0;e<c.length;e++){const i=c[e];if(!0===i.polar||!0===i.spider||"pie"===i.type||"donut"===i.type)continue;f="horizontal"===c[e].orientation;let r={x:g.x-v[e].xRel-v[e].width,y:g.y,width:v[e].width,height:g.height};"left"!==v[e].position&&(r.x=g.x+g.width+v[e].xRel);let s=t._getXAxis(e)===t._getXAxis()?-1:e,a=t._getValueAxis(e)===t._getValueAxis()?-1:e;if(f){if(O.push(r),8==(8&m.xAxis[s]))continue;if(!t._isGroupVisible(e))continue;t._renderXAxis(e,r,!1,g),m.xAxis[s]|=8}else{if(8==(8&m.valueAxis[a]))continue;if(!t._isGroupVisible(e))continue;t._renderValueAxis(e,r,!1,g),m.valueAxis[a]|=8}}if(!(g.width<=0||g.height<=0)){t._plotRect={x:g.x,y:g.y,width:g.width,height:g.height};for(let e=0;e<c.length;e++)this._drawPlotAreaLines(e,!0,{gridLines:!1,tickMarks:!1,alternatingBackground:!0}),this._drawPlotAreaLines(e,!1,{gridLines:!1,tickMarks:!1,alternatingBackground:!0});for(let e=0;e<c.length;e++)this._drawPlotAreaLines(e,!0,{gridLines:!0,tickMarks:!0,alternatingBackground:!1}),this._drawPlotAreaLines(e,!1,{gridLines:!0,tickMarks:!0,alternatingBackground:!1});var I=!1;for(let e=0;e<c.length&&!I;e++){const t=c[e];if(void 0!==t.annotations||"function"==typeof t.draw||"function"==typeof t.drawBefore){I=!0;break}}var P=i.beginGroup();if(t.clip&&!I){var R=i.createClipRect({x:g.x-2,y:g.y,width:g.width+4,height:g.height});i.setClip(P,R)}for(let r=0;r<c.length;r++){const s=c[r];var L=!1;for(var G in t._seriesTypes)if(t._seriesTypes[G]===s.type){L=!0;break}L||t.error(t.localize("invalidType",{type:s.type})),"function"==typeof s.drawBefore&&s.drawBefore(i,e,r,this),!0!==s.polar&&!0!==s.spider||-1===s.type.indexOf("pie")&&-1===s.type.indexOf("donut")&&t._renderSpiderAxis(r,g),t._renderAxisBands(r,g,!0),t._renderAxisBands(r,g,!1)}for(let r=0;r<c.length;r++){const s=c[r];if(t._isColumnType(s.type)?t._renderColumnSeries(r,g):-1!==s.type.indexOf("pie")||-1!==s.type.indexOf("donut")?t._renderPieSeries(r,g):-1!==s.type.indexOf("line")||-1!==s.type.indexOf("area")?t._renderLineSeries(r,g):-1!==s.type.indexOf("scatter")||-1!==s.type.indexOf("bubble")?t._renderScatterSeries(r,g):-1===s.type.indexOf("candlestick")&&-1===s.type.indexOf("ohlc")||t._renderCandleStickSeries(r,g,-1!==s.type.indexOf("ohlc")),s.annotations){this._moduleAnnotations||t.error(t.localize("missingReference",{files:"smart.chart.annotations.js"}));for(let e=0;e<s.annotations.length;e++)t._renderAnnotation(r,s.annotations[e],g)}"function"==typeof s.draw&&s.draw(i,e,r,this)}if(i.endGroup(),t.disabled){var V=i.rect(e.x,e.y,e.width,e.height);i.attr(V,{fill:"#777777",opacity:.5,stroke:"#00FFFFFF"})}"function"==typeof t.draw&&t.draw(i,e),i.endGroup(),t._startAnimation("series"),t._credits&&t._credits();var E=!1;for(let e=0;e<t.seriesGroups.length&&!E;e++){let i=t._getXAxis(e);i&&i.rangeSelector&&i.rangeSelector.visible&&(E=!0,t._hasRangeSelector=!0)}if(E){this._moduleRangeSelector||t.error(t.localize("missingReference",{files:"smart.chart.rangeselector.js"}));var B=[];t._isSelectorRefresh||(t._rangeSelectorInstances={});for(let e=0;e<t.seriesGroups.length;e++){var H=this._getXAxis(e);-1===B.indexOf(H)&&this._renderXAxisRangeSelector(e,O[e])&&B.push(H)}}}}}_credits(){}_isPieOnlySeries(){let e=this.seriesGroups;if(0===e.length)return!1;for(let t=0;t<e.length;t++)if("pie"!==e[t].type&&"donut"!==e[t].type)return!1;return!0}_renderChartLegend(e,t,i,r){var s=this,a=s.renderer,l={x:t.x,y:t.y,width:t.width,height:t.height};l.width>=6&&(l.x+=3,l.width-=6),l.height>=6&&(l.y+=3,l.height-=6);var n={width:l.width,height:0},o=0,h=0,d=20,u=0,g=10,f=0;for(let I=0;I<e.length;I++){var p=e[I].css;p||(p="smart-chart-legend-text"),d=20;var c=e[I].text,m=a.measureText(c,0,{class:p});m.height>d&&(d=m.height),m.width>f&&(f=m.width),r?(0!==I&&(h+=d),h>l.height&&(h=0,o+=f+20+g,f=m.width,n.width=o+f)):(0!==o&&(o+=10),o+20+m.width>l.width&&m.width<l.width&&(o=0,h+=d,d=20,u=l.width,n.height=h+d));var y=!1;if(m.width>l.width){y=!0;var _=l.width,x=c.split(/\s+/);let e=[],t="";for(let i=0;i<x.length;i++){var v=t+(t.length>0?" ":"")+x[i];s.renderer.measureText(v,0,{class:p}).width>_&&v.length>0&&t.length>0?(e.push({text:t}),t=x[i]):t=v,i+1===x.length&&e.push({text:t})}m.width=0;var b=0;for(let t=0;t<e.length;t++){var N=e[t].text;let i=s.renderer.measureText(N,0,{class:p});m.width=Math.max(m.width,i.width),b+=m.height}m.height=b}var M=o+m.width<l.width&&h+m.height<t.height;if(s._legendLayout){let e=l.x+o+m.width<s._rect.x+s._rect.width&&l.y+h+m.height<s._rect.y+s._rect.height;this._renderInBounds=e}if(!i&&M){var A=e[I].seriesIndex,w=e[I].groupIndex,S=e[I].itemIndex,C=e[I].fillColor,k=e[I].lineColor,D=s._isSerieVisible(w,A,S),T=a.beginGroup(),F=D?e[I].opacity:.1;if(y){let t=c,i=l.width,n=t.split(/\s+/);var O=0;let u=[],f="";for(let e=0;e<n.length;e++){let t=f+(f.length>0?" ":"")+n[e],r=s.renderer.measureText(t,0,{class:p});r.width>i&&t.length>0&&f.length>0?(u.push({text:f,dy:O}),O+=r.height,f=n[e]):f=t,e+1===n.length&&u.push({text:f,dy:O})}for(let e=0;e<u.length;e++){let t=u[e].text;O=u[e].dy,s.renderer.measureText(t,0,{class:p}),r?s.renderer.text(t,l.x+o+15,l.y+h+O,m.width,d,0,{class:p},!1,"left","center"):s.renderer.text(t,l.x+o+15,l.y+h+O,m.width,d,0,{class:p},!1,"center","center")}let y=a.rect(l.x+o,l.y+h+5+O/2,g,g);r&&(h+=O),s.renderer.attr(y,{fill:C,"fill-opacity":F,stroke:k,"stroke-width":1,"stroke-opacity":e[I].opacity})}else{let t,i=a.rect(l.x+o,l.y+h+5,g,g);s.renderer.attr(i,{fill:C,"fill-opacity":F,stroke:k,"stroke-width":1,"stroke-opacity":e[I].opacity,purpose:"legend-toggle",data:e[I]}),t=r?s.renderer.text(c,l.x+o+15,l.y+h,m.width,m.height+5,0,{class:p},!1,"left","center"):s.renderer.text(c,l.x+o+15,l.y+h,m.width,d,0,{class:p},!1,"center","center"),a.attr(t,{purpose:"legend-toggle",data:e[I]})}s.renderer.endGroup(),s._setLegendToggleHandler(w,A,S,T)}r||u<(o+=m.width+20)&&(u=o)}if(i)return n.height=this.renderer._ptrnd(h+d+5),n.width=this.renderer._ptrnd(u),n}isSerieVisible(e,t,i){return this._isSerieVisible(e,t,i)}_isSerieVisible(e,t,i){for(;this._itemsToggleState.length<e+1;)this._itemsToggleState.push([]);let r=this._itemsToggleState[e];for(;r.length<t+1;)r.push(!!isNaN(i)||[]);let s=r[t];if(isNaN(i))return s;for(Array.isArray(s)||(r[t]=s=[]);s.length<i+1;)s.push(!0);return s[i]}isGroupVisible(e){return this._isGroupVisible(e)}_isGroupVisible(e){let t=!1,i=this.seriesGroups[e].series;if(!i)return t;for(let r=0;r<i.length;r++)if(this._isSerieVisible(e,r)){t=!0;break}return t}_toggleSerie(e,t,i,r){let s=!this._isSerieVisible(e,t,i);void 0!==r&&(s=r);let a=this.seriesGroups[e],l=a.series[t];if(this.$.fireEvent("toggle",{state:s,seriesGroup:a,serie:l,elementIndex:i}),isNaN(i))this._itemsToggleState[e][t]=s;else{let r=this._itemsToggleState[e][t];for(Array.isArray(r)||(r=[]);r.length<i;)r.push(!0);r[i]=s}this._isToggleRefresh=!0,this.update(),this._isToggleRefresh=!1}showSerie(e,t,i){this._toggleSerie(e,t,i,!0)}hideSerie(e,t,i){this._toggleSerie(e,t,i,!1)}_setLegendToggleHandler(e,t,i,r){let s=this.seriesGroups[e],a=s.series[t].enableSeriesToggle;if(null==a&&(a=!1!==s.enableSeriesToggle),a){let s=this;this.renderer.addHandler(r,"click",(function(){s._toggleSerie(e,t,i)}))}}_renderLegend(e,t){let i=this,r=[];for(let e=0;e<i.seriesGroups.length;e++){let t=i.seriesGroups[e];if(!1!==t.showLegend)for(let s=0;s<t.series.length;s++){let a=t.series[s];if(!1===a.showLegend)continue;let l,n=i._getSerieSettings(e,s);if("pie"===t.type||"donut"===t.type){let o=i._getXAxis(e);const h=a.legendFormatSettings||t.legendFormatSettings||i._getFormatSettings(o)||i._getFormatSettings(a)||i._getFormatSettings(t);let d=a.legendFormatFunction||t.legendFormatFunction||o.formatFunction||a.formatFunction||t.formatFunction,u=i._getDataLen(e);for(let t=0;t<u;t++){l=i._getDataValue(t,a.displayText,e),l=i._formatValue(l,h,d,e,s,t);let o=i._getColors(e,s,t);r.push({groupIndex:e,seriesIndex:s,itemIndex:t,text:l,css:a.displayTextClass,fillColor:o.fillColor,lineColor:o.lineColor,opacity:n.opacity})}continue}const o=a.legendFormatSettings||t.legendFormatSettings;let h=a.legendFormatFunction||t.legendFormatFunction;l=i._formatValue(a.displayText||a.dataField||"",o,h,e,s,NaN);let d=i._getSeriesColors(e,s),u=this._get([a.legendFillColor,a.legendColor,d.fillColor]),g=this._get([a.legendLineColor,a.legendColor,d.lineColor]);r.push({groupIndex:e,seriesIndex:s,text:l,css:a.displayTextClass,fillColor:u,lineColor:g,opacity:n.opacity})}}return i._renderChartLegend(r,e,t,i._legendLayout&&"vertical"===i.legendLayout.flow)}_getInterval(e,t){if(!e)return t;let i=this._get([e.unitInterval,t]);return isNaN(e.step)||null===e.step||(i=e.step*t),i}_getOffsets(e,t,i,r,s,a,l,n,o){let h,d=this._getInterval(s[e],n),u=[];if((""===e||s[e].visible&&"custom"!==s[e].visible)&&(u=this._generateIntervalValues(r,d,n,l,o)),"labels"!==e){let e=l?a.left:0;if(!l&&n>1&&(e=a.left*(n+1)),1===u.length&&(e*=2),h=this._valuesToOffsets(u,t,r,i,a,!1,e),!l){let e=(a.left+a.right)*d/n;t.flip?h.unshift(h[0]+e):h.push(h[h.length-1]+e)}}else{let e=a.left;1===u.length&&(e*=2),h=this._valuesToOffsets(u,t,r,i,a,l,e)}let g=this._arraysToObjectsArray([u,h],["value","offset"]);if(t[e]&&t[e].custom){let s=this._objectsArraysToArray(t[e].custom,"value"),n=this._objectsArraysToArray(t[e].custom,"offset"),o=this._valuesToOffsets(s,t,r,i,a,l,a.left);for(let i=0;i<t[e].custom.length;i++)g.push({value:s[i],offset:isNaN(n[i])?o[i]:n[i]})}return g}_renderXAxis(e,t,i,r){let s=this,a=s._getXAxis(e),l=s.seriesGroups[e],n="horizontal"===l.orientation,o={width:0,height:0},h=s._getAxisSettings(a);if(!a||!h.visible||"spider"===l.type)return o;if(!s._isGroupVisible(e)||this._isPieGroup(e))return o;let d=s._alignValuesWithTicks(e);for(;s._renderData.length<e+1;)s._renderData.push({});s.rightToLeft?(a._flip=a.flip,a.flip=!0):void 0!==a._flip&&(a.flip=a._flip);let u=n?t.height:t.width,g=s._calculateXOffsets(e,u),f=g.axisStats,p=a.rangeSelector&&a.rangeSelector.visible,c=0;p&&(this._moduleRangeSelector||s.error(s.localize("missingReference",{files:"smart.chart.rangeselector.js"})),c=this._selectorGetSize(a));let m=n&&"right"===a.position||!n&&"top"===a.position;!i&&p&&(n?(t.width-=c,"right"!==a.position&&(t.x+=c)):(t.height-=c,"top"===a.position&&(t.y+=c)));let y={rangeLength:g.rangeLength,itemWidth:g.itemWidth,intervalWidth:g.intervalWidth,data:g,settings:h,isMirror:m,rect:t};s._renderData[e].xAxis=y;let _=f.interval;if(isNaN(_))return o;n&&(h.title.angle-=90,h.labels.angle-=90);let x,v,b=this._getInterval(h.gridLines,_),N=this._getInterval(h.tickMarks,_),M=this._getInterval(h.labels,_),A=f.min,w=f.max,S=g.padding,C=!0===a.flip||s.rightToLeft,k={min:A,max:w};f.logAxis.enabled&&(k.min=f.logAxis.minPow,k.max=f.logAxis.maxPow),"date"===a.type?(h.gridLines.offsets=this._generateDTOffsets(A,w,u,S,b,_,f.dateTimeUnit,d,NaN,!1,C),h.tickMarks.offsets=this._generateDTOffsets(A,w,u,S,N,_,f.dateTimeUnit,d,NaN,!1,C),x=this._generateDTOffsets(A,w,u,S,M,_,f.dateTimeUnit,d,NaN,!0,C)):(h.gridLines.offsets=this._getOffsets("gridLines",a,u,f,h,S,d,_),h.tickMarks.offsets=this._getOffsets("tickMarks",a,u,f,h,S,d,_),x=this._getOffsets("labels",a,u,f,h,S,d,_)),s._elementRenderInfo&&s._elementRenderInfo.length>e&&(v=s._elementRenderInfo[e].xAxis);let D,T=[];h.labels.formatFunction&&(D=h.labels.formatFunction);const F=s._getFormatSettings(h.labels);let O;F&&(O=Object.assign({},F)),"date"===a.type&&(a.dateFormat&&!D?O?O.dateFormat=O.dateFormat||a.dateFormat:O={dateFormat:a.dateFormat}:D||O&&(!O||O.dateFormat)||(D=this._getDefaultDTFormatFn(a.baseUnit||"day")));for(let t=0;t<x.length;t++){let i,r=x[t].value,l=x[t].offset;if(isNaN(l))continue;"date"!==a.type&&f.useIndeces&&a.dataField&&(i=Math.round(r),r=s._getDataValue(i,a.dataField,e),null==r&&(r=""));let n=s._formatValue(r,O,D,e,void 0,i);null!=n&&""!==n.toString()||(isNaN(i)&&(i=t),i>=f.filterRange.min&&i<=f.filterRange.max&&(n=f.useIndeces?(f.min+i).toString():void 0===r?"":r.toString()));let o={key:r,text:n,targetX:l,x:l};v&&v.itemOffsets[r]&&(o.x=v.itemOffsets[r].x,o.y=v.itemOffsets[r].y),T.push(o)}let I=s._getAnimProps(e),P=I.enabled&&T.length<500?I.duration:0;!1===s.enableAxisTextAnimation&&(P=0);let R={items:T,renderData:y},L=s._renderAxis(n,m,h,{x:t.x,y:t.y,width:t.width,height:t.height},r,_,!1,!0,R,i,P);return n?L.width+=c:L.height+=c,L}_animateAxisText(e,t){let i=e.items,r=e.textSettings;for(let e=0;e<i.length;e++){let s=i[e];if(!s)continue;if(!s.visible)continue;let a=s.targetX,l=s.targetY;isNaN(s.x)||isNaN(s.y)||(a=s.x+(a-s.x)*t,l=s.y+(l-s.y)*t),s.element&&(this.renderer.removeElement(s.element),s.element=void 0),s.element=this.renderer.text(s.text,a,l,s.width,s.height,r.angle,{class:r.style},!1,r.halign,r.valign,r.textRotationPoint)}}_getPolarAxisCoords(e,t){let i=this.seriesGroups[e],r=t.x+this._draw.getNum([i.offsetX,t.width/2]),s=t.y+this._draw.getNum([i.offsetY,t.height/2]),a=Math.min(t.width,t.height),l=i.radius;this._isPercent(l)&&(l=parseFloat(l)/100*a/2),isNaN(l)&&(l=a/2*.6);let n=this._alignValuesWithTicks(e),o=this._get([i.startAngle,i.minAngle,0])-90;o=isNaN(o)?0:2*Math.PI*o/360;let h=this._get([i.endAngle,i.maxAngle,360])-90;if(h=isNaN(h)?2*Math.PI:2*Math.PI*h/360,o>h){let e=o;o=h,h=e}let d=this.renderer._rnd(Math.abs(o-h)/(2*Math.PI),.001,!0),u=2*Math.PI*l*d,g=this._calcGroupOffsets(e,t).xoffsets;if(!g)return;let f,p=!(Math.abs(Math.abs(h-o)-2*Math.PI)>1e-5);if(i.spider){const t=this._getXAxisStats(e,this._getXAxis(e),u);let i=t.interval;(isNaN(i)||0===i)&&(i=1);let r=(t.max-t.min)/i+(p?1:0);if(r=Math.round(r),r>2){let e=Math.cos(Math.abs(h-o)/2/r);e=this.renderer._rnd(e,.01),0===e&&(e=1),f=l/e,f>l&&n&&(l=f)}}return l=this.renderer._ptrnd(l),{x:r,y:s,r:l,adjR:this._get([f,l]),itemWidth:g.itemWidth,rangeLength:g.rangeLength,valuesOnTicks:n,startAngle:o,endAngle:h,isClosedCircle:p,axisSize:u}}_toPolarCoord(e,t,i,r){let s=Math.abs(e.startAngle-e.endAngle)/(2*Math.PI),a=2*(i-t.x)*Math.PI*s/Math.max(1,t.width)+e.startAngle,l=(t.height+t.y-r)*e.r/Math.max(1,t.height),n=e.x+l*Math.cos(a),o=e.y+l*Math.sin(a);return{x:this.renderer._ptrnd(n),y:this.renderer._ptrnd(o)}}_renderSpiderAxis(e,t){let i=this,r=i._getXAxis(e),s=this._getAxisSettings(r);if(!r||!s.visible)return;let a=i.seriesGroups[e],l=i._getPolarAxisCoords(e,t);if(!l)return;let n=this.renderer._ptrnd(l.x),o=this.renderer._ptrnd(l.y),h=l.adjR,d=l.startAngle,u=l.endAngle;if(h<1)return;let g=this.renderer._rnd(Math.abs(d-u)/(2*Math.PI),.001,!0),f=2*Math.PI*h*g,p=l.isClosedCircle,c=this._renderData[e].xoffsets;if(!c.rangeLength)return;let m=c.axisStats.interval;for((isNaN(m)||m<1)&&(m=1);i._renderData.length<e+1;)i._renderData.push({});let y={rangeLength:c.rangeLength,itemWidth:c.itemWidth,data:c,rect:t,settings:s};i._renderData[e].xAxis=y,i._renderData[e].polarCoords=l;let _=!0;for(let t=0;t<e;t++){let e=i._renderData[t].polarCoords,s=i._getXAxis(t),a=!1;for(let t in l)if(l[t]!==e[t]){a=!0;break}a&&s===r||(_=!1)}let x,v,b=s.gridLines,N=s.tickMarks,M=s.labels,A=this._getInterval(b,m),w=this._getInterval(N,m),S=this._getInterval(M,m),C=i._alignValuesWithTicks(e),k=i.renderer,D=c.axisStats,T=D.min,F=D.max,O=this._getPaddingSize(c.axisStats,r,C,f,!0,p,!1),I=!0===r.flip||i.rightToLeft;"date"===r.type?(b.offsets=this._generateDTOffsets(T,F,f,O,A,m,r.baseUnit,!0,0,!1,I),N.offsets=this._generateDTOffsets(T,F,f,O,w,m,r.baseUnit,!0,0,!1,I),x=this._generateDTOffsets(T,F,f,O,S,m,r.baseUnit,!0,0,!0,I)):(s.gridLines.offsets=this._getOffsets("gridLines",r,f,D,s,O,!0,m),s.tickMarks.offsets=this._getOffsets("tickMarks",r,f,D,s,O,!0,m),x=this._getOffsets("labels",r,f,D,s,O,!0,m)),i._elementRenderInfo&&i._elementRenderInfo.length>e&&(v=i._elementRenderInfo[e].xAxis);let P=[],R=this._getDataLen(e);for(let t=0;t<x.length;t++){let s,a=x[t].offset,l=x[t].value;if("date"!==r.type&&D.useIndeces&&r.dataField){if(s=Math.round(l),s>=R)continue;l=i._getDataValue(s,r.dataField),null==l&&(l="")}let n=i._formatValue(l,i._getFormatSettings(M.formatSettings),M.formatFunction,e,void 0,s);null!=n&&""!==n.toString()||(n=D.useIndeces?(D.min+t).toString():null==l?"":l.toString());let o={key:l,text:n,targetX:a,x:a};v&&v.itemOffsets[l]&&(o.x=v.itemOffsets[l].x,o.y=v.itemOffsets[l].y),P.push(o)}let L={stroke:b.color||i._getThemeColor("line"),fill:"none","stroke-width":b.width,"stroke-dasharray":b.dashStyle||""};if(!a.spider)if(1===g)k.circle(n,o,h,L);else{let e=-d/Math.PI*180,t=-u/Math.PI*180;this.renderer.pieslice(n,o,0,h,Math.min(e,t),Math.max(e,t),void 0,L)}let G=d;if(b.visible&&_){C||p||b.offsets.unshift({offset:-O.right});for(let e=0;e<b.offsets.length;e++){let t=b.offsets[e].offset;C||(t+=p?O.right/2:O.right);const i=G+2*t*Math.PI*g/Math.max(1,f);if(i-u>.01)continue;let r=this.renderer._ptrnd(n+h*Math.cos(i)),s=this.renderer._ptrnd(o+h*Math.sin(i));k.line(n,o,r,s,L)}}if(N.visible&&_){let e=5,t={stroke:N.color||i._getThemeColor("line"),fill:"none","stroke-width":N.width,"stroke-dasharray":N.dashStyle||""};C||p||N.offsets.unshift({offset:-O.right});for(let i=0;i<N.offsets.length;i++){let r=N.offsets[i].offset;C||(r+=p?O.right/2:O.right);const s=G+2*r*Math.PI*g/Math.max(1,f);if(s-u>.01)continue;let a={x:n+h*Math.cos(s),y:o+h*Math.sin(s)},l={x:n+(h+e)*Math.cos(s),y:o+(h+e)*Math.sin(s)};k.line(this.renderer._ptrnd(a.x),this.renderer._ptrnd(a.y),this.renderer._ptrnd(l.x),this.renderer._ptrnd(l.y),t)}}let V=[];if(a.spider){let e=[];e="date"===r.type?this._generateDTOffsets(T,F,f,O,m,m,r.baseUnit,!0,0,!1,I):this._getOffsets("",r,f,D,s,O,!0,m),C||p||e.unshift({offset:-O.right});for(let t=0;t<e.length;t++){let i=e[t].offset;C||(i+=p?O.right/2:O.right);const r=G+2*i*Math.PI*g/Math.max(1,f);r-u>.01||V.push(r)}y.offsetAngles=V}let E=i._renderSpiderValueAxis(e,t,C?l.adjR:l.r,V);if(E||(E=[]),a.spider){if(!C)for(let e=0;e<E.length;e++)E[e]=E[e]*l.adjR/l.r;E.push(h),this._renderSpiderLines(n,o,E,l,V,L)}if(_&&M.visible){y.polarLabels=[];for(let e=0;e<P.length;e++){let t=G+2*P[e].x*Math.PI*g/Math.max(1,f);t=(360-t/(2*Math.PI)*360)%360,t<0&&(t=360+t);let i,r=k.measureText(P[e].text,0,{class:s.labels.style}),a=(C?l.adjR:l.r)+(N.visible?7:2),h=s.labels;if(h.autoRotate){let e=this._draw._ptRotate(n-r.width/2,o-a-r.height,n,o,-t/180*Math.PI),s=this._draw._ptRotate(n+r.width/2,o-a,n,o,-t/180*Math.PI);r.width=Math.abs(e.x-s.x),r.height=Math.abs(e.y-s.y),i={x:Math.min(e.x,s.x),y:Math.min(e.y,s.y)}}else i=this._adjustTextBoxPosition(n,o,r,a,t,!1,!1,!1);y.polarLabels.push({x:i.x,y:i.y,value:P[e].text}),k.text(P[e].text,i.x,i.y,r.width,r.height,h.autoRotate?90-t:h.angle,{class:h.style},!1,h.halign,h.valign)}}}_renderSpiderLines(e,t,i,r,s,a){let l=this.renderer,n=r.isClosedCircle;for(let r=0;r<i.length;r++){let o,h,d=i[r];for(let i=0;i<s.length;i++){let r=s[i],n=this.renderer._ptrnd(e+d*Math.cos(r)),u=this.renderer._ptrnd(t+d*Math.sin(r));o&&l.line(o.x,o.y,n,u,a),o={x:n,y:u},h||(h={x:n,y:u})}h&&n&&l.line(o.x,o.y,h.x,h.y,a)}}_renderSpiderValueAxis(e,t,i,r){var s=this,a=this.seriesGroups[e],l=this._getPolarAxisCoords(e,t);if(!l)return;var n=this.renderer._ptrnd(l.x),o=this.renderer._ptrnd(l.y);i=i||l.r;var h=l.startAngle,d=l.endAngle,u=this.renderer._rnd(Math.abs(h-d)/(2*Math.PI),.001,!0);if(i<1)return;i=this.renderer._ptrnd(i);var g=this._getValueAxis(e);const f=this._getAxisSettings(g);if(g&&!1!==f.visible){var p=this._stats.seriesGroups[e].mu,c=f.labels,m=s._getFormatSettings(c);-1!==a.type.indexOf("stacked")&&-1!==a.type.indexOf("100")&&!m&&(m={sufix:"%"});var y=this._get([c.step,c.unitInterval/p]);isNaN(y)&&(y=1),y=Math.max(1,Math.round(y)),this._calcValueAxisItems(e,i,y);var _=f.gridLines,x=f.tickMarks,v=f.labels,b={stroke:_.color||s._getThemeColor("line"),fill:"none","stroke-width":1,"stroke-dasharray":_.dashStyle||""},N=this._renderData[e].valueAxis,M=N.items,A=h;if(M.length&&f.line.visible){isNaN(f.line.angle)||(A=2*Math.PI*f.line.angle/360);var w=n+Math.cos(A)*i,S=o+Math.sin(A)*i;if(-1===r.indexOf(A)){var C=Object.assign({},b);C["stroke-width"]=f.line.lineWidth,C.stroke=f.line.color||s._getThemeColor("line"),C["stroke-dasharray"]=f.line.dashStyle,this.renderer.line(n,o,w,S,C)}}M=M.reverse();var k=this.renderer;N.polarLabels=[];for(let e=0;e<M.length-1;e++){var D=M[e];if(isNaN(D))continue;var T=v.formatFunction?v.formatFunction(D):this._formatNumber(D,m),F=k.measureText(T,0,{class:v.style}),O=n+(!1!==g.showTickMarks?3:2);let t=o-N.itemWidth*e-F.height/2;var I=this._draw._ptRotate(O,t,n,o,A),P=this._draw._ptRotate(O+F.width,t+F.height,n,o,A);O=Math.min(I.x,P.x),t=Math.min(I.y,P.y),F.width=Math.abs(I.x-P.x),F.height=Math.abs(I.y-P.y),O+=f.labels.textOffset.x,t+=f.labels.textOffset.y,N.polarLabels.push({x:O,y:t,value:T}),k.text(T,O,t,F.width,F.height,v.autoRotate?90+180*h/Math.PI:v.angle,{class:v.style},!1,v.halign,v.valign)}var R=!1!==g.valuesOnTicks,L=this._stats.seriesGroups[e],G=L.mu,V=!0===g.logarithmicScale;V&&(G=1);var E={min:L.min,max:L.max,logAxis:{enabled:!0===V,base:g.logarithmicScaleBase,minPow:L.minPow,maxPow:L.maxPow}};(_.visible||a.spider||g.alternatingBackgroundColor||g.alternatingBackgroundColor2)&&(_.offsets=this._getOffsets("gridLines",g,i,E,f,{left:0,right:0},R,G));var B=[];if(_.visible||a.spider){let e={stroke:_.color||s._getThemeColor("line"),fill:"none","stroke-width":1,"stroke-dasharray":_.dashStyle||""};for(let t=0;t<_.offsets.length;t++){let r=this.renderer._ptrnd(_.offsets[t].offset);if(r!==i)if(a.spider)B.push(r);else if(1!==u){var H=-h/Math.PI*180,z=-d/Math.PI*180;this.renderer.pieslice(n,o,0,r,Math.min(H,z),Math.max(H,z),void 0,e)}else k.circle(n,o,r,e)}}if(g.tickMarks&&(g.tickMarks.visible||g.showTickMarks)||(x.visible=!1),x.visible){x.offsets=this._getOffsets("tickMarks",g,i,E,f,{left:0,right:0},R,G);const e=2*x.size;let t={stroke:x.color||s._getThemeColor("line"),fill:"none","stroke-width":1,"stroke-dasharray":x.dashStyle||""};for(let i=0;i<x.offsets.length;i++){var W=x.offsets[i].offset;let r={x:n+W*Math.cos(A)-e/2*Math.sin(A+Math.PI/2),y:o+W*Math.sin(A)-e/2*Math.cos(A+Math.PI/2)},s={x:n+W*Math.cos(A)+e/2*Math.sin(A+Math.PI/2),y:o+W*Math.sin(A)+e/2*Math.cos(A+Math.PI/2)};k.line(this.renderer._ptrnd(r.x),this.renderer._ptrnd(r.y),this.renderer._ptrnd(s.x),this.renderer._ptrnd(s.y),t)}}return B}}_renderAxis(e,t,i,r,s,a,l,n,o,h,d){if(i.customDraw&&!h)return{width:NaN,height:NaN};let u=i.title,g=i.labels,f=i.tickMarks,p=i.padding,c=f.visible?f.size:0,m={width:0,height:0},y={width:0,height:0};e?m.height=y.height=r.height:m.width=y.width=r.width,!h&&t&&e&&(r.x-=r.width);let _=o.renderData,x=_.itemWidth;if(u.visible&&void 0!==u.text&&null!==u.text&&""!==u){let i=u.angle,s=this.renderer.measureText(u.text,i,{class:u.style});y.width=s.width,y.height=s.height,h||this.renderer.text(u.text,r.x+u.offset.x+(e?t?-p.right-2+2*r.width-y.width:2+p.left:0),r.y+u.offset.y+(e?0:t?p.top+2:r.height-2-y.height-p.bottom),e?y.width:r.width,e?r.height:y.height,i,{class:u.style},!0,u.halign,u.valign,u.rotationPoint)}let v=0,b=n?-x/2:0;n&&!e&&(g.halign="center");let N=r.x,M=r.y,A=g.textOffset;A&&(isNaN(A.x)||(N+=A.x),isNaN(A.y)||(M+=A.y)),e?(N+=p.left+2+(y.width>0?y.width+2:0)+(t?r.width-y.width:0),M+=b):(N+=b,t?(M+=y.height>0?y.height+6:4,M+=c-(n?c:c/4)):M+=n?c:c/4,M+=p.top);let w=0,S=0,C=o.items;_.itemOffsets={},!this._isToggleRefresh&&this._isUpdate||(d=0);let k=!1,D=0;for(let i=0;i<C.length&&g.visible;i++,v+=x){if(!C[i]||isNaN(x))continue;let s=C[i].text;isNaN(C[i].targetX)||(v=C[i].targetX);let a=this.renderer.measureText(s,g.angle,{class:g.style});if(a.width>S&&(S=a.width),a.height>w&&(w=a.height),D+=e?w:S,!h){if(e&&v>r.height+2||!e&&v>r.width+2)continue;const s=e?N+(t?0===y.width?c:c-2:0):N+v;let a=e?M+v:M;_.itemOffsets[C[i].key]={x:s,y:a},k||(!isNaN(C[i].x)||!isNaN(C[i].y)&&d)&&(k=!0),C[i].targetX=s,C[i].targetY=a,C[i].width=e?r.width-p.left-p.right-4-c-(y.width>0?y.width+2:0):x,C[i].height=e?x:r.height-p.top-p.bottom-4-c-(y.height>0?y.height+2:0),C[i].visible=!0}}if(_.avgWidth=0===C.length?0:D/C.length,!h){let e={items:C,textSettings:g};if(!isNaN(d)&&k||(d=0),this._animateAxisText(e,0===d?1:0),0!==d){let t=this;this._enqueueAnimation("series",void 0,void 0,d,(function(e,i,r){t._animateAxisText(i,r)}),e)}}if(m.width+=4+c+y.width+S+(e&&y.width>0?2:0),m.height+=4+c+y.height+w+(!e&&y.height>0?2:0),e?m.width+=p.left+p.right:m.height+=p.top+p.bottom,!h&&i.line.visible){let s={stroke:i.line.color||self._getThemeColor("line"),"stroke-width":i.line.width,"stroke-dasharray":i.line.dashStyle||""};if(e){let e=r.x+r.width+(t?p.left:-p.right);e=this.renderer._ptrnd(e),this.renderer.line(e,r.y,e,r.y+r.height,s)}else{let e=this.renderer._ptrnd(r.y+(t?r.height-p.bottom:p.top));this.renderer.line(this.renderer._ptrnd(r.x),e,this.renderer._ptrnd(r.x+r.width+1),e,s)}}return m.width=this.renderer._rup(m.width),m.height=this.renderer._rup(m.height),m}_drawPlotAreaLines(e,t,i){var r=this.seriesGroups[e],s="horizontal"!==r.orientation;if(!this._renderData||this._renderData.length<=e)return;var a=t?"valueAxis":"xAxis",l=this._renderData[e][a];if(!l)return;var n=this._renderData.axisDrawState;n||(n=this._renderData.axisDrawState={});var o,h="";t?(h="valueAxis_"+(r.valueAxis?e:"")+(s?"swap":""),o=this._getValueAxis(e)):(h="xAxis_"+(r.xAxis?e:"")+(s?"swap":""),o=this._getXAxis(e)),n=n[h]?n[h]:n[h]={},t||(s=!s);var d=l.settings;if(!d)return;if(d.customDraw)return;var u=d.gridLines,g=d.tickMarks,f=d.padding,p=l.rect,c=this._plotRect;if(!u||!g)return;var m=.5,y={};let _={stroke:u.color||self._getThemeColor("line"),"stroke-width":u.width,"stroke-dasharray":u.dashStyle||""};var x=t?p.y+p.height:p.x,v=u.offsets;let b;if(t&&!o.flip&&(v=(v=v.slice(0)).reverse()),v&&v.length>0){var N=NaN;for(let e=0;e<v.length;e++)if(s?(b=this.renderer._ptrnd(p.y+v[e].offset),b<p.y-m&&(b=this.renderer._ptrnd(p.y)),b>p.y+p.height&&(b=p.y+p.height)):(b=this.renderer._ptrnd(p.x+v[e].offset),b>p.x+p.width+m&&(b=this.renderer._ptrnd(p.x+p.width))),!isNaN(b)&&(isNaN(N)||!(Math.abs(b-N)<2))){if(N=b,i.gridLines&&!1!==u.visible&&!0!==n.gridLines&&(s?this.renderer.line(this.renderer._ptrnd(c.x),b,this.renderer._ptrnd(c.x+c.width),b,_):this.renderer.line(b,this.renderer._ptrnd(c.y),b,this.renderer._ptrnd(c.y+c.height),_)),y[b]=!0,i.alternatingBackground&&(u.alternatingBackgroundColor||u.alternatingBackgroundColor2)&&!0!==n.alternatingBackground){var M,A=e%2==0?u.alternatingBackgroundColor2:u.alternatingBackgroundColor;e>0&&A&&(M=s?this.renderer.rect(this.renderer._ptrnd(c.x),x,this.renderer._ptrnd(c.width-1),b-x,_):this.renderer.rect(x,this.renderer._ptrnd(c.y),b-x,this.renderer._ptrnd(c.height),_),this.renderer.attr(M,{"stroke-width":0,fill:A,opacity:u.alternatingBackgroundOpacity||1}))}x=b}}if(_={stroke:g.color||self._getThemeColor("line"),"stroke-width":g.width,"stroke-dasharray":g.dashStyle||""},i.tickMarks&&g.visible&&!0!==n.tickMarks){var w=g.size;let e=g.offsets,i=NaN;for(let r=0;r<e.length;r++)if(s?(b=this.renderer._ptrnd(p.y+e[r].offset),b<p.y-m&&(b=this.renderer._ptrnd(p.y)),b>p.y+p.height&&(b=p.y+p.height)):(b=this.renderer._ptrnd(p.x+e[r].offset),b>p.x+p.width+m&&(b=this.renderer._ptrnd(p.x+p.width))),!isNaN(b)&&(isNaN(i)||!(Math.abs(b-i)<2))){if(y[b-1]?b--:y[b+1]&&b++,s){if(b>p.y+p.height+m)break}else if(b>p.x+p.width+m)break;i=b;var S=l.isMirror?w:-w;if(s){var C=p.x+p.width+("right"===o.position?f.left:-f.right);t||(C=p.x+(l.isMirror?f.left:-f.right+p.width)),this.renderer.line(C,b,C+S,b,_)}else{var k=p.y+(l.isMirror?p.height:0);k+=l.isMirror?-f.bottom:f.top,k=this.renderer._ptrnd(k),this.renderer.line(b,k,b,k-S,_)}}}n.tickMarks=n.tickMarks||i.tickMarks,n.gridLines=n.gridLines||i.gridLines,n.alternatingBackground=n.alternatingBackground||i.alternatingBackground}_calcValueAxisItems(e,t,i){let r=this._stats.seriesGroups[e];if(!r||!r.isValid)return!1;let s=this.seriesGroups[e],a=this._getValueAxis(e),l=!1!==a.valuesOnTicks,n=r.intervals,o=t/n,h=r.min,d=r.mu,u=!0===a.logarithmicScale,g=a.logarithmicScaleBase||10,f=-1!==s.type.indexOf("stacked")&&-1!==s.type.indexOf("100");for(u&&(d=isNaN(a.unitInterval)?1:a.unitInterval),l||(n=Math.max(n-1,1));this._renderData.length<e+1;)this._renderData.push({});this._renderData[e].valueAxis={};let p=this._renderData[e].valueAxis;p.itemWidth=p.intervalWidth=o,p.items=[];let c=p.items;for(let e=0;e<=n;e++){let t=0;t=u?f?r.max/Math.pow(g,n-e):h*Math.pow(g,e):l?h+e*d:h+(e+.5)*d,e%i==0?c.push(t):c.push(NaN)}return p.rangeLength=u&&!f?r.intervals:r.intervals*d,!0!==a.flip&&(c=c.reverse()),!0}_getDecimalPlaces(e,t,i){let r=0;isNaN(i)&&(i=10);for(let s=0;s<e.length;s++){let a=void 0===t?e[s]:e[s][t];if(isNaN(a))continue;let l=a.toString();for(let e=0;e<l.length;e++)if((l[e]<"0"||l[e]>"9")&&(r=l.length-(e+1),r>=0))return Math.min(r,i);for(r>0&&(a*=Math.pow(10,r));Math.round(a)!==a&&r<i;)r++,a*=10}return r}_renderValueAxis(e,t,i,r){let s=this.seriesGroups[e],a="horizontal"===s.orientation,l=this._getValueAxis(e);l||this.error(this.localize("missingAxis",{index:e,axis:"valueAxis"}));let n={width:0,height:0};if(!this._isGroupVisible(e)||this._isPieOnlySeries()||"spider"===s.type)return n;let o=!1!==l.valuesOnTicks,h=this._stats.seriesGroups[e],d=h.mu,u=!0===l.logarithmicScale,g=l.logarithmicScaleBase||10;if(u&&(d=isNaN(l.unitInterval)?1:l.unitInterval),0===d&&(d=1),isNaN(d))return n;let f=this._getAxisSettings(l),p=f.title,c=f.labels,m=l.labels||{};this._get([l.horizontalTextAlignment,m.horizontalAlignment])||0!==c.angle||(c.halign=a?"center":"right"===l.position?"left":"right");let y=this._get([c.step,c.unitInterval/d]);if(isNaN(y)&&(y=1),y=Math.max(1,Math.round(y)),!this._calcValueAxisItems(e,a?t.width:t.height,y)||!f.visible)return n;a||(p.angle=this.rightToLeft?90:-90,"centercenter"===p.rotationPoint&&("top"===p.valign?p.rotationPoint="rightcenter":"bottom"===p.valign&&(p.rotationPoint="leftcenter")));let _=this._renderData[e].valueAxis,x=this._getFormatSettings(c);-1!==s.type.indexOf("stacked")&&-1!==s.type.indexOf("100")&&!x&&(x={sufix:"%"}),c.formatFunction||x&&null!==x.decimalPlaces&&void 0!==x.decimalPlaces||(x=x||{},x.decimalPlaces=this._getDecimalPlaces([h.min,h.max,d],void 0,3));let v=f.gridLines,b=a?t.width:t.height,N=!0===l.flip;l.flip=!N;let M={min:h.min,max:h.max,logAxis:{enabled:!0===u,base:g,minPow:h.minPow,maxPow:h.maxPow}};(v.visible||l.alternatingBackgroundColor||l.alternatingBackgroundColor2)&&(v.offsets=this._getOffsets("gridLines",l,b,M,f,{left:0,right:0},o,d));let A=f.tickMarks;A.visible&&(A.offsets=this._getOffsets("tickMarks",l,b,M,f,{left:0,right:0},o,d));const w=this._getOffsets("labels",l,b,M,f,{left:0,right:0},o,d,!o);l.flip=N;let S,C=[];this._elementRenderInfo&&this._elementRenderInfo.length>e&&(S=this._elementRenderInfo[e].valueAxis);for(let e=0;e<w.length;e++){let t=w[e].value;if(isNaN(w[e].offset)){C.push(void 0);continue}let i={key:t,text:c.formatFunction?c.formatFunction(t):isNaN(t)?t:this._formatNumber(t,x)};S&&S.itemOffsets[t]&&(i.x=S.itemOffsets[t].x,i.y=S.itemOffsets[t].y),i.targetX=w[e].offset,isNaN(i.targetX)||C.push(i)}let k=a&&"top"===l.position||!a&&"right"===l.position||!a&&this.rightToLeft&&"left"!==l.position,D={items:C,renderData:_},T=this._getAnimProps(e),F=T.enabled&&C.length<500?T.duration:0;return!1===this.enableAxisTextAnimation&&(F=0),_.settings=f,_.isMirror=k,_.rect=t,this._renderAxis(!a,k,f,t,r,d,u,!0,D,i,F)}_objectsArraysToArray(e,t){let i=[];if(!Array.isArray(e))return i;for(let r=0;r<e.length;r++)i.push(e[r][t]);return i}_arraysToObjectsArray(e,t){let i=[];if(e.length!==t.length)return i;for(let r=0;r<e.length;r++)for(let s=0;s<e[r].length;s++)i.length<=s&&i.push({}),i[s][t[r]]=e[r][s];return i}_valuesToOffsets(e,t,i,r,s,a,l){let n=[];if(!t||!Array.isArray(e))return n;let o=i.logAxis.base,h=i.logAxis.enabled?"logarithmic":"linear",d=t.flip,u=r,g=0,f=0;s&&!isNaN(s.left)&&(g=s.left),s&&!isNaN(s.right)&&(f=s.right),u=r-g-f,r=u;for(let t=0;t<e.length;t++){let s=this._smartPlot.scale(e[t],{min:i.min.valueOf(),max:i.max.valueOf(),type:h,base:o},{min:0,max:a?r:u,flip:d},{});isNaN(s)?n.push(NaN):(isNaN(l)||(s+=l),s<=r+g+f+1?n.push(this.renderer._ptrnd(s)):n.push(NaN))}return n}_generateIntervalValues(e,t,i,r,s){let a=[],l=e.min,n=e.max;if(e.logAxis&&e.logAxis.enabled&&(l=e.logAxis.minPow,n=e.logAxis.maxPow),null==l||null==n)return a;if(l===n)return e.logAxis&&e.logAxis.enabled?[Math.pow(e.logAxis.base,l)]:[l];let o=1;i<1&&(o=1e6,l*=o,n*=o,i*=o);for(let e=l;e<=n;e+=i)a.push(e/o+(s?i/2:0));if(t>i){let e=[],r=Math.round(t/i);for(let t=0;t<a.length;t++)t%r==0&&e.push(a[t]);a=e}if(e.logAxis&&e.logAxis.enabled)for(let t=0;t<a.length;t++)a[t]=Math.pow(e.logAxis.base,a[t]);return a}_generateDTOffsets(e,t,i,r,s,a,l,n,o,h,d){l||(l="day");var u=[];if(e>t)return u;if(e===t)return h?u.push({offset:n?i/2:r.left,value:e}):n&&u.push({offset:i/2,value:e}),u;var g=i-r.left-r.right,f=e,p=r.left,c=p,m=a=Math.max(a,1),y=Math.min(1,a);for(a>1&&"millisecond"!==l&&(a=1);this.renderer._ptrnd(c)<=this.renderer._ptrnd(r.left+g+(n?0:r.right));){u.push({offset:c,value:f});var _=new Date(f.valueOf());if("millisecond"===l)_.setMilliseconds(f.getMilliseconds()+a);else if("second"===l)_.setSeconds(f.getSeconds()+a);else if("minute"===l)_.setMinutes(f.getMinutes()+a);else if("hour"===l){var x=_.valueOf();_.setHours(f.getHours()+a),x===_.valueOf()&&_.setHours(f.getHours()+a+1)}else"day"===l?_.setDate(f.getDate()+a):"month"===l?_.setMonth(f.getMonth()+a):"year"===l&&_.setFullYear(f.getFullYear()+a);c=p+((f=_).valueOf()-e.valueOf())*y/(t.valueOf()-e.valueOf())*g}if(d)for(let e=0;e<u.length;e++)u[e].offset=i-u[e].offset;if(m>1&&"millisecond"!==l){var v=[];for(let e=0;e<u.length;e+=m)v.push({offset:u[e].offset,value:u[e].value});u=v}if(!n&&!h&&u.length>1){let e=[];e.push({offset:0,value:void 0});for(let t=1;t<u.length;t++)e.push({offset:u[t-1].offset+(u[t].offset-u[t-1].offset)/2,value:void 0});var b=e.length;b>1?e.push({offset:e[b-1].offset+(e[b-1].offset-e[b-2].offset)}):e.push({offset:i,value:void 0}),u=e}if(s>a){let e=[];var N=Math.round(s/m);for(let t=0;t<u.length;t++)t%N==0&&e.push({offset:u[t].offset,value:u[t].value});u=e}return u}_hasStackValueReversal(e,t){let i=this.seriesGroups[e];if(-1===i.type.indexOf("stacked"))return!1;let r=-1!==i.type.indexOf("waterfall"),s=this._getDataLen(e),a=0,l=!1,n=[];for(let t=0;t<i.series.length;t++)n[t]=this._isSerieVisible(e,t);for(let o=0;o<s;o++){let s;r||(l=!1);for(let r=0;r<i.series.length;r++){if(!n[r])continue;const h=this._getDataValueAsNumber(o,i.series[r].dataField,e);if(isNaN(h))continue;if(i.series[r].summary&&void 0!==this._getDataValue(o,i.series[r].summary,e))continue;let d=l?h<0:h<t;if(l=!0,void 0===s&&(s=d),d!==s)return!0;s=d,a+=h}}return this.waterfallStackSum=a,!1}_getValueAxis(e){let t=null==e?this.valueAxis:this.seriesGroups[e].valueAxis||this.valueAxis;return t||(t=this.valueAxis={}),t}_buildStats(e){var t={seriesGroups:[]};this._stats=t;for(let B=0;B<this.seriesGroups.length;B++){var i=this.seriesGroups[B];t.seriesGroups[B]={};var r=this._getXAxis(B),s=this._getValueAxis(B),a=this._getXAxisStats(B,r,"horizontal"!==i.orientation?e.width:e.height);let H=t.seriesGroups[B];H.isValid=!0;var l="horizontal"===i.orientation?e.width:e.height,n=!0===s.logarithmicScale,o=s.logarithmicScaleBase;isNaN(o)&&(o=10);var h=-1!==i.type.indexOf("stacked"),d=h&&-1!==i.type.indexOf("100"),u=-1!==i.type.indexOf("range"),g=-1!==i.type.indexOf("waterfall");g&&!this._moduleWaterfall&&self.error(self.localize("missingReference",{files:"smart.chart.waterfall.js"})),d&&(H.psums=[],H.nsums=[]);var f=NaN,p=NaN,c=NaN,m=NaN,y=s?s.baselineValue:NaN;isNaN(y)&&(y=n&&!d?1:0);var _=!1;0!==y&&h&&(_=this._hasStackValueReversal(B,y))&&(y=0),h&&g&&(_=this._hasStackValueReversal(B,y));var x=this._getDataLen(B),v=0,b=NaN,N=[];if(g)for(let e=0;e<i.series.length;e++)N.push(NaN);var M=NaN;for(let e=0;e<x&&H.isValid;e++){if(r.rangeSelector&&r.rangeSelector.visible){var A=r.dataField?this._getDataValue(e,r.dataField,B):e;if(A&&a.isDateTime&&(A=this._castAsDate(A,r.dateFormat)),a.useIndeces&&(A=e),A&&(A.valueOf()<a.min.valueOf()||A.valueOf()>a.max.valueOf()))continue}var w=s.minValue,S=s.maxValue;s.baselineValue&&(w=isNaN(w)?y:Math.min(y,w),S=isNaN(S)?y:Math.max(y,S));var C=0,k=0;for(let t=0;i.series&&t<i.series.length;t++)if(this._isSerieVisible(B,t)){var D=NaN,T=NaN,F=NaN;if(-1!==i.type.indexOf("candle")||-1!==i.type.indexOf("ohlc")){var O=["Open","Low","Close","High"];for(var I in O){var P=this._getDataValueAsNumber(e,i.series[t]["dataField"+O[I]],B);isNaN(P)||(F=isNaN(T)?P:Math.min(F,P),T=isNaN(T)?P:Math.max(T,P))}}else if(u){var R=this._getDataValueAsNumber(e,i.series[t].dataFieldFrom,B),L=this._getDataValueAsNumber(e,i.series[t].dataFieldTo,B);T=Math.max(R,L),F=Math.min(R,L)}else{if(D=this._getDataValueAsNumber(e,i.series[t].dataField,B),g){if(this._isSummary(B,e)&&void 0!==this._getDataValue(e,i.series[t].summary,B))continue;h?(isNaN(M)||(D+=M),M=D):(isNaN(N[t])?N[t]=D:D+=N[t],N[t]=D)}if(isNaN(D)||n&&D<=0)continue;F=T=D}(isNaN(S)||T>S)&&(isNaN(s.maxValue)||T<=s.maxValue)&&(S=T),(isNaN(w)||F<w)&&(isNaN(s.minValue)||F>=s.minValue)&&(w=F),isNaN(D)||!h||g||(D>y?C+=D:D<y&&(k+=D))}if(d||(isNaN(s.maxValue)||(C=Math.min(s.maxValue,C)),isNaN(s.minValue)||(k=Math.max(s.minValue,k))),n&&d)for(let t=0;t<i.series.length;t++){if(!this._isSerieVisible(B,t)){b=.01;continue}let r=this._getDataValueAsNumber(e,i.series[t].dataField,B);if(isNaN(r)||r<=0)b=.01;else{var G=0===C?0:r/C;(isNaN(b)||G<b)&&(b=G)}}var V=C-k;v<V&&(v=V),d&&(H.psums[e]=C,H.nsums[e]=k),(S>p||isNaN(p))&&(p=S),(w<f||isNaN(f))&&(f=w),(C>c||isNaN(c))&&(c=C),(k<m||isNaN(m))&&(m=k)}d&&(c=0===c?0:Math.max(c,-m),m=0===m?0:Math.min(m,-c)),f===p&&(!isNaN(s.minValue)&&isNaN(s.maxValue)?(f=s.minValue,p=n?f*o:f+1):isNaN(s.minValue)&&!isNaN(s.maxValue)&&(p=s.maxValue,f=n?p/o:p-1)),f===p&&(0===f?(f=-1,p=1):f<0?p=0:n?1===f&&(f/=o,p*=o):f=0);var E={gmin:f,gmax:p,gsumP:c,gsumN:m,gbase:y,isLogAxis:n,logBase:o,minPercent:b,gMaxRange:v,isStacked:h,isStacked100:d,isWaterfall:g,hasStackValueReversal:_,valueAxis:s,valueAxisSize:l};E.isStacked&&(E.gsumN<0&&(E.gmin=Math.min(E.gmin,E.gbase+E.gsumN)),E.gsumP>0&&(E.gmax=Math.max(E.gmax,E.gbase+E.gsumP))),H.context=E}this._mergeCommonValueAxisStats();for(let e=0;e<t.seriesGroups.length;e++){let i=t.seriesGroups[e];if(i.isValid){var B=this._calcOutputGroupStats(i.context);for(let e in B)i[e]=B[e];delete i.context}}}_mergeCommonValueAxisStats(){let e={};for(let t=0;t<this.seriesGroups.length;t++){if(!this._isGroupVisible(t))continue;if(this.seriesGroups[t].valueAxis)continue;let i=this._stats.seriesGroups[t].context;e.gbase=i.gbase,(isNaN(e.gmin)||i.gmin<e.gmin)&&(e.gmin=i.gmin),(isNaN(e.gmax)||i.gmax>e.gmax)&&(e.gmax=i.gmax),(isNaN(e.gsumP)||i.gsumP>e.gsumP)&&(e.gsumP=i.gsumP),(isNaN(e.gsumN)||i.gsumN<e.gsumN)&&(e.gsumN=i.gsumN),(isNaN(e.logBase)||i.logBase<e.logBase)&&(e.logBase=i.logBase),(isNaN(e.minPercent)||i.minPercent<e.minPercent)&&(e.minPercent=i.minPercent),e.gsumN>0&&(e.gmin=Math.min(e.gmin,e.gbase+e.gsumN)),e.gsumP>0&&(e.gmax=Math.max(e.gmax,e.gbase+e.gsumP))}for(let t=0;t<this.seriesGroups.length;t++){if(this.seriesGroups[t].valueAxis)continue;let i=this._stats.seriesGroups[t].context;for(let t in e)i[t]=e[t]}}_calcOutputGroupStats(e){let t=e.gmin,i=e.gmax,r=e.gsumP,s=e.gsumN,a=e.gbase,l=e.isLogAxis,n=e.logBase,o=e.minPercent,h=e.gMaxRange,d=e.isStacked,u=e.isStacked100,g=e.isWaterfall,f=e.hasStackValueReversal,p=e.valueAxis,c=e.valueAxisSize,m=e.valueAxis.unitInterval;m||(m=this._calcInterval(t,i,Math.max(c/80,2))),t===i&&(t=a,i*=2);let y=NaN,_=0,x=0;if(l){if(u){y=0;let e=1;for(_=x=this._draw.log(100,n);e>o;)e/=n,_--,y++;t=Math.pow(n,_)}else d&&!g&&(i=Math.max(i,r)),x=this.renderer._rnd(this._draw.log(i,n),1,!0),i=Math.pow(n,x),_=this.renderer._rnd(this._draw.log(t,n),1,!1),t=Math.pow(n,_);m=n}t<s&&(s=t),i>r&&(r=i);let v=t,b=i;if(l||0!=Math.abs(b-v)%m&&(v=this.renderer._rnd(t,m,!1),b=this.renderer._rnd(i,m,!0)),u&&b>100&&(b=100),u&&!l&&(b=b>0?100:0,v=v<0?-100:0,m=p.unitInterval,(isNaN(m)||m<=0||m>=100)&&(m=10),100%m!=0))for(;m>=1&&100%m!=0;m--);return isNaN(b)||isNaN(v)||isNaN(m)?{}:(isNaN(y)&&(y=parseInt(((b-v)/(0===m?1:m)).toFixed())),l&&!u&&(y=x-_,h=Math.pow(n,y)),y<1?{}:{min:v,max:b,logarithmic:l,logBase:n,base:l?v:a,minPow:_,maxPow:x,sumP:r,sumN:s,mu:m,maxRange:h,intervals:y,hasStackValueReversal:f})}_getDataLen(e){let t=this.dataSource;return null!=e&&-1!==e&&this.seriesGroups[e].dataSource&&(t=this.seriesGroups[e].dataSource),t?t.length:0}_getDataValue(e,t,i){let r=this.dataSource;if(null!=i&&-1!==i&&(r=this.seriesGroups[i].dataSource||r),!(!r||e<0||e>r.length-1))return"function"==typeof t?t(e,r):t&&""!==t?r[e][t]:r[e]}_getDataValueAsNumber(e,t,i){let r=this._getDataValue(e,t,i);return this._isDate(r)?r.valueOf():("number"!=typeof r&&(r=parseFloat(r)),"number"!=typeof r&&(r=void 0),r)}_isPieGroup(e){let t=this.seriesGroups[e];return!(!t||!t.type||-1===t.type.indexOf("pie")&&-1===t.type.indexOf("donut"))}_renderPieSeries(e,t){let i=this._getDataLen(e),r=this.seriesGroups[e],s=this._calcGroupOffsets(e,t).offsets;for(let a=0;a<r.series.length;a++){let l=r.series[a];if(l.customDraw)continue;let n=this._getSerieSettings(e,a),o=this._getAnimProps(e,a),h=o.enabled&&i<5e3&&!this._isToggleRefresh&&o.duration;this._isTouchDevice&&this.renderer instanceof Smart.Utilities.HTML5Renderer&&(h=0);let d=this._get([l.minAngle,l.startAngle]);(isNaN(d)||d<0||d>360)&&(d=0);let u=this._get([l.maxAngle,l.endAngle]);(isNaN(u)||u<0||u>360)&&(u=360);let g={rect:t,minAngle:d,maxAngle:u,groupIndex:e,serieIndex:a,settings:n,items:[]};for(let t=0;t<i;t++){let i=s[a][t];if(!i.visible)continue;let r=i.fromAngle,l=i.toAngle,n=this.renderer.pieslice(i.x,i.y,i.innerRadius,i.outerRadius,r,0===h?l:r,i.centerOffset);this._setRenderInfo(e,a,t,{element:n});let o={displayValue:i.displayValue,itemIndex:t,visible:i.visible,x:i.x,y:i.y,innerRadius:i.innerRadius,outerRadius:i.outerRadius,fromAngle:r,toAngle:l,centerOffset:i.centerOffset};g.items.push(o)}this._animatePieSlices(g,0);let f=this;this._enqueueAnimation("series",void 0,void 0,h,(function(e,t,i){f._animatePieSlices(t,i)}),g)}}_sliceSortFunction(e,t){return e.fromAngle-t.fromAngle}_animatePieSlices(e,t){var i;this._elementRenderInfo&&this._elementRenderInfo.length>e.groupIndex&&this._elementRenderInfo[e.groupIndex].series&&this._elementRenderInfo[e.groupIndex].series.length>e.serieIndex&&(i=this._elementRenderInfo[e.groupIndex].series[e.serieIndex]);var r=this._getLabelsSettings(e.groupIndex,e.serieIndex,NaN),s=r.visible,a=[];for(let r=0;r<e.items.length;r++){const s=e.items[r];if(!s.visible)continue;let h=s.fromAngle;var l=s.fromAngle+t*(s.toAngle-s.fromAngle);if(i&&i[s.displayValue]){var n=i[s.displayValue].fromAngle,o=i[s.displayValue].toAngle;h=n+(h-n)*t,l=o+(l-o)*t}a.push({index:r,from:h,to:l})}i&&a.sort(this._sliceSortFunction);var h=NaN;for(let l=0;l<a.length;l++){const n=e.items[a[l].index];var d=this._getRenderInfo(e.groupIndex,e.serieIndex,n.itemIndex);let o=a[l].from,p=a[l].to;i&&(!isNaN(h)&&o>h&&(o=h),h=p,l===a.length-1&&p!==a[0].from&&(p=e.maxAngle+a[0].from));var u=this.renderer.pieSlicePath(n.x,n.y,n.innerRadius,n.outerRadius,o,p,n.centerOffset);this.renderer.attr(d.element,{d:u});var g=this._getColors(e.groupIndex,e.serieIndex,n.itemIndex,"radialGradient",n.outerRadius),f=e.settings;d.colors=g,d.settings=f,this.renderer.attr(d.element,{fill:g.fillColor,stroke:g.lineColor,"stroke-width":f.stroke,"fill-opacity":f.opacity,"stroke-opacity":f.opacity,"stroke-dasharray":"none"}),s&&this._showPieLabel(e.groupIndex,e.serieIndex,n.itemIndex,r,void 0,d.colors.lineColor),1===t&&this._installHandlers(d.element,"pieslice",e.groupIndex,e.serieIndex,n.itemIndex)}}_showPieLabel(e,t,i,r,s){let a=this._renderData[e].offsets[t][i];if(a.elementInfo.labelElement&&this.renderer.removeElement(a.elementInfo.labelElement),r||(r=this._getLabelsSettings(e,t,NaN)),!r.visible)return;let l=a.fromAngle,n=a.toAngle,o=Math.abs(l-n);o>360&&(l=0,n=360);let h=o/2+l;h%=360;let d,u=h*Math.PI*2/360;!0===r.autoRotate&&(d=h<90||h>270?360-h:180-h);let g=r.linesEnabled,f=this._showLabel(e,t,i,{x:0,y:0,width:0,height:0},"center","center",!0,!1,!1,d),p=r.radius||a.outerRadius+Math.max(f.width,f.height);this._isPercent(p)&&(p=parseFloat(p)/100*Math.min(this._plotRect.width,this._plotRect.height)/2),p+=a.centerOffset,isNaN(s)&&(s=0),p+=s;let c=this.seriesGroups[e],m=c.series[t],y=this._draw.getNum([m.offsetX,c.offsetX,this._plotRect.width/2]),_=this._draw.getNum([m.offsetY,c.offsetY,this._plotRect.height/2]),x=this._plotRect.x+y,v=this._plotRect.y+_,b=this._adjustTextBoxPosition(x,v,f,p,h,a.outerRadius>p,!1!==r.linesAngles,!0===r.autoRotate);const N={},M=b.x<x?0:f.width/2,A=Math.sqrt(Math.pow(b.x-x,2)+Math.pow(b.y-v,2))+M<a.outerRadius?arguments[5]:void 0;if(a.elementInfo.labelElement=this._showLabel(e,t,i,{x:b.x,y:b.y,width:f.width,height:f.height},"left","top",!1,!1,!1,d,N,A),p>a.outerRadius+s+5&&!1!==g){let e={lineColor:a.elementInfo.colors.lineColor,stroke:a.elementInfo.settings.stroke,opacity:a.elementInfo.settings.opacity,dashStyle:a.elementInfo.settings.dashStyle};a.elementInfo.labelArrowPath=this._updateLebelArrowPath(a.elementInfo.labelArrowPath,x,v,p,a.outerRadius+s,u,!1!==r.linesAngles,e,N)}}_updateLebelArrowPath(e,t,i,r,s,a,l,n,o){const h=this.renderer;let d=h._ptrnd(t+(r-0)*Math.cos(a)),u=h._ptrnd(i-(r-0)*Math.sin(a)),g=h._ptrnd(t+(s+2)*Math.cos(a)),f=h._ptrnd(i-(s+2)*Math.sin(a)),p=[];p.push({x:o.x+o.width/2,y:o.y}),p.push({x:o.x+o.width/2,y:o.y+o.height}),p.push({x:o.x,y:o.y+o.height/2}),p.push({x:o.x+o.width,y:o.y+o.height/2}),l||(p.push({x:o.x,y:o.y}),p.push({x:o.x+o.width,y:o.y}),p.push({x:o.x+o.width,y:o.y+o.height}),p.push({x:o.x,y:o.y+o.height})),p=p.sort((function(e,r){return h._ptdist(e.x,e.y,t,i)-h._ptdist(r.x,r.y,t,i)})),p=p.sort((function(e,r){return Math.abs(e.x-t)+Math.abs(e.y-i)-(Math.abs(r.x-t)+Math.abs(r.y-i))}));for(let e=0;e<p.length;e++)p[e].x=h._ptrnd(p[e].x),p[e].y=h._ptrnd(p[e].y);d=p[0].x,u=p[0].y;let c="M "+d+","+u+" L"+g+","+f;return l&&(c="M "+d+","+u+" L"+g+","+u+" L"+g+","+f),e?h.attr(e,{d:c}):e=h.path(c,{}),h.attr(e,{fill:"none",stroke:n.lineColor,"stroke-width":n.stroke,"stroke-opacity":n.opacity,"stroke-dasharray":"none"}),e}_adjustTextBoxPosition(e,t,i,r,s,a,l,n){let o=s*Math.PI*2/360,h=this.renderer._ptrnd(e+r*Math.cos(o)),d=this.renderer._ptrnd(t-r*Math.sin(o));if(n){let s=i.width,a=i.height,l=Math.atan(a/s)%(2*Math.PI),n=o%(2*Math.PI),h=0;n<=l?h=s/2*Math.cos(o):n>=l&&n<Math.PI-l?h=a/2*Math.sin(o):n>=Math.PI-l&&n<Math.PI+l?h=s/2*Math.cos(o):n>=Math.PI+l&&n<2*Math.PI-l?h=a/2*Math.sin(o):n>=2*Math.PI-l&&n<2*Math.PI&&(h=s/2*Math.cos(o)),r+=Math.abs(h)+3;let d=this.renderer._ptrnd(e+r*Math.cos(o)),u=this.renderer._ptrnd(t-r*Math.sin(o));return d-=i.width/2,u-=i.height/2,{x:d,y:u}}return a?(h-=i.width/2,d-=i.height/2):l?s>=90&&s<270?(d-=i.height/2,h-=i.width):d-=i.height/2:s>=0&&s<45||s>=315&&s<360?d-=i.height/2:s>=45&&s<135?(d-=i.height,h-=i.width/2):s>=135&&s<225?(d-=i.height/2,h-=i.width):s>=225&&s<315&&(h-=i.width/2),{x:h,y:d}}_isColumnType(e){return-1!==e.indexOf("column")||-1!==e.indexOf("waterfall")}_getColumnGroupsCount(e){let t=0;e=e||"vertical";let i=this.seriesGroups;for(let r=0;r<i.length;r++){let s=i[r].orientation||"vertical";this._isColumnType(i[r].type)&&s===e&&t++}return this.columnSeriesOverlap&&(t=1),t}_getColumnGroupIndex(e){let t=0,i=this.seriesGroups[e].orientation||"vertical";for(let r=0;r<e;r++){let e=this.seriesGroups[r],s=e.orientation||"vertical";this._isColumnType(e.type)&&s===i&&t++}return t}_renderAxisBands(e,t,i){var r=i?this._getXAxis(e):this._getValueAxis(e),s=this.seriesGroups[e],a=i?void 0:s.bands;if(!a){for(let t=0;t<e;t++)if((i?this._getXAxis(t):this._getValueAxis(t))===r)return;a=r.bands}if(Array.isArray(a)){var l=t,n="horizontal"===s.orientation;n&&(l={x:t.y,y:t.x,width:t.height,height:t.width}),this._calcGroupOffsets(e,l);for(let r=0;r<a.length;r++){var o=a[r],h=o.minValue,d=o.maxValue,u=i?this.getXAxisDataPointOffset(h,e):this.getValueAxisDataPointOffset(h,e),g=i?this.getXAxisDataPointOffset(d,e):this.getValueAxisDataPointOffset(d,e);if(!isNaN(u)&&!isNaN(g)){var f,p=Math.abs(u-g);if(s.polar||s.spider){var c=this._renderData[e],m=c.polarCoords;if(i)if(s.spider){const t=this.getPolarDataPointOffset(h,this._stats.seriesGroups[e].max,e),i=this.getPolarDataPointOffset(d,this._stats.seriesGroups[e].max,e);let r="M "+m.x+","+m.y;r+=" L "+t.x+","+t.y,r+=" L "+i.x+","+i.y,f=this.renderer.path(r)}else{var y={},_={x:Math.min(u,g),y:t.y,width:p,height:t.height};this._columnAsPieSlice(y,t,m,_),f=y.element}else{var x=this._toPolarCoord(m,t,t.x,c.baseOffset),v=this._toPolarCoord(m,t,t.x,u),b=this._toPolarCoord(m,t,t.x,g),N=this.renderer._ptdist(x.x,x.y,v.x,v.y),M=this.renderer._ptdist(x.x,x.y,b.x,b.y),A=Math.round(360*-m.startAngle/(2*Math.PI)),w=Math.round(360*-m.endAngle/(2*Math.PI));if(A>w){const e=A;A=w,w=e}if(s.spider){var S=c.xAxis.offsetAngles;let e="";var C=[M,N],k=S;for(var D in m.isClosedCircle&&(k=S.slice(0)).push(k[0]),C){for(let t=0;t<k.length;t++){var T=0===D?t:S.length-t-1;let i=m.x+C[D]*Math.cos(k[T]),r=m.y+C[D]*Math.sin(k[T]);e+=""===e?"M ":" L",e+=this.renderer._ptrnd(i)+","+this.renderer._ptrnd(r)}if(0===D){let t=m.x+C[1]*Math.cos(k[T]),i=m.y+C[1]*Math.sin(k[T]);e+=" L"+this.renderer._ptrnd(t)+","+this.renderer._ptrnd(i)}}e+=" Z",f=this.renderer.path(e)}else f=this.renderer.pieslice(m.x,m.y,N,M,A,w)}}else{var F={x:Math.min(u,g),y:l.y,width:p,height:l.height};if(i||(F={x:l.x,y:Math.min(u,g),width:l.width,height:p}),n){let e=F.x;F.x=F.y,F.y=e,e=F.width,F.width=F.height,F.height=e}f=0===p||1===p?this.renderer.line(this.renderer._ptrnd(F.x),this.renderer._ptrnd(F.y),this.renderer._ptrnd(F.x+(n?0:F.width)),this.renderer._ptrnd(F.y+(n?F.height:0))):this.renderer.rect(F.x,F.y,F.width,F.height)}var O=o.color||this._getThemeColor("band"),I=o.lineColor||O,P=o.lineWidth;isNaN(P)&&(P=1);var R=o.opacity;(isNaN(R)||R<0||R>1)&&(R=1),this.renderer.attr(f,{fill:O,"fill-opacity":R,stroke:I,"stroke-opacity":R,"stroke-width":P,"stroke-dasharray":o.dashStyle})}}}}_getColumnGroupWidth(e,t,i){let r=this.seriesGroups[e],s=-1!==r.type.indexOf("stacked"),a=this._getColumnGroupsCount(r.orientation);(isNaN(a)||0===a)&&(a=1);let l=t.rangeLength>=1?t.itemWidth:.9*i,n=r.columnsMinWidth;isNaN(n)&&(n=1),isNaN(r.columnsMaxWidth)||(n=Math.min(r.columnsMaxWidth,n)),n>l&&t.length>0&&(l=Math.max(l,.9*i/t.length));let o=n;if(!s){let e=r.seriesGapPercent;(isNaN(e)||e<0)&&(e=10),e/=100;let t=n;t*=1+e,o+=r.series.length*t}return{requiredWidth:o,availableWidth:l,targetWidth:Math.max(l/a,o)}}_getColumnSerieWidthAndOffset(e,t){let i=this.seriesGroups[e],r="horizontal"===i.orientation,s=this._plotRect;r&&(s={x:s.y,y:s.x,width:s.height,height:s.width});let a=this._calcGroupOffsets(e,s);if(!a||0===a.xoffsets.length)return;let l=this._getColumnGroupsCount(i.orientation);"candlestick"!==i.type&&"ohlc"!==i.type||(l=1);let n=this._getColumnGroupIndex(e),o=this._getColumnGroupWidth(e,a.xoffsets,r?s.height:s.width),h=0,d=o.targetWidth;(!0===this.columnSeriesOverlap||Math.round(d)>Math.round(o.availableWidth/l))&&(l=1,n=0),h-=d*l/2,h+=d*n;let u=i.columnsGapPercent;u<=0&&(u=0),(isNaN(u)||u>=100)&&(u=25),u/=100;let g=d*u;g+o.requiredWidth>o.targetWidth&&(g=Math.max(0,o.targetWidth-o.requiredWidth)),Math.round(d)>Math.round(o.availableWidth)&&(g=0),d-=g,h+=g/2;let f=i.seriesGapPercent;(isNaN(f)||f<0)&&(f=10);let p=-1!==i.type.indexOf("stacked"),c=d;p||(c/=i.series.length);let m=this._get([i.seriesGap,d*f/100/(i.series.length-1)]);(!0===i.polar||!0===i.spider||p||i.series.length<=1)&&(m=0);let y=m*(i.series.length-1);i.series.length>1&&y>d-1*i.series.length&&(y=d-1*i.series.length,m=y/Math.max(1,i.series.length-1));let _=c-y/i.series.length,x=0,v=i.columnsMaxWidth;isNaN(v)||_>v&&(x=_-v,_=v);let b=0;return b=p?x/2:(d-_*i.series.length-y)/2+_*t+Math.max(0,t)*m,{width:_,offset:h+b}}_renderColumnSeries(e,t){let i=this.seriesGroups[e];if(!i.series||0===i.series.length)return;let r="horizontal"===i.orientation,s=t;r&&(s={x:t.y,y:t.x,width:t.height,height:t.width});let a,l=this._calcGroupOffsets(e,s);if(!l||0===l.xoffsets.length)return;!0!==i.polar&&!0!==i.spider||(a=this._getPolarAxisCoords(e,s));let n={groupIndex:e,rect:t,vertical:!r,seriesCtx:[],renderData:l,polarAxisCoords:a};n.columnGroupWidth=this._getColumnGroupWidth(e,l.xoffsets,r?s.height:s.width);let o,h=this._getGroupGradientType(e);for(let t=0;t<i.series.length;t++){let r=i.series[t];if(r.customDraw)continue;let s=this._getAnimProps(e,t);o=s.enabled&&!this._isToggleRefresh&&l.xoffsets.length<100?s.duration:0;let d=this._getColumnSerieWidthAndOffset(e,t),u=this._isSerieVisible(e,t),g=this._getSerieSettings(e,t),f=this._getColors(e,t,NaN,this._getGroupGradientType(e),4),p=[];if("function"==typeof r.colorFunction&&!a)for(let i=l.xoffsets.first;i<=l.xoffsets.last;i++)p.push(this._getColors(e,t,i,h,4));let c={seriesIndex:t,serieColors:f,itemsColors:p,settings:g,columnWidth:d.width,xAdjust:d.offset,isVisible:u};n.seriesCtx.push(c)}this._animColumns(n,0===o?1:0);let d=this;this._enqueueAnimation("series",void 0,void 0,o,(function(e,t,i){d._animColumns(t,i)}),n)}_getPercent(e,t,i,r){return isNaN(e)&&(e=t),!isNaN(i)&&!isNaN(e)&&e<i&&(e=i),!isNaN(r)&&!isNaN(e)&&e>r&&(e=r),isNaN(e)?NaN:e}_getColumnVOffsets(e,t,i,r,s,a){var l=this.seriesGroups[t],n=this._getPercent(l.columnsTopWidthPercent,100,0,100),o=this._getPercent(l.columnsBottomWidthPercent,100,0,100);0===n&&0===o&&(o=100);var h=this._getPercent(l.columnsNeckHeightPercent,NaN,0,100)/100,d=this._getPercent(l.columnsNeckWidthPercent,100,0,100)/100,u=[],g=NaN;for(let l=0;l<i.length;l++){var f,p=i[l],c=p.seriesIndex,m=e.offsets[c][r].from,y=e.offsets[c][r].to,_=e.xoffsets.data[r],x=p.isVisible;x||(y=m);var v=this._elementRenderInfo;if(x&&v&&v.length>t&&v[t].series.length>c){var b=e.xoffsets.xvalues[r];!(f=v[t].series[c][b])||isNaN(f.from)||isNaN(f.to)||(m=f.from+(m-f.from)*a,y=f.to+(y-f.to)*a,_=f.xoffset+(_-f.xoffset)*a)}f||(y=m+(y-m)*(s?1:a)),isNaN(m)&&(m=isNaN(g)?e.baseOffset:g),g=!isNaN(y)&&s?y:m,isNaN(y)&&(y=m);var N={from:m,to:y,xOffset:_};100===n&&100===o||(N.funnel=!0,N.toWidthPercent=n,N.fromWidthPercent=o),u.push(N)}if(s&&u.length>1&&!(this._elementRenderInfo&&this._elementRenderInfo.length>t)){var M=0,A=0,w=-1/0,S=1/0,C=1/0,k=-1/0;for(let e=0;e<u.length;e++)i[e].isVisible&&(u[e].to>=u[e].from?(A+=u[e].to-u[e].from,C=Math.min(C,u[e].from),k=Math.max(k,u[e].to)):(M+=u[e].from-u[e].to,w=Math.max(w,u[e].from),S=Math.min(S,u[e].to)));var D=M,T=A;M*=a,A*=a;var F=0,O=0;for(let e=0;e<u.length;e++)if(u[e].to>=u[e].from){let t=u[e].to-u[e].from;t+O>A&&(t=Math.max(0,A-O),u[e].to=u[e].from+t),100===n&&100===o||(u[e].funnel=!0,!isNaN(h)&&T*h>=O?u[e].fromWidthPercent=100*d:u[e].fromWidthPercent=Math.abs(u[e].from-C)/T*(n-o)+o,!isNaN(h)&&T*h>=0+(O+t)?u[e].toWidthPercent=100*d:u[e].toWidthPercent=Math.abs(u[e].to-C)/T*(n-o)+o),O+=t}else{let t=u[e].from-u[e].to;t+F>M&&(t=Math.max(0,M-F),u[e].to=u[e].from-t),100===n&&100===o||(u[e].funnel=!0,!isNaN(h)&&D*h>=F?u[e].fromWidthPercent=100*d:u[e].fromWidthPercent=Math.abs(u[e].from-w)/D*(n-o)+o,!isNaN(h)&&D*h>=0+(F+t)?u[e].toWidthPercent=100*d:u[e].toWidthPercent=Math.abs(u[e].to-w)/D*(n-o)+o),F+=t}}return u}_columnAsPieSlice(e,t,i,r){let s=this._toPolarCoord(i,t,r.x,r.y),a=this._toPolarCoord(i,t,r.x,r.y+r.height),l=this.renderer._ptdist(i.x,i.y,a.x,a.y),n=this.renderer._ptdist(i.x,i.y,s.x,s.y),o=t.width,h=180*Math.abs(i.startAngle-i.endAngle)/Math.PI,d=-(r.x-t.x)*h/o,u=-(r.x+r.width-t.x)*h/o,g=i.startAngle;if(g=360*g/(2*Math.PI),d-=g,u-=g,e)if(void 0!==e.element&&null!==e.element){let t=this.renderer.pieSlicePath(i.x,i.y,l,n,u,d,0);t+=" Z",this.renderer.attr(e.element,{d:t})}else e.element=this.renderer.pieslice(i.x,i.y,l,n,u,d,0);return{fromAngle:u,toAngle:d,innerRadius:l,outerRadius:n}}_setRenderInfo(e,t,i,r){this._renderData[e].offsets[t][i].elementInfo=r}_getRenderInfo(e,t,i){return this._renderData[e].offsets[t][i].elementInfo||{}}_animColumns(e,t){var i=this,r=e.groupIndex,s=this.seriesGroups[r],a=e.renderData,l=-1!==s.type.indexOf("waterfall"),n=this._getXAxis(r),o=-1!==s.type.indexOf("stacked"),h=e.polarAxisCoords,d=-1;for(let e=0;e<s.series.length;e++)if(this._isSerieVisible(r,e)){d=e;break}var u=NaN,g=NaN;for(let t=0;t<e.seriesCtx.length;t++){var f=e.seriesCtx[t];(isNaN(u)||u>f.xAdjust)&&(u=f.xAdjust),(isNaN(g)||g<f.xAdjust+f.columnWidth)&&(g=f.xAdjust+f.columnWidth)}var p=Math.abs(g-u),c=this._get([s.columnsGapPercent,25])/100;(isNaN(c)<0||c>=1)&&(c=.25);var m=c*p,y=e.renderData.xoffsets,_=-1,x={},v=!0===s.skipOverlappingPoints;for(let u=y.first;u<=y.last;u++){var b=y.data[u];if(!(isNaN(b)||-1!==_&&Math.abs(b-_)<p-1+m&&v)){_=b;var N=this._getColumnVOffsets(a,r,e.seriesCtx,u,o,t),M=!1;if(l)for(let e=0;e<s.series.length;e++)s.series[e].summary&&y.xvalues[u][s.series[e].summary]&&(M=!0);for(let g=0;g<e.seriesCtx.length;g++){let f=e.seriesCtx[g];var A=f.seriesIndex,w=s.series[A],S=N[g].from,C=N[g].to,k=N[g].xOffset,D=(e.vertical?e.rect.x:e.rect.y)+f.xAdjust,T=f.settings;let p=0!==f.itemsColors.length?f.itemsColors[u-a.xoffsets.first]:f.serieColors;var F=this._isSerieVisible(r,A);if(!F)continue;let c=this.renderer._ptrnd(D+k);var O={x:c,width:f.columnWidth};N[g].funnel&&(O.fromWidthPercent=N[g].fromWidthPercent,O.toWidthPercent=N[g].toWidthPercent);var I=!0;e.vertical?(O.y=S,O.height=C-S,O.height<0&&(O.y+=O.height,O.height=-O.height,I=!1)):(O.x=S<C?S:C,O.width=Math.abs(S-C),I=S-C<0,O.y=c,O.height=f.columnWidth);var P=S-C;if(!isNaN(P)){P=Math.abs(P);var R=void 0,L=i._getRenderInfo(r,A,u),G=L.element,V=L.labelElement,E=null==G;if(V&&(i.renderer.removeElement(V),V=void 0),h){var B={element:G};R=this._columnAsPieSlice(B,e.rect,h,O),G=B.element,p=this._getColors(r,A,void 0,"radialGradient",R.outerRadius)}else if(N[g].funnel){var H=this._getTrapezoidPath(Object.assign({},O),e.vertical,I);E?G=this.renderer.path(H,{}):this.renderer.attr(G,{d:H})}else E?G=this.renderer.rect(O.x,O.y,e.vertical?O.width:0,e.vertical?0:O.height):!0===e.vertical?this.renderer.attr(G,{x:O.x,y:O.y,height:P}):this.renderer.attr(G,{x:O.x,y:O.y,width:P});if(P<1&&(1!==t||h)?this.renderer.attr(G,{display:"none"}):this.renderer.attr(G,{display:"block"}),E&&this.renderer.attr(G,{fill:p.fillColor,"fill-opacity":T.opacity,"stroke-opacity":T.opacity,stroke:p.lineColor,"stroke-width":T.stroke,"stroke-dasharray":T.dashStyle}),V&&this.renderer.removeElement(V),!F||0===P&&t<1)L={element:G,labelElement:V},i._setRenderInfo(r,A,u,L);else{if(l&&!1!==this._get([w.showWaterfallLines,s.showWaterfallLines])){if(!o||o&&g===d){var z=o?-1:g;if(1===t&&!isNaN(a.offsets[g][u].from)&&!isNaN(a.offsets[g][u].to)){var W=x[z];if(null!=W){var j={x:W.x,y:this.renderer._ptrnd(W.y)},X={x:c,y:j.y},U=s.columnsTopWidthPercent/100;(isNaN(U)||U>1||U<0)&&(U=1);var Y=s.columnsBottomWidthPercent/100;(isNaN(Y)||Y>1||Y<0)&&(Y=1);var q=e.vertical?O.width:O.height;if(j.x=j.x-q/2+q/2*U,M){let e=q*U/2;X.x=X.x+q/2-(n.flip?-e:e)}else{let e=q*Y/2;X.x=X.x+q/2-(n.flip?-e:e)}e.vertical||(this._swapXY([j]),this._swapXY([X])),this.renderer.line(j.x,j.y,X.x,X.y,{stroke:W.color,"stroke-width":T.stroke,"stroke-opacity":T.opacity,"fill-opacity":T.opacity,"stroke-dasharray":T.dashStyle})}}}1===t&&0!==P&&(x[o?-1:g]={y:C,x:e.vertical?O.x+O.width:O.y+O.height,color:p.lineColor})}if(h){let e=this._showLabel(r,A,u,O,void 0,void 0,!0);var Z=R.outerRadius+10;const t=this._adjustTextBoxPosition(h.x,h.y,e,Z,(R.fromAngle+R.toAngle)/2,!0,!1,!1);V=this._showLabel(r,A,u,{x:t.x,y:t.y},void 0,void 0,!1,!1,!1)}else V=this._showLabel(r,A,u,O,void 0,void 0,!1,!1,I);L={element:G,labelElement:V},i._setRenderInfo(r,A,u,L),1===t&&this._installHandlers(G,"column",r,A,u)}}}}}}_getTrapezoidPath(e,t,i){let r="",s=e.fromWidthPercent/100,a=e.toWidthPercent/100;if(!t){let t=e.width;e.width=e.height,e.height=t,t=e.x,e.x=e.y,e.y=t}let l=e.x+e.width/2,n=[{x:l-e.width*(i?a:s)/2,y:e.y+e.height},{x:l-e.width*(i?s:a)/2,y:e.y},{x:l+e.width*(i?s:a)/2,y:e.y},{x:l+e.width*(i?a:s)/2,y:e.y+e.height}];t||this._swapXY(n),r+="M "+this.renderer._ptrnd(n[0].x)+","+this.renderer._ptrnd(n[0].y);for(let e=1;e<n.length;e++)r+=" L "+this.renderer._ptrnd(n[e].x)+","+this.renderer._ptrnd(n[e].y);return r+=" Z",r}_swapXY(e){for(let t=0;t<e.length;t++){let i=e[t].x;e[t].x=e[t].y,e[t].y=i}}_renderCandleStickSeries(e,t,i){let r=this,s=r.seriesGroups[e];if(!s.series||0===s.series.length)return;let a="horizontal"===s.orientation,l=t;a&&(l={x:t.y,y:t.x,width:t.height,height:t.width});let n,o=r._calcGroupOffsets(e,l);if(!o||0===o.xoffsets.length)return;(s.polar||s.spider)&&(n=r._getPolarAxisCoords(e,l));let h=r._getGroupGradientType(e),d=[];for(let t=0;t<s.series.length;t++)d[t]=r._getColumnSerieWidthAndOffset(e,t);for(let l=0;l<s.series.length;l++){if(!this._isSerieVisible(e,l))continue;let u=r._getSerieSettings(e,l),g=s.series[l];if(g.customDraw)continue;let f="function"==typeof g.colorFunction?void 0:r._getColors(e,l,NaN,h),p={rect:t,inverse:a,groupIndex:e,seriesIndex:l,symbolType:g.symbolType,symbolSize:g.symbolSize,"fill-opacity":u.opacity,"stroke-opacity":u.opacity,"stroke-width":u.stroke,"stroke-dasharray":u.dashStyle,gradientType:h,colors:f,renderData:o,polarAxisCoords:n,columnsInfo:d,isOHLC:i,items:[],self:r},c=r._getAnimProps(e,l),m=c.enabled&&!r._isToggleRefresh&&o.xoffsets.length<5e3?c.duration:0;r._animCandleStick(p,0),r._enqueueAnimation("series",void 0,void 0,m,(function(e,t,i){r._animCandleStick(t,i,e)}),p)}}_animCandleStick(e,t){var i=["Open","Low","Close","High"],r=e.columnsInfo[e.seriesIndex].width,s=e.self.seriesGroups[e.groupIndex],a=e.renderData.xoffsets,l=-1,n=Math.abs(a.data[a.last]-a.data[a.first]);n*=t;var o=NaN,h=NaN;for(let t=0;t<e.columnsInfo.length;t++){var d=e.columnsInfo[t];(isNaN(o)||o>d.offset)&&(o=d.offset),(isNaN(h)||h<d.offset+d.width)&&(h=d.offset+d.width)}var u=Math.abs(h-o),g=!1!==s.skipOverlappingPoints;for(let o=a.first;o<=a.last;o++){var f=a.data[o];if(!(isNaN(f)||-1!==l&&Math.abs(f-l)<u&&g)){if(Math.abs(a.data[o]-a.data[a.first])>n)break;l=f;var p=e.items[o]=e.items[o]||{};for(let t in i){var c=e.self._getDataValueAsNumber(o,s.series[e.seriesIndex]["dataField"+i[t]],e.groupIndex);if(isNaN(c))break;var m=e.renderData.offsets[e.seriesIndex][o][i[t]];if(isNaN(m))break;p[i[t]]=m}if(f+=e.inverse?e.rect.y:e.rect.x,e.polarAxisCoords){var y=this._toPolarCoord(e.polarAxisCoords,this._plotRect,f,m);f=y.x,m=y.y}for(var _ in f=this.renderer._ptrnd(f),i)p[_]=this.renderer._ptrnd(p[_]);var x=e.colors;if(x||(x=e.self._getColors(e.groupIndex,e.seriesIndex,o,e.gradientType)),e.isOHLC){var v="M"+f+","+p.Low+" L"+f+","+p.High+" M"+(f-r/2)+","+p.Open+" L"+f+","+p.Open+" M"+(f+r/2)+","+p.Close+" L"+f+","+p.Close;e.inverse&&(v="M"+p.Low+","+f+" L"+p.High+","+f+" M"+p.Open+","+(f-r/2)+" L"+p.Open+","+f+" M"+p.Close+","+f+" L"+p.Close+","+(f+r/2));let i=p.lineElement;i||(i=this.renderer.path(v,{}),this.renderer.attr(i,{fill:x.fillColor,"fill-opacity":e["fill-opacity"],"stroke-opacity":e["fill-opacity"],stroke:x.lineColor,"stroke-width":e["stroke-width"],"stroke-dasharray":e["stroke-dasharray"]}),p.lineElement=i),1===t&&this._installHandlers(i,"column",e.groupIndex,e.seriesIndex,o)}else{var b=p.lineElement;b||(b=e.inverse?this.renderer.line(p.Low,f,p.High,f):this.renderer.line(f,p.Low,f,p.High),this.renderer.attr(b,{fill:x.fillColor,"fill-opacity":e["fill-opacity"],"stroke-opacity":e["fill-opacity"],stroke:x.lineColor,"stroke-width":e["stroke-width"],"stroke-dasharray":e["stroke-dasharray"]}),p.lineElement=b);var N=p.stickElement;if(f-=r/2,!N){var M=x.fillColor;p.Close<=p.Open&&x.fillColorAlt&&(M=x.fillColorAlt),N=e.inverse?this.renderer.rect(Math.min(p.Open,p.Close),f,Math.abs(p.Close-p.Open),r):this.renderer.rect(f,Math.min(p.Open,p.Close),r,Math.abs(p.Close-p.Open)),this.renderer.attr(N,{fill:M,"fill-opacity":e["fill-opacity"],"stroke-opacity":e["fill-opacity"],stroke:x.lineColor,"stroke-width":e["stroke-width"],"stroke-dasharray":e["stroke-dasharray"]}),p.stickElement=N}1===t&&this._installHandlers(N,"column",e.groupIndex,e.seriesIndex,o)}}}}_renderScatterSeries(e,t,i){var r=this.seriesGroups[e];if(r.series&&0!==r.series.length){var s=-1!==r.type.indexOf("bubble"),a="horizontal"===r.orientation,l=t;a&&(l={x:t.y,y:t.x,width:t.height,height:t.width});var n=this._calcGroupOffsets(e,l);if(n&&0!==n.xoffsets.length){var o,h=l.width;(r.polar||r.spider)&&(h=2*(o=this._getPolarAxisCoords(e,l)).r);var d=this._getGroupGradientType(e);i||(i="to");for(let V=0;V<r.series.length;V++){var u=this._getSerieSettings(e,V),g=r.series[V];if(!g.customDraw){var f=g.dataField,p="function"==typeof g.colorFunction,c=this._getColors(e,V,NaN,d),m=NaN,y=NaN;if(s)for(let t=n.xoffsets.first;t<=n.xoffsets.last;t++){var _=this._getDataValueAsNumber(t,g.radiusDataField||g.sizeDataField,e);"number"!=typeof _&&this.error(this.localize("invalidRadiusDataField",{index:t})),isNaN(_)||((isNaN(m)||_<m)&&(m=_),(isNaN(y)||_>y)&&(y=_))}var x=g.minRadius||g.minSymbolSize;isNaN(x)&&(x=h/50);var v=g.maxRadius||g.maxSymbolSize;isNaN(v)&&(v=h/25),x>v&&(v=x);var b=g.radius;b=isNaN(b)&&!isNaN(g.symbolSize)?"circle"===g.symbolType?g.symbolSize/2:g.symbolSize:5;var N=this._getAnimProps(e,V),M=N.enabled&&!this._isToggleRefresh&&n.xoffsets.length<5e3?N.duration:0,A={groupIndex:e,seriesIndex:V,symbolType:g.symbolType,symbolSize:g.symbolSize,"fill-opacity":u.opacity,"stroke-opacity":u.opacity,"stroke-width":u.stroke,"stroke-width-symbol":u.strokeSymbol,"stroke-dasharray":u.dashStyle,items:[],polarAxisCoords:o},w=void 0;for(let r=n.xoffsets.first;r<=n.xoffsets.last;r++)if("number"==typeof this._getDataValueAsNumber(r,f,e)){var S=n.xoffsets.data[r],C=n.xoffsets.xvalues[r],k=n.offsets[V][r][i];if(!(k<l.y||k>l.y+l.height||isNaN(S)||isNaN(k))){if(a){var D=S;S=k,k=D+t.y}else S+=t.x;if(!(!p&&w&&this.enableSampling&&this.renderer._ptdist(w.x,w.y,S,k)<1)){w={x:S,y:k};var T=b;if(s){var F=this._getDataValueAsNumber(r,g.radiusDataField||g.sizeDataField,e);if("number"!=typeof F)continue;T=x+(v-x)*(F-m)/Math.max(1,y-m),isNaN(T)&&(T=x)}n.offsets[V][r].radius=T;var O=NaN,I=NaN,P=0,R=this._elementRenderInfo;if(null!=C&&R&&R.length>e&&R[e].series.length>V){var L=R[e].series[V][C];if(L&&!isNaN(L.to)){if(O=L.to,I=L.xoffset,P=b,a){let e=I;I=O,O=e+t.y}else I+=t.x;s&&(P=x+(v-x)*(L.valueRadius-m)/Math.max(1,y-m),isNaN(P)&&(P=x))}}p&&(c=this._getColors(e,V,r,d)),A.items.push({from:P,to:T,itemIndex:r,fill:c.fillColor,stroke:c.lineColor,x:S,y:k,xFrom:I,yFrom:O})}}}this._animR(A,0);var G=this;this._enqueueAnimation("series",void 0,void 0,M,(function(e,t,i){G._animR(t,i,e)}),A)}}}}}_animR(e,t){let i=e.items,r=e.symbolType||"circle",s=e.symbolSize;for(let a=0;a<i.length;a++){let l=i[a],n=l.x,o=l.y,h=Math.round((l.to-l.from)*t+l.from);if(isNaN(l.yFrom)||(o=l.yFrom+(o-l.yFrom)*t),isNaN(l.xFrom)||(n=l.xFrom+(n-l.xFrom)*t),e.polarAxisCoords){let t=this._toPolarCoord(e.polarAxisCoords,this._plotRect,n,o);n=t.x,o=t.y}n=this.renderer._ptrnd(n),o=this.renderer._ptrnd(o),h=this.renderer._ptrnd(h);let d=this._getRenderInfo(e.groupIndex,e.seriesIndex,i[a].itemIndex),u=d.element,g=d.labelElement;"circle"===r?(u||(u=this.renderer.circle(n,o,h),this.renderer.attr(u,{fill:l.fill,"fill-opacity":e["fill-opacity"],"stroke-opacity":e["fill-opacity"],stroke:l.stroke,"stroke-width":e["stroke-width"],"stroke-dasharray":e["stroke-dasharray"]})),this.renderer.attr(u,{r:h,cy:o,cx:n})):(u&&this.renderer.removeElement(u),u=this._drawSymbol(r,n,o,l.fill,e["fill-opacity"],l.stroke,e["stroke-opacity"]||e["fill-opacity"],e["stroke-width-symbol"],e["stroke-dasharray"],s||h)),g&&this.renderer.removeElement(g),g=this._showLabel(e.groupIndex,e.seriesIndex,l.itemIndex,{x:n-h,y:o-h,width:2*h,height:2*h}),t>=1&&this._installHandlers(u,"circle",e.groupIndex,e.seriesIndex,l.itemIndex),this._setRenderInfo(e.groupIndex,e.seriesIndex,i[a].itemIndex,{element:u,labelElement:g})}}_showMultiSeriesToolTip(e){let t=this,i="<div style='text-align:left'>",r="";for(let s=0;s<t.seriesGroups.length;s++){if(t._isPieGroup(s))continue;let a=t._getXAxis(s),l=t._getValueAxis(s),n=t.seriesGroups[s],o=this._getAxisSettings(a),h=this._getFormatSettings(o,"toolTipFormatSettings"),d=o.toolTipFormatFunction,u=t._getDataValue(e,a.dataField,s);void 0!==a.dataField&&null!==a.dataField&&""!==a.dataField||(u=e),"date"===a.type&&(u=t._castAsDate(u,(h?h.dateFormat:void 0)||a.dateFormat)),d||h||"date"!==a.type||(d=this._getDefaultDTFormatFn(a.baseUnit||"day"));let g=a.displayText||a.dataField||"";""!==g&&(g+=": ");let f=g+t._formatValue(u,h,d,s,void 0,e);r!==f&&(""!==r&&(i+="<br />"),i+=f+"<br /><br />",r=f);for(let r=0;r<n.series.length;r++){let a=n.series[r];if(!1===n.showToolTips||!1===a.showToolTips)continue;if(!t._isSerieVisible(s,r))continue;let o=t._get([t._getFormatSettings(a,"toolTipFormatSettings"),t._getFormatSettings(n,"toolTipFormatSettings"),t._getFormatSettings(l,"toolTipFormatSettings"),t._getFormatSettings(t,"toolTipFormatSettings")]),h=t._get([a.toolTipFormatFunction,n.toolTipFormatFunction,l.toolTipFormatFunction,t.toolTipFormatFunction]),d=t._getFormattedValue(s,r,e,o,h);i+='<span style="color:'+t._getColors(s,r,e).lineColor+';">'+d+"</span><br />\n"}}let s=this._get([t.toolTipClass,"smart-chart-tooltip-text"]),a=this._get([t.toolTipBackground,t._getThemeColor("background")]),l=this._get([t.toolTipLineColor,t._getThemeColor("line")]),n=this._get([t.toolTipOpacity,1]);i+="</div>";let o=this.getItemCoord(t._ttEl.gidx,t._ttEl.sidx,t._ttEl.iidx);o.x+=window.pageXOffset,o.y+=window.pageYOffset,t._createTooltip(o,t.seriesGroups[t._ttEl.gidx],i,{css:s,fill:a,stroke:l,fillOpacity:n,symbolSize:3})}_showToolTip(e,t,i,r,s){let a=this,l=a._getXAxis(i),n=a._getValueAxis(i);if(a._ttEl&&i===a._ttEl.gidx&&r===a._ttEl.sidx&&s===a._ttEl.iidx)return;let o=a.seriesGroups[i],h=o.series[r],d=a.enableCrosshairs;a._pointMarker?(e=parseInt(a._pointMarker.x+5),t=parseInt(a._pointMarker.y-5)):d=!1;let u=d&&!1===a.showToolTips;if(e=this.renderer._ptrnd(e),t=this.renderer._ptrnd(t),!1===o.showToolTips||!1===h.showToolTips)return;a._ttEl||(a._ttEl={}),a._ttEl.sidx=r,a._ttEl.gidx=i,a._ttEl.iidx=s;let g=0;for(let e=0;e<a.seriesGroups.length;e++)for(let t=0;t<a.seriesGroups[e].series.length;t++)g++;if(d){let e=this.renderer._ptrnd(a._pointMarker.x),t=this.renderer._ptrnd(a._pointMarker.y),r=a.crosshairsColor||a._getThemeColor("line");if(o.polar||o.spider){let s=this._getPolarAxisCoords(i,this._plotRect);if(this.renderer._ptdist(e,t,s.x,s.y)>s.r)return;let l=Math.atan2(t-s.y,e-s.x),n=Math.cos(l)*s.r+s.x,o=Math.sin(l)*s.r+s.y;a._ttEl.vLine?a.renderer.attr(a._ttEl.vLine,{x1:s.x,y1:s.y,x2:n,y2:o}):a._ttEl.vLine=a.renderer.line(s.x,s.y,n,o,{stroke:r,"stroke-width":a.crosshairsLineWidth||1,"stroke-dasharray":a.crosshairsDashStyle||""})}else a._ttEl.vLine&&a._ttEl.hLine?(a.renderer.attr(a._ttEl.vLine,{x1:e,x2:e}),a.renderer.attr(a._ttEl.hLine,{y1:t,y2:t})):(a._ttEl.vLine=a.renderer.line(e,a._plotRect.y,e,a._plotRect.y+a._plotRect.height,{stroke:r,"stroke-width":a.crosshairsLineWidth||1,"stroke-dasharray":a.crosshairsDashStyle||""}),a._ttEl.hLine=a.renderer.line(a._plotRect.x,t,a._plotRect.x+a._plotRect.width,t,{stroke:r,"stroke-width":a.crosshairsLineWidth||1,"stroke-dasharray":a.crosshairsDashStyle||""}))}if(a.showToolTipsOnAllSeries&&!a._isPieGroup(i)&&g>1)return void a._showMultiSeriesToolTip(s);let f=a._get([a._getFormatSettings(h,"toolTipFormatSettings"),a._getFormatSettings(o,"toolTipFormatSettings"),a._getFormatSettings(n,"toolTipFormatSettings"),a._getFormatSettings(a,"toolTipFormatSettings")]),p=a._get([h.toolTipFormatFunction,o.toolTipFormatFunction,n.toolTipFormatFunction,a.toolTipFormatFunction]),c=a._getColors(i,r,s),m=a._getDataValue(s,l.dataField,i);void 0!==l.dataField&&null!==l.dataField&&""!==l.dataField||(m=s),"date"===l.type&&(m=a._castAsDate(m,(f?f.dateFormat:void 0)||l.dateFormat));let y="";if("function"==typeof p){let e={},t=0;for(let r in h)0===r.indexOf("dataField")&&(e[r.substring(9,r.length).toLowerCase()]=a._getDataValue(s,h[r],i),t++);0===t?e=a._getDataValue(s,void 0,i):1===t&&(e=e[""]),y=p(e,s,h,o,m,l)}else{y=a._getFormattedValue(i,r,s,f,p);let e=this._getAxisSettings(l),t=a._getFormatSettings(e,"toolTipFormatSettings"),n=e.toolTipFormatFunction;n||t||"date"!==l.type||(n=this._getDefaultDTFormatFn(l.baseUnit||"day"));let o=a._formatValue(m,t,n,i,r,s);if(a._isPieGroup(i))m=a._getDataValue(s,h.displayText||h.dataField,i),o=a._formatValue(m,t,n,i,r,s),y=o+": "+y;else{let e=l.displayText||l.dataField||"";y=e.length>0?e+": "+o+"<br>"+y:o+"<br>"+y}}if(!u&&!1!==a.showToolTips){let e=this._get([h.toolTipClass,o.toolTipClass,a.toolTipClass,"smart-chart-tooltip-text"]),t=this._get([h.toolTipBackground,o.toolTipBackground,a.toolTipBackground,a._getThemeColor("background")]),l=this._get([h.toolTipLineColor,o.toolTipLineColor,a.toolTipLineColor,c.lineColor,a._getThemeColor("line")]),n=this._get([h.toolTipOpacity,o.toolTipOpacity,a.toolTipOpacity,1]),d=this.getItemCoord(i,r,s);d.y=Math.min(Math.max(d.y,this._plotRect.y),this._plotRect.y+this._plotRect.y+this._plotRect.height);let u=0;a._pointMarker&&a._pointMarker.element&&(u=h.symbolSizeSelected,isNaN(u)&&(u=h.symbolSize),(isNaN(u)||u>50||u<0)&&(u=o.symbolSize),(isNaN(u)||u>50||u<0)&&(u=8)),a._createTooltip(d,o,y,{css:e,fill:t,stroke:l,fillOpacity:n,symbolSize:u})}}_fitTooltip(e,t,i,r,s){let a={},l=2+s/2;if(t.x-i.width-7-l>e.x&&t.y+t.height/2-i.height/2>e.y&&t.y+t.height/2+i.height/2<e.y+e.height&&(a.left={arrowLocation:"right",x:t.x-i.width-7-l,y:t.y+t.height/2-i.height/2,width:i.width+7,height:i.height}),t.x+t.width+i.width+7+l<e.x+e.width&&t.y+t.height/2-i.height/2>e.y&&t.y+t.height/2+i.height/2<e.y+e.height&&(a.right={arrowLocation:"left",x:t.x+t.width+l,y:t.y+t.height/2-i.height/2,width:i.width+7,height:i.height}),t.y-i.height-l-7>e.y&&t.x+t.width/2-i.width/2>e.x&&t.x+t.width/2+i.width/2<e.x+e.width&&(a.top={arrowLocation:"bottom",x:t.x+t.width/2-i.width/2,y:t.y-i.height-l-7,width:i.width,height:i.height+7}),t.y+t.height+i.height+7+l<e.y+e.height&&t.x+t.width/2-i.width/2>e.x&&t.x+t.width/2+i.width/2<e.x+e.width&&(a.bottom={arrowLocation:"top",x:t.x+t.width/2-i.width/2,y:t.y+t.height+l,width:i.width,height:i.height+7}),t.width>t.height||(-1!==r.type.indexOf("stackedcolumn")||-1!==r.type.indexOf("stackedwaterfall"))&&"horizontal"!==r.orientation){if(a.left)return a.left;if(a.right)return a.right}else{if(a.top)return a.top;if(a.bottom)return a.bottom}for(let e in a)if(a[e])return a[e];return{arrowLocation:""}}_createTooltip(e,t,i,r){const s=this,a=t.type;let l=s._ttEl.box;if(!l){l=s._ttEl.box=document.createElement("div"),l.id=s.id+"Tooltip",l.className="smart-chart-tooltip",l.setAttribute("animation",s.animation),l.setAttribute("theme",s.theme),l.setAttribute("role","tooltip");const e=document.createElement("div"),t=document.createElement("div"),i=document.createElement("div");if(e.className="smart-chart-tooltip-arrow-outer",e.setAttribute("role","presentation"),t.className="smart-chart-tooltip-arrow-inner",t.setAttribute("role","presentation"),i.className="smart-chart-tooltip-content",i.setAttribute("role","presentation"),l.appendChild(i),l.appendChild(e),l.appendChild(t),s.getRootNode().host?s.getShadowRootOrBody().appendChild(l):document.body.appendChild(l),s.hasAttribute("aria-owns")){const e=s.getAttribute("aria-owns");s.setAttribute("aria-owns",e+" "+l.id)}else s.setAttribute("aria-owns",l.id)}if(!i||0===i.length)return void l.classList.add("smart-visibility-hidden");s.rightToLeft?l.setAttribute("right-to-left",""):l.removeAttribute("right-to-left"),l.classList.add("smart-visibility-hidden");const n=l.firstElementChild,o=l.children[1],h=l.children[2];h.style.opacity=o.style.opacity=r.fillOpacity,n.style.backgroundColor=r.fill,n.style.borderColor=r.stroke,n.style.opacity=r.fillOpacity;const d='<span class="'+r.css+'" role="presentation">'+i+"</span>";n.innerHTML=d;const u=s._measureHtml(d),g=s._plotRect;if(u.width>g.width||u.height>g.height)return;let f={width:u.width,height:u.height},p="",c=s._isColumnType(a),m=Math.max(e.x,g.x),y=Math.max(e.y,g.y);if(-1!==a.indexOf("pie")||-1!==a.indexOf("donut")){let t=(e.fromAngle+e.toAngle)/2;t*=Math.PI/180;let i=!isNaN(e.innerRadius)&&e.innerRadius>0?(e.innerRadius+e.outerRadius)/2:.75*e.outerRadius;m=e.x=e.center.x+Math.cos(t)*i,y=e.y=e.center.y-Math.sin(t)*i,e.width=e.height=1}else c&&(t.polar||t.spider)&&(e.width=e.height=1);let _=this._fitTooltip(this._plotRect,e,f,t,r.symbolSize);""!==_.arrowLocation&&(p=_.arrowLocation,m=_.x,y=_.y,f.width=_.width,f.height=_.height),"top"===p||"bottom"===p?(f.height+=7,m-=3.5,"bottom"===p&&(y-=7)):"left"!==p&&"right"!==p||(f.width+=7,y-=3.5,"right"===p&&(m-=7)),m+f.width>g.x+g.width&&(p="",m=g.x+g.width-f.width),y+f.height>g.y+g.height&&(p="",y=g.y+g.height-f.height);let x={x:0,y:0},v={x:0,y:0};n.style.width=u.width+"px",n.style.height=u.height+"px",o.style["margin-top"]=o.style["margin-left"]=0,h.style["margin-top"]=h.style["margin-left"]=0,n.style["margin-top"]=n.style["margin-left"]=0;let b="7px solid transparent";switch(p){case"left":x={x:0,y:(u.height-7)/2},v={x:7,y:0},n.style["margin-left"]="7px",o.style["margin-left"]="0px",o.style["margin-top"]=x.y+"px",o.style["border-left"]="",o.style["border-right"]="7px solid "+r.stroke,o.style["border-top"]=b,o.style["border-bottom"]=b,h.style["margin-left"]="1px",h.style["margin-top"]=x.y+"px",h.style["border-left"]="",h.style["border-right"]="7px solid "+r.fill,h.style["border-top"]=b,h.style["border-bottom"]=b;break;case"right":x={x:f.width-7,y:(u.height-7)/2},v={x:0,y:0},o.style["margin-left"]=x.x+"px",o.style["margin-top"]=x.y+"px",o.style["border-left"]="7px solid "+r.stroke,o.style["border-right"]="",o.style["border-top"]=b,o.style["border-bottom"]=b,h.style["margin-left"]=x.x-1+"px",h.style["margin-top"]=x.y+"px",h.style["border-left"]="7px solid "+r.fill,h.style["border-right"]="",h.style["border-top"]=b,h.style["border-bottom"]=b;break;case"top":x={x:f.width/2-3.5,y:0},v={x:0,y:7},n.style["margin-top"]=v.y+"px",o.style["margin-left"]=x.x+"px",o.style["border-top"]="",o.style["border-bottom"]="7px solid "+r.stroke,o.style["border-left"]=b,o.style["border-right"]=b,h.style["margin-left"]=x.x+"px",h.style["margin-top"]="1px",h.style["border-top"]="",h.style["border-bottom"]="7px solid "+r.fill,h.style["border-left"]=b,h.style["border-right"]=b;break;case"bottom":x={x:f.width/2-3.5,y:f.height-7},v={x:0,y:0},o.style["margin-left"]=x.x+"px",o.style["margin-top"]=x.y+"px",o.style["border-top"]="7px solid "+r.stroke,o.style["border-bottom"]="",o.style["border-left"]=b,o.style["border-right"]=b,h.style["margin-left"]=x.x+"px",h.style["margin-top"]=x.y-1+"px",h.style["border-top"]="7px solid "+r.fill,h.style["border-bottom"]="",h.style["border-left"]=b,h.style["border-right"]=b}""===p?(o.classList.add("smart-hidden"),h.classList.add("smart-hidden")):(o.classList.remove("smart-hidden"),h.classList.remove("smart-hidden")),l.style.width=f.width+"px",l.style.height=f.height+"px";const N=s.getBoundingClientRect();l.style.left=m+N.left+window.pageXOffset+"px",l.style.top=y+N.top+window.pageYOffset+"px",l.classList.remove("smart-visibility-hidden")}_measureHtml(e){const t=this;let i=t._measureDiv;i||(t._measureDiv=i=document.createElement("div"),i.className="smart-chart-tooltip",i.style.position="absolute",i.style.visibility="hidden",i.style.left=0,i.style.top=0,(t.shadowRoot||t).appendChild(i)),i.innerHTML=e;const r={width:i.offsetWidth+2,height:i.offsetHeight+2};return Smart.Utilities.Core.Browser.Firefox&&(r.height+=3),r}_hideToolTip(){this._ttEl&&(this._ttEl.box&&this._ttEl.box.classList.add("smart-visibility-hidden"),this._hideCrosshairs(),this._ttEl.gidx=void 0)}_hideCrosshairs(){this._ttEl&&(this._ttEl.vLine&&(this.renderer.removeElement(this._ttEl.vLine),this._ttEl.vLine=void 0),this._ttEl.hLine&&(this.renderer.removeElement(this._ttEl.hLine),this._ttEl.hLine=void 0))}_get(e){return this._draw.getByPriority(e)}_getAxisSettings(e){if(!e)return{};let t=this,i=e.gridLines||{},r={visible:t._get([i.visible,!0]),color:t._get([i.color,t._getThemeColor("line")]),unitInterval:i.unitInterval,step:i.step,dashStyle:i.dashStyle,width:t._get([i.lineWidth,1]),offsets:[],alternatingBackgroundColor:e.alternatingBackgroundColor,alternatingBackgroundColor2:e.alternatingBackgroundColor2,alternatingBackgroundOpacity:e.alternatingBackgroundOpacity},s=e.tickMarks||{},a={visible:t._get([s.visible,e.showTickMarks,!0]),color:t._get([s.color,e.tickMarksColor,t._getThemeColor("line")]),unitInterval:t._get([s.unitInterval,s.interval,e.tickMarksInterval]),step:t._get([s.step,e.tickMarksStep]),dashStyle:t._get([s.dashStyle,e.tickMarksDashStyle]),width:t._get([s.lineWidth,1]),size:t._get([s.size,4]),offsets:[]},l=e.title||{},n={visible:t._get([l.visible,!0]),text:t._get([e.description,l.text]),style:t._get([e.descriptionClass,l.class,"smart-chart-axis-description"]),halign:t._get([e.horizontalDescriptionAlignment,l.horizontalAlignment,"center"]),valign:t._get([e.verticalDescriptionAlignment,l.verticalAlignment,"center"]),angle:0,rotationPoint:t._get([l.rotationPoint,"centercenter"]),offset:t._get([l.offset,{x:0,y:0}])},o=e.line||{},h={visible:t._get([o.visible,!0]),color:t._get([o.color,r.color,t._getThemeColor("line")]),dashStyle:t._get([o.dashStyle,r.dashStyle,""]),width:t._get([o.lineWidth,1]),angle:t._get([o.angle,NaN])},d=e.padding||{};d={left:d.left||0,right:d.right||0,top:d.top||0,bottom:d.bottom||0};let u=this._getAxisLabelsSettings(e);return{visible:this._get([e.visible,!0]),customDraw:this._get([e.customDraw,!1]),gridLines:r,tickMarks:a,line:h,title:n,labels:u,padding:d,toolTipFormatFunction:this._get([e.toolTipFormatFunction,e.formatFunction,u.formatFunction]),toolTipFormatSettings:this._get([t._getFormatSettings(e,"toolTipFormatSettings"),t._getFormatSettings(e),t._getFormatSettings(u)])}}_getAxisLabelsSettings(e){let t=this,i=e.labels||{};return{visible:t._get([e.showLabels,i.visible,!0]),unitInterval:t._get([i.unitInterval,i.interval,e.labelsInterval]),step:t._get([i.step,e.labelsStep]),angle:t._get([e.textRotationAngle,i.angle,0]),style:t._get([e.class,i.class,"smart-chart-axis-text"]),halign:t._get([e.horizontalTextAlignment,i.horizontalAlignment,"center"]),valign:t._get([e.verticalTextAlignment,i.verticalAlignment,"center"]),textRotationPoint:t._get([e.textRotationPoint,i.rotationPoint,"auto"]),textOffset:t._get([e.textOffset,i.offset,{x:0,y:0}]),autoRotate:t._get([e.labelsAutoRotate,i.autoRotate,!1]),formatSettings:t._get([t._getFormatSettings(e),t._getFormatSettings(i),void 0]),formatFunction:t._get([e.formatFunction,i.formatFunction,void 0])}}_getLabelsSettings(e,t,i,r){let s=this.seriesGroups[e],a=s.series[t],l=isNaN(i)?void 0:this._getDataValue(i,a.dataField,e),n=r||["Visible","Offset","Angle","HorizontalAlignment","VerticalAlignment","Class","BackgroundColor","BorderColor","BorderOpacity","Padding","Opacity","BackgroundOpacity","LinesAngles","LinesEnabled","AutoRotate","Radius"],o={};for(let e=0;e<n.length;e++){let t,r=n[e],h="labels"+r,d="label"+r,u=r.substring(0,1).toLowerCase()+r.substring(1);s.labels&&"object"==typeof s.labels&&(t=s.labels[u]),a.labels&&"object"==typeof a.labels&&void 0!==a.labels[u]&&null!==a.labels[u]&&(t=a.labels[u]),t=this._get([a[h],a[d],t,s[h],s[d]]),o[u]="function"==typeof t?t(l,i,a,s):t}o.class=o.class||"smart-chart-label-text",o.visible=this._get([o.visible,a.showLabels,s.showLabels,void 0!==a.labels&&null!==a.labels||void 0,void 0!==s.labels&&null!==s.labels||void 0]);let h=o.padding||1;return o.padding={left:this._get([h.left,isNaN(h)?1:h]),right:this._get([h.right,isNaN(h)?1:h]),top:this._get([h.top,isNaN(h)?1:h]),bottom:this._get([h.bottom,isNaN(h)?1:h])},o}_showLabel(e,t,i,r,s,a,l,n,o,h,d){let u={width:0,height:0};if(isNaN(i))return;let g=this._getLabelsSettings(e,t,i);if(!g.visible)return l?u:void 0;if(r.width<0||r.height<0)return l?u:void 0;let f=g.angle;isNaN(h)||(f=h);let p=g.offset||{},c={x:p.x,y:p.y};isNaN(c.x)&&(c.x=0),isNaN(c.y)&&(c.y=0),s=s||g.horizontalAlignment||"center",a=a||g.verticalAlignment||"center";let m=this._getFormattedValue(e,t,i,void 0,void 0,!0),y=r.width,_=r.height;if(!0===n&&"center"!==s&&(s="right"===s?"left":"right"),!0===o&&"center"!==a&&"middle"!==a&&(a="top"===a?"bottom":"top",c.y*=-1),u=this.renderer.measureText(m,f,{class:g.class}),l)return u;let x=0,v=0;y>0&&(""===s||"center"===s?x+=(y-u.width)/2:"right"===s&&(x+=y-u.width)),_>0&&(""===a||"center"===a?v+=(_-u.height)/2:"bottom"===a&&(v+=_-u.height)),x+=r.x+c.x,v+=r.y+c.y;let b=this._plotRect;x<=b.x&&(x=b.x+2),v<=b.y&&(v=b.y+2);let N,M=Math.max(u.width,1),A=Math.max(u.height,1);v+A>=b.y+b.height&&(v=b.y+b.height-A-2),x+M>=b.x+b.width&&(x=b.x+b.width-M-2);let w=g.backgroundColor,S=g.borderColor,C=g.padding;(w||S)&&(N=this.renderer.beginGroup(),this.renderer.rect(x-C.left,v-C.top,u.width+C.left+C.right,u.height+C.bottom+C.bottom,{fill:w||"transparent","fill-opacity":g.backgroundOpacity||1,stroke:S||"transparent","stroke-opacity":g.borderOpacity,"stroke-width":1}));let k=this.renderer.text(m,x,v,u.width,u.height,f,{class:g.class,opacity:g.opacity||1},!1,"center","center",void 0,arguments[11]);return d&&(d.x=x-C.left,d.y=v-C.top,d.width=u.width+C.left+C.right,d.height=u.height+C.bottom+C.bottom),N&&this.renderer.endGroup(),N||k}_getAnimProps(e,t){let i=this.seriesGroups[e],r=isNaN(t)?void 0:i.series[t],s=this.hasAnimation;i.animation&&(s="none"!==i.animation),r&&r.animation&&(s="none"!==r.animation);let a=this.animationDuration;isNaN(a)&&(a=1e3);let l=i.animationDuration;if(isNaN(l)||(a=l),r){let e=r.animationDuration;isNaN(e)||(a=e)}return a>5e3&&(a=1e3),{enabled:s,duration:a}}_isColorTransition(e,t,i,r){if(r-1<i.xoffsets.first)return!1;let s=this._getColors(e,t,r,this._getGroupGradientType(e)),a=this._getColors(e,t,r-1,this._getGroupGradientType(e));return s.fillColor!==a.fillColor}_renderLineSeries(e,t){var i=this.seriesGroups[e];if(i.series&&0!==i.series.length){var r=-1!==i.type.indexOf("area"),s=-1!==i.type.indexOf("stacked"),a=s&&-1!==i.type.indexOf("100"),l=-1!==i.type.indexOf("spline"),n=-1!==i.type.indexOf("step"),o=-1!==i.type.indexOf("range"),h=!0===i.polar||!0===i.spider;if(h&&(n=!1),!n||!l){var d="horizontal"===i.orientation,u=!0===this._getXAxis(e).flip,g=t;d&&(g={x:t.y,y:t.x,width:t.height,height:t.width});var f=this._calcGroupOffsets(e,g);if(f&&0!==f.xoffsets.length){this._linesRenderInfo||(this._linesRenderInfo={}),this._linesRenderInfo[e]={};for(let t=i.series.length-1;t>=0;t--){var p=this._getSerieSettings(e,t),c={groupIndex:e,rect:g,serieIndex:t,swapXY:d,isArea:r,isSpline:l,isRange:o,isPolar:h,settings:p,segments:[],pointsLength:0};if(this._isSerieVisible(e,t)){var m=i.series[t];if(!m.customDraw){var y,_="function"==typeof m.colorFunction,x=f.xoffsets.first,v=x,b=this._getColors(e,t,NaN,this._getGroupGradientType(e));do{var N=[],M=[],A=[],w=0,S=0,C=NaN,k=NaN,D=NaN;if(!(f.xoffsets.length<1)){var T=this._getAnimProps(e,t),F=T.enabled&&!this._isToggleRefresh&&f.xoffsets.length<1e4&&T.duration,O=x;y=!1;var I=void 0;for(let s=x;s<=f.xoffsets.last;s++){x=s;var P=f.xoffsets.data[s],R=f.xoffsets.xvalues[s];if(!(isNaN(P)||(w=P=Math.max(P,1),S=f.offsets[t][s].to,!_&&I&&this.enableSampling&&this.renderer._ptdist(I.x,I.y,w,S)<1))){I={x:w,y:S};var L=f.offsets[t][s].from;if(isNaN(S)||isNaN(L)){if("connect"===m.emptyPointsDisplay)continue;if("zero"!==m.emptyPointsDisplay){y=!0;break}isNaN(S)&&(S=f.baseOffset),isNaN(L)&&(L=f.baseOffset)}if(_&&this._isColorTransition(e,t,f,x)&&N.length>1){x--;break}var G=this._elementRenderInfo;if(G&&G.length>e&&G[e].series.length>t){var V=G[e].series[t][R];let i=this.renderer._ptrnd(V?V.to:void 0),r=this.renderer._ptrnd(g.x+(V?V.xoffset:void 0));A.push(d?{y:r,x:i,index:s}:{x:r,y:i,index:s})}v=s,p.stroke<2&&(S-g.y<=1&&(S=g.y+1),L-g.y<=1&&(L=g.y+1),g.y+g.height-S<=1&&(S=g.y+g.height-1),g.y+g.height-L<=1&&(L=g.y+g.height-1)),!r&&a&&(S<=g.y&&(S=g.y+1),S>=g.y+g.height&&(S=g.y+g.height-1),L<=g.y&&(L=g.y+1),L>=g.y+g.height&&(L=g.y+g.height-1)),w=(P=Math.max(P,1))+g.x,!0===i.skipOverlappingPoints&&!isNaN(C)&&Math.abs(C-w)<=1||(!n||isNaN(C)||isNaN(k)||k!==S&&N.push(d?{y:w,x:this.renderer._ptrnd(k)}:{x:w,y:this.renderer._ptrnd(k)}),N.push(d?{y:w,x:this.renderer._ptrnd(S),index:s}:{x:w,y:this.renderer._ptrnd(S),index:s}),M.push(d?{y:w,x:this.renderer._ptrnd(L),index:s}:{x:w,y:this.renderer._ptrnd(L),index:s}),C=w,k=S,isNaN(D)&&(D=S))}}if(0!==N.length){var E=N[N.length-1].index;_&&(b=this._getColors(e,t,E,this._getGroupGradientType(e)));var B=g.x+f.xoffsets.data[O],H=g.x+f.xoffsets.data[v];if(r&&!0===i.alignEndPointsWithIntervals&&(B>g.x&&(B=g.x),H<g.x+g.width&&(H=g.x+g.width),u)){var z=B;B=H,H=z}H=this.renderer._ptrnd(H),B=this.renderer._ptrnd(B);var W=f.baseOffset;D=this.renderer._ptrnd(D);var j=this.renderer._ptrnd(S)||W;o&&(N=N.concat(M.reverse())),c.pointsLength+=N.length;var X={lastItemIndex:E,colorSettings:b,pointsArray:N,pointsStart:A,left:B,right:H,pyStart:D,pyEnd:j,yBase:W,labelElements:[],symbolElements:[]};c.segments.push(X)}else x++}}while(x<f.xoffsets.first+f.xoffsets.length-1||y);this._linesRenderInfo[e][t]=c}}else this._linesRenderInfo[e][t]=c}var U=this._linesRenderInfo[e],Y=[];for(let e in U)Y.push(U[e]);Y=Y.sort((function(e,t){return e.serieIndex-t.serieIndex})),r&&s&&Y.reverse();for(let e=0;e<Y.length;e++){let t=Y[e];this._animateLine(t,0===F?1:0);var q=this;this._enqueueAnimation("series",void 0,void 0,F,(function(e,t,i){q._animateLine(t,i)}),t)}}}}}_animateLine(e,t){let i=e.settings,r=e.groupIndex,s=e.serieIndex,a=this.seriesGroups[r],l=a.series[s],n=this._getSymbol(r,s),o=this._getLabelsSettings(r,s,NaN,["Visible"]).visible,h=!0;e.isPolar&&(isNaN(a.endAngle)||360===Math.round(Math.abs((isNaN(a.startAngle)?0:a.startAngle)-a.endAngle))||(h=!1)),!1===l.endPointsConnect&&(h=!1);let d=0;for(let a=0;a<e.segments.length;a++){let u=e.segments[a],g=this._calculateLine(r,e.pointsLength,d,u.pointsArray,u.pointsStart,u.yBase,t,e.isArea,e.swapXY);if(d+=u.pointsArray.length,""===g)continue;let f=g.split(" "),p=g;p=""!==p?this._buildLineCmd(g,e.isRange,u.left,u.right,u.pyStart,u.pyEnd,u.yBase,e.isArea,e.isPolar,h,e.isSpline,e.swapXY):"M 0 0";let c=u.colorSettings;if(u.pathElement?this.renderer.attr(u.pathElement,{d:p}):(u.pathElement=this.renderer.path(p,{"stroke-width":i.stroke,stroke:c.lineColor,"stroke-opacity":i.opacity,"fill-opacity":i.opacity,"stroke-dasharray":i.dashStyle,fill:e.isArea?c.fillColor:"none"}),this._installHandlers(u.pathElement,"path",r,s,u.lastItemIndex)),u.labelElements){for(let e=0;e<u.labelElements.length;e++)this.renderer.removeElement(u.labelElements[e]);u.labelElements=[]}if(u.symbolElements){for(let e=0;e<u.symbolElements.length;e++)this.renderer.removeElement(u.symbolElements[e]);u.symbolElements=[]}if(u.pointsArray.length===f.length&&("none"!==n||o)){let e=l.symbolSize,t=this._plotRect;for(let a=0;a<f.length;a++){let l=f[a].split(",");if(l={x:parseFloat(l[0]),y:parseFloat(l[1])},!(l.x<t.x||l.x>t.x+t.width||l.y<t.y||l.y>t.y+t.height)){if("none"!==n){let t=this._getColors(r,s,u.pointsArray[a].index,this._getGroupGradientType(r)),o=this._drawSymbol(n,l.x,l.y,t.fillColorSymbol,i.opacity,t.lineColorSymbol,i.opacity,i.strokeSymbol,void 0,e);u.symbolElements.push(o)}if(o&&(l=this._adjustLineLabelPosition(r,s,u.pointsArray[a].index,l),l)){let e=this._showLabel(r,s,u.pointsArray[a].index,{x:l.x,y:l.y,width:0,height:0});u.labelElements.push(e)}}}}if(1===t&&"none"!==n)for(let e=0;e<u.symbolElements.length;e++)isNaN(u.pointsArray[e].index)||this._installHandlers(u.symbolElements[e],"symbol",r,s,u.pointsArray[e].index)}}_adjustLineLabelPosition(e,t,i,r){let s=this._showLabel(e,t,i,{width:0,height:0},"","",!0);if(!s)return;let a={x:r.x-s.width/2,y:0};return a.y=r.y-1.5*s.height,a}_calculateLine(e,t,i,r,s,a,l,n,o){let h,d=this.seriesGroups[e];!0!==d.polar&&!0!==d.spider||(h=this._getPolarAxisCoords(e,this._plotRect));let u="",g=r.length;n||0!==s.length||(g=t*l-i);for(let e=0;e<g+1&&e<r.length;e++){e>0&&(u+=" ");let t=r[e].y,i=r[e].x,d=n?a:t,f=i;if(s&&s.length>e&&(d=s[e].y,f=s[e].x,(isNaN(d)||isNaN(f))&&(d=t,f=i)),g<=r.length&&e>0&&e===g&&(f=r[e-1].x,d=r[e-1].y),o?(i=this.renderer._ptrnd((i-d)*(n?l:1)+d),t=this.renderer._ptrnd(t)):(i=this.renderer._ptrnd((i-f)*l+f),t=this.renderer._ptrnd((t-d)*l+d)),h){let e=this._toPolarCoord(h,this._plotRect,i,t);i=e.x,t=e.y}u+=i+","+t}return u}_buildLineCmd(e,t,i,r,s,a,l,n,o,h,d,u){let g=e,f=u?l+","+i:i+","+l;!n||o||t||(g=f+" "+e+" "+(u?l+","+r:r+","+l)),d&&(g=this._getBezierPoints(g));let p=g.split(" ");if(0===p.length)return"";if(1===p.length){let e=p[0].split(",");return"M "+p[0]+" L"+(parseFloat(e[0])+1)+","+(parseFloat(e[1])+1)}let c=p[0].replace("M","");return n&&!o?g=t?"M "+c+" L "+c+(d?"":" L "+c+" ")+g:"M "+f+" L "+c+" "+g:d||(g="M "+c+" L "+c+" "+g),(o&&h||t)&&(g+=" Z"),g}_getSerieSettings(e,t){let i=this.seriesGroups[e],r=-1!==i.type.indexOf("area"),s=-1!==i.type.indexOf("line"),a=i.series[t],l=a.dashStyle||i.dashStyle||"",n=a.opacity||i.opacity;(isNaN(n)||n<0||n>1)&&(n=1);let o=a.lineWidth;isNaN(o)&&"auto"!==o&&(o=i.lineWidth),("auto"===o||isNaN(o)||o<0||o>15)&&(o=r?2:s?3:1);let h=a.lineWidthSymbol;return isNaN(h)&&(h=1),{stroke:o,strokeSymbol:h,opacity:n,dashStyle:l}}_getColors(e,t,i,r,s){let a=this.seriesGroups[e],l=a.series[t],n=this._get([l.useGradientColors,a.useGradientColors,!1]),o=this._getSeriesColors(e,t,i),h=[[0,1.4],[100,1]],d=[[0,1],[25,1.1],[50,1.4],[100,1]],u=[[0,1.3],[90,1.2],[100,1]],g=NaN;if(isNaN(s)||(g=2===s?h:d),n){let s={};for(let e in o)s[e]=o[e];if(o=s,"verticalLinearGradient"===r||"horizontalLinearGradient"===r){let e="verticalLinearGradient"===r?g||h:g||d,t=["fillColor","fillColorSelected","fillColorAlt","fillColorAltSelected"];for(let i in t){let s=o[t[i]];s&&(o[t[i]]=this.renderer._toLinearGradient(s,"verticalLinearGradient"===r,e))}}else if("radialGradient"===r){let r,s=h;("pie"===a.type||"donut"===a.type||a.polar)&&null!=i&&this._renderData[e]&&this._renderData[e].offsets[t]&&(r=this._renderData[e].offsets[t][i],s=u),o.fillColor=this.renderer._toRadialGradient(o.fillColor,s,r),o.fillColorSelected=this.renderer._toRadialGradient(o.fillColorSelected,s,r)}}return o}_installHandlers(e,t,i,r,s){if(!this.enableEvents)return!1;var a=this,l=this.seriesGroups[i],n=this.seriesGroups[i].series[r],o=-1!==l.type.indexOf("line")||-1!==l.type.indexOf("area");o||!1===l.enableSelection||!1===n.enableSelection||this.renderer.addHandler(e,"mousemove",(function(){var e=a._selected;e&&e.isLineType&&"click"===e.linesUnselectMode&&(e.group!==i||e.series!==r)||a._ttEl&&a._ttEl.gidx===i&&a._ttEl.sidx===r&&a._ttEl.iidx===s||a._startTooltipTimer(i,r,s)})),!1!==l.enableSelection&&!1!==n.enableSelection&&this.renderer.addHandler(e,"mouseover",(function(){var l=a._selected;l&&l.isLineType&&"click"===l.linesUnselectMode&&(l.group!==i||l.series!==r)||a._select(e,t,i,r,s,s)})),this.renderer.addHandler(e,"click",(function(e){clearTimeout(a._hostClickTimer),a._lastClickTs=(new Date).valueOf(),o&&"symbol"!==t&&"pointMarker"!==t||(a._isColumnType(l.type)&&a._unselect(),isNaN(s)||(e.stopImmediatePropagation(),a._raiseItemEvent("click",l,n,s)))}))}_getHorizontalOffset(e,t,i,r){let s=this._plotRect;if(0===this._getDataLen(e))return{index:void 0,value:i};let a=this._calcGroupOffsets(e,this._plotRect);if(0===a.xoffsets.length)return{index:void 0,value:void 0};let l,n,o,h,d,u=i,g=r,f=this.seriesGroups[e];(f.polar||f.spider)&&(l=this._getPolarAxisCoords(e,s));for(let e=a.xoffsets.first;e<=a.xoffsets.last;e++){let i=a.xoffsets.data[e],r=a.offsets[t][e].to,p=0;if(l){let e=this._toPolarCoord(l,s,i+s.x,r);i=e.x,r=e.y,p=this.renderer._ptdist(u,g,i,r)}else if("horizontal"===f.orientation){i+=s.y;let e=r;r=i,i=e,p=this.renderer._ptdist(u,g,i,r)}else i+=s.x,p=Math.abs(u-i);(isNaN(n)||n>p)&&(n=p,o=e,h=i,d=r)}return{index:o,value:a.xoffsets.data[o],polarAxisCoords:l,x:h,y:d}}onmousemove(e,t){if(this._mouseX===e&&this._mouseY===t)return;if(this._mouseX=e,this._mouseY=t,!this._selected)return;let i=this._selected.group,r=this._selected.series,s=this.seriesGroups[i],a=s.series[r],l=this._plotRect;if(this.renderer&&(l=this.renderer.getRect(),l.x+=5,l.y+=5,l.width-=10,l.height-=10),e<l.x+window.scrollX||e>l.x+l.width+window.scrollX||t<l.y+window.scrollY||t>l.y+l.height+window.scrollY)return this._hideToolTip(),void this._unselect();let n="horizontal"===s.orientation;if(l=this._plotRect,-1!==s.type.indexOf("line")||-1!==s.type.indexOf("area")){let o=this._getHorizontalOffset(i,this._selected.series,e,t),h=o.index;if(null==h)return;if(this._selected.item!==h){let e=this._linesRenderInfo[i][r].segments,t=0;for(;h>e[t].lastItemIndex;)if(t++,t>=e.length)return;let s=e[t].pathElement,a=e[t].lastItemIndex;this._unselect(!1),this._select(s,"path",i,r,h,a)}let d=this._getSymbol(this._selected.group,this._selected.series);"none"===d&&(d="circle");let u=this._calcGroupOffsets(i,l),g=u.offsets[this._selected.series][h].to,f=g;-1!==s.type.indexOf("range")&&(f=u.offsets[this._selected.series][h].from);let p=n?e:t;if(t=!isNaN(f)&&Math.abs(p-f)<Math.abs(p-g)?f:g,isNaN(t))return;if(e=o.value,n){let i=e;e=t,t=i+l.y}else e+=l.x;if(o.polarAxisCoords&&(e=o.x,t=o.y),t=this.renderer._ptrnd(t),e=this.renderer._ptrnd(e),this._pointMarker&&this._pointMarker.element&&(this.renderer.removeElement(this._pointMarker.element),this._pointMarker.element=void 0),isNaN(e)||isNaN(t))return;let c=this._getSeriesColors(i,r,h),m=this._getSerieSettings(i,r),y=a.symbolSizeSelected;isNaN(y)&&(y=a.symbolSize),(isNaN(y)||y>50||y<0)&&(y=s.symbolSize),(isNaN(y)||y>50||y<0)&&(y=8),(this.showToolTips||this.enableCrosshairs)&&(this._pointMarker={type:d,x:e,y:t,gidx:i,sidx:r,iidx:h},this._pointMarker.element=this._drawSymbol(d,e,t,c.fillColorSymbolSelected,m.opacity,c.lineColorSymbolSelected,m.opacity,m.strokeSymbol,m.dashStyle,y),this._installHandlers(this._pointMarker.element,"pointMarker",i,r,h)),this._startTooltipTimer(i,this._selected.series,h)}}_drawSymbol(e,t,i,r,s,a,l,n,o,h){let d,u,g=h||6,f=g/2;switch(e){case"none":return;case"circle":d=this.renderer.circle(t,i,g/2);break;case"square":g-=1,f=g/2,d=this.renderer.rect(t-f,i-f,g,g);break;case"diamond":u="M "+(t-f)+","+i+" L"+t+","+(i-f)+" L"+(t+f)+","+i+" L"+t+","+(i+f)+" Z",d=this.renderer.path(u);break;case"triangle_up":case"triangle":u="M "+(t-f)+","+(i+f)+" L "+(t+f)+","+(i+f)+" L "+t+","+(i-f)+" Z",d=this.renderer.path(u);break;case"triangle_down":u="M "+(t-f)+","+(i-f)+" L "+t+","+(i+f)+" L "+(t+f)+","+(i-f)+" Z",d=this.renderer.path(u);break;case"triangle_left":u="M "+(t-f)+","+i+" L "+(t+f)+","+(i+f)+" L "+(t+f)+","+(i-f)+" Z",d=this.renderer.path(u);break;case"triangle_right":u="M "+(t-f)+","+(i-f)+" L "+(t-f)+","+(i+f)+" L "+(t+f)+","+i+" Z",d=this.renderer.path(u);break;default:d=this.renderer.circle(t,i,g)}return this.renderer.attr(d,{fill:r,"fill-opacity":s,stroke:a,"stroke-width":n,"stroke-opacity":l,"stroke-dasharray":o||""}),"circle"!==e&&(this.renderer.attr(d,{r:g/2}),"square"!==e&&this.renderer.attr(d,{x:t,y:i})),d}_getSymbol(e,t){let i,r=["circle","square","diamond","triangle_up","triangle_down","triangle_left","triangle_right"],s=this.seriesGroups[e],a=s.series[t];return void 0!==a.symbolType&&null!==a.symbolType&&(i=a.symbolType),null==i&&(i=s.symbolType),"default"===i?r[t%r.length]:null!=i?i:"none"}_startTooltipTimer(e,t,i,r,s,a,l){this._cancelTooltipTimer();let n=this,o=this.toolTipShowDelay;(isNaN(o)||o>1e4||o<0)&&(o=500),(this._ttEl||!0===this.enableCrosshairs&&!1===this.showToolTips)&&(o=0),isNaN(a)||(o=a),clearTimeout(this._tttimerHide),isNaN(r)&&(r=n._mouseX),isNaN(s)&&(s=n._mouseY-3),0===o&&n._showToolTip(r,s,e,t,i),this._tttimer=setTimeout((function(){0!==o&&n._showToolTip(r,s,e,t,i);let a=n.toolTipHideDelay;isNaN(l)||(a=l),isNaN(a)&&(a=4e3),n._tttimerHide=setTimeout((function(){n._hideToolTip(),n._unselect()}),a)}),o)}_cancelTooltipTimer(){clearTimeout(this._tttimer)}_getGroupGradientType(e){let t=this.seriesGroups[e];return-1!==t.type.indexOf("area")?"horizontal"===t.orientation?"horizontalLinearGradient":"verticalLinearGradient":this._isColumnType(t.type)||-1!==t.type.indexOf("candle")?t.polar?"radialGradient":"horizontal"===t.orientation?"verticalLinearGradient":"horizontalLinearGradient":-1!==t.type.indexOf("scatter")||-1!==t.type.indexOf("bubble")||this._isPieGroup(e)?"radialGradient":void 0}_select(e,t,i,r,s,a){if(this._selected){if(this._selected.item===s&&this._selected.series===r&&this._selected.group===i)return;this._unselect()}let l=this.seriesGroups[i],n=l.series[r];if(!1===l.enableSelection||!1===n.enableSelection)return;let o=-1!==l.type.indexOf("line")&&-1===l.type.indexOf("area");this._selected={element:e,type:t,group:i,series:r,item:s,iidxBase:a,isLineType:o,linesUnselectMode:n.linesUnselectMode||l.linesUnselectMode};let h=this._getColors(i,r,a||s,this._getGroupGradientType(i)),d=h.fillColorSelected;o&&(d="none");let u=this._getSerieSettings(i,r),g="symbol"===t?h.lineColorSymbolSelected:h.lineColorSelected;d="symbol"===t?h.fillColorSymbolSelected:d;let f="symbol"===t?1:u.stroke;"symbol"!==t&&this.renderer.getAttr(e,"fill")===h.fillColorAlt&&(d=h.fillColorAltSelected),this.renderer.attr(e,{stroke:g,fill:d,"stroke-width":f}),-1===l.type.indexOf("pie")&&-1===l.type.indexOf("donut")||this._applyPieSelect(),this._raiseItemEvent("mouseover",l,n,s),this._isTouchDevice&&this._startTooltipTimer(i,r,s)}_applyPieSelect(){var e=this;e._createAnimationGroup("animPieSlice");var t=this._selected;if(t){var i=this.getItemCoord(t.group,t.series,t.item);if(i){var r={element:this._getRenderInfo(t.group,t.series,t.item),coord:i};this._enqueueAnimation("animPieSlice",void 0,void 0,300,(function(i,r,s){var a=r.coord,l=a.selectedRadiusChange*s,n=e.renderer.pieSlicePath(a.center.x,a.center.y,0===a.innerRadius?0:a.innerRadius+l,a.outerRadius+l,a.fromAngle,a.toAngle,a.centerOffset);e.renderer.attr(r.element.element,{d:n}),e._showPieLabel(t.group,t.series,t.item,void 0,l,r.element.colors.lineColor)}),r),e._startAnimation("animPieSlice")}}}_applyPieUnselect(){this._stopAnimations();let e=this._selected;if(!e)return;let t=this.getItemCoord(e.group,e.series,e.item);if(!t||!t.center)return;let i=this.renderer.pieSlicePath(t.center.x,t.center.y,t.innerRadius,t.outerRadius,t.fromAngle,t.toAngle,t.centerOffset);this.renderer.attr(e.element,{d:i}),this._showPieLabel(e.group,e.series,e.item,void 0,0,this._getRenderInfo(e.group,e.series,e.item).colors.lineColor)}_unselect(){let e=this;if(e._selected){let t=e._selected.group,i=e._selected.series,r=e._selected.item,s=e._selected.iidxBase,a=e._selected.type,l=e.seriesGroups[t],n=l.series[i],o=-1!==l.type.indexOf("line")&&-1===l.type.indexOf("area"),h=e._getColors(t,i,s||r,e._getGroupGradientType(t)),d=h.fillColor;o&&(d="none");let u=e._getSerieSettings(t,i),g="symbol"===a?h.lineColorSymbol:h.lineColor;d="symbol"===a?h.fillColorSymbol:d,"symbol"!==a&&this.renderer.getAttr(e._selected.element,"fill")===h.fillColorAltSelected&&(d=h.fillColorAlt);let f="symbol"===a?1:u.stroke;e.renderer.attr(e._selected.element,{stroke:g,fill:d,"stroke-width":f}),-1===l.type.indexOf("pie")&&-1===l.type.indexOf("donut")||this._applyPieUnselect(),e._selected=void 0,isNaN(r)||e._raiseItemEvent("mouseout",l,n,r)}e._pointMarker&&(e._pointMarker.element&&(e.renderer.removeElement(e._pointMarker.element),e._pointMarker.element=void 0),e._pointMarker=void 0,e._hideCrosshairs())}_raiseItemEvent(e,t,i,r){let s=i[e]||t[e],a=0;for(;a<this.seriesGroups.length&&this.seriesGroups[a]!==t;a++);if(a===this.seriesGroups.length)return;let l={event:e,seriesGroup:t,serie:i,elementIndex:r,elementValue:this._getDataValue(r,i.dataField,a)};s&&"function"==typeof s&&s(l),this.$.fireEvent(e,l)}_calcInterval(e,t,i){let r=Math.abs(t-e)/i,s=.1,a=[1,2,3,4,5,10,15,20,25,50,100];r<1&&(a=[.5,.25,.125,.1],s=10);let l=0;do{l=0,r>=1?s*=10:s/=10;for(let e=1;e<a.length&&Math.abs(a[l]*s-r)>Math.abs(a[e]*s-r);e++)l=e}while(l===a.length-1);return a[l]*s}_renderDataClone(){if(!this._renderData||this._isToggleRefresh)return;let e=this._elementRenderInfo=[];if(!this._isSelectorRefresh)for(let t=0;t<this._renderData.length;t++){for(;e.length<=t;)e.push({});let i=e[t],r=this._renderData[t];if(!r.offsets)continue;if(r.valueAxis){i.valueAxis={itemOffsets:{}};for(let e in r.valueAxis.itemOffsets)i.valueAxis.itemOffsets[e]=r.valueAxis.itemOffsets[e]}if(r.xAxis){i.xAxis={itemOffsets:{}};for(let e in r.xAxis.itemOffsets)i.xAxis.itemOffsets[e]=r.xAxis.itemOffsets[e]}i.series=[];let s=i.series,a=this._isPieGroup(t);for(let e=0;e<r.offsets.length;e++){s.push({});for(let i=0;i<r.offsets[e].length;i++)if(a){let t=r.offsets[e][i];s[e][t.displayValue]={value:t.value,x:t.x,y:t.y,fromAngle:t.fromAngle,toAngle:t.toAngle}}else r.xoffsets?s[e][r.xoffsets.xvalues[i]]={value:r.offsets[e][i].value,valueRadius:r.offsets[e][i].valueRadius,xoffset:r.xoffsets.data[i],from:r.offsets[e][i].from,to:r.offsets[e][i].to}:(r.xoffsets=this._calculateXOffsets(t,self._plotRect.width),r.xoffsets&&(s[e][r.xoffsets.xvalues[i]]={value:r.offsets[e][i].value,valueRadius:r.offsets[e][i].valueRadius,xoffset:r.xoffsets.data[i],from:r.offsets[e][i].from,to:r.offsets[e][i].to}))}}}getPolarDataPointOffset(e,t,i){let r=this._renderData[i];if(!r)return{x:NaN,y:NaN};let s=this.getValueAxisDataPointOffset(t,i),a=this.getXAxisDataPointOffset(e,i),l=this._toPolarCoord(r.polarCoords,r.xAxis.rect,a,s);return{x:l.x,y:l.y}}_getDataPointOffsetDiff(e,t,i,r,s,a,l){let n=this._getDataPointOffset(e,i,r,s,a,l),o=this._getDataPointOffset(t,i,r,s,a,l);return Math.abs(n-o)}_getXAxisRenderData(e){if(e>=this._renderData.length)return;let t=this.seriesGroups[e],i=this._renderData[e].xAxis;if(i){if(void 0===t.xAxis||null===t.xAxis)for(let t=0;t<=e;t++)if(void 0===this.seriesGroups[t].xAxis||null===this.seriesGroups[t].xAxis){i=this._renderData[t].xAxis;break}return i}}getXAxisDataPointOffset(e,t){let i=this.seriesGroups[t];if(isNaN(e))return NaN;const r=this._getXAxisRenderData(t);if(!r)return NaN;let s=r.data.axisStats,a=s.min.valueOf(),l=s.max.valueOf(),n=l-a;if(0===n&&(n=1),e.valueOf()>l||e.valueOf()<a)return NaN;let o=this._getXAxis(t),h="horizontal"===i.orientation?"height":"width",d="horizontal"===i.orientation?"y":"x",u=(e.valueOf()-a)/n,g=r.rect[h]-r.data.padding.left-r.data.padding.right;return(i.polar||i.spider)&&this._renderData[t].polarCoords.isClosedCircle&&(g=r.data.axisSize),this._plotRect[d]+r.data.padding.left+g*(o.flip?1-u:u)}getValueAxisDataPointOffset(e,t){let i=this._getValueAxis(t);if(!i)return NaN;let r=this._renderData[t];if(!r)return NaN;let s=!0===i.flip,a=r.logBase,l=r.scale,n=r.gbase,o=r.baseOffset;return this._getDataPointOffset(e,n,a,l,o,s)}_getDataPointOffset(e,t,i,r,s,a){let l;return isNaN(e)&&(e=t),l=isNaN(i)?(e-t)*r:(this._draw.log(e,i)-this._draw.log(t,i))*r,l=a?s+l:s-l,l}_calcGroupOffsets(e,t){let i=this.seriesGroups[e];for(;this._renderData.length<e+1;)this._renderData.push({});if(null!==this._renderData[e]&&void 0!==this._renderData[e].offsets)return this._renderData[e];if(this._isPieGroup(e))return this._calcPieSeriesGroupOffsets(e,t);let r=this._getValueAxis(e);if(!r||!i.series||0===i.series.length)return this._renderData[e];let s=!0===r.flip,a=!0===r.logarithmicScale,l=r.logarithmicScaleBase||10,n=[],o=-1!==i.type.indexOf("stacked"),h=o&&-1!==i.type.indexOf("100"),d=-1!==i.type.indexOf("range"),u=this._isColumnType(i.type),g=-1!==i.type.indexOf("waterfall"),f=this._getDataLen(e),p=i.baselineValue||r.baselineValue||0;h&&(p=0);let c=this._stats.seriesGroups[e];if(!c||!c.isValid)return;let m=c.hasStackValueReversal;if(m&&(p=0),g&&o){if(m)return;p=c.base}p>c.max&&(p=c.max),p<c.min&&(p=c.min);let y=h||a?c.maxRange:c.max-c.min,_=c.min,x=c.max,v=t.height/(a?c.intervals:y),b=0;h?_*x<0?(y/=2,b=-(y+p)*v):b=-p*v:b=-(p-_)*v,s?b=t.y-b:b+=t.y+t.height;let N,M=[],A=[],w=[];a&&(N=this._draw.log(x,l)-this._draw.log(p,l),o&&(N=c.intervals,p=h?0:_),s||(b=t.y+N/c.intervals*t.height)),b=this.renderer._ptrnd(b);let S=_*x<0?t.height/2:t.height,C=[],k=[],D=o&&(u||a),T=[];n=new Array(i.series.length);for(let e=0;e<i.series.length;e++)n[e]=new Array(f);for(let t=0;t<f;t++){!g&&o&&(k=[]);for(let r=0;r<i.series.length;r++){!o&&a&&(C=[]);let u=i.series[r],g=u.dataField,f=u.dataFieldFrom,m=u.dataFieldTo,y=u.radiusDataField||u.sizeDataField;n[r][t]={};let _=this._isSerieVisible(e,r);if(-1!==i.type.indexOf("candle")||-1!==i.type.indexOf("ohlc")){let i=["Open","Close","High","Low"];for(let o in i){let h="dataField"+i[o];u[h]&&(n[r][t][i[o]]=this._getDataPointOffset(this._getDataValueAsNumber(t,u[h],e),p,a?l:NaN,v,b,s))}continue}if(o)for(;k.length<=t;)k.push(0);let x=NaN;d&&(x=this._getDataValueAsNumber(t,f,e),isNaN(x)&&(x=p));let N=NaN;N=d?this._getDataValueAsNumber(t,m,e):this._getDataValueAsNumber(t,g,e);let F,O=this._getDataValueAsNumber(t,y,e);if(o&&(k[t]+=_?N:0),_||(N=NaN),isNaN(N)||a&&N<=0){n[r][t]={from:void 0,to:void 0};continue}o&&(D?F=N>=p?M:A:N=k[t]);let I=v*(N-p);if(d&&(I=v*(N-x)),o&&D&&(T[t]?I=v*N:(T[t]=!0,I=v*(N-p))),a){for(;C.length<=t;)C.push({p:{value:0,height:0},n:{value:0,height:0}});let e=d||d?x:p,i=N>e?C[t].p:C[t].n;i.value+=N,h?(N=i.value/(c.psums[t]+c.nsums[t])*100,I=(this._draw.log(N,l)-c.minPow)*v):(I=this._draw.log(i.value,l)-this._draw.log(e,l),I*=v),I-=i.height,i.height+=I}let P=b;if(d){let e=0;e=a?(this._draw.log(x,l)-this._draw.log(p,l))*v:(x-p)*v,P+=s?e:-e}if(o){if(h&&!a){let e=c.psums[t]-c.nsums[t];N>p?(I=c.psums[t]/e*S,0!==c.psums[t]&&(I*=N/c.psums[t])):(I=c.nsums[t]/e*S,0!==c.nsums[t]&&(I*=N/c.nsums[t]))}D&&(isNaN(F[t])&&(F[t]=P),P=F[t])}isNaN(w[t])&&(w[t]=0);let R=w[t];I=Math.abs(I);let L=I;if(I>=1){const e=this.renderer._ptrnd(I)-1;I=Math.abs(I-e)>.5?Math.round(I):e}if(R+=I-L,o||(R=0),Math.abs(R)>.5&&(R>0?(I-=1,R-=1):(I+=1,R+=1)),w[t]=R,r===i.series.length-1&&h){let e=0;for(let i=0;i<r;i++)e+=Math.abs(n[i][t].to-n[i][t].from);if(e+=I,e<S)if(I>.5)I=this.renderer._ptrnd(I+S-e);else{let i=r-1;for(;i>=0;){if(Math.abs(n[i][t].to-n[i][t].from)>1){n[i][t].from>n[i][t].to&&(n[i][t].from+=S-e);break}i--}}}s&&(I*=-1);let G=N<p;d&&(G=x>N);let V=isNaN(x)?N:{from:x,to:N};G?(D&&(F[t]+=I),n[r][t]={from:P,to:P+I,value:V,valueRadius:O}):(D&&(F[t]-=I),n[r][t]={from:P,to:P-I,value:V,valueRadius:O})}}let F=this._renderData[e];return F.baseOffset=b,F.gbase=p,F.logBase=a?l:NaN,F.scale=v,F.offsets=g?this._applyWaterfall(n,f,e,b,p,a?l:NaN,v,s,o):n,F.xoffsets=this._calculateXOffsets(e,t.width),this._renderData[e]}_isPercent(e){return"string"==typeof e&&e.length>0&&e.indexOf("%")===e.length-1}_calcPieSeriesGroupOffsets(e,t){var i=this,r=this._getDataLen(e),s=this.seriesGroups[e],a=this._renderData[e]={},l=a.offsets=[];for(let a=0;a<s.series.length;a++){var n=s.series[a],o=this._get([n.minAngle,n.startAngle]);(isNaN(o)||o<0||o>360)&&(o=0);var h=this._get([n.maxAngle,n.endAngle]);(isNaN(h)||h<0||h>360)&&(h=360);var d=h-o,u=n.initialAngle||0;u<o&&(u=o),u>h&&(u=h);var g=n.centerOffset||0,f=this._draw.getNum([n.offsetX,s.offsetX,t.width/2]),p=this._draw.getNum([n.offsetY,s.offsetY,t.height/2]),c=Math.min(t.width,t.height)/2,m=u,y=n.radius;i._isPercent(y)&&(y=parseFloat(y)/100*c),isNaN(y)&&(y=.4*c);var _=n.innerRadius;i._isPercent(_)&&(_=parseFloat(_)/100*c),(isNaN(_)||_>=y)&&(_=0);var x=n.selectedRadiusChange;i._isPercent(x)&&(x=parseFloat(x)/100*(y-_)),isNaN(x)&&(x=.1*(y-_)),l.push([]);var v=0,b=0;for(let t=0;t<r;t++){var N=this._getDataValueAsNumber(t,n.dataField,e);isNaN(N)||(this._isSerieVisible(e,a,t)||!0===n.hiddenPointsDisplay)&&(N>0?v+=N:b+=N)}var M=v-b;0===M&&(M=1);for(let i=0;i<r;i++){let r=this._getDataValueAsNumber(i,n.dataField,e);if(isNaN(r))l[a].push({});else{var A=n.displayText||n.displayField,w=this._getDataValue(i,A,e);null==w&&(w=i);var S=0,C=this._isSerieVisible(e,a,i);(C||!0===n.hiddenPointsDisplay)&&(S=Math.abs(r)/M*d);var k=t.x+f,D=t.y+p,T=g;"function"==typeof g&&(T=g({seriesIndex:a,seriesGroupIndex:e,itemIndex:i})),isNaN(T)&&(T=0);var F={key:e+"_"+a+"_"+i,value:r,displayValue:w,x:k,y:D,fromAngle:m,toAngle:m+S,centerOffset:T,innerRadius:_,outerRadius:y,selectedRadiusChange:x,visible:C};l[a].push(F),m+=S}}}return a}_isPointSeriesOnly(){for(let e=0;e<this.seriesGroups.length;e++){let t=this.seriesGroups[e];if(-1===t.type.indexOf("line")&&-1===t.type.indexOf("area")&&-1===t.type.indexOf("scatter")&&-1===t.type.indexOf("bubble"))return!1}return!0}_hasColumnSeries(){let e=["column","ohlc","candlestick","waterfall"];for(let t=0;t<this.seriesGroups.length;t++){let i=this.seriesGroups[t];for(let t in e)if(-1!==i.type.indexOf(e[t]))return!0}return!1}_alignValuesWithTicks(e){let t=this._isPointSeriesOnly(),i=this.seriesGroups[e],r=this._getXAxis(e),s=void 0===r.valuesOnTicks||null===r.valuesOnTicks?t:!1!==r.valuesOnTicks;return r.logarithmicScale&&(s=!0),null==e||void 0===i.valuesOnTicks||null===i.valuesOnTicks?s:i.valuesOnTicks}_getYearsDiff(e,t){return t.getFullYear()-e.getFullYear()}_getMonthsDiff(e,t){return 12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth()}_getDateDiff(e,t,i,r){let s=0;switch("year"!==i&&"month"!==i&&(s=t.valueOf()-e.valueOf()),i){case"year":s=this._getYearsDiff(e,t);break;case"month":s=this._getMonthsDiff(e,t);break;case"day":s/=864e5;break;case"hour":s/=36e5;break;case"minute":s/=6e4;break;case"second":s/=1e3}return"year"!==i&&"month"!==i&&!1!==r&&(s=this.renderer._rnd(s,1,!0)),s}_getBestDTUnit(e,t,i,r,s){let a="day",l=t.valueOf()-e.valueOf();a=l<1e3?"second":l<36e5?"minute":l<864e5?"hour":l<2592e6?"day":l<31104e6?"month":"year";let n=[{key:"year",cnt:l/31536e6},{key:"month",cnt:l/2592e6},{key:"day",cnt:l/864e5},{key:"hour",cnt:l/36e5},{key:"minute",cnt:l/6e4},{key:"second",cnt:l/1e3},{key:"millisecond",cnt:l}],o=-1;for(let e=0;e<n.length;e++)if(n[e].key===a){o=e;break}let h=-1,d=-1;for(;o<n.length&&!(n[o].cnt/100>r);o++){let a=this._estAxisInterval(e,t,i,r,n[o].key,s),l=this._getDTIntCnt(e,t,a,n[o].key);(-1===h||h<l)&&(h=l,d=o)}return a=n[d].key,a}_getXAxisStats(e,t,i){let r=this._getDataLen(e),s="date"===t.type||"time"===t.type;if(s&&!this._autoDateFormats){this._autoDateFormats||(this._autoDateFormats=[]);let e=this._testXAxisDateFormat();e&&this._autoDateFormats.push(e)}let a=s?this._castAsDate(t.minValue,t.dateFormat):this._castAsNumber(t.minValue),l=s?this._castAsDate(t.maxValue,t.dateFormat):this._castAsNumber(t.maxValue);if(this._selectorRange&&this._selectorRange[e]){let i=this._selectorRange[e].min;isNaN(i)||(a=s?this._castAsDate(i,t.dateFormat):this._castAsNumber(i));let r=this._selectorRange[e].max;isNaN(r)||(l=s?this._castAsDate(r,t.dateFormat):this._castAsNumber(r))}let n,o,h=a,d=l,u=void 0===t.type||null===t.type||"auto"===t.type,g=u||"basic"===t.type,f=0,p=0;for(let i=0;i<r&&t.dataField;i++){let r=this._getDataValue(i,t.dataField,e);r=s?this._castAsDate(r,t.dateFormat):this._castAsNumber(r),isNaN(r)||(s?f++:p++,(isNaN(n)||r<n)&&(n=r),(isNaN(o)||r>=o)&&(o=r))}u&&(!s&&p===r||s&&f===r)&&(g=!1),g&&(n=0,o=Math.max(0,r-1)),isNaN(h)&&(h=n),isNaN(d)&&(d=o),s?(this._isDate(h)||(h=this._isDate(d)?d:new Date),this._isDate(d)||(d=this._isDate(h)?h:new Date)):(isNaN(h)&&(h=0),isNaN(d)&&(d=g?Math.max(0,r-1):h)),null==n&&(n=h),null==o&&(o=d);let c,m,y=t.rangeSelector&&t.rangeSelector.visible;if(y){let e=y.minValue||h;e&&s&&(e=this._castAsDate(e,y.dateFormat||t.dateFormat));let i=y.maxValue||d;i&&s&&(i=this._castAsDate(i,y.dateFormat||t.rangeSelector)),h<e&&(h=e),d<e&&(d=i),h>i&&(h=e),d>i&&(d=i)}s&&(c=t.baseUnit,c||(c=this._getBestDTUnit(h,d,e,i)),m="hour"===c||"minute"===c||"second"===c||"millisecond"===c);let _=!0===t.logarithmicScale,x=t.logarithmicScaleBase;(isNaN(x)||x<=1)&&(x=10);let v=t.unitInterval;_?v=1:(isNaN(v)||v<=0)&&(v=this._estAxisInterval(h,d,e,i,c));let b,N,M={min:h,max:d},A=this.seriesGroups[e];return _?(h||(h=1,d&&h>d&&(h=d)),d||(d=h),M={min:h,max:d},b=this.renderer._rnd(this._draw.log(h,x),1,!1),N=this.renderer._rnd(this._draw.log(d,x),1,!0),d=Math.pow(x,N),h=Math.pow(x,b)):s||!A.polar&&!A.spider||(h=this.renderer._rnd(h,v,!1),d=this.renderer._rnd(d,v,!0)),{min:h,max:d,logAxis:{enabled:_,base:x,minPow:b,maxPow:N},dsRange:{min:n,max:o},filterRange:M,useIndeces:g,isDateTime:s,isTimeUnit:m,dateTimeUnit:c,interval:v}}_getDefaultDTFormatFn(e){let t,i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return t="year"===e||"month"===e||"day"===e?function(e){return e.getDate()+"-"+i[e.getMonth()]+"-"+e.getFullYear()}:function(e){return e.getDate()+"-"+i[e.getMonth()]+"-"+e.getFullYear()+"<br>"+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()},t}_getDTIntCnt(e,t,i,r){let s=0,a=new Date(e),l=new Date(t);if(l=l.valueOf(),i<=0)return 1;for(;a.valueOf()<l;)"millisecond"===r?a=new Date(a.valueOf()+i):"second"===r?a=new Date(a.valueOf()+1e3*i):"minute"===r?a=new Date(a.valueOf()+6e4*i):"hour"===r?a=new Date(a.valueOf()+6e4*i*24):"day"===r?a.setDate(a.getDate()+i):"month"===r?a.setMonth(a.getMonth()+i):"year"===r&&a.setFullYear(a.getFullYear()+i),s++;return s}_estAxisInterval(e,t,i,r,s,a){if(isNaN(e)||isNaN(t))return NaN;let l=[1,2,5,10,15,20,50,100,200,500],n=0,o=r/(!isNaN(a)&&a>0?a:50);if(this._renderData&&this._renderData.length>i&&this._renderData[i].xAxis&&!isNaN(this._renderData[i].xAxis.avgWidth)){let e=Math.max(1,this._renderData[i].xAxis.avgWidth);0!==e&&isNaN(a)&&(o=.9*r/e)}if(o<=1)return Math.abs(t-e);let h,d=0;for(;h=n>=l.length?Math.pow(10,3+n-l.length):l[n],d=this._isDate(e)&&this._isDate(t)?this._getDTIntCnt(e,t,h,s):(t-e)/h,!(d<=o);)n++;let u=this.seriesGroups[i];return(u.spider||u.polar)&&2*h>t-e&&(h=t-e),h}_getPaddingSize(e,t,i,r,s,a,l){var n=e.min,o=e.max;e.logAxis.enabled&&(n=e.logAxis.minPow,o=e.logAxis.maxPow);var h=e.interval,d=e.dateTimeUnit;if(s){var u=r/Math.max(1,o-n+h)*h;return a?{left:0,right:u}:i?{left:0,right:0}:{left:u/2,right:u/2}}if(i&&!l)return{left:0,right:0};if(this._isDate(n)&&this._isDate(o)){let e=this._getDTIntCnt(n,o,Math.min(h,o-n),d),t=r/Math.max(2,e);return{left:t/2,right:t/2}}let g=Math.max(1,o-n);if(1===g){const e=r/4;return{left:e,right:e}}let f=r/(g+1);return{left:f/2,right:f/2}}_calculateXOffsets(e,t){var i=this.seriesGroups[e],r=this._getXAxis(e),s=[],a=[],l=this._getDataLen(e),n=this._getXAxisStats(e,r,t),o=n.min,h=n.max,d=n.isDateTime,u=n.isTimeUnit,g=this._hasColumnSeries(),f=i.polar||i.spider,p=this._get([i.startAngle,i.minAngle,0]),c=this._get([i.endAngle,i.maxAngle,360]),m=f&&!(Math.abs(Math.abs(c-p)-360)>1e-4),y=this._alignValuesWithTicks(e),_=this._getPaddingSize(n,r,y,t,f,m,g),x=h-o,v=n.filterRange;0===x&&(x=1);var b=t-_.left-_.right;f&&y&&!m&&(_.left=_.right=0);var N=-1,M=-1;for(let t=0;t<l;t++){var A=void 0===r.dataField?t:this._getDataValue(t,r.dataField,e);if(n.useIndeces){if(t<v.min||t>v.max){s.push(NaN),a.push(void 0);continue}if(S=_.left+(t-o)/x*b,!0===n.logAxis.enabled){var w=n.logAxis.base;S=this._smartPlot.scale(A,{min:o.valueOf(),max:h.valueOf(),type:"logarithmic",base:w},{min:0,max:b,flip:!1})}s.push(this.renderer._ptrnd(S)),a.push(A),-1===N&&(N=t),(-1===M||M<t)&&(M=t)}else if(A=d?this._castAsDate(A,r.dateFormat):this._castAsNumber(A),isNaN(A)||A<v.min||A>v.max)s.push(NaN),a.push(void 0);else{var S=0;if(!0===n.logAxis.enabled){let e=n.logAxis.base;S=this._smartPlot.scale(A,{min:o.valueOf(),max:h.valueOf(),type:"logarithmic",base:e},{min:0,max:b,flip:!1})}else S=!d||d&&u?(A-o)*b/x:(A.valueOf()-o.valueOf())/(h.valueOf()-o.valueOf())*b;S=this.renderer._ptrnd(_.left+S),s.push(S),a.push(A),-1===N&&(N=t),(-1===M||M<t)&&(M=t)}}if(!0===r.flip)for(let e=0;e<s.length;e++)isNaN(s[e])||(s[e]=t-s[e]);(u||d)&&(x=this._getDateDiff(o,h,r.baseUnit),x=this.renderer._rnd(x,1,!1));var C=Math.max(1,x),k=b/C;return N===M&&1===C&&(s[N]=_.left+b/2),{axisStats:n,data:s,xvalues:a,first:N,last:M,length:-1===M?0:M-N+1,itemWidth:k,intervalWidth:k*n.interval,rangeLength:x,useIndeces:n.useIndeces,padding:_,axisSize:b}}_getXAxis(e){return null==e||this.seriesGroups.length<=e?this.xAxis:this.seriesGroups[e].xAxis||this.xAxis}_isGreyScale(e,t){let i=this.seriesGroups[e],r=i.series[t];return!0===r.greyScale||!1!==r.greyScale&&(!0===i.greyScale||!1!==i.greyScale&&!0===this.greyScale)}_getSeriesColors(e,t,i){let r=this._getSeriesColorsInternal(e,t,i);if(this._isGreyScale(e,t))for(let e in r)r[e]=this._draw.toGreyScale(r[e]);return r}_getColorFromScheme(e,t,i){let r="#000000",s=this.seriesGroups[e],a=s.series[t];if(this._isPieGroup(e)){let l=this._getDataLen(e);r=this._getItemColorFromScheme(a.colorScheme||s.colorScheme||this.colorScheme,t*l+i,e,t)}else{let i=0;for(let r=0;r<=e;r++)for(let s=0;s<this.seriesGroups[r].series.length&&(r!==e||parseInt(s)!==t);s++)i++;let a=this.colorScheme;if(s.colorScheme&&(a=s.colorScheme),null!=a&&""!==a||(a=this.colorSchemes[0].name),!a)return r;for(let e=0;e<this.colorSchemes.length;e++){let t=this.colorSchemes[e];if(t.name===a){for(;i>t.colors.length;)i-=t.colors.length,++e>=this.colorSchemes.length&&(e=0),t=this.colorSchemes[e];r=t.colors[i%t.colors.length]}}}return r}_createColorsCache(){this._colorsCache={get:function(e){if(this._store[e])return this._store[e]},set:function(e,t){this._size<1e4&&(this._store[e]=t,this._size++)},clear:function(){this._store={},this._size=0},_size:0,_store:{}}}_getSeriesColorsInternal(e,t,i){let r=this.seriesGroups[e],s=r.series[t];"function"===(s.colorFunction,!1)&&"pie"!==r.type&&"donut"!==r.type&&(i=NaN);let a=e+"_"+t+"_"+(isNaN(i)?"NaN":i);if(this._colorsCache.get(a))return this._colorsCache.get(a);let l,n={lineColor:"#222222",lineColorSelected:"#151515",lineColorSymbol:"#222222",lineColorSymbolSelected:"#151515",fillColor:"#222222",fillColorSelected:"#333333",fillColorSymbol:"#222222",fillColorSymbolSelected:"#333333",fillColorAlt:"#222222",fillColorAltSelected:"#333333"};if("function"==typeof s.colorFunction){let t=isNaN(i)?NaN:this._getDataValue(i,s.dataField,e);if(-1===r.type.indexOf("range")||isNaN(i)||(t={from:this._getDataValue(i,s.dataFieldFrom,e),to:this._getDataValue(i,s.dataFieldTo,e)}),l=s.colorFunction(t,i,s,r),"object"==typeof l)for(let e in l)n[e]=l[e];else n.fillColor=l}else{for(let e in n)s[e]&&(n[e]=s[e]);s.fillColor||s.color?s.fillColor=s.fillColor||s.color:n.fillColor=this._getColorFromScheme(e,t,i)}let o={fillColor:{baseColor:"fillColor",adjust:1},fillColorSelected:{baseColor:"fillColor",adjust:1.1},fillColorSymbol:{baseColor:"fillColor",adjust:1},fillColorSymbolSelected:{baseColor:"fillColorSymbol",adjust:2},fillColorAlt:{baseColor:"fillColor",adjust:4},fillColorAltSelected:{baseColor:"fillColor",adjust:3},lineColor:{baseColor:"fillColor",adjust:.95},lineColorSelected:{baseColor:"lineColor",adjust:.95},lineColorSymbol:{baseColor:"lineColor",adjust:1},lineColorSymbolSelected:{baseColor:"lineColorSelected",adjust:1}};for(let e in n)"object"==typeof l&&l[e]||s[e]&&(n[e]=s[e]);for(let e in n)"object"==typeof l&&l[e]||s[e]||(n[e]=this.renderer.adjustColor(n[o[e].baseColor],o[e].adjust));return this._colorsCache.set(a,n),n}_getItemColorFromScheme(e,t,i,r){let s;for(void 0!==e&&""!==e||(e=this.colorSchemes[0].name),s=0;s<this.colorSchemes.length&&e!==this.colorSchemes[s].name;s++);let a=0;for(;a<=t;){s===this.colorSchemes.length&&(s=0);let e=this.colorSchemes[s].colors.length;if(!(a+e<=t)){let e=this.colorSchemes[s].colors[t-a];return this._isGreyScale(i,r)&&0===e.indexOf("#")&&(e=this._draw.toGreyScale(e)),e}a+=e,s++}}getColorScheme(e){for(let t=0;t<this.colorSchemes.length;t++)if(this.colorSchemes[t].name===e)return this.colorSchemes[t].colors}addColorScheme(e,t){for(let i=0;i<this.colorSchemes.length;i++)if(this.colorSchemes[i].name===e)return void(this.colorSchemes[i].colors=t);this.colorSchemes.push({name:e,colors:t})}removeColorScheme(e){for(let t=0;t<this.colorSchemes.length;t++)if(this.colorSchemes[t].name===e){this.colorSchemes.splice(t,1);break}}_formatValue(e,t,i,r,s,a){if(null==e)return"";if(this._isObject(e)&&!this._isDate(e)&&!i)return"";if(i){if("function"!=typeof i)return e.toString();try{return i(e,a,s,r)}catch(e){return e.message}}return this._isNumber(e)?this._formatNumber(e,t):this._isDate(e)?this._formatDate(e,t):t?(t.prefix||"")+e.toString()+(t.sufix||""):e.toString()}_getFormattedValue(e,t,i,r,s,a){let l=this.seriesGroups[e],n=l.series[t],o="",h=r,d=s;n.labels&&(h=h||this._getFormatSettings(n.labels),d=d||n.labels.formatFunction),h||d||(h=this._getFormatSettings(n),d=n.formatFunction,h||d||(h=this._getFormatSettings(l),d=l.formatFunction));let u={},g=0;for(let t in n)0===t.indexOf("dataField")&&(u[t.substring(9).toLowerCase()]=this._getDataValue(i,n[t],e),g++);if(0===g&&(u=this._getDataValue(i,void 0,e)),-1!==l.type.indexOf("waterfall")&&this._isSummary(e,i)&&(u=this._renderData[e].offsets[t][i].value,g=0),d&&"function"==typeof d)try{return d(1===g?u[""]:u,i,n,l)}catch(e){return e.message}if(1===g&&this._isPieGroup(e))return this._formatValue(u[""],h,d,e,t,i);if(g>0){let r=0;for(let s in u){r>0&&""!==o&&(o+="<br>");let l="dataField"+(s.length>0?s.substring(0,1).toUpperCase()+s.substring(1):""),g=n["displayText"+(s.length>0?s.substring(0,1).toUpperCase()+s.substring(1):"")]||n[l],f=u[s];void 0!==f&&(f=this._formatValue(f,h,d,e,t,i),o+=!0===a?f:g+": "+f,r++)}}else null!=u&&(o=this._formatValue(u,h,d,e,t,i));return o||""}_isNumberAsString(e){if("string"!=typeof e)return!1;e=e.trim();for(let t=0;t<e.length;t++){let i=e.charAt(t);if(!(i>="0"&&i<="9"||","===i||"."===i||"-"===i&&0===t||"("===i&&0===t||")"===i&&t===e.length-1))return!1}return!0}_castAsDate(e,t){if(e instanceof Date&&!isNaN(e))return e;if("string"==typeof e){let i=new Date(e);if(this._isDate(i))return-1===e.indexOf(":")&&i.setHours(0,0,0,0),i;try{if(t&&(i=Smart.Utilities.DateTime.parseDateString(e,void 0,t).toDate(),this._isDate(i)))return i;if(this._autoDateFormats)for(let t=0;t<this._autoDateFormats.length;t++)if(i=Smart.Utilities.DateTime.parseDateString(e,void 0,this._autoDateFormats[t]).toDate(),this._isDate(i))return i;let r=this._detectDateFormat(e);if(r&&(i=Smart.Utilities.DateTime.parseDateString(e,void 0,r).toDate(),this._isDate(i)))return this._autoDateFormats.push(r),i}catch(e){}}}_castAsNumber(e){if(e instanceof Date&&!isNaN(e))return e.valueOf();if("string"==typeof e)if(this._isNumber(e))e=parseFloat(e);else if(!/[a-zA-Z]/.test(e)){let t=new Date(e);null!=t&&(e=t.valueOf())}return isNaN(e)?void 0:e}_isNumber(e){return"string"==typeof e&&this._isNumberAsString(e)&&(e=parseFloat(e)),"number"==typeof e&&isFinite(e)}_isDate(e){return e instanceof Date&&!isNaN(e.getDate())}_isBoolean(e){return"boolean"==typeof e}_isObject(e){return e&&("object"==typeof e||"function"==typeof e)||!1}_formatDate(e,t){let i=e.toString();return t&&(t.dateFormat&&(i=new Smart.Utilities.DateTime(e).toString(t.dateFormat)),i=(t.prefix||"")+i+(t.sufix||"")),i}_formatNumber(e,t){if(!this._isNumber(e))return e;t=t||{};let i=this.localization.decimalSeparator,r=this.localization.thousandsSeparator;t.decimalSeparator&&(i=t.decimalSeparator),t.thousandsSeparator&&(r=t.thousandsSeparator);let s=t.prefix||"",a=t.sufix||"",l=t.decimalPlaces;isNaN(l)&&(l=this._getDecimalPlaces([e],void 0,3));let n=t.negativeWithBrackets||!1,o=e<0;o&&n&&(e*=-1);let h,d=e.toString(),u=Math.pow(10,l);if(d=(Math.round(e*u)/u).toString(),isNaN(d)&&(d=""),h=d.lastIndexOf("."),l>0)for(h<0?(d+=i,h=d.length-1):"."!==i&&(d=d.replace(".",i));d.length-1-h<l;)d+="0";h=d.lastIndexOf(i),h=h>-1?h:d.length;let g=d.substring(h),f=0;for(let e=h;e>0;e--,f++)f%3==0&&e!==h&&(!o||e>1||o&&n)&&(g=r+g),g=d.charAt(e-1)+g;return d=g,o&&n&&(d="("+d+")"),s+d+a}_calculateControlPoints(e,t){let i=e[t],r=e[t+1],s=e[t+2],a=e[t+3],l=e[t+4],n=e[t+5],o=Math.sqrt(Math.pow(s-i,2)+Math.pow(a-r,2)),h=o+Math.sqrt(Math.pow(l-s,2)+Math.pow(n-a,2));0===h&&(h=1);let d=.4*o/h,u=.4-d;return[s+d*(i-l),a+d*(r-n),s-u*(i-l),a-u*(r-n)]}_getBezierPoints(e){let t="",i=[],r=[],s=e.split(" ");for(let e=0;e<s.length;e++){let t=s[e].split(",");i.push(parseFloat(t[0])),i.push(parseFloat(t[1])),!isNaN(i[i.length-1])&&isNaN(i[i.length-2])}let a=i.length;if(a<=1)return"";if(2===a)return t="M"+this.renderer._ptrnd(i[0])+","+this.renderer._ptrnd(i[1])+" L"+this.renderer._ptrnd(i[0]+1)+","+this.renderer._ptrnd(i[1]+1)+" ",t;for(let e=0;e<a-4;e+=2)r=r.concat(this._calculateControlPoints(i,e));for(let e=2;e<a-5;e+=2)t+=" C"+this.renderer._ptrnd(r[2*e-2])+","+this.renderer._ptrnd(r[2*e-1])+" "+this.renderer._ptrnd(r[2*e])+","+this.renderer._ptrnd(r[2*e+1])+" "+this.renderer._ptrnd(i[e+2])+","+this.renderer._ptrnd(i[e+3])+" ";return t=a<=4||Math.abs(i[0]-i[2])<3||Math.abs(i[1]-i[3])<3?"M"+this.renderer._ptrnd(i[0])+","+this.renderer._ptrnd(i[1])+" L"+this.renderer._ptrnd(i[2])+","+this.renderer._ptrnd(i[3])+" "+t:"M"+this.renderer._ptrnd(i[0])+","+this.renderer._ptrnd(i[1])+" Q"+this.renderer._ptrnd(r[0])+","+this.renderer._ptrnd(r[1])+" "+this.renderer._ptrnd(i[2])+","+this.renderer._ptrnd(i[3])+" "+t,a>=4&&(Math.abs(i[a-2]-i[a-4])<3||Math.abs(i[a-1]-i[a-3])<3)?t+=" L"+this.renderer._ptrnd(i[a-2])+","+this.renderer._ptrnd(i[a-1])+" ":a>=5&&(t+=" Q"+this.renderer._ptrnd(r[2*a-10])+","+this.renderer._ptrnd(r[2*a-9])+" "+this.renderer._ptrnd(i[a-2])+","+this.renderer._ptrnd(i[a-1])+" "),t}_createAnimationGroup(e){this._animGroups||(this._animGroups={}),this._animGroups[e]={animations:[],startTick:NaN}}_startAnimation(e){let t=(new Date).getTime();this._animGroups[e].startTick=t,this._runAnimation(),this._enableAnimTimer()}_enqueueAnimation(e,t,i,r,s,a,l){r<0&&(r=0),void 0===l&&(l="easeInOutSine"),this._animGroups[e].animations.push({key:t,properties:i,duration:r,fn:s,context:a,easing:l})}_stopAnimations(){clearTimeout(this._animtimer),this._animtimer=void 0,this._animGroups=void 0}_enableAnimTimer(){if(!this._animtimer){let e=this;this._animtimer=setTimeout((function(){e._runAnimation()}),this._animTickInt)}}_runAnimation(){if(this._animGroups){let e=(new Date).getTime(),t={};for(let i in this._animGroups){let r=this._animGroups[i].animations,s=this._animGroups[i].startTick,a=0;for(let t=0;t<r.length;t++){let i=r[t],l=e-s;i.duration>a&&(a=i.duration);let n=i.duration>0?l/i.duration:1,o=n;if(i.easing&&0!==i.duration&&!1!==i.duration&&(o=Smart.Utilities.Animation.Easings[i.easing](l,0,1,i.duration)),n>1&&(n=1,o=1),i.fn){i.fn(i.key,i.context,o);continue}let h={};for(let e=0;e<i.properties.length;e++){let t=i.properties[e],r=0;r=1===n?t.to:o*(t.to-t.from)+t.from,h[t.key]=r}this.renderer.attr(i.key,h)}s+a>e&&(t[i]={startTick:s,animations:r})}this._animGroups=t,this.renderer instanceof Smart.Utilities.HTML5Renderer&&this.renderer.refresh()}this._animtimer=null,Object.values(this._animGroups).length>0&&this._enableAnimTimer()}_fixCoords(e,t){if("horizontal"!==this.seriesGroups[t].orientation)return e;var i=e.x;return e.x=e.y,e.y=i+this._plotRect.y-this._plotRect.x,i=e.width,e.width=e.height,e.height=i,e}getItemCoord(e,t,i){var r=this;if(r._isPieGroup(e)&&(!r._isSerieVisible(e,t,i)||!r._renderData||r._renderData.length<=e))return{x:NaN,y:NaN};if(!r._isSerieVisible(e,t)||!r._renderData||r._renderData.length<=e)return{x:NaN,y:NaN};var s=r.seriesGroups[e],a=s.series[t],l=r._getItemCoord(e,t,i);if(r._isPieGroup(e)){if(isNaN(l.x)||isNaN(l.y)||isNaN(l.fromAngle)||isNaN(l.toAngle))return{x:NaN,y:NaN};var n=this._plotRect,o=l.fromAngle*(Math.PI/180),h=l.toAngle*(Math.PI/180);const e=n.x+l.center.x+Math.cos(o)*l.outerRadius,t=n.x+l.center.x+Math.cos(h)*l.outerRadius,i=n.y+l.center.y-Math.sin(o)*l.outerRadius,r=n.y+l.center.y-Math.sin(h)*l.outerRadius;var d=Math.min(e,t),u=Math.abs(t-e);return l={x:d,y:Math.min(i,r),width:u,height:Math.abs(r-i),center:l.center,centerOffset:l.centerOffset,innerRadius:l.innerRadius,outerRadius:l.outerRadius,selectedRadiusChange:l.selectedRadiusChange,fromAngle:l.fromAngle,toAngle:l.toAngle}}if(-1!==s.type.indexOf("column")||-1!==s.type.indexOf("waterfall")){var g=this._getColumnSerieWidthAndOffset(e,t);l.height=Math.abs(l.y.to-l.y.from),l.y=Math.min(l.y.to,l.y.from),l.x+=g.offset,l.width=g.width}else if(-1!==s.type.indexOf("ohlc")||-1!==s.type.indexOf("candlestick")){let i=this._getColumnSerieWidthAndOffset(e,t),r=l.y;var f=Math.min(r.Open,r.Close,r.Low,r.High),p=Math.max(r.Open,r.Close,r.Low,r.High);l.height=Math.abs(p-f),l.y=f,l.x+=i.offset,l.width=i.width}else if(-1!==s.type.indexOf("line")||-1!==s.type.indexOf("area"))l.width=l.height=0,l.y=l.y.to;else if(-1!==s.type.indexOf("bubble")||-1!==s.type.indexOf("scatter")){l.center={x:l.x,y:l.y.to};var c=l.y.radius;"circle"!==a.symbolType&&void 0!==a.symbolType&&null!==a.symbolType&&(c/=2),l.y=l.y.to,l.radius=c,l.width=2*c,l.height=2*c}if(l=this._fixCoords(l,e),s.polar||s.spider){var m=this._toPolarCoord(this._renderData[e].polarCoords,this._plotRect,l.x,l.y);l.x=m.x,l.y=m.y,l.center&&(l.center=this._toPolarCoord(this._renderData[e].polarCoords,this._plotRect,l.center.x,l.center.y))}return-1===s.type.indexOf("bubble")&&-1===s.type.indexOf("scatter")||(l.x-=c,l.y-=c),l}_getItemCoord(e,t,i){let r,s,a=this.seriesGroups[e];if(!a||!this._renderData)return{x:NaN,y:NaN};if(!a.series[t])return{x:NaN,y:NaN};let l=this._plotRect;if(this._isPieGroup(e)){let a=this._renderData[e].offsets[t][i];if(!a)return{x:NaN,y:NaN};let n=(a.fromAngle+a.toAngle)/2*(Math.PI/180);return r=l.x+a.x+Math.cos(n)*a.outerRadius,s=l.y+a.y-Math.sin(n)*a.outerRadius,{x:r,y:s,center:{x:a.x,y:a.y},centerOffset:a.centerOffset,innerRadius:a.innerRadius,outerRadius:a.outerRadius,selectedRadiusChange:a.selectedRadiusChange,fromAngle:a.fromAngle,toAngle:a.toAngle}}if(r=l.x+this._renderData[e].xoffsets.data[i],s=this._renderData[e].offsets[t][i],isNaN(r)||!s)return{x:NaN,y:NaN};let n={};for(let e in s)n[e]=s[e];return{x:r,y:n}}getXAxisValue(e,t){var i=this.seriesGroups[t];if(i){var r=this._getXAxis(t),s=this._plotRect,a=0,l=NaN,n=this._renderData[0].xoffsets.axisStats,o=0,h=0;if(i.polar||i.spider){if(isNaN(e.x)||isNaN(e.y))return NaN;var d=this._getPolarAxisCoords(t,s);if(this.renderer._ptdist(e.x,e.y,d.x,d.y)>d.r)return NaN;var u=Math.atan2(d.y-e.y,e.x-d.x);(u=Math.PI/2-u)<0&&(u=2*Math.PI+u),l=u*d.r;var g=d.startAngle+Math.PI/2,f=d.endAngle+Math.PI/2;o=g*d.r,h=f*d.r,a=(f-g)*d.r;var p=this._getPaddingSize(n,r,r.valuesOnTicks,a,!0,d.isClosedCircle,this._hasColumnSeries());d.isClosedCircle?(a-=p.left+p.right,h-=p.left+p.right):r.valuesOnTicks||(o+=p.left,h-=p.right)}else{if("horizontal"!==i.orientation){if(e<s.x||e>s.x+s.width)return NaN;l=e-s.x,a=s.width}else{if(e<s.y||e>s.y+s.height)return NaN;l=e-s.y,a=s.height}if(this._renderData[t]&&this._renderData[t].xoffsets){let e=this._renderData[t].xoffsets.padding;a-=e.left+e.right,l-=e.left}h=a}return this._smartPlot.scale(l,{min:o,max:h},{min:n.min.valueOf(),max:n.max.valueOf(),type:n.logAxis.enabled?"logarithmic":"linear",base:n.logAxis.base,flip:r.flip})}}getValueAxisValue(e,t){let i=this.seriesGroups[t];if(!i)return;let r=this._getValueAxis(t),s=this._plotRect,a=0,l=NaN;if(i.polar||i.spider){if(isNaN(e.x)||isNaN(e.y))return NaN;let i=this._getPolarAxisCoords(t,s);l=this.renderer._ptdist(e.x,e.y,i.x,i.y),a=i.r,l=a-l}else if("horizontal"===i.orientation){if(e<s.x||e>s.x+s.width)return NaN;l=e-s.x,a=s.width}else{if(e<s.y||e>s.y+s.height)return NaN;l=e-s.y,a=s.height}let n=this._stats.seriesGroups[t];return this._smartPlot.scale(l,{min:0,max:a},{min:n.min.valueOf(),max:n.max.valueOf(),type:n.logarithmic?"logarithmic":"linear",base:n.logBase,flip:!r.flip})}_detectDateFormat(e,t){let i={en_US_d:"M/d/yyyy",en_US_D:"dddd, MMMM dd, yyyy",en_US_t:"h:mm tt",en_US_T:"h:mm:ss tt",en_US_f:"dddd, MMMM dd, yyyy h:mm tt",en_US_F:"dddd, MMMM dd, yyyy h:mm:ss tt",en_US_M:"MMMM dd",en_US_Y:"yyyy MMMM",en_US_S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",en_CA_d:"dd/MM/yyyy",en_CA_D:"MMMM-dd-yy",en_CA_f:"MMMM-dd-yy h:mm tt",en_CA_F:"MMMM-dd-yy h:mm:ss tt",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",de_DE_d:"dd.MM.yyyy",de_DE_D:"dddd, d. MMMM yyyy",de_DE_t:"HH:mm",de_DE_T:"HH:mm:ss",de_DE_f:"dddd, d. MMMM yyyy HH:mm",de_DE_F:"dddd, d. MMMM yyyy HH:mm:ss",de_DE_M:"dd MMMM",de_DE_Y:"MMMM yyyy",fr_FR_d:"dd/MM/yyyy",fr_FR_D:"dddd d MMMM yyyy",fr_FR_t:"HH:mm",fr_FR_T:"HH:mm:ss",fr_FR_f:"dddd d MMMM yyyy HH:mm",fr_FR_F:"dddd d MMMM yyyy HH:mm:ss",fr_FR_M:"d MMMM",fr_FR_Y:"MMMM yyyy",it_IT_d:"dd/MM/yyyy",it_IT_D:"dddd d MMMM yyyy",it_IT_t:"HH:mm",it_IT_T:"HH:mm:ss",it_IT_f:"dddd d MMMM yyyy HH:mm",it_IT_F:"dddd d MMMM yyyy HH:mm:ss",it_IT_M:"dd MMMM",it_IT_Y:"MMMM yyyy",ru_RU_d:"dd.MM.yyyy",ru_RU_D:"d MMMM yyyy '?.'",ru_RU_t:"H:mm",ru_RU_T:"H:mm:ss",ru_RU_f:"d MMMM yyyy '?.' H:mm",ru_RU_F:"d MMMM yyyy '?.' H:mm:ss",ru_RU_Y:"MMMM yyyy",cs_CZ_d:"d.M.yyyy",cs_CZ_D:"d. MMMM yyyy",cs_CZ_t:"H:mm",cs_CZ_T:"H:mm:ss",cs_CZ_f:"d. MMMM yyyy H:mm",cs_CZ_F:"d. MMMM yyyy H:mm:ss",cs_CZ_M:"dd MMMM",cs_CZ_Y:"MMMM yyyy",he_IL_d:"dd MMMM yyyy",he_IL_D:"dddd dd MMMM yyyy",he_IL_t:"HH:mm",he_IL_T:"HH:mm:ss",he_IL_f:"dddd dd MMMM yyyy HH:mm",he_IL_F:"dddd dd MMMM yyyy HH:mm:ss",he_IL_M:"dd MMMM",he_IL_Y:"MMMM yyyy",hr_HR_d:"d.M.yyyy.",hr_HR_D:"d. MMMM yyyy.",hr_HR_t:"H:mm",hr_HR_T:"H:mm:ss",hr_HR_f:"d. MMMM yyyy. H:mm",hr_HR_F:"d. MMMM yyyy. H:mm:ss",hr_HR_M:"d. MMMM",hu_HU_d:"yyyy.MM.dd.",hu_HU_D:"yyyy. MMMM d.",hu_HU_t:"H:mm",hu_HU_T:"H:mm:ss",hu_HU_f:"yyyy. MMMM d. H:mm",hu_HU_F:"yyyy. MMMM d. H:mm:ss",hu_HU_M:"MMMM d.",hu_HU_Y:"yyyy. MMMM",jp_JP_d:"gg y/M/d",jp_JP_D:"gg y'?'M'?'d'?'",jp_JP_t:"H:mm",jp_JP_T:"H:mm:ss",jp_JP_f:"gg y'?'M'?'d'?' H:mm",jp_JP_F:"gg y'?'M'?'d'?' H:mm:ss",jp_JP_M:"M'?'d'?'",jp_JP_Y:"gg y'?'M'?'",lt_LT_d:"yyyy.MM.dd",lt_LT_D:"yyyy 'm.' MMMM d 'd.'",lt_LT_t:"HH:mm",lt_LT_T:"HH:mm:ss",lt_LT_f:"yyyy 'm.' MMMM d 'd.' HH:mm",lt_LT_F:"yyyy 'm.' MMMM d 'd.' HH:mm:ss",lt_LT_M:"MMMM d 'd.'",lt_LT_Y:"yyyy 'm.' MMMM",sa_IN_d:"dd-MM-yyyy",sa_IN_D:"dd MMMM yyyy dddd",sa_IN_t:"HH:mm",sa_IN_T:"HH:mm:ss",sa_IN_f:"dd MMMM yyyy dddd HH:mm",sa_IN_F:"dd MMMM yyyy dddd HH:mm:ss",sa_IN_M:"dd MMMM",basic_y:"yyyy",basic_ym:"yyyy-MM",basic_d:"yyyy-MM-dd",basic_dhm:"yyyy-MM-dd hh:mm",basic_bhms:"yyyy-MM-dd hh:mm:ss",basic2_ym:"MM-yyyy",basic2_d:"MM-dd-yyyy",basic2_dhm:"MM-dd-yyyy hh:mm",basic2_dhms:"MM-dd-yyyy hh:mm:ss",basic3_ym:"yyyy/MM",basic3_d:"yyyy/MM/dd",basic3_dhm:"yyyy/MM/dd hh:mm",basic3_bhms:"yyyy/MM/dd hh:mm:ss",basic4_ym:"MM/yyyy",basic4_d:"MM/dd/yyyy",basic4_dhm:"MM/dd/yyyy hh:mm",basic4_dhms:"MM/dd/yyyy hh:mm:ss"};t&&(i=Object.assign({},i,t));let r=[];Array.isArray(e)?r=e:r.push(e);for(let e in i)i[e]={format:i[e],count:0};for(let e=0;e<r.length;e++){const t=r[e];if(null!=t)for(let e in i)try{(t instanceof Date||Smart.Utilities.DateTime.parseDateString(t,void 0,i[e].format))&&i[e].count++}catch(e){}}let s={key:void 0,count:0};for(let e in i)i[e].count>s.count&&(s.key=e,s.count=i[e].count);return s.key?i[s.key].format:""}_testXAxisDateFormat(e){let t=this,i=t._getXAxis(e),r=t._getDataLen(e),s={};if(t.localization.patterns)for(let e in t.localization.patterns)s["local_"+e]=t.localization.patterns[e];let a=[];for(let s=0;s<r&&s<10;s++){const r=t._getDataValue(s,i.dataField,e);null!=r&&a.push(r)}return t._detectDateFormat(a,s)}_getThemeColor(e){if("light"===this.theme)switch(e){case"background":return"#FFFFFF";case"line":return"#BCBCBC";case"band":return"#AAAAAA"}switch(e){case"background":return"#2E2E2E";case"line":return"#707070";case"band":return"#565656"}}});
|
|
35
|
+
Smart("smart-chart",class extends Smart.BaseElement{static get properties(){return{animationDuration:{value:300,type:"number"},backgroundColor:{value:null,type:"string?"},backgroundImage:{value:"",type:"string"},borderLineColor:{value:null,type:"string?"},borderLineWidth:{value:1,type:"number"},caption:{value:"Caption",type:"string"},clip:{value:!0,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},columnSeriesOverlap:{value:!1,type:"boolean"},crosshairsColor:{value:null,type:"string?"},crosshairsDashStyle:{value:"2,2",type:"string"},crosshairsLineWidth:{value:1,type:"number"},dataSource:{value:[],type:"object",reflectToAttribute:!1},description:{value:"Description",type:"string"},draw:{value:null,type:"function?"},drawBefore:{value:null,type:"function?"},enableAxisTextAnimation:{value:!1,type:"boolean"},enableCrosshairs:{value:!1,type:"boolean"},greyScale:{value:!1,type:"boolean"},legendLayout:{value:{flow:{value:"horizontal",allowedValues:["horizontal","vertical"],type:"string"},height:{value:null,type:"number?"},left:{value:null,type:"number?"},top:{value:null,type:"number?"},width:{value:null,type:"number?"}},type:"object?"},localization:{value:{decimalSeparator:{value:".",type:"string"},patterns:{value:null,type:"object?"},thousandsSeparator:{value:"",type:"string"}},type:"object"},messages:{value:{en:{invalidRadiusDataField:"smart-chart: Invalid radiusDataField value at [{{index}}]",invalidSeries:"smart-chart: Invalid property: each series group must have a 'series' property which must be a valid array.",invalidSeriesGroups:"smart-chart: Invalid property: 'seriesGroups' property is required and must be a valid array.",invalidType:'smart-chart: Invalid serie type "{{type}}".',missingAxis:"smart-chart: seriesGroup[{{index}}] is missing {{axis}} definition.",missingReference:"smart-chart: Missing reference to {{files}}.",missingType:"smart-chart: Invalid property: each series group must have a valid 'type' property."}},type:"object",extend:!0},padding:{value:{bottom:{value:5,type:"number"},left:{value:5,type:"number"},right:{value:5,type:"number"},top:{value:5,type:"number"}},type:"object"},renderEngine:{value:"",allowedValues:["","SVG","HTML5"],type:"string"},rightToLeft:{value:!1,type:"boolean"},seriesGroups:{value:[],type:"any",reflectToAttribute:!1},showBorderLine:{value:!0,type:"boolean"},showLegend:{value:!0,type:"boolean"},showToolTips:{value:!0,type:"boolean"},showToolTipsOnAllSeries:{value:!1,type:"boolean"},theme:{value:"light",allowedValues:["light","dark"],type:"string"},titlePadding:{value:{bottom:{value:10,type:"number"},left:{value:5,type:"number"},right:{value:5,type:"number"},top:{value:5,type:"number"}},type:"object"},toolTipBackground:{value:null,type:"string?"},toolTipFormatFunction:{value:null,type:"function?"},toolTipHideDelay:{value:4e3,type:"number"},toolTipLineColor:{value:null,type:"string?"},toolTipShowDelay:{value:300,type:"number"},valueAxis:{value:{alternatingBackgroundColor:{value:"",type:"string"},alternatingBackgroundColor2:{value:"",type:"string"},alternatingBackgroundOpacity:{value:1,type:"number"},axisSize:{value:null,type:"any"},bands:{value:null,type:"array?"},baselineValue:{value:0,type:"any"},customDraw:{value:!1,type:"boolean"},flip:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},gridLines:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},labels:{value:{angle:{value:0,type:"number"},autoRotate:{value:!1,type:"boolean"},class:{value:null,type:"string?"},custom:{value:null,type:"array?"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},offset:{value:{x:{value:0,type:"number"},y:{value:0,type:"number"}},type:"object"},rotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"any"}},type:"object"},line:{value:{color:{value:"",type:"string"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},visible:{value:!0,type:"any"}},type:"object"},logarithmicScale:{value:!1,type:"boolean"},logarithmicScaleBase:{value:10,type:"number"},maxValue:{value:NaN,type:"any"},minValue:{value:NaN,type:"any"},padding:{value:{bottom:{value:0,type:"number"},left:{value:0,type:"number"},right:{value:0,type:"number"},top:{value:0,type:"number"}},type:"object"},position:{value:"left",allowedValues:["left","right","top","bottom"],type:"string"},textRotationAngle:{value:null,type:"number?"},textRotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},tickMarks:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},size:{value:4,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},title:{value:{class:{value:null,type:"string?"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},text:{value:"",type:"string"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"boolean"}},type:"object"},unitInterval:{value:null,type:"number?"},valuesOnTicks:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"},xAxis:{value:{alternatingBackgroundColor:{value:"",type:"string"},alternatingBackgroundColor2:{value:"",type:"string"},alternatingBackgroundOpacity:{value:1,type:"number"},axisSize:{value:null,type:"any"},bands:{value:null,type:"array?"},baseUnit:{value:null,allowedValues:["year","month","day","hour","minute","second","millisecond",null],type:"string?"},customDraw:{value:!1,type:"boolean"},dataField:{value:"",type:"string"},dateFormat:{value:null,type:"string?"},displayText:{value:null,type:"string?"},flip:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},gridLines:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},labels:{value:{angle:{value:0,type:"number"},autoRotate:{value:!1,type:"boolean"},class:{value:null,type:"string?"},custom:{value:null,type:"array?"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},offset:{value:{x:{value:0,type:"number"},y:{value:0,type:"number"}},type:"object"},rotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"any"}},type:"object"},line:{value:{color:{value:"",type:"string"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},visible:{value:!0,type:"any"}},type:"object"},logarithmicScale:{value:!1,type:"boolean"},logarithmicScaleBase:{value:10,type:"number"},maxValue:{value:NaN,type:"any"},minValue:{value:NaN,type:"any"},padding:{value:{bottom:{value:0,type:"number"},left:{value:0,type:"number"},right:{value:0,type:"number"},top:{value:0,type:"number"}},type:"object"},position:{value:"bottom",allowedValues:["bottom","top","left","right"],type:"string"},rangeSelector:{value:{backgroundColor:{value:null,type:"string?"},backgroundImage:{value:"",type:"string"},baseUnit:{value:null,allowedValues:["year","month","day","hour","minute","second","millisecond",null],type:"string?"},borderLineColor:{value:null,type:"string?"},borderLineWidth:{value:null,type:"number?"},caption:{value:"",type:"string"},colorScheme:{value:null,type:"string?"},columnSeriesOverlap:{value:!1,type:"boolean"},columnsGapPercent:{value:25,type:"number"},dataField:{value:null,type:"string?"},description:{value:"",type:"string"},greyScale:{value:null,type:"boolean?"},gridLines:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},labels:{value:{angle:{value:0,type:"number"},autoRotate:{value:!1,type:"boolean"},class:{value:null,type:"string?"},custom:{value:null,type:"array?"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},offset:{value:{x:{value:0,type:"number"},y:{value:0,type:"number"}},type:"object"},rotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"any"}},type:"object"},maxValue:{value:NaN,type:"any"},minValue:{value:NaN,type:"any"},padding:{value:{bottom:{value:0,type:"number"},left:{value:0,type:"number"},right:{value:0,type:"number"},top:{value:0,type:"number"}},type:"object"},position:{value:null,allowedValues:["bottom","top","left","right"],type:"string?"},renderTo:{value:null,type:"any"},rightToLeft:{value:null,type:"boolean?"},seriesGapPercent:{value:10,type:"number"},seriesGroups:{value:null,type:"array?"},serieType:{value:"area",type:"string"},showBorderLine:{value:null,type:"boolean?"},size:{value:null,type:"number?"},skipOverlappingPoints:{value:!0,type:"boolean"},titlePadding:{value:{bottom:{value:10,type:"number"},left:{value:5,type:"number"},right:{value:5,type:"number"},top:{value:5,type:"number"}},type:"object"},unitInterval:{value:null,type:"number?"},valueAxis:{value:{alternatingBackgroundColor:{value:"",type:"string"},alternatingBackgroundColor2:{value:"",type:"string"},alternatingBackgroundOpacity:{value:1,type:"number"},axisSize:{value:null,type:"any"},bands:{value:null,type:"array?"},baselineValue:{value:0,type:"any"},customDraw:{value:!1,type:"boolean"},flip:{value:!1,type:"boolean"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},gridLines:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},labels:{value:{angle:{value:0,type:"number"},autoRotate:{value:!1,type:"boolean"},class:{value:null,type:"string?"},custom:{value:null,type:"array?"},formatFunction:{value:null,type:"function?"},formatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},offset:{value:{x:{value:0,type:"number"},y:{value:0,type:"number"}},type:"object"},rotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"any"}},type:"object"},line:{value:{color:{value:"",type:"string"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},visible:{value:!0,type:"any"}},type:"object"},logarithmicScale:{value:!1,type:"boolean"},logarithmicScaleBase:{value:10,type:"number"},maxValue:{value:NaN,type:"any"},minValue:{value:NaN,type:"any"},padding:{value:{bottom:{value:0,type:"number"},left:{value:0,type:"number"},right:{value:0,type:"number"},top:{value:0,type:"number"}},type:"object"},position:{value:"left",allowedValues:["left","right","top","bottom"],type:"string"},textRotationAngle:{value:null,type:"number?"},textRotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},tickMarks:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},size:{value:4,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},title:{value:{class:{value:null,type:"string?"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},text:{value:"",type:"string"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"boolean"}},type:"object"},unitInterval:{value:null,type:"number?"},valuesOnTicks:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object"},textRotationAngle:{value:null,type:"number?"},textRotationPoint:{value:"auto",allowedValues:["auto","left","center","right","topleft","topcenter","topright","bottomleft","bottomcenter","bottomright","centermiddle"],type:"string"},tickMarks:{value:{color:{value:"",type:"string"},custom:{value:null,type:"array?"},dashStyle:{value:"",type:"string"},lineWidth:{value:1,type:"number"},size:{value:4,type:"number"},step:{value:null,type:"number?"},unitInterval:{value:null,type:"number?"},visible:{value:!0,type:"any"}},type:"object"},title:{value:{class:{value:null,type:"string?"},horizontalAlignment:{value:"center",allowedValues:["left","center","right"],type:"string"},text:{value:"",type:"string"},verticalAlignment:{value:"center",allowedValues:["top","center","bottom"],type:"string"},visible:{value:!0,type:"boolean"}},type:"object"},toolTipFormatFunction:{value:null,type:"function?"},toolTipFormatSettings:{value:{dateFormat:{value:null,type:"string?"},decimalPlaces:{value:null,type:"number?"},decimalSeparator:{value:null,type:"string?"},negativeWithBrackets:{value:!1,type:"boolean"},prefix:{value:"",type:"string"},sufix:{value:"",type:"string"},thousandsSeparator:{value:null,type:"string?"}},type:"object"},type:{value:"auto",allowedValues:["auto","date","basic","linear"],type:"string"},unitInterval:{value:null,type:"number?"},valuesOnTicks:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object",reflectToAttribute:!1}}}get _legendLayout(){const e=this.legendLayout;return null!==e.height||null!==e.left||null!==e.top||null!==e.width||"vertical"===e.flow}_getFormatSettings(e,t){if(!e)return null;const i=e[t||"formatSettings"];return i&&(i.dateFormat||null!==i.decimalPlaces||i.decimalSeparator||i.negativeWithBrackets||i.prefix||i.sufix||i.thousandsSeparator)?i:null}static get listeners(){return{click:"_clickHandler",down:"_downMoveHandler",mouseleave:"_mouseleaveHandler",move:"_moveHandler",resize:"_resizeHandler","document.move":"_downMoveHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.Utilities.Draw":"smart.draw.js"}}static get styleUrls(){return["smart.chart.css"]}template(){return'<div role="presentation"></div>'}ready(){super.ready(),this.checkLicense()}render(){const e=this;e._observeSeriesGroups(),e._isTouchDevice=Smart.Utilities.Core.isMobile,e._setDefaults(),e._createColorsCache(),e.refresh(),e._setAriaProperties(),super.render()}attached(){const e=this;super.attached(),e.isCompleted&&!e._isRangeSelectorInstance&&Object.values(e._rangeSelectorInstances).forEach((e=>{e.parentDiv.parentDiv.appendChild(e.parentDiv)}))}detached(){const e=this;super.detached(),e._isRangeSelectorInstance||(e._ttEl&&e._ttEl.box&&e._ttEl.box.remove(),delete e._ttEl,Object.values(e._rangeSelectorInstances).forEach((e=>{e.parentDiv.remove()})))}_setAriaProperties(){const e=this;if(e._isRangeSelectorInstance)return;const t=e.xAxis,i=e.valueAxis,r=e.seriesGroups;let s=e.$.content.children[1],a="",l=!0;function n(e,t){e&&(e.title&&e.title.text||e.description||e.dataField)&&(a+='; "',e.title&&e.title.text?a+=e.title.text:a+=e.description||e.dataField,a+='" on the '+t,isNaN(e.minValue)||(a+=" from "+e.minValue),isNaN(e.maxValue)||(a+=" up to "+e.maxValue))}e.setAttribute("role","figure"),s||(s=document.createElement("div"),s.id=e.id+"DescriptionContainer",s.className="smart-hidden",e.$.content.appendChild(s)),e.setAttribute("aria-labelledby",e.id+"TitleText"),e.setAttribute("aria-describedby",e.id+"TitleDescription "+s.id),a+="This chart displays:",n(t,"x-axis"),n(i,"y-axis");for(let e=0;e<r.length;e++){const t=r[e];if(n(t.valueAxis,"y-axis"),t.series){l=l&&"horizontal"===t.orientation;for(let i=0;i<t.series.length;i++){const r=t.series[i];0===i&&(a+=0===e?" for ":"; "),a+='"'+(r.displayText||r.dataField)+'"',i!==t.series.length-1&&(a+=", ")}}}a=a.replace(":;",":"),a=a.replace(/<.+?>/g,""),l&&(a=a.replace(/x-axis/g,"@@@"),a=a.replace(/y-axis/g,"x-axis"),a=a.replace(/@@@/g,"y-axis")),e.description&&(a="; "+a),s.innerHTML=a}_observeSeriesGroups(){const e=this;function t(t){e.context!==e&&t.newValue!==t.oldValue&&e.update()}if(e._validateSeriesGroups(),Array.isArray(e.seriesGroups)){e.seriesGroups=new Smart.ObservableArray(e.seriesGroups),e.seriesGroups.canNotify=!0;for(let i=0;i<e.seriesGroups.length;i++)Array.isArray(e.seriesGroups[i].series)&&(e.seriesGroups[i].series=new Smart.ObservableArray(e.seriesGroups[i].series),e.seriesGroups[i].series.canNotify=!0,e.seriesGroups[i].series.notify(t));e.seriesGroups.notify(t)}}_downMoveHandler(e){const t=this;let i=e.originalEvent.target;t.shadowRoot&&i===t&&(i=e.originalEvent.composedPath()[0]);const r=i.closest(".smart-chart-range-selector");if(!r)return;const s=r.firstElementChild,a=s.parentChart;t!==s&&t!==a||a["_onSliderMouse"+e.type.slice(0,1).toUpperCase()+e.type.slice(1)](e)}_documentUpHandler(e){const t=this;t._draggingRangeSelector&&t._onSliderMouseUp(e)}_setDefaults(){const e=this;e.axisPadding=5,e.enableEvents=!0,e.enableSampling=!0,e._itemsToggleState=[],e._isToggleRefresh=!1,e._isSelectorRefresh=!1,e._sliders=[],e._selectorRange=[],e._rangeSelectorInstances={},e._resizeState={},e._isRangeSelectorInstance=e._isRangeSelectorInstance||!1,e._renderData={},e._smartPlot=null,e._animTickInt=50,e._seriesTypes=["line","stackedline","stackedline100","spline","stackedspline","stackedspline100","stepline","stackedstepline","stackedstepline100","area","stackedarea","stackedarea100","splinearea","stackedsplinearea","stackedsplinearea100","steparea","stackedsteparea","stackedsteparea100","rangearea","splinerangearea","steprangearea","column","stackedcolumn","stackedcolumn100","rangecolumn","scatter","stackedscatter","stackedscatter100","bubble","stackedbubble","stackedbubble100","pie","donut","candlestick","ohlc","waterfall","stackedwaterfall"],e.colorSchemes=[{name:"scheme01",colors:["#307DD7","#AA4643","#89A54E","#71588F","#4198AF"]},{name:"scheme02",colors:["#7FD13B","#EA157A","#FEB80A","#00ADDC","#738AC8"]},{name:"scheme03",colors:["#E8601A","#FF9639","#F5BD6A","#599994","#115D6E"]},{name:"scheme04",colors:["#D02841","#FF7C41","#FFC051","#5B5F4D","#364651"]},{name:"scheme05",colors:["#25A0DA","#309B46","#8EBC00","#FF7515","#FFAE00"]},{name:"scheme06",colors:["#0A3A4A","#196674","#33A6B2","#9AC836","#D0E64B"]},{name:"scheme07",colors:["#CC6B32","#FFAB48","#FFE7AD","#A7C9AE","#888A63"]},{name:"scheme08",colors:["#3F3943","#01A2A6","#29D9C2","#BDF271","#FFFFA6"]},{name:"scheme09",colors:["#1B2B32","#37646F","#A3ABAF","#E1E7E8","#B22E2F"]},{name:"scheme10",colors:["#5A4B53","#9C3C58","#DE2B5B","#D86A41","#D2A825"]},{name:"scheme11",colors:["#993144","#FFA257","#CCA56A","#ADA072","#949681"]},{name:"scheme12",colors:["#105B63","#EEEAC5","#FFD34E","#DB9E36","#BD4932"]},{name:"scheme13",colors:["#BBEBBC","#F0EE94","#F5C465","#FA7642","#FF1E54"]},{name:"scheme14",colors:["#60573E","#F2EEAC","#BFA575","#A63841","#BFB8A3"]},{name:"scheme15",colors:["#444546","#FFBB6E","#F28D00","#D94F00","#7F203B"]},{name:"scheme16",colors:["#583C39","#674E49","#948658","#F0E99A","#564E49"]},{name:"scheme17",colors:["#142D58","#447F6E","#E1B65B","#C8782A","#9E3E17"]},{name:"scheme18",colors:["#4D2B1F","#635D61","#7992A2","#97BFD5","#BFDCF5"]},{name:"scheme19",colors:["#844341","#D5CC92","#BBA146","#897B26","#55591C"]},{name:"scheme20",colors:["#56626B","#6C9380","#C0CA55","#F07C6C","#AD5472"]},{name:"scheme21",colors:["#96003A","#FF7347","#FFBC7B","#FF4154","#642223"]},{name:"scheme22",colors:["#5D7359","#E0D697","#D6AA5C","#8C5430","#661C0E"]},{name:"scheme23",colors:["#16193B","#35478C","#4E7AC7","#7FB2F0","#ADD5F7"]},{name:"scheme24",colors:["#7B1A25","#BF5322","#9DA860","#CEA457","#B67818"]},{name:"scheme25",colors:["#0081DA","#3AAFFF","#99C900","#FFEB3D","#309B46"]},{name:"scheme26",colors:["#0069A5","#0098EE","#7BD2F6","#FFB800","#FF6800"]},{name:"scheme27",colors:["#FF6800","#A0A700","#FF8D00","#678900","#0069A5"]},{name:"scheme28",colors:["#3A43BA","#281E5D","#48AAAD","#0492C2","#1E456E","#59788D","#52B2C0","#82EDFD"]},{name:"scheme29",colors:["#003F5C","#BC5090","#58508D","#FF6361","#FFA600"]},{name:"scheme30",colors:["#16736F","#A2D56A","#1C515C","#62B773","#EEEF63","#1F313F","#309577"]},{name:"scheme31",colors:["#74CC66","#191A4D","#2D867A","#EEE3CD","#224D19","#0D261B","#5771C7","#B6D7E7","#206052","#6B5724","#C3AF4B","#603620","#536722","#B6E7B9","#34819D","#94ACDB"]},{name:"scheme32",colors:["#87C5FF","#5B5B60","#9BE076","#F7A384","#7479D3","#F13A80","#E4D388","#2BC6B2","#F45B14"]}]}_clickHandler(e){const t=this;if(t.disabled||t._isRangeSelectorInstance)return;let i=e.pageX||e.clientX||e.screenX,r=e.pageY||e.clientY||e.screenY;const s=t.getBoundingClientRect();t._isTouchDevice&&(i=e.pageX,r=e.pageY),i-=s.left,r-=s.top,t._mouseX=i,t._mouseY=r,!isNaN(t._lastClickTs)&&(new Date).valueOf()-t._lastClickTs<100||(this._hostClickTimer=setTimeout((function(){if(t._isTouchDevice||(t._cancelTooltipTimer(),t._hideToolTip(),t._unselect()),t._pointMarker&&t._pointMarker.element){const i=t.seriesGroups[t._pointMarker.gidx],r=i.series[t._pointMarker.sidx];e.stopImmediatePropagation(),t._raiseItemEvent("click",i,r,t._pointMarker.iidx)}}),100),"HTML5"===t.renderEngine&&t._canvasClickHandler(i,r))}_canvasClickHandler(e,t){const i=this,r=i.renderer._elements;let s;for(let i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&"0"!==i){const a=r[i];if(t>a.y&&t<a.y+a.height&&e>a.x&&e<a.x+a.width){s=a;break}}if(s&&s.purpose&&"legend-toggle"===s.purpose){const e=s.data;i._toggleSerie(e.groupIndex,e.seriesIndex,e.itemIndex)}}_mouseleaveHandler(){const e=this;if(e.disabled||e._isRangeSelectorInstance)return;const t=e._mouseX,i=e._mouseY,r=e._plotRect;r&&t>=r.x&&t<=r.x+r.width&&i>=r.y&&i<=r.y+r.height||(e._cancelTooltipTimer(),e._hideToolTip(0),e._unselect())}_moveHandler(e){const t=this;if(t.disabled)return;if(t._isRangeSelectorInstance){const i=t.parentChart;null===i.xAxis.rangeSelector.renderTo&&(i._unselect(),i._hideToolTip()),"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}else t.style.cursor="default";let i=e.pageX||e.clientX||e.screenX,r=e.pageY||e.clientY||e.screenY;const s=t.getBoundingClientRect();t._isTouchDevice&&(i=e.pageX,r=e.pageY),i-=s.left,r-=s.top,t.onmousemove(i,r)}_resizeHandler(){const e=this,t=e.animation;e._isRangeSelectorInstance||(e.animation="none",e.refresh(),e.animation=t)}propertyChangedHandler(e,t,i){const r=this;switch(e){case"animation":case"theme":r._ttEl&&r._ttEl.box.setAttribute(e,i);break;case"rightToLeft":if(!r._ttEl||!r._ttEl.box)break;i?r._ttEl.box.setAttribute("right-to-left",i):r._ttEl.box.removeAttribute("right-to-left");break;case"seriesGroups":r._observeSeriesGroups();break;case"xAxis_rangeSelector_renderTo":if(null===i){const e=t.getElementsByClassName("smart-chart-range-selector")[0];e.parentElement.removeChild(e)}}this.refresh()}_initRenderer(){const e=this;e._draw=new Smart.Utilities.Draw(e.$.content,e.renderEngine),e.renderer=e._draw.renderer,e._smartPlot||(e._smartPlot=new Smart.Utilities.Plot(e.renderer)),e.$.content.firstElementChild.setAttribute("role","presentation")}_internalRefresh(){const e=this;if(!(e.offsetWidth||e.offsetHeight||e.getClientRects().length))return;e._stopAnimations(),e.renderer&&(e._isToggleRefresh||e._isUpdate)||(e._hideToolTip(0),e.$.content.innerHTML="",e._initRenderer());const t=e.renderer;if(!t)return;const i=t.getRect();e._render({x:1,y:1,width:i.width,height:i.height}),this.$.fireEvent("refreshBegin",{instance:this}),t instanceof Smart.Utilities.HTML5Renderer&&t.refresh(),e._isUpdate=!1,this.$.fireEvent("refreshEnd",{instance:this})}saveAsPNG(e){return this._saveAsImage("png",e)}saveAsJPEG(e){return this._saveAsImage("jpeg",e)}saveAsPDF(e,t){return this._saveAsImage("pdf",e,t)}print(){return this._saveAsImage("print")}_saveAsImage(e,t,i){const r=this;return r._draw._widgetToImage(r,e,t,r._hasRangeSelector?r._selectorSaveAsImageCallback:void 0,i)}_selectorSaveAsImageCallback(e,t){let i=e;for(let e=0;e<i.seriesGroups.length;e++){let r=i._getXAxis(e);if(!r||!r.rangeSelector||!r.rangeSelector.visible||r.rangeSelector.renderTo)continue;let s=i._rangeSelectorInstances[e];if(!s)continue;let a=s.renderer.getRect(),l=s.renderer.getContainer().getElementsByTagName("canvas")[0].getContext("2d"),n=i._sliders[e],o="horizontal"===i.seriesGroups[e].orientation,h=o?"height":"width",d=o?"width":"height",u=o?"y":"x",g=o?"x":"y",f={};f[u]=n.startOffset+n.rect[u],f[g]=n.rect[g],f[h]=n.endOffset-n.startOffset,f[d]=n.rect[d];let p=r.rangeSelector.colorSelectedRange||"blue",c=r.rangeSelector.colorRangeLine||"grey",m=[];m.push(s.renderer.rect(f.x,f.y,f.width,f.height,{fill:p,opacity:.1}));const y=i.renderer;o?(m.push(s.renderer.line(y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(n.rect.y),y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(f.y),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(f.y+f.height),y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(n.rect.y+n.rect.height),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(n.rect.x),y._ptrnd(f.y),y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(f.y),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(n.rect.x),y._ptrnd(f.y+f.height),y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(f.y+f.height),{stroke:c,opacity:.5}))):(m.push(s.renderer.line(y._ptrnd(n.rect.x),y._ptrnd(n.rect.y),y._ptrnd(f.x),y._ptrnd(n.rect.y),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(f.x+f.width),y._ptrnd(n.rect.y),y._ptrnd(n.rect.x+n.rect.width),y._ptrnd(n.rect.y),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(f.x),y._ptrnd(n.rect.y),y._ptrnd(f.x),y._ptrnd(n.rect.y+n.rect.height),{stroke:c,opacity:.5})),m.push(s.renderer.line(y._ptrnd(f.x+f.width),y._ptrnd(n.rect.y),y._ptrnd(f.x+f.width),y._ptrnd(n.rect.y+n.rect.height),{stroke:c,opacity:.5}))),s.renderer.refresh();let _=l.getImageData(a.x,a.y,a.width,a.height);const x=t.getContext("2d"),v=i.getBoundingClientRect(),b=s.getBoundingClientRect();x.putImageData(_,b.left-v.left,b.top-v.top,1,1,a.width,a.height);for(let e=0;e<m.length;e++)s.renderer.removeElement(m[e]);s.renderer.refresh()}return!0}refresh(){this._internalRefresh(),this._setAriaProperties()}update(){this._isUpdate=!0,this._internalRefresh()}clear(){const e=this;e.caption="",e.description="",e.refresh()}_validateSeriesGroups(){const e=this;Array.isArray(this.seriesGroups)||e.seriesGroups instanceof Smart.ObservableArray||e.error(e.localize("invalidSeriesGroups"));for(let t=0;t<this.seriesGroups.length;t++){const i=this.seriesGroups[t];i.type||e.error(e.localize("missingType")),Array.isArray(i.series)||i.series instanceof Smart.ObservableArray||e.error(e.localize("invalidSeries"))}}_render(e){var t=this,i=t.renderer;t._colorsCache.clear(),!t._isToggleRefresh&&t._isUpdate&&t._renderData&&t._renderDataClone(),t._renderData=[],i.clear(),t._unselect(),t._hideToolTip(0);var r=t.backgroundImage;t.style.backgroundImage=null==r||""===r?"":-1!==r.indexOf("(")?r:'url("'+r+'")',t._rect=e;var s=t.padding||{left:5,top:5,right:5,bottom:5},a=i.createClipRect(e),l=i.beginGroup();i.setClip(l,a);var n=i.rect(e.x,e.y,e.width-2,e.height-2);if(null==r||""===r?i.attr(n,{fill:t.backgroundColor||t._getThemeColor("background")}):i.attr(n,{fill:"transparent"}),!1!==t.showBorderLine){var o=this.borderLineWidth;(isNaN(o)||o<0||o>10)&&(o=1),i.attr(n,{"stroke-width":o,stroke:t.borderLineColor||t._getThemeColor("line")})}"function"==typeof t.drawBefore&&t.drawBefore(i,e);var h={x:s.left,y:s.top,width:e.width-s.left-s.right,height:e.height-s.top-s.bottom};t._paddedRect=h;var d,u=t.titlePadding||{left:2,top:2,right:2,bottom:2};t.caption&&t.caption.length>0&&(d=i.measureText(t.caption,0,{class:"smart-chart-title-text"}),i.text(t.caption,h.x+u.left,h.y+u.top,h.width-(u.left+u.right),d.height,0,{class:"smart-chart-title-text"},!0,"center","center").id=t.id+"TitleText",h.y+=d.height,h.height-=d.height),t.description&&t.description.length>0&&(d=i.measureText(t.description,0,{class:"smart-chart-title-description"}),i.text(t.description,h.x+u.left,h.y+u.top,h.width-(u.left+u.right),d.height,0,{class:"smart-chart-title-description"},!0,"center","center").id=t.id+"TitleDescription",h.y+=d.height,h.height-=d.height),(t.caption||t.description)&&(h.y+=u.bottom+u.top,h.height-=u.bottom+u.top);var g={x:h.x,y:h.y,width:h.width,height:h.height};t._plotRect=g,t._buildStats(g);var f,p=t._isPieOnlySeries(),c=t.seriesGroups,m={xAxis:{},valueAxis:{}};for(let e=0;e<c.length&&!p;e++){if("pie"===c[e].type||"donut"===c[e].type)continue;var y=t._getXAxis(e);y||t.error(t.localize("missingAxis",{index:e,axis:"xAxis"}));let i=y===t._getXAxis()?-1:e;m.xAxis[i]=0}var _=t.axisPadding;isNaN(_)&&(_=5);var x={left:0,right:0,leftCount:0,rightCount:0},v=[];for(let e=0;e<c.length;e++){const i=c[e];if("pie"===i.type||"donut"===i.type||!0===i.spider||!0===i.polar){v.push({width:0,position:0,xRel:0});continue}f="horizontal"===i.orientation;let r=t._getXAxis(e),s=r===t._getXAxis()?-1:e;var b=t._getValueAxis(e),N=b===t._getValueAxis()?-1:e,M=f?r.axisSize:b.axisSize,A={x:0,y:g.y,width:g.width,height:g.height},w=f?t._getXAxis(e).position:b.position;M&&"auto"!==M||(f?(M=this._renderXAxis(e,A,!0,g).width,1==(1&m.xAxis[s])?M=0:M>0&&(m.xAxis[s]|=1)):(M=t._renderValueAxis(e,A,!0,g).width,1==(1&m.valueAxis[N])?M=0:M>0&&(m.valueAxis[N]|=1))),"left"!==w&&!0===t.rightToLeft&&(w="right"),"right"!==w&&(w="left"),x[w+"Count"]>0&&x[w]>0&&M>0&&(x[w]+=_),v.push({width:M,position:w,xRel:x[w]}),x[w]+=M,x[w+"Count"]++}var S=Math.max(1,Math.max(e.width,e.height)),C={top:0,bottom:0,topCount:0,bottomCount:0},k=[];for(let e=0;e<c.length;e++){const i=c[e];if("pie"===i.type||"donut"===i.type||!0===i.spider||!0===i.polar){k.push({height:0,position:0,yRel:0});continue}f="horizontal"===i.orientation;let r=this._getValueAxis(e),s=r===t._getValueAxis()?-1:e,a=t._getXAxis(e),l=a===t._getXAxis()?-1:e,n=f?r.axisSize:a.axisSize,o=f?r.position:a.position;n&&"auto"!==n||(f?(n=t._renderValueAxis(e,{x:0,y:0,width:S,height:0},!0,g).height,2==(2&m.valueAxis[s])?n=0:n>0&&(m.valueAxis[s]|=2)):(n=t._renderXAxis(e,{x:0,y:0,width:S,height:0},!0).height,2==(2&m.xAxis[l])?n=0:n>0&&(m.xAxis[l]|=2))),"top"!==o&&(o="bottom"),C[o+"Count"]>0&&C[o]>0&&n>0&&(C[o]+=_),k.push({height:n,position:o,yRel:C[o]}),C[o]+=n,C[o+"Count"]++}t._createAnimationGroup("series");const D=!1!==t.showLegend,T=t._legendLayout;var F=D?t._renderLegend(T?t._rect:h,!0):{width:0,height:0};if(!T||isNaN(this.legendLayout.left)&&isNaN(this.legendLayout.top)||(F={width:0,height:0}),h.height<C.top+C.bottom+F.height||h.width<x.left+x.right)i.endGroup();else{g.height-=C.top+C.bottom+F.height,g.x+=x.left,g.width-=x.left+x.right,g.y+=C.top;var O=[];if(!p)for(let e=0;e<c.length;e++){const i=c[e];if(!0===i.polar||!0===i.spider||"pie"===i.type||"donut"===i.type)continue;f="horizontal"===i.orientation;let r=t._getXAxis(e)===t._getXAxis()?-1:e,s=t._getValueAxis(e)===t._getValueAxis()?-1:e,a={x:g.x,y:0,width:g.width,height:k[e].height};if("top"!==k[e].position?a.y=g.y+g.height+k[e].yRel:a.y=g.y-k[e].yRel-k[e].height,f){if(4==(4&m.valueAxis[s]))continue;if(!t._isGroupVisible(e))continue;t._renderValueAxis(e,a,!1,g),m.valueAxis[s]|=4}else{if(O.push(a),4==(4&m.xAxis[r]))continue;if(!t._isGroupVisible(e))continue;t._renderXAxis(e,a,!1,g),m.xAxis[r]|=4}}if(D){const e=t._legendLayout,i=e?t._rect:h;let r=h.x+this.renderer._ptrnd((h.width-F.width)/2),s=g.y+g.height+C.bottom,a=h.width,l=F.height;e&&(isNaN(t.legendLayout.left)||(r=t.legendLayout.left),isNaN(t.legendLayout.top)||(s=t.legendLayout.top),isNaN(t.legendLayout.width)||(a=t.legendLayout.width),isNaN(t.legendLayout.height)||(l=t.legendLayout.height)),r+a>i.x+i.width&&(a=i.x+i.width-r),s+l>i.y+i.height&&(l=i.y+i.height-s),t._renderLegend({x:r,y:s,width:a,height:l})}if(t._hasHorizontalLines=!1,!p)for(let e=0;e<c.length;e++){const i=c[e];if(!0===i.polar||!0===i.spider||"pie"===i.type||"donut"===i.type)continue;f="horizontal"===c[e].orientation;let r={x:g.x-v[e].xRel-v[e].width,y:g.y,width:v[e].width,height:g.height};"left"!==v[e].position&&(r.x=g.x+g.width+v[e].xRel);let s=t._getXAxis(e)===t._getXAxis()?-1:e,a=t._getValueAxis(e)===t._getValueAxis()?-1:e;if(f){if(O.push(r),8==(8&m.xAxis[s]))continue;if(!t._isGroupVisible(e))continue;t._renderXAxis(e,r,!1,g),m.xAxis[s]|=8}else{if(8==(8&m.valueAxis[a]))continue;if(!t._isGroupVisible(e))continue;t._renderValueAxis(e,r,!1,g),m.valueAxis[a]|=8}}if(!(g.width<=0||g.height<=0)){t._plotRect={x:g.x,y:g.y,width:g.width,height:g.height};for(let e=0;e<c.length;e++)this._drawPlotAreaLines(e,!0,{gridLines:!1,tickMarks:!1,alternatingBackground:!0}),this._drawPlotAreaLines(e,!1,{gridLines:!1,tickMarks:!1,alternatingBackground:!0});for(let e=0;e<c.length;e++)this._drawPlotAreaLines(e,!0,{gridLines:!0,tickMarks:!0,alternatingBackground:!1}),this._drawPlotAreaLines(e,!1,{gridLines:!0,tickMarks:!0,alternatingBackground:!1});var I=!1;for(let e=0;e<c.length&&!I;e++){const t=c[e];if(void 0!==t.annotations||"function"==typeof t.draw||"function"==typeof t.drawBefore){I=!0;break}}var P=i.beginGroup();if(t.clip&&!I){var R=i.createClipRect({x:g.x-2,y:g.y,width:g.width+4,height:g.height});i.setClip(P,R)}for(let r=0;r<c.length;r++){const s=c[r];var L=!1;for(var G in t._seriesTypes)if(t._seriesTypes[G]===s.type){L=!0;break}L||t.error(t.localize("invalidType",{type:s.type})),"function"==typeof s.drawBefore&&s.drawBefore(i,e,r,this),!0!==s.polar&&!0!==s.spider||-1===s.type.indexOf("pie")&&-1===s.type.indexOf("donut")&&t._renderSpiderAxis(r,g),t._renderAxisBands(r,g,!0),t._renderAxisBands(r,g,!1)}for(let r=0;r<c.length;r++){const s=c[r];if(t._isColumnType(s.type)?t._renderColumnSeries(r,g):-1!==s.type.indexOf("pie")||-1!==s.type.indexOf("donut")?t._renderPieSeries(r,g):-1!==s.type.indexOf("line")||-1!==s.type.indexOf("area")?t._renderLineSeries(r,g):-1!==s.type.indexOf("scatter")||-1!==s.type.indexOf("bubble")?t._renderScatterSeries(r,g):-1===s.type.indexOf("candlestick")&&-1===s.type.indexOf("ohlc")||t._renderCandleStickSeries(r,g,-1!==s.type.indexOf("ohlc")),s.annotations){this._moduleAnnotations||t.error(t.localize("missingReference",{files:"smart.chart.annotations.js"}));for(let e=0;e<s.annotations.length;e++)t._renderAnnotation(r,s.annotations[e],g)}"function"==typeof s.draw&&s.draw(i,e,r,this)}if(i.endGroup(),t.disabled){var V=i.rect(e.x,e.y,e.width,e.height);i.attr(V,{fill:"#777777",opacity:.5,stroke:"#00FFFFFF"})}"function"==typeof t.draw&&t.draw(i,e),i.endGroup(),t._startAnimation("series"),t._credits&&t._credits();var E=!1;for(let e=0;e<t.seriesGroups.length&&!E;e++){let i=t._getXAxis(e);i&&i.rangeSelector&&i.rangeSelector.visible&&(E=!0,t._hasRangeSelector=!0)}if(E){this._moduleRangeSelector||t.error(t.localize("missingReference",{files:"smart.chart.rangeselector.js"}));var B=[];t._isSelectorRefresh||(t._rangeSelectorInstances={});for(let e=0;e<t.seriesGroups.length;e++){var H=this._getXAxis(e);-1===B.indexOf(H)&&this._renderXAxisRangeSelector(e,O[e])&&B.push(H)}}}}}_credits(){}_isPieOnlySeries(){let e=this.seriesGroups;if(0===e.length)return!1;for(let t=0;t<e.length;t++)if("pie"!==e[t].type&&"donut"!==e[t].type)return!1;return!0}_renderChartLegend(e,t,i,r){var s=this,a=s.renderer,l={x:t.x,y:t.y,width:t.width,height:t.height};l.width>=6&&(l.x+=3,l.width-=6),l.height>=6&&(l.y+=3,l.height-=6);var n={width:l.width,height:0},o=0,h=0,d=20,u=0,g=10,f=0;for(let I=0;I<e.length;I++){var p=e[I].css;p||(p="smart-chart-legend-text"),d=20;var c=e[I].text,m=a.measureText(c,0,{class:p});m.height>d&&(d=m.height),m.width>f&&(f=m.width),r?(0!==I&&(h+=d),h>l.height&&(h=0,o+=f+20+g,f=m.width,n.width=o+f)):(0!==o&&(o+=10),o+20+m.width>l.width&&m.width<l.width&&(o=0,h+=d,d=20,u=l.width,n.height=h+d));var y=!1;if(m.width>l.width){y=!0;var _=l.width,x=c.split(/\s+/);let e=[],t="";for(let i=0;i<x.length;i++){var v=t+(t.length>0?" ":"")+x[i];s.renderer.measureText(v,0,{class:p}).width>_&&v.length>0&&t.length>0?(e.push({text:t}),t=x[i]):t=v,i+1===x.length&&e.push({text:t})}m.width=0;var b=0;for(let t=0;t<e.length;t++){var N=e[t].text;let i=s.renderer.measureText(N,0,{class:p});m.width=Math.max(m.width,i.width),b+=m.height}m.height=b}var M=o+m.width<l.width&&h+m.height<t.height;if(s._legendLayout){let e=l.x+o+m.width<s._rect.x+s._rect.width&&l.y+h+m.height<s._rect.y+s._rect.height;this._renderInBounds=e}if(!i&&M){var A=e[I].seriesIndex,w=e[I].groupIndex,S=e[I].itemIndex,C=e[I].fillColor,k=e[I].lineColor,D=s._isSerieVisible(w,A,S),T=a.beginGroup(),F=D?e[I].opacity:.1;if(y){let t=c,i=l.width,n=t.split(/\s+/);var O=0;let u=[],f="";for(let e=0;e<n.length;e++){let t=f+(f.length>0?" ":"")+n[e],r=s.renderer.measureText(t,0,{class:p});r.width>i&&t.length>0&&f.length>0?(u.push({text:f,dy:O}),O+=r.height,f=n[e]):f=t,e+1===n.length&&u.push({text:f,dy:O})}for(let e=0;e<u.length;e++){let t=u[e].text;O=u[e].dy,s.renderer.measureText(t,0,{class:p}),r?s.renderer.text(t,l.x+o+15,l.y+h+O,m.width,d,0,{class:p},!1,"left","center"):s.renderer.text(t,l.x+o+15,l.y+h+O,m.width,d,0,{class:p},!1,"center","center")}let y=a.rect(l.x+o,l.y+h+5+O/2,g,g);r&&(h+=O),s.renderer.attr(y,{fill:C,"fill-opacity":F,stroke:k,"stroke-width":1,"stroke-opacity":e[I].opacity})}else{let t,i=a.rect(l.x+o,l.y+h+5,g,g);s.renderer.attr(i,{fill:C,"fill-opacity":F,stroke:k,"stroke-width":1,"stroke-opacity":e[I].opacity,purpose:"legend-toggle",data:e[I]}),t=r?s.renderer.text(c,l.x+o+15,l.y+h,m.width,m.height+5,0,{class:p},!1,"left","center"):s.renderer.text(c,l.x+o+15,l.y+h,m.width,d,0,{class:p},!1,"center","center"),a.attr(t,{purpose:"legend-toggle",data:e[I]})}s.renderer.endGroup(),s._setLegendToggleHandler(w,A,S,T)}r||u<(o+=m.width+20)&&(u=o)}if(i)return n.height=this.renderer._ptrnd(h+d+5),n.width=this.renderer._ptrnd(u),n}isSerieVisible(e,t,i){return this._isSerieVisible(e,t,i)}_isSerieVisible(e,t,i){for(;this._itemsToggleState.length<e+1;)this._itemsToggleState.push([]);let r=this._itemsToggleState[e];for(;r.length<t+1;)r.push(!!isNaN(i)||[]);let s=r[t];if(isNaN(i))return s;for(Array.isArray(s)||(r[t]=s=[]);s.length<i+1;)s.push(!0);return s[i]}isGroupVisible(e){return this._isGroupVisible(e)}_isGroupVisible(e){let t=!1,i=this.seriesGroups[e].series;if(!i)return t;for(let r=0;r<i.length;r++)if(this._isSerieVisible(e,r)){t=!0;break}return t}_toggleSerie(e,t,i,r){let s=!this._isSerieVisible(e,t,i);void 0!==r&&(s=r);let a=this.seriesGroups[e],l=a.series[t];if(this.$.fireEvent("toggle",{state:s,seriesGroup:a,serie:l,elementIndex:i}),isNaN(i))this._itemsToggleState[e][t]=s;else{let r=this._itemsToggleState[e][t];for(Array.isArray(r)||(r=[]);r.length<i;)r.push(!0);r[i]=s}this._isToggleRefresh=!0,this.update(),this._isToggleRefresh=!1}showSerie(e,t,i){this._toggleSerie(e,t,i,!0)}hideSerie(e,t,i){this._toggleSerie(e,t,i,!1)}_setLegendToggleHandler(e,t,i,r){let s=this.seriesGroups[e],a=s.series[t].enableSeriesToggle;if(null==a&&(a=!1!==s.enableSeriesToggle),a){let s=this;this.renderer.addHandler(r,"click",(function(){s._toggleSerie(e,t,i)}))}}_renderLegend(e,t){let i=this,r=[];for(let e=0;e<i.seriesGroups.length;e++){let t=i.seriesGroups[e];if(!1!==t.showLegend)for(let s=0;s<t.series.length;s++){let a=t.series[s];if(!1===a.showLegend)continue;let l,n=i._getSerieSettings(e,s);if("pie"===t.type||"donut"===t.type){let o=i._getXAxis(e);const h=a.legendFormatSettings||t.legendFormatSettings||i._getFormatSettings(o)||i._getFormatSettings(a)||i._getFormatSettings(t);let d=a.legendFormatFunction||t.legendFormatFunction||o.formatFunction||a.formatFunction||t.formatFunction,u=i._getDataLen(e);for(let t=0;t<u;t++){l=i._getDataValue(t,a.displayText,e),l=i._formatValue(l,h,d,e,s,t);let o=i._getColors(e,s,t);r.push({groupIndex:e,seriesIndex:s,itemIndex:t,text:l,css:a.displayTextClass,fillColor:o.fillColor,lineColor:o.lineColor,opacity:n.opacity})}continue}const o=a.legendFormatSettings||t.legendFormatSettings;let h=a.legendFormatFunction||t.legendFormatFunction;l=i._formatValue(a.displayText||a.dataField||"",o,h,e,s,NaN);let d=i._getSeriesColors(e,s),u=this._get([a.legendFillColor,a.legendColor,d.fillColor]),g=this._get([a.legendLineColor,a.legendColor,d.lineColor]);r.push({groupIndex:e,seriesIndex:s,text:l,css:a.displayTextClass,fillColor:u,lineColor:g,opacity:n.opacity})}}return i._renderChartLegend(r,e,t,i._legendLayout&&"vertical"===i.legendLayout.flow)}_getInterval(e,t){if(!e)return t;let i=this._get([e.unitInterval,t]);return isNaN(e.step)||null===e.step||(i=e.step*t),i}_getOffsets(e,t,i,r,s,a,l,n,o){let h,d=this._getInterval(s[e],n),u=[];if((""===e||s[e].visible&&"custom"!==s[e].visible)&&(u=this._generateIntervalValues(r,d,n,l,o)),"labels"!==e){let e=l?a.left:0;if(!l&&n>1&&(e=a.left*(n+1)),1===u.length&&(e*=2),h=this._valuesToOffsets(u,t,r,i,a,!1,e),!l){let e=(a.left+a.right)*d/n;t.flip?h.unshift(h[0]+e):h.push(h[h.length-1]+e)}}else{let e=a.left;1===u.length&&(e*=2),h=this._valuesToOffsets(u,t,r,i,a,l,e)}let g=this._arraysToObjectsArray([u,h],["value","offset"]);if(t[e]&&t[e].custom){let s=this._objectsArraysToArray(t[e].custom,"value"),n=this._objectsArraysToArray(t[e].custom,"offset"),o=this._valuesToOffsets(s,t,r,i,a,l,a.left);for(let i=0;i<t[e].custom.length;i++)g.push({value:s[i],offset:isNaN(n[i])?o[i]:n[i]})}return g}_renderXAxis(e,t,i,r){let s=this,a=s._getXAxis(e),l=s.seriesGroups[e],n="horizontal"===l.orientation,o={width:0,height:0},h=s._getAxisSettings(a);if(!a||!h.visible||"spider"===l.type)return o;if(!s._isGroupVisible(e)||this._isPieGroup(e))return o;let d=s._alignValuesWithTicks(e);for(;s._renderData.length<e+1;)s._renderData.push({});s.rightToLeft?(a._flip=a.flip,a.flip=!0):void 0!==a._flip&&(a.flip=a._flip);let u=n?t.height:t.width,g=s._calculateXOffsets(e,u),f=g.axisStats,p=a.rangeSelector&&a.rangeSelector.visible,c=0;p&&(this._moduleRangeSelector||s.error(s.localize("missingReference",{files:"smart.chart.rangeselector.js"})),c=this._selectorGetSize(a));let m=n&&"right"===a.position||!n&&"top"===a.position;!i&&p&&(n?(t.width-=c,"right"!==a.position&&(t.x+=c)):(t.height-=c,"top"===a.position&&(t.y+=c)));let y={rangeLength:g.rangeLength,itemWidth:g.itemWidth,intervalWidth:g.intervalWidth,data:g,settings:h,isMirror:m,rect:t};s._renderData[e].xAxis=y;let _=f.interval;if(isNaN(_))return o;n&&(h.title.angle-=90,h.labels.angle-=90);let x,v,b=this._getInterval(h.gridLines,_),N=this._getInterval(h.tickMarks,_),M=this._getInterval(h.labels,_),A=f.min,w=f.max,S=g.padding,C=!0===a.flip||s.rightToLeft,k={min:A,max:w};f.logAxis.enabled&&(k.min=f.logAxis.minPow,k.max=f.logAxis.maxPow),"date"===a.type?(h.gridLines.offsets=this._generateDTOffsets(A,w,u,S,b,_,f.dateTimeUnit,d,NaN,!1,C),h.tickMarks.offsets=this._generateDTOffsets(A,w,u,S,N,_,f.dateTimeUnit,d,NaN,!1,C),x=this._generateDTOffsets(A,w,u,S,M,_,f.dateTimeUnit,d,NaN,!0,C)):(h.gridLines.offsets=this._getOffsets("gridLines",a,u,f,h,S,d,_),h.tickMarks.offsets=this._getOffsets("tickMarks",a,u,f,h,S,d,_),x=this._getOffsets("labels",a,u,f,h,S,d,_)),s._elementRenderInfo&&s._elementRenderInfo.length>e&&(v=s._elementRenderInfo[e].xAxis);let D,T=[];h.labels.formatFunction&&(D=h.labels.formatFunction);const F=s._getFormatSettings(h.labels);let O;F&&(O=Object.assign({},F)),"date"===a.type&&(a.dateFormat&&!D?O?O.dateFormat=O.dateFormat||a.dateFormat:O={dateFormat:a.dateFormat}:D||O&&(!O||O.dateFormat)||(D=this._getDefaultDTFormatFn(a.baseUnit||"day")));for(let t=0;t<x.length;t++){let i,r=x[t].value,l=x[t].offset;if(isNaN(l))continue;"date"!==a.type&&f.useIndeces&&a.dataField&&(i=Math.round(r),r=s._getDataValue(i,a.dataField,e),null==r&&(r=""));let n=s._formatValue(r,O,D,e,void 0,i);null!=n&&""!==n.toString()||(isNaN(i)&&(i=t),i>=f.filterRange.min&&i<=f.filterRange.max&&(n=f.useIndeces?(f.min+i).toString():void 0===r?"":r.toString()));let o={key:r,text:n,targetX:l,x:l};v&&v.itemOffsets[r]&&(o.x=v.itemOffsets[r].x,o.y=v.itemOffsets[r].y),T.push(o)}let I=s._getAnimProps(e),P=I.enabled&&T.length<500?I.duration:0;!1===s.enableAxisTextAnimation&&(P=0);let R={items:T,renderData:y},L=s._renderAxis(n,m,h,{x:t.x,y:t.y,width:t.width,height:t.height},r,_,!1,!0,R,i,P);return n?L.width+=c:L.height+=c,L}_animateAxisText(e,t){let i=e.items,r=e.textSettings;for(let e=0;e<i.length;e++){let s=i[e];if(!s)continue;if(!s.visible)continue;let a=s.targetX,l=s.targetY;isNaN(s.x)||isNaN(s.y)||(a=s.x+(a-s.x)*t,l=s.y+(l-s.y)*t),s.element&&(this.renderer.removeElement(s.element),s.element=void 0),s.element=this.renderer.text(s.text,a,l,s.width,s.height,r.angle,{class:r.style},!1,r.halign,r.valign,r.textRotationPoint)}}_getPolarAxisCoords(e,t){let i=this.seriesGroups[e],r=t.x+this._draw.getNum([i.offsetX,t.width/2]),s=t.y+this._draw.getNum([i.offsetY,t.height/2]),a=Math.min(t.width,t.height),l=i.radius;this._isPercent(l)&&(l=parseFloat(l)/100*a/2),isNaN(l)&&(l=a/2*.6);let n=this._alignValuesWithTicks(e),o=this._get([i.startAngle,i.minAngle,0])-90;o=isNaN(o)?0:2*Math.PI*o/360;let h=this._get([i.endAngle,i.maxAngle,360])-90;if(h=isNaN(h)?2*Math.PI:2*Math.PI*h/360,o>h){let e=o;o=h,h=e}let d=this.renderer._rnd(Math.abs(o-h)/(2*Math.PI),.001,!0),u=2*Math.PI*l*d,g=this._calcGroupOffsets(e,t).xoffsets;if(!g)return;let f,p=!(Math.abs(Math.abs(h-o)-2*Math.PI)>1e-5);if(i.spider){const t=this._getXAxisStats(e,this._getXAxis(e),u);let i=t.interval;(isNaN(i)||0===i)&&(i=1);let r=(t.max-t.min)/i+(p?1:0);if(r=Math.round(r),r>2){let e=Math.cos(Math.abs(h-o)/2/r);e=this.renderer._rnd(e,.01),0===e&&(e=1),f=l/e,f>l&&n&&(l=f)}}return l=this.renderer._ptrnd(l),{x:r,y:s,r:l,adjR:this._get([f,l]),itemWidth:g.itemWidth,rangeLength:g.rangeLength,valuesOnTicks:n,startAngle:o,endAngle:h,isClosedCircle:p,axisSize:u}}_toPolarCoord(e,t,i,r){let s=Math.abs(e.startAngle-e.endAngle)/(2*Math.PI),a=2*(i-t.x)*Math.PI*s/Math.max(1,t.width)+e.startAngle,l=(t.height+t.y-r)*e.r/Math.max(1,t.height),n=e.x+l*Math.cos(a),o=e.y+l*Math.sin(a);return{x:this.renderer._ptrnd(n),y:this.renderer._ptrnd(o)}}_renderSpiderAxis(e,t){let i=this,r=i._getXAxis(e),s=this._getAxisSettings(r);if(!r||!s.visible)return;let a=i.seriesGroups[e],l=i._getPolarAxisCoords(e,t);if(!l)return;let n=this.renderer._ptrnd(l.x),o=this.renderer._ptrnd(l.y),h=l.adjR,d=l.startAngle,u=l.endAngle;if(h<1)return;let g=this.renderer._rnd(Math.abs(d-u)/(2*Math.PI),.001,!0),f=2*Math.PI*h*g,p=l.isClosedCircle,c=this._renderData[e].xoffsets;if(!c.rangeLength)return;let m=c.axisStats.interval;for((isNaN(m)||m<1)&&(m=1);i._renderData.length<e+1;)i._renderData.push({});let y={rangeLength:c.rangeLength,itemWidth:c.itemWidth,data:c,rect:t,settings:s};i._renderData[e].xAxis=y,i._renderData[e].polarCoords=l;let _=!0;for(let t=0;t<e;t++){let e=i._renderData[t].polarCoords,s=i._getXAxis(t),a=!1;for(let t in l)if(l[t]!==e[t]){a=!0;break}a&&s===r||(_=!1)}let x,v,b=s.gridLines,N=s.tickMarks,M=s.labels,A=this._getInterval(b,m),w=this._getInterval(N,m),S=this._getInterval(M,m),C=i._alignValuesWithTicks(e),k=i.renderer,D=c.axisStats,T=D.min,F=D.max,O=this._getPaddingSize(c.axisStats,r,C,f,!0,p,!1),I=!0===r.flip||i.rightToLeft;"date"===r.type?(b.offsets=this._generateDTOffsets(T,F,f,O,A,m,r.baseUnit,!0,0,!1,I),N.offsets=this._generateDTOffsets(T,F,f,O,w,m,r.baseUnit,!0,0,!1,I),x=this._generateDTOffsets(T,F,f,O,S,m,r.baseUnit,!0,0,!0,I)):(s.gridLines.offsets=this._getOffsets("gridLines",r,f,D,s,O,!0,m),s.tickMarks.offsets=this._getOffsets("tickMarks",r,f,D,s,O,!0,m),x=this._getOffsets("labels",r,f,D,s,O,!0,m)),i._elementRenderInfo&&i._elementRenderInfo.length>e&&(v=i._elementRenderInfo[e].xAxis);let P=[],R=this._getDataLen(e);for(let t=0;t<x.length;t++){let s,a=x[t].offset,l=x[t].value;if("date"!==r.type&&D.useIndeces&&r.dataField){if(s=Math.round(l),s>=R)continue;l=i._getDataValue(s,r.dataField),null==l&&(l="")}let n=i._formatValue(l,i._getFormatSettings(M.formatSettings),M.formatFunction,e,void 0,s);null!=n&&""!==n.toString()||(n=D.useIndeces?(D.min+t).toString():null==l?"":l.toString());let o={key:l,text:n,targetX:a,x:a};v&&v.itemOffsets[l]&&(o.x=v.itemOffsets[l].x,o.y=v.itemOffsets[l].y),P.push(o)}let L={stroke:b.color||i._getThemeColor("line"),fill:"none","stroke-width":b.width,"stroke-dasharray":b.dashStyle||""};if(!a.spider)if(1===g)k.circle(n,o,h,L);else{let e=-d/Math.PI*180,t=-u/Math.PI*180;this.renderer.pieslice(n,o,0,h,Math.min(e,t),Math.max(e,t),void 0,L)}let G=d;if(b.visible&&_){C||p||b.offsets.unshift({offset:-O.right});for(let e=0;e<b.offsets.length;e++){let t=b.offsets[e].offset;C||(t+=p?O.right/2:O.right);const i=G+2*t*Math.PI*g/Math.max(1,f);if(i-u>.01)continue;let r=this.renderer._ptrnd(n+h*Math.cos(i)),s=this.renderer._ptrnd(o+h*Math.sin(i));k.line(n,o,r,s,L)}}if(N.visible&&_){let e=5,t={stroke:N.color||i._getThemeColor("line"),fill:"none","stroke-width":N.width,"stroke-dasharray":N.dashStyle||""};C||p||N.offsets.unshift({offset:-O.right});for(let i=0;i<N.offsets.length;i++){let r=N.offsets[i].offset;C||(r+=p?O.right/2:O.right);const s=G+2*r*Math.PI*g/Math.max(1,f);if(s-u>.01)continue;let a={x:n+h*Math.cos(s),y:o+h*Math.sin(s)},l={x:n+(h+e)*Math.cos(s),y:o+(h+e)*Math.sin(s)};k.line(this.renderer._ptrnd(a.x),this.renderer._ptrnd(a.y),this.renderer._ptrnd(l.x),this.renderer._ptrnd(l.y),t)}}let V=[];if(a.spider){let e=[];e="date"===r.type?this._generateDTOffsets(T,F,f,O,m,m,r.baseUnit,!0,0,!1,I):this._getOffsets("",r,f,D,s,O,!0,m),C||p||e.unshift({offset:-O.right});for(let t=0;t<e.length;t++){let i=e[t].offset;C||(i+=p?O.right/2:O.right);const r=G+2*i*Math.PI*g/Math.max(1,f);r-u>.01||V.push(r)}y.offsetAngles=V}let E=i._renderSpiderValueAxis(e,t,C?l.adjR:l.r,V);if(E||(E=[]),a.spider){if(!C)for(let e=0;e<E.length;e++)E[e]=E[e]*l.adjR/l.r;E.push(h),this._renderSpiderLines(n,o,E,l,V,L)}if(_&&M.visible){y.polarLabels=[];for(let e=0;e<P.length;e++){let t=G+2*P[e].x*Math.PI*g/Math.max(1,f);t=(360-t/(2*Math.PI)*360)%360,t<0&&(t=360+t);let i,r=k.measureText(P[e].text,0,{class:s.labels.style}),a=(C?l.adjR:l.r)+(N.visible?7:2),h=s.labels;if(h.autoRotate){let e=this._draw._ptRotate(n-r.width/2,o-a-r.height,n,o,-t/180*Math.PI),s=this._draw._ptRotate(n+r.width/2,o-a,n,o,-t/180*Math.PI);r.width=Math.abs(e.x-s.x),r.height=Math.abs(e.y-s.y),i={x:Math.min(e.x,s.x),y:Math.min(e.y,s.y)}}else i=this._adjustTextBoxPosition(n,o,r,a,t,!1,!1,!1);y.polarLabels.push({x:i.x,y:i.y,value:P[e].text}),k.text(P[e].text,i.x,i.y,r.width,r.height,h.autoRotate?90-t:h.angle,{class:h.style},!1,h.halign,h.valign)}}}_renderSpiderLines(e,t,i,r,s,a){let l=this.renderer,n=r.isClosedCircle;for(let r=0;r<i.length;r++){let o,h,d=i[r];for(let i=0;i<s.length;i++){let r=s[i],n=this.renderer._ptrnd(e+d*Math.cos(r)),u=this.renderer._ptrnd(t+d*Math.sin(r));o&&l.line(o.x,o.y,n,u,a),o={x:n,y:u},h||(h={x:n,y:u})}h&&n&&l.line(o.x,o.y,h.x,h.y,a)}}_renderSpiderValueAxis(e,t,i,r){var s=this,a=this.seriesGroups[e],l=this._getPolarAxisCoords(e,t);if(!l)return;var n=this.renderer._ptrnd(l.x),o=this.renderer._ptrnd(l.y);i=i||l.r;var h=l.startAngle,d=l.endAngle,u=this.renderer._rnd(Math.abs(h-d)/(2*Math.PI),.001,!0);if(i<1)return;i=this.renderer._ptrnd(i);var g=this._getValueAxis(e);const f=this._getAxisSettings(g);if(g&&!1!==f.visible){var p=this._stats.seriesGroups[e].mu,c=f.labels,m=s._getFormatSettings(c);-1!==a.type.indexOf("stacked")&&-1!==a.type.indexOf("100")&&!m&&(m={sufix:"%"});var y=this._get([c.step,c.unitInterval/p]);isNaN(y)&&(y=1),y=Math.max(1,Math.round(y)),this._calcValueAxisItems(e,i,y);var _=f.gridLines,x=f.tickMarks,v=f.labels,b={stroke:_.color||s._getThemeColor("line"),fill:"none","stroke-width":1,"stroke-dasharray":_.dashStyle||""},N=this._renderData[e].valueAxis,M=N.items,A=h;if(M.length&&f.line.visible){isNaN(f.line.angle)||(A=2*Math.PI*f.line.angle/360);var w=n+Math.cos(A)*i,S=o+Math.sin(A)*i;if(-1===r.indexOf(A)){var C=Object.assign({},b);C["stroke-width"]=f.line.lineWidth,C.stroke=f.line.color||s._getThemeColor("line"),C["stroke-dasharray"]=f.line.dashStyle,this.renderer.line(n,o,w,S,C)}}M=M.reverse();var k=this.renderer;N.polarLabels=[];for(let e=0;e<M.length-1;e++){var D=M[e];if(isNaN(D))continue;var T=v.formatFunction?v.formatFunction(D):this._formatNumber(D,m),F=k.measureText(T,0,{class:v.style}),O=n+(!1!==g.showTickMarks?3:2);let t=o-N.itemWidth*e-F.height/2;var I=this._draw._ptRotate(O,t,n,o,A),P=this._draw._ptRotate(O+F.width,t+F.height,n,o,A);O=Math.min(I.x,P.x),t=Math.min(I.y,P.y),F.width=Math.abs(I.x-P.x),F.height=Math.abs(I.y-P.y),O+=f.labels.textOffset.x,t+=f.labels.textOffset.y,N.polarLabels.push({x:O,y:t,value:T}),k.text(T,O,t,F.width,F.height,v.autoRotate?90+180*h/Math.PI:v.angle,{class:v.style},!1,v.halign,v.valign)}var R=!1!==g.valuesOnTicks,L=this._stats.seriesGroups[e],G=L.mu,V=!0===g.logarithmicScale;V&&(G=1);var E={min:L.min,max:L.max,logAxis:{enabled:!0===V,base:g.logarithmicScaleBase,minPow:L.minPow,maxPow:L.maxPow}};(_.visible||a.spider||g.alternatingBackgroundColor||g.alternatingBackgroundColor2)&&(_.offsets=this._getOffsets("gridLines",g,i,E,f,{left:0,right:0},R,G));var B=[];if(_.visible||a.spider){let e={stroke:_.color||s._getThemeColor("line"),fill:"none","stroke-width":1,"stroke-dasharray":_.dashStyle||""};for(let t=0;t<_.offsets.length;t++){let r=this.renderer._ptrnd(_.offsets[t].offset);if(r!==i)if(a.spider)B.push(r);else if(1!==u){var H=-h/Math.PI*180,z=-d/Math.PI*180;this.renderer.pieslice(n,o,0,r,Math.min(H,z),Math.max(H,z),void 0,e)}else k.circle(n,o,r,e)}}if(g.tickMarks&&(g.tickMarks.visible||g.showTickMarks)||(x.visible=!1),x.visible){x.offsets=this._getOffsets("tickMarks",g,i,E,f,{left:0,right:0},R,G);const e=2*x.size;let t={stroke:x.color||s._getThemeColor("line"),fill:"none","stroke-width":1,"stroke-dasharray":x.dashStyle||""};for(let i=0;i<x.offsets.length;i++){var W=x.offsets[i].offset;let r={x:n+W*Math.cos(A)-e/2*Math.sin(A+Math.PI/2),y:o+W*Math.sin(A)-e/2*Math.cos(A+Math.PI/2)},s={x:n+W*Math.cos(A)+e/2*Math.sin(A+Math.PI/2),y:o+W*Math.sin(A)+e/2*Math.cos(A+Math.PI/2)};k.line(this.renderer._ptrnd(r.x),this.renderer._ptrnd(r.y),this.renderer._ptrnd(s.x),this.renderer._ptrnd(s.y),t)}}return B}}_renderAxis(e,t,i,r,s,a,l,n,o,h,d){if(i.customDraw&&!h)return{width:NaN,height:NaN};let u=i.title,g=i.labels,f=i.tickMarks,p=i.padding,c=f.visible?f.size:0,m={width:0,height:0},y={width:0,height:0};e?m.height=y.height=r.height:m.width=y.width=r.width,!h&&t&&e&&(r.x-=r.width);let _=o.renderData,x=_.itemWidth;if(u.visible&&void 0!==u.text&&null!==u.text&&""!==u){let i=u.angle,s=this.renderer.measureText(u.text,i,{class:u.style});y.width=s.width,y.height=s.height,h||this.renderer.text(u.text,r.x+u.offset.x+(e?t?-p.right-2+2*r.width-y.width:2+p.left:0),r.y+u.offset.y+(e?0:t?p.top+2:r.height-2-y.height-p.bottom),e?y.width:r.width,e?r.height:y.height,i,{class:u.style},!0,u.halign,u.valign,u.rotationPoint)}let v=0,b=n?-x/2:0;n&&!e&&(g.halign="center");let N=r.x,M=r.y,A=g.textOffset;A&&(isNaN(A.x)||(N+=A.x),isNaN(A.y)||(M+=A.y)),e?(N+=p.left+2+(y.width>0?y.width+2:0)+(t?r.width-y.width:0),M+=b):(N+=b,t?(M+=y.height>0?y.height+6:4,M+=c-(n?c:c/4)):M+=n?c:c/4,M+=p.top);let w=0,S=0,C=o.items;_.itemOffsets={},!this._isToggleRefresh&&this._isUpdate||(d=0);let k=!1,D=0;for(let i=0;i<C.length&&g.visible;i++,v+=x){if(!C[i]||isNaN(x))continue;let s=C[i].text;isNaN(C[i].targetX)||(v=C[i].targetX);let a=this.renderer.measureText(s,g.angle,{class:g.style});if(a.width>S&&(S=a.width),a.height>w&&(w=a.height),D+=e?w:S,!h){if(e&&v>r.height+2||!e&&v>r.width+2)continue;const s=e?N+(t?0===y.width?c:c-2:0):N+v;let a=e?M+v:M;_.itemOffsets[C[i].key]={x:s,y:a},k||(!isNaN(C[i].x)||!isNaN(C[i].y)&&d)&&(k=!0),C[i].targetX=s,C[i].targetY=a,C[i].width=e?r.width-p.left-p.right-4-c-(y.width>0?y.width+2:0):x,C[i].height=e?x:r.height-p.top-p.bottom-4-c-(y.height>0?y.height+2:0),C[i].visible=!0}}if(_.avgWidth=0===C.length?0:D/C.length,!h){let e={items:C,textSettings:g};if(!isNaN(d)&&k||(d=0),this._animateAxisText(e,0===d?1:0),0!==d){let t=this;this._enqueueAnimation("series",void 0,void 0,d,(function(e,i,r){t._animateAxisText(i,r)}),e)}}if(m.width+=4+c+y.width+S+(e&&y.width>0?2:0),m.height+=4+c+y.height+w+(!e&&y.height>0?2:0),e?m.width+=p.left+p.right:m.height+=p.top+p.bottom,!h&&i.line.visible){let s={stroke:i.line.color||self._getThemeColor("line"),"stroke-width":i.line.width,"stroke-dasharray":i.line.dashStyle||""};if(e){let e=r.x+r.width+(t?p.left:-p.right);e=this.renderer._ptrnd(e),this.renderer.line(e,r.y,e,r.y+r.height,s)}else{let e=this.renderer._ptrnd(r.y+(t?r.height-p.bottom:p.top));this.renderer.line(this.renderer._ptrnd(r.x),e,this.renderer._ptrnd(r.x+r.width+1),e,s)}}return m.width=this.renderer._rup(m.width),m.height=this.renderer._rup(m.height),m}_drawPlotAreaLines(e,t,i){var r=this.seriesGroups[e],s="horizontal"!==r.orientation;if(!this._renderData||this._renderData.length<=e)return;var a=t?"valueAxis":"xAxis",l=this._renderData[e][a];if(!l)return;var n=this._renderData.axisDrawState;n||(n=this._renderData.axisDrawState={});var o,h="";t?(h="valueAxis_"+(r.valueAxis?e:"")+(s?"swap":""),o=this._getValueAxis(e)):(h="xAxis_"+(r.xAxis?e:"")+(s?"swap":""),o=this._getXAxis(e)),n=n[h]?n[h]:n[h]={},t||(s=!s);var d=l.settings;if(!d)return;if(d.customDraw)return;var u=d.gridLines,g=d.tickMarks,f=d.padding,p=l.rect,c=this._plotRect;if(!u||!g)return;var m=.5,y={};let _={stroke:u.color||self._getThemeColor("line"),"stroke-width":u.width,"stroke-dasharray":u.dashStyle||""};var x=t?p.y+p.height:p.x,v=u.offsets;let b;if(t&&!o.flip&&(v=(v=v.slice(0)).reverse()),v&&v.length>0){var N=NaN;for(let e=0;e<v.length;e++)if(s?(b=this.renderer._ptrnd(p.y+v[e].offset),b<p.y-m&&(b=this.renderer._ptrnd(p.y)),b>p.y+p.height&&(b=p.y+p.height)):(b=this.renderer._ptrnd(p.x+v[e].offset),b>p.x+p.width+m&&(b=this.renderer._ptrnd(p.x+p.width))),!isNaN(b)&&(isNaN(N)||!(Math.abs(b-N)<2))){if(N=b,i.gridLines&&!1!==u.visible&&!0!==n.gridLines&&(s?this.renderer.line(this.renderer._ptrnd(c.x),b,this.renderer._ptrnd(c.x+c.width),b,_):this.renderer.line(b,this.renderer._ptrnd(c.y),b,this.renderer._ptrnd(c.y+c.height),_)),y[b]=!0,i.alternatingBackground&&(u.alternatingBackgroundColor||u.alternatingBackgroundColor2)&&!0!==n.alternatingBackground){var M,A=e%2==0?u.alternatingBackgroundColor2:u.alternatingBackgroundColor;e>0&&A&&(M=s?this.renderer.rect(this.renderer._ptrnd(c.x),x,this.renderer._ptrnd(c.width-1),b-x,_):this.renderer.rect(x,this.renderer._ptrnd(c.y),b-x,this.renderer._ptrnd(c.height),_),this.renderer.attr(M,{"stroke-width":0,fill:A,opacity:u.alternatingBackgroundOpacity||1}))}x=b}}if(_={stroke:g.color||self._getThemeColor("line"),"stroke-width":g.width,"stroke-dasharray":g.dashStyle||""},i.tickMarks&&g.visible&&!0!==n.tickMarks){var w=g.size;let e=g.offsets,i=NaN;for(let r=0;r<e.length;r++)if(s?(b=this.renderer._ptrnd(p.y+e[r].offset),b<p.y-m&&(b=this.renderer._ptrnd(p.y)),b>p.y+p.height&&(b=p.y+p.height)):(b=this.renderer._ptrnd(p.x+e[r].offset),b>p.x+p.width+m&&(b=this.renderer._ptrnd(p.x+p.width))),!isNaN(b)&&(isNaN(i)||!(Math.abs(b-i)<2))){if(y[b-1]?b--:y[b+1]&&b++,s){if(b>p.y+p.height+m)break}else if(b>p.x+p.width+m)break;i=b;var S=l.isMirror?w:-w;if(s){var C=p.x+p.width+("right"===o.position?f.left:-f.right);t||(C=p.x+(l.isMirror?f.left:-f.right+p.width)),this.renderer.line(C,b,C+S,b,_)}else{var k=p.y+(l.isMirror?p.height:0);k+=l.isMirror?-f.bottom:f.top,k=this.renderer._ptrnd(k),this.renderer.line(b,k,b,k-S,_)}}}n.tickMarks=n.tickMarks||i.tickMarks,n.gridLines=n.gridLines||i.gridLines,n.alternatingBackground=n.alternatingBackground||i.alternatingBackground}_calcValueAxisItems(e,t,i){let r=this._stats.seriesGroups[e];if(!r||!r.isValid)return!1;let s=this.seriesGroups[e],a=this._getValueAxis(e),l=!1!==a.valuesOnTicks,n=r.intervals,o=t/n,h=r.min,d=r.mu,u=!0===a.logarithmicScale,g=a.logarithmicScaleBase||10,f=-1!==s.type.indexOf("stacked")&&-1!==s.type.indexOf("100");for(u&&(d=isNaN(a.unitInterval)?1:a.unitInterval),l||(n=Math.max(n-1,1));this._renderData.length<e+1;)this._renderData.push({});this._renderData[e].valueAxis={};let p=this._renderData[e].valueAxis;p.itemWidth=p.intervalWidth=o,p.items=[];let c=p.items;for(let e=0;e<=n;e++){let t=0;t=u?f?r.max/Math.pow(g,n-e):h*Math.pow(g,e):l?h+e*d:h+(e+.5)*d,e%i==0?c.push(t):c.push(NaN)}return p.rangeLength=u&&!f?r.intervals:r.intervals*d,!0!==a.flip&&(c=c.reverse()),!0}_getDecimalPlaces(e,t,i){let r=0;isNaN(i)&&(i=10);for(let s=0;s<e.length;s++){let a=void 0===t?e[s]:e[s][t];if(isNaN(a))continue;let l=a.toString();for(let e=0;e<l.length;e++)if((l[e]<"0"||l[e]>"9")&&(r=l.length-(e+1),r>=0))return Math.min(r,i);for(r>0&&(a*=Math.pow(10,r));Math.round(a)!==a&&r<i;)r++,a*=10}return r}_renderValueAxis(e,t,i,r){let s=this.seriesGroups[e],a="horizontal"===s.orientation,l=this._getValueAxis(e);l||this.error(this.localize("missingAxis",{index:e,axis:"valueAxis"}));let n={width:0,height:0};if(!this._isGroupVisible(e)||this._isPieOnlySeries()||"spider"===s.type)return n;let o=!1!==l.valuesOnTicks,h=this._stats.seriesGroups[e],d=h.mu,u=!0===l.logarithmicScale,g=l.logarithmicScaleBase||10;if(u&&(d=isNaN(l.unitInterval)?1:l.unitInterval),0===d&&(d=1),isNaN(d))return n;let f=this._getAxisSettings(l),p=f.title,c=f.labels,m=l.labels||{};this._get([l.horizontalTextAlignment,m.horizontalAlignment])||0!==c.angle||(c.halign=a?"center":"right"===l.position?"left":"right");let y=this._get([c.step,c.unitInterval/d]);if(isNaN(y)&&(y=1),y=Math.max(1,Math.round(y)),!this._calcValueAxisItems(e,a?t.width:t.height,y)||!f.visible)return n;a||(p.angle=this.rightToLeft?90:-90,"centercenter"===p.rotationPoint&&("top"===p.valign?p.rotationPoint="rightcenter":"bottom"===p.valign&&(p.rotationPoint="leftcenter")));let _=this._renderData[e].valueAxis,x=this._getFormatSettings(c);-1!==s.type.indexOf("stacked")&&-1!==s.type.indexOf("100")&&!x&&(x={sufix:"%"}),c.formatFunction||x&&null!==x.decimalPlaces&&void 0!==x.decimalPlaces||(x=x||{},x.decimalPlaces=this._getDecimalPlaces([h.min,h.max,d],void 0,3));let v=f.gridLines,b=a?t.width:t.height,N=!0===l.flip;l.flip=!N;let M={min:h.min,max:h.max,logAxis:{enabled:!0===u,base:g,minPow:h.minPow,maxPow:h.maxPow}};(v.visible||l.alternatingBackgroundColor||l.alternatingBackgroundColor2)&&(v.offsets=this._getOffsets("gridLines",l,b,M,f,{left:0,right:0},o,d));let A=f.tickMarks;A.visible&&(A.offsets=this._getOffsets("tickMarks",l,b,M,f,{left:0,right:0},o,d));const w=this._getOffsets("labels",l,b,M,f,{left:0,right:0},o,d,!o);l.flip=N;let S,C=[];this._elementRenderInfo&&this._elementRenderInfo.length>e&&(S=this._elementRenderInfo[e].valueAxis);for(let e=0;e<w.length;e++){let t=w[e].value;if(isNaN(w[e].offset)){C.push(void 0);continue}let i={key:t,text:c.formatFunction?c.formatFunction(t):isNaN(t)?t:this._formatNumber(t,x)};S&&S.itemOffsets[t]&&(i.x=S.itemOffsets[t].x,i.y=S.itemOffsets[t].y),i.targetX=w[e].offset,isNaN(i.targetX)||C.push(i)}let k=a&&"top"===l.position||!a&&"right"===l.position||!a&&this.rightToLeft&&"left"!==l.position,D={items:C,renderData:_},T=this._getAnimProps(e),F=T.enabled&&C.length<500?T.duration:0;return!1===this.enableAxisTextAnimation&&(F=0),_.settings=f,_.isMirror=k,_.rect=t,this._renderAxis(!a,k,f,t,r,d,u,!0,D,i,F)}_objectsArraysToArray(e,t){let i=[];if(!Array.isArray(e))return i;for(let r=0;r<e.length;r++)i.push(e[r][t]);return i}_arraysToObjectsArray(e,t){let i=[];if(e.length!==t.length)return i;for(let r=0;r<e.length;r++)for(let s=0;s<e[r].length;s++)i.length<=s&&i.push({}),i[s][t[r]]=e[r][s];return i}_valuesToOffsets(e,t,i,r,s,a,l){let n=[];if(!t||!Array.isArray(e))return n;let o=i.logAxis.base,h=i.logAxis.enabled?"logarithmic":"linear",d=t.flip,u=r,g=0,f=0;s&&!isNaN(s.left)&&(g=s.left),s&&!isNaN(s.right)&&(f=s.right),u=r-g-f,r=u;for(let t=0;t<e.length;t++){let s=this._smartPlot.scale(e[t],{min:i.min.valueOf(),max:i.max.valueOf(),type:h,base:o},{min:0,max:a?r:u,flip:d},{});isNaN(s)?n.push(NaN):(isNaN(l)||(s+=l),s<=r+g+f+1?n.push(this.renderer._ptrnd(s)):n.push(NaN))}return n}_generateIntervalValues(e,t,i,r,s){let a=[],l=e.min,n=e.max;if(e.logAxis&&e.logAxis.enabled&&(l=e.logAxis.minPow,n=e.logAxis.maxPow),null==l||null==n)return a;if(l===n)return e.logAxis&&e.logAxis.enabled?[Math.pow(e.logAxis.base,l)]:[l];let o=1;i<1&&(o=1e6,l*=o,n*=o,i*=o);for(let e=l;e<=n;e+=i)a.push(e/o+(s?i/2:0));if(t>i){let e=[],r=Math.round(t/i);for(let t=0;t<a.length;t++)t%r==0&&e.push(a[t]);a=e}if(e.logAxis&&e.logAxis.enabled)for(let t=0;t<a.length;t++)a[t]=Math.pow(e.logAxis.base,a[t]);return a}_generateDTOffsets(e,t,i,r,s,a,l,n,o,h,d){l||(l="day");var u=[];if(e>t)return u;if(e===t)return h?u.push({offset:n?i/2:r.left,value:e}):n&&u.push({offset:i/2,value:e}),u;var g=i-r.left-r.right,f=e,p=r.left,c=p,m=a=Math.max(a,1),y=Math.min(1,a);for(a>1&&"millisecond"!==l&&(a=1);this.renderer._ptrnd(c)<=this.renderer._ptrnd(r.left+g+(n?0:r.right));){u.push({offset:c,value:f});var _=new Date(f.valueOf());if("millisecond"===l)_.setMilliseconds(f.getMilliseconds()+a);else if("second"===l)_.setSeconds(f.getSeconds()+a);else if("minute"===l)_.setMinutes(f.getMinutes()+a);else if("hour"===l){var x=_.valueOf();_.setHours(f.getHours()+a),x===_.valueOf()&&_.setHours(f.getHours()+a+1)}else"day"===l?_.setDate(f.getDate()+a):"month"===l?_.setMonth(f.getMonth()+a):"year"===l&&_.setFullYear(f.getFullYear()+a);c=p+((f=_).valueOf()-e.valueOf())*y/(t.valueOf()-e.valueOf())*g}if(d)for(let e=0;e<u.length;e++)u[e].offset=i-u[e].offset;if(m>1&&"millisecond"!==l){var v=[];for(let e=0;e<u.length;e+=m)v.push({offset:u[e].offset,value:u[e].value});u=v}if(!n&&!h&&u.length>1){let e=[];e.push({offset:0,value:void 0});for(let t=1;t<u.length;t++)e.push({offset:u[t-1].offset+(u[t].offset-u[t-1].offset)/2,value:void 0});var b=e.length;b>1?e.push({offset:e[b-1].offset+(e[b-1].offset-e[b-2].offset)}):e.push({offset:i,value:void 0}),u=e}if(s>a){let e=[];var N=Math.round(s/m);for(let t=0;t<u.length;t++)t%N==0&&e.push({offset:u[t].offset,value:u[t].value});u=e}return u}_hasStackValueReversal(e,t){let i=this.seriesGroups[e];if(-1===i.type.indexOf("stacked"))return!1;let r=-1!==i.type.indexOf("waterfall"),s=this._getDataLen(e),a=0,l=!1,n=[];for(let t=0;t<i.series.length;t++)n[t]=this._isSerieVisible(e,t);for(let o=0;o<s;o++){let s;r||(l=!1);for(let r=0;r<i.series.length;r++){if(!n[r])continue;const h=this._getDataValueAsNumber(o,i.series[r].dataField,e);if(isNaN(h))continue;if(i.series[r].summary&&void 0!==this._getDataValue(o,i.series[r].summary,e))continue;let d=l?h<0:h<t;if(l=!0,void 0===s&&(s=d),d!==s)return!0;s=d,a+=h}}return this.waterfallStackSum=a,!1}_getValueAxis(e){let t=null==e?this.valueAxis:this.seriesGroups[e].valueAxis||this.valueAxis;return t||(t=this.valueAxis={}),t}_buildStats(e){var t={seriesGroups:[]};this._stats=t;for(let B=0;B<this.seriesGroups.length;B++){var i=this.seriesGroups[B];t.seriesGroups[B]={};var r=this._getXAxis(B),s=this._getValueAxis(B),a=this._getXAxisStats(B,r,"horizontal"!==i.orientation?e.width:e.height);let H=t.seriesGroups[B];H.isValid=!0;var l="horizontal"===i.orientation?e.width:e.height,n=!0===s.logarithmicScale,o=s.logarithmicScaleBase;isNaN(o)&&(o=10);var h=-1!==i.type.indexOf("stacked"),d=h&&-1!==i.type.indexOf("100"),u=-1!==i.type.indexOf("range"),g=-1!==i.type.indexOf("waterfall");g&&!this._moduleWaterfall&&self.error(self.localize("missingReference",{files:"smart.chart.waterfall.js"})),d&&(H.psums=[],H.nsums=[]);var f=NaN,p=NaN,c=NaN,m=NaN,y=s?s.baselineValue:NaN;isNaN(y)&&(y=n&&!d?1:0);var _=!1;0!==y&&h&&(_=this._hasStackValueReversal(B,y))&&(y=0),h&&g&&(_=this._hasStackValueReversal(B,y));var x=this._getDataLen(B),v=0,b=NaN,N=[];if(g)for(let e=0;e<i.series.length;e++)N.push(NaN);var M=NaN;for(let e=0;e<x&&H.isValid;e++){if(r.rangeSelector&&r.rangeSelector.visible){var A=r.dataField?this._getDataValue(e,r.dataField,B):e;if(A&&a.isDateTime&&(A=this._castAsDate(A,r.dateFormat)),a.useIndeces&&(A=e),A&&(A.valueOf()<a.min.valueOf()||A.valueOf()>a.max.valueOf()))continue}var w=s.minValue,S=s.maxValue;s.baselineValue&&(w=isNaN(w)?y:Math.min(y,w),S=isNaN(S)?y:Math.max(y,S));var C=0,k=0;for(let t=0;i.series&&t<i.series.length;t++)if(this._isSerieVisible(B,t)){var D=NaN,T=NaN,F=NaN;if(-1!==i.type.indexOf("candle")||-1!==i.type.indexOf("ohlc")){var O=["Open","Low","Close","High"];for(var I in O){var P=this._getDataValueAsNumber(e,i.series[t]["dataField"+O[I]],B);isNaN(P)||(F=isNaN(T)?P:Math.min(F,P),T=isNaN(T)?P:Math.max(T,P))}}else if(u){var R=this._getDataValueAsNumber(e,i.series[t].dataFieldFrom,B),L=this._getDataValueAsNumber(e,i.series[t].dataFieldTo,B);T=Math.max(R,L),F=Math.min(R,L)}else{if(D=this._getDataValueAsNumber(e,i.series[t].dataField,B),g){if(this._isSummary(B,e)&&void 0!==this._getDataValue(e,i.series[t].summary,B))continue;h?(isNaN(M)||(D+=M),M=D):(isNaN(N[t])?N[t]=D:D+=N[t],N[t]=D)}if(isNaN(D)||n&&D<=0)continue;F=T=D}(isNaN(S)||T>S)&&(isNaN(s.maxValue)||T<=s.maxValue)&&(S=T),(isNaN(w)||F<w)&&(isNaN(s.minValue)||F>=s.minValue)&&(w=F),isNaN(D)||!h||g||(D>y?C+=D:D<y&&(k+=D))}if(d||(isNaN(s.maxValue)||(C=Math.min(s.maxValue,C)),isNaN(s.minValue)||(k=Math.max(s.minValue,k))),n&&d)for(let t=0;t<i.series.length;t++){if(!this._isSerieVisible(B,t)){b=.01;continue}let r=this._getDataValueAsNumber(e,i.series[t].dataField,B);if(isNaN(r)||r<=0)b=.01;else{var G=0===C?0:r/C;(isNaN(b)||G<b)&&(b=G)}}var V=C-k;v<V&&(v=V),d&&(H.psums[e]=C,H.nsums[e]=k),(S>p||isNaN(p))&&(p=S),(w<f||isNaN(f))&&(f=w),(C>c||isNaN(c))&&(c=C),(k<m||isNaN(m))&&(m=k)}d&&(c=0===c?0:Math.max(c,-m),m=0===m?0:Math.min(m,-c)),f===p&&(!isNaN(s.minValue)&&isNaN(s.maxValue)?(f=s.minValue,p=n?f*o:f+1):isNaN(s.minValue)&&!isNaN(s.maxValue)&&(p=s.maxValue,f=n?p/o:p-1)),f===p&&(0===f?(f=-1,p=1):f<0?p=0:n?1===f&&(f/=o,p*=o):f=0);var E={gmin:f,gmax:p,gsumP:c,gsumN:m,gbase:y,isLogAxis:n,logBase:o,minPercent:b,gMaxRange:v,isStacked:h,isStacked100:d,isWaterfall:g,hasStackValueReversal:_,valueAxis:s,valueAxisSize:l};E.isStacked&&(E.gsumN<0&&(E.gmin=Math.min(E.gmin,E.gbase+E.gsumN)),E.gsumP>0&&(E.gmax=Math.max(E.gmax,E.gbase+E.gsumP))),H.context=E}this._mergeCommonValueAxisStats();for(let e=0;e<t.seriesGroups.length;e++){let i=t.seriesGroups[e];if(i.isValid){var B=this._calcOutputGroupStats(i.context);for(let e in B)i[e]=B[e];delete i.context}}}_mergeCommonValueAxisStats(){let e={};for(let t=0;t<this.seriesGroups.length;t++){if(!this._isGroupVisible(t))continue;if(this.seriesGroups[t].valueAxis)continue;let i=this._stats.seriesGroups[t].context;e.gbase=i.gbase,(isNaN(e.gmin)||i.gmin<e.gmin)&&(e.gmin=i.gmin),(isNaN(e.gmax)||i.gmax>e.gmax)&&(e.gmax=i.gmax),(isNaN(e.gsumP)||i.gsumP>e.gsumP)&&(e.gsumP=i.gsumP),(isNaN(e.gsumN)||i.gsumN<e.gsumN)&&(e.gsumN=i.gsumN),(isNaN(e.logBase)||i.logBase<e.logBase)&&(e.logBase=i.logBase),(isNaN(e.minPercent)||i.minPercent<e.minPercent)&&(e.minPercent=i.minPercent),e.gsumN>0&&(e.gmin=Math.min(e.gmin,e.gbase+e.gsumN)),e.gsumP>0&&(e.gmax=Math.max(e.gmax,e.gbase+e.gsumP))}for(let t=0;t<this.seriesGroups.length;t++){if(this.seriesGroups[t].valueAxis)continue;let i=this._stats.seriesGroups[t].context;for(let t in e)i[t]=e[t]}}_calcOutputGroupStats(e){let t=e.gmin,i=e.gmax,r=e.gsumP,s=e.gsumN,a=e.gbase,l=e.isLogAxis,n=e.logBase,o=e.minPercent,h=e.gMaxRange,d=e.isStacked,u=e.isStacked100,g=e.isWaterfall,f=e.hasStackValueReversal,p=e.valueAxis,c=e.valueAxisSize,m=e.valueAxis.unitInterval;m||(m=this._calcInterval(t,i,Math.max(c/80,2))),t===i&&(t=a,i*=2);let y=NaN,_=0,x=0;if(l){if(u){y=0;let e=1;for(_=x=this._draw.log(100,n);e>o;)e/=n,_--,y++;t=Math.pow(n,_)}else d&&!g&&(i=Math.max(i,r)),x=this.renderer._rnd(this._draw.log(i,n),1,!0),i=Math.pow(n,x),_=this.renderer._rnd(this._draw.log(t,n),1,!1),t=Math.pow(n,_);m=n}t<s&&(s=t),i>r&&(r=i);let v=t,b=i;if(l||0!=Math.abs(b-v)%m&&(v=this.renderer._rnd(t,m,!1),b=this.renderer._rnd(i,m,!0)),u&&b>100&&(b=100),u&&!l&&(b=b>0?100:0,v=v<0?-100:0,m=p.unitInterval,(isNaN(m)||m<=0||m>=100)&&(m=10),100%m!=0))for(;m>=1&&100%m!=0;m--);return isNaN(b)||isNaN(v)||isNaN(m)?{}:(isNaN(y)&&(y=parseInt(((b-v)/(0===m?1:m)).toFixed())),l&&!u&&(y=x-_,h=Math.pow(n,y)),y<1?{}:{min:v,max:b,logarithmic:l,logBase:n,base:l?v:a,minPow:_,maxPow:x,sumP:r,sumN:s,mu:m,maxRange:h,intervals:y,hasStackValueReversal:f})}_getDataLen(e){let t=this.dataSource;return null!=e&&-1!==e&&this.seriesGroups[e].dataSource&&(t=this.seriesGroups[e].dataSource),t?t.length:0}_getDataValue(e,t,i){let r=this.dataSource;if(null!=i&&-1!==i&&(r=this.seriesGroups[i].dataSource||r),!(!r||e<0||e>r.length-1))return"function"==typeof t?t(e,r):t&&""!==t?r[e][t]:r[e]}_getDataValueAsNumber(e,t,i){let r=this._getDataValue(e,t,i);return this._isDate(r)?r.valueOf():("number"!=typeof r&&(r=parseFloat(r)),"number"!=typeof r&&(r=void 0),r)}_isPieGroup(e){let t=this.seriesGroups[e];return!(!t||!t.type||-1===t.type.indexOf("pie")&&-1===t.type.indexOf("donut"))}_renderPieSeries(e,t){let i=this._getDataLen(e),r=this.seriesGroups[e],s=this._calcGroupOffsets(e,t).offsets;for(let a=0;a<r.series.length;a++){let l=r.series[a];if(l.customDraw)continue;let n=this._getSerieSettings(e,a),o=this._getAnimProps(e,a),h=o.enabled&&i<5e3&&!this._isToggleRefresh&&o.duration;this._isTouchDevice&&this.renderer instanceof Smart.Utilities.HTML5Renderer&&(h=0);let d=this._get([l.minAngle,l.startAngle]);(isNaN(d)||d<0||d>360)&&(d=0);let u=this._get([l.maxAngle,l.endAngle]);(isNaN(u)||u<0||u>360)&&(u=360);let g={rect:t,minAngle:d,maxAngle:u,groupIndex:e,serieIndex:a,settings:n,items:[]};for(let t=0;t<i;t++){let i=s[a][t];if(!i.visible)continue;let r=i.fromAngle,l=i.toAngle,n=this.renderer.pieslice(i.x,i.y,i.innerRadius,i.outerRadius,r,0===h?l:r,i.centerOffset);this._setRenderInfo(e,a,t,{element:n});let o={displayValue:i.displayValue,itemIndex:t,visible:i.visible,x:i.x,y:i.y,innerRadius:i.innerRadius,outerRadius:i.outerRadius,fromAngle:r,toAngle:l,centerOffset:i.centerOffset};g.items.push(o)}this._animatePieSlices(g,0);let f=this;this._enqueueAnimation("series",void 0,void 0,h,(function(e,t,i){f._animatePieSlices(t,i)}),g)}}_sliceSortFunction(e,t){return e.fromAngle-t.fromAngle}_animatePieSlices(e,t){var i;this._elementRenderInfo&&this._elementRenderInfo.length>e.groupIndex&&this._elementRenderInfo[e.groupIndex].series&&this._elementRenderInfo[e.groupIndex].series.length>e.serieIndex&&(i=this._elementRenderInfo[e.groupIndex].series[e.serieIndex]);var r=this._getLabelsSettings(e.groupIndex,e.serieIndex,NaN),s=r.visible,a=[];for(let r=0;r<e.items.length;r++){const s=e.items[r];if(!s.visible)continue;let h=s.fromAngle;var l=s.fromAngle+t*(s.toAngle-s.fromAngle);if(i&&i[s.displayValue]){var n=i[s.displayValue].fromAngle,o=i[s.displayValue].toAngle;h=n+(h-n)*t,l=o+(l-o)*t}a.push({index:r,from:h,to:l})}i&&a.sort(this._sliceSortFunction);var h=NaN;for(let l=0;l<a.length;l++){const n=e.items[a[l].index];var d=this._getRenderInfo(e.groupIndex,e.serieIndex,n.itemIndex);let o=a[l].from,p=a[l].to;i&&(!isNaN(h)&&o>h&&(o=h),h=p,l===a.length-1&&p!==a[0].from&&(p=e.maxAngle+a[0].from));var u=this.renderer.pieSlicePath(n.x,n.y,n.innerRadius,n.outerRadius,o,p,n.centerOffset);this.renderer.attr(d.element,{d:u});var g=this._getColors(e.groupIndex,e.serieIndex,n.itemIndex,"radialGradient",n.outerRadius),f=e.settings;d.colors=g,d.settings=f,this.renderer.attr(d.element,{fill:g.fillColor,stroke:g.lineColor,"stroke-width":f.stroke,"fill-opacity":f.opacity,"stroke-opacity":f.opacity,"stroke-dasharray":"none"}),s&&this._showPieLabel(e.groupIndex,e.serieIndex,n.itemIndex,r,void 0,d.colors.lineColor),1===t&&this._installHandlers(d.element,"pieslice",e.groupIndex,e.serieIndex,n.itemIndex)}}_showPieLabel(e,t,i,r,s){let a=this._renderData[e].offsets[t][i];if(a.elementInfo.labelElement&&this.renderer.removeElement(a.elementInfo.labelElement),r||(r=this._getLabelsSettings(e,t,NaN)),!r.visible)return;let l=a.fromAngle,n=a.toAngle,o=Math.abs(l-n);o>360&&(l=0,n=360);let h=o/2+l;h%=360;let d,u=h*Math.PI*2/360;!0===r.autoRotate&&(d=h<90||h>270?360-h:180-h);let g=r.linesEnabled,f=this._showLabel(e,t,i,{x:0,y:0,width:0,height:0},"center","center",!0,!1,!1,d),p=r.radius||a.outerRadius+Math.max(f.width,f.height);this._isPercent(p)&&(p=parseFloat(p)/100*Math.min(this._plotRect.width,this._plotRect.height)/2),p+=a.centerOffset,isNaN(s)&&(s=0),p+=s;let c=this.seriesGroups[e],m=c.series[t],y=this._draw.getNum([m.offsetX,c.offsetX,this._plotRect.width/2]),_=this._draw.getNum([m.offsetY,c.offsetY,this._plotRect.height/2]),x=this._plotRect.x+y,v=this._plotRect.y+_,b=this._adjustTextBoxPosition(x,v,f,p,h,a.outerRadius>p,!1!==r.linesAngles,!0===r.autoRotate);const N={},M=b.x<x?0:f.width/2,A=Math.sqrt(Math.pow(b.x-x,2)+Math.pow(b.y-v,2))+M<a.outerRadius?arguments[5]:void 0;if(a.elementInfo.labelElement=this._showLabel(e,t,i,{x:b.x,y:b.y,width:f.width,height:f.height},"left","top",!1,!1,!1,d,N,A),p>a.outerRadius+s+5&&!1!==g){let e={lineColor:a.elementInfo.colors.lineColor,stroke:a.elementInfo.settings.stroke,opacity:a.elementInfo.settings.opacity,dashStyle:a.elementInfo.settings.dashStyle};a.elementInfo.labelArrowPath=this._updateLebelArrowPath(a.elementInfo.labelArrowPath,x,v,p,a.outerRadius+s,u,!1!==r.linesAngles,e,N)}}_updateLebelArrowPath(e,t,i,r,s,a,l,n,o){const h=this.renderer;let d=h._ptrnd(t+(r-0)*Math.cos(a)),u=h._ptrnd(i-(r-0)*Math.sin(a)),g=h._ptrnd(t+(s+2)*Math.cos(a)),f=h._ptrnd(i-(s+2)*Math.sin(a)),p=[];p.push({x:o.x+o.width/2,y:o.y}),p.push({x:o.x+o.width/2,y:o.y+o.height}),p.push({x:o.x,y:o.y+o.height/2}),p.push({x:o.x+o.width,y:o.y+o.height/2}),l||(p.push({x:o.x,y:o.y}),p.push({x:o.x+o.width,y:o.y}),p.push({x:o.x+o.width,y:o.y+o.height}),p.push({x:o.x,y:o.y+o.height})),p=p.sort((function(e,r){return h._ptdist(e.x,e.y,t,i)-h._ptdist(r.x,r.y,t,i)})),p=p.sort((function(e,r){return Math.abs(e.x-t)+Math.abs(e.y-i)-(Math.abs(r.x-t)+Math.abs(r.y-i))}));for(let e=0;e<p.length;e++)p[e].x=h._ptrnd(p[e].x),p[e].y=h._ptrnd(p[e].y);d=p[0].x,u=p[0].y;let c="M "+d+","+u+" L"+g+","+f;return l&&(c="M "+d+","+u+" L"+g+","+u+" L"+g+","+f),e?h.attr(e,{d:c}):e=h.path(c,{}),h.attr(e,{fill:"none",stroke:n.lineColor,"stroke-width":n.stroke,"stroke-opacity":n.opacity,"stroke-dasharray":"none"}),e}_adjustTextBoxPosition(e,t,i,r,s,a,l,n){let o=s*Math.PI*2/360,h=this.renderer._ptrnd(e+r*Math.cos(o)),d=this.renderer._ptrnd(t-r*Math.sin(o));if(n){let s=i.width,a=i.height,l=Math.atan(a/s)%(2*Math.PI),n=o%(2*Math.PI),h=0;n<=l?h=s/2*Math.cos(o):n>=l&&n<Math.PI-l?h=a/2*Math.sin(o):n>=Math.PI-l&&n<Math.PI+l?h=s/2*Math.cos(o):n>=Math.PI+l&&n<2*Math.PI-l?h=a/2*Math.sin(o):n>=2*Math.PI-l&&n<2*Math.PI&&(h=s/2*Math.cos(o)),r+=Math.abs(h)+3;let d=this.renderer._ptrnd(e+r*Math.cos(o)),u=this.renderer._ptrnd(t-r*Math.sin(o));return d-=i.width/2,u-=i.height/2,{x:d,y:u}}return a?(h-=i.width/2,d-=i.height/2):l?s>=90&&s<270?(d-=i.height/2,h-=i.width):d-=i.height/2:s>=0&&s<45||s>=315&&s<360?d-=i.height/2:s>=45&&s<135?(d-=i.height,h-=i.width/2):s>=135&&s<225?(d-=i.height/2,h-=i.width):s>=225&&s<315&&(h-=i.width/2),{x:h,y:d}}_isColumnType(e){return-1!==e.indexOf("column")||-1!==e.indexOf("waterfall")}_getColumnGroupsCount(e){let t=0;e=e||"vertical";let i=this.seriesGroups;for(let r=0;r<i.length;r++){let s=i[r].orientation||"vertical";this._isColumnType(i[r].type)&&s===e&&t++}return this.columnSeriesOverlap&&(t=1),t}_getColumnGroupIndex(e){let t=0,i=this.seriesGroups[e].orientation||"vertical";for(let r=0;r<e;r++){let e=this.seriesGroups[r],s=e.orientation||"vertical";this._isColumnType(e.type)&&s===i&&t++}return t}_renderAxisBands(e,t,i){var r=i?this._getXAxis(e):this._getValueAxis(e),s=this.seriesGroups[e],a=i?void 0:s.bands;if(!a){for(let t=0;t<e;t++)if((i?this._getXAxis(t):this._getValueAxis(t))===r)return;a=r.bands}if(Array.isArray(a)){var l=t,n="horizontal"===s.orientation;n&&(l={x:t.y,y:t.x,width:t.height,height:t.width}),this._calcGroupOffsets(e,l);for(let r=0;r<a.length;r++){var o=a[r],h=o.minValue,d=o.maxValue,u=i?this.getXAxisDataPointOffset(h,e):this.getValueAxisDataPointOffset(h,e),g=i?this.getXAxisDataPointOffset(d,e):this.getValueAxisDataPointOffset(d,e);if(!isNaN(u)&&!isNaN(g)){var f,p=Math.abs(u-g);if(s.polar||s.spider){var c=this._renderData[e],m=c.polarCoords;if(i)if(s.spider){const t=this.getPolarDataPointOffset(h,this._stats.seriesGroups[e].max,e),i=this.getPolarDataPointOffset(d,this._stats.seriesGroups[e].max,e);let r="M "+m.x+","+m.y;r+=" L "+t.x+","+t.y,r+=" L "+i.x+","+i.y,f=this.renderer.path(r)}else{var y={},_={x:Math.min(u,g),y:t.y,width:p,height:t.height};this._columnAsPieSlice(y,t,m,_),f=y.element}else{var x=this._toPolarCoord(m,t,t.x,c.baseOffset),v=this._toPolarCoord(m,t,t.x,u),b=this._toPolarCoord(m,t,t.x,g),N=this.renderer._ptdist(x.x,x.y,v.x,v.y),M=this.renderer._ptdist(x.x,x.y,b.x,b.y),A=Math.round(360*-m.startAngle/(2*Math.PI)),w=Math.round(360*-m.endAngle/(2*Math.PI));if(A>w){const e=A;A=w,w=e}if(s.spider){var S=c.xAxis.offsetAngles;let e="";var C=[M,N],k=S;for(var D in m.isClosedCircle&&(k=S.slice(0)).push(k[0]),C){for(let t=0;t<k.length;t++){var T=0===D?t:S.length-t-1;let i=m.x+C[D]*Math.cos(k[T]),r=m.y+C[D]*Math.sin(k[T]);e+=""===e?"M ":" L",e+=this.renderer._ptrnd(i)+","+this.renderer._ptrnd(r)}if(0===D){let t=m.x+C[1]*Math.cos(k[T]),i=m.y+C[1]*Math.sin(k[T]);e+=" L"+this.renderer._ptrnd(t)+","+this.renderer._ptrnd(i)}}e+=" Z",f=this.renderer.path(e)}else f=this.renderer.pieslice(m.x,m.y,N,M,A,w)}}else{var F={x:Math.min(u,g),y:l.y,width:p,height:l.height};if(i||(F={x:l.x,y:Math.min(u,g),width:l.width,height:p}),n){let e=F.x;F.x=F.y,F.y=e,e=F.width,F.width=F.height,F.height=e}f=0===p||1===p?this.renderer.line(this.renderer._ptrnd(F.x),this.renderer._ptrnd(F.y),this.renderer._ptrnd(F.x+(n?0:F.width)),this.renderer._ptrnd(F.y+(n?F.height:0))):this.renderer.rect(F.x,F.y,F.width,F.height)}var O=o.color||this._getThemeColor("band"),I=o.lineColor||O,P=o.lineWidth;isNaN(P)&&(P=1);var R=o.opacity;(isNaN(R)||R<0||R>1)&&(R=1),this.renderer.attr(f,{fill:O,"fill-opacity":R,stroke:I,"stroke-opacity":R,"stroke-width":P,"stroke-dasharray":o.dashStyle})}}}}_getColumnGroupWidth(e,t,i){let r=this.seriesGroups[e],s=-1!==r.type.indexOf("stacked"),a=this._getColumnGroupsCount(r.orientation);(isNaN(a)||0===a)&&(a=1);let l=t.rangeLength>=1?t.itemWidth:.9*i,n=r.columnsMinWidth;isNaN(n)&&(n=1),isNaN(r.columnsMaxWidth)||(n=Math.min(r.columnsMaxWidth,n)),n>l&&t.length>0&&(l=Math.max(l,.9*i/t.length));let o=n;if(!s){let e=r.seriesGapPercent;(isNaN(e)||e<0)&&(e=10),e/=100;let t=n;t*=1+e,o+=r.series.length*t}return{requiredWidth:o,availableWidth:l,targetWidth:Math.max(l/a,o)}}_getColumnSerieWidthAndOffset(e,t){let i=this.seriesGroups[e],r="horizontal"===i.orientation,s=this._plotRect;r&&(s={x:s.y,y:s.x,width:s.height,height:s.width});let a=this._calcGroupOffsets(e,s);if(!a||0===a.xoffsets.length)return;let l=this._getColumnGroupsCount(i.orientation);"candlestick"!==i.type&&"ohlc"!==i.type||(l=1);let n=this._getColumnGroupIndex(e),o=this._getColumnGroupWidth(e,a.xoffsets,r?s.height:s.width),h=0,d=o.targetWidth;(!0===this.columnSeriesOverlap||Math.round(d)>Math.round(o.availableWidth/l))&&(l=1,n=0),h-=d*l/2,h+=d*n;let u=i.columnsGapPercent;u<=0&&(u=0),(isNaN(u)||u>=100)&&(u=25),u/=100;let g=d*u;g+o.requiredWidth>o.targetWidth&&(g=Math.max(0,o.targetWidth-o.requiredWidth)),Math.round(d)>Math.round(o.availableWidth)&&(g=0),d-=g,h+=g/2;let f=i.seriesGapPercent;(isNaN(f)||f<0)&&(f=10);let p=-1!==i.type.indexOf("stacked"),c=d;p||(c/=i.series.length);let m=this._get([i.seriesGap,d*f/100/(i.series.length-1)]);(!0===i.polar||!0===i.spider||p||i.series.length<=1)&&(m=0);let y=m*(i.series.length-1);i.series.length>1&&y>d-1*i.series.length&&(y=d-1*i.series.length,m=y/Math.max(1,i.series.length-1));let _=c-y/i.series.length,x=0,v=i.columnsMaxWidth;isNaN(v)||_>v&&(x=_-v,_=v);let b=0;return b=p?x/2:(d-_*i.series.length-y)/2+_*t+Math.max(0,t)*m,{width:_,offset:h+b}}_renderColumnSeries(e,t){let i=this.seriesGroups[e];if(!i.series||0===i.series.length)return;let r="horizontal"===i.orientation,s=t;r&&(s={x:t.y,y:t.x,width:t.height,height:t.width});let a,l=this._calcGroupOffsets(e,s);if(!l||0===l.xoffsets.length)return;!0!==i.polar&&!0!==i.spider||(a=this._getPolarAxisCoords(e,s));let n={groupIndex:e,rect:t,vertical:!r,seriesCtx:[],renderData:l,polarAxisCoords:a};n.columnGroupWidth=this._getColumnGroupWidth(e,l.xoffsets,r?s.height:s.width);let o,h=this._getGroupGradientType(e);for(let t=0;t<i.series.length;t++){let r=i.series[t];if(r.customDraw)continue;let s=this._getAnimProps(e,t);o=s.enabled&&!this._isToggleRefresh&&l.xoffsets.length<100?s.duration:0;let d=this._getColumnSerieWidthAndOffset(e,t),u=this._isSerieVisible(e,t),g=this._getSerieSettings(e,t),f=this._getColors(e,t,NaN,this._getGroupGradientType(e),4),p=[];if("function"==typeof r.colorFunction&&!a)for(let i=l.xoffsets.first;i<=l.xoffsets.last;i++)p.push(this._getColors(e,t,i,h,4));let c={seriesIndex:t,serieColors:f,itemsColors:p,settings:g,columnWidth:d.width,xAdjust:d.offset,isVisible:u};n.seriesCtx.push(c)}this._animColumns(n,0===o?1:0);let d=this;this._enqueueAnimation("series",void 0,void 0,o,(function(e,t,i){d._animColumns(t,i)}),n)}_getPercent(e,t,i,r){return isNaN(e)&&(e=t),!isNaN(i)&&!isNaN(e)&&e<i&&(e=i),!isNaN(r)&&!isNaN(e)&&e>r&&(e=r),isNaN(e)?NaN:e}_getColumnVOffsets(e,t,i,r,s,a){var l=this.seriesGroups[t],n=this._getPercent(l.columnsTopWidthPercent,100,0,100),o=this._getPercent(l.columnsBottomWidthPercent,100,0,100);0===n&&0===o&&(o=100);var h=this._getPercent(l.columnsNeckHeightPercent,NaN,0,100)/100,d=this._getPercent(l.columnsNeckWidthPercent,100,0,100)/100,u=[],g=NaN;for(let l=0;l<i.length;l++){var f,p=i[l],c=p.seriesIndex,m=e.offsets[c][r].from,y=e.offsets[c][r].to,_=e.xoffsets.data[r],x=p.isVisible;x||(y=m);var v=this._elementRenderInfo;if(x&&v&&v.length>t&&v[t].series.length>c){var b=e.xoffsets.xvalues[r];!(f=v[t].series[c][b])||isNaN(f.from)||isNaN(f.to)||(m=f.from+(m-f.from)*a,y=f.to+(y-f.to)*a,_=f.xoffset+(_-f.xoffset)*a)}f||(y=m+(y-m)*(s?1:a)),isNaN(m)&&(m=isNaN(g)?e.baseOffset:g),g=!isNaN(y)&&s?y:m,isNaN(y)&&(y=m);var N={from:m,to:y,xOffset:_};100===n&&100===o||(N.funnel=!0,N.toWidthPercent=n,N.fromWidthPercent=o),u.push(N)}if(s&&u.length>1&&!(this._elementRenderInfo&&this._elementRenderInfo.length>t)){var M=0,A=0,w=-1/0,S=1/0,C=1/0,k=-1/0;for(let e=0;e<u.length;e++)i[e].isVisible&&(u[e].to>=u[e].from?(A+=u[e].to-u[e].from,C=Math.min(C,u[e].from),k=Math.max(k,u[e].to)):(M+=u[e].from-u[e].to,w=Math.max(w,u[e].from),S=Math.min(S,u[e].to)));var D=M,T=A;M*=a,A*=a;var F=0,O=0;for(let e=0;e<u.length;e++)if(u[e].to>=u[e].from){let t=u[e].to-u[e].from;t+O>A&&(t=Math.max(0,A-O),u[e].to=u[e].from+t),100===n&&100===o||(u[e].funnel=!0,!isNaN(h)&&T*h>=O?u[e].fromWidthPercent=100*d:u[e].fromWidthPercent=Math.abs(u[e].from-C)/T*(n-o)+o,!isNaN(h)&&T*h>=0+(O+t)?u[e].toWidthPercent=100*d:u[e].toWidthPercent=Math.abs(u[e].to-C)/T*(n-o)+o),O+=t}else{let t=u[e].from-u[e].to;t+F>M&&(t=Math.max(0,M-F),u[e].to=u[e].from-t),100===n&&100===o||(u[e].funnel=!0,!isNaN(h)&&D*h>=F?u[e].fromWidthPercent=100*d:u[e].fromWidthPercent=Math.abs(u[e].from-w)/D*(n-o)+o,!isNaN(h)&&D*h>=0+(F+t)?u[e].toWidthPercent=100*d:u[e].toWidthPercent=Math.abs(u[e].to-w)/D*(n-o)+o),F+=t}}return u}_columnAsPieSlice(e,t,i,r){let s=this._toPolarCoord(i,t,r.x,r.y),a=this._toPolarCoord(i,t,r.x,r.y+r.height),l=this.renderer._ptdist(i.x,i.y,a.x,a.y),n=this.renderer._ptdist(i.x,i.y,s.x,s.y),o=t.width,h=180*Math.abs(i.startAngle-i.endAngle)/Math.PI,d=-(r.x-t.x)*h/o,u=-(r.x+r.width-t.x)*h/o,g=i.startAngle;if(g=360*g/(2*Math.PI),d-=g,u-=g,e)if(void 0!==e.element&&null!==e.element){let t=this.renderer.pieSlicePath(i.x,i.y,l,n,u,d,0);t+=" Z",this.renderer.attr(e.element,{d:t})}else e.element=this.renderer.pieslice(i.x,i.y,l,n,u,d,0);return{fromAngle:u,toAngle:d,innerRadius:l,outerRadius:n}}_setRenderInfo(e,t,i,r){this._renderData[e].offsets[t][i].elementInfo=r}_getRenderInfo(e,t,i){return this._renderData[e].offsets[t][i].elementInfo||{}}_animColumns(e,t){var i=this,r=e.groupIndex,s=this.seriesGroups[r],a=e.renderData,l=-1!==s.type.indexOf("waterfall"),n=this._getXAxis(r),o=-1!==s.type.indexOf("stacked"),h=e.polarAxisCoords,d=-1;for(let e=0;e<s.series.length;e++)if(this._isSerieVisible(r,e)){d=e;break}var u=NaN,g=NaN;for(let t=0;t<e.seriesCtx.length;t++){var f=e.seriesCtx[t];(isNaN(u)||u>f.xAdjust)&&(u=f.xAdjust),(isNaN(g)||g<f.xAdjust+f.columnWidth)&&(g=f.xAdjust+f.columnWidth)}var p=Math.abs(g-u),c=this._get([s.columnsGapPercent,25])/100;(isNaN(c)<0||c>=1)&&(c=.25);var m=c*p,y=e.renderData.xoffsets,_=-1,x={},v=!0===s.skipOverlappingPoints;for(let u=y.first;u<=y.last;u++){var b=y.data[u];if(!(isNaN(b)||-1!==_&&Math.abs(b-_)<p-1+m&&v)){_=b;var N=this._getColumnVOffsets(a,r,e.seriesCtx,u,o,t),M=!1;if(l)for(let e=0;e<s.series.length;e++)s.series[e].summary&&y.xvalues[u][s.series[e].summary]&&(M=!0);for(let g=0;g<e.seriesCtx.length;g++){let f=e.seriesCtx[g];var A=f.seriesIndex,w=s.series[A],S=N[g].from,C=N[g].to,k=N[g].xOffset,D=(e.vertical?e.rect.x:e.rect.y)+f.xAdjust,T=f.settings;let p=0!==f.itemsColors.length?f.itemsColors[u-a.xoffsets.first]:f.serieColors;var F=this._isSerieVisible(r,A);if(!F)continue;let c=this.renderer._ptrnd(D+k);var O={x:c,width:f.columnWidth};N[g].funnel&&(O.fromWidthPercent=N[g].fromWidthPercent,O.toWidthPercent=N[g].toWidthPercent);var I=!0;e.vertical?(O.y=S,O.height=C-S,O.height<0&&(O.y+=O.height,O.height=-O.height,I=!1)):(O.x=S<C?S:C,O.width=Math.abs(S-C),I=S-C<0,O.y=c,O.height=f.columnWidth);var P=S-C;if(!isNaN(P)){P=Math.abs(P);var R=void 0,L=i._getRenderInfo(r,A,u),G=L.element,V=L.labelElement,E=null==G;if(V&&(i.renderer.removeElement(V),V=void 0),h){var B={element:G};R=this._columnAsPieSlice(B,e.rect,h,O),G=B.element,p=this._getColors(r,A,void 0,"radialGradient",R.outerRadius)}else if(N[g].funnel){var H=this._getTrapezoidPath(Object.assign({},O),e.vertical,I);E?G=this.renderer.path(H,{}):this.renderer.attr(G,{d:H})}else E?G=this.renderer.rect(O.x,O.y,e.vertical?O.width:0,e.vertical?0:O.height):!0===e.vertical?this.renderer.attr(G,{x:O.x,y:O.y,height:P}):this.renderer.attr(G,{x:O.x,y:O.y,width:P});if(P<1&&(1!==t||h)?this.renderer.attr(G,{display:"none"}):this.renderer.attr(G,{display:"block"}),E&&this.renderer.attr(G,{fill:p.fillColor,"fill-opacity":T.opacity,"stroke-opacity":T.opacity,stroke:p.lineColor,"stroke-width":T.stroke,"stroke-dasharray":T.dashStyle}),V&&this.renderer.removeElement(V),!F||0===P&&t<1)L={element:G,labelElement:V},i._setRenderInfo(r,A,u,L);else{if(l&&!1!==this._get([w.showWaterfallLines,s.showWaterfallLines])){if(!o||o&&g===d){var z=o?-1:g;if(1===t&&!isNaN(a.offsets[g][u].from)&&!isNaN(a.offsets[g][u].to)){var W=x[z];if(null!=W){var j={x:W.x,y:this.renderer._ptrnd(W.y)},X={x:c,y:j.y},U=s.columnsTopWidthPercent/100;(isNaN(U)||U>1||U<0)&&(U=1);var Y=s.columnsBottomWidthPercent/100;(isNaN(Y)||Y>1||Y<0)&&(Y=1);var q=e.vertical?O.width:O.height;if(j.x=j.x-q/2+q/2*U,M){let e=q*U/2;X.x=X.x+q/2-(n.flip?-e:e)}else{let e=q*Y/2;X.x=X.x+q/2-(n.flip?-e:e)}e.vertical||(this._swapXY([j]),this._swapXY([X])),this.renderer.line(j.x,j.y,X.x,X.y,{stroke:W.color,"stroke-width":T.stroke,"stroke-opacity":T.opacity,"fill-opacity":T.opacity,"stroke-dasharray":T.dashStyle})}}}1===t&&0!==P&&(x[o?-1:g]={y:C,x:e.vertical?O.x+O.width:O.y+O.height,color:p.lineColor})}if(h){let e=this._showLabel(r,A,u,O,void 0,void 0,!0);var Z=R.outerRadius+10;const t=this._adjustTextBoxPosition(h.x,h.y,e,Z,(R.fromAngle+R.toAngle)/2,!0,!1,!1);V=this._showLabel(r,A,u,{x:t.x,y:t.y},void 0,void 0,!1,!1,!1)}else V=this._showLabel(r,A,u,O,void 0,void 0,!1,!1,I);L={element:G,labelElement:V},i._setRenderInfo(r,A,u,L),1===t&&this._installHandlers(G,"column",r,A,u)}}}}}}_getTrapezoidPath(e,t,i){let r="",s=e.fromWidthPercent/100,a=e.toWidthPercent/100;if(!t){let t=e.width;e.width=e.height,e.height=t,t=e.x,e.x=e.y,e.y=t}let l=e.x+e.width/2,n=[{x:l-e.width*(i?a:s)/2,y:e.y+e.height},{x:l-e.width*(i?s:a)/2,y:e.y},{x:l+e.width*(i?s:a)/2,y:e.y},{x:l+e.width*(i?a:s)/2,y:e.y+e.height}];t||this._swapXY(n),r+="M "+this.renderer._ptrnd(n[0].x)+","+this.renderer._ptrnd(n[0].y);for(let e=1;e<n.length;e++)r+=" L "+this.renderer._ptrnd(n[e].x)+","+this.renderer._ptrnd(n[e].y);return r+=" Z",r}_swapXY(e){for(let t=0;t<e.length;t++){let i=e[t].x;e[t].x=e[t].y,e[t].y=i}}_renderCandleStickSeries(e,t,i){let r=this,s=r.seriesGroups[e];if(!s.series||0===s.series.length)return;let a="horizontal"===s.orientation,l=t;a&&(l={x:t.y,y:t.x,width:t.height,height:t.width});let n,o=r._calcGroupOffsets(e,l);if(!o||0===o.xoffsets.length)return;(s.polar||s.spider)&&(n=r._getPolarAxisCoords(e,l));let h=r._getGroupGradientType(e),d=[];for(let t=0;t<s.series.length;t++)d[t]=r._getColumnSerieWidthAndOffset(e,t);for(let l=0;l<s.series.length;l++){if(!this._isSerieVisible(e,l))continue;let u=r._getSerieSettings(e,l),g=s.series[l];if(g.customDraw)continue;let f="function"==typeof g.colorFunction?void 0:r._getColors(e,l,NaN,h),p={rect:t,inverse:a,groupIndex:e,seriesIndex:l,symbolType:g.symbolType,symbolSize:g.symbolSize,"fill-opacity":u.opacity,"stroke-opacity":u.opacity,"stroke-width":u.stroke,"stroke-dasharray":u.dashStyle,gradientType:h,colors:f,renderData:o,polarAxisCoords:n,columnsInfo:d,isOHLC:i,items:[],self:r},c=r._getAnimProps(e,l),m=c.enabled&&!r._isToggleRefresh&&o.xoffsets.length<5e3?c.duration:0;r._animCandleStick(p,0),r._enqueueAnimation("series",void 0,void 0,m,(function(e,t,i){r._animCandleStick(t,i,e)}),p)}}_animCandleStick(e,t){var i=["Open","Low","Close","High"],r=e.columnsInfo[e.seriesIndex].width,s=e.self.seriesGroups[e.groupIndex],a=e.renderData.xoffsets,l=-1,n=Math.abs(a.data[a.last]-a.data[a.first]);n*=t;var o=NaN,h=NaN;for(let t=0;t<e.columnsInfo.length;t++){var d=e.columnsInfo[t];(isNaN(o)||o>d.offset)&&(o=d.offset),(isNaN(h)||h<d.offset+d.width)&&(h=d.offset+d.width)}var u=Math.abs(h-o),g=!1!==s.skipOverlappingPoints;for(let o=a.first;o<=a.last;o++){var f=a.data[o];if(!(isNaN(f)||-1!==l&&Math.abs(f-l)<u&&g)){if(Math.abs(a.data[o]-a.data[a.first])>n)break;l=f;var p=e.items[o]=e.items[o]||{};for(let t in i){var c=e.self._getDataValueAsNumber(o,s.series[e.seriesIndex]["dataField"+i[t]],e.groupIndex);if(isNaN(c))break;var m=e.renderData.offsets[e.seriesIndex][o][i[t]];if(isNaN(m))break;p[i[t]]=m}if(f+=e.inverse?e.rect.y:e.rect.x,e.polarAxisCoords){var y=this._toPolarCoord(e.polarAxisCoords,this._plotRect,f,m);f=y.x,m=y.y}for(var _ in f=this.renderer._ptrnd(f),i)p[_]=this.renderer._ptrnd(p[_]);var x=e.colors;if(x||(x=e.self._getColors(e.groupIndex,e.seriesIndex,o,e.gradientType)),e.isOHLC){var v="M"+f+","+p.Low+" L"+f+","+p.High+" M"+(f-r/2)+","+p.Open+" L"+f+","+p.Open+" M"+(f+r/2)+","+p.Close+" L"+f+","+p.Close;e.inverse&&(v="M"+p.Low+","+f+" L"+p.High+","+f+" M"+p.Open+","+(f-r/2)+" L"+p.Open+","+f+" M"+p.Close+","+f+" L"+p.Close+","+(f+r/2));let i=p.lineElement;i||(i=this.renderer.path(v,{}),this.renderer.attr(i,{fill:x.fillColor,"fill-opacity":e["fill-opacity"],"stroke-opacity":e["fill-opacity"],stroke:x.lineColor,"stroke-width":e["stroke-width"],"stroke-dasharray":e["stroke-dasharray"]}),p.lineElement=i),1===t&&this._installHandlers(i,"column",e.groupIndex,e.seriesIndex,o)}else{var b=p.lineElement;b||(b=e.inverse?this.renderer.line(p.Low,f,p.High,f):this.renderer.line(f,p.Low,f,p.High),this.renderer.attr(b,{fill:x.fillColor,"fill-opacity":e["fill-opacity"],"stroke-opacity":e["fill-opacity"],stroke:x.lineColor,"stroke-width":e["stroke-width"],"stroke-dasharray":e["stroke-dasharray"]}),p.lineElement=b);var N=p.stickElement;if(f-=r/2,!N){var M=x.fillColor;p.Close<=p.Open&&x.fillColorAlt&&(M=x.fillColorAlt),N=e.inverse?this.renderer.rect(Math.min(p.Open,p.Close),f,Math.abs(p.Close-p.Open),r):this.renderer.rect(f,Math.min(p.Open,p.Close),r,Math.abs(p.Close-p.Open)),this.renderer.attr(N,{fill:M,"fill-opacity":e["fill-opacity"],"stroke-opacity":e["fill-opacity"],stroke:x.lineColor,"stroke-width":e["stroke-width"],"stroke-dasharray":e["stroke-dasharray"]}),p.stickElement=N}1===t&&this._installHandlers(N,"column",e.groupIndex,e.seriesIndex,o)}}}}_renderScatterSeries(e,t,i){var r=this.seriesGroups[e];if(r.series&&0!==r.series.length){var s=-1!==r.type.indexOf("bubble"),a="horizontal"===r.orientation,l=t;a&&(l={x:t.y,y:t.x,width:t.height,height:t.width});var n=this._calcGroupOffsets(e,l);if(n&&0!==n.xoffsets.length){var o,h=l.width;(r.polar||r.spider)&&(h=2*(o=this._getPolarAxisCoords(e,l)).r);var d=this._getGroupGradientType(e);i||(i="to");for(let V=0;V<r.series.length;V++){var u=this._getSerieSettings(e,V),g=r.series[V];if(!g.customDraw){var f=g.dataField,p="function"==typeof g.colorFunction,c=this._getColors(e,V,NaN,d),m=NaN,y=NaN;if(s)for(let t=n.xoffsets.first;t<=n.xoffsets.last;t++){var _=this._getDataValueAsNumber(t,g.radiusDataField||g.sizeDataField,e);"number"!=typeof _&&this.error(this.localize("invalidRadiusDataField",{index:t})),isNaN(_)||((isNaN(m)||_<m)&&(m=_),(isNaN(y)||_>y)&&(y=_))}var x=g.minRadius||g.minSymbolSize;isNaN(x)&&(x=h/50);var v=g.maxRadius||g.maxSymbolSize;isNaN(v)&&(v=h/25),x>v&&(v=x);var b=g.radius;b=isNaN(b)&&!isNaN(g.symbolSize)?"circle"===g.symbolType?g.symbolSize/2:g.symbolSize:5;var N=this._getAnimProps(e,V),M=N.enabled&&!this._isToggleRefresh&&n.xoffsets.length<5e3?N.duration:0,A={groupIndex:e,seriesIndex:V,symbolType:g.symbolType,symbolSize:g.symbolSize,"fill-opacity":u.opacity,"stroke-opacity":u.opacity,"stroke-width":u.stroke,"stroke-width-symbol":u.strokeSymbol,"stroke-dasharray":u.dashStyle,items:[],polarAxisCoords:o},w=void 0;for(let r=n.xoffsets.first;r<=n.xoffsets.last;r++)if("number"==typeof this._getDataValueAsNumber(r,f,e)){var S=n.xoffsets.data[r],C=n.xoffsets.xvalues[r],k=n.offsets[V][r][i];if(!(k<l.y||k>l.y+l.height||isNaN(S)||isNaN(k))){if(a){var D=S;S=k,k=D+t.y}else S+=t.x;if(!(!p&&w&&this.enableSampling&&this.renderer._ptdist(w.x,w.y,S,k)<1)){w={x:S,y:k};var T=b;if(s){var F=this._getDataValueAsNumber(r,g.radiusDataField||g.sizeDataField,e);if("number"!=typeof F)continue;T=x+(v-x)*(F-m)/Math.max(1,y-m),isNaN(T)&&(T=x)}n.offsets[V][r].radius=T;var O=NaN,I=NaN,P=0,R=this._elementRenderInfo;if(null!=C&&R&&R.length>e&&R[e].series.length>V){var L=R[e].series[V][C];if(L&&!isNaN(L.to)){if(O=L.to,I=L.xoffset,P=b,a){let e=I;I=O,O=e+t.y}else I+=t.x;s&&(P=x+(v-x)*(L.valueRadius-m)/Math.max(1,y-m),isNaN(P)&&(P=x))}}p&&(c=this._getColors(e,V,r,d)),A.items.push({from:P,to:T,itemIndex:r,fill:c.fillColor,stroke:c.lineColor,x:S,y:k,xFrom:I,yFrom:O})}}}this._animR(A,0);var G=this;this._enqueueAnimation("series",void 0,void 0,M,(function(e,t,i){G._animR(t,i,e)}),A)}}}}}_animR(e,t){let i=e.items,r=e.symbolType||"circle",s=e.symbolSize;for(let a=0;a<i.length;a++){let l=i[a],n=l.x,o=l.y,h=Math.round((l.to-l.from)*t+l.from);if(isNaN(l.yFrom)||(o=l.yFrom+(o-l.yFrom)*t),isNaN(l.xFrom)||(n=l.xFrom+(n-l.xFrom)*t),e.polarAxisCoords){let t=this._toPolarCoord(e.polarAxisCoords,this._plotRect,n,o);n=t.x,o=t.y}n=this.renderer._ptrnd(n),o=this.renderer._ptrnd(o),h=this.renderer._ptrnd(h);let d=this._getRenderInfo(e.groupIndex,e.seriesIndex,i[a].itemIndex),u=d.element,g=d.labelElement;"circle"===r?(u||(u=this.renderer.circle(n,o,h),this.renderer.attr(u,{fill:l.fill,"fill-opacity":e["fill-opacity"],"stroke-opacity":e["fill-opacity"],stroke:l.stroke,"stroke-width":e["stroke-width"],"stroke-dasharray":e["stroke-dasharray"]})),this.renderer.attr(u,{r:h,cy:o,cx:n})):(u&&this.renderer.removeElement(u),u=this._drawSymbol(r,n,o,l.fill,e["fill-opacity"],l.stroke,e["stroke-opacity"]||e["fill-opacity"],e["stroke-width-symbol"],e["stroke-dasharray"],s||h)),g&&this.renderer.removeElement(g),g=this._showLabel(e.groupIndex,e.seriesIndex,l.itemIndex,{x:n-h,y:o-h,width:2*h,height:2*h}),t>=1&&this._installHandlers(u,"circle",e.groupIndex,e.seriesIndex,l.itemIndex),this._setRenderInfo(e.groupIndex,e.seriesIndex,i[a].itemIndex,{element:u,labelElement:g})}}_showMultiSeriesToolTip(e){let t=this,i="<div style='text-align:left'>",r="";for(let s=0;s<t.seriesGroups.length;s++){if(t._isPieGroup(s))continue;let a=t._getXAxis(s),l=t._getValueAxis(s),n=t.seriesGroups[s],o=this._getAxisSettings(a),h=this._getFormatSettings(o,"toolTipFormatSettings"),d=o.toolTipFormatFunction,u=t._getDataValue(e,a.dataField,s);void 0!==a.dataField&&null!==a.dataField&&""!==a.dataField||(u=e),"date"===a.type&&(u=t._castAsDate(u,(h?h.dateFormat:void 0)||a.dateFormat)),d||h||"date"!==a.type||(d=this._getDefaultDTFormatFn(a.baseUnit||"day"));let g=a.displayText||a.dataField||"";""!==g&&(g+=": ");let f=g+t._formatValue(u,h,d,s,void 0,e);r!==f&&(""!==r&&(i+="<br />"),i+=f+"<br /><br />",r=f);for(let r=0;r<n.series.length;r++){let a=n.series[r];if(!1===n.showToolTips||!1===a.showToolTips)continue;if(!t._isSerieVisible(s,r))continue;let o=t._get([t._getFormatSettings(a,"toolTipFormatSettings"),t._getFormatSettings(n,"toolTipFormatSettings"),t._getFormatSettings(l,"toolTipFormatSettings"),t._getFormatSettings(t,"toolTipFormatSettings")]),h=t._get([a.toolTipFormatFunction,n.toolTipFormatFunction,l.toolTipFormatFunction,t.toolTipFormatFunction]),d=t._getFormattedValue(s,r,e,o,h);i+='<span style="color:'+t._getColors(s,r,e).lineColor+';">'+d+"</span><br />\n"}}let s=this._get([t.toolTipClass,"smart-chart-tooltip-text"]),a=this._get([t.toolTipBackground,t._getThemeColor("background")]),l=this._get([t.toolTipLineColor,t._getThemeColor("line")]),n=this._get([t.toolTipOpacity,1]);i+="</div>";let o=this.getItemCoord(t._ttEl.gidx,t._ttEl.sidx,t._ttEl.iidx);o.x+=window.pageXOffset,o.y+=window.pageYOffset,t._createTooltip(o,t.seriesGroups[t._ttEl.gidx],i,{css:s,fill:a,stroke:l,fillOpacity:n,symbolSize:3})}_showToolTip(e,t,i,r,s){let a=this,l=a._getXAxis(i),n=a._getValueAxis(i);if(a._ttEl&&i===a._ttEl.gidx&&r===a._ttEl.sidx&&s===a._ttEl.iidx)return;let o=a.seriesGroups[i],h=o.series[r],d=a.enableCrosshairs;a._pointMarker?(e=parseInt(a._pointMarker.x+5),t=parseInt(a._pointMarker.y-5)):d=!1;let u=d&&!1===a.showToolTips;if(e=this.renderer._ptrnd(e),t=this.renderer._ptrnd(t),!1===o.showToolTips||!1===h.showToolTips)return;a._ttEl||(a._ttEl={}),a._ttEl.sidx=r,a._ttEl.gidx=i,a._ttEl.iidx=s;let g=0;for(let e=0;e<a.seriesGroups.length;e++)for(let t=0;t<a.seriesGroups[e].series.length;t++)g++;if(d){let e=this.renderer._ptrnd(a._pointMarker.x),t=this.renderer._ptrnd(a._pointMarker.y),r=a.crosshairsColor||a._getThemeColor("line");if(o.polar||o.spider){let s=this._getPolarAxisCoords(i,this._plotRect);if(this.renderer._ptdist(e,t,s.x,s.y)>s.r)return;let l=Math.atan2(t-s.y,e-s.x),n=Math.cos(l)*s.r+s.x,o=Math.sin(l)*s.r+s.y;a._ttEl.vLine?a.renderer.attr(a._ttEl.vLine,{x1:s.x,y1:s.y,x2:n,y2:o}):a._ttEl.vLine=a.renderer.line(s.x,s.y,n,o,{stroke:r,"stroke-width":a.crosshairsLineWidth||1,"stroke-dasharray":a.crosshairsDashStyle||""})}else a._ttEl.vLine&&a._ttEl.hLine?(a.renderer.attr(a._ttEl.vLine,{x1:e,x2:e}),a.renderer.attr(a._ttEl.hLine,{y1:t,y2:t})):(a._ttEl.vLine=a.renderer.line(e,a._plotRect.y,e,a._plotRect.y+a._plotRect.height,{stroke:r,"stroke-width":a.crosshairsLineWidth||1,"stroke-dasharray":a.crosshairsDashStyle||""}),a._ttEl.hLine=a.renderer.line(a._plotRect.x,t,a._plotRect.x+a._plotRect.width,t,{stroke:r,"stroke-width":a.crosshairsLineWidth||1,"stroke-dasharray":a.crosshairsDashStyle||""}))}if(a.showToolTipsOnAllSeries&&!a._isPieGroup(i)&&g>1)return void a._showMultiSeriesToolTip(s);let f=a._get([a._getFormatSettings(h,"toolTipFormatSettings"),a._getFormatSettings(o,"toolTipFormatSettings"),a._getFormatSettings(n,"toolTipFormatSettings"),a._getFormatSettings(a,"toolTipFormatSettings")]),p=a._get([h.toolTipFormatFunction,o.toolTipFormatFunction,n.toolTipFormatFunction,a.toolTipFormatFunction]),c=a._getColors(i,r,s),m=a._getDataValue(s,l.dataField,i);void 0!==l.dataField&&null!==l.dataField&&""!==l.dataField||(m=s),"date"===l.type&&(m=a._castAsDate(m,(f?f.dateFormat:void 0)||l.dateFormat));let y="";if("function"==typeof p){let e={},t=0;for(let r in h)0===r.indexOf("dataField")&&(e[r.substring(9,r.length).toLowerCase()]=a._getDataValue(s,h[r],i),t++);0===t?e=a._getDataValue(s,void 0,i):1===t&&(e=e[""]),y=p(e,s,h,o,m,l)}else{y=a._getFormattedValue(i,r,s,f,p);let e=this._getAxisSettings(l),t=a._getFormatSettings(e,"toolTipFormatSettings"),n=e.toolTipFormatFunction;n||t||"date"!==l.type||(n=this._getDefaultDTFormatFn(l.baseUnit||"day"));let o=a._formatValue(m,t,n,i,r,s);if(a._isPieGroup(i))m=a._getDataValue(s,h.displayText||h.dataField,i),o=a._formatValue(m,t,n,i,r,s),y=o+": "+y;else{let e=l.displayText||l.dataField||"";y=e.length>0?e+": "+o+"<br>"+y:o+"<br>"+y}}if(!u&&!1!==a.showToolTips){let e=this._get([h.toolTipClass,o.toolTipClass,a.toolTipClass,"smart-chart-tooltip-text"]),t=this._get([h.toolTipBackground,o.toolTipBackground,a.toolTipBackground,a._getThemeColor("background")]),l=this._get([h.toolTipLineColor,o.toolTipLineColor,a.toolTipLineColor,c.lineColor,a._getThemeColor("line")]),n=this._get([h.toolTipOpacity,o.toolTipOpacity,a.toolTipOpacity,1]),d=this.getItemCoord(i,r,s);d.y=Math.min(Math.max(d.y,this._plotRect.y),this._plotRect.y+this._plotRect.y+this._plotRect.height);let u=0;a._pointMarker&&a._pointMarker.element&&(u=h.symbolSizeSelected,isNaN(u)&&(u=h.symbolSize),(isNaN(u)||u>50||u<0)&&(u=o.symbolSize),(isNaN(u)||u>50||u<0)&&(u=8)),a._createTooltip(d,o,y,{css:e,fill:t,stroke:l,fillOpacity:n,symbolSize:u})}}_fitTooltip(e,t,i,r,s){let a={},l=2+s/2;if(t.x-i.width-7-l>e.x&&t.y+t.height/2-i.height/2>e.y&&t.y+t.height/2+i.height/2<e.y+e.height&&(a.left={arrowLocation:"right",x:t.x-i.width-7-l,y:t.y+t.height/2-i.height/2,width:i.width+7,height:i.height}),t.x+t.width+i.width+7+l<e.x+e.width&&t.y+t.height/2-i.height/2>e.y&&t.y+t.height/2+i.height/2<e.y+e.height&&(a.right={arrowLocation:"left",x:t.x+t.width+l,y:t.y+t.height/2-i.height/2,width:i.width+7,height:i.height}),t.y-i.height-l-7>e.y&&t.x+t.width/2-i.width/2>e.x&&t.x+t.width/2+i.width/2<e.x+e.width&&(a.top={arrowLocation:"bottom",x:t.x+t.width/2-i.width/2,y:t.y-i.height-l-7,width:i.width,height:i.height+7}),t.y+t.height+i.height+7+l<e.y+e.height&&t.x+t.width/2-i.width/2>e.x&&t.x+t.width/2+i.width/2<e.x+e.width&&(a.bottom={arrowLocation:"top",x:t.x+t.width/2-i.width/2,y:t.y+t.height+l,width:i.width,height:i.height+7}),t.width>t.height||(-1!==r.type.indexOf("stackedcolumn")||-1!==r.type.indexOf("stackedwaterfall"))&&"horizontal"!==r.orientation){if(a.left)return a.left;if(a.right)return a.right}else{if(a.top)return a.top;if(a.bottom)return a.bottom}for(let e in a)if(a[e])return a[e];return{arrowLocation:""}}_createTooltip(e,t,i,r){const s=this,a=t.type;let l=s._ttEl.box;if(!l){l=s._ttEl.box=document.createElement("div"),l.id=s.id+"Tooltip",l.className="smart-chart-tooltip",l.setAttribute("animation",s.animation),l.setAttribute("theme",s.theme),l.setAttribute("role","tooltip");const e=document.createElement("div"),t=document.createElement("div"),i=document.createElement("div");if(e.className="smart-chart-tooltip-arrow-outer",e.setAttribute("role","presentation"),t.className="smart-chart-tooltip-arrow-inner",t.setAttribute("role","presentation"),i.className="smart-chart-tooltip-content",i.setAttribute("role","presentation"),l.appendChild(i),l.appendChild(e),l.appendChild(t),s.getRootNode().host?s.getShadowRootOrBody().appendChild(l):document.body.appendChild(l),s.hasAttribute("aria-owns")){const e=s.getAttribute("aria-owns");s.setAttribute("aria-owns",e+" "+l.id)}else s.setAttribute("aria-owns",l.id)}if(!i||0===i.length)return void l.classList.add("smart-visibility-hidden");s.rightToLeft?l.setAttribute("right-to-left",""):l.removeAttribute("right-to-left"),l.classList.add("smart-visibility-hidden");const n=l.firstElementChild,o=l.children[1],h=l.children[2];h.style.opacity=o.style.opacity=r.fillOpacity,n.style.backgroundColor=r.fill,n.style.borderColor=r.stroke,n.style.opacity=r.fillOpacity;const d='<span class="'+r.css+'" role="presentation">'+i+"</span>";n.innerHTML=d;const u=s._measureHtml(d),g=s._plotRect;if(u.width>g.width||u.height>g.height)return;let f={width:u.width,height:u.height},p="",c=s._isColumnType(a),m=Math.max(e.x,g.x),y=Math.max(e.y,g.y);if(-1!==a.indexOf("pie")||-1!==a.indexOf("donut")){let t=(e.fromAngle+e.toAngle)/2;t*=Math.PI/180;let i=!isNaN(e.innerRadius)&&e.innerRadius>0?(e.innerRadius+e.outerRadius)/2:.75*e.outerRadius;m=e.x=e.center.x+Math.cos(t)*i,y=e.y=e.center.y-Math.sin(t)*i,e.width=e.height=1}else c&&(t.polar||t.spider)&&(e.width=e.height=1);let _=this._fitTooltip(this._plotRect,e,f,t,r.symbolSize);""!==_.arrowLocation&&(p=_.arrowLocation,m=_.x,y=_.y,f.width=_.width,f.height=_.height),"top"===p||"bottom"===p?(f.height+=7,m-=3.5,"bottom"===p&&(y-=7)):"left"!==p&&"right"!==p||(f.width+=7,y-=3.5,"right"===p&&(m-=7)),m+f.width>g.x+g.width&&(p="",m=g.x+g.width-f.width),y+f.height>g.y+g.height&&(p="",y=g.y+g.height-f.height);let x={x:0,y:0},v={x:0,y:0};n.style.width=u.width+"px",n.style.height=u.height+"px",o.style["margin-top"]=o.style["margin-left"]=0,h.style["margin-top"]=h.style["margin-left"]=0,n.style["margin-top"]=n.style["margin-left"]=0;let b="7px solid transparent";switch(p){case"left":x={x:0,y:(u.height-7)/2},v={x:7,y:0},n.style["margin-left"]="7px",o.style["margin-left"]="0px",o.style["margin-top"]=x.y+"px",o.style["border-left"]="",o.style["border-right"]="7px solid "+r.stroke,o.style["border-top"]=b,o.style["border-bottom"]=b,h.style["margin-left"]="1px",h.style["margin-top"]=x.y+"px",h.style["border-left"]="",h.style["border-right"]="7px solid "+r.fill,h.style["border-top"]=b,h.style["border-bottom"]=b;break;case"right":x={x:f.width-7,y:(u.height-7)/2},v={x:0,y:0},o.style["margin-left"]=x.x+"px",o.style["margin-top"]=x.y+"px",o.style["border-left"]="7px solid "+r.stroke,o.style["border-right"]="",o.style["border-top"]=b,o.style["border-bottom"]=b,h.style["margin-left"]=x.x-1+"px",h.style["margin-top"]=x.y+"px",h.style["border-left"]="7px solid "+r.fill,h.style["border-right"]="",h.style["border-top"]=b,h.style["border-bottom"]=b;break;case"top":x={x:f.width/2-3.5,y:0},v={x:0,y:7},n.style["margin-top"]=v.y+"px",o.style["margin-left"]=x.x+"px",o.style["border-top"]="",o.style["border-bottom"]="7px solid "+r.stroke,o.style["border-left"]=b,o.style["border-right"]=b,h.style["margin-left"]=x.x+"px",h.style["margin-top"]="1px",h.style["border-top"]="",h.style["border-bottom"]="7px solid "+r.fill,h.style["border-left"]=b,h.style["border-right"]=b;break;case"bottom":x={x:f.width/2-3.5,y:f.height-7},v={x:0,y:0},o.style["margin-left"]=x.x+"px",o.style["margin-top"]=x.y+"px",o.style["border-top"]="7px solid "+r.stroke,o.style["border-bottom"]="",o.style["border-left"]=b,o.style["border-right"]=b,h.style["margin-left"]=x.x+"px",h.style["margin-top"]=x.y-1+"px",h.style["border-top"]="7px solid "+r.fill,h.style["border-bottom"]="",h.style["border-left"]=b,h.style["border-right"]=b}""===p?(o.classList.add("smart-hidden"),h.classList.add("smart-hidden")):(o.classList.remove("smart-hidden"),h.classList.remove("smart-hidden")),l.style.width=f.width+"px",l.style.height=f.height+"px";const N=s.getBoundingClientRect();l.style.left=m+N.left+window.pageXOffset+"px",l.style.top=y+N.top+window.pageYOffset+"px",l.classList.remove("smart-visibility-hidden")}_measureHtml(e){const t=this;let i=t._measureDiv;i||(t._measureDiv=i=document.createElement("div"),i.className="smart-chart-tooltip",i.style.position="absolute",i.style.visibility="hidden",i.style.left=0,i.style.top=0,(t.shadowRoot||t).appendChild(i)),i.innerHTML=e;const r={width:i.offsetWidth+2,height:i.offsetHeight+2};return Smart.Utilities.Core.Browser.Firefox&&(r.height+=3),r}_hideToolTip(){this._ttEl&&(this._ttEl.box&&this._ttEl.box.classList.add("smart-visibility-hidden"),this._hideCrosshairs(),this._ttEl.gidx=void 0)}_hideCrosshairs(){this._ttEl&&(this._ttEl.vLine&&(this.renderer.removeElement(this._ttEl.vLine),this._ttEl.vLine=void 0),this._ttEl.hLine&&(this.renderer.removeElement(this._ttEl.hLine),this._ttEl.hLine=void 0))}_get(e){return this._draw.getByPriority(e)}_getAxisSettings(e){if(!e)return{};let t=this,i=e.gridLines||{},r={visible:t._get([i.visible,!0]),color:t._get([i.color,t._getThemeColor("line")]),unitInterval:i.unitInterval,step:i.step,dashStyle:i.dashStyle,width:t._get([i.lineWidth,1]),offsets:[],alternatingBackgroundColor:e.alternatingBackgroundColor,alternatingBackgroundColor2:e.alternatingBackgroundColor2,alternatingBackgroundOpacity:e.alternatingBackgroundOpacity},s=e.tickMarks||{},a={visible:t._get([s.visible,e.showTickMarks,!0]),color:t._get([s.color,e.tickMarksColor,t._getThemeColor("line")]),unitInterval:t._get([s.unitInterval,s.interval,e.tickMarksInterval]),step:t._get([s.step,e.tickMarksStep]),dashStyle:t._get([s.dashStyle,e.tickMarksDashStyle]),width:t._get([s.lineWidth,1]),size:t._get([s.size,4]),offsets:[]},l=e.title||{},n={visible:t._get([l.visible,!0]),text:t._get([e.description,l.text]),style:t._get([e.descriptionClass,l.class,"smart-chart-axis-description"]),halign:t._get([e.horizontalDescriptionAlignment,l.horizontalAlignment,"center"]),valign:t._get([e.verticalDescriptionAlignment,l.verticalAlignment,"center"]),angle:0,rotationPoint:t._get([l.rotationPoint,"centercenter"]),offset:t._get([l.offset,{x:0,y:0}])},o=e.line||{},h={visible:t._get([o.visible,!0]),color:t._get([o.color,r.color,t._getThemeColor("line")]),dashStyle:t._get([o.dashStyle,r.dashStyle,""]),width:t._get([o.lineWidth,1]),angle:t._get([o.angle,NaN])},d=e.padding||{};d={left:d.left||0,right:d.right||0,top:d.top||0,bottom:d.bottom||0};let u=this._getAxisLabelsSettings(e);return{visible:this._get([e.visible,!0]),customDraw:this._get([e.customDraw,!1]),gridLines:r,tickMarks:a,line:h,title:n,labels:u,padding:d,toolTipFormatFunction:this._get([e.toolTipFormatFunction,e.formatFunction,u.formatFunction]),toolTipFormatSettings:this._get([t._getFormatSettings(e,"toolTipFormatSettings"),t._getFormatSettings(e),t._getFormatSettings(u)])}}_getAxisLabelsSettings(e){let t=this,i=e.labels||{};return{visible:t._get([e.showLabels,i.visible,!0]),unitInterval:t._get([i.unitInterval,i.interval,e.labelsInterval]),step:t._get([i.step,e.labelsStep]),angle:t._get([e.textRotationAngle,i.angle,0]),style:t._get([e.class,i.class,"smart-chart-axis-text"]),halign:t._get([e.horizontalTextAlignment,i.horizontalAlignment,"center"]),valign:t._get([e.verticalTextAlignment,i.verticalAlignment,"center"]),textRotationPoint:t._get([e.textRotationPoint,i.rotationPoint,"auto"]),textOffset:t._get([e.textOffset,i.offset,{x:0,y:0}]),autoRotate:t._get([e.labelsAutoRotate,i.autoRotate,!1]),formatSettings:t._get([t._getFormatSettings(e),t._getFormatSettings(i),void 0]),formatFunction:t._get([e.formatFunction,i.formatFunction,void 0])}}_getLabelsSettings(e,t,i,r){let s=this.seriesGroups[e],a=s.series[t],l=isNaN(i)?void 0:this._getDataValue(i,a.dataField,e),n=r||["Visible","Offset","Angle","HorizontalAlignment","VerticalAlignment","Class","BackgroundColor","BorderColor","BorderOpacity","Padding","Opacity","BackgroundOpacity","LinesAngles","LinesEnabled","AutoRotate","Radius"],o={};for(let e=0;e<n.length;e++){let t,r=n[e],h="labels"+r,d="label"+r,u=r.substring(0,1).toLowerCase()+r.substring(1);s.labels&&"object"==typeof s.labels&&(t=s.labels[u]),a.labels&&"object"==typeof a.labels&&void 0!==a.labels[u]&&null!==a.labels[u]&&(t=a.labels[u]),t=this._get([a[h],a[d],t,s[h],s[d]]),o[u]="function"==typeof t?t(l,i,a,s):t}o.class=o.class||"smart-chart-label-text",o.visible=this._get([o.visible,a.showLabels,s.showLabels,void 0!==a.labels&&null!==a.labels||void 0,void 0!==s.labels&&null!==s.labels||void 0]);let h=o.padding||1;return o.padding={left:this._get([h.left,isNaN(h)?1:h]),right:this._get([h.right,isNaN(h)?1:h]),top:this._get([h.top,isNaN(h)?1:h]),bottom:this._get([h.bottom,isNaN(h)?1:h])},o}_showLabel(e,t,i,r,s,a,l,n,o,h,d){let u={width:0,height:0};if(isNaN(i))return;let g=this._getLabelsSettings(e,t,i);if(!g.visible)return l?u:void 0;if(r.width<0||r.height<0)return l?u:void 0;let f=g.angle;isNaN(h)||(f=h);let p=g.offset||{},c={x:p.x,y:p.y};isNaN(c.x)&&(c.x=0),isNaN(c.y)&&(c.y=0),s=s||g.horizontalAlignment||"center",a=a||g.verticalAlignment||"center";let m=this._getFormattedValue(e,t,i,void 0,void 0,!0),y=r.width,_=r.height;if(!0===n&&"center"!==s&&(s="right"===s?"left":"right"),!0===o&&"center"!==a&&"middle"!==a&&(a="top"===a?"bottom":"top",c.y*=-1),u=this.renderer.measureText(m,f,{class:g.class}),l)return u;let x=0,v=0;y>0&&(""===s||"center"===s?x+=(y-u.width)/2:"right"===s&&(x+=y-u.width)),_>0&&(""===a||"center"===a?v+=(_-u.height)/2:"bottom"===a&&(v+=_-u.height)),x+=r.x+c.x,v+=r.y+c.y;let b=this._plotRect;x<=b.x&&(x=b.x+2),v<=b.y&&(v=b.y+2);let N,M=Math.max(u.width,1),A=Math.max(u.height,1);v+A>=b.y+b.height&&(v=b.y+b.height-A-2),x+M>=b.x+b.width&&(x=b.x+b.width-M-2);let w=g.backgroundColor,S=g.borderColor,C=g.padding;(w||S)&&(N=this.renderer.beginGroup(),this.renderer.rect(x-C.left,v-C.top,u.width+C.left+C.right,u.height+C.bottom+C.bottom,{fill:w||"transparent","fill-opacity":g.backgroundOpacity||1,stroke:S||"transparent","stroke-opacity":g.borderOpacity,"stroke-width":1}));let k=this.renderer.text(m,x,v,u.width,u.height,f,{class:g.class,opacity:g.opacity||1},!1,"center","center",void 0,arguments[11]);return d&&(d.x=x-C.left,d.y=v-C.top,d.width=u.width+C.left+C.right,d.height=u.height+C.bottom+C.bottom),N&&this.renderer.endGroup(),N||k}_getAnimProps(e,t){let i=this.seriesGroups[e],r=isNaN(t)?void 0:i.series[t],s=this.hasAnimation;i.animation&&(s="none"!==i.animation),r&&r.animation&&(s="none"!==r.animation);let a=this.animationDuration;isNaN(a)&&(a=1e3);let l=i.animationDuration;if(isNaN(l)||(a=l),r){let e=r.animationDuration;isNaN(e)||(a=e)}return a>5e3&&(a=1e3),{enabled:s,duration:a}}_isColorTransition(e,t,i,r){if(r-1<i.xoffsets.first)return!1;let s=this._getColors(e,t,r,this._getGroupGradientType(e)),a=this._getColors(e,t,r-1,this._getGroupGradientType(e));return s.fillColor!==a.fillColor}_renderLineSeries(e,t){var i=this.seriesGroups[e];if(i.series&&0!==i.series.length){var r=-1!==i.type.indexOf("area"),s=-1!==i.type.indexOf("stacked"),a=s&&-1!==i.type.indexOf("100"),l=-1!==i.type.indexOf("spline"),n=-1!==i.type.indexOf("step"),o=-1!==i.type.indexOf("range"),h=!0===i.polar||!0===i.spider;if(h&&(n=!1),!n||!l){var d="horizontal"===i.orientation,u=!0===this._getXAxis(e).flip,g=t;d&&(g={x:t.y,y:t.x,width:t.height,height:t.width});var f=this._calcGroupOffsets(e,g);if(f&&0!==f.xoffsets.length){this._linesRenderInfo||(this._linesRenderInfo={}),this._linesRenderInfo[e]={};for(let t=i.series.length-1;t>=0;t--){var p=this._getSerieSettings(e,t),c={groupIndex:e,rect:g,serieIndex:t,swapXY:d,isArea:r,isSpline:l,isRange:o,isPolar:h,settings:p,segments:[],pointsLength:0};if(this._isSerieVisible(e,t)){var m=i.series[t];if(!m.customDraw){var y,_="function"==typeof m.colorFunction,x=f.xoffsets.first,v=x,b=this._getColors(e,t,NaN,this._getGroupGradientType(e));do{var N=[],M=[],A=[],w=0,S=0,C=NaN,k=NaN,D=NaN;if(!(f.xoffsets.length<1)){var T=this._getAnimProps(e,t),F=T.enabled&&!this._isToggleRefresh&&f.xoffsets.length<1e4&&T.duration,O=x;y=!1;var I=void 0;for(let s=x;s<=f.xoffsets.last;s++){x=s;var P=f.xoffsets.data[s],R=f.xoffsets.xvalues[s];if(!(isNaN(P)||(w=P=Math.max(P,1),S=f.offsets[t][s].to,!_&&I&&this.enableSampling&&this.renderer._ptdist(I.x,I.y,w,S)<1))){I={x:w,y:S};var L=f.offsets[t][s].from;if(isNaN(S)||isNaN(L)){if("connect"===m.emptyPointsDisplay)continue;if("zero"!==m.emptyPointsDisplay){y=!0;break}isNaN(S)&&(S=f.baseOffset),isNaN(L)&&(L=f.baseOffset)}if(_&&this._isColorTransition(e,t,f,x)&&N.length>1){x--;break}var G=this._elementRenderInfo;if(G&&G.length>e&&G[e].series.length>t){var V=G[e].series[t][R];let i=this.renderer._ptrnd(V?V.to:void 0),r=this.renderer._ptrnd(g.x+(V?V.xoffset:void 0));A.push(d?{y:r,x:i,index:s}:{x:r,y:i,index:s})}v=s,p.stroke<2&&(S-g.y<=1&&(S=g.y+1),L-g.y<=1&&(L=g.y+1),g.y+g.height-S<=1&&(S=g.y+g.height-1),g.y+g.height-L<=1&&(L=g.y+g.height-1)),!r&&a&&(S<=g.y&&(S=g.y+1),S>=g.y+g.height&&(S=g.y+g.height-1),L<=g.y&&(L=g.y+1),L>=g.y+g.height&&(L=g.y+g.height-1)),w=(P=Math.max(P,1))+g.x,!0===i.skipOverlappingPoints&&!isNaN(C)&&Math.abs(C-w)<=1||(!n||isNaN(C)||isNaN(k)||k!==S&&N.push(d?{y:w,x:this.renderer._ptrnd(k)}:{x:w,y:this.renderer._ptrnd(k)}),N.push(d?{y:w,x:this.renderer._ptrnd(S),index:s}:{x:w,y:this.renderer._ptrnd(S),index:s}),M.push(d?{y:w,x:this.renderer._ptrnd(L),index:s}:{x:w,y:this.renderer._ptrnd(L),index:s}),C=w,k=S,isNaN(D)&&(D=S))}}if(0!==N.length){var E=N[N.length-1].index;_&&(b=this._getColors(e,t,E,this._getGroupGradientType(e)));var B=g.x+f.xoffsets.data[O],H=g.x+f.xoffsets.data[v];if(r&&!0===i.alignEndPointsWithIntervals&&(B>g.x&&(B=g.x),H<g.x+g.width&&(H=g.x+g.width),u)){var z=B;B=H,H=z}H=this.renderer._ptrnd(H),B=this.renderer._ptrnd(B);var W=f.baseOffset;D=this.renderer._ptrnd(D);var j=this.renderer._ptrnd(S)||W;o&&(N=N.concat(M.reverse())),c.pointsLength+=N.length;var X={lastItemIndex:E,colorSettings:b,pointsArray:N,pointsStart:A,left:B,right:H,pyStart:D,pyEnd:j,yBase:W,labelElements:[],symbolElements:[]};c.segments.push(X)}else x++}}while(x<f.xoffsets.first+f.xoffsets.length-1||y);this._linesRenderInfo[e][t]=c}}else this._linesRenderInfo[e][t]=c}var U=this._linesRenderInfo[e],Y=[];for(let e in U)Y.push(U[e]);Y=Y.sort((function(e,t){return e.serieIndex-t.serieIndex})),r&&s&&Y.reverse();for(let e=0;e<Y.length;e++){let t=Y[e];this._animateLine(t,0===F?1:0);var q=this;this._enqueueAnimation("series",void 0,void 0,F,(function(e,t,i){q._animateLine(t,i)}),t)}}}}}_animateLine(e,t){let i=e.settings,r=e.groupIndex,s=e.serieIndex,a=this.seriesGroups[r],l=a.series[s],n=this._getSymbol(r,s),o=this._getLabelsSettings(r,s,NaN,["Visible"]).visible,h=!0;e.isPolar&&(isNaN(a.endAngle)||360===Math.round(Math.abs((isNaN(a.startAngle)?0:a.startAngle)-a.endAngle))||(h=!1)),!1===l.endPointsConnect&&(h=!1);let d=0;for(let a=0;a<e.segments.length;a++){let u=e.segments[a],g=this._calculateLine(r,e.pointsLength,d,u.pointsArray,u.pointsStart,u.yBase,t,e.isArea,e.swapXY);if(d+=u.pointsArray.length,""===g)continue;let f=g.split(" "),p=g;p=""!==p?this._buildLineCmd(g,e.isRange,u.left,u.right,u.pyStart,u.pyEnd,u.yBase,e.isArea,e.isPolar,h,e.isSpline,e.swapXY):"M 0 0";let c=u.colorSettings;if(u.pathElement?this.renderer.attr(u.pathElement,{d:p}):(u.pathElement=this.renderer.path(p,{"stroke-width":i.stroke,stroke:c.lineColor,"stroke-opacity":i.opacity,"fill-opacity":i.opacity,"stroke-dasharray":i.dashStyle,fill:e.isArea?c.fillColor:"none"}),this._installHandlers(u.pathElement,"path",r,s,u.lastItemIndex)),u.labelElements){for(let e=0;e<u.labelElements.length;e++)this.renderer.removeElement(u.labelElements[e]);u.labelElements=[]}if(u.symbolElements){for(let e=0;e<u.symbolElements.length;e++)this.renderer.removeElement(u.symbolElements[e]);u.symbolElements=[]}if(u.pointsArray.length===f.length&&("none"!==n||o)){let e=l.symbolSize,t=this._plotRect;for(let a=0;a<f.length;a++){let l=f[a].split(",");if(l={x:parseFloat(l[0]),y:parseFloat(l[1])},!(l.x<t.x||l.x>t.x+t.width||l.y<t.y||l.y>t.y+t.height)){if("none"!==n){let t=this._getColors(r,s,u.pointsArray[a].index,this._getGroupGradientType(r)),o=this._drawSymbol(n,l.x,l.y,t.fillColorSymbol,i.opacity,t.lineColorSymbol,i.opacity,i.strokeSymbol,void 0,e);u.symbolElements.push(o)}if(o&&(l=this._adjustLineLabelPosition(r,s,u.pointsArray[a].index,l),l)){let e=this._showLabel(r,s,u.pointsArray[a].index,{x:l.x,y:l.y,width:0,height:0});u.labelElements.push(e)}}}}if(1===t&&"none"!==n)for(let e=0;e<u.symbolElements.length;e++)isNaN(u.pointsArray[e].index)||this._installHandlers(u.symbolElements[e],"symbol",r,s,u.pointsArray[e].index)}}_adjustLineLabelPosition(e,t,i,r){let s=this._showLabel(e,t,i,{width:0,height:0},"","",!0);if(!s)return;let a={x:r.x-s.width/2,y:0};return a.y=r.y-1.5*s.height,a}_calculateLine(e,t,i,r,s,a,l,n,o){let h,d=this.seriesGroups[e];!0!==d.polar&&!0!==d.spider||(h=this._getPolarAxisCoords(e,this._plotRect));let u="",g=r.length;n||0!==s.length||(g=t*l-i);for(let e=0;e<g+1&&e<r.length;e++){e>0&&(u+=" ");let t=r[e].y,i=r[e].x,d=n?a:t,f=i;if(s&&s.length>e&&(d=s[e].y,f=s[e].x,(isNaN(d)||isNaN(f))&&(d=t,f=i)),g<=r.length&&e>0&&e===g&&(f=r[e-1].x,d=r[e-1].y),o?(i=this.renderer._ptrnd((i-d)*(n?l:1)+d),t=this.renderer._ptrnd(t)):(i=this.renderer._ptrnd((i-f)*l+f),t=this.renderer._ptrnd((t-d)*l+d)),h){let e=this._toPolarCoord(h,this._plotRect,i,t);i=e.x,t=e.y}u+=i+","+t}return u}_buildLineCmd(e,t,i,r,s,a,l,n,o,h,d,u){let g=e,f=u?l+","+i:i+","+l;!n||o||t||(g=f+" "+e+" "+(u?l+","+r:r+","+l)),d&&(g=this._getBezierPoints(g));let p=g.split(" ");if(0===p.length)return"";if(1===p.length){let e=p[0].split(",");return"M "+p[0]+" L"+(parseFloat(e[0])+1)+","+(parseFloat(e[1])+1)}let c=p[0].replace("M","");return n&&!o?g=t?"M "+c+" L "+c+(d?"":" L "+c+" ")+g:"M "+f+" L "+c+" "+g:d||(g="M "+c+" L "+c+" "+g),(o&&h||t)&&(g+=" Z"),g}_getSerieSettings(e,t){let i=this.seriesGroups[e],r=-1!==i.type.indexOf("area"),s=-1!==i.type.indexOf("line"),a=i.series[t],l=a.dashStyle||i.dashStyle||"",n=a.opacity||i.opacity;(isNaN(n)||n<0||n>1)&&(n=1);let o=a.lineWidth;isNaN(o)&&"auto"!==o&&(o=i.lineWidth),("auto"===o||isNaN(o)||o<0||o>15)&&(o=r?2:s?3:1);let h=a.lineWidthSymbol;return isNaN(h)&&(h=1),{stroke:o,strokeSymbol:h,opacity:n,dashStyle:l}}_getColors(e,t,i,r,s){let a=this.seriesGroups[e],l=a.series[t],n=this._get([l.useGradientColors,a.useGradientColors,!1]),o=this._getSeriesColors(e,t,i),h=[[0,1.4],[100,1]],d=[[0,1],[25,1.1],[50,1.4],[100,1]],u=[[0,1.3],[90,1.2],[100,1]],g=NaN;if(isNaN(s)||(g=2===s?h:d),n){let s={};for(let e in o)s[e]=o[e];if(o=s,"verticalLinearGradient"===r||"horizontalLinearGradient"===r){let e="verticalLinearGradient"===r?g||h:g||d,t=["fillColor","fillColorSelected","fillColorAlt","fillColorAltSelected"];for(let i in t){let s=o[t[i]];s&&(o[t[i]]=this.renderer._toLinearGradient(s,"verticalLinearGradient"===r,e))}}else if("radialGradient"===r){let r,s=h;("pie"===a.type||"donut"===a.type||a.polar)&&null!=i&&this._renderData[e]&&this._renderData[e].offsets[t]&&(r=this._renderData[e].offsets[t][i],s=u),o.fillColor=this.renderer._toRadialGradient(o.fillColor,s,r),o.fillColorSelected=this.renderer._toRadialGradient(o.fillColorSelected,s,r)}}return o}_installHandlers(e,t,i,r,s){if(!this.enableEvents)return!1;var a=this,l=this.seriesGroups[i],n=this.seriesGroups[i].series[r],o=-1!==l.type.indexOf("line")||-1!==l.type.indexOf("area");o||!1===l.enableSelection||!1===n.enableSelection||this.renderer.addHandler(e,"mousemove",(function(){var e=a._selected;e&&e.isLineType&&"click"===e.linesUnselectMode&&(e.group!==i||e.series!==r)||a._ttEl&&a._ttEl.gidx===i&&a._ttEl.sidx===r&&a._ttEl.iidx===s||a._startTooltipTimer(i,r,s)})),!1!==l.enableSelection&&!1!==n.enableSelection&&this.renderer.addHandler(e,"mouseover",(function(){var l=a._selected;l&&l.isLineType&&"click"===l.linesUnselectMode&&(l.group!==i||l.series!==r)||a._select(e,t,i,r,s,s)})),this.renderer.addHandler(e,"click",(function(e){clearTimeout(a._hostClickTimer),a._lastClickTs=(new Date).valueOf(),o&&"symbol"!==t&&"pointMarker"!==t||(a._isColumnType(l.type)&&a._unselect(),isNaN(s)||(e.stopImmediatePropagation(),a._raiseItemEvent("click",l,n,s)))}))}_getHorizontalOffset(e,t,i,r){let s=this._plotRect;if(0===this._getDataLen(e))return{index:void 0,value:i};let a=this._calcGroupOffsets(e,this._plotRect);if(0===a.xoffsets.length)return{index:void 0,value:void 0};let l,n,o,h,d,u=i,g=r,f=this.seriesGroups[e];(f.polar||f.spider)&&(l=this._getPolarAxisCoords(e,s));for(let e=a.xoffsets.first;e<=a.xoffsets.last;e++){let i=a.xoffsets.data[e],r=a.offsets[t][e].to,p=0;if(l){let e=this._toPolarCoord(l,s,i+s.x,r);i=e.x,r=e.y,p=this.renderer._ptdist(u,g,i,r)}else if("horizontal"===f.orientation){i+=s.y;let e=r;r=i,i=e,p=this.renderer._ptdist(u,g,i,r)}else i+=s.x,p=Math.abs(u-i);(isNaN(n)||n>p)&&(n=p,o=e,h=i,d=r)}return{index:o,value:a.xoffsets.data[o],polarAxisCoords:l,x:h,y:d}}onmousemove(e,t){if(this._mouseX===e&&this._mouseY===t)return;if(this._mouseX=e,this._mouseY=t,!this._selected)return;let i=this._selected.group,r=this._selected.series,s=this.seriesGroups[i],a=s.series[r],l=this._plotRect;if(this.renderer&&(l=this.renderer.getRect(),l.x+=5,l.y+=5,l.width-=10,l.height-=10),e<l.x+window.scrollX||e>l.x+l.width+window.scrollX||t<l.y+window.scrollY||t>l.y+l.height+window.scrollY)return this._hideToolTip(),void this._unselect();let n="horizontal"===s.orientation;if(l=this._plotRect,-1!==s.type.indexOf("line")||-1!==s.type.indexOf("area")){let o=this._getHorizontalOffset(i,this._selected.series,e,t),h=o.index;if(null==h)return;if(this._selected.item!==h){let e=this._linesRenderInfo[i][r].segments,t=0;for(;h>e[t].lastItemIndex;)if(t++,t>=e.length)return;let s=e[t].pathElement,a=e[t].lastItemIndex;this._unselect(!1),this._select(s,"path",i,r,h,a)}let d=this._getSymbol(this._selected.group,this._selected.series);"none"===d&&(d="circle");let u=this._calcGroupOffsets(i,l),g=u.offsets[this._selected.series][h].to,f=g;-1!==s.type.indexOf("range")&&(f=u.offsets[this._selected.series][h].from);let p=n?e:t;if(t=!isNaN(f)&&Math.abs(p-f)<Math.abs(p-g)?f:g,isNaN(t))return;if(e=o.value,n){let i=e;e=t,t=i+l.y}else e+=l.x;if(o.polarAxisCoords&&(e=o.x,t=o.y),t=this.renderer._ptrnd(t),e=this.renderer._ptrnd(e),this._pointMarker&&this._pointMarker.element&&(this.renderer.removeElement(this._pointMarker.element),this._pointMarker.element=void 0),isNaN(e)||isNaN(t))return;let c=this._getSeriesColors(i,r,h),m=this._getSerieSettings(i,r),y=a.symbolSizeSelected;isNaN(y)&&(y=a.symbolSize),(isNaN(y)||y>50||y<0)&&(y=s.symbolSize),(isNaN(y)||y>50||y<0)&&(y=8),(this.showToolTips||this.enableCrosshairs)&&(this._pointMarker={type:d,x:e,y:t,gidx:i,sidx:r,iidx:h},this._pointMarker.element=this._drawSymbol(d,e,t,c.fillColorSymbolSelected,m.opacity,c.lineColorSymbolSelected,m.opacity,m.strokeSymbol,m.dashStyle,y),this._installHandlers(this._pointMarker.element,"pointMarker",i,r,h)),this._startTooltipTimer(i,this._selected.series,h)}}_drawSymbol(e,t,i,r,s,a,l,n,o,h){let d,u,g=h||6,f=g/2;switch(e){case"none":return;case"circle":d=this.renderer.circle(t,i,g/2);break;case"square":g-=1,f=g/2,d=this.renderer.rect(t-f,i-f,g,g);break;case"diamond":u="M "+(t-f)+","+i+" L"+t+","+(i-f)+" L"+(t+f)+","+i+" L"+t+","+(i+f)+" Z",d=this.renderer.path(u);break;case"triangle_up":case"triangle":u="M "+(t-f)+","+(i+f)+" L "+(t+f)+","+(i+f)+" L "+t+","+(i-f)+" Z",d=this.renderer.path(u);break;case"triangle_down":u="M "+(t-f)+","+(i-f)+" L "+t+","+(i+f)+" L "+(t+f)+","+(i-f)+" Z",d=this.renderer.path(u);break;case"triangle_left":u="M "+(t-f)+","+i+" L "+(t+f)+","+(i+f)+" L "+(t+f)+","+(i-f)+" Z",d=this.renderer.path(u);break;case"triangle_right":u="M "+(t-f)+","+(i-f)+" L "+(t-f)+","+(i+f)+" L "+(t+f)+","+i+" Z",d=this.renderer.path(u);break;default:d=this.renderer.circle(t,i,g)}return this.renderer.attr(d,{fill:r,"fill-opacity":s,stroke:a,"stroke-width":n,"stroke-opacity":l,"stroke-dasharray":o||""}),"circle"!==e&&(this.renderer.attr(d,{r:g/2}),"square"!==e&&this.renderer.attr(d,{x:t,y:i})),d}_getSymbol(e,t){let i,r=["circle","square","diamond","triangle_up","triangle_down","triangle_left","triangle_right"],s=this.seriesGroups[e],a=s.series[t];return void 0!==a.symbolType&&null!==a.symbolType&&(i=a.symbolType),null==i&&(i=s.symbolType),"default"===i?r[t%r.length]:null!=i?i:"none"}_startTooltipTimer(e,t,i,r,s,a,l){this._cancelTooltipTimer();let n=this,o=this.toolTipShowDelay;(isNaN(o)||o>1e4||o<0)&&(o=500),(this._ttEl||!0===this.enableCrosshairs&&!1===this.showToolTips)&&(o=0),isNaN(a)||(o=a),clearTimeout(this._tttimerHide),isNaN(r)&&(r=n._mouseX),isNaN(s)&&(s=n._mouseY-3),0===o&&n._showToolTip(r,s,e,t,i),this._tttimer=setTimeout((function(){0!==o&&n._showToolTip(r,s,e,t,i);let a=n.toolTipHideDelay;isNaN(l)||(a=l),isNaN(a)&&(a=4e3),n._tttimerHide=setTimeout((function(){n._hideToolTip(),n._unselect()}),a)}),o)}_cancelTooltipTimer(){clearTimeout(this._tttimer)}_getGroupGradientType(e){let t=this.seriesGroups[e];return-1!==t.type.indexOf("area")?"horizontal"===t.orientation?"horizontalLinearGradient":"verticalLinearGradient":this._isColumnType(t.type)||-1!==t.type.indexOf("candle")?t.polar?"radialGradient":"horizontal"===t.orientation?"verticalLinearGradient":"horizontalLinearGradient":-1!==t.type.indexOf("scatter")||-1!==t.type.indexOf("bubble")||this._isPieGroup(e)?"radialGradient":void 0}_select(e,t,i,r,s,a){if(this._selected){if(this._selected.item===s&&this._selected.series===r&&this._selected.group===i)return;this._unselect()}let l=this.seriesGroups[i],n=l.series[r];if(!1===l.enableSelection||!1===n.enableSelection)return;let o=-1!==l.type.indexOf("line")&&-1===l.type.indexOf("area");this._selected={element:e,type:t,group:i,series:r,item:s,iidxBase:a,isLineType:o,linesUnselectMode:n.linesUnselectMode||l.linesUnselectMode};let h=this._getColors(i,r,a||s,this._getGroupGradientType(i)),d=h.fillColorSelected;o&&(d="none");let u=this._getSerieSettings(i,r),g="symbol"===t?h.lineColorSymbolSelected:h.lineColorSelected;d="symbol"===t?h.fillColorSymbolSelected:d;let f="symbol"===t?1:u.stroke;"symbol"!==t&&this.renderer.getAttr(e,"fill")===h.fillColorAlt&&(d=h.fillColorAltSelected),this.renderer.attr(e,{stroke:g,fill:d,"stroke-width":f}),-1===l.type.indexOf("pie")&&-1===l.type.indexOf("donut")||this._applyPieSelect(),this._raiseItemEvent("mouseover",l,n,s),this._isTouchDevice&&this._startTooltipTimer(i,r,s)}_applyPieSelect(){var e=this;e._createAnimationGroup("animPieSlice");var t=this._selected;if(t){var i=this.getItemCoord(t.group,t.series,t.item);if(i){var r={element:this._getRenderInfo(t.group,t.series,t.item),coord:i};this._enqueueAnimation("animPieSlice",void 0,void 0,300,(function(i,r,s){var a=r.coord,l=a.selectedRadiusChange*s,n=e.renderer.pieSlicePath(a.center.x,a.center.y,0===a.innerRadius?0:a.innerRadius+l,a.outerRadius+l,a.fromAngle,a.toAngle,a.centerOffset);e.renderer.attr(r.element.element,{d:n}),e._showPieLabel(t.group,t.series,t.item,void 0,l,r.element.colors.lineColor)}),r),e._startAnimation("animPieSlice")}}}_applyPieUnselect(){this._stopAnimations();let e=this._selected;if(!e)return;let t=this.getItemCoord(e.group,e.series,e.item);if(!t||!t.center)return;let i=this.renderer.pieSlicePath(t.center.x,t.center.y,t.innerRadius,t.outerRadius,t.fromAngle,t.toAngle,t.centerOffset);this.renderer.attr(e.element,{d:i}),this._showPieLabel(e.group,e.series,e.item,void 0,0,this._getRenderInfo(e.group,e.series,e.item).colors.lineColor)}_unselect(){let e=this;if(e._selected){let t=e._selected.group,i=e._selected.series,r=e._selected.item,s=e._selected.iidxBase,a=e._selected.type,l=e.seriesGroups[t],n=l.series[i],o=-1!==l.type.indexOf("line")&&-1===l.type.indexOf("area"),h=e._getColors(t,i,s||r,e._getGroupGradientType(t)),d=h.fillColor;o&&(d="none");let u=e._getSerieSettings(t,i),g="symbol"===a?h.lineColorSymbol:h.lineColor;d="symbol"===a?h.fillColorSymbol:d,"symbol"!==a&&this.renderer.getAttr(e._selected.element,"fill")===h.fillColorAltSelected&&(d=h.fillColorAlt);let f="symbol"===a?1:u.stroke;e.renderer.attr(e._selected.element,{stroke:g,fill:d,"stroke-width":f}),-1===l.type.indexOf("pie")&&-1===l.type.indexOf("donut")||this._applyPieUnselect(),e._selected=void 0,isNaN(r)||e._raiseItemEvent("mouseout",l,n,r)}e._pointMarker&&(e._pointMarker.element&&(e.renderer.removeElement(e._pointMarker.element),e._pointMarker.element=void 0),e._pointMarker=void 0,e._hideCrosshairs())}_raiseItemEvent(e,t,i,r){let s=i[e]||t[e],a=0;for(;a<this.seriesGroups.length&&this.seriesGroups[a]!==t;a++);if(a===this.seriesGroups.length)return;let l={event:e,seriesGroup:t,serie:i,elementIndex:r,elementValue:this._getDataValue(r,i.dataField,a)};s&&"function"==typeof s&&s(l),this.$.fireEvent(e,l)}_calcInterval(e,t,i){let r=Math.abs(t-e)/i,s=.1,a=[1,2,3,4,5,10,15,20,25,50,100];r<1&&(a=[.5,.25,.125,.1],s=10);let l=0;do{l=0,r>=1?s*=10:s/=10;for(let e=1;e<a.length&&Math.abs(a[l]*s-r)>Math.abs(a[e]*s-r);e++)l=e}while(l===a.length-1);return a[l]*s}_renderDataClone(){if(!this._renderData||this._isToggleRefresh)return;let e=this._elementRenderInfo=[];if(!this._isSelectorRefresh)for(let t=0;t<this._renderData.length;t++){for(;e.length<=t;)e.push({});let i=e[t],r=this._renderData[t];if(!r.offsets)continue;if(r.valueAxis){i.valueAxis={itemOffsets:{}};for(let e in r.valueAxis.itemOffsets)i.valueAxis.itemOffsets[e]=r.valueAxis.itemOffsets[e]}if(r.xAxis){i.xAxis={itemOffsets:{}};for(let e in r.xAxis.itemOffsets)i.xAxis.itemOffsets[e]=r.xAxis.itemOffsets[e]}i.series=[];let s=i.series,a=this._isPieGroup(t);for(let e=0;e<r.offsets.length;e++){s.push({});for(let i=0;i<r.offsets[e].length;i++)if(a){let t=r.offsets[e][i];s[e][t.displayValue]={value:t.value,x:t.x,y:t.y,fromAngle:t.fromAngle,toAngle:t.toAngle}}else r.xoffsets?s[e][r.xoffsets.xvalues[i]]={value:r.offsets[e][i].value,valueRadius:r.offsets[e][i].valueRadius,xoffset:r.xoffsets.data[i],from:r.offsets[e][i].from,to:r.offsets[e][i].to}:(r.xoffsets=this._calculateXOffsets(t,this._plotRect.width),r.xoffsets&&(s[e][r.xoffsets.xvalues[i]]={value:r.offsets[e][i].value,valueRadius:r.offsets[e][i].valueRadius,xoffset:r.xoffsets.data[i],from:r.offsets[e][i].from,to:r.offsets[e][i].to}))}}}getPolarDataPointOffset(e,t,i){let r=this._renderData[i];if(!r)return{x:NaN,y:NaN};let s=this.getValueAxisDataPointOffset(t,i),a=this.getXAxisDataPointOffset(e,i),l=this._toPolarCoord(r.polarCoords,r.xAxis.rect,a,s);return{x:l.x,y:l.y}}_getDataPointOffsetDiff(e,t,i,r,s,a,l){let n=this._getDataPointOffset(e,i,r,s,a,l),o=this._getDataPointOffset(t,i,r,s,a,l);return Math.abs(n-o)}_getXAxisRenderData(e){if(e>=this._renderData.length)return;let t=this.seriesGroups[e],i=this._renderData[e].xAxis;if(i){if(void 0===t.xAxis||null===t.xAxis)for(let t=0;t<=e;t++)if(void 0===this.seriesGroups[t].xAxis||null===this.seriesGroups[t].xAxis){i=this._renderData[t].xAxis;break}return i}}getXAxisDataPointOffset(e,t){let i=this.seriesGroups[t];if(isNaN(e))return NaN;const r=this._getXAxisRenderData(t);if(!r)return NaN;let s=r.data.axisStats,a=s.min.valueOf(),l=s.max.valueOf(),n=l-a;if(0===n&&(n=1),e.valueOf()>l||e.valueOf()<a)return NaN;let o=this._getXAxis(t),h="horizontal"===i.orientation?"height":"width",d="horizontal"===i.orientation?"y":"x",u=(e.valueOf()-a)/n,g=r.rect[h]-r.data.padding.left-r.data.padding.right;return(i.polar||i.spider)&&this._renderData[t].polarCoords.isClosedCircle&&(g=r.data.axisSize),this._plotRect[d]+r.data.padding.left+g*(o.flip?1-u:u)}getValueAxisDataPointOffset(e,t){let i=this._getValueAxis(t);if(!i)return NaN;let r=this._renderData[t];if(!r)return NaN;let s=!0===i.flip,a=r.logBase,l=r.scale,n=r.gbase,o=r.baseOffset;return this._getDataPointOffset(e,n,a,l,o,s)}_getDataPointOffset(e,t,i,r,s,a){let l;return isNaN(e)&&(e=t),l=isNaN(i)?(e-t)*r:(this._draw.log(e,i)-this._draw.log(t,i))*r,l=a?s+l:s-l,l}_calcGroupOffsets(e,t){let i=this.seriesGroups[e];for(;this._renderData.length<e+1;)this._renderData.push({});if(null!==this._renderData[e]&&void 0!==this._renderData[e].offsets)return this._renderData[e];if(this._isPieGroup(e))return this._calcPieSeriesGroupOffsets(e,t);let r=this._getValueAxis(e);if(!r||!i.series||0===i.series.length)return this._renderData[e];let s=!0===r.flip,a=!0===r.logarithmicScale,l=r.logarithmicScaleBase||10,n=[],o=-1!==i.type.indexOf("stacked"),h=o&&-1!==i.type.indexOf("100"),d=-1!==i.type.indexOf("range"),u=this._isColumnType(i.type),g=-1!==i.type.indexOf("waterfall"),f=this._getDataLen(e),p=i.baselineValue||r.baselineValue||0;h&&(p=0);let c=this._stats.seriesGroups[e];if(!c||!c.isValid)return;let m=c.hasStackValueReversal;if(m&&(p=0),g&&o){if(m)return;p=c.base}p>c.max&&(p=c.max),p<c.min&&(p=c.min);let y=h||a?c.maxRange:c.max-c.min,_=c.min,x=c.max,v=t.height/(a?c.intervals:y),b=0;h?_*x<0?(y/=2,b=-(y+p)*v):b=-p*v:b=-(p-_)*v,s?b=t.y-b:b+=t.y+t.height;let N,M=[],A=[],w=[];a&&(N=this._draw.log(x,l)-this._draw.log(p,l),o&&(N=c.intervals,p=h?0:_),s||(b=t.y+N/c.intervals*t.height)),b=this.renderer._ptrnd(b);let S=_*x<0?t.height/2:t.height,C=[],k=[],D=o&&(u||a),T=[];n=new Array(i.series.length);for(let e=0;e<i.series.length;e++)n[e]=new Array(f);for(let t=0;t<f;t++){!g&&o&&(k=[]);for(let r=0;r<i.series.length;r++){!o&&a&&(C=[]);let u=i.series[r],g=u.dataField,f=u.dataFieldFrom,m=u.dataFieldTo,y=u.radiusDataField||u.sizeDataField;n[r][t]={};let _=this._isSerieVisible(e,r);if(-1!==i.type.indexOf("candle")||-1!==i.type.indexOf("ohlc")){let i=["Open","Close","High","Low"];for(let o in i){let h="dataField"+i[o];u[h]&&(n[r][t][i[o]]=this._getDataPointOffset(this._getDataValueAsNumber(t,u[h],e),p,a?l:NaN,v,b,s))}continue}if(o)for(;k.length<=t;)k.push(0);let x=NaN;d&&(x=this._getDataValueAsNumber(t,f,e),isNaN(x)&&(x=p));let N=NaN;N=d?this._getDataValueAsNumber(t,m,e):this._getDataValueAsNumber(t,g,e);let F,O=this._getDataValueAsNumber(t,y,e);if(o&&(k[t]+=_?N:0),_||(N=NaN),isNaN(N)||a&&N<=0){n[r][t]={from:void 0,to:void 0};continue}o&&(D?F=N>=p?M:A:N=k[t]);let I=v*(N-p);if(d&&(I=v*(N-x)),o&&D&&(T[t]?I=v*N:(T[t]=!0,I=v*(N-p))),a){for(;C.length<=t;)C.push({p:{value:0,height:0},n:{value:0,height:0}});let e=d||d?x:p,i=N>e?C[t].p:C[t].n;i.value+=N,h?(N=i.value/(c.psums[t]+c.nsums[t])*100,I=(this._draw.log(N,l)-c.minPow)*v):(I=this._draw.log(i.value,l)-this._draw.log(e,l),I*=v),I-=i.height,i.height+=I}let P=b;if(d){let e=0;e=a?(this._draw.log(x,l)-this._draw.log(p,l))*v:(x-p)*v,P+=s?e:-e}if(o){if(h&&!a){let e=c.psums[t]-c.nsums[t];N>p?(I=c.psums[t]/e*S,0!==c.psums[t]&&(I*=N/c.psums[t])):(I=c.nsums[t]/e*S,0!==c.nsums[t]&&(I*=N/c.nsums[t]))}D&&(isNaN(F[t])&&(F[t]=P),P=F[t])}isNaN(w[t])&&(w[t]=0);let R=w[t];I=Math.abs(I);let L=I;if(I>=1){const e=this.renderer._ptrnd(I)-1;I=Math.abs(I-e)>.5?Math.round(I):e}if(R+=I-L,o||(R=0),Math.abs(R)>.5&&(R>0?(I-=1,R-=1):(I+=1,R+=1)),w[t]=R,r===i.series.length-1&&h){let e=0;for(let i=0;i<r;i++)e+=Math.abs(n[i][t].to-n[i][t].from);if(e+=I,e<S)if(I>.5)I=this.renderer._ptrnd(I+S-e);else{let i=r-1;for(;i>=0;){if(Math.abs(n[i][t].to-n[i][t].from)>1){n[i][t].from>n[i][t].to&&(n[i][t].from+=S-e);break}i--}}}s&&(I*=-1);let G=N<p;d&&(G=x>N);let V=isNaN(x)?N:{from:x,to:N};G?(D&&(F[t]+=I),n[r][t]={from:P,to:P+I,value:V,valueRadius:O}):(D&&(F[t]-=I),n[r][t]={from:P,to:P-I,value:V,valueRadius:O})}}let F=this._renderData[e];return F.baseOffset=b,F.gbase=p,F.logBase=a?l:NaN,F.scale=v,F.offsets=g?this._applyWaterfall(n,f,e,b,p,a?l:NaN,v,s,o):n,F.xoffsets=this._calculateXOffsets(e,t.width),this._renderData[e]}_isPercent(e){return"string"==typeof e&&e.length>0&&e.indexOf("%")===e.length-1}_calcPieSeriesGroupOffsets(e,t){var i=this,r=this._getDataLen(e),s=this.seriesGroups[e],a=this._renderData[e]={},l=a.offsets=[];for(let a=0;a<s.series.length;a++){var n=s.series[a],o=this._get([n.minAngle,n.startAngle]);(isNaN(o)||o<0||o>360)&&(o=0);var h=this._get([n.maxAngle,n.endAngle]);(isNaN(h)||h<0||h>360)&&(h=360);var d=h-o,u=n.initialAngle||0;u<o&&(u=o),u>h&&(u=h);var g=n.centerOffset||0,f=this._draw.getNum([n.offsetX,s.offsetX,t.width/2]),p=this._draw.getNum([n.offsetY,s.offsetY,t.height/2]),c=Math.min(t.width,t.height)/2,m=u,y=n.radius;i._isPercent(y)&&(y=parseFloat(y)/100*c),isNaN(y)&&(y=.4*c);var _=n.innerRadius;i._isPercent(_)&&(_=parseFloat(_)/100*c),(isNaN(_)||_>=y)&&(_=0);var x=n.selectedRadiusChange;i._isPercent(x)&&(x=parseFloat(x)/100*(y-_)),isNaN(x)&&(x=.1*(y-_)),l.push([]);var v=0,b=0;for(let t=0;t<r;t++){var N=this._getDataValueAsNumber(t,n.dataField,e);isNaN(N)||(this._isSerieVisible(e,a,t)||!0===n.hiddenPointsDisplay)&&(N>0?v+=N:b+=N)}var M=v-b;0===M&&(M=1);for(let i=0;i<r;i++){let r=this._getDataValueAsNumber(i,n.dataField,e);if(isNaN(r))l[a].push({});else{var A=n.displayText||n.displayField,w=this._getDataValue(i,A,e);null==w&&(w=i);var S=0,C=this._isSerieVisible(e,a,i);(C||!0===n.hiddenPointsDisplay)&&(S=Math.abs(r)/M*d);var k=t.x+f,D=t.y+p,T=g;"function"==typeof g&&(T=g({seriesIndex:a,seriesGroupIndex:e,itemIndex:i})),isNaN(T)&&(T=0);var F={key:e+"_"+a+"_"+i,value:r,displayValue:w,x:k,y:D,fromAngle:m,toAngle:m+S,centerOffset:T,innerRadius:_,outerRadius:y,selectedRadiusChange:x,visible:C};l[a].push(F),m+=S}}}return a}_isPointSeriesOnly(){for(let e=0;e<this.seriesGroups.length;e++){let t=this.seriesGroups[e];if(-1===t.type.indexOf("line")&&-1===t.type.indexOf("area")&&-1===t.type.indexOf("scatter")&&-1===t.type.indexOf("bubble"))return!1}return!0}_hasColumnSeries(){let e=["column","ohlc","candlestick","waterfall"];for(let t=0;t<this.seriesGroups.length;t++){let i=this.seriesGroups[t];for(let t in e)if(-1!==i.type.indexOf(e[t]))return!0}return!1}_alignValuesWithTicks(e){let t=this._isPointSeriesOnly(),i=this.seriesGroups[e],r=this._getXAxis(e),s=void 0===r.valuesOnTicks||null===r.valuesOnTicks?t:!1!==r.valuesOnTicks;return r.logarithmicScale&&(s=!0),null==e||void 0===i.valuesOnTicks||null===i.valuesOnTicks?s:i.valuesOnTicks}_getYearsDiff(e,t){return t.getFullYear()-e.getFullYear()}_getMonthsDiff(e,t){return 12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth()}_getDateDiff(e,t,i,r){let s=0;switch("year"!==i&&"month"!==i&&(s=t.valueOf()-e.valueOf()),i){case"year":s=this._getYearsDiff(e,t);break;case"month":s=this._getMonthsDiff(e,t);break;case"day":s/=864e5;break;case"hour":s/=36e5;break;case"minute":s/=6e4;break;case"second":s/=1e3}return"year"!==i&&"month"!==i&&!1!==r&&(s=this.renderer._rnd(s,1,!0)),s}_getBestDTUnit(e,t,i,r,s){let a="day",l=t.valueOf()-e.valueOf();a=l<1e3?"second":l<36e5?"minute":l<864e5?"hour":l<2592e6?"day":l<31104e6?"month":"year";let n=[{key:"year",cnt:l/31536e6},{key:"month",cnt:l/2592e6},{key:"day",cnt:l/864e5},{key:"hour",cnt:l/36e5},{key:"minute",cnt:l/6e4},{key:"second",cnt:l/1e3},{key:"millisecond",cnt:l}],o=-1;for(let e=0;e<n.length;e++)if(n[e].key===a){o=e;break}let h=-1,d=-1;for(;o<n.length&&!(n[o].cnt/100>r);o++){let a=this._estAxisInterval(e,t,i,r,n[o].key,s),l=this._getDTIntCnt(e,t,a,n[o].key);(-1===h||h<l)&&(h=l,d=o)}return a=n[d].key,a}_getXAxisStats(e,t,i){let r=this._getDataLen(e),s="date"===t.type||"time"===t.type;if(s&&!this._autoDateFormats){this._autoDateFormats||(this._autoDateFormats=[]);let e=this._testXAxisDateFormat();e&&this._autoDateFormats.push(e)}let a=s?this._castAsDate(t.minValue,t.dateFormat):this._castAsNumber(t.minValue),l=s?this._castAsDate(t.maxValue,t.dateFormat):this._castAsNumber(t.maxValue);if(this._selectorRange&&this._selectorRange[e]){let i=this._selectorRange[e].min;isNaN(i)||(a=s?this._castAsDate(i,t.dateFormat):this._castAsNumber(i));let r=this._selectorRange[e].max;isNaN(r)||(l=s?this._castAsDate(r,t.dateFormat):this._castAsNumber(r))}let n,o,h=a,d=l,u=void 0===t.type||null===t.type||"auto"===t.type,g=u||"basic"===t.type,f=0,p=0;for(let i=0;i<r&&t.dataField;i++){let r=this._getDataValue(i,t.dataField,e);r=s?this._castAsDate(r,t.dateFormat):this._castAsNumber(r),isNaN(r)||(s?f++:p++,(isNaN(n)||r<n)&&(n=r),(isNaN(o)||r>=o)&&(o=r))}u&&(!s&&p===r||s&&f===r)&&(g=!1),g&&(n=0,o=Math.max(0,r-1)),isNaN(h)&&(h=n),isNaN(d)&&(d=o),s?(this._isDate(h)||(h=this._isDate(d)?d:new Date),this._isDate(d)||(d=this._isDate(h)?h:new Date)):(isNaN(h)&&(h=0),isNaN(d)&&(d=g?Math.max(0,r-1):h)),null==n&&(n=h),null==o&&(o=d);let c,m,y=t.rangeSelector&&t.rangeSelector.visible;if(y){let e=y.minValue||h;e&&s&&(e=this._castAsDate(e,y.dateFormat||t.dateFormat));let i=y.maxValue||d;i&&s&&(i=this._castAsDate(i,y.dateFormat||t.rangeSelector)),h<e&&(h=e),d<e&&(d=i),h>i&&(h=e),d>i&&(d=i)}s&&(c=t.baseUnit,c||(c=this._getBestDTUnit(h,d,e,i)),m="hour"===c||"minute"===c||"second"===c||"millisecond"===c);let _=!0===t.logarithmicScale,x=t.logarithmicScaleBase;(isNaN(x)||x<=1)&&(x=10);let v=t.unitInterval;_?v=1:(isNaN(v)||v<=0)&&(v=this._estAxisInterval(h,d,e,i,c));let b,N,M={min:h,max:d},A=this.seriesGroups[e];return _?(h||(h=1,d&&h>d&&(h=d)),d||(d=h),M={min:h,max:d},b=this.renderer._rnd(this._draw.log(h,x),1,!1),N=this.renderer._rnd(this._draw.log(d,x),1,!0),d=Math.pow(x,N),h=Math.pow(x,b)):s||!A.polar&&!A.spider||(h=this.renderer._rnd(h,v,!1),d=this.renderer._rnd(d,v,!0)),{min:h,max:d,logAxis:{enabled:_,base:x,minPow:b,maxPow:N},dsRange:{min:n,max:o},filterRange:M,useIndeces:g,isDateTime:s,isTimeUnit:m,dateTimeUnit:c,interval:v}}_getDefaultDTFormatFn(e){let t,i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return t="year"===e||"month"===e||"day"===e?function(e){return e.getDate()+"-"+i[e.getMonth()]+"-"+e.getFullYear()}:function(e){return e.getDate()+"-"+i[e.getMonth()]+"-"+e.getFullYear()+"<br>"+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()},t}_getDTIntCnt(e,t,i,r){let s=0,a=new Date(e),l=new Date(t);if(l=l.valueOf(),i<=0)return 1;for(;a.valueOf()<l;)"millisecond"===r?a=new Date(a.valueOf()+i):"second"===r?a=new Date(a.valueOf()+1e3*i):"minute"===r?a=new Date(a.valueOf()+6e4*i):"hour"===r?a=new Date(a.valueOf()+6e4*i*24):"day"===r?a.setDate(a.getDate()+i):"month"===r?a.setMonth(a.getMonth()+i):"year"===r&&a.setFullYear(a.getFullYear()+i),s++;return s}_estAxisInterval(e,t,i,r,s,a){if(isNaN(e)||isNaN(t))return NaN;let l=[1,2,5,10,15,20,50,100,200,500],n=0,o=r/(!isNaN(a)&&a>0?a:50);if(this._renderData&&this._renderData.length>i&&this._renderData[i].xAxis&&!isNaN(this._renderData[i].xAxis.avgWidth)){let e=Math.max(1,this._renderData[i].xAxis.avgWidth);0!==e&&isNaN(a)&&(o=.9*r/e)}if(o<=1)return Math.abs(t-e);let h,d=0;for(;h=n>=l.length?Math.pow(10,3+n-l.length):l[n],d=this._isDate(e)&&this._isDate(t)?this._getDTIntCnt(e,t,h,s):(t-e)/h,!(d<=o);)n++;let u=this.seriesGroups[i];return(u.spider||u.polar)&&2*h>t-e&&(h=t-e),h}_getPaddingSize(e,t,i,r,s,a,l){var n=e.min,o=e.max;e.logAxis.enabled&&(n=e.logAxis.minPow,o=e.logAxis.maxPow);var h=e.interval,d=e.dateTimeUnit;if(s){var u=r/Math.max(1,o-n+h)*h;return a?{left:0,right:u}:i?{left:0,right:0}:{left:u/2,right:u/2}}if(i&&!l)return{left:0,right:0};if(this._isDate(n)&&this._isDate(o)){let e=this._getDTIntCnt(n,o,Math.min(h,o-n),d),t=r/Math.max(2,e);return{left:t/2,right:t/2}}let g=Math.max(1,o-n);if(1===g){const e=r/4;return{left:e,right:e}}let f=r/(g+1);return{left:f/2,right:f/2}}_calculateXOffsets(e,t){var i=this.seriesGroups[e],r=this._getXAxis(e),s=[],a=[],l=this._getDataLen(e),n=this._getXAxisStats(e,r,t),o=n.min,h=n.max,d=n.isDateTime,u=n.isTimeUnit,g=this._hasColumnSeries(),f=i.polar||i.spider,p=this._get([i.startAngle,i.minAngle,0]),c=this._get([i.endAngle,i.maxAngle,360]),m=f&&!(Math.abs(Math.abs(c-p)-360)>1e-4),y=this._alignValuesWithTicks(e),_=this._getPaddingSize(n,r,y,t,f,m,g),x=h-o,v=n.filterRange;0===x&&(x=1);var b=t-_.left-_.right;f&&y&&!m&&(_.left=_.right=0);var N=-1,M=-1;for(let t=0;t<l;t++){var A=void 0===r.dataField?t:this._getDataValue(t,r.dataField,e);if(n.useIndeces){if(t<v.min||t>v.max){s.push(NaN),a.push(void 0);continue}if(S=_.left+(t-o)/x*b,!0===n.logAxis.enabled){var w=n.logAxis.base;S=this._smartPlot.scale(A,{min:o.valueOf(),max:h.valueOf(),type:"logarithmic",base:w},{min:0,max:b,flip:!1})}s.push(this.renderer._ptrnd(S)),a.push(A),-1===N&&(N=t),(-1===M||M<t)&&(M=t)}else if(A=d?this._castAsDate(A,r.dateFormat):this._castAsNumber(A),isNaN(A)||A<v.min||A>v.max)s.push(NaN),a.push(void 0);else{var S=0;if(!0===n.logAxis.enabled){let e=n.logAxis.base;S=this._smartPlot.scale(A,{min:o.valueOf(),max:h.valueOf(),type:"logarithmic",base:e},{min:0,max:b,flip:!1})}else S=!d||d&&u?(A-o)*b/x:(A.valueOf()-o.valueOf())/(h.valueOf()-o.valueOf())*b;S=this.renderer._ptrnd(_.left+S),s.push(S),a.push(A),-1===N&&(N=t),(-1===M||M<t)&&(M=t)}}if(!0===r.flip)for(let e=0;e<s.length;e++)isNaN(s[e])||(s[e]=t-s[e]);(u||d)&&(x=this._getDateDiff(o,h,r.baseUnit),x=this.renderer._rnd(x,1,!1));var C=Math.max(1,x),k=b/C;return N===M&&1===C&&(s[N]=_.left+b/2),{axisStats:n,data:s,xvalues:a,first:N,last:M,length:-1===M?0:M-N+1,itemWidth:k,intervalWidth:k*n.interval,rangeLength:x,useIndeces:n.useIndeces,padding:_,axisSize:b}}_getXAxis(e){return null==e||this.seriesGroups.length<=e?this.xAxis:this.seriesGroups[e].xAxis||this.xAxis}_isGreyScale(e,t){let i=this.seriesGroups[e],r=i.series[t];return!0===r.greyScale||!1!==r.greyScale&&(!0===i.greyScale||!1!==i.greyScale&&!0===this.greyScale)}_getSeriesColors(e,t,i){let r=this._getSeriesColorsInternal(e,t,i);if(this._isGreyScale(e,t))for(let e in r)r[e]=this._draw.toGreyScale(r[e]);return r}_getColorFromScheme(e,t,i){let r="#000000",s=this.seriesGroups[e],a=s.series[t];if(this._isPieGroup(e)){let l=this._getDataLen(e);r=this._getItemColorFromScheme(a.colorScheme||s.colorScheme||this.colorScheme,t*l+i,e,t)}else{let i=0;for(let r=0;r<=e;r++)for(let s=0;s<this.seriesGroups[r].series.length&&(r!==e||parseInt(s)!==t);s++)i++;let a=this.colorScheme;if(s.colorScheme&&(a=s.colorScheme),null!=a&&""!==a||(a=this.colorSchemes[0].name),!a)return r;for(let e=0;e<this.colorSchemes.length;e++){let t=this.colorSchemes[e];if(t.name===a){for(;i>t.colors.length;)i-=t.colors.length,++e>=this.colorSchemes.length&&(e=0),t=this.colorSchemes[e];r=t.colors[i%t.colors.length]}}}return r}_createColorsCache(){this._colorsCache={get:function(e){if(this._store[e])return this._store[e]},set:function(e,t){this._size<1e4&&(this._store[e]=t,this._size++)},clear:function(){this._store={},this._size=0},_size:0,_store:{}}}_getSeriesColorsInternal(e,t,i){let r=this.seriesGroups[e],s=r.series[t];"function"===(s.colorFunction,!1)&&"pie"!==r.type&&"donut"!==r.type&&(i=NaN);let a=e+"_"+t+"_"+(isNaN(i)?"NaN":i);if(this._colorsCache.get(a))return this._colorsCache.get(a);let l,n={lineColor:"#222222",lineColorSelected:"#151515",lineColorSymbol:"#222222",lineColorSymbolSelected:"#151515",fillColor:"#222222",fillColorSelected:"#333333",fillColorSymbol:"#222222",fillColorSymbolSelected:"#333333",fillColorAlt:"#222222",fillColorAltSelected:"#333333"};if("function"==typeof s.colorFunction){let t=isNaN(i)?NaN:this._getDataValue(i,s.dataField,e);if(-1===r.type.indexOf("range")||isNaN(i)||(t={from:this._getDataValue(i,s.dataFieldFrom,e),to:this._getDataValue(i,s.dataFieldTo,e)}),l=s.colorFunction(t,i,s,r),"object"==typeof l)for(let e in l)n[e]=l[e];else n.fillColor=l}else{for(let e in n)s[e]&&(n[e]=s[e]);s.fillColor||s.color?s.fillColor=s.fillColor||s.color:n.fillColor=this._getColorFromScheme(e,t,i)}let o={fillColor:{baseColor:"fillColor",adjust:1},fillColorSelected:{baseColor:"fillColor",adjust:1.1},fillColorSymbol:{baseColor:"fillColor",adjust:1},fillColorSymbolSelected:{baseColor:"fillColorSymbol",adjust:2},fillColorAlt:{baseColor:"fillColor",adjust:4},fillColorAltSelected:{baseColor:"fillColor",adjust:3},lineColor:{baseColor:"fillColor",adjust:.95},lineColorSelected:{baseColor:"lineColor",adjust:.95},lineColorSymbol:{baseColor:"lineColor",adjust:1},lineColorSymbolSelected:{baseColor:"lineColorSelected",adjust:1}};for(let e in n)"object"==typeof l&&l[e]||s[e]&&(n[e]=s[e]);for(let e in n)"object"==typeof l&&l[e]||s[e]||(n[e]=this.renderer.adjustColor(n[o[e].baseColor],o[e].adjust));return this._colorsCache.set(a,n),n}_getItemColorFromScheme(e,t,i,r){let s;for(void 0!==e&&""!==e||(e=this.colorSchemes[0].name),s=0;s<this.colorSchemes.length&&e!==this.colorSchemes[s].name;s++);let a=0;for(;a<=t;){s===this.colorSchemes.length&&(s=0);let e=this.colorSchemes[s].colors.length;if(!(a+e<=t)){let e=this.colorSchemes[s].colors[t-a];return this._isGreyScale(i,r)&&0===e.indexOf("#")&&(e=this._draw.toGreyScale(e)),e}a+=e,s++}}getColorScheme(e){for(let t=0;t<this.colorSchemes.length;t++)if(this.colorSchemes[t].name===e)return this.colorSchemes[t].colors}addColorScheme(e,t){for(let i=0;i<this.colorSchemes.length;i++)if(this.colorSchemes[i].name===e)return void(this.colorSchemes[i].colors=t);this.colorSchemes.push({name:e,colors:t})}removeColorScheme(e){for(let t=0;t<this.colorSchemes.length;t++)if(this.colorSchemes[t].name===e){this.colorSchemes.splice(t,1);break}}_formatValue(e,t,i,r,s,a){if(null==e)return"";if(this._isObject(e)&&!this._isDate(e)&&!i)return"";if(i){if("function"!=typeof i)return e.toString();try{return i(e,a,s,r)}catch(e){return e.message}}return this._isNumber(e)?this._formatNumber(e,t):this._isDate(e)?this._formatDate(e,t):t?(t.prefix||"")+e.toString()+(t.sufix||""):e.toString()}_getFormattedValue(e,t,i,r,s,a){let l=this.seriesGroups[e],n=l.series[t],o="",h=r,d=s;n.labels&&(h=h||this._getFormatSettings(n.labels),d=d||n.labels.formatFunction),h||d||(h=this._getFormatSettings(n),d=n.formatFunction,h||d||(h=this._getFormatSettings(l),d=l.formatFunction));let u={},g=0;for(let t in n)0===t.indexOf("dataField")&&(u[t.substring(9).toLowerCase()]=this._getDataValue(i,n[t],e),g++);if(0===g&&(u=this._getDataValue(i,void 0,e)),-1!==l.type.indexOf("waterfall")&&this._isSummary(e,i)&&(u=this._renderData[e].offsets[t][i].value,g=0),d&&"function"==typeof d)try{return d(1===g?u[""]:u,i,n,l)}catch(e){return e.message}if(1===g&&this._isPieGroup(e))return this._formatValue(u[""],h,d,e,t,i);if(g>0){let r=0;for(let s in u){r>0&&""!==o&&(o+="<br>");let l="dataField"+(s.length>0?s.substring(0,1).toUpperCase()+s.substring(1):""),g=n["displayText"+(s.length>0?s.substring(0,1).toUpperCase()+s.substring(1):"")]||n[l],f=u[s];void 0!==f&&(f=this._formatValue(f,h,d,e,t,i),o+=!0===a?f:g+": "+f,r++)}}else null!=u&&(o=this._formatValue(u,h,d,e,t,i));return o||""}_isNumberAsString(e){if("string"!=typeof e)return!1;e=e.trim();for(let t=0;t<e.length;t++){let i=e.charAt(t);if(!(i>="0"&&i<="9"||","===i||"."===i||"-"===i&&0===t||"("===i&&0===t||")"===i&&t===e.length-1))return!1}return!0}_castAsDate(e,t){if(e instanceof Date&&!isNaN(e))return e;if("string"==typeof e){let i=new Date(e);if(this._isDate(i))return-1===e.indexOf(":")&&i.setHours(0,0,0,0),i;try{if(t&&(i=Smart.Utilities.DateTime.parseDateString(e,void 0,t).toDate(),this._isDate(i)))return i;if(this._autoDateFormats)for(let t=0;t<this._autoDateFormats.length;t++)if(i=Smart.Utilities.DateTime.parseDateString(e,void 0,this._autoDateFormats[t]).toDate(),this._isDate(i))return i;let r=this._detectDateFormat(e);if(r&&(i=Smart.Utilities.DateTime.parseDateString(e,void 0,r).toDate(),this._isDate(i)))return this._autoDateFormats.push(r),i}catch(e){}}}_castAsNumber(e){if(e instanceof Date&&!isNaN(e))return e.valueOf();if("string"==typeof e)if(this._isNumber(e))e=parseFloat(e);else if(!/[a-zA-Z]/.test(e)){let t=new Date(e);null!=t&&(e=t.valueOf())}return isNaN(e)?void 0:e}_isNumber(e){return"string"==typeof e&&this._isNumberAsString(e)&&(e=parseFloat(e)),"number"==typeof e&&isFinite(e)}_isDate(e){return e instanceof Date&&!isNaN(e.getDate())}_isBoolean(e){return"boolean"==typeof e}_isObject(e){return e&&("object"==typeof e||"function"==typeof e)||!1}_formatDate(e,t){let i=e.toString();return t&&(t.dateFormat&&(i=new Smart.Utilities.DateTime(e).toString(t.dateFormat)),i=(t.prefix||"")+i+(t.sufix||"")),i}_formatNumber(e,t){if(!this._isNumber(e))return e;t=t||{};let i=this.localization.decimalSeparator,r=this.localization.thousandsSeparator;t.decimalSeparator&&(i=t.decimalSeparator),t.thousandsSeparator&&(r=t.thousandsSeparator);let s=t.prefix||"",a=t.sufix||"",l=t.decimalPlaces;isNaN(l)&&(l=this._getDecimalPlaces([e],void 0,3));let n=t.negativeWithBrackets||!1,o=e<0;o&&n&&(e*=-1);let h,d=e.toString(),u=Math.pow(10,l);if(d=(Math.round(e*u)/u).toString(),isNaN(d)&&(d=""),h=d.lastIndexOf("."),l>0)for(h<0?(d+=i,h=d.length-1):"."!==i&&(d=d.replace(".",i));d.length-1-h<l;)d+="0";h=d.lastIndexOf(i),h=h>-1?h:d.length;let g=d.substring(h),f=0;for(let e=h;e>0;e--,f++)f%3==0&&e!==h&&(!o||e>1||o&&n)&&(g=r+g),g=d.charAt(e-1)+g;return d=g,o&&n&&(d="("+d+")"),s+d+a}_calculateControlPoints(e,t){let i=e[t],r=e[t+1],s=e[t+2],a=e[t+3],l=e[t+4],n=e[t+5],o=Math.sqrt(Math.pow(s-i,2)+Math.pow(a-r,2)),h=o+Math.sqrt(Math.pow(l-s,2)+Math.pow(n-a,2));0===h&&(h=1);let d=.4*o/h,u=.4-d;return[s+d*(i-l),a+d*(r-n),s-u*(i-l),a-u*(r-n)]}_getBezierPoints(e){let t="",i=[],r=[],s=e.split(" ");for(let e=0;e<s.length;e++){let t=s[e].split(",");i.push(parseFloat(t[0])),i.push(parseFloat(t[1])),!isNaN(i[i.length-1])&&isNaN(i[i.length-2])}let a=i.length;if(a<=1)return"";if(2===a)return t="M"+this.renderer._ptrnd(i[0])+","+this.renderer._ptrnd(i[1])+" L"+this.renderer._ptrnd(i[0]+1)+","+this.renderer._ptrnd(i[1]+1)+" ",t;for(let e=0;e<a-4;e+=2)r=r.concat(this._calculateControlPoints(i,e));for(let e=2;e<a-5;e+=2)t+=" C"+this.renderer._ptrnd(r[2*e-2])+","+this.renderer._ptrnd(r[2*e-1])+" "+this.renderer._ptrnd(r[2*e])+","+this.renderer._ptrnd(r[2*e+1])+" "+this.renderer._ptrnd(i[e+2])+","+this.renderer._ptrnd(i[e+3])+" ";return t=a<=4||Math.abs(i[0]-i[2])<3||Math.abs(i[1]-i[3])<3?"M"+this.renderer._ptrnd(i[0])+","+this.renderer._ptrnd(i[1])+" L"+this.renderer._ptrnd(i[2])+","+this.renderer._ptrnd(i[3])+" "+t:"M"+this.renderer._ptrnd(i[0])+","+this.renderer._ptrnd(i[1])+" Q"+this.renderer._ptrnd(r[0])+","+this.renderer._ptrnd(r[1])+" "+this.renderer._ptrnd(i[2])+","+this.renderer._ptrnd(i[3])+" "+t,a>=4&&(Math.abs(i[a-2]-i[a-4])<3||Math.abs(i[a-1]-i[a-3])<3)?t+=" L"+this.renderer._ptrnd(i[a-2])+","+this.renderer._ptrnd(i[a-1])+" ":a>=5&&(t+=" Q"+this.renderer._ptrnd(r[2*a-10])+","+this.renderer._ptrnd(r[2*a-9])+" "+this.renderer._ptrnd(i[a-2])+","+this.renderer._ptrnd(i[a-1])+" "),t}_createAnimationGroup(e){this._animGroups||(this._animGroups={}),this._animGroups[e]={animations:[],startTick:NaN}}_startAnimation(e){let t=(new Date).getTime();this._animGroups[e].startTick=t,this._runAnimation(),this._enableAnimTimer()}_enqueueAnimation(e,t,i,r,s,a,l){r<0&&(r=0),void 0===l&&(l="easeInOutSine"),this._animGroups[e].animations.push({key:t,properties:i,duration:r,fn:s,context:a,easing:l})}_stopAnimations(){clearTimeout(this._animtimer),this._animtimer=void 0,this._animGroups=void 0}_enableAnimTimer(){if(!this._animtimer){let e=this;this._animtimer=setTimeout((function(){e._runAnimation()}),this._animTickInt)}}_runAnimation(){if(this._animGroups){let e=(new Date).getTime(),t={};for(let i in this._animGroups){let r=this._animGroups[i].animations,s=this._animGroups[i].startTick,a=0;for(let t=0;t<r.length;t++){let i=r[t],l=e-s;i.duration>a&&(a=i.duration);let n=i.duration>0?l/i.duration:1,o=n;if(i.easing&&0!==i.duration&&!1!==i.duration&&(o=Smart.Utilities.Animation.Easings[i.easing](l,0,1,i.duration)),n>1&&(n=1,o=1),i.fn){i.fn(i.key,i.context,o);continue}let h={};for(let e=0;e<i.properties.length;e++){let t=i.properties[e],r=0;r=1===n?t.to:o*(t.to-t.from)+t.from,h[t.key]=r}this.renderer.attr(i.key,h)}s+a>e&&(t[i]={startTick:s,animations:r})}this._animGroups=t,this.renderer instanceof Smart.Utilities.HTML5Renderer&&this.renderer.refresh()}this._animtimer=null,Object.values(this._animGroups).length>0&&this._enableAnimTimer()}_fixCoords(e,t){if("horizontal"!==this.seriesGroups[t].orientation)return e;var i=e.x;return e.x=e.y,e.y=i+this._plotRect.y-this._plotRect.x,i=e.width,e.width=e.height,e.height=i,e}getItemCoord(e,t,i){var r=this;if(r._isPieGroup(e)&&(!r._isSerieVisible(e,t,i)||!r._renderData||r._renderData.length<=e))return{x:NaN,y:NaN};if(!r._isSerieVisible(e,t)||!r._renderData||r._renderData.length<=e)return{x:NaN,y:NaN};var s=r.seriesGroups[e],a=s.series[t],l=r._getItemCoord(e,t,i);if(r._isPieGroup(e)){if(isNaN(l.x)||isNaN(l.y)||isNaN(l.fromAngle)||isNaN(l.toAngle))return{x:NaN,y:NaN};var n=this._plotRect,o=l.fromAngle*(Math.PI/180),h=l.toAngle*(Math.PI/180);const e=n.x+l.center.x+Math.cos(o)*l.outerRadius,t=n.x+l.center.x+Math.cos(h)*l.outerRadius,i=n.y+l.center.y-Math.sin(o)*l.outerRadius,r=n.y+l.center.y-Math.sin(h)*l.outerRadius;var d=Math.min(e,t),u=Math.abs(t-e);return l={x:d,y:Math.min(i,r),width:u,height:Math.abs(r-i),center:l.center,centerOffset:l.centerOffset,innerRadius:l.innerRadius,outerRadius:l.outerRadius,selectedRadiusChange:l.selectedRadiusChange,fromAngle:l.fromAngle,toAngle:l.toAngle}}if(-1!==s.type.indexOf("column")||-1!==s.type.indexOf("waterfall")){var g=this._getColumnSerieWidthAndOffset(e,t);l.height=Math.abs(l.y.to-l.y.from),l.y=Math.min(l.y.to,l.y.from),l.x+=g.offset,l.width=g.width}else if(-1!==s.type.indexOf("ohlc")||-1!==s.type.indexOf("candlestick")){let i=this._getColumnSerieWidthAndOffset(e,t),r=l.y;var f=Math.min(r.Open,r.Close,r.Low,r.High),p=Math.max(r.Open,r.Close,r.Low,r.High);l.height=Math.abs(p-f),l.y=f,l.x+=i.offset,l.width=i.width}else if(-1!==s.type.indexOf("line")||-1!==s.type.indexOf("area"))l.width=l.height=0,l.y=l.y.to;else if(-1!==s.type.indexOf("bubble")||-1!==s.type.indexOf("scatter")){l.center={x:l.x,y:l.y.to};var c=l.y.radius;"circle"!==a.symbolType&&void 0!==a.symbolType&&null!==a.symbolType&&(c/=2),l.y=l.y.to,l.radius=c,l.width=2*c,l.height=2*c}if(l=this._fixCoords(l,e),s.polar||s.spider){var m=this._toPolarCoord(this._renderData[e].polarCoords,this._plotRect,l.x,l.y);l.x=m.x,l.y=m.y,l.center&&(l.center=this._toPolarCoord(this._renderData[e].polarCoords,this._plotRect,l.center.x,l.center.y))}return-1===s.type.indexOf("bubble")&&-1===s.type.indexOf("scatter")||(l.x-=c,l.y-=c),l}_getItemCoord(e,t,i){let r,s,a=this.seriesGroups[e];if(!a||!this._renderData)return{x:NaN,y:NaN};if(!a.series[t])return{x:NaN,y:NaN};let l=this._plotRect;if(this._isPieGroup(e)){let a=this._renderData[e].offsets[t][i];if(!a)return{x:NaN,y:NaN};let n=(a.fromAngle+a.toAngle)/2*(Math.PI/180);return r=l.x+a.x+Math.cos(n)*a.outerRadius,s=l.y+a.y-Math.sin(n)*a.outerRadius,{x:r,y:s,center:{x:a.x,y:a.y},centerOffset:a.centerOffset,innerRadius:a.innerRadius,outerRadius:a.outerRadius,selectedRadiusChange:a.selectedRadiusChange,fromAngle:a.fromAngle,toAngle:a.toAngle}}if(r=l.x+this._renderData[e].xoffsets.data[i],s=this._renderData[e].offsets[t][i],isNaN(r)||!s)return{x:NaN,y:NaN};let n={};for(let e in s)n[e]=s[e];return{x:r,y:n}}getXAxisValue(e,t){var i=this.seriesGroups[t];if(i){var r=this._getXAxis(t),s=this._plotRect,a=0,l=NaN,n=this._renderData[0].xoffsets.axisStats,o=0,h=0;if(i.polar||i.spider){if(isNaN(e.x)||isNaN(e.y))return NaN;var d=this._getPolarAxisCoords(t,s);if(this.renderer._ptdist(e.x,e.y,d.x,d.y)>d.r)return NaN;var u=Math.atan2(d.y-e.y,e.x-d.x);(u=Math.PI/2-u)<0&&(u=2*Math.PI+u),l=u*d.r;var g=d.startAngle+Math.PI/2,f=d.endAngle+Math.PI/2;o=g*d.r,h=f*d.r,a=(f-g)*d.r;var p=this._getPaddingSize(n,r,r.valuesOnTicks,a,!0,d.isClosedCircle,this._hasColumnSeries());d.isClosedCircle?(a-=p.left+p.right,h-=p.left+p.right):r.valuesOnTicks||(o+=p.left,h-=p.right)}else{if("horizontal"!==i.orientation){if(e<s.x||e>s.x+s.width)return NaN;l=e-s.x,a=s.width}else{if(e<s.y||e>s.y+s.height)return NaN;l=e-s.y,a=s.height}if(this._renderData[t]&&this._renderData[t].xoffsets){let e=this._renderData[t].xoffsets.padding;a-=e.left+e.right,l-=e.left}h=a}return this._smartPlot.scale(l,{min:o,max:h},{min:n.min.valueOf(),max:n.max.valueOf(),type:n.logAxis.enabled?"logarithmic":"linear",base:n.logAxis.base,flip:r.flip})}}getValueAxisValue(e,t){let i=this.seriesGroups[t];if(!i)return;let r=this._getValueAxis(t),s=this._plotRect,a=0,l=NaN;if(i.polar||i.spider){if(isNaN(e.x)||isNaN(e.y))return NaN;let i=this._getPolarAxisCoords(t,s);l=this.renderer._ptdist(e.x,e.y,i.x,i.y),a=i.r,l=a-l}else if("horizontal"===i.orientation){if(e<s.x||e>s.x+s.width)return NaN;l=e-s.x,a=s.width}else{if(e<s.y||e>s.y+s.height)return NaN;l=e-s.y,a=s.height}let n=this._stats.seriesGroups[t];return this._smartPlot.scale(l,{min:0,max:a},{min:n.min.valueOf(),max:n.max.valueOf(),type:n.logarithmic?"logarithmic":"linear",base:n.logBase,flip:!r.flip})}_detectDateFormat(e,t){let i={en_US_d:"M/d/yyyy",en_US_D:"dddd, MMMM dd, yyyy",en_US_t:"h:mm tt",en_US_T:"h:mm:ss tt",en_US_f:"dddd, MMMM dd, yyyy h:mm tt",en_US_F:"dddd, MMMM dd, yyyy h:mm:ss tt",en_US_M:"MMMM dd",en_US_Y:"yyyy MMMM",en_US_S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",en_CA_d:"dd/MM/yyyy",en_CA_D:"MMMM-dd-yy",en_CA_f:"MMMM-dd-yy h:mm tt",en_CA_F:"MMMM-dd-yy h:mm:ss tt",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",de_DE_d:"dd.MM.yyyy",de_DE_D:"dddd, d. MMMM yyyy",de_DE_t:"HH:mm",de_DE_T:"HH:mm:ss",de_DE_f:"dddd, d. MMMM yyyy HH:mm",de_DE_F:"dddd, d. MMMM yyyy HH:mm:ss",de_DE_M:"dd MMMM",de_DE_Y:"MMMM yyyy",fr_FR_d:"dd/MM/yyyy",fr_FR_D:"dddd d MMMM yyyy",fr_FR_t:"HH:mm",fr_FR_T:"HH:mm:ss",fr_FR_f:"dddd d MMMM yyyy HH:mm",fr_FR_F:"dddd d MMMM yyyy HH:mm:ss",fr_FR_M:"d MMMM",fr_FR_Y:"MMMM yyyy",it_IT_d:"dd/MM/yyyy",it_IT_D:"dddd d MMMM yyyy",it_IT_t:"HH:mm",it_IT_T:"HH:mm:ss",it_IT_f:"dddd d MMMM yyyy HH:mm",it_IT_F:"dddd d MMMM yyyy HH:mm:ss",it_IT_M:"dd MMMM",it_IT_Y:"MMMM yyyy",ru_RU_d:"dd.MM.yyyy",ru_RU_D:"d MMMM yyyy '?.'",ru_RU_t:"H:mm",ru_RU_T:"H:mm:ss",ru_RU_f:"d MMMM yyyy '?.' H:mm",ru_RU_F:"d MMMM yyyy '?.' H:mm:ss",ru_RU_Y:"MMMM yyyy",cs_CZ_d:"d.M.yyyy",cs_CZ_D:"d. MMMM yyyy",cs_CZ_t:"H:mm",cs_CZ_T:"H:mm:ss",cs_CZ_f:"d. MMMM yyyy H:mm",cs_CZ_F:"d. MMMM yyyy H:mm:ss",cs_CZ_M:"dd MMMM",cs_CZ_Y:"MMMM yyyy",he_IL_d:"dd MMMM yyyy",he_IL_D:"dddd dd MMMM yyyy",he_IL_t:"HH:mm",he_IL_T:"HH:mm:ss",he_IL_f:"dddd dd MMMM yyyy HH:mm",he_IL_F:"dddd dd MMMM yyyy HH:mm:ss",he_IL_M:"dd MMMM",he_IL_Y:"MMMM yyyy",hr_HR_d:"d.M.yyyy.",hr_HR_D:"d. MMMM yyyy.",hr_HR_t:"H:mm",hr_HR_T:"H:mm:ss",hr_HR_f:"d. MMMM yyyy. H:mm",hr_HR_F:"d. MMMM yyyy. H:mm:ss",hr_HR_M:"d. MMMM",hu_HU_d:"yyyy.MM.dd.",hu_HU_D:"yyyy. MMMM d.",hu_HU_t:"H:mm",hu_HU_T:"H:mm:ss",hu_HU_f:"yyyy. MMMM d. H:mm",hu_HU_F:"yyyy. MMMM d. H:mm:ss",hu_HU_M:"MMMM d.",hu_HU_Y:"yyyy. MMMM",jp_JP_d:"gg y/M/d",jp_JP_D:"gg y'?'M'?'d'?'",jp_JP_t:"H:mm",jp_JP_T:"H:mm:ss",jp_JP_f:"gg y'?'M'?'d'?' H:mm",jp_JP_F:"gg y'?'M'?'d'?' H:mm:ss",jp_JP_M:"M'?'d'?'",jp_JP_Y:"gg y'?'M'?'",lt_LT_d:"yyyy.MM.dd",lt_LT_D:"yyyy 'm.' MMMM d 'd.'",lt_LT_t:"HH:mm",lt_LT_T:"HH:mm:ss",lt_LT_f:"yyyy 'm.' MMMM d 'd.' HH:mm",lt_LT_F:"yyyy 'm.' MMMM d 'd.' HH:mm:ss",lt_LT_M:"MMMM d 'd.'",lt_LT_Y:"yyyy 'm.' MMMM",sa_IN_d:"dd-MM-yyyy",sa_IN_D:"dd MMMM yyyy dddd",sa_IN_t:"HH:mm",sa_IN_T:"HH:mm:ss",sa_IN_f:"dd MMMM yyyy dddd HH:mm",sa_IN_F:"dd MMMM yyyy dddd HH:mm:ss",sa_IN_M:"dd MMMM",basic_y:"yyyy",basic_ym:"yyyy-MM",basic_d:"yyyy-MM-dd",basic_dhm:"yyyy-MM-dd hh:mm",basic_bhms:"yyyy-MM-dd hh:mm:ss",basic2_ym:"MM-yyyy",basic2_d:"MM-dd-yyyy",basic2_dhm:"MM-dd-yyyy hh:mm",basic2_dhms:"MM-dd-yyyy hh:mm:ss",basic3_ym:"yyyy/MM",basic3_d:"yyyy/MM/dd",basic3_dhm:"yyyy/MM/dd hh:mm",basic3_bhms:"yyyy/MM/dd hh:mm:ss",basic4_ym:"MM/yyyy",basic4_d:"MM/dd/yyyy",basic4_dhm:"MM/dd/yyyy hh:mm",basic4_dhms:"MM/dd/yyyy hh:mm:ss"};t&&(i=Object.assign({},i,t));let r=[];Array.isArray(e)?r=e:r.push(e);for(let e in i)i[e]={format:i[e],count:0};for(let e=0;e<r.length;e++){const t=r[e];if(null!=t)for(let e in i)try{(t instanceof Date||Smart.Utilities.DateTime.parseDateString(t,void 0,i[e].format))&&i[e].count++}catch(e){}}let s={key:void 0,count:0};for(let e in i)i[e].count>s.count&&(s.key=e,s.count=i[e].count);return s.key?i[s.key].format:""}_testXAxisDateFormat(e){let t=this,i=t._getXAxis(e),r=t._getDataLen(e),s={};if(t.localization.patterns)for(let e in t.localization.patterns)s["local_"+e]=t.localization.patterns[e];let a=[];for(let s=0;s<r&&s<10;s++){const r=t._getDataValue(s,i.dataField,e);null!=r&&a.push(r)}return t._detectDateFormat(a,s)}_getThemeColor(e){if("light"===this.theme)switch(e){case"background":return"#FFFFFF";case"line":return"#BCBCBC";case"band":return"#AAAAAA"}switch(e){case"background":return"#2E2E2E";case"line":return"#707070";case"band":return"#565656"}}});
|
|
36
36
|
Smart.Chart&&(Smart.Chart.prototype._moduleAnnotations=!0,Smart.Chart.prototype._renderAnnotation=function(t,e){const i=this.seriesGroups[t],a=this.renderer;if(isNaN(t))return;let s=this._get([this.getXAxisDataPointOffset(e.xValue,t),e.x]),o=this._get([this.getValueAxisDataPointOffset(e.yValue,t),e.y]),n=this._get([this.getXAxisDataPointOffset(e.xValue2,t),e.x2]),r=this._get([this.getValueAxisDataPointOffset(e.yValue2,t),e.y2]);if(i.polar||i.spider){const i=this.getPolarDataPointOffset(e.xValue,e.yValue,t);!i||isNaN(i.x)||isNaN(i.y)?(s=e.x,o=e.y):(s=i.x,o=i.y)}if(isNaN(o)||isNaN(s))return!1;if("horizontal"===i.orientation){let t=s;s=o,o=t,t=n,n=r,r=t}e.offset&&(isNaN(e.offset.x)||(s+=e.offset.x,n+=e.offset.x),isNaN(e.offset.y)||(o+=e.offset.y,r+=e.offset.y));const l=this._get([e.width,n-s]),f=this._get([e.height,r-o]);let c,h;switch(e.type){case"rect":c=a.rect(s,o,l,f);break;case"circle":c=a.rect(s,o,e.radius);break;case"line":c=a.rect(s,o,n,r);break;case"path":c=a.path(e.path)}if(c&&a.attr(c,{fill:e.fillColor,stroke:e.lineColor,opacity:this._get([e.fillOpacity,e.opacity]),"stroke-opacity":this._get([e.lineOpacity,e.opacity]),"stroke-width":e.lineWidth,"stroke-dasharray":e.dashStyle||"none"}),e.text){const t=e.text;let i=0,n=0;t.offset&&(isNaN(t.offset.x)||(i+=t.offset.x),isNaN(t.offset.y)||(n+=t.offset.y)),h=a.text(t.value,s+i,o+n,NaN,NaN,t.angle,{},!0===t.clip,t.horizontalAlignment||"center",t.verticalAlignment||"center",t.rotationPoint||"centermiddle"),a.attr(h,{fill:t.fillColor,stroke:t.lineColor,class:"smart-chart-annotation-text "+(t.class||"")})}const y=["click","mouseenter","mouseleave"],p=this;for(let t=0;t<y.length;t++){const i=y[t];c&&this.renderer.addHandler(c,i,(function(){p._raiseAnnotationEvent(e,i)})),h&&this.renderer.addHandler(h,i,(function(){p._raiseAnnotationEvent(e,i)}))}},Smart.Chart.prototype._raiseAnnotationEvent=function(t,e){this.$.fireEvent("annotation"+e.charAt(0).toUpperCase()+e.slice(1),{annotation:t})});
|
|
37
37
|
Smart.Chart&&(Smart.Chart.prototype._moduleApi=!0,Smart.Chart.prototype.getItemsCount=function(t,e){const r=this.seriesGroups[t];if(!this._isSerieVisible(t,e))return 0;const i=this._renderData;return!r||!i||i.length<=t?0:r.series[e]?i[t].offsets[e].length:0},Smart.Chart.prototype.getXAxisRect=function(t){const e=this._renderData;if(e&&!(e.length<=t)&&e[t].xAxis)return e[t].xAxis.rect},Smart.Chart.prototype.getXAxisLabels=function(t){const e=[];let r=this._renderData;if(!r||r.length<=t)return e;if(r=r[t].xAxis,!r)return e;const i=this.seriesGroups[t];if(i.polar||i.spider){for(let t=0;t<r.polarLabels.length;t++){const i=r.polarLabels[t];e.push({offset:{x:i.x,y:i.y},value:i.value})}return e}const s=this._getXAxis(t),o=this.getXAxisRect(t),a="top"===s.position||"right"===s.position,n="horizontal"===i.orientation;for(let t=0;t<r.data.length;t++)n?e.push({offset:{x:o.x+(a?0:o.width),y:o.y+r.data.data[t]},value:r.data.xvalues[t]}):e.push({offset:{x:o.x+r.data.data[t],y:o.y+(a?o.height:0)},value:r.data.xvalues[t]});return e},Smart.Chart.prototype.getValueAxisRect=function(t){const e=this._renderData;if(e&&!(e.length<=t)&&e[t].valueAxis)return e[t].valueAxis.rect},Smart.Chart.prototype.getValueAxisLabels=function(t){const e=[];let r=this._renderData;if(!r||r.length<=t)return e;if(r=r[t].valueAxis,!r)return e;const i=this._getValueAxis(t),s="top"===i.position||"right"===i.position,o=this.seriesGroups[t],a="horizontal"===o.orientation;if(o.polar||o.spider){for(let t=0;t<r.polarLabels.length;t++){const i=r.polarLabels[t];e.push({offset:{x:i.x,y:i.y},value:i.value})}return e}for(let t=0;t<r.items.length;t++)a?e.push({offset:{x:r.itemOffsets[r.items[t]].x+r.itemWidth/2,y:r.rect.y+(s?r.rect.height:0)},value:r.items[t]}):e.push({offset:{x:r.rect.x+r.rect.width,y:r.itemOffsets[r.items[t]].y+r.itemWidth/2},value:r.items[t]});return e},Smart.Chart.prototype.getPlotAreaRect=function(){return this._plotRect},Smart.Chart.prototype.getRect=function(){return this._rect},Smart.Chart.prototype.showToolTip=function(t,e,r,i,s){const o=this.getItemCoord(t,e,r);isNaN(o.x)||isNaN(o.y)||this._startTooltipTimer(t,e,r,o.x,o.y,i,s)},Smart.Chart.prototype.hideToolTip=function(t){isNaN(t)&&(t=0);const e=this;e._cancelTooltipTimer(),setTimeout((function(){e._hideToolTip(0)}),t)});
|
|
38
38
|
Smart.Chart&&(Smart.Chart.prototype._moduleRangeSelector=!0,Smart.Chart.prototype._renderXAxisRangeSelector=function(e,t){const i=this,r=i.seriesGroups[e],s=i._getXAxis(e),o=s?s.rangeSelector:void 0;if(!i._isSelectorRefresh){const e=(o&&o.renderTo?o.renderTo:i).getElementsByClassName("smart-chart-range-selector")[0];e&&e.parentElement.removeChild(e)}if(!s||!1===s.visible||"spider"===r.type)return!1;if(!i._isGroupVisible(e))return!1;if(!o)return!1;let a="horizontal"===r.orientation;o.renderTo&&(a=!1),i.rightToLeft&&(s.flip=!0);let l=a?i.offsetHeight:i.offsetWidth;l-=4;const n=this._getXAxisStats(e,s,l);let h=s.position;if(o.renderTo&&o.position&&(h=o.position),!this._isSelectorRefresh){const i=o.renderTo,r=document.createElement("div");if(r.className="smart-chart-range-selector smart-unselectable",r.style.position="absolute",r.style.backgroundColor="transparent",r.style.onselectstart=function(){return!1},i)i.appendChild(r),r.style.width=i.offsetWidth+"px",r.style.height=i.offsetHeight+"px",t.width=i.offsetWidth,t.height=i.offsetHeight;else{this.renderer.getContainer().appendChild(r);const e=this._selectorGetSize(s);a?(r.style.left=1+t.x+("right"!==h?-e:t.width)+"px",r.style.top="0",r.style.height=l+"px",r.style.width=e+"px",t.height=e):(r.style.left="2px",r.style.top=t.y+("top"!==h?t.height:-e)+"px",r.style.height=e+"px",r.style.width=l-1+"px")}r.parentDiv=r.parentElement,this._refreshSelector(e,s,n,r,t,a)}return this._isSelectorRefresh=!1,!0},Smart.Chart.prototype._refreshSelector=function(e,t,i,r,s,o){const a=this,l={},n=t.rangeSelector;for(let e in n)l[e]=n[e];delete l.padding;let h=l.minValue,d=l.maxValue;isNaN(h)&&(h=Math.min(i.min.valueOf(),i.dsRange.min.valueOf())),isNaN(d)&&(d=Math.max(i.max.valueOf(),i.dsRange.max.valueOf())),this._isDate(i.min)&&(h=new Date(h)),this._isDate(i.max)&&(d=new Date(d));let p=t.position;n.renderTo&&n.position&&(p=n.position),l.dataField=t.dataField,delete l.rangeSelector,l.type=t.type,l.baseUnit=null!==n.baseUnit?n.baseUnit:t.baseUnit,l.minValue=h,l.maxValue=d,l.flip=t.flip,l.position=p;let g=2,u=2,c=2,f=2;n.renderTo||(g=o?0:s.x,u=o?0:this._rect.width-s.x-s.width,c=o?s.y:5,f=o?this._paddedRect.height-this._plotRect.height:5);let m=n.padding;m=null!=m||n.renderTo?{left:m&&m.left?m.left:g,top:m&&m.top?m.top:c,right:m&&m.right?m.right:u,bottom:m&&m.bottom?m.bottom:f}:{left:g,top:c,right:u,bottom:f};let x=n.dataField;for(let e=0;null==x&&e<this.seriesGroups.length;e++)for(let t=0;null==x&&t<this.seriesGroups[e].series.length;t++)x=this.seriesGroups[e].series[t].dataField;const y={parentChart:this,padding:m,_isRangeSelectorInstance:!0,theme:this.theme,caption:n.caption,description:n.description,titlePadding:n.titlePadding,colorScheme:n.colorScheme||this.colorScheme,backgroundColor:n.backgroundColor||this.backgroundColor||a._getThemeColor("background"),backgroundImage:n.backgroundImage,showBorderLine:null!==n.showBorderLine?n.showBorderLine:!!n.renderTo,borderLineWidth:n.borderLineWidth||this.borderLineWidth,borderLineColor:n.borderLineColor||this.borderLineColor||a._getThemeColor("line"),rightToLeft:null!==n.rightToLeft?n.rightToLeft:this.rightToLeft,greyScale:null!==n.greyScale?n.greyScale:this.greyScale,renderEngine:this.renderEngine,showLegend:!1,animation:"none",enableEvents:!1,showToolTips:!1,dataSource:this.dataSource,xAxis:l,seriesGroups:[{orientation:o?"horizontal":"vertical",valueAxis:{visible:!1},type:n.serieType,skipOverlappingPoints:n.skipOverlappingPoints,columnSeriesOverlap:n.columnSeriesOverlap,columnsGapPercent:n.columnsGapPercent,seriesGapPercent:n.seriesGapPercent,series:[{dataField:x,opacity:.8,lineWidth:1}]}]};n.seriesGroups&&(y.seriesGroups=n.seriesGroups),n.valueAxis.visible&&(y.valueAxis=n.valueAxis),y.showBorderLine||(y.borderLineWidth=1,y.borderLineColor=a._get([this.backgroundColor,this.background,a._getThemeColor("background")]),y.showBorderLine=!0),a._supressBindingRefresh=!0,r.innerHTML="";const _=document.createElement("smart-chart");_.rightToLeft=a.rightToLeft,_.parentDiv=r;for(let e in y)_[e]=y[e];r.appendChild(_),a._rangeSelectorInstances[e]=_,a._supressBindingRefresh=!1;const S=function(){if(!_._plotRect)return;const t=_._paddedRect;if(t.height=_._plotRect.height,o||"top"!==p){if(o){const e=_._renderData[0].xAxis.rect.width;t.width-=e,"right"!==p&&(t.x+=e)}}else t.y+=_._renderData[0].xAxis.rect.height;if(a._createSliderElements(e,r,t,n,{min:l.minValue,max:l.maxValue}),a._rangeSelectorEventData={groupIndex:e,renderTo:r,swapXY:o},a.hasAttribute("aria-owns")){const e=a.getAttribute("aria-owns");a.setAttribute("aria-owns",e+" "+_.id)}else a.setAttribute("aria-owns",_.id)};_.isRendered?S():_.whenRendered((()=>{S()}))},Smart.Chart.prototype._createSliderElements=function(e,t,i,r,s){const o=this,a=t.getElementsByClassName("slider")[0];a&&a.parentElement.removeChild(a);const l=r.selectedRangeColor||"blue",n=o._get([r.selectedRangeOpacity,.1]),h=o._get([r.unselectedRangeOpacity,.5]),d=r.unselectedRangeColor||"white",p=r.rangeLineColor||"grey",g=document.createElement("div");for(g.className="slider",g.style.position="absolute",g.style.background=l,g.style.opacity=n,g.style.left=i.x+"px",g.style.top=i.y+"px",g.style.width=i.width+"px",g.style.height=i.height+"px",t.appendChild(g);this._sliders.length<e+1;)this._sliders.push({});function u(e,t){const i=document.createElement("div");return i.className="slider",i.style.position="absolute",i.style.background=e,i.style.opacity=t,i}function c(){const e=document.createElement("div");return e.className="slider",e.style.position="absolute",e.style.background="#FFFFFF",e.style.borderStyle="solid",e.style.borderWidth="1px",e.style.borderRadius="3px",e.style.borderColor=p,e.setAttribute("role","slider"),e.setAttribute("aria-controls",o.id),e}const f=g.getBoundingClientRect(),m=t.getBoundingClientRect();this._sliders[e]={element:g,host:t.firstElementChild,_sliderInitialAbsoluteRect:{x:f.left,y:f.top,width:i.width,height:i.height},_hostInitialAbsolutePos:{x:m.left,y:m.top},getRect:function(){const e=t.getBoundingClientRect();return{x:e.left-this._hostInitialAbsolutePos.x+this._sliderInitialAbsoluteRect.x,y:e.top-this._hostInitialAbsolutePos.y+this._sliderInitialAbsoluteRect.y,width:this._sliderInitialAbsoluteRect.width,height:this._sliderInitialAbsoluteRect.height}},rect:i,left:u(d,h),right:u(d,h),leftTop:u(p,h),rightTop:u(p,h),leftBorder:u(p,h),leftBar:c(),rightBorder:u(p,h),rightBar:c()};const x=this._sliders[e];t.appendChild(x.left),t.appendChild(x.right),t.appendChild(x.leftTop),t.appendChild(x.rightTop),t.appendChild(x.leftBorder),t.appendChild(x.rightBorder),t.appendChild(x.leftBar),t.appendChild(x.rightBar);const y=this._renderData[e].xAxis.data.axisStats,_=y.min.valueOf(),S=y.max.valueOf();"number"==typeof y.min?(x.leftBar.setAttribute("aria-valuemin",s.min),x.leftBar.setAttribute("aria-valuemax",s.max),x.leftBar.setAttribute("aria-valuenow",_),x.rightBar.setAttribute("aria-valuemin",s.min),x.rightBar.setAttribute("aria-valuemax",s.max),x.rightBar.setAttribute("aria-valuenow",S)):(x.leftBar.setAttribute("aria-valuemin",s.min.getTime()),x.leftBar.setAttribute("aria-valuemax",s.max.getTime()),x.leftBar.setAttribute("aria-valuenow",y.min.getTime()),x.leftBar.setAttribute("aria-valuetext",y.min.toLocaleString()),x.rightBar.setAttribute("aria-valuemin",s.min.getTime()),x.rightBar.setAttribute("aria-valuemax",s.max.getTime()),x.rightBar.setAttribute("aria-valuenow",y.max.getTime()),x.rightBar.setAttribute("aria-valuetext",y.max.toLocaleString()));let b=this._valueToOffset(e,_),v=this._valueToOffset(e,S);if(b>v){const e=v;v=b,b=e}"horizontal"!==this.seriesGroups[e].orientation?(g.style.left=Math.round(i.x+b)+"px",g.style.top=i.y+"px",g.style.width=Math.round(v-b)+"px",g.style.height=i.height+"px"):(g.style.left=i.x+"px",g.style.top=Math.round(i.y+b)+"px",g.style.width=i.width+"px",g.style.height=Math.round(v-b)+"px"),this._setSliderPositions(e,b,v)},Smart.Chart.prototype._setSliderPositions=function(e,t,i){const r=this.seriesGroups[e],s=this._getXAxis(e),o=s.rangeSelector;let a="horizontal"===r.orientation;s.rangeSelector.renderTo&&(a=!1);let l=s.position;o.renderTo&&o.position&&(l=o.position);const n=this._sliders[e],h=a?"top":"left",d=a?"left":"top",p=a?"height":"width",g=a?"width":"height",u=a?"y":"x",c=a?"x":"y",f=n.rect;n.startOffset=t,n.endOffset=i,n.left.style[h]=f[u]+"px",n.left.style[d]=f[c]+"px",n.left.style[p]=t+"px",n.left.style[g]=f[g]+"px",n.right.style[h]=f[u]+i+"px",n.right.style[d]=f[c]+"px",n.right.style[p]=f[p]-i+1+"px",n.right.style[g]=f[g]+"px",n.leftTop.style[h]=f[u]+"px",n.leftTop.style[d]=f[c]+(a&&"right"===l||!a&&"top"!==l?0:f[g])+"px",n.leftTop.style[p]=t+"px",n.leftTop.style[g]="1px",n.rightTop.style[h]=f[u]+i+"px",n.rightTop.style[d]=f[c]+(a&&"right"===l||!a&&"top"!==l?0:f[g])+"px",n.rightTop.style[p]=f[p]-i+1+"px",n.rightTop.style[g]="1px",n.leftBorder.style[h]=f[u]+t+"px",n.leftBorder.style[d]=f[c]+"px",n.leftBorder.style[p]="1px",n.leftBorder.style[g]=f[g]+"px";let m=f[g]/4;m>20&&(m=20),m<3&&(m=3),n.leftBar.style[h]=f[u]+t-3+"px",n.leftBar.style[d]=f[c]+f[g]/2-m/2+"px",n.leftBar.style[p]="5px",n.leftBar.style[g]=m+"px",n.rightBorder.style[h]=f[u]+i+"px",n.rightBorder.style[d]=f[c]+"px",n.rightBorder.style[p]="1px",n.rightBorder.style[g]=f[g]+"px",n.rightBar.style[h]=f[u]+i-3+"px",n.rightBar.style[d]=f[c]+f[g]/2-m/2+"px",n.rightBar.style[p]="5px",n.rightBar.style[g]=m+"px"},Smart.Chart.prototype._resizeState={},Smart.Chart.prototype._onSliderMouseDown=function(e){e.stopImmediatePropagation(),e.stopPropagation();const t=this;t._sliders[t._rangeSelectorEventData.groupIndex]&&(void 0!==t._resizeState.state&&null!==t._resizeState.state||t._testAndSetReadyResize(e),"ready"===t._resizeState.state&&(t._draggingRangeSelector=!0,t._resizeState.state="resizing"))},Smart.Chart.prototype._valueToOffset=function(e,t){const i=this.seriesGroups[e],r=this._sliders[e],s=r.host._renderData[0].xAxis.data.axisStats,o=s.min.valueOf();let a=s.max.valueOf()-o;0===a&&(a=1);const l=this._getXAxis(e),n="horizontal"===i.orientation?"height":"width",h=(t.valueOf()-o)/a;return r.getRect()[n]*(l.flip?1-h:h)},Smart.Chart.prototype._offsetToValue=function(e,t){const i=this._sliders[e],r=this.seriesGroups[e],s=this._getXAxis(e),o="horizontal"===r.orientation?"height":"width";let a=i.getRect()[o];0===a&&(a=1);const l=i.host._renderData[0].xAxis.data.axisStats,n=l.min.valueOf(),h=l.max.valueOf();let d=t/a*(h-n)+n;return!0===s.flip&&(d=h-t/a*(h-n)),this._isDate(l.min)||this._isDate(l.max)?d=new Date(d):((void 0===s.dataField||null===s.dataField||l.useIndeces)&&(d=Math.round(d)),d<l.min&&(d=l.min),d>l.max&&(d=l.max)),d},Smart.Chart.prototype._onSliderMouseUp=function(e){const t=this,i=t._rangeSelectorEventData.groupIndex,r=t._rangeSelectorEventData.swapXY,s=t._sliders[i];if(delete t._draggingRangeSelector,!s)return;if("resizing"!==t._resizeState.state)return;e.stopImmediatePropagation(),e.stopPropagation(),t._resizeState={},t.style.cursor="default";const o=r?"top":"left",a=r?"y":"x",l=s.element.getBoundingClientRect()[o],n=l+(r?s.element.offsetHeight:s.element.offsetWidth),h=s.getRect();let d=t._offsetToValue(i,l-h[a]),p=t._offsetToValue(i,n-h[a]);!s.host._renderData[0].xAxis.data.axisStats.isTimeUnit&&p.valueOf()-d.valueOf()>864e5&&(d.setHours(0,0,0,0),p.setDate(p.getDate()+1),p.setHours(0,0,0,0));const g=t._getXAxis(i);if(g.flip){const e=d;d=p,p=e}for(let e=0;e<t.seriesGroups.length;e++)t._getXAxis(e)===g&&(t._selectorRange[e]={min:d,max:p});t._isSelectorRefresh=!0;const u=t.animation;t.$.fireEvent("rangeSelectionChanging",{instance:t,minValue:d,maxValue:p}),t.animation="none",t.update(),t.animation=u,t.$.fireEvent("rangeSelectionChanged",{instance:t,minValue:d,maxValue:p}),"number"==typeof d?(s.leftBar.setAttribute("aria-valuenow",d),s.rightBar.setAttribute("aria-valuenow",p)):(s.leftBar.setAttribute("aria-valuenow",d.getTime()),s.leftBar.setAttribute("aria-valuetext",d.toLocaleString()),s.rightBar.setAttribute("aria-valuenow",p.getTime()),s.rightBar.setAttribute("aria-valuetext",p.toLocaleString()))},Smart.Chart.prototype._onSliderMouseMove=function(e){const t=this,i=t._rangeSelectorEventData.groupIndex,r=t._sliders[i],s=t._rangeSelectorEventData.swapXY;if(!r)return;const o=r.getRect(),a=r.element,l={left:e.clientX,top:e.clientY},n=a.getBoundingClientRect(),h=s?"top":"left",d=parseFloat(getComputedStyle(a)[h]),p=s?"height":"width",g=s?"y":"x";if("resizing"===t._resizeState.state){if(e.stopImmediatePropagation(),e.stopPropagation(),"left"===t._resizeState.side){let e=Math.round(l[h]-n[h]),t=o[g];if(n[h]+e>=t&&n[h]+e<=t+o[p]){let t=parseInt(d),i=Math.max(2,(s?a.offsetHeight:a.offsetWidth)-e);a.style[p]=i+"px",a.style[h]=t+e+"px"}}else if("right"===t._resizeState.side){let e=s?a.offsetHeight:a.offsetWidth,t=Math.round(l[h]-n[h]-e),i=o[g];if(n[h]+e+t>=i&&n[h]+t+e<=i+o[p]){let i=Math.max(2,e+t);a.style[p]=i+"px"}}else if("move"===t._resizeState.side){let e=s?a.offsetHeight:a.offsetWidth,i=parseInt(d),r=Math.round(l[h]-t._resizeState.startPos);n[h]+r>=o[g]&&n[h]+r+e<=o[g]+o[p]&&(t._resizeState.startPos=l[h],a.style[h]=i+r+"px")}const u=parseInt(d)-r.rect[g],c=u+(s?a.offsetHeight:a.offsetWidth);t._setSliderPositions(i,u,c)}else t._testAndSetReadyResize(e)},Smart.Chart.prototype._testAndSetReadyResize=function(e){const t=this,i=t._rangeSelectorEventData,r=i.renderTo,s=i.groupIndex,o=t._sliders[s],a=i.swapXY,l=o.getRect(),n=o.element,h={left:e.clientX,top:e.clientY},d=n.getBoundingClientRect(),p=a?"left":"top",g=a?"top":"left",u=a?"width":"height",c=t._isTouchDevice?30:5;h[p]>=d[p]&&h[p]<=d[p]+l[u]?Math.abs(h[g]-d[g])<=c?(r.style.cursor=a?"row-resize":"col-resize",t._resizeState={state:"ready",side:"left"}):Math.abs(h[g]-d[g]-(a?n.offsetHeight:n.offsetWidth))<=c?(r.style.cursor=a?"row-resize":"col-resize",t._resizeState={state:"ready",side:"right"}):h[g]+c>d[g]&&h[g]-c<d[g]+(a?n.offsetHeight:n.offsetWidth)?(r.style.cursor="pointer",t._resizeState={state:"ready",side:"move",startPos:h[g]}):(r.style.cursor="default",t._resizeState={}):(r.style.cursor="default",t._resizeState={})},Smart.Chart.prototype._selectorGetSize=function(e){return e.rangeSelector.renderTo?0:e.rangeSelector.size||this._paddedRect.height/3});
|
|
@@ -98,7 +98,7 @@ Smart("smart-tree-item",class extends Smart.MenuItem{static get properties(){ret
|
|
|
98
98
|
Smart("smart-text-area",class extends Smart.Input{template(){return'<div id="inputContainer" role="presentation"><textarea class="smart-input" id=\'input\' readonly=\'[[readonly]]\' placeholder=\'[[placeholder]]\' name=\'[[name]]\' value=\'{{value::keyup}}\' disabled=\'[[disabled]]\' aria-label="[[placeholder]]"></textarea><span class="smart-hidden smart-hint" inner-h-t-m-l="[[hint]]" id="span"></span><div id="dropDownButton" tabindex=-1 class="smart-drop-down-button" role="button" aria-label="Toggle popup"><div id="arrow" class="arrow" aria-hidden="true"></div></div></div>'}render(){super.render(),this.classList.add("smart-input")}});
|
|
99
99
|
Smart("smart-sortable",class extends Smart.ContentElement{static get properties(){return{disableMode:{value:"auto",allowedValues:["auto","manual"],type:"string"},dragMode:{value:"item",allowedValues:["item","handle"],type:"string"},handlePosition:{value:"right",allowedValues:["right","left","top","bottom"],type:"string"},handleVisibility:{value:"hover",allowedValues:["hover","visible"],type:"string"},items:{value:null,type:"string?"},mode:{value:"vertical",allowedValues:["horizontal","vertical"],type:"string"}}}static get listeners(){return{contextmenu:"_preventDefault","container.down":"_containerDownHandler","container.move":"_containerMoveHandler","container.transitionend":"_containerTransitionendHandler","document.dragstart":"_preventDefault","document.move":"_documentMoveHandler","document.selectstart":"_preventDefault","document.up":"_documentUpHandler"}}static get styleUrls(){return["smart.sortable.css"]}template(){return'<div id="container" class="smart-sortable-container" role="presentation" inner-h-t-m-l=\'[[innerHTML]]\'><content></content></div>'}move(e,t){const o=this,i=o._items;if(isNaN(e)||isNaN(t)||e===t||e<0||e>=i.length||t<0||t>=i.length)return;const n=i[e],s=i[t];e>t?o._itemsParent.insertBefore(n,s):o._itemsParent.insertBefore(n,s.nextElementSibling),o._getItems(!1)}updateItems(){this._items.forEach((e=>e.classList.remove("smart-sortable-item"))),this._getItems()}propertyChangedHandler(e,t,o){super.propertyChangedHandler(e,t,o);const i=this;switch(e){case"disabled":i._originallyDisabled=o,i._items.length<2&&"auto"===i.disableMode&&(i.disabled=!0);break;case"items":i._itemsParent.classList.remove("smart-sortable-items-parent"),i.updateItems();break;case"mode":i._setSettingsObject()}}ready(){super.ready();const e=this;e.setAttribute("role","group"),e._originallyDisabled=e.disabled,e._getItems(),e._setSettingsObject()}_getItems(e){const t=this;if(null===t.items?t._items=Array.from(t.$.container.children):t._items=Array.from((t.shadowRoot||t).querySelectorAll(".smart-sortable-container "+t.items)),t._items=t._items.filter((e=>!e.hasAttribute("disable-drag"))),!1!==e&&(t._items.forEach((e=>e.classList.add("smart-sortable-item"))),t._items.length)){if(t._itemsParent=t._items[0].parentElement,t._itemsParent.classList.add("smart-sortable-items-parent"),t.parents)for(let e=0;e<t.parents.length;e++)if(t.parents[e]instanceof HTMLElement&&t.parents[e].classList.contains("smart-sort-panel"))return void("auto"===t.disableMode&&(t.disabled=t._originallyDisabled));"auto"===t.disableMode&&(t._items.length<2?t.disabled=!0:t.disabled=t._originallyDisabled)}}_setSettingsObject(){const e=this;"vertical"===e.mode?e._settings={coordinateName:"y",dimension:"height",offsetDimension:"offsetHeight",startOffset:"top",endOffset:"bottom"}:e._settings={coordinateName:"x",dimension:"width",offsetDimension:"offsetWidth",startOffset:"left",endOffset:"right"}}_preventDefault(e){this._draggedItem&&e.preventDefault()}_containerDownHandler(e){const t=this;if(t.disabled||t._draggedItem)return;const o=(t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest(".smart-sortable-item");if(!o)return;const i=e.pageX-window.scrollX,n=e.pageY-window.scrollY,s=o.getBoundingClientRect(),r=getComputedStyle(o),a=parseFloat(r.marginLeft),l=parseFloat(r.marginTop);if("handle"!==t.dragMode||!(e.originalEvent.target!==document.elementFromPoint(e.clientX,e.clientY)||i>=s.left&&i<=s.right&&n>=s.top&&n<=s.bottom)){if("handle"===t.dragMode){const t=e.originalEvent.composedPath();for(let e=1;e<t.length;e++)if(t[e].classList&&t[e].classList.contains("smart-sortable-item"))return}window.getSelection().removeAllRanges(),t._draggedItem=o,t._positionPlaceholder(),t._getPositionedAncestorCoords(),o.style.width=o.offsetWidth+"px",o.style.height=o.offsetHeight+"px",o.style.left=s.left-a+(-t._positionedAncestorCoords.x||window.scrollX)+"px",o.style.top=s.top-l+(-t._positionedAncestorCoords.y||window.scrollY)+"px",o.classList.add("dragged"),t._clickOffset={x:e.pageX-s.left+a,y:e.pageY-s.top+l},t._prevCoords={x:i,y:n},t._getItemCoordinates()}}_positionPlaceholder(){const e=this,t=e._draggedItem,o=getComputedStyle(t),i=document.createElement("div");i.className="smart-sortable-item placeholder smart-visibility-hidden",i.style.width=t.offsetWidth+"px",i.style.height=t.offsetHeight+"px",i.style.minHeight=t.offsetHeight+"px",i.style.marginBottom=o.marginBottom,i.style.marginLeft=o.marginLeft,i.style.marginRight=o.marginRight,i.style.marginTop=o.marginTop,e._itemsParent.insertBefore(i,t.nextElementSibling),e._placeholder=i}_getPositionedAncestorCoords(){const e=this,t=e.offsetParent;if(e._positionedAncestorCoords={x:0,y:0},t!==document.body){const o=t.getBoundingClientRect();e._positionedAncestorCoords={x:o.left,y:o.top}}}_getItemCoordinates(){const e=[];this._items.forEach((function(t){const o=t.getBoundingClientRect();e.push({left:o.left,top:o.top,right:o.right,bottom:o.bottom,width:o.width,height:o.height})})),this._coordinates=e}_containerMoveHandler(e){this._draggedItem&&"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_containerTransitionendHandler(e){const t=this;t._draggedItem&&e.target.classList.contains("smart-sortable-item")&&(e.target.classList.contains("returning")?t._resolveDragging():t._getItemCoordinates())}_documentMoveHandler(e){const t=this,o=t._draggedItem;if(!o)return;const i=t._settings,n={x:e.pageX-window.scrollX,y:e.pageY-window.scrollY},s=n[i.coordinateName];let r;if(t._prevCoords.x===n.x&&t._prevCoords.y===n.y)return;t.hasAttribute("dragged")||t.setAttribute("dragged",""),r=t._prevCoords[i.coordinateName]>s?"up":"down",t._prevCoords=n,o.style.top=e.pageY-t._clickOffset.y+(-t._positionedAncestorCoords.y||window.scrollY)+"px",o.style.left=e.pageX-t._clickOffset.x+(-t._positionedAncestorCoords.x||window.scrollX)+"px";const a=t._items.indexOf(o);let l;for(let e=0;e<t._coordinates.length;e++){const o=t._coordinates[e];if(a!==e){if("down"===r&&s>=o[i.startOffset]+o[i.dimension]/2&&s<=o[i.endOffset]){l=t._items[e];break}if("up"===r&&s>=o[i.startOffset]&&s<=o[i.startOffset]+o[i.dimension]/2){l=t._items[e];break}}}if(l){if(l!==t._prevOverItem){if(t._prevOverItem=l,l[r])return;const e=t._items.indexOf(l);if(t._overItem=l,l.up||l.down)l.style.transform=null,delete l.up,delete l.down;else{if("horizontal"===t.mode&&("up"===r&&(!t.rightToLeft&&e>a||t.rightToLeft&&e<a)||"down"===r&&(!t.rightToLeft&&e<a||t.rightToLeft&&e>a)))return;if("vertical"===t.mode&&("up"===r&&e>a||"down"===r&&e<a))return;const o=getComputedStyle(l);l.style.transform=`translate${i.coordinateName.toUpperCase()}(${("up"===r?1:-1)*(l[i.offsetDimension]+parseFloat(o["margin-"+i.startOffset])+parseFloat(o["margin-"+i.endOffset]))}px)`,l[r]=!0}}}else delete t._prevOverItem}_documentUpHandler(){const e=this,t=e._draggedItem;if(!t)return;let o=e._overItem;if(o){const i=e._items.indexOf(t),n=e._items.indexOf(o);i<n&&o[e.rightToLeft&&"horizontal"===e.mode?"up":"down"]||i>n&&!o.down&&!o.up?(e._insertBefore=o.nextElementSibling,o=e._insertBefore,o&&o.nextElementSibling===t&&(o=e._placeholder)):(i>n&&o[e.rightToLeft&&"horizontal"===e.mode?"down":"up"]||i<n&&!o.down&&!o.up)&&(e._insertBefore=o,i>n&&o[e.rightToLeft&&"horizontal"===e.mode?"down":"up"]||(o=o.previousElementSibling||o))}else o=e._placeholder;e._resolveDragging()}_resolveDragging(){const e=this,t=e._draggedItem,o=e._items.indexOf(t);let i=!1;t.classList.remove("dragged","returning"),e._removeInlineStyle(),void 0!==e._insertBefore&&e._items.indexOf(e._insertBefore)!==o&&e._insertBefore!==e._placeholder[e.rightToLeft&&"horizontal"===e.mode?"previousElementSibling":"nextElementSibling"]&&(e._itemsParent.insertBefore(t,e._insertBefore),delete e._insertBefore,i=!0),e._itemsParent.removeChild(e._placeholder),delete e._clickOffset,delete e._draggedItem,delete e._overItem,delete e._placeholder,delete e._prevCoords,e.removeAttribute("dragged"),i&&(e._getItems(!1),e.$.fireEvent("dragEnd",{oldIndex:o,newIndex:e._items.indexOf(t)}))}_removeInlineStyle(){const e=this;e._items.forEach((function(e){e.style=null,e.style.transition="none",delete e.up,delete e.down})),setTimeout((function(){e._items.forEach((e=>e.style.transition=null))}),50)}});
|
|
100
100
|
Smart("smart-table",class extends Smart.ContentElement{static get properties(){return{autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},columnGroups:{value:null,type:"array?"},columnMinWidth:{value:"50px",type:"any"},columnReorder:{value:!1,type:"boolean"},columnResize:{value:!1,type:"boolean"},columnResizeFeedback:{value:!1,type:"boolean"},columnResizeNormalize:{value:!1,type:"boolean"},columns:{value:[],type:"any?",reflectToAttribute:!1},columnSizeMode:{value:"default",allowedValues:["auto","default"],type:"string"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},conditionalFormattingButton:{value:!1,type:"boolean"},deferredScrollDelay:{value:1,type:"number"},dataRowId:{value:null,type:"string?"},dataSource:{value:null,type:"any?",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},sanitizeHTMLRender:{value:"text",allowedValues:["text","html"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},dataTransform:{value:null,type:"function?",reflectToAttribute:!1},editing:{value:!1,type:"boolean"},editMode:{value:"cell",allowedValues:["cell","row"],type:"string"},expandHierarchy:{value:!1,type:"boolean"},filtering:{value:!1,type:"boolean"},columnMenu:{value:!1,type:"boolean"},filterRow:{value:!1,type:"boolean"},filterTemplate:{value:null,type:"string?"},filterOperator:{value:"and",type:"string?"},footerRow:{value:null,type:"string?"},formulas:{value:!1,type:"boolean"},freezeFooter:{value:!1,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},grouping:{value:!1,type:"boolean"},groupFormatFunction:{value:null,type:"any"},headerRow:{value:null,type:"any"},hideSelectionColumn:{value:!1,type:"boolean"},keyboardNavigation:{value:!1,type:"boolean"},loadColumnStateBehavior:{value:"implementationOnly",allowedValues:["stateOnly","implementationOnly","intersection"],type:"string"},messages:{value:{en:{add:"Add condition",all:"All columns",apply:"Apply",between:"Between",cancel:"Cancel",clearFilter:"Clear filter",close:"Close",column:"Column:",condition:"Condition:",conditionalFormatting:"Conditional Formatting",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",equal:"Equal To",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filterCondition:"Filter condition",filterPlaceholder:"Filter",firstButton:"First",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",formatColumn:"Format Column",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",greaterThan:"Greater Than",highlight:"Highlight",invalidValue:"Invalid value",itemsPerPage:"Items per page:",lastButton:"Last",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",lessThan:"Less Than",nextButton:"Next",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",notEqual:"Not Equal To",NULL:"null",ok:"OK",previousButton:"Previous",remove:"Remove condition",secondValue:"Second value:",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",summaryPrefix:"of",text:"Text",value:"Value:",with:"with",columnMenuItemSortAsc:"Sort Ascending",columnMenuItemSortDesc:"Sort Descending",columnMenuItemReset:"Reset",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Show rows where:",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemColumns:"Columns",grouping:"Group field name is not found in the dataFields collection!"}},type:"object",extend:!0},onCellRender:{value:null,type:"function?",reflectToAttribute:!1},onColumnRender:{value:null,type:"function?",reflectToAttribute:!1},onUpdateComplete:{value:null,type:"function?",reflectToAttribute:!1},onInit:{value:null,type:"function?",reflectToAttribute:!1},onLoad:{value:null,type:"function?",reflectToAttribute:!1},pageSize:{value:10,allowedValues:[10,25,50],type:"int"},pageIndex:{value:0,type:"int"},paging:{value:!1,type:"boolean"},rowDetailTemplate:{value:null,type:"string?"},selected:{value:[],type:"array",reflectToAttribute:!1},selection:{value:!1,type:"boolean"},selectionMode:{value:"many",type:"string",allowedValues:["one","many","extended"]},selectionByHierarchy:{value:!0,type:"boolean"},sort:{value:null,type:"function?",reflectToAttribute:!1},sortMode:{value:"none",type:"string",allowedValues:["none","one","many"]},stateSettings:{value:["columns","expanded","filtered","grouped","selected","sorted"],type:"array"},tooltip:{value:!1,type:"boolean"},virtualization:{value:!1,type:"boolean"}}}static get listeners(){return{resize:"_resizeHandler","conditionalFormattingButton.click":"_conditionalFormattingButtonClickHandler","filterInput.keyup":"_filterInputKeyupHandler","pager.change":"_pagerChangeHandler","pager.pageSizeChanged":"_pagerPageSizeChanged","tableContainer.change":"_tableContainerChangeHandler","tableContainer.click":"_tableContainerClickHandler","tableContainer.down":"_tableContainerDownHandler","tableContainer.focus":"_tableContainerFocusHandler","tableContainer.pointerover":"_tableContainerPointeroverHandler","document.down":"_documentDownHandler","document.keydown":"_tableContainerKeydownHandler","document.keyup":"_tableContainerKeyupHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler"}}template(){return Smart.Templates[this.nodeName]&&delete Smart.Templates[this.nodeName],this.virtualization?'<div id="container" class="smart-container" role="presentation">\n <div id="header" class="smart-table-header" role="toolbar">\n <smart-input id="filterInput" class="underlined" animation="[[animation]]" locale="[[locale]]" right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-input>\n <div id="filterTemplateContainer" class="smart-table-filter-template-container smart-hidden"></div>\n <smart-button id="conditionalFormattingButton" class="smart-table-toolbar-button conditional-formatting" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" aria-label="Conditional Formatting"></smart-button>\n </div>\n <smart-scroll-viewer style="opacity: 0.99" id="virtualizationContainer" class="smart-table-virtualization-container" right-to-left="[[rightToLeft]]" theme="[[theme]]">\n <table id="tableContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-table-container">\n <content></content>\n </table>\n </smart-scroll-viewer>\n <smart-pager id="pager" animation="[[animation]]" locale="[[locale]]" page-index="[[pageIndex]]" page-size="[[pageSize]]" pages-count="null" show-first-last-navigation-buttons show-page-size-selector show-prev-next-navigation-buttons show-summary right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-pager>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" aria-label="Loading">\n <span id="loadingIndicator" class="smart-loader" role="presentation"></span>\n </div>\n </div>':'<div id="container" class="smart-container" role="presentation">\n <div id="header" class="smart-table-header" role="toolbar">\n <smart-input id="filterInput" class="underlined" animation="[[animation]]" locale="[[locale]]" right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-input>\n <div id="filterTemplateContainer" class="smart-table-filter-template-container smart-hidden"></div>\n <smart-button id="conditionalFormattingButton" class="smart-table-toolbar-button conditional-formatting" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" aria-label="Conditional Formatting"></smart-button>\n </div>\n <table id="tableContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-table-container">\n <content></content>\n </table>\n <smart-pager id="pager" animation="[[animation]]" locale="[[locale]]" page-index="[[pageIndex]]" page-size="[[pageSize]]" pages-count="null" show-first-last-navigation-buttons show-page-size-selector show-prev-next-navigation-buttons show-summary right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-pager>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" aria-label="Loading">\n <span id="loadingIndicator" class="smart-loader" role="presentation"></span>\n </div>\n </div>'}resetState(e){const t=this;switch(e){case"expanded":t._expandedIds=[],t._state.expanded=[];break;case"selected":t._selectedIds=[],t._disabledSelection=[],t._selectableGroupRecords=[],t.set("selected",[]),t._state.selected=[];break;default:t._dblclickObject={numberOfClicks:0},t._expandedIds=[],t._selectedIds=[],t._disabledSelection=[],t._selectableGroupRecords=[],t._state={expanded:[],selected:[],sorted:[]},t.set("selected",[])}}render(){this._render(),super.render()}_render(){const e=this,t=getComputedStyle(e);if(e.setAttribute("role","presentation"),e.$.tableContainer.id=e.id+"TableContainer",e._cachedWidth=e.offsetWidth,e._cachedHeight=e.offsetHeight,e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)},e._isMobile=Smart.Utilities.Core.isMobile,e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?8:Smart.Utilities.Core.Browser.Edge?16:4,e._dblclickObject={numberOfClicks:0},e._expandedIds=[],e._selectedIds=[],e._disabledSelection=[],e._selectableGroupRecords=[],e._state={expanded:[],selected:[],sorted:[]},e._rowHeight=parseFloat(t.getPropertyValue("--smart-table-row-height")),e._rowDetailHeight=parseFloat(t.getPropertyValue("--smart-table-row-detail-height")),e._animation=e.animation,e._setFocusable(),e.selection&&e.$.tableContainer.setAttribute("aria-multiselectable",!0),e.virtualization){const t=e.$.virtualizationContainer,a=e;t&&(t._mouseWheelHandler=function(e){const l=t;if(!l.disabled&&(l.computedHorizontalScrollBarVisibility||l.computedVerticalScrollBarVisibility)){if(e.shiftKey&&l.computedHorizontalScrollBarVisibility){const t=l.scrollLeft;if(0===t&&e.deltaX<0||t===l.scrollHeight&&e.deltaX>0)return;return e.stopPropagation(),e.preventDefault(),void(l.scrollWidth>0&&l.scrollTo(void 0,l.scrollLeft+l._getScrollCoefficient(e,l.offsetWidth)))}if(l.computedVerticalScrollBarVisibility){const t=l.scrollTop;if(0===t&&e.deltaY<0||t===l.scrollHeight&&e.deltaY>0)return;if(e.stopPropagation(),e.preventDefault(),l.scrollHeight>0){let t=3*a._rowHeight;e.deltaY<=0&&(t=-3*a._rowHeight),Math.abs(e.deltaY)>=100?l.scrollTop+=t:l.scrollTop+=e.deltaY}}}},t._verticalScrollbarHandler=function(t){0===e.deferredScrollDelay?e._onVerticalChange(t):(e._verticalScrollTimer&&(clearTimeout(e._verticalScrollTimer),delete e._verticalScrollTimer),e._verticalScrollTimer=setTimeout((()=>{e._onVerticalChange(t),delete e._verticalScrollTimer}),e.deferredScrollDelay))}),t.hasStyleObserver=!1,t.$.verticalScrollBar.hasStyleObserver=!1,t.$.horizontalScrollBar.hasStyleObserver=!1,e.freezeHeader=!0,e.freezeFooter=!0}e.isRendered?e.innerHTML&&e.innerHTML.trim().length>1?e._initDataSourceFromHTML():e._fullRefresh():(e._createElement(),setTimeout((()=>{const t=e.querySelectorAll("tr[row-id]");if(t.length>0){let a=!1;for(let l=0;l<t.length;l++){const i=t[l];e._rowHeight<i.offsetHeight&&(e._rowHeight=i.offsetHeight,a=!0)}a&&(e.style.setProperty("--smart-table-row-height",e._rowHeight+"px"),e._refreshDataRows())}e.onLoad&&e.onLoad()}),500),e.columnMenu&&(e._initialState=e.getState()),super.render())}_initDataSourceFromHTML(){const e=this,t=e.context;e.context=e,e.hasAttribute("smart-blazor")&&(e.$.tableContainer.innerHTML="");const a=e.columns;e.dataSource=null,e.rows=null,e.columns=null;const l=e.querySelectorAll("th");let i=[],n=[],r=[];for(let e=0;e<l.length;e++){const t=l[e].innerHTML.trim();let a={label:t,dataField:t,dataType:"string"};i.push(a),n.push(t)}if(0===l.length&&a&&a.length>0)for(let e=0;e<a.length;e++){const t=a[e];let l={label:t.label,dataField:t.dataField,dataType:t.dataType};t.width&&(l.width=t.width),t.allowResize&&(l.allowResize=t.allowResize),t.allowFilter&&(l.allowFilter=t.allowFilter),t.allowSort&&(l.allowSort=t.allowSort),t.allowHide&&(l.allowHide=t.allowHide),t.allowMenu&&(l.allowMenu=t.allowMenu),t.freeze&&(l.freeze=t.freeze),t.responsivePriority&&(l.responsivePriority=t.responsivePriority),t.columnGroup&&(l.columnGroup=t.columnGroup),i.push(l),n.push({name:t.dataField,dataType:t.dataType})}const o=e.querySelectorAll("tr");for(let e=0;e<o.length;e++){const t={},a=o[e].querySelectorAll("td");if(a.length>0){for(let e=0;e<i.length;e++)t[i[e].dataField]=a[e].innerHTML.trim();r.push(t)}}const s=new Smart.DataAdapter({dataSource:r,expandHierarchy:e.expandHierarchy,dataFields:n,id:e.dataRowId});e.$.tableContainer.innerHTML="",e.columns=i,e.context=t,e.dataSource=s}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog)),e.isRendered&&e.isCompleted&&e.endUpdate()}detached(){const e=this;if(super.detached(),e._focusedCell&&!e.$.tableContainer.contains(e._focusedCell)&&delete e._focusedCell,!e._dialog)return;e._detachCachedTemplates();const t=e._dialog;t.removeEventListener("change",e._dialogEventHandler),t.removeEventListener("clear",e._dialogEventHandler),t.removeEventListener("click",e._dialogEventHandler),t.removeEventListener("close",e._dialogEventHandler),t.removeEventListener("filter",e._dialogEventHandler),t.remove()}addFilter(e,t){const a=this,l=a.columnByDataField[e];"string"==typeof t?t=a.dataSource._createFilter(l.dataType,[t]):Array.isArray(t)&&(t=a.dataSource._createFilter(l.dataType,t)),l&&!1!==l.allowFilter&&t instanceof Smart.Utilities.FilterGroup!=0&&(e=l.dataField,a._clearSortByRow&&a._clearSortByRow(!0),a._designerFiltersApplied&&a._clearDesignerFilters(),a._filterInfo.appliedFilters||(a._filterInfo.appliedFilters={}),a._filterInfo.appliedFilters[e]=t,a._refreshFilters("add"),l.headerCellElement&&l.headerCellElement.setAttribute("filter",""),a.$.filterInput&&t&&!a.filterRow&&!a.columnMenu&&(a.$.filterInput.value=t.filters[t.filters.length-1].value,a._filterInfo.query=a.$.filterInput.value),a._originalDynamicColumnsOrder&&(a._originalDynamicColumnsOrder=a._dynamicColumns.map((e=>e.id))))}addGroup(e){const t=this;if(!t.grouping)return;const a=t.columnByDataField[e];if(!a||!1===a.allowGroup)return;const l=t.dataSource,i=l.groupBy;e=a.dataField,-1===i.indexOf(e)&&(i.push(e),l.refreshHierarchy(),t._getSelectableGroupRecords(),t._fullRefresh(),t._updateState("grouped"),t._doNotFireEvent||t.$.fireEvent("group",{action:"add",dataField:e}))}beginEdit(e,t){const a=this;if(!a.editing)return;const l=a.columnByDataField[t];if(t=l?l.dataField:void 0,"cell"===a.editMode&&!t||l&&!1===l.allowEdit)return;const i=a.rowById[e];if(!i)return;const n=i.data.$.id;a._editing&&a.endEdit(),a._beginEdit({rowId:n,rowObject:i,dataField:t})}cancelEdit(){const e=this,t=e._editing;if(t){for(let a=0;a<t.cells.length;a++){const l=t.cells[a];l.editor.contains(e.getRootNode().activeElement)&&e._focusCell(l.element),l.editor.remove(),e._setCellContent(l.element,e._formatCellValue(t.row,e.columnByDataField[l.dataField],l.element)),l.element.classList.remove("editing")}delete e._editing}}clearFilters(e=null){const t=this,a=t._filterInfo;(a.inputFilters||a.rowFilters||a.appliedFilters)&&(t._clearFilterInput(),t._clearRowFilters(e),delete t._filterInfo.appliedFilters,t.dataSource.virtualDataSource||t.dataSource.clearFilter(),t._fullRefresh("filter"),t._updateState("filtered"),t._doNotFireEvent||t.$.fireEvent("filter",{action:"remove"}))}clearGrouping(){const e=this,t=e.dataSource;0!==t.groupBy.length&&(t.groupBy=[],t.refreshHierarchy(),e._getSelectableGroupRecords(),e._fullRefresh(),e._updateState("grouped"),e.$.fireEvent("group",{action:"remove"}))}clearSelection(){this._clearSelection(!0)}collapseAllRows(){const e=this;e._isExpandCollapseForbidden()||function t(a){for(let l=0;l<a.length;l++){const i=a[l];i.leaf||(i.children&&t(i.children),i.expanded&&e.collapseRow(i.$.id))}}(e["smart-table"===e.nodeName.toLowerCase()?"dataSource":"rows"].boundHierarchy)}collapseGroup(e){const t=this;if(!t.grouping||0===t.dataSource.groupBy.length)return;const a=t._getGroupByIndex(e);if(!a||!a.expanded)return;const l=t.$.tableContainer.querySelector(`tr[row-id="${a.$.id}"]:not([unused])`);if(!l){a.expanded=!1;let e=a.$.id;return null==e?void t.refresh():e.replace?(e=e.replace("Item","").replace(/_/gi,"."),void t.$.fireEvent("group",{action:"collapse",path:e,dataField:a.groupDataField,label:a.label})):(t.refresh(),void t.$.fireEvent("group",{action:"collapse",path:e,dataField:a.groupDataField,label:a.label}))}if(t._isCollapsed(a))return l.setAttribute("aria-expanded",!1),l.classList.remove("expanded"),void(a.expanded=!1);t._hierarchyArrowClickHandler(l)}collapseRow(e){const t=this;if(t._isExpandCollapseForbidden())return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e],l=a.data||a;if(!a||l.leaf||!l.expanded)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);return i?t._isCollapsed(l)?(i.setAttribute("aria-expanded",!1),i.classList.remove("expanded"),l.expanded=!1,t._expandedIds=t._expandedIds.filter((e=>e!==l.$.id)),t._updateState("expanded"),void t.$.fireEvent("collapse",{record:l})):void t._hierarchyArrowClickHandler(i):(l.expanded=!1,t._expandedIds=t._expandedIds.filter((e=>e!==l.$.id)),void t._updateState("expanded"))}collapseRowDetails(e){const t=this;if(!t.rowDetailTemplate)return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e],l=a.data||a;if(!a||!l)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);if(!i)return;const n=i.nextElementSibling;n&&n.classList.contains("smart-table-row-detail")&&!n.classList.contains("collapsed")&&t._toggleRowDetail(i,l.$.id)}collapseAllRowDetails(){const e=this;if(!e.rowDetailTemplate||!e.dataSource)return;let t=e.dataSource.boundSource;t||(t=e.$.tableContainer.querySelectorAll("tr[row-id]:not([unused])"));for(let a=0;a<t.length;a++)e.collapseRowDetails(t[a].$.id)}expandAllRowDetails(){const e=this;if(!e.rowDetailTemplate||!e.dataSource)return;let t=e.dataSource.boundSource;t||(t=e.$.tableContainer.querySelectorAll("tr[row-id]:not([unused])"));for(let a=0;a<t.length;a++)e.expandRowDetails(t[a].$.id)}updateRow(e,t,a){const l=this,i=l.rowById?l.rowById[e]:l.rows.dataItemById[e];if(!i)return;const n=l._selectedIds.slice(0);l._editing=!0,l.__updatedRows=!0;let r=[];l.dataSource&&l.dataSource.groupBy&&l.dataSource.groupBy.toArray&&(r=l.dataSource.groupBy.toArray().slice(0));const o=l.dataSource.boundSource.canNotify;l.dataSource.boundSource.canNotify=!1;const s=e=>{if(i.data[e]=t[e],l.dataSource.id&&i&&i.data&&i.data.$&&(i.data.$.id=t[l.dataSource.id]),i&&i.data.$&&void 0!==i.data.$.index){const a=i.data.$.index,n=l.dataSource.dataSource,o=()=>{const a=t[e];if(null==a){const t=l.columnByDataField[e];return t?"number"===t.dataType?0:"boolean"!==t.dataType&&("date"===t.dataType?new Date:""):""}return a};if(n&&n[a]&&(n[a][e]=o()),l.dataSource[a]){if(r.length>0&&!l._dirtyHierarchy&&l.dataSource[a][e]!==o()&&r.indexOf(e)>=0){const e=l._getExpandedGroups(l.dataSource.boundHierarchy);l._dirtyHierarchy=e}l.dataSource[a][e]=o()}}};for(let e=0;e<l.columns.length;e++){const a=l.columns[e];void 0!==t[a.dataField]&&s(a.dataField)}if(a){const e=l.dataSource.dataFields;if(e)for(let t=0;t<e.length;t++)e[t].map?s(e[t].map):s(e[t].name)}l._editing=!1,l.dataSource.boundSource.canNotify=o,l.__updating||(l.dataSource.refreshHierarchy(),l._fullRefresh(void 0,n,"update"))}addRow(e){const t=this;let a=[];const l=t.dataSource.boundSource.canNotify;if(t.dataSource.boundSource.canNotify=!1,t._editing=!0,t.__updatedRows=!0,t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.toArray&&(a=t.dataSource.groupBy.toArray().slice(0),a.length>0&&t.dataSource.beginUpdate()),a.length>0)t.dataSource?t.dataSource.add(e,!0):t._addNewRow(e,0);else if(t.dataSource)if(t.dataSource.boundHierarchy&&t.$.tableContainer&&"treegrid"===t.$.tableContainer.getAttribute("role")){const a=e[t.dataSource.parentDataField];t.dataSource.add(e,a)}else t.dataSource.add(e,!0);else t._addNewRow(e,0);t.dataSource.boundSource.canNotify=l,t._editing=!1,t._updateSelectAllState(),a.length>0||t.dataSource.boundHierarchy&&t.$.tableContainer&&"treegrid"===t.$.tableContainer.getAttribute("role")?(t._dataSourceUpdatingTimer&&clearTimeout(t._dataSourceUpdatingTimer),t._dataSourceUpdatingTimer=setTimeout((()=>{t._doNotFireEvent=!0;const e=t._getExpandedGroups(t.dataSource.boundHierarchy);a.forEach((e=>t.addGroup(e))),t.dataSource.endUpdate(),t._restoreExpandedGroups(e),t._fullRefresh("update"),t._doNotFireEvent=!1}),50)):(t._dataSourceUpdatingTimer&&clearTimeout(t._dataSourceUpdatingTimer),t._dataSourceUpdatingTimer=setTimeout((()=>{t._doNotFireEvent=!0,t._fullRefresh("update"),t._doNotFireEvent=!1})))}removeRow(e){const t=this,a=t.rowById?t.rowById[e]:t.rows.dataItemById[e];if(!a){if(t.dataSource&&t.dataSource.dataItemById){const a=t.dataSource.dataItemById[e];if(a){const l=void 0!==a.$?a.$.index:0;t.dataSource.removeAt(l),t._selectedIds.indexOf(e)>=0&&(t._selectedIds.splice(t._selectedIds.indexOf(e),1),t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:"remove"})),t.virtualization&&t.__updating||t._fullRefresh("update")}}return}const l=a.data||a,i=void 0!==l.$?l.$.index:0,n=t.dataSource.boundSource.canNotify;t.dataSource.boundSource.canNotify=!1,t._editing=!0,t.__updatedRows=!0;let r=[];t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.toArray&&(r=t.dataSource.groupBy.toArray().slice(0),r.length>0&&t.dataSource.beginUpdate()),t._doNotFireEvent=!0,t._sortColumns&&t._sortColumns.length?t.dataSource.remove(l):t.dataSource.removeAt(i),t._selectedIds.indexOf(e)>=0&&(t._selectedIds.splice(t._selectedIds.indexOf(e),1),t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:"remove"})),t._doNotFireEvent=!1,t.dataSource.boundSource.canNotify=n,t._editing=!1,r.length>0&&(t._dataSourceUpdatingTimer&&clearTimeout(t._dataSourceUpdatingTimer),t._dataSourceUpdatingTimer=setTimeout((()=>{const e=t._getExpandedGroups(t.dataSource.boundHierarchy);r.forEach((e=>t.addGroup(e))),t.dataSource.endUpdate(),t._restoreExpandedGroups(e),t._fullRefresh("update")}),50)),t.virtualization&&t.__updating||t._fullRefresh("update")}expandRowDetails(e){const t=this;if(!t.rowDetailTemplate)return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e];if(!a)return;const l=a.data||a;if(!a||!l)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);if(!i)return;const n=i.nextElementSibling;!n&&!t.virtualization||n&&n.classList.contains("smart-table-row-detail")&&!n.classList.contains("collapsed")||t._toggleRowDetail(i,l.$.id)}endEdit(){const e=this,t=e._editing;if(!t)return;const a=t.row,l=a.data,i=[];let n=!0;for(let a=0;a<t.cells.length;a++){const l=t.cells[a],r=e.columnByDataField[l.dataField],o=l.element,s=l.editor;let d;if(r.editor&&r.editor.template?r.editor.getValue&&(d=r.editor.getValue(s)):(d=s.value,s instanceof HTMLInputElement&&("number"===s.type?d=parseFloat(d):"date"===s.type&&(d=new Date(d),isNaN(d.getTime())&&(d=null)))),r.validation){const t=r.validation(d),a=void 0!==t&&!0!==t;if(a){let a;a="object"==typeof t&&t.message?t.message:e.localize("invalidValue"),o.setAttribute("validation-message",a)}else o.removeAttribute("validation-message");o.classList.toggle("invalid",a),n=n&&!a}i.push({column:r,newValue:d})}if(n){if(e.dataSource.virtualDataSource){const a=Object.assign({},l);for(let e=0;e<t.cells.length;e++){const l=t.cells[e],n=i[e],r=n.column;a[l.dataField]=n.newValue,r.transform&&(a[r.dataField]=r.transform(n.newValue))}for(const t of e._columns)a[t.dataField]instanceof Date&&(a[t.dataField]=a[t.dataField].toISOString().slice(0,10));e._editing.row.data=a,e._requestVirtualDataSource("update",(function(t){return t?r(!1,a):(e._editing.row.data=l,e.cancelEdit()),t}))}else r(!0,l);delete e._editing}function r(l,n){for(let r=0;r<t.cells.length;r++){const o=t.cells[r],s=i[r],d=s.column,c=o.editor;c.contains(e.getRootNode().activeElement)&&e._focusCell(o.element),c.remove(),l&&(n[o.dataField]=s.newValue,d.transform&&(n[d.dataField]=d.transform(s.newValue))),e._setCellContent(o.element,e._formatCellValue(a,d,o.element)),o.element.classList.remove("editing"),e.$.fireEvent("cellEndEdit",{id:n.$.id,row:n,value:n[o.dataField],dataField:o.dataField})}e._updateCellsWithFormulas(),"row"===e.editMode&&e.$.fireEvent("rowEndEdit",{id:n.$.id,row:n})}}expandAllRows(){const e=this;if(e._isExpandCollapseForbidden())return;e.beginUpdate();const t=e["smart-table"===e.nodeName.toLowerCase()?"dataSource":"rows"].boundHierarchy;if(t)for(let e=0;e<t.length;e++){const a=t[e],l=e=>{if(!e.leaf&&(e.expanded=!0,e.children))for(let t=0;t<e.children.length;t++){const a=e.children[t];l(a)}};l(a)}e.endUpdate()}isGroupExpanded(e){const t=this,a=t.dataSource;if(!t.grouping||0===a.groupBy.length)return;const l=t._getGroupByIndex(e);return!!l&&l.expanded}expandGroup(e){const t=this,a=t.dataSource;if(!t.grouping||0===a.groupBy.length)return;const l=t._getGroupByIndex(e);if(!l)return;const i=t._doNotFireEvent,n=t.animation,r=t.$.tableContainer.querySelector(`tr[row-id="${l.$.id}"]:not([unused])`);let o=!1;if(i&&(t.animation="none"),r){if(t._isCollapsed(l))if(i)o=!0;else{let e=l.parent;e&&!e.expanded&&t.expandGroup(l.parent.$.id.replace("Item","").replace(/_/g,"."))}l.expanded||(o||i?(l.expanded=!0,r.setAttribute("aria-expanded",!0),r.classList.add("expanded")):t._hierarchyArrowClickHandler(r,i)),i&&(l.expanded=!0,r.setAttribute("aria-expanded",!0),r.classList.add("expanded"),requestAnimationFrame((()=>t.animation=n)))}else if(l.expanded=!0,!l.expanded&&!i){let e=l.$.id;e=e.replace("Item","").replace(/_/gi,"."),t.$.fireEvent("group",{action:"expand",path:e,dataField:l.groupDataField,label:l.label})}}expandAllRootGroups(){const e=this;if(!e.grouping)return;e.beginUpdate();const t=e.dataSource.boundHierarchy;if(t)for(let e=0;e<t.length;e++)t[e].expanded=!0;e.endUpdate()}expandAllGroups(){const e=this;if(!e.grouping)return;e.beginUpdate();const t=e.dataSource.boundHierarchy;if(t)for(let e=0;e<t.length;e++){const a=t[e],l=e=>{if(e.expanded=!0,e.children)for(let t=0;t<e.children.length;t++){const a=e.children[t];l(a)}};l(a)}e.endUpdate()}collapseAllGroups(){const e=this;if(!e.grouping)return;e.beginUpdate();const t=e.dataSource.boundHierarchy;if(t)for(let e=0;e<t.length;e++)t[e].expanded=!1;e.endUpdate()}expandRow(e){const t=this;if(t._isExpandCollapseForbidden())return;const a=t.rowById?t.rowById[e]:t.rows.dataItemById[e],l=a.data||a;if(!a||l.leaf)return;const i=t.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused])`);if(!i)return l.expanded=!0,-1===t._expandedIds.indexOf(l.$.id)&&t._expandedIds.push(l.$.id),t._updateState("expanded"),void t.$.fireEvent("expand",{id:l.$.id,record:l});if(t._isCollapsed(l)){let e=l.parent;e&&!e.expanded&&t.expandRow(e.$.id)}l.expanded||t._hierarchyArrowClickHandler(i)}exportData(e,t,a,l){const i=this,n=i._columns.filter((e=>e.visible)),r=i.columnGroups,o=i.dataSource,s=getComputedStyle(i),d=s.borderRightColor,c=new Smart.Utilities.DataExporter(void 0,o.groupBy.toArray()),u={};let f,m=Array.from(i.$.tableContainer.firstElementChild.querySelectorAll("th"));if(o.virtualDataSource){f=[];for(let e=0;e<i.rows.length;e++)f.push(i.rows[e].data)}else o.boundHierarchy&&!i.grouping?(c.hierarchical=!0,f=function e(t){const l=[];return t.forEach((t=>{a&&!1===t.$.filtered||(l.push(t),t.leaf||(t._expanded=t.expanded,t.children&&(t.children=e(t.children),0===t.children.length&&(t._expanded=void 0,t.children=void 0,t.leaf=!0))))})),l}(JSON.parse(JSON.stringify(o.boundHierarchy,((e,t)=>{if("parent"!==e)return t}))))):(f=Array.from(o.toArray()),a&&(f=f.filter((e=>!1!==e.$.filtered))));c.style={border:"1px solid "+d,borderCollapse:"collapse",backgroundColor:s.backgroundColor,color:s.color,fontFamily:"Helvetica",header:{border:"1px solid "+d,fontWeight:"bold"},columns:{border:"1px solid "+d}},m=m.filter((e=>!1===e.classList.contains("smart-table-select-all")));for(let e=0;e<n.length;e++){const t=n[e],a={},l={};let i=m[e].offsetWidth+"px";u[t.dataField]=t.label,"date"===t.dataType&&(l.format="d"),a.width=i,c.style.header[t.dataField]=a,c.style.columns[t.dataField]=l}return r?c.header={columns:n,columngroups:r}:f.unshift(u),c.exportData(f,e,t,l)}getRowIndexById(e){const t=this.rowById[e];return this.dataSource&&t&&t.data&&t.data.$?t.data.$.index:-1}getSelection(){const e=this;return 0===e._selectableGroupRecords.length?e._selectedIds.filter((e=>!(""+e).startsWith("Item"))):e._selectedIds.filter((t=>-1===e._selectableGroupRecords.indexOf(t)&&!(""+t).startsWith("Item")))}getState(){return JSON.parse(this._stringifyState())}getValue(e,t){const a=this,l=a.columnByDataField[t];if(!l)return;let i=a.rowById[e];return i?i.data[l.dataField]:(i=a.dataSource.dataItemById[e],i?i[l.dataField]:void 0)}loadState(e){const t=this;if(!e&&!(e=window.localStorage.getItem("smartTable"+t.id)))return;const a=t.stateSettings;let l=!1;if(t._loadingState=!0,"string"==typeof e&&(e=JSON.parse(e)),-1!==a.indexOf("columns")){const a=t.loadColumnStateBehavior,i=t._columns,n=[],r=e.columns;for(let e=0;e<r.length;e++){let t=Object.assign({},r[e]);const l=i.find((e=>e.dataField===t.dataField));if(!l){"implementationOnly"!==a&&n.push(t);continue}const o=l.label,s=["editor","formatFunction","templateElement","templateElementSettings","transform","validation"];"stateOnly"!==a&&s.push("label");for(let e in l)-1===s.indexOf(e)&&delete l[e];t=Object.assign(l,t),"stateOnly"!==a&&o&&(t.label=o),n.push(t)}if("stateOnly"!==a)for(let e=0;e<i.length;e++){const t=i[e];n.find((e=>e.dataField===t.dataField))||n.push(t)}t.columns=n,t._initColumns(!0),l=!0,t._formattingPanel&&(t._formattingPanel.columns=t._columns)}if(t.grouping){const a=t.dataSource,i=t.dataSource.groupBy;e.grouped=e.grouped||[],JSON.stringify(i._array)!==JSON.stringify(e.grouped)&&(t.dataSource.groupBy=e.grouped,a.refreshHierarchy(),l=!0)}else t.hasAttribute("hierarchy")&&-1!==a.indexOf("expanded")&&JSON.stringify(t._expandedIds.slice(0).sort())!==JSON.stringify(e.expanded.slice(0).sort())&&(t.collapseAllRows(),t._expandedIds=e.expanded,l=!0);-1!==a.indexOf("selected")&&e.selected.slice&&JSON.stringify(t._selectedIds.slice(0).sort())!==JSON.stringify(e.selected.slice(0).sort())&&(t._selectedIds=e.selected,l=!0),l&&(t._initRows(),t.refresh());e:if(-1!==a.indexOf("filtered")){const a=t.filtering,l=e.filtered;if(t.clearFilters(),!l)break e;if(a&&t.filterRow&&l.rowFilters){const a=t.$.tableContainer.querySelector(".smart-table-filter-row"),l=Number(t.selection),i=e.filtered.filterRowValues;for(let e=0;e<t._columns.length;e++){const n=i[e];if(!n)continue;const r=t._columns[e].dataType,o=a.children[e+l].firstElementChild,s=t._filterInfo["string"===r?"stringConditions":"numberAndDateConditions"].find((e=>e.value===n.condition));if(-1===["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(s.value))if("date"===r){const e=new Date(n.value),t=(e.getMonth()+1).toString(),a=e.getDate().toString();o.children[0].value=`${e.getFullYear()}-${"0".repeat(2-t.length)}${t}-${"0".repeat(2-a.length)}${a}`}else o.children[0].value=n.value;o.children[1].value=s.label,o.children[1].$.input.dataValue=s.value}t._applyRowFilters()}else if(a&&l.inputFilters)t.$.filterInput.value=l.query,t._filterByAll(l.query);else if(l.appliedFilters){t._filterInfo.appliedFilters||(t._filterInfo.appliedFilters={});for(let e in l.appliedFilters){const a=l.appliedFilters[e],i=new window.Smart.Utilities.FilterGroup;a.filters.forEach(((e,t)=>{const l=i.createFilter(e.type.replace("Filter",""),e.value,e.condition);i.addFilter(a.logicalOperators[t],l)})),t._filterInfo.appliedFilters[e]=i}t._refreshFilters("add")}}-1!==a.indexOf("sorted")&&(t.clearSort(),e.sorted.forEach&&e.sorted.forEach((e=>{t.sortBy(e.dataField,e.direction)}))),a.forEach((e=>t._updateState(e,!1))),t.autoSaveState&&window.localStorage.setItem("smartTable"+t.id,t._stringifyState()),delete t._loadingState}navigateTo(e){const t=this;if(isNaN(e)||null===e)return;const a=t.pageIndex;t.pageIndex=Math.max(Math.min(Math.round(e),t.$.pager.pagesCount-1),0),t.paging&&t.pageIndex!==a&&(t._fullRefresh("pageIndexChange"),t.$.fireEvent("page",{action:"pageIndexChange"}))}removeFilter(e){const t=this,a=t.columnByDataField[e];a&&t.filterRow&&t.clearFilters(e),t._filterInfo.appliedFilters&&a&&(e=a.dataField,t._clearSortByRow&&t._clearSortByRow(!0),t._designerFiltersApplied&&t._clearDesignerFilters(e),delete t._filterInfo.appliedFilters[e],t._refreshFilters("remove"),t._originalDynamicColumnsOrder&&(t._originalDynamicColumnsOrder=t._dynamicColumns.map((e=>e.id))))}removeGroup(e){const t=this,a=t.columnByDataField[e];if(!t.grouping||!a)return;e=a.dataField;const l=t.dataSource,i=l.groupBy,n=i.indexOf(e);-1!==n&&(i.splice(n,1),l.refreshHierarchy(),t._getSelectableGroupRecords(),t._fullRefresh(),t._updateState("grouped"),t.$.fireEvent("group",{action:"remove",dataField:e}))}saveState(){const e=this._stringifyState();return window.localStorage.setItem("smartTable"+this.id,e),JSON.parse(e)}enableSelect(e){const t=this;t.selection&&t._disabledSelection.indexOf(e)>=0&&(t._disabledSelection.splice(t._disabledSelection.indexOf(e),1),t._fullRefresh("update"))}disableSelect(e){const t=this;t.selection&&(t._disabledSelection.push(e),t._fullRefresh("update"))}select(e){const t=this;t.selection&&(Array.isArray(e)?t._changeSelectionOfMultiple(e,"select"):t._selectSingle(e)&&(t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:t._interaction?"interaction":"programmatic"})))}setValue(e,t,a){const l=this,i=l.columnByDataField[t];if(!i)return;let n,r=l.rowById[e];if(r)n=r.data;else{if(r=l.dataSource.dataItemById[e],!r)return;n=r}t=i.dataField,l.dataSource._updating=!0,i.transform?(n[i.originalDataField]=a,n[t]=i.transform(a)):n[t]=a;const o=l.$.tableContainer.querySelector(`tr[row-id="${e}"]:not([unused]) td[data-field="${t}"]`);if(o&&(l._setCellContent(o,l._formatCellValue(r,i,o),o.classList.contains("tree-cell")),i.templateElement&&i.templateElementSettings)){const e=o.classList.contains("tree-cell"),t=o,a=e?t.children[0].children[1]:t,r=n.$.id;l._cachedTemplates&&l._cachedTemplates[i.dataField+"_"+r]&&(0===l._cachedTemplates[i.dataField+"_"+r].innerHTML.length?delete l._cachedTemplates[i.dataField+"_"+r]:(a.innerHTML="",a.appendChild(l._cachedTemplates[i.dataField+"_"+r]))),i.templateElementSettings(n[i.dataField],r,a.firstElementChild),l._cachedTemplates||(l._cachedTemplates=[]),l._cachedTemplates[i.dataField+"_"+r]||(l._cachedTemplates[i.dataField+"_"+r]=a.firstElementChild)}l._updateCellsWithFormulas(),delete l.dataSource._updating}unselect(e){const t=this;t.selection&&(Array.isArray(e)?t._changeSelectionOfMultiple(e,"unselect"):t._unselectSingle(e)&&(t._updateSelectAllState(),t._updateState("selected"),t.$.fireEvent("change",{type:t._interaction&&-1===t._disabledSelection.indexOf(e)?"interaction":"programmatic"})))}set scrollTop(e){const t=this;t.isRendered&&(e=parseInt(e),isNaN(e)||((t.virtualization?t.$.virtualizationContainer:t.$.container).scrollTop=e))}get scrollTop(){const e=this;return e.isRendered?(e.virtualization?e.$.virtualizationContainer:e.$.container).scrollTop:0}set scrollLeft(e){const t=this;t.isRendered&&(e=parseInt(e),isNaN(e)||((t.virtualization?t.$.virtualizationContainer:t.$.container).scrollLeft=e))}get scrollLeft(){const e=this;return e.isRendered?(e.virtualization?e.$.virtualizationContainer:e.$.container).scrollLeft:0}clearContent(){const e=this;for(;e.$.tableContainer.firstChild;)e.$.tableContainer.removeChild(e.$.tableContainer.firstChild)}applyContent(){const e=this;if(void 0===e.content)return void(e.content=e.$.tableContainer);if(""===e.content||null===e.content)return void e.clearContent();if(e.content instanceof HTMLElement)return e.clearContent(),void e.$.content.appendChild(e.content);const t=document.createDocumentFragment();let a=document.createElement("div");t.appendChild(a),e.content instanceof HTMLElement?a.appendChild(e.content):a.innerHTML=e.content;let l=Array.from(a.childNodes);a.parentNode.removeChild(a);for(let e=0;e<l.length;e++)t.appendChild(l[e]);e.clearContent(),e.$.tableContainer.appendChild(t)}propertyChangedHandler(e,t,a){const l=this;if(super.propertyChangedHandler(e,t,a),"innerHTML"!==e)switch(e){case"animation":case"theme":if("theme"===e){const e=getComputedStyle(l);l._defaults.text=l._toHex(e.color),l._defaults.highlight=l._toHex(e.backgroundColor)}if(l.filterRow){const t=l.$.tableContainer.querySelector(".smart-table-filter-row");Array.from(t.querySelectorAll("smart-input, smart-button")).forEach((t=>t[e]=a))}i(e,a);break;case"autoSaveState":a&&window.localStorage.setItem("smartTable"+l.id,l._stringifyState());break;case"columnGroups":a&&(l.columnResize&&(l.columnResize=!1),"auto"===l.columnSizeMode&&(l.removeAttribute("resize-max-reached"),l.columnSizeMode="default")),l.refresh();break;case"columnMinWidth":if(isNaN(parseFloat(a)))return void(l.columnMinWidth=t);l._handleAutoSizeMode(),l._handleFrozenColumnPositions(),l._refreshHorizontalScrollbar();break;case"columnResize":a&&l.columnGroups&&(l.columnResize=!1);break;case"columnResizeNormalize":l._columns&&l._columns.length>0&&""===l._columns[l._columns.length-1].dataField&&(l._columns.pop(),l.columns.pop()),l._initColumns(!0),l.refresh();break;case"columns":{l._conditionalFormatting&&delete l._conditionalFormatting;const e=l._sortColumns,t=l._filterInfo;if(l._clearFilterInput(),l._clearRowFilters(),delete l._filterInfo.appliedFilters,l._sortColumns=[],l._initColumns(!0),l.refresh(),l._formattingPanel&&(l._formattingPanel.columns=l._columns),l.dataSource.dataFields){let a=l.dataSource.dataFields||[];const i=l.columns;let n=!1;if(i.forEach((e=>{if(e.dataType){const t=a.find((t=>t.name===e.dataField));t?t.dataType=e.dataType:e.map?a.find((t=>e.map.indexOf(t.name)>=0?t:null))&&(l.dataSource.dataFields.push({name:e.dataField,map:e.map,dataType:e.dataType}),n=!0):(l.dataSource.dataFields.push({name:e.dataField,dataType:e.dataType}),n=!0)}})),n&&l.dataSource.dataBind){let a=[],i=[];if(l.dataSource&&l.dataSource.groupBy&&l.dataSource.groupBy.toArray&&(a=l.dataSource.groupBy.toArray().slice(0)),a.length>0&&(i=l._getExpandedGroups(l.dataSource.boundHierarchy)),l.dataSource.bindingCompleted=!1,l.dataSource.dataBind(),l._doNotFireEvent=!0,a.length>0&&(a.forEach((e=>l.addGroup(e))),l.dataSource.boundHierarchy&&l.dataSource.refreshHierarchy(),l._restoreExpandedGroups(i)),t.inputFilters?l._filterByAll(t.query):t.rowFilters?l._applyRowFilters():t.appliedFilters&&l._refreshFilters(),e&&(l._sortColumns=[],e.forEach((e=>{l.columnByDataField[e.dataField].sortOrder=null,l.sortBy(e.dataField,e.direction)}))),l._selectedIds.length>0){const e=JSON.stringify(l._selectedIds.slice(0).sort()),t=l.dataSource;l._selectedIds=l._selectedIds.filter((e=>void 0!==t.dataItemById[e]||-1!==l._selectableGroupRecords.indexOf(e))),e!==JSON.stringify(l._selectedIds.slice(0).sort())&&(l._updateSelectAllState(),l._updateState("selected"),l.$.fireEvent("change",{type:"remove"}))}l.virtualization&&setTimeout((()=>{const e=l.columns&&l.columns.length>0?l.columns[0].dataField:"";if(e){const t=l.querySelector('td[data-field="'+e+'"]');t&&l._rowHeight<t.offsetHeight&&(l._rowHeight=t.offsetHeight,l.style.setProperty("--smart-table-row-height",l._rowHeight+"px"),l._refreshDataRows())}}),300),delete l._doNotFireEvent}else t.inputFilters?l._filterByAll(t.query):t.rowFilters?l._applyRowFilters():t.appliedFilters&&l._refreshFilters(),e&&(l._sortColumns=[],e.forEach((e=>{l.columnByDataField[e.dataField].sortOrder=null,l.sortBy(e.dataField,e.direction)})))}break}case"columnSizeMode":if("auto"===a){if(l.columnGroups)return void(l.columnSizeMode="default");l._handleAutoSizeMode()}else l.removeAttribute("resize-max-reached"),l._columns.forEach((e=>{e.visible&&(e._isResponsive?e.headerCellElement.style.width=e.width||e._manualPercentageWidth?l._getColumnWidth(e.width||e._manualPercentageWidth,!0,e):null:e.headerCellElement.style.width=e.width||e._manualWidth?l._getColumnWidth(e.width||e._manualWidth,!0,e):null)}));l._handleFrozenColumnPositions(),l._refreshHorizontalScrollbar();break;case"conditionalFormatting":l._applyInitialConditionalFormatting(l.dataSource),l._refreshDataRows();break;case"conditionalFormattingButton":l.$.header.classList.toggle("smart-hidden",(!l.filtering||l.filterRow)&&!a),!a&&l._dialog&&l._dialog.close();break;case"dataSource":case"dataSourceSettings":{const i=l._sortColumns,n=l._filterInfo;if("dataSource"===e&&null===a&&(l.dataSource=[]),"dataSource"===e&&t&&a&&l.virtualization&&t instanceof Smart.DataAdapter&&t.length===a.length&&t.length>0&&a.length>0&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===a)return;l.beginUpdate();for(let e=0;e<a.length;e++){const t=a[e],i=l.dataSource[e].$.id;l.updateRow(i,t,!0)}return i?l.endUpdate(!0,!0):l.endUpdate(void 0,!0),void(l._cachedDataSource=a)}const r=l.$.virtualizationContainer?l.$.virtualizationContainer.scrollTop:0,o=void 0!==l.$.virtualizationContainer&&l.$.virtualizationContainer.$?l.$.virtualizationContainer.$.verticalScrollBar:null;o&&o.beginUpdate();let s=[];if(t&&t.groupBy&&t.groupBy.toArray&&(s=t.groupBy.toArray().slice(0)),l._dataBind(!0),l._doNotFireEvent=!0,s.length>0){const e=l._getExpandedGroups(t.boundHierarchy);if(l.__updating=!0,l.dataSource._groupBy&&(l.dataSource._groupBy.canNotify=!1),l._selectedIds.length>0){const e=JSON.stringify(l._selectedIds.slice(0).sort()),t=l.dataSource;l._selectedIds=l._selectedIds.filter((e=>void 0!==t.dataItemById[e]||-1!==l._selectableGroupRecords.indexOf(e))),s.forEach((e=>l.addGroup(e))),e!==JSON.stringify(l._selectedIds.slice(0).sort())&&(l._updateSelectAllState(),l._updateState("selected"),l.$.fireEvent("change",{type:"remove"}))}else s.forEach((e=>l.addGroup(e)));l.dataSource.boundHierarchy&&l.dataSource.refreshHierarchy(),l.dataSource._groupBy&&(l.dataSource._groupBy.canNotify=!0),l.__updating=!1,l._restoreExpandedGroups(e),l._fullRefresh("update")}if(n.inputFilters?l._filterByAll(n.query):n.rowFilters?l._applyRowFilters():n.appliedFilters&&l._refreshFilters(),i&&(l._sortColumns=[],i.forEach((e=>{l.columnByDataField[e.dataField].sortOrder=null,l.sortBy(e.dataField,e.direction)}))),l._selectedIds.length>0){const e=JSON.stringify(l._selectedIds.slice(0).sort()),t=l.dataSource;l._selectedIds=l._selectedIds.filter((e=>void 0!==t.dataItemById[e]||-1!==l._selectableGroupRecords.indexOf(e))),e!==JSON.stringify(l._selectedIds.slice(0).sort())&&(l._updateSelectAllState(),l._updateState("selected"),l.$.fireEvent("change",{type:"remove"}))}l.virtualization&&(setTimeout((()=>{const e=l.columns&&l.columns.length>0?l.columns[0].dataField:"";if(e){const t=l.querySelector('td[data-field="'+e+'"]');t&&l._rowHeight<t.offsetHeight&&(l._rowHeight=t.offsetHeight,l.style.setProperty("--smart-table-row-height",l._rowHeight+"px"),l._refreshDataRows())}}),300),l.$.virtualizationContainer.scrollTop=r,o&&(o.endUpdate(),l._onVerticalChange({detail:{value:o.value}},!0))),delete l._doNotFireEvent;break}case"disabled":case"unfocusable":case"keyboardNavigation":l._setFocusable(),i("unfocusable",l.disabled||l.unfocusable||!l.keyboardNavigation),"disabled"===e&&l._dialog&&l._dialog.close();break;case"hideSelectionColumn":l.refresh();break;case"columnMenu":l.$.header.classList.toggle("smart-hidden",(!l.filtering||l.filterRow||l.columnMenu)&&!l.conditionalFormattingButton),l.columnMenu&&(l._initialState=l.getState()),l.refresh();break;case"editing":a?l.$.tableContainer.removeAttribute("aria-readonly"):l.$.tableContainer.setAttribute("aria-readonly",!0);break;case"filtering":l.columnMenu||l.$.header.classList.toggle("smart-hidden",(!a||l.filterRow)&&!l.conditionalFormattingButton),a&&l.filterRow?l._createFilterRow():!1===a&&(l.filterRow&&l.$.tableContainer.querySelector(".smart-table-filter-row").remove(),(l._filterInfo.query||l._filterInfo.rowFilters||l._filterInfo.appliedFilters)&&l.clearFilters()),l.virtualization&&l.refresh();break;case"filterRow":if(l.$.header.classList.toggle("smart-hidden",(!l.filtering||a)&&!l.conditionalFormattingButton),!l.filtering)return;a?l._createFilterRow():(l.$.tableContainer.querySelector(".smart-table-filter-row").remove(),l._filterInfo.rowFilters&&l.clearFilters());break;case"filterTemplate":l._applyFilterTemplate();break;case"footerRow":{const e=l.$.tableContainer.querySelector("tfoot");e&&e.remove(),a&&l._createFooterRow();break}case"formulas":a?l._formulaParser=new Smart.FormulaParser(l):delete l._formulaParser,l._updateCellsWithFormulas(!0);break;case"freezeHeader":case"freezeFooter":l.virtualization&&(l[e]=!0);break;case"grouping":a||l.clearGrouping();break;case"headerRow":{const e=Array.from(l.$.tableContainer.firstElementChild.children);for(let t=1;t<e.length;t++)e[t].remove();a&&l._createCustomHeaderRow();break}case"locale":case"messages":{const e=l._dialog;if(l._localize(),l.filterRow){const e=l.$.tableContainer.querySelector(".smart-table-filter-row"),t=Array.from(e.querySelectorAll("smart-input.string-filter")),a=Array.from(e.querySelectorAll("smart-input.num-date-filter")),i=Array.from(e.querySelectorAll("smart-button"));t.concat(a).forEach((e=>e.title=l.localize("filterCondition"))),t.forEach((e=>{e.dataSource=l._filterInfo.stringConditions,void 0===e.$.input.dataValue?e.value=l.localize("CONTAINS"):e.value=l._filterInfo.stringConditions.find((t=>t.value===e.$.input.dataValue)).label})),a.forEach((e=>{e.dataSource=l._filterInfo.numberAndDateConditions,void 0===e.$.input.dataValue?e.value=l.localize("EQUAL"):e.value=l._filterInfo.numberAndDateConditions.find((t=>t.value===e.$.input.dataValue)).label})),i.forEach((e=>e.title=l.localize("clearFilter")))}e&&(e.$.footer.firstElementChild.innerHTML=l.localize("ok"),e.$.footer.children[1].innerHTML=l.localize("cancel"),e.classList.contains("conditional-formatting")?e.label=l.localize("conditionalFormatting"):e.classList.contains("drill-down")&&(e.label=l.localize("details"))),l._formattingPanel&&(l._formattingPanel.messages=l.messages,l._formattingPanel.locale=l.locale),Array.from(l.$.tableContainer.querySelectorAll(".group-label-value>.placeholder")).forEach((e=>{e.textContent=l.localize("EMPTY")}));break}case"pageIndex":l.pageIndex=Math.max(Math.min(Math.round(a),l.$.pager.pagesCount-1),0),l.paging&&l.pageIndex!==t&&(l._fullRefresh("pageIndexChange"),l.$.fireEvent("page",{action:"pageIndexChange"}));break;case"pageSize":l.paging&&(l._fullRefresh("pageSizeChange"),l.$.fireEvent("page",{action:"pageSizeChange"}));break;case"paging":if(!1===a){if(l.dataSource.virtualDataSource)return void(l.paging=!0);if(1===l.$.pager.pagesCount)return}l._fullRefresh();break;case"rowDetailTemplate":l._fullRefresh();break;case"rightToLeft":Array.from(l.$.tableContainer.querySelectorAll(".freeze-near, .freeze-far")).forEach((e=>{e.style.left=null,e.style.right=null,e.style.zIndex=null})),l._handleFrozenColumnPositions(),i("rightToLeft",a);break;case"selected":{const e=l._selectedIds.slice(0);l._clearSelection(),l._changeSelectionOfMultiple(a,"select","programmatic",e);break}case"selection":if(l.filterRow){const e=l.$.tableContainer.querySelector(".smart-table-filter-row");a?e.insertBefore(document.createElement("td"),e.firstElementChild):e.firstElementChild.remove()}l.refresh(),a?(l.$.tableContainer.setAttribute("aria-multiselectable",!0),l._updateSelectAllState()):l.$.tableContainer.removeAttribute("aria-multiselectable");break;case"selectionMode":{l.$.tableContainer.classList.remove("smart-unselectable");const e=l.querySelector(".smart-table-select-all");e&&("one"===l.selectionMode?e.classList.add("smart-visibility-hidden"):e.classList.remove("smart-visibility-hidden"));break}case"sortMode":"none"===a&&l.clearSort();break;case"tooltip":if(!a){const e=l.$.tableContainer.querySelector(".tooltip");e&&(e.classList.remove("tooltip"),e.removeAttribute("title"))}break;case"virtualization":l.virtualization=t}else l._initDataSourceFromHTML();function i(e,t){const a=[];l._dialog&&a.push(l._dialog,l._dialog.$.footer.firstElementChild,l._dialog.$.footer.children[1]),l._formattingPanel&&a.push(l._formattingPanel),a.forEach((a=>a[e]=t))}}_createElement(){const e=this;if(e._expandedRowDetailIds=[],e._editors={},isNaN(parseFloat(e.columnMinWidth))&&(e.columnMinWidth="50px"),e.columnGroups&&(e.columnResize=!1,e.columnSizeMode="default"),e.formulas&&(e._formulaParser=new Smart.FormulaParser(e)),e._setupPagingAndFiltering(),e._localize(),e._selectedIds=e.selected.slice(0),"one"===e.selectionMode){e._selectedIds=e._selectedIds.slice(0,1);const t=e.querySelector(".smart-table-select-all");t&&t.classList.add("smart-visibility-hidden")}e._dataBind(),e.editing||e.$.tableContainer.setAttribute("aria-readonly",!0),e.autoLoadState&&e.loadState(),e.autoSaveState&&window.localStorage.setItem("smartTable"+e.id,e._stringifyState())}_initColumns(e){const t=this,a=t.columns;if(!t.isRendered&&t.dataSource.length>0&&(!a||Array.isArray(a)&&0===a.length)&&(t.columns=t.dataSource.dataFields.map((e=>({label:e.name,dataField:e.name,dataType:e.dataType})))),t._filterInfo.stringDataFields=[],t._columns=[],t.columnByDataField={},t.columns.canNotify=!1,t.columns instanceof Smart.ObservableArray){const e=[];for(let a=0;a<t.columns.length;a++){let l=t.columns[a],i={};for(let e in l)i[e]=l[e];e.push(i)}t.columns=e}for(let a=0;a<t.columns.length;a++){let l=t.columns[a];if("string"==typeof l&&t.dataSource.dataFields){const e=t.dataSource.dataFields.find((e=>{if(e.name===l)return e}));l={label:l,dataField:l,dataType:e&&e.dataType||"string"}}void 0===l.label&&void 0===l.dataField||(void 0===l.label&&(l.label=l.dataField),void 0===l.dataField&&(l.dataField=l.label),l.dataType||(l.dataType="string"),"string"!==l.dataType&&"number"!==l.dataType||!1===l.allowFilter||!l.dataField||t._filterInfo.stringDataFields.push(l.dataField),l.visible=void 0===l.visible||!!l.visible,l.allowResize=void 0===l.allowResize||!!l.allowResize,t._transformColumnDataField(l,e),l.thHierarchy=[],t._columns.push(l),t.columnByDataField[l.dataField]=l)}if("default"===t.columnSizeMode&&t.selection){let e=!0;for(let a=0;a<t._columns.length;a++){const l=t._columns[a];if(!l.width){e=!1,l._isResponsive=!0,l._isFillRemainingWidth=!0;break}}(!t.columnResizeNormalize&&e||t.columnResizeNormalize&&e)&&t._columns.push({dataField:"",label:"",visible:!0,allowResize:!1,allowFilter:!1,allowSort:!1})}else if("default"===t.columnSizeMode&&!t.selection&&t.columnResizeNormalize){let e=!0;for(let a=0;a<t._columns.length;a++){const l=t._columns[a];if(!l.width){e=!1,l._isResponsive=!0,l._isFillRemainingWidth=!0;break}}e&&t._columns.push({dataField:"",label:"",visible:!0,allowResize:!1,allowFilter:!1,allowSort:!1})}t.columns=new Smart.ObservableArray(t._columns),t._updateState("columns"),t.columns.notify((function(e){if(!t.columns.canNotify)return;if("length"===e.action||"update"===e.action&&-1!==["allowGroup","allowSort","sortOrder"].indexOf(e.propertyName))return void t._updateState("columns");const a=e.target;if("update"===e.action){const l=a.dataField;if("allowEdit"===e.propertyName)return Array.from(t.$.tableContainer.querySelectorAll(`td[data-field="${l}"]`)).forEach((t=>{t.classList.toggle("no-edit",!1===e.newValue),!1===e.newValue?t.setAttribute("aria-readonly",!0):t.removeAttribute("aria-readonly")})),void t._updateState("columns");if("allowFilter"===e.propertyName)return"string"!==a.dataType&&"number"!==a.dataType||!l||(!1===e.newValue?t._filterInfo.stringDataFields=t._filterInfo.stringDataFields.filter((e=>e!==l)):!1===e.oldValue&&t._filterInfo.stringDataFields.push(l)),t.filterRow&&t.$.tableContainer.querySelector(`.smart-table-filter-row td[filter-for="${l}"]`).classList.toggle("no-filter",!1===e.newValue),"smart-pivot-table"===t.nodeName.toLowerCase()&&t._columnNotify(e),void t._updateState("columns");if("transform"===e.propertyName)a.sortOrder&&t.sortBy(a.dataField,null),t._transformColumnDataField(a,!0);else{if(-1!==["allowPivot","allowRowGroup","pivot","rowGroup","summary"].indexOf(e.propertyName)&&"smart-pivot-table"===t.nodeName.toLowerCase())return t._columnNotify(e),void t._updateState("columns");if("visible"===e.propertyName){const e=t._expandedRowDetailIds,a=t.$.tableContainer;let l;return t.filterRow&&(l=a.querySelector(".smart-table-filter-row"),l&&l.remove()),e&&e.length&&!t._columns.some((e=>e.visible))&&e.forEach((e=>t._toggleRowDetail(a.querySelector(`[row-id="${e}"]`),e))),t.$.tableContainer.setAttribute("aria-colcount",t._columns.filter((e=>e.visible)).length+ +t.selection),t.refresh(),void t._updateState("columns")}}}"add"===e.action&&(t.columns[t.columns.length-1].visible=!0),t._columns=t.columns._array,t.columnByDataField=[],t._columns.forEach((e=>{t.columnByDataField[e.dataField]=e,e.originalDataField&&(t.columnByDataField[e.originalDataField]=e)})),t.refresh(!0),t._updateState("columns")})),t.$.tableContainer.setAttribute("aria-colcount",t._columns.filter((e=>e.visible)).length+ +t.selection)}_transformColumnDataField(e,t){const a=this;if("function"==typeof e.transform){if(!a.isRendered||t){const l=a.dataSource,i=a.columns.canNotify;i&&(a.columns.canNotify=!1),t&&e.originalDataField&&(delete a.columnByDataField[e.dataField],e.dataField=e.originalDataField);const n=e.dataField,r=n+"Transformed";a.columnByDataField[n]=e,e.originalDataField=n,e.dataField=r,l.canNotify=!1;for(let t=0;t<l.length;t++){const a=l[t];a[r]=e.transform(a[n])}i&&(a.columns.canNotify=!0),l.canNotify=!0}}else e.transform&&(e.transform=void 0)}_initRows(){const e=this,t=e.dataSource,a=e.context;if(e.context=e,e.rows=[],e.rowById=[],t.virtualDataSource)return e._initRowsVirtualDataSource(),void(e.context=a);if(t.boundHierarchy)return e.$.tableContainer.setAttribute("role","treegrid"),e.setAttribute("hierarchy",""),e._initHierarchicalRows(),void(e.context=a);e.$.tableContainer.setAttribute("role","grid");let l=0,i=t.length,n=!1;if(e.removeAttribute("hierarchy"),e.paging){const a=e.pageSize;if(e._filterInfo.query||e._filterInfo.rowFilters||e._filterInfo.appliedFilters){let e=0;for(let a=0;a<i;a++)!1!==t[a].$.filtered&&e++;i=e,n=!0}const r=Math.max(Math.ceil(i/a),1);e.$.pager.pagesCount=r,e.$.pager.totalRecords=i,e.pageIndex=Math.max(Math.min(e.pageIndex,r-1),0),l=e.pageIndex*a,i=l+a}if(n){let a=-1;for(let n=0;n<t.length;n++){const r=t[n];if(r&&!1!==r.$.filtered){if(a++,a<l)continue;if(a>=i)break;e._addNewRow(r,n)}}}else for(let a=l;a<i;a++){const l=t[a];l&&!1!==l.$.filtered&&e._addNewRow(l,a)}e._observeRows(),e.context=a}_initRowsVirtualDataSource(){const e=this,t=e.dataSource;if(t.boundHierarchy)e.$.tableContainer.setAttribute("role","treegrid"),e.setAttribute("hierarchy",""),e._processHierarchy(t.boundHierarchy,0,t.boundHierarchy.length);else for(let a=0;a<t._dataSource.length;a++){const l=t[a];l&&!1!==l.$.filtered&&e._addNewRow(l,a)}if(e.paging){const a=t.length,l=e.pageSize,i=Math.max(Math.ceil(a/l),1),n=e.$.pager.pagesCount;if(e.$.pager.pagesCount=i,e.$.pager.totalRecords=a,e.pageIndex=Math.max(Math.min(e.pageIndex,i-1),0),null!==n&&n!==i)return void e._fullRefresh()}e._observeRows()}_initHierarchicalRows(){const e=this,t=e.dataSource.boundHierarchy;let a=0,l=t.length,i=!1;if(e.paging){const n=e.pageSize;if(e._filterInfo.query||e._filterInfo.rowFilters||e._filterInfo.appliedFilters){let e=0;for(let a=0;a<l;a++)!1!==t[a].$.filtered&&e++;l=e,i=!0}const r=Math.max(Math.ceil(l/n),1);e.$.pager.pagesCount=r,e.$.pager.totalRecords=l,e.pageIndex=Math.max(Math.min(e.pageIndex,r-1),0),a=e.pageIndex*n,l=a+n}if(i){let i=-1;for(let n=0;n<t.length;n++){const r=t[n];if(r&&!1!==r.$.filtered){if(i++,i<a)continue;if(i>=l)break;e._processHierarchy(t,n,n+1)}}}else e._processHierarchy(t,a,l);e._observeRows()}_processHierarchy(e,t,a){const l=this;for(let i=t;i<a;i++){const t=e[i];if(!t)break;t.leaf?t&&!1!==t.$.filtered&&l._addNewRow(t,i):(-1!==l._expandedIds.indexOf(t.$.id)?t.expanded=!0:void 0===t.expanded&&(t.expanded=!1),!1!==t.$.filtered&&l._addNewRow(t,i),t.children.length&&!1!==t.$.filtered&&l._processHierarchy(t.children,0,t.children.length))}}_observeRows(){const e=this;e.rows=new Smart.ObservableArray(e.rows),e.rows.notify((function(t){if(!e.rows.canNotify||t.path||!e.dataSource)return;e.rows.canNotify=!1;const a=t.action,l=e._selectedIds.slice(0);switch(e.dataSource.canNotify=!1,a){case"add":{const a={};e.dataSource.dataFields.forEach((e=>a[e.name]=""));const l=Object.assign(a,e.rows[t.index]);e.dataSource.add(e.rows[t.index]),e._editing={row:{data:l}};break}case"update":e.dataSource.update(t.index,e.rows[t.index]),e._editing={row:{data:e.rows[t.index]}};break;case"remove":{const a=t.removed[0].data,l=a.$.id,i=e._selectedIds.indexOf(l);e.dataSource.removeAt(a.$.index),delete e.rowById[l],-1!==i&&e._selectedIds.splice(i,1),e._editing={row:t.removed[0]},e._updateSelectAllState();break}}e._fullRefresh(a,l,a),delete e._editing,e.dataSource.canNotify=!0,e.rows.canNotify=!0}))}beginUpdate(){const e=this;if("smart-table"!==e.nodeName.toLowerCase())return;e.__updating=!0,e.__updatedRows=!1;const t=window.__karma__||window.karma;document.hidden&&!t||(e._dirtyHierarchy=!1,e.__updatingOldSelectedIds=e._selectedIds.slice(0),e.__updatingSortColumns=e._sortColumns,e.dataSource&&e.dataSource.clearSort&&e.dataSource.clearSort())}endUpdate(e,t){const a=this;if("smart-table"!==a.nodeName.toLowerCase())return;a.__updating=!1;const l=window.__karma__||window.karma;if(document.hidden&&!l)return;if(!1===e)return;l&&(t=!0);const i=()=>{const t=a.__updatingOldSelectedIds?a.__updatingOldSelectedIds:a._selectedIds.slice(0);a.__updatingOldSelectedIds&&delete a.__updatingOldSelectedIds,a._dirtyHierarchy&&a.dataSource.refreshHierarchy();const l=a._sortColumns,i=a._filterInfo,n=a.dataSource.groupBy._array.slice(0),r=void 0!==a.$.virtualizationContainer&&a.$.virtualizationContainer.$?a.$.virtualizationContainer.$.verticalScrollBar:null;if(r&&r.beginUpdate(),a._doNotFireEvent=!0,a._fullRefresh("update",t,"update"),n.length>0){let e=a._getExpandedGroups(a.dataSource.boundHierarchy);a._dirtyHierarchy&&(e=a._dirtyHierarchy),n.forEach((e=>a.addGroup(e))),a._restoreExpandedGroups(e)}i.inputFilters?a._filterByAll(i.query):i.rowFilters?a._applyRowFilters():i.appliedFilters&&a._refreshFilters(),l&&(a.__updatingSortColumns&&JSON.stringify(a.__updatingSortColumns)!==JSON.stringify(l)||0===n.length||!0===e||!1===a.__updatedRows)&&(a._sortColumns=[],l.forEach((e=>{a.columnByDataField[e.dataField].sortOrder=null,a.sortBy(e.dataField,e.direction)}))),r&&(r.endUpdate(),a._onVerticalChange({detail:{value:r.value}},!0),a._dirtyHierarchy&&(a._rowsInDOM.length<a.rows.length&&0===a.$.virtualizationContainer.$.verticalScrollBar.max&&a._refreshDataRows(),a._dirtyHierarchy=!1)),a.onUpdateComplete&&a.onUpdateComplete(a.rows),delete a._doNotFireEvent};if(a._verticalScrollTimer)return a._scheduleUpdate&&clearInterval(a._scheduleUpdate),void(a._scheduleUpdate=setInterval((function(){a._verticalScrollTimer||(i(),clearInterval(a._scheduleUpdate),delete a._scheduleUpdate)}),100));t?i():requestAnimationFrame((()=>{i()}))}_addNewRow(e,t){const a=this,l=e.$.id,i=new Smart.Observable({data:e,boundIndex:t});-1!==a._disabledSelection.indexOf(l)&&(i.allowSelect=!1),i.canNotify=!0,i.notify((function(t){if(a._editing||a._hierarchyChange)return;const i=a.selection;if("allowSelect"===t.propertyName){const n=a._disabledSelection.indexOf(l);if(a._hierarchyChange=!0,t.newValue||-1!==n)t.newValue&&-1!==n&&function e(t){const l=t.$.id,n=a.$.tableContainer.querySelector(`[row-id="${l}"]:not([unused])`),r=a.rowById[l];if(t.parent&&-1!==a._disabledSelection.indexOf(t.parent.$.id))r.allowSelect=!1;else if(a._disabledSelection.splice(a._disabledSelection.indexOf(l),1),n&&(n.classList.remove("disable-select"),i&&(n.setAttribute("aria-selected",!1),n.firstElementChild.firstElementChild.removeAttribute("aria-disabled"))),r&&(r.allowSelect=!0),t.children)for(let a=0;a<t.children.length;a++)e(t.children[a])}(e);else{const t=[];!function e(t,l){const n=t.$.id,r=a.$.tableContainer.querySelector(`[row-id="${n}"]:not([unused])`),o=a.rowById[n];if(l.push(n),r&&(r.removeAttribute("aria-selected"),r.classList.add("disable-select"),i&&r.firstElementChild.firstElementChild.setAttribute("aria-disabled",!0)),o&&(o.allowSelect=!1),t.children)for(let a=0;a<t.children.length;a++)e(t.children[a],l)}(e,t),a._disabledSelection=a._disabledSelection.concat(t),a.unselect(t)}delete a._hierarchyChange}})),a.rowById[l]=i,a.rows.push(i)}refresh(){const e=this;if(e.__updating)return;const t=e._columns.filter((e=>e.visible)),a=e.$.tableContainer,l=a.querySelector(".smart-table-filter-row"),i=a.querySelector("tfoot"),n=document.createElement("tbody"),r=e._getFractionOfMax(),o=e.virtualization?e.$.virtualizationContainer:e.$.tableContainer.parentElement,s={top:o.scrollTop,left:o.scrollLeft};for(e.columns.canNotify=!1;a.childNodes.length>0;)a.childNodes[0].remove();e._createTableHeader(),e.isRendered||!e.onInit||e._loadingState||e.onInit(),e._createCustomHeaderRow(),e._createFooterRow(i),e._createDataRows(n),e._createFilterRow(l);const d=a.querySelectorAll("th[data-field]");for(let a=0;a<t.length;a++){const l=t[a];l.headerCellElement=d[a],l.headerCellElement&&(l.headerCellElement.onclick=function(){const t=this.dataField;e.$.fireEvent("columnClick",{dataField:t}),e.closeColumnMenu(),"none"===e.sortMode||!1===l.allowSort||e._preventClickSort||(e._addSortIconContainer(this),e._sortOnClick=!0,this.headerCellElement.sortIconContainerElement.classList.contains("asc")?e.sortBy(t,"desc"):this.headerCellElement.sortIconContainerElement.classList.contains("desc")?e.sortBy(t,null):e.sortBy(t,"asc"),e._sortOnClick=!1)}.bind(l))}if(e._sortColumns&&e._sortColumns.length>0)for(let t=0;t<e._sortColumns.length;t++){const a=e._sortColumns[t],l=e.columnByDataField[a.dataField];e._addSortIconContainer(l,a.direction,t+1)}e._handleAutoSizeMode(),e._handleFrozenColumnPositions(),e._refreshHorizontalScrollbar(),e.isRendered&&(e.selection&&e._updateSelectAllState(),e._setFractionOfMax(r)),[o.scrollTop,o.scrollLeft]=[s.top,s.left],e.columns.canNotify=!0}_createTableHeader(){const e=this,t=e.selection,a=document.createElement("thead"),l=e._columns.filter((e=>e.visible)),i=e._getColumnHeaderStructure(),n=window.innerWidth,r={};for(let o=0;o<i;o++){const s=document.createElement("tr"),d=document.createDocumentFragment();t&&(s.innerHTML=o<i-1?'<th class="empty"></th>':'<th class="smart-table-select-all freeze-near" scope="col" aria-colindex="1"><div role="checkbox" aria-checked="false" aria-label="Toggle selection of all rows"></div></th>',e.virtualization&&Smart.Utilities.Core.Browser.Safari&&s.querySelector("th").classList.add("sticky")),o<i-1&&s.classList.add("column-groups-header");for(let a=0;a<l.length;a++){const s=l[a];if(0===o&&(s.width&&isNaN(parseFloat(s.width))&&delete s.width,s.responsivePriority&&("number"!=typeof s.responsivePriority&&(s.responsivePriority=1),s.responsivePriority=Math.max(Math.min(Math.round(s.responsivePriority),5),1),i>1&&(r[a]=e._isColumnHidden(s.responsivePriority,n)))),o<i-1){if(r[a])continue;const t=l[a],i=t.headerStructure[o];if(a>0){let r=a-1,s=l[r];for(;s&&e._isColumnHidden(s.responsivePriority,n);)r--,s=l[r];if(s&&i===s.headerStructure[o]&&e._areColumnsWithSameFreezeSettings(t,s))continue}const s=document.createElement("th");if(s.includes=[t],a<l.length-1){let r=1,d=a+1,c=l[d];for(;c;){if(!e._isColumnHidden(c.responsivePriority,n)){if(i!==c.headerStructure[o]||!e._areColumnsWithSameFreezeSettings(t,c))break;r++,s.includes.push(c)}d++,c=l[d]}s.colSpan=r}0!==o&&t.headerStructure[o-1]===i||(s.textContent=i),s.includes.forEach((e=>e.thHierarchy[o]=s)),s.classList.add("column-header"),t.freeze&&s.classList.add("freeze-"+("far"===t.freeze?"far":"near")),e.virtualization&&Smart.Utilities.Core.Browser.Safari&&s.classList.add("sticky"),d.appendChild(s)}else e._setupColumnHeaderCell(t,d,a,s)}s.appendChild(d),a.appendChild(s),e._tableHeader=a}if(e.$.tableContainer.appendChild(a),"default"===e.columnSizeMode){for(let t=0;t<e.columns.length;t++){const l=e.columns[t];if(!l.width){const t=a.querySelector('[data-field="'+l.dataField+'"]');t&&t.offsetWidth<5&&(t.style.width=parseInt(l.minWidth||e.columnMinWidth)+"px")}}if(t){const t=e.columns.filter((e=>e.visible));if(1===t.length){const e=t[0],l=a.querySelector('[data-field="'+e.dataField+'"]');l&&(l.style.width="")}}}}_getColumnHeaderStructure(){const e=this._columns,t=this.columnGroups;if(!t)return 1;let a=1;for(const l of e){let e=l.columnGroup;if(l.headerStructure=[],e&&(e=t.find((t=>t.name===e)),e))for(l.headerStructure.push(e.label||e.name);e.parentGroup&&(e=t.find((t=>t.name===e.parentGroup)),e);)l.headerStructure.unshift(e.label||e.name);l.headerStructure.push(l.label),a=Math.max(a,l.headerStructure.length)}for(const t of e){const e=t.headerStructure,l=e[0];for(;e.length<a;)e.unshift(l)}return a}_isColumnHidden(e,t){return!(!e||1===e||t>1280)&&(t<=640&&2===e||t<=800&&3===e||t<=1024&&4===e||t<=1280&&5===e)}_areColumnsWithSameFreezeSettings(e,t){return!e.freeze&&!t.freeze||e.freeze===t.freeze||!0===e.freeze&&"near"===t.freeze||"near"===e.freeze&&!0===t.freeze}getColumnProperty(e,t){const a=this,l=a.columnByDataField[e];if(!l)return null;switch(t){case"width":return l.width?a._getColumnWidth(l.width,!0,l):l._isResponsive&&l._manualPercentageWidth?a._getColumnWidth(l._manualPercentageWidth+"%",!0,l):a._getColumnWidth(l._manualWidth,!0,l);default:return l[t]}}setColumnProperty(e,t,a){const l=this;if(!l.columnByDataField[e])return null;l.columns.forEach(((i,n)=>{i.dataField===e&&(l.columns[n][t]=a)}))}_getTableRemainingWidth(){const e=this;let t=e.offsetWidth;if(e.selection){const a=e.$.tableContainer.querySelector(".smart-table-select-all");a&&(t=e.offsetWidth-a.offsetWidth),""===e.columns[e.columns.length-1].dataField&&(t-=parseInt(e.columnMinWidth))}e.virtualization&&e.$.virtualizationContainer&&e.$.virtualizationContainer.computedVerticalScrollBarVisibility&&(t-=20);let a=0;for(let t=0;t<e.columns.length;t++){const l=e.columns[t];l.visible&&l.width&&!(""+l.width).endsWith("%")&&(a+=e._getColumnWidth(l.width))}return t-=a,t}_getColumnWidth(e,t,a){const l=this,i=parseFloat(e);if((e=(e+"").trim()).endsWith("%")){let e=l.offsetWidth;if(l.selection){const t=l.$.tableContainer.querySelector(".smart-table-select-all");t&&(e=l.offsetWidth-t.offsetWidth),""===l.columns[l.columns.length-1].dataField&&(e-=parseInt(l.columnMinWidth))}l.virtualization&&l.$.virtualizationContainer&&l.$.virtualizationContainer.computedVerticalScrollBarVisibility&&(e-=20);let n=0;for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.visible&&t.width&&!(""+t.width).endsWith("%")&&(n+=l._getColumnWidth(t.width))}e-=n;const r=a&&a.minWidth||l._getNumericMinWidth(),o=t?i+"%":e*(i/100);return r>o?r:o}return isNaN(i)?"auto":t?i+"px":i}_setupColumnHeaderCell(e,t,a,l){const i=this,n=document.createElement("th");if(n.setAttribute("aria-colindex",a+1+ +e),l.width){let e=l.width;"number"==typeof e&&l.minWidth&&(e=Math.max(e,l.minWidth)),n.style.width=i._getColumnWidth(e,!0,l)}else l._manualWidth&&(l._isResponsive?n.style.width=l._manualPercentageWidth+"%":n.style.width=l._manualWidth+"px");if(1!==i._columns.length&&l.allowResize||n.setAttribute("locked",""),l.freeze&&n.classList.add("freeze-"+("far"===l.freeze?"far":"near")),l.responsivePriority&&n.classList.add("priority-"+l.responsivePriority),i.virtualization&&Smart.Utilities.Core.Browser.Safari&&n.classList.add("sticky"),n.setAttribute("data-field",l.dataField),n.innerHTML=`<div class="wrapper" role="presentation"><div class="label">${l.label}</div></div>`,i.columnMenu){const e=document.createElement("div");e.classList.add("column-menu"),e.setAttribute("aria-hidden",!0),n.firstElementChild.appendChild(e),e.onclick=e=>{i.activeColumnMenu&&i.activeColumnMenu.dataField===l.dataField?i.closeColumnMenu():i.openColumnMenu(l.dataField),e.preventDefault(),e.stopPropagation()}}i.onColumnRender&&i.onColumnRender(l.dataField,n),t.appendChild(n)}_refreshDataRows(){const e=this,t=window.scrollY,a=window.scrollX,l=e.$.tableContainer.children[1],i=Array.from(l.querySelectorAll("tr:not(.smart-table-filter-row)"));if(e._clearCachedTemplates(),e.filterRow||e.footerRow||e.headerRow)for(let e=0;e<i.length;e++)i[e].remove();else l.innerHTML="";e._createDataRows(l),e._handleAutoSizeMode(),e._handleFrozenColumnPositions(),e._refreshHorizontalScrollbar(),(a||t)&&window.scroll(a,t)}_createDataRows(e){const t=this;if(t.virtualization)return void t._createVirtualDataRows(e);const a=t.rowDetailTemplate,l=t.selection,i=document.createDocumentFragment(),n=t.hasAttribute("hierarchy");for(let e=0;e<t.rows.length;e++){const r=t.rows[e],o=r.data;o.groupDataField?t._createGroupHeader(o,i):t._createDataRow(r,i,{hierarchical:n,rowDetailTemplate:a,selection:l,virtualization:!1})}if(i.appendChild(t._createLastRow()),e.appendChild(i),t._updateState("expanded"),e.parentElement||t.$.tableContainer.insertBefore(e,t.$.tableContainer.querySelector("tfoot")),t.getRootNode().activeElement===t.$.tableContainer&&t._tableContainerFocusHandler(),t._templateTags.length){const e=t.querySelectorAll("tr");for(let a=0;a<t._templateTags.length;a++){const l=t._templateTags[a],i=l.index,n=l.dataField,r=l.td;if(e[i]){const t=e[i].querySelector('[data-field="'+n+'"]'),a=[...t.querySelectorAll("smart-button"),...t.querySelectorAll("button"),...t.querySelectorAll("a"),...t.querySelectorAll("span")],l=[...r.querySelectorAll("smart-button"),...r.querySelectorAll("button"),...r.querySelectorAll("a"),...r.querySelectorAll("span")];for(let e=0;e<a.length;e++)"button"===a[e].nodeName.toLowerCase()&&a[e].classList.contains("smart-button")||(a[e].onclick=()=>{l[e].click()})}}}}_createDataRow(e,t,a){const l=this,i=l._columns.filter((e=>e.visible)),n=e.data,r=n.$.id,o=document.createElement("tr"),s={row:o,detail:null};let d=0;o.setAttribute("aria-rowindex",n.$.index+1),l._processAndRenderSelection(n,o,a.hierarchical),a.selection&&d++;for(let t=0;t<i.length;t++){const s=document.createElement("td"),c=i[t];s.setAttribute("data-field",c.dataField),s.setAttribute("aria-colindex",t+1+ +a.selection);let u,f=l._formatCellValue(e,c,s);if(c.freeze&&s.classList.add("freeze-"+("far"===c.freeze?"far":"near")),c.responsivePriority&&s.classList.add("priority-"+c.responsivePriority),!1===c.allowEdit&&(s.classList.add("no-edit"),s.setAttribute("aria-readonly",!0)),0===t&&a.hierarchical){const e=l._areChildrenFiltered(n);n.leaf||(s.classList.add("tree-cell"),u=e),n.level&&(s.classList.add("outline-level-"+Math.min(n.level,10)),!n.leaf&&e||s.classList.add("tree-leaf"))}if(a.virtualization&&c.templateElement){const e=c.templateElement+"";u&&l._setCellContent(s,f,u);const t=u?s.children[0].children[1]:s;e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+n[c.dataField]+"</div>"):t.innerHTML=e,c.templateElementSettings&&(l._cachedTemplates&&l._cachedTemplates[c.dataField+"_"+r]&&(0===l._cachedTemplates[c.dataField+"_"+r].innerHTML.length?delete l._cachedTemplates[c.dataField+"_"+r]:(t.innerHTML="",t.appendChild(l._cachedTemplates[c.dataField+"_"+r]))),c.templateElementSettings(n[c.dataField],r,t.firstElementChild),l._cachedTemplates||(l._cachedTemplates=[]),l._cachedTemplates[c.dataField+"_"+r]||(l._cachedTemplates[c.dataField+"_"+r]=t.firstElementChild))}else l._setCellContent(s,f,u);l.onCellRender&&l.onCellRender(n,c.dataField,n[c.dataField],s),l._applyConditionalFormattingToCell(s,c.dataField,n.$.index),o.appendChild(s),d++}if(o.data=n,o.setAttribute("row-id",r),-1!==l._disabledSelection.indexOf(r)&&(o.removeAttribute("aria-selected"),o.classList.add("disable-select"),a.selection&&o.firstElementChild.firstElementChild.setAttribute("aria-disabled",!0)),n.expanded?(-1===l._expandedIds.indexOf(r)&&l._expandedIds.push(r),o.setAttribute("aria-expanded",!0),o.classList.add("expanded")):!1===n.expanded&&o.setAttribute("aria-expanded",!1),n.level&&l._isCollapsed(n)&&(o.setAttribute("aria-hidden",!0),o.classList.add("collapsed","smart-hidden")),t.appendChild(o),a.rowDetailTemplate){const i=document.createElement("tr");if(-1===l._expandedRowDetailIds.indexOf(r)){if(a.virtualization)return s;i.setAttribute("aria-hidden",!0),i.classList.add("collapsed")}else s.detail=i;i.data=Object.assign(n,{detail:!0}),i.classList.add("smart-table-row-detail"),i.innerHTML=`<td colspan="${d}"><div class="smart-table-detail-container">${l._applyRowDetailTemplate(e)}</div></td>`,t.appendChild(i)}return s}_processAndRenderSelection(e,t,a,l){const i=this,n=e.$.id,r=i._getChildCheckState(e).state;if(a&&i.selectionByHierarchy){const e=i._selectedIds.indexOf(n);!0===r&&-1===e?i._selectedIds.push(n):r||-1===e||i._selectedIds.splice(e,1)}if(!i.selection)return;let o,s;l?(o=t.firstElementChild,s=o.firstElementChild):(o=document.createElement("td"),s=document.createElement("div")),s.className="selection-checkbox",s.setAttribute("role","checkbox"),s.setAttribute("aria-checked",!!r||null===r&&"mixed"),s.setAttribute("aria-label","Toggle row selection"),o.className="smart-table-select-row freeze-near"+(r?" selected":null===r?" indeterminate":""),o.setAttribute("aria-colindex",1),l||(o.appendChild(s),t.appendChild(o)),t.setAttribute("aria-selected",!0===r)}_applyConditionalFormattingToCell(e,t,a){const l=this;if(l._conditionalFormatting&&l._conditionalFormatting[t]){const i=l._conditionalFormatting[t][a];i&&(e.style.backgroundColor=i.background,e.style.color=i.color,e.style.fontFamily=i.fontFamily,e.style.fontSize=i.fontSize)}}_createLastRow(){const e=document.createElement("tr");e.setAttribute("aria-hidden",!0),e.classList.add("last-visible");try{new ResizeObserver((t=>{try{e.classList.toggle("sized",t[0].contentRect.height>0&&null!==e.previousSibling)}catch(e){}})).observe(e)}catch(e){}return e}_createGroupHeader(e,t,a){const l=this;l.columnByDataField[e.groupDataField]||console.error(l.localize("grouping"));const i=l.columnByDataField[e.groupDataField]?l.columnByDataField[e.groupDataField].label:`${l.localize("EMPTY")}`,n=a||document.createElement("tr"),r=document.createElement("td"),o=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div");let c=e.label;if((/<.+?>/.test(c)||/<./.test(c))&&c.replace&&("all"===l.dataSourceSettings.sanitizeHTML?c=c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===l.dataSourceSettings.sanitizeHTML&&(c=window.Smart.Utilities.Core.sanitizeHTML(c))),""!==c&&c||(c=`<em class="placeholder">${l.localize("EMPTY")}</em>`),n.removeAttribute("aria-rowindex"),n.data=e,s.classList.add("hierarchy-arrow","smart-arrow","smart-arrow-down"),s.setAttribute("role","button"),s.setAttribute("aria-label","Toggle row"),d.classList.add("group-label"),d.innerHTML=`<span class="group-label-name">${i}: </span>\n <span class="group-label-value">${c}</span>\n <span class="group-label-count">(${l._getLeafCount(e)})</span>`,r.colSpan=l._columns.filter((e=>e.visible)).length,r.classList.add("group-header"),e.level&&(r.classList.add("outline-level-"+Math.min(e.level,10)),l._isCollapsed(e)&&(n.setAttribute("aria-hidden",!0),n.classList.add("collapsed","smart-hidden"))),n.setAttribute("row-id",e.$.id),n.setAttribute("role","group"),n.setAttribute("aria-level",e.level),o.appendChild(s),o.appendChild(d),r.appendChild(o),l._processAndRenderSelection(e,n,!0),n.appendChild(r),n.setAttribute("aria-expanded",e.expanded),n.classList.toggle("expanded",e.expanded),e&&e.$&&!1===e.$.filtered&&n.classList.add("smart-hidden"),l.groupFormatFunction){const t={value:c,row:e.$.id,column:e.groupDataField,data:e,template:null};l.groupFormatFunction(t),c!==t.value&&(d.innerHTML=`<span class="group-label-name">${i}: </span>\n <span class="group-label-value">${t.value}</span>\n <span class="group-label-count">(${l._getLeafCount(e)})</span>`),t.template instanceof HTMLElement&&(d.innerHTML="",d.appendChild(t.template));const a=t.template;let n="";if(a&&a.startsWith("#")){const e=document.querySelector(a);let t=c;if(e&&e instanceof HTMLTemplateElement){const a=e.content.cloneNode(!0),l=document.createElement("div");l.appendChild(a),t=t.toString(),t=t.replace(/'/gi,"\\'"),t=t.replace(/"/gi,'\\"'),n=l.innerHTML.replace(/{{value}}/gi,t),n.indexOf("{{value=")>=0&&(t?(n=n.substring(0,n.indexOf("{{value="))+t+n.substring(n.indexOf("}")),n=n.replace(/}/gi,""),n=n.replace(/{/gi,"")):(n=n.replace(/{{value=/gi,""),n=n.replace(/}}/gi,""))),d.innerHTML=n}}else a&&"string"==typeof a&&(n=a.replace(/{{value}}/gi,c),d.innerHTML=n)}const u=l.selection?1:0;for(let e=0;e<l.columns.length;e++){const t=document.createElement("td"),a=l.columns[e];a.visible&&(t.setAttribute("data-field",a.dataField),t.setAttribute("aria-colindex",e+1+u),t.classList.add("smart-hidden"),n.appendChild(t))}return a||t.appendChild(n),n}_getLeafCount(e){let t=0;return function e(a){for(const l of a)l.leaf?t++:l.children&&l.children.length>0&&e(l.children)}(e.children),t}_isCollapsed(e){let t=e.parent;for(;t;){if(!t.expanded)return!0;t=t.parent}return!1}_areChildrenFiltered(e){if(!e.leaf){if(0===e.children.length&&this.dataSource.virtualDataSource)return!0;for(let t=0;t<e.children.length;t++)if(!1!==e.children[t].$.filtered)return!0;return!1}}_applyRowDetailTemplate(e){const t=this,a=t.dataSource.dataFields;let l=t.rowDetailTemplate;for(let i=0;i<a.length;i++){const n=a[i].name,r=new RegExp(`{{${n}}}`,"g");let o=t.columnByDataField[n]||{dataField:n};if(r.test(l)){let a=t._formatCellValue(e,o,document.createElement("td"));"string"!=typeof a&&(a=e.data[o.dataField]),l=l.replace(r,a)}}return l}_handleFrozenColumnPositions(){const e=this,t=e.rightToLeft,a=e._columns.filter((e=>e.visible));let l=[],i=[],n=0;function r(t,l,i,r,o){const s=a[l-n],d=[s.headerCellElement];for(const e of s.thHierarchy)e.includes[0].dataField===s.dataField&&d.push(e);Array.from(e.$.tableContainer.querySelectorAll(`td:nth-child(${l+1})`)).concat(d).forEach((e=>{e.style[t]=i+"px",o&&(e.style.zIndex=2+r)}))}e.selection&&(t?i.push(0):l.push(0),n=1);for(let e=0+n;e<a.length+n;e++){const r=a[e-n];r.freeze&&(!t&&"far"===r.freeze||t&&"far"!==r.freeze?i.push(e):l.push(e))}if(l.length<2&&i.length<2)return;const o=[];e.selection&&o.push(40);for(const e of a){let t=e.width;t||(t=e.headerCellElement.offsetWidth),e.minWidth&&(t=Math.max(e.minWidth,t)),o.push(t)}if(t){for(let e=0;e<l.length-1;e++){const t=l[e];let a=0;for(let e=t+1;e<o.length;e++)-1!==l.indexOf(e)&&(a+=o[e]);r("left",t,a,e,!0)}for(let e=1;e<i.length;e++){const t=i[e];let a=0;for(let e=0;e<t;e++)-1!==i.indexOf(e)&&(a+=o[e]);r("right",t,a,e,!1)}}else{for(let e=1;e<l.length;e++){const t=l[e];let a=0;for(let e=0;e<t;e++)-1!==l.indexOf(e)&&(a+=o[e]);r("left",t,a,e,!1)}for(let e=0;e<i.length-1;e++){const t=i[e];let a=0;for(let e=t+1;e<o.length;e++)-1!==i.indexOf(e)&&(a+=o[e]);r("right",t,a,e,!0)}}}_formatCellValue(e,t,a,l){const i=this;let n=e&&e.data?e.data.$.id:e;if(void 0===l&&(l=e.data[t.dataField]),"string"==typeof l&&(l.indexOf(">")>=0||l.indexOf("<")>=0)&&l.replace&&("all"===i.dataSourceSettings.sanitizeHTML?l=l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===i.dataSourceSettings.sanitizeHTML&&(l=window.Smart.Utilities.Core.sanitizeHTML(l))),i._cellsWithFormulas){const e=t.dataField+":"+n;if("string"==typeof l&&/=.+/.test(l)){const t=i._formulaParser;i._cellsWithFormulas[e]=!0,t&&(l=t.parse(l.slice(1)))}else delete i._cellsWithFormulas[e]}if(t.formatFunction){const i={value:l,row:n,column:t.dataField,data:e.data,cell:a,template:null};if(t.formatFunction(i),l=i.value,i.template instanceof HTMLElement)return i.template;if(null===i.template||"string"!=typeof i.template)return l;const r=i.template;let o="";if(r.startsWith("#")){const e=document.querySelector(r);if(e&&e instanceof HTMLTemplateElement){const t=e.content.cloneNode(!0),a=document.createElement("div");return a.appendChild(t),l=(l=(l=l.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),o=a.innerHTML.replace(/{{value}}/gi,l),o.indexOf("{{value=")>=0&&(l?(o=o.substring(0,o.indexOf("{{value="))+l+o.substring(o.indexOf("}")),o=o.replace(/}/gi,""),o=o.replace(/{/gi,"")):(o=o.replace(/{{value=/gi,""),o=o.replace(/}}/gi,""))),o}}return o='<div class="smart-table-cell-template">'+r.replace(/{{value}}/gi,l)+"</div>",o}return"date"===t.dataType&&l instanceof Date?l.toLocaleDateString():l}_setCellContent(e,t,a){if(t instanceof HTMLElement==1){for(;e.childNodes.length>0;)e.childNodes[0].remove();if(a){const a=document.createElement("div");a.innerHTML='<div class="hierarchy-arrow smart-arrow smart-arrow-down" role="button" aria-label="Toggle row"></div><div></div>',a.children[1].appendChild(t),e.appendChild(a)}else e.appendChild(t)}else if(a)e.innerHTML=t=`<div>\n <div class="hierarchy-arrow smart-arrow smart-arrow-down" role="button" aria-label="Toggle row"></div>\n <div>${t}</div>\n </div>`;else if("string"==typeof t&&t.indexOf(">")>=0)if(/<.+?>/.test(t)||/&\S+;/.test(t)){if(e._content===t)return;e.innerHTML=t,e._content=t}else e.textContent!==t&&(e.textContent=t);else"html"===this.dataSourceSettings.sanitizeHTMLRender?e.innerHTML!==t&&("string"==typeof t&&t.indexOf(" ")>=0&&(t=t.replaceAll(" "," ")),e.innerHTML=t):e.textContent!==t&&(e.textContent=t)}_dataBind(e){const t=this;if(t._cellsWithFormulas={},t._templateTags=[],t.dataSource){if(t.dataSource instanceof Smart.DataAdapter==0){const e=t.dataSource;if(Array.isArray(e)){const a=t.columns;let l;if(e.length>0){const t=e[0];l=[];for(let e in t){const a=t[e];"number"==typeof a?l.push({name:e,dataType:"number"}):"boolean"==typeof a?l.push({name:e,dataType:"boolean"}):a instanceof Date?l.push({name:e,dataType:"date"}):a instanceof Object?l.push({name:e,dataType:"any"}):l.push({name:e,dataType:"string"})}}a&&a.length>0&&(l=l||[],a.forEach((e=>{if(e.dataType){const t=l.find((t=>t.name===e.dataField));t?t.dataType=e.dataType:e.map?l.find((t=>e.map.indexOf(t.name)>=0?t:null))&&l.push({name:e.dataField,map:e.map,dataType:e.dataType}):l.push({name:e.dataField,dataType:e.dataType})}}))),t.dataSourceSettings.dataFields&&t.dataSourceSettings.dataFields.length>0?t.dataSource=new Smart.DataAdapter({dataSource:t.dataSource,dataSourceType:t.dataSourceSettings.dataSourceType,dataFields:t.dataSourceSettings.dataFields,keyDataField:t.dataSourceSettings.keyDataField,parentDataField:t.dataSourceSettings.parentDataField,childrenDataField:t.dataSourceSettings.childrenDataField,groupBy:t.dataSourceSettings.groupBy,mapChar:t.dataSourceSettings.mapChar,root:t.dataSourceSettings.root,record:t.dataSourceSettings.record,autoGenerateColumns:t.autoGenerateColumns,id:t.dataSourceSettings.id||t.dataRowId,expandHierarchy:t.expandHierarchy,virtualDataSource:t.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:t.dataSourceSettings.virtualDataSourceOnExpand}):t.dataSource=new Smart.DataAdapter({dataSource:t.dataSource,dataFields:l,id:t.dataRowId||t.dataSourceSettings.id,dataSourceType:t.dataSourceSettings.dataSourceType,keyDataField:t.dataSourceSettings.keyDataField,parentDataField:t.dataSourceSettings.parentDataField,childrenDataField:t.dataSourceSettings.childrenDataField,groupBy:t.dataSourceSettings.groupBy,mapChar:t.dataSourceSettings.mapChar,root:t.dataSourceSettings.root,record:t.dataSourceSettings.record,autoGenerateColumns:t.autoGenerateColumns,expandHierarchy:t.expandHierarchy,virtualDataSource:t.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:t.dataSourceSettings.virtualDataSourceOnExpand})}else t.dataSource=new Smart.DataAdapter({dataSource:[],id:t.dataRowId,expandHierarchy:t.expandHierarchy})}}else{if(t.dataFields=[],!t.columns||Array.isArray(t.columns)&&0===t.columns.length){t.columns=[];const e=t.querySelectorAll("th");for(let a=0;a<e.length;a++){const l=e[a].innerHTML.trim();let i={label:l,dataField:l,dataType:"string"};t.columns.push(i),t.dataFields.push(l)}}else for(let e=0;e<t.columns.length;e++){const a=t.columns[e];"string"==typeof a?t.dataFields.push(a):"object"==typeof a&&t.dataFields.push(a.dataField+(a.dataType?": "+a.dataType:""))}let e=[];if(!t.rows){const a=t.querySelectorAll("tr");for(let l=0;l<a.length;l++){const i={},n=a[l].querySelectorAll("td");if(n.length>0){for(let e=0;e<t.columns.length;e++){const a=t.columns[e];i[a.dataField]=n[e].innerHTML.trim(),i[a.dataField].indexOf("<")>=0&&t._templateTags.push({index:l,dataField:a.dataField,td:n[e]})}e.push(i)}}t.dataSource=new Smart.DataAdapter({dataSource:e,expandHierarchy:t.expandHierarchy,dataFields:t.dataFields,id:t.dataRowId})}const a=t.$.container.querySelectorAll("table");a.length>1&&a[a.length-1].parentNode.removeChild(a[a.length-1])}t.dataSource.expandHierarchy=t.expandHierarchy,t._transformDataSource(),t._applyInitialConditionalFormatting(t.dataSource),t._initColumns(e),t._initRows(),t.dataSource.notify((function(e){if(t.dataSource._updating)return void delete t.dataSource._updating;if(t._editing)return;const a=e.data,l=t._selectedIds.slice(0);let i=e.action;switch(t.rows.canNotify=!1,e.action){case"add":if(a.length)for(let e=0;e<a.length;e++)t._addNewRow(a[e],t.dataSource.length-a.length+e);else t._addNewRow(a,t.dataSource.length-1);break;case"update":if(a.length)for(let l=0;l<a.length;l++){const i=e.index[l];t.rows[i].data=a[l]}break;case"insert":t._addNewRow(a,e.index);for(let e=0;e<t.rows.length;e++)t.rows[e].dataIndex=e;break;case"remove":case"removeLast":i="remove",function(e){const a=e.$.id,l=t._selectedIds.indexOf(a);delete t.rowById[a],t.rows.splice(e.$.index,1),-1!==l&&t._selectedIds.splice(l,1)}(a);break;case"bindingComplete":if(t.filtering&&t.filterRow){const e=t._filterInfo;e.inputFilters?t._filterByAll(e.query):e.rowFilters?t._applyRowFilters():e.appliedFilters&&t._refreshFilters()}}t.rows.canNotify=!0,this.refreshHierarchy(),t._fullRefresh(void 0,l,i)})),t.refresh(),t.dataSource.virtualDataSource&&(t.paging=!0,t._requestVirtualDataSource("dataBind")),t.$.tableContainer.setAttribute("aria-rowcount",t.dataSource.length)}_requestVirtualDataSource(e,t,a=null){const l=this,i=l.pageSize,n=Math.max(l.pageIndex*i,0),r=n+i,o=[],s=[],d={};let c=null;if(l.dataSource._updating=!0,l._sortColumns&&(l._sortColumns.forEach(((e,t)=>o[e.dataField]={sortOrder:e.direction,sortIndex:t})),o.length=l._sortColumns.length),l._filterInfo.appliedFilters){for(let e in l._filterInfo.appliedFilters)s[e]=l._filterInfo.appliedFilters[e];s.length=Object.keys(l._filterInfo.appliedFilters).length,c="and"}else{const e=l._filterInfo.inputFilters||l._filterInfo.rowFilters;e&&(e.forEach((e=>s[e[0]]=e[1])),s.length=e.length),c=l._filterInfo.inputFilters?"or":"and"}l._editing&&(d.row=l._editing.row.data),l.$.loadingIndicatorContainer.classList.remove("smart-hidden"),l.setAttribute("loading",""),l.dataSource.onVirtualDataSourceRequested((function(i){let n=!0;-1!==["add","update","remove"].indexOf(e)&&t&&(n=t(i.result)),l.$.loadingIndicatorContainer.classList.add("smart-hidden"),l.removeAttribute("loading"),n&&(a&&(a.expanded=!0),l._initRows(),l._refreshDataRows())}),{first:n,last:r,sorting:o,filtering:s,filterOperator:c,grouping:[],edit:d,row:a,action:e})}sortBy(e,t){const a=this,l=a.columnByDataField[e];if(l){if(!1===l.allowSort)return;e=l.dataField}if(a._sortBy({column:l,columnDataField:e,sortOrder:t,dataFields:a.dataSource.dataFields,columnByDataField:"columnByDataField"}),null===e){const e=!0===a._sortOnClick?"interaction":"programmatic";a.$.fireEvent("sort",{columns:[],sortDataFields:[],sortOrders:[],sortDataTypes:[],type:e})}}_sortBy(e){const t=this,a=e.column,l=e.columnDataField,i=e.sortOrder,n=e.dataFields,r=e.columnByDataField,o=[],s=[],d=[],c=function(e){t._addSortIconContainer(e),e.headerCellElement&&(e.headerCellElement.removeAttribute("aria-sort"),e.headerCellElement.sortIconContainerElement.classList.remove("desc"),e.headerCellElement.sortIconContainerElement.classList.remove("asc")),e.sortOrder=null},u=function(){if(t._sortColumns&&t._sortColumns.length>0)for(let e=0;e<t._sortColumns.length;e++){const a=t._sortColumns[e],l=t[r][a.dataField];c(l)}t._sortColumns=[]};if(null==a)return void(t._sortColumns&&t._sortColumns.length>0&&(u(),t._sortCallback(o,s,d),t._updateState("sorted")));if("none"===t.sortMode||!t.dataSource)return;if(i&&a.sortOrder===i)return;let f=i||"asc";null===i&&(f=null),c(a),t._sortColumns||(t._sortColumns=[]);let m="string";for(let e=0;e<n.length;e++){const t=n[e];if(t.name===l){m=t.dataType,"any"===m&&(m="number");break}}let h=!0;for(let e=0;e<t._sortColumns.length;e++){const n=t._sortColumns[e];if(n.dataField===l)if(h=!1,null===f&&(n.direction="desc"),"asc"===n.direction)n.direction="desc",f="desc";else if("desc"===n.direction){t._sortColumns.splice(e,1),c(a),f=i;break}}h&&("one"===t.sortMode&&u(),t._sortColumns.push({dataField:l,direction:f,dataType:m})),t._addSortIconContainer(a),null!==f?(a.headerCellElement&&(a.headerCellElement.sortIconContainerElement.classList.remove("asc"),a.headerCellElement.sortIconContainerElement.classList.remove("desc")),a.sortOrder=f,a.headerCellElement&&("desc"===f?(a.headerCellElement.sortIconContainerElement.classList.add("desc"),a.headerCellElement.setAttribute("aria-sort","descending")):(a.headerCellElement.sortIconContainerElement.classList.add("asc"),a.headerCellElement.setAttribute("aria-sort","ascending")))):a.headerCellElement&&(a.headerCellElement.sortIconContainerElement.classList.remove("asc"),a.headerCellElement.sortIconContainerElement.classList.remove("desc"),a.headerCellElement.removeAttribute("aria-sort"));for(let e=0;e<t._sortColumns.length;e++){const a=t._sortColumns[e],l=t[r][a.dataField];o.push(a.dataField),s.push(a.direction),d.push(a.dataType),l.headerCellElement&&l.headerCellElement.sortIconContainerElement.setAttribute("order",e+1)}if(t._sortCallback(o,s,d),t._updateState("sorted"),!t._doNotFireEvent){const e=!0===t._sortOnClick?"interaction":"programmatic";t.$.fireEvent("sort",{columns:t._sortColumns,sortDataFields:o,sortOrders:s,sortDataTypes:d,type:e})}}_addSortIconContainer(e,t,a){const l=e.headerCellElement;if(l&&!l.sortIconContainerElement){const e=document.createElement("div");e.classList.add("sort-by"),e.setAttribute("aria-hidden",!0),t&&e.classList.add(t),l.firstElementChild.appendChild(e),l.sortIconContainerElement=e,"asc"===t?l.setAttribute("aria-sort","ascending"):"desc"===t?l.setAttribute("aria-sort","descending"):l.removeAttribute("aria-sort"),void 0!==a&&e.setAttribute("order",a)}}_sortCallback(e,t,a){const l=this,i=l.dataSource;if(!i.virtualDataSource){let n=null;for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.sort&&(n||(n={}),n[t.dataField]=t.sort)}i._sort(l.dataSource.boundSource,e,t,a,l.sort,n);let r=[],o=[];if(i.groupBy&&i.groupBy.toArray&&(r=i.groupBy.toArray().slice(0)),r.length>0&&(o=l._getExpandedGroups(i.boundHierarchy)),i.refreshHierarchy(),r.length>0){const e=l._doNotFireEvent;l._doNotFireEvent=!0,l._restoreExpandedGroups(o),l._doNotFireEvent=e}}l._fullRefresh("sort")}clearSort(){this.sortBy(null)}_fullRefresh(e,t,a,l){const i=this;if(i.__updating)return;if(i.dataSource.virtualDataSource)return void i._requestVirtualDataSource(e,l);const n=i._getFractionOfMax();t||(t=i._selectedIds.slice(0)),t=JSON.stringify(t.sort()),i._initRows(),i._refreshDataRows(),i._setFractionOfMax(n),"filter"===e&&(i._updateSelectAllState(),a||(a="filter")),t!==JSON.stringify(i._selectedIds.slice(0).sort())&&("filter"!==e&&i._updateSelectAllState(),i._updateState("selected"),i.$.fireEvent("change",{type:a})),"string"==typeof e&&-1!==e.indexOf("page")&&i._fixFrozenHeaderFirefox()}_pagerChangeHandler(e){const t=this;(t.isInShadowDOM?e.composedPath()[0]:e.target)===t.$.pager&&(t.pageIndex=e.detail.index,t._fullRefresh("pageIndexChange"),t.$.fireEvent("page",{action:"pageIndexChange"}))}_pagerPageSizeChanged(e){const t=this;t.pageSize=e.detail.value,t._fullRefresh("pageSizeChange"),t.$.fireEvent("page",{action:"pageSizeChange"})}_filterInputKeyupHandler(){const e=this;clearTimeout(e._filterInputTimeout),e._filterInputTimeout=setTimeout((function(){if(e._filterInfo&&e.$.filterInput.value!==e._filterInfo.query){const t=e.context;e.context=e,e._filterByAll(e.$.filterInput.value),e.context=t}}),500)}_filterByAll(e){const t=this;if(t._filterInfo.query=e,""===e)return void t.clearFilters();const a=[];t._clearRowFilters(),delete t._filterInfo.appliedFilters,t._filterInfo.stringDataFields.forEach((t=>{const l=new Smart.Utilities.FilterGroup,i=l.createFilter("string",e,"CONTAINS");l.addFilter("or",i),a.push([t,l])})),t.dataSource.virtualDataSource||t.dataSource._filter(a,"or"),t._filterInfo.inputFilters=a,t._fullRefresh("filter"),t._updateState("filtered"),t._doNotFireEvent||t.$.fireEvent("filter",{action:"add",filters:a})}_setupPagingAndFiltering(){const e=this;e.$.pager.$.pageSizeSelector.classList.add("underlined"),e.$.pager.$.pageSizeSelector.dropDownAppendTo="body",e._filterInfo={query:""},e._applyFilterTemplate(),e.$.header.classList.toggle("smart-hidden",(!e.filtering||e.filterRow||e.columnMenu)&&!e.conditionalFormattingButton)}_applyFilterTemplate(){const e=this,t=e.filterTemplate;if(e.$.filterTemplateContainer.innerHTML="",!t)return e.$.filterInput.classList.remove("smart-hidden"),e.$.filterTemplateContainer.classList.add("smart-hidden"),void(e.filterTemplate=null);const a=document.getElementById(t);if(a&&a instanceof HTMLTemplateElement){const t=document.importNode(a.content,!0);e.$.filterInput.classList.add("smart-hidden"),e.$.filterTemplateContainer.classList.remove("smart-hidden"),e.$.filterTemplateContainer.appendChild(t)}else e.filterTemplate=null,e.$.filterInput.classList.remove("smart-hidden"),e.$.filterTemplateContainer.classList.add("smart-hidden")}_refreshFilters(e){const t=this,a=[];for(let e in t._filterInfo.appliedFilters){let l=t._filterInfo.appliedFilters[e];a.push([e,l])}0!==a.length?(t._clearFilterInput(),t._clearRowFilters(),t.dataSource.virtualDataSource||t.dataSource._filter(a,t.filterOperator),t._fullRefresh("filter"),t._updateState("filtered"),e&&!t._doNotFireEvent&&t.$.fireEvent("filter",{action:e,filters:a})):t.clearFilters()}_localize(){const e=this,t=e.$.pager;t.messages[e.locale]||(t.messages[e.locale]={}),t.messages[e.locale].pageSizeLabel=e.localize("itemsPerPage"),t.messages[e.locale].summaryPrefix=e.localize("summaryPrefix"),t.messages[e.locale].summarySuffix="",t.$.firstButton.setAttribute("tooltip",e.localize("firstButton")),t.$.previousButton.setAttribute("tooltip",e.localize("previousButton")),t.$.nextButton.setAttribute("tooltip",e.localize("nextButton")),t.$.lastButton.setAttribute("tooltip",e.localize("lastButton")),e.$.filterInput.placeholder=e.localize("filterPlaceholder"),e.$.conditionalFormattingButton.setAttribute("tooltip",e.localize("conditionalFormatting")),e._filterInfo.stringConditions=[{value:"EMPTY",label:e.localize("EMPTY")},{value:"NOT_EMPTY",label:e.localize("NOT_EMPTY")},{value:"CONTAINS",label:e.localize("CONTAINS")},{value:"CONTAINS_CASE_SENSITIVE",label:e.localize("CONTAINS_CASE_SENSITIVE")},{value:"DOES_NOT_CONTAIN",label:e.localize("DOES_NOT_CONTAIN")},{value:"DOES_NOT_CONTAIN_CASE_SENSITIVE",label:e.localize("DOES_NOT_CONTAIN_CASE_SENSITIVE")},{value:"STARTS_WITH",label:e.localize("STARTS_WITH")},{value:"STARTS_WITH_CASE_SENSITIVE",label:e.localize("STARTS_WITH_CASE_SENSITIVE")},{value:"ENDS_WITH",label:e.localize("ENDS_WITH")},{value:"ENDS_WITH_CASE_SENSITIVE",label:e.localize("ENDS_WITH_CASE_SENSITIVE")},{value:"EQUAL",label:e.localize("EQUAL")},{value:"EQUAL_CASE_SENSITIVE",label:e.localize("EQUAL_CASE_SENSITIVE")},{value:"NULL",label:e.localize("NULL")},{value:"NOT_NULL",label:e.localize("NOT_NULL")}],e._filterInfo.numberAndDateConditions=[{value:"EQUAL",label:e.localize("EQUAL")},{value:"NOT_EQUAL",label:e.localize("NOT_EQUAL")},{value:"LESS_THAN",label:e.localize("LESS_THAN")},{value:"LESS_THAN_OR_EQUAL",label:e.localize("LESS_THAN_OR_EQUAL")},{value:"GREATER_THAN",label:e.localize("GREATER_THAN")},{value:"GREATER_THAN_OR_EQUAL",label:e.localize("GREATER_THAN_OR_EQUAL")},{value:"NULL",label:e.localize("NULL")},{value:"NOT_NULL",label:e.localize("NOT_NULL")}]}_createFilterRow(e){const t=this;if(!t.filtering||!t.filterRow)return;if(e)return void t.$.tableContainer.children[1].insertBefore(e,t.$.tableContainer.children[1].firstElementChild);const a=document.createElement("tr"),l=t._columns.filter((e=>e.visible));let i="";a.className="smart-table-filter-row",t.selection&&(i+='<td style="left: 0px; z-index: 99; position: sticky; background: var(--smart-background);"></td>');for(let e=0;e<l.length;e++){const a=l[e];i+=t._createFilterRowInput(a)}a.innerHTML=i,t.$.tableContainer.children[1].insertBefore(a,t.$.tableContainer.children[1].firstElementChild)}_createFilterRowInput(e){const t=this,a=` animation="${t.animation}" `,l=t.rightToLeft?" right-to-left":"",i=[];let n,r,o,s;return"string"===e.dataType?(n=t._filterInfo.stringConditions,r="string",o="string-filter",s=t.localize("CONTAINS")):(n=t._filterInfo.numberAndDateConditions,r=e.dataType,o="num-date-filter",s=t.localize("EQUAL")),e.freeze&&i.push("freeze-"+("far"===e.freeze?"far":"near")),e.responsivePriority&&i.push("priority-"+e.responsivePriority),!1===e.allowFilter&&i.push("no-filter"),`<td${i.length?' class="'+i.join(" ")+'"':""} filter-for="${e.dataField}">\n <div>\n <input type="${r}" class="filter-value" aria-label="Filter value" />\n <smart-input class="${o}${a}data-source='${JSON.stringify(n)}' drop-down-button-position="right" drop-down-width="auto" readonly${l} value="${s}" title="${t.localize("filterCondition")}" aria-label="Filter condition"></smart-input>\n <smart-button class="smart-hidden" title="${t.localize("clearFilter")}"${a}${l} aria-label="Clear filter"></smart-button>\n </div>\n </td>`}_tableContainerChangeHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target;a.classList.contains("filter-value")&&("date"===a.type||a instanceof Smart.Input&&(""!==a.previousElementSibling.value||-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(e.detail.value)))&&t._applyRowFilters(),(a.classList.contains("string-filter")||a.classList.contains("num-date-filter"))&&a instanceof Smart.Input&&(""!==a.previousElementSibling.value||-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(e.detail.value))&&t._applyRowFilters()}_tableContainerClickHandler(e){const t=this;if(t._editing)return;const a=t.isInShadowDOM?e.composedPath()[0]:e.target;if(!t.$.tableContainer.contains(a))return;const l=a.closest("tbody tr[row-id], tfoot tr.grand-total");if(l){t.closeColumnMenu();const i=a.closest("td");if(a.classList.contains("hierarchy-arrow")){const e=t.animation;return t.virtualization&&(t._animation="none"),t._hierarchyArrowClickHandler(l,i),void(t.virtualization&&(t._animation=e))}const n=l.getAttribute("row-id");let r;n&&(r=t.rowById?t.rowById[n].data:t.rows.dataItemById[n]);const o=r?r.$.id:void 0,s=i?i.getAttribute("data-field"):void 0;if(!r&&l.classList.contains("grand-total")&&(r=l.data),void 0!==s){const a={};for(let e=0;e<t.columns.length;e++){const l=t.columns[e];a[l.dataField]=r[l.dataField]}t.$.fireEvent("cellClick",{id:n,row:a,dataField:s,value:r[s],originalEvent:e})}if(t._toggleSelection(l,r,e,a),t.editing||t.drillDown){if(!s||i.classList.contains("no-edit"))return;clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks?(t._dblclickObject.numberOfClicks=0,t._beginEdit({rowElement:l,cell:i,dataField:s})):t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300)}return void(t.rowDetailTemplate&&t._toggleRowDetail(l,o))}const i=a.closest(".smart-table-select-all");if(i){if("one"===t.selectionMode)return;return void t._selectAllCheckboxClickHandler(i)}const n=a.closest(".smart-table-filter-row smart-button")||a.closest(".smart-table-column-menu smart-button");if(n){const e=n.parentElement.firstElementChild,a=n.parentElement.children[1];return e.value="",-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(a.$.input.dataValue)&&(a.value=t.localize("text"===e.type?"CONTAINS":"EQUAL"),delete a.$.input.dataValue),void t._applyRowFilters()}}_toggleSelection(e,t,a,l){const i=this;if(!i.selection||"cell"===i.selectionMode||e.classList.contains("disable-select")||e.classList.contains("grand-total"))return;function n(){i._selectedIds=[],Array.from(i.$.tableContainer.querySelectorAll(".smart-table-select-row.selected")).forEach((e=>{e.parentElement.classList.contains("disable-select")||e.parentElement.setAttribute("aria-selected",!1),e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1)}))}const r=t.$.id;let o=-1!==i._selectedIds.indexOf(r);if(i._interaction=!0,"one"===i.selectionMode){if(o)return;n(),i.select(r)}if("many"===i.selectionMode)if(o)i.unselect(r);else{if(i._disabledSelection.length>0&&t.children&&t.children.length>0){let e=0,a=0,l=[];if(t.children.forEach((t=>{const n=t.$.id;-1===i._selectedIds.indexOf(n)?e++:l.push(n),-1!==i._disabledSelection.indexOf(n)&&a++})),e===a)return i.unselect(l),void delete i._interaction}i.select(r),i._selectionStart={data:t,element:e}}else{if(i._selectionStart&&a.shiftKey){let t,a,l;if(i.virtualization?(t=i.rows,a=t.findIndex((e=>e.data.$.id===r)),l=t.findIndex((e=>e.data.$.id===i._selectionStart.data.$.id))):(t=Array.from(i.$.tableContainer.querySelectorAll("tr[row-id]:not([unused])")),a=t.indexOf(e),l=t.indexOf(i._selectionStart.element)),a!==l){const e=JSON.stringify(i._selectedIds.slice(0).sort()),r=Math.min(a,l),o=Math.max(a,l);n();const s=[];for(let e=r;e<=o;e++){const a=t[e];s.push(a.data.$.id)}return i._changeSelectionOfMultiple(s,"select","interaction",e),getSelection().removeAllRanges(),void delete i._interaction}if(1===i._selectedIds.length)return void delete i._interaction}const s=!!l&&(l.classList.contains("selection-checkbox")||l.classList.contains("smart-table-select-row"));let d=!1;if(1===i._selectedIds.length)d=!0;else if(i.hasAttribute("hierarchy")&&i.selectionByHierarchy){const e=[];!function e(t,a){const l=t.$.id;-1!==i._selectedIds.indexOf(l)&&a.push(l),t.children&&t.children.forEach((t=>e(t,a)))}(t,e),i._selectedIds.length===e.length&&(d=!0),t&&t.leaf&&(d=!0),o=i._getChildCheckState(t).maxSelected}else i.hasAttribute("hierarchy")&&!i.selectionByHierarchy&&(d=!0);if(o&&(s||d||a.ctrlKey||a.metaKey))return delete i._selectionStart,i.unselect(r),void delete i._interaction;s||a.ctrlKey||a.metaKey||n(),i.select(r),i._selectionStart={data:t,element:e}}delete i._interaction}_selectAllCheckboxClickHandler(e,t){const a=this;if(void 0===t){const l=a._filterInfo;if(l.inputFilters||l.rowFilters||l.appliedFilters)return void a._selectAllCheckboxClickHandlerFiltering(e);if(t=a.dataSource,a.hasAttribute("hierarchy")&&a._disabledSelection.length>0){const e=t.boundHierarchy,l=a._getChildCheckState({children:e}).maxSelected;return void a._changeSelectionOfMultiple(e.map((e=>e.$.id)),l?"unselect":"select","interaction")}}const l=t.length,i=a._selectedIds.length===l-a._disabledSelection.length+a._selectableGroupRecords.length,n=a._selectedIds.slice(0);if(a._selectedIds=[],i)a._updateCSSOnUnselectAll(e);else{let i,n=0;for(let e=0;e<l;e++){const l=t[e].$.id;-1===a._disabledSelection.indexOf(l)&&(a._selectedIds.push(l),n++)}n===l?i=!0:0===n&&(i=!1),a._updateCSSOnSelectAll(e,i),a._selectableGroupRecords.length>0&&(a._selectedIds=a._selectedIds.concat(a._selectableGroupRecords))}n.length!==a._selectedIds.length&&(a._updateState("selected"),a.$.fireEvent("change",{type:"interaction"}))}_selectAllCheckboxClickHandlerFiltering(e){const t=this,a=t.dataSource,l=t._selectedIds.slice(0),i=[],n=[];let r=0;for(let e=0;e<a.length;e++){const o=a[e];if(!1===o.$.filtered)continue;const s=o.$.id;r++,-1!==l.indexOf(s)&&i.push(s),-1===t._disabledSelection.indexOf(s)&&n.push(s)}const o=i.length===n.length;if(t._selectedIds=t._selectedIds.filter((e=>-1===n.indexOf(e))),o)t._updateCSSOnUnselectAll(e);else{let a;t._selectedIds=t._selectedIds.concat(n),n.length===r?a=!0:0===n.length&&(a=!1),t._updateCSSOnSelectAll(e,a)}l.length!==t._selectedIds.length&&(t._updateState("selected"),t.$.fireEvent("change",{type:"interaction"}))}_updateCSSOnUnselectAll(e){e.classList.remove("indeterminate","selected"),e.firstElementChild.setAttribute("aria-checked",!1),Array.from(this.$.tableContainer.querySelectorAll(".smart-table-select-row")).forEach((e=>{e.parentElement.classList.contains("disable-select")||e.parentElement.setAttribute("aria-selected",!1),e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1)}))}_updateCSSOnSelectAll(e,t){t?(e.classList.remove("indeterminate"),e.classList.add("selected"),e.firstElementChild.setAttribute("aria-checked",!0)):!1===t?(e.classList.remove("indeterminate","selected"),e.firstElementChild.setAttribute("aria-checked",!1)):(e.classList.remove("selected"),e.classList.add("indeterminate"),e.firstElementChild.setAttribute("aria-checked","mixed")),Array.from(this.$.tableContainer.querySelectorAll(".smart-table-select-row")).forEach((e=>{e.parentElement.classList.contains("disable-select")||(e.parentElement.setAttribute("aria-selected",!0),e.classList.remove("indeterminate"),e.classList.add("selected"),e.firstElementChild.setAttribute("aria-checked",!0))}))}_beginEdit(e){const t=this,a=t.editMode,l=e.dataField;let i=e.rowId,n=e.rowElement,r=e.rowObject,o=e.cell,s=[],d=[];if(t.editing){n||(n=t.$.tableContainer.querySelector(`tr[row-id="${i}"]:not([unused])`)),r||(i=n.getAttribute("row-id"),r=t.rowById[i],i=r.data.$.id),"row"===a?(s=n.querySelectorAll("td[data-field]"),d=t._columns.filter((e=>e.visible)).map((e=>e.dataField)),o||(o=l?n.querySelector(`td[data-field="${l}"`):s[0])):(o||(o=n.querySelector(`td[data-field="${l}"`)),s=[o],d=[l]),t._editing={row:r,cells:[]};for(let e=0;e<d.length;e++){const a=s[e];let l=d[e];const n=t.columnByDataField[l];if(!1===n.allowEdit)continue;n.transform&&(l=n.originalDataField);const c=r.data[l],u=t._initEditor(n,i,l,c);let f=u instanceof HTMLInputElement&&"date"===u.type;if(n.editor&&n.editor.template)n.editor.onRender&&n.editor.onRender(i,l,u,c);else if(f)if(c instanceof Date&&!isNaN(c.getTime())){const e=(c.getMonth()+1).toString(),t=c.getDate().toString();u.value=`${c.getFullYear()}-${"0".repeat(2-e.length)}${e}-${"0".repeat(2-t.length)}${t}`}else u.value="";else u.value=void 0===c?"":c;a.classList.add("editing"),a.innerHTML="",a.appendChild(u),a===o&&u.focus&&(u.focus(),n.editor&&n.editor.template||f||!u.select||u.select()),t._editing.cells.push({dataField:l,editor:u,element:a}),t.$.fireEvent("cellBeginEdit",{id:r.data.$.id,row:r.data,value:r.data[l],dataField:l})}"row"===a&&t.$.fireEvent("rowBeginEdit",{id:r.data.$.id,row:r.data})}}_initEditor(e,t,a,l){let i=this._editors[a];if(i)return i;if(e.editor&&e.editor.template){const n=document.createElement("div");return n.innerHTML=e.editor.template,i=n.firstElementChild,i.className="smart-table-editor",e.editor.onInit&&e.editor.onInit(t,a,i,l),i}return i=document.createElement("input"),i.className="smart-table-editor standard","number"===e.dataType?i.type="number":"date"===e.dataType?i.type="date":i.type="text",this._editors[a]=i,i}_toggleRowDetail(e,t){const a=this;if(a.virtualization)return void a._toggleRowDetailVirtualization(e,t);const l=e.nextElementSibling;l.classList.toggle("collapsed"),l.classList.contains("collapsed")?(l.setAttribute("aria-hidden",!0),a._expandedRowDetailIds=a._expandedRowDetailIds.filter((e=>e!==t))):(l.removeAttribute("aria-hidden"),a._expandedRowDetailIds.push(t))}_toggleRowDetailVirtualization(e,t){const a=this;let l=e.nextElementSibling;function i(){let e=a.$.virtualizationContainer.$.verticalScrollBar,t=a.$.virtualizationContainer.$.verticalScrollBar.value;a._ignoreVerticalChange=!0,a._refreshDataRows(),t=Math.min(e.max,t),e.value=t,delete a._ignoreVerticalChange,a._onVerticalChange({detail:{value:t}},!0)}if(l&&l.classList.contains("smart-table-row-detail")&&!l.classList.contains("collapsed"))return l.setAttribute("aria-hidden",!0),a._expandedRowDetailIds=a._expandedRowDetailIds.filter((e=>e!==t)),l.classList.add("collapsed"),l.remove(),void i();const n=e.data;l=document.createElement("tr"),l.classList.add("collapsed"),a._createRowDetailOnDemand(l,{data:n},n),e.parentElement.insertBefore(l,e.nextElementSibling),a._expandedRowDetailIds.push(t),l.classList.remove("collapsed"),i()}_setFocusable(){const e=this,t="smart-table"===e.nodeName.toLowerCase();if(!e.keyboardNavigation||e.disabled||e.unfocusable||e.hasAttribute("modal"))return e.$.tableContainer.removeAttribute("tabindex"),t&&(e.$.filterInput.unfocusable=!0,e.$.pager.unfocusable=!0),void(e.$.conditionalFormattingButton.unfocusable=!0);const a=e.$.tableContainer.getAttribute("tabindex");(null===a||a<0)&&e.$.tableContainer.setAttribute("tabindex",0),t&&(e.$.filterInput.unfocusable=!1,e.$.pager.unfocusable=!1),e.$.conditionalFormattingButton.unfocusable=!1}_tableContainerFocusHandler(){const e=this;e._focusedCell&&e.$.tableContainer.contains(e._focusedCell)||e._focusCell(e.$.tableContainer.children[1].querySelector("tr:not([unused]) td[data-field], tr:not([unused]) td.group-header"))}_tableContainerDownHandler(e){const t=this.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;this._focusCell(t.closest("td[data-field], td.group-header")),e.stopPropagation()}_focusCell(e,t){const a=this;if(!e||!e.hasAttribute("data-field")&&!e.classList.contains("group-header")||e.parentElement.classList.contains("grand-total"))return!1;if(a._focusedCell){if(a._focusedCell===e)return!1;a._focusedCell.removeAttribute("focus")}if(a._focusedCell=e,e.setAttribute("focus",""),!t)return;const l=a.$.tableContainer.parentElement,i=a.$.header.offsetHeight,n=a.freezeHeader?a.$.tableContainer.firstElementChild.offsetHeight:0,r=l.scrollTop;let o=e.offsetTop-i-n;if(o<r)l.scrollTop=o;else{const t=a.footerRow&&a.freezeFooter?a.$.tableContainer.lastElementChild.offsetHeight:0,s=a.$.pager.offsetHeight,d=l.clientHeight-(i+n+t+s);o+=e.offsetHeight,o>r+d&&(l.scrollTop=o-d)}if(e.classList.contains("freeze-near")||e.classList.contains("freeze-far"))return;const s=l.scrollLeft,d=a.$.tableContainer.querySelector("tr[row-id]:not([unused])");let c,u=0;if(Array.from(d.children).forEach((e=>{e.classList.contains("freeze-near")&&(u+=e.offsetWidth)})),a.rightToLeft){let t=e.previousElementSibling;for(c=0;t;)t.classList.contains("freeze-near")||(c-=t.offsetWidth),t=t.previousElementSibling;if(c>s)l.scrollLeft=c;else{const t=l.clientWidth;c-=e.offsetWidth,c<s-t&&(l.scrollLeft=c+t-u)}}else if(c=e.offsetLeft-u,c<s)l.scrollLeft=c;else{const t=l.clientWidth;c+=e.offsetWidth+u,c>s+t&&(l.scrollLeft=c-t)}}focus(){const e=this;!e.keyboardNavigation||e.disabled||e.unfocusable||e.hasAttribute("modal")||e.$.tableContainer.focus()}blur(){this.$.tableContainer.blur()}_tableContainerKeydownHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=e.key;if("Shift"===l)return void("extended"===t.selectionMode&&t.$.tableContainer.classList.add("smart-unselectable"));if(!t.contains(a))return;if(a&&"INPUT"===a.nodeName&&!t._editing)return;const i=t._focusedCell;if(!i)return;const n=t.virtualization,r=i.classList.contains("group-header");if(r&&-1!==["ArrowRight","ArrowLeft","Home","End","Escape","F2"].indexOf(l))return void e.preventDefault();if(t._editing){switch(l){case"Enter":t.endEdit();break;case"Escape":t.cancelEdit();break;default:return}return t.$.tableContainer.focus(),void e.preventDefault()}const o=i.parentElement;if(n&&o){const e=t.$.virtualizationContainer.$.verticalScrollBar,a=e.value,i=o.data.$.id;if("ArrowUp"===l&&0===a&&i===t._rowsVirtual[0].data.$.id||"ArrowDown"===l&&a===e.max&&i===t._rowsVirtual[t._rowsVirtual.length-1].data.$.id)return}let s="ArrowRight",d="ArrowLeft";switch(t.rightToLeft&&(s="ArrowLeft",d="ArrowRight"),l){case s:case d:{const a=l===s?"nextElementSibling":"previousElementSibling";let r=i[a];for(;r&&r.classList.contains("smart-hidden");)r=r[a];t._focusCell(r,!n,e),t._scrollToVirtualization(l===s?"nextArrow":"prevArrow",r);break}case"ArrowUp":case"ArrowDown":{const a="ArrowUp"===l?"previousElementSibling":"nextElementSibling";let s=o[a];for(;s&&(s.classList.contains("smart-table-row-detail")||s.classList.contains("collapsed"));)s=s[a];s&&(r?t._focusCell(s.querySelector("td[data-field], .group-header"),!n,e):t._focusCell(s.querySelector(`td[data-field="${i.getAttribute("data-field")}"], .group-header`),!n,e),t._scrollToVirtualization(l,s));break}case"Home":t._focusCell(o.querySelector("td[data-field]"),!n,e),t._scrollToVirtualization(l);break;case"End":{const a=o.querySelectorAll("td[data-field]");let i=a.length-1,r=a[i];for(;r.classList.contains("smart-hidden");)i--,r=a[i];t._focusCell(r,!n,e),t._scrollToVirtualization(l);break}case"PageDown":t._pageDownHandler(i,e);break;case"PageUp":t._pageUpHandler(i,e);break;case"Enter":{const a=o.data;t.dataSource.boundHierarchy&&t._areChildrenFiltered(a)?t._hierarchyArrowClickHandler(o,i,e):t.rowDetailTemplate&&t._toggleRowDetail(o,a.$.id);break}case" ":t._toggleSelection(o,o.data,e);break;case"F2":t.beginEdit(o.data.$.id,i.getAttribute("data-field"));break;default:return}if(e.preventDefault(),t.onKeyboardScroll){const e=n?t.$.virtualizationContainer:t.$.container;t.onKeyboardScroll(l,e.scrollTop,e.scrollLeft)}}_pageDownHandler(e,t){const a=this,l=a.paging;if(!l&&e.parentElement===e.parentElement.parentElement.lastElementChild)return;const i=a.virtualization,n=a.$.tableContainer,r=n.parentElement,o=i?a.$.virtualizationContainer:r;let s=e.getAttribute("data-field");function d(){const e=n.querySelectorAll("tr[row-id]:not([unused])");let t=i?0:a.$.header.offsetHeight+a.$.pager.offsetHeight;a.footerRow&&a.freezeFooter&&(t+=n.lastElementChild.offsetHeight);for(let a=e.length-1;a>=0;a--){const l=e[a];if(!l.classList.contains("collapsed")&&l.offsetTop+l.offsetHeight<=(i?-r.offsetTop:r.scrollTop)+o.clientHeight-t)return l.querySelector(`td[data-field${s}], .group-header`)}}s=s?`="${s}"`:"";let c=d();if(c)if(e===c){const u=(a.freezeHeader?n.firstElementChild.offsetHeight:0)+a._rowHeight;let f;if(i?(f=o.$.verticalScrollBar.value,o.$.verticalScrollBar.value+=o.clientHeight-u):r.scrollTop+=r.clientHeight-u,c=d(),l&&(i&&f===o.$.verticalScrollBar.value||!i&&e===c)){const e=a.pageIndex;a.navigateTo(a.pageIndex+1),a.pageIndex!==e&&(i&&(o.$.verticalScrollBar.value=0),a._focusCell(n.querySelector(`tr[row-id]:not([unused]) td[data-field${s}], tr[row-id]:not([unused]) .group-header`),!i,t))}else a._focusCell(c,void 0,t)}else a._focusCell(c,void 0,t)}_pageUpHandler(e,t){const a=this,l=a.virtualization,i=a.$.tableContainer,n=i.parentElement,r=l?a.$.virtualizationContainer:n;let o=e.getAttribute("data-field");function s(){const e=i.querySelectorAll("tr[row-id]:not([unused])");let t=0;a.freezeHeader&&(t=i.firstElementChild.offsetHeight);for(let a=0;a<e.length;a++){const i=e[a];if(!i.classList.contains("collapsed")&&i.offsetTop>=(l?-n.offsetTop:n.scrollTop)+t)return i.querySelector(`td[data-field${o}], .group-header`)}}o=o?`="${o}"`:"";let d=s();if(d)if(e===d){const c=(a.freezeHeader?i.firstElementChild.offsetHeight:0)+a._rowHeight;let u;if(l?(u=r.$.verticalScrollBar.value,r.$.verticalScrollBar.value-=r.clientHeight-c):n.scrollTop-=n.clientHeight-c,d=s(),a.paging&&(l&&u===r.$.verticalScrollBar.value||!l&&e===d)){const e=a.pageIndex;if(a.navigateTo(a.pageIndex-1),a.pageIndex!==e){l&&(r.$.verticalScrollBar.value=r.$.verticalScrollBar.max);const e=i.querySelectorAll(`tr[row-id]:not([aria-hidden="true"]) td[data-field${o}], tr[row-id]:not([aria-hidden="true"]) .group-header`);a._focusCell(e[e.length-1],!l,t)}}else a._focusCell(d,void 0,t)}else a._focusCell(d,void 0,t)}_tableContainerKeyupHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target;if("Shift"===e.key&&"extended"===t.selectionMode&&t.$.tableContainer.classList.remove("smart-unselectable"),t.contains(a))return a.classList.contains("filter-value")&&"date"!==a.type?(clearTimeout(t._filterRowTimeout),void(t._filterRowTimeout=setTimeout((function(){const e=t.context;t.context=t,t._applyRowFilters(),t.context=e}),500))):void 0}_tableContainerPointeroverHandler(e){const t=this;if(!t.tooltip)return;const a=(t.isInShadowDOM?e.composedPath()[0]:e.target).closest("tbody td[data-field], thead th[data-field]");if(!a)return;const l=t.$.tableContainer.querySelector(".tooltip"),i=t.columnByDataField[a.getAttribute("data-field")],n=t.virtualization;if(l&&(l.classList.remove("tooltip"),l.removeAttribute("title")),"th"!==a.tagName.toLowerCase())(a.classList.contains("tree-cell")&&a.firstElementChild&&a.firstElementChild.children[1].scrollWidth>a.firstElementChild.children[1].offsetWidth||a.scrollWidth>a.offsetWidth)&&(a.classList.add("tooltip"),a.title=n&&i&&i.templateElement?"":a.innerText);else{const e=a.querySelector(".label");e&&e.scrollWidth>e.offsetWidth&&(a.classList.add("tooltip"),a.title=n&&i&&i.templateElement?"":e.innerText)}}_documentDownHandler(e){const t=this,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;function l(){"default"!==t.columnSizeMode&&(t._preventClickSort=!0,clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks?(t._dblclickObject.numberOfClicks=0,t._autoResizeColumnOnDblclick()):t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300))}if(delete t._preventClickSort,t._editing&&!a.closest(".smart-table-editor")){const e=a.closest(".smart-drop-down")||a.closest(".smart-input-drop-down-menu");if(!e)return void t.endEdit();const l=e.ownerElement;if(!l)return void t.endEdit();if(t.$.container.contains(l)&&l.classList.contains("smart-table-editor"))return;return void t.endEdit()}const i=t.columnReorder,n=t.columnResize;if(i&&!t.columnTotals||n){const r=a.closest("th[data-field]:not(.smart-pivot-table-total-header)");if(r&&t.$.tableContainer.contains(r)){if(t.$.tableContainer.classList.add("smart-unselectable"),n&&t._columns.length>1&&!t.hasAttribute("resize-max-reached")){const a=t.rightToLeft,i=r.getBoundingClientRect();let n=null;if(!a&&e.clientX<=i.left+5||a&&e.clientX>=i.right-5){const i=r.previousElementSibling;if(i&&i.hasAttribute("data-field")){if(i.hasAttribute("locked"))return;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.headerCellElement===i){n=a;break}}const r=i.getBoundingClientRect(),o=n&&n.minWidth||t._getNumericMinWidth();return t._resizeDetails={FeedbackShown:!1,Item:i,ItemStart:r[a?"right":"left"]+window.scrollX,Min:o,StartPosition:{left:e.pageX,top:e.pageY},StartTime:new Date},t._resizeDetails.Max=t._getCurrentResizeMax(),void l()}}if(!a&&e.clientX>=i.right-5||a&&e.clientX<=i.left+5){if(r.hasAttribute("locked"))return;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.headerCellElement===r){n=a;break}}const o=n&&n.minWidth||t._getNumericMinWidth();return t._resizeDetails={FeedbackShown:!1,Item:r,ItemStart:i[a?"right":"left"]+window.scrollX,Min:o,StartPosition:{left:e.pageX,top:e.pageY},StartTime:new Date},t._resizeDetails.Max=t._getCurrentResizeMax(),void l()}}i&&(t._dragDetails={FeedbackShown:!1,Item:r,StartPosition:{left:e.pageX,top:e.pageY},StartTime:new Date})}}}_documentMoveHandler(e){const t=this,a=t._dragDetails;if(!a)return void(t._resizeDetails&&t._handleResizeOnMove(e));if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,i=Math.abs(a.StartPosition.left-e.pageX)>5||Math.abs(a.StartPosition.top-e.pageY)>5;if(!i||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&i&&!l&&(delete t._dragDetails,t.$.tableContainer.classList.remove("smart-unselectable")));t._hideBodyOverflow(),a.Feedback=t._addDragFeedback(),a.FeedbackShown=!0,a.Item.classList.add("dragged"),t.classList.add("smart-unselectable")}const l=t.$.tableContainer.parentElement;a.Feedback.style.left=e.pageX+10+"px",a.Feedback.style.top=e.pageY+10+"px",a.HoveredItem&&(a.HoveredItem.classList.remove("drop-column","left","right"),delete a.HoveredItem),l.offsetWidth<l.scrollWidth&&(clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const a=l.getBoundingClientRect();a.left<=e.clientX&&a.left+a.width>=e.clientX?e.clientX>=a.left&&e.clientX<=a.left+25?l.scrollLeft-=t._autoScrollCoefficient:e.clientX>=a.left+a.width-25&&e.clientX<=a.left+a.width?l.scrollLeft+=t._autoScrollCoefficient:clearInterval(t._dragInterval):clearInterval(t._dragInterval)}),10));const i=t._getClosestThToHover(e);i&&(i.classList.add("drop-column"),a.HoveredItem=i)}_hideBodyOverflow(){const e=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,t=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth;this._originalBodyOverflow={overflowX:document.body.style.overflowX,overflowY:document.body.style.overflowY,overflow:document.body.style.overflow},document.body.classList.add("smart-dragging"),document.body.style.overflow=document.body.style.overflowX=document.body.style.overflowY="",e&&!t?document.body.style.overflowX="hidden":t&&!e?document.body.style.overflowY="hidden":t||e||(document.body.style.overflow="hidden")}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=document.createElement("div");return a.className="smart-table-feedback",a.setAttribute("parent-table-id",e.id),a.innerHTML=e.columnByDataField[t.getAttribute("data-field")].label,e.theme&&a.setAttribute("theme",e.theme),document.body.appendChild(a),a}_getClosestThToHover(e){const t=e.clientX,a=Array.from(this.$.tableContainer.querySelectorAll("th[data-field]:not(.smart-pivot-table-total-header)"));let l,i,n;for(let e=0;e<a.length;e++){const r=a[e];if(!r||this._dragDetails.Item===r)continue;const o=r.getBoundingClientRect(),s=Math.abs(t-o.left),d=Math.abs(t-o.right),c=Math.min(s,d);if(!(void 0===i||c<i))break;l=r,i=c,n=s<d?"left":"right"}return l&&l.classList.add(n),l}_handleResizeOnMove(e){const t=this,a=t._resizeDetails;if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,i=Math.abs(a.StartPosition.left-e.pageX)>=1||Math.abs(a.StartPosition.top-e.pageY)>=1;if(!i||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&i&&!l&&(delete t._resizeDetails,t.$.tableContainer.classList.remove("smart-unselectable","resizing"),document.body.style.cursor=null));a.Feedback=t._addResizeFeedbacks(),a.FeedbackShown=!0,t.classList.add("smart-unselectable","resizing"),document.body.style.cursor="col-resize"}const l=a.Feedback,i=a.ItemStart;let n;t.rightToLeft?(n=Math.min(a.Max,Math.max(a.Min,Math.round(i-e.pageX))),l.style.left=i-n+"px"):(n=Math.min(a.Max,Math.max(a.Min,Math.round(e.pageX-i))),l.style.left=i+n+"px"),l.classList.toggle("min",n===a.Min),l.classList.toggle("max",n===a.Max),t.columnResizeFeedback&&(l.innerHTML=n+"px"),a.Width=n}_addResizeFeedbacks(){const e=this,t=e._resizeDetails,a=e.$.container.getBoundingClientRect(),l=a.top+window.scrollY+"px",i=a.height+"px",n=document.createElement("div"),r=document.createElement("div");return r.className="smart-table-resize-feedback static",r.setAttribute("parent-table-id",e.id),r.style.top=l,r.style.left=t.ItemStart+"px",r.style.height=i,e._resizeDetails.StaticFeedback=r,n.className="smart-table-resize-feedback",n.setAttribute("parent-table-id",e.id),n.style.top=l,n.style.height=i,e.theme&&(r.setAttribute("theme",e.theme),n.setAttribute("theme",e.theme)),document.body.appendChild(n),document.body.appendChild(r),n}_resolveResize(e){const t=this,a=t._resizeDetails;if(delete t._resizeDetails,t.$.tableContainer.classList.remove("smart-unselectable","resizing"),e){if(!a.FeedbackShown)return;a.StaticFeedback.remove(),a.Feedback.remove()}const l=t._columns.find((e=>e.headerCellElement===a.Item));t.classList.remove("smart-unselectable","resizing"),document.body.style.cursor=null;let i=a.Width;i<parseInt(t.columnMinWidth)&&(i=parseInt(t.columnMinWidth));const n=t._getTableRemainingWidth();if(l){const e=l._isResponsive||!!(l.width&&l.width.toString().indexOf("%")>=0);if(delete l.width,l.minWidth&&i<l.minWidth&&(i=l.minWidth),l._manualWidth=i,l._manualPercentageWidth=parseFloat(i/n*100),l._isResponsive=e,a.Item.style.width=l._isResponsive?parseFloat(i/n*100)+"%":i+"px",l._isFillRemainingWidth){let e=!0;for(let a=0;a<t._columns.length;a++){const l=t._columns[a];if(!l.width&&!l._manualWidth){e=!1;break}}!t.columnResizeNormalize&&e&&(t.columns.push({dataField:"",label:"",visible:!0,allowResize:!1,allowFilter:!1,allowSort:!1}),t._initColumns(!0),t.refresh())}}else a.Item.style.width=i+"px";t._handleAutoSizeMode(l),t._handleFrozenColumnPositions(),t._refreshHorizontalScrollbar();const r=parseFloat(i/n*100);t.$.fireEvent("columnResize",{dataField:l.dataField,headerCellElement:a.Item,widthInPercentages:r,width:i})}openColumnMenu(e){const t=this,a=t.columnByDataField[e];if(!a)return;const l=a.headerCellElement;if(!l)return;if(a&&!1===a.allowMenu)return;const i=l.querySelector(".column-menu");if(!i)return;const n=()=>{const e=c.getBoundingClientRect(),a=t.activeColumnMenu;t._columnsSettingsMenu.style.top=e.top+window.scrollY+"px",t._columnsSettingsMenu.style.left=e.right+window.scrollX+"px",e.right-i.offsetWidth+window.scrollX+a.offsetWidth>t.getBoundingClientRect().right&&(t._columnsSettingsMenu.style.left=10+e.right-a.offsetWidth-t._columnsSettingsMenu.offsetWidth+window.scrollX+"px")},r=()=>{const e=a.headerCellElement;e.hasAttribute("column-menu-button")||e.setAttribute("column-menu-button","");const l=e.querySelector(".column-menu"),i=l.getBoundingClientRect();o.style.top=i.bottom+10+window.scrollY+"px",o.style.left=i.right-l.offsetWidth+window.scrollX+"px",i.right-l.offsetWidth+window.scrollX+o.offsetWidth>t.getBoundingClientRect().right&&(o.style.left=i.right-o.offsetWidth+window.scrollX+"px");const n=o.querySelector("input");n&&n.focus()};a.columnMenu&&a.columnMenu.remove(),t.closeColumnMenu();const o=document.createElement("div");o.classList.add("smart-table-column-menu","wrapper"),o.owner=l,o.dataField=e;const s=document.createElement("div");s.innerHTML=`<span class='menu-icon sort-asc'></span><span class="label">${t.localize("columnMenuItemSortAsc")}</span>`,s.classList.add("smart-table-menu-item");const d=document.createElement("div");d.innerHTML=`<span class='menu-icon sort-desc'></span><span class="label">${t.localize("columnMenuItemSortDesc")}</span>`,d.classList.add("smart-table-menu-item");const c=document.createElement("div");c.innerHTML=`<span class='menu-icon columns'></span><span class="label">${t.localize("columnMenuItemColumns")}</span>`,c.classList.add("smart-table-menu-item","columns-item");const u=document.createElement("div");u.innerHTML=`<span class='menu-icon filter-by'></span><span class="label">${t.localize("columnMenuItemFilter")}</span>`,u.classList.add("smart-table-menu-item","filter-item");const f=document.createElement("div");f.innerHTML=`<span class='menu-icon filter-by-remove'></span><span class="label">${t.localize("columnMenuItemRemoveFilter")}</span>`,f.classList.add("smart-table-menu-item","remove-filter-item","smart-hidden");const m=document.createElement("div");m.innerHTML=`<span class='menu-icon sort-remove'></span><span class="label">${t.localize("columnMenuItemRemoveSort")}</span>`,m.classList.add("smart-table-menu-item","remove-sort-item","smart-hidden");const h=document.createElement("div");h.innerHTML=`<span class='menu-icon reset'></span><span class="label">${t.localize("columnMenuItemReset")}</span>`,h.classList.add("smart-table-menu-item","reset-item"),c.onmouseleave=e=>{const a=t._columnsSettingsMenu.getBoundingClientRect();e.pageX>=a.left-20&&e.pageX<=a.right+20&&e.pageY>=a.top-20&&e.pageY<=a.bottom+20||t._columnsSettingsMenu&&t._columnsSettingsMenu.remove()},c.onmouseenter=()=>{t._columnsSettingsMenu=(()=>{t._columnsSettingsMenu&&t._columnsSettingsMenu.remove();const a=document.createElement("div");a.classList.add("smart-table-column-menu","wrapper","smart-table-columns-menu");let l=0,i=null;for(let o=0;o<t.columns.length;o++){const s=document.createElement("div");s.innerHTML=`<span class='column-item menu-icon'></span><span class="label">${t.columns[o].label}</span>`,s.classList.add("smart-table-menu-item"),s.column=t.columns[o],e!==s.column.dataField&&!1!==s.column.allowHide&&(s.column.visible?(l++,i=s):s.firstElementChild.classList.add("off"),s.onpointerdown=e=>{s.column.visible=!s.column.visible,s.column.visible?s.firstElementChild.classList.remove("off"):s.firstElementChild.classList.add("off"),r(),n(),e.stopPropagation(),e.preventDefault()},a.appendChild(s))}return 1===l&&i&&i.classList.add("smart-disabled"),document.body.appendChild(a),a})(),n()};const p=t._createFilterRowInput(a);if(t.filtering&&!1!==a.allowFilter)if(t.filterRow)o.insertBefore(f,o.firstElementChild);else{o.innerHTML=p,o.insertBefore(u,o.firstElementChild);const e=o.querySelector(".filter-value");e.onkeyup=a=>{"Enter"===a.key&&t.closeColumnMenu(),"Escape"===a.key&&(e.value="")},e.nextElementSibling.onchange=()=>{t._applyRowFilters()}}o.insertBefore(h,o.firstElementChild),o.insertBefore(c,o.firstElementChild),o.insertBefore(m,o.firstElementChild),!1!==a.allowSort&&"none"!==t.sortMode&&(o.insertBefore(d,o.firstElementChild),o.insertBefore(s,o.firstElementChild),a.headerCellElement.hasAttribute("aria-sort")&&(m.classList.remove("smart-hidden"),"ascending"===a.headerCellElement.getAttribute("aria-sort")?s.classList.add("smart-disabled"):d.classList.add("smart-disabled")),m.onclick=()=>{t.sortBy(a.dataField,null),t.closeColumnMenu()},s.onclick=()=>{t.sortBy(a.dataField,"asc"),t.closeColumnMenu()},d.onclick=()=>{t.sortBy(a.dataField,"desc"),t.closeColumnMenu()}),h.onclick=()=>{if(t._initialState){if(t.loadState(t._initialState),t._filterInfo.filterRowValues&&delete t._filterInfo.filterRowValues,t.clearFilters(),t.filterRow){const e=t.$.tableContainer.querySelector(".smart-table-filter-row");e&&e.remove()}t._initRows(),t.refresh()}t.closeColumnMenu()};const g=t.columns.findIndex((e=>e.dataField===a.dataField));t.appendChild(o);const _=o.lastElementChild.children[2];_&&(_.onclick=()=>{const e=_.parentElement.firstElementChild,a=_.parentElement.children[1];e.value="",-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(a.$.input.dataValue)&&(a.value=t.localize("text"===e.type?"CONTAINS":"EQUAL"),delete a.$.input.dataValue),t._applyRowFilters()});const b=t._filterInfo&&t._filterInfo.filterRowValues?t._filterInfo.filterRowValues[g]:null;if(b&&!t.filterRow){const e=o.lastElementChild,l=a.dataType,i=t._filterInfo["string"===l?"stringConditions":"numberAndDateConditions"].find((e=>e.value===b.condition));if(-1===["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(i.value))if("date"===l){const t=new Date(b.value),a=(t.getMonth()+1).toString(),l=t.getDate().toString();e.children[0].value=`${t.getFullYear()}-${"0".repeat(2-a.length)}${a}-${"0".repeat(2-l.length)}${l}`}else e.children[0].value=b.value;e.children[1].value=i.label,e.children[1].$.input.dataValue=i.value,e.children[2].classList.remove("smart-hidden")}a.headerCellElement.hasAttribute("filter")&&f.classList.remove("smart-hidden"),f.onclick=()=>{t.removeFilter(a.dataField),t.closeColumnMenu()},r(),a.columnMenu=t.activeColumnMenu=o,t.$.fireEvent("openColumnMenu",{dataField:e})}closeColumnMenu(){const e=this;e.activeColumnMenu&&(e.activeColumnMenu.owner.hasAttribute("column-menu-button")&&e.activeColumnMenu.owner.removeAttribute("column-menu-button"),e._columnsSettingsMenu&&e._columnsSettingsMenu.remove(),e.$.fireEvent("closeColumnMenu",{dataField:e.activeColumnMenu.dataField}),e.activeColumnMenu.remove(),delete e.activeColumnMenu)}_documentUpHandler(e){const t=this,a=t._dragDetails;if(t.activeColumnMenu){const a=e.originalEvent?e.originalEvent:e;if(a){let e=!1,l=a.target;for(;l;)if(l=l.parentNode,l===t){e=!0;break}(t.activeColumnMenu.contains(a.target)||t._columnsSettingsMenu&&t._columnsSettingsMenu.contains(a.target))&&(e=!0);const i=t.activeColumnMenu.querySelector("smart-input");i&&i.$.scrollView.contains(a.target)&&(e=!0),e||t.closeColumnMenu()}}if(t._selectDrag)return t.$.main.classList.remove("prevent-scroll"),void delete t._selectDrag;if(!a)return t._resizeDetails&&t._resolveResize(!0),void t.$.tableContainer.classList.remove("smart-unselectable");if(delete t._dragDetails,t.$.tableContainer.classList.remove("smart-unselectable"),!a.FeedbackShown)return;const l=a.HoveredItem;document.body.classList.remove("smart-dragging"),document.body.style.overflow=t._originalBodyOverflow.overflow,document.body.style.eoverflowX=t._originalBodyOverflow.overflowX,document.body.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,t.classList.remove("smart-unselectable"),a.Item.classList.remove("dragged"),document.body.removeChild(a.Feedback),clearInterval(t._dragInterval),delete t._dragInterval,l&&t._applyColumnReorder(a,l),t._preventClickSort=!0,requestAnimationFrame((()=>delete t._preventClickSort))}_applyColumnReorder(e,t){const a=this,l=a.rightToLeft,i=a._columns,n=e.Item.getAttribute("data-field"),r=i.find((e=>e.dataField===n)),o=t.getAttribute("data-field"),s=t.classList.contains("right"),d=a._columns.filter((e=>e.dataField!==n)),c=d.findIndex((e=>e.dataField===o));t.classList.remove("drop-column","left","right"),s&&!l||!s&&l?d.splice(c+1,0,r):d.splice(c,0,r),i.map((e=>e.dataField)).join(",")!==d.map((e=>e.dataField)).join(",")&&(a.columns=d,a._initColumns(),a.refresh())}_applyRowFilters(){const e=this;if(!e.filtering||!e.filterRow&&!e.columnMenu)return;const t=e.filterRow?e.$.tableContainer.querySelector(".smart-table-filter-row"):null,a=Number(e.selection),l=e._columns.filter((e=>e.visible)),i=[],n=[];for(let r=0;r<l.length;r++){const o=l[r].dataField,s=l[r].dataType;if(l[r].headerCellElement&&l[r].headerCellElement.hasAttribute("filter")&&l[r].headerCellElement.removeAttribute("filter"),!e.filterRow&&!l[r].columnMenu){n.push(null);continue}const d=e.filterRow?t.children[r+a].firstElementChild:l[r].columnMenu.lastElementChild,c=d.children[2];let u=d.firstElementChild.value,f=d.children[1].value;"string"===s?f=e._filterInfo.stringConditions.find((e=>e.label===f)).value:(f=e._filterInfo.numberAndDateConditions.find((e=>e.label===f)).value,""!==u&&("number"===s?(u=parseFloat(u),isNaN(u)&&(d.firstElementChild.value="",u="")):"date"===s&&(u=new Date(u),u.setHours(0,0,0))));const m=-1!==["EMPTY","NOT_EMPTY","NULL","NOT_NULL"].indexOf(f);if(""!==u||m){const e=new Smart.Utilities.FilterGroup,t=e.createFilter(s,u,f);e.addFilter("or",t),i.push([o,e]),c.classList.remove("smart-hidden"),n.push({condition:f,value:u}),l[r].headerCellElement&&l[r].headerCellElement.setAttribute("filter","")}else c.classList.add("smart-hidden"),n.push(null),l[r].headerCellElement&&l[r].headerCellElement.hasAttribute("filter")&&l[r].headerCellElement.removeAttribute("filter");m?d.firstElementChild.setAttribute("disabled",!0):d.firstElementChild.removeAttribute("disabled")}i.length>0?(e.dataSource.virtualDataSource||e.dataSource._filter(i,e.filterOperator),e._filterInfo.rowFilters=i,e._filterInfo.filterRowValues=n,delete e._filterInfo.appliedFilters,e._fullRefresh("filter"),e._updateState("filtered"),e._doNotFireEvent||e.$.fireEvent("filter",{action:"add",filters:i})):e._filterInfo.rowFilters?(e._filterInfo.filterRowValues&&delete e._filterInfo.filterRowValues,e.clearFilters()):e._filterInfo.filterRowValues&&delete e._filterInfo.filterRowValues}_clearFilterInput(){const e=this;e._filterInfo.query="",delete e._filterInfo.inputFilters,e.$.filterInput.value=""}_clearRowFilters(e){const t=this;if(!t._filterInfo.rowFilters)return;const a=t.$.tableContainer.querySelector(".smart-table-filter-row"),l=t.selection?1:0;let i=t._columns.filter((e=>e.visible));if(e&&(i=t._columns.filter((t=>t.dataField===e))),a)for(let e=0;e<i.length;e++){const t=a.children[e+l]?a.children[e+l].firstElementChild:null;t&&(t.firstElementChild.value="",t.children[2].classList.add("smart-hidden")),i[e].headerCellElement&&i[e].headerCellElement.hasAttribute("filter")&&i[e].headerCellElement.removeAttribute("filter")}delete t._filterInfo.rowFilters}_createFooterRow(e){const t=this,a=t.footerRow;if(!a)return;if(e)return void t.$.tableContainer.appendChild(e);const l=document.getElementById(a);if(l&&l instanceof HTMLTemplateElement){const e=document.createElement("tfoot"),a=document.importNode(l.content,!0);e.appendChild(a),t.$.tableContainer.appendChild(e)}else t.footerRow=null}_createCustomHeaderRow(){const e=this,t=e.$.tableContainer.firstElementChild;let a=e.headerRow;if(a){if("function"==typeof a)a.call(e,t);else if("string"==typeof a){const e=document.getElementById(a);if(!e)return void(t.innerHTML=`<tr><th>${a}</th></tr>`);a=e}a instanceof HTMLTemplateElement?t.appendChild(document.importNode(a.content,!0)):a.nodeName?t.appendChild(a):e.headerRow=null}}_updateSelectAllState(e){const t=this;if(!t.selection||"cell"===t.selectionMode)return;const a=t.$.tableContainer.querySelector(".smart-table-select-all");let l;if(void 0===e){const a=t.dataSource,i=t._filterInfo;if(i.inputFilters||i.rowFilters||i.appliedFilters){const i=t._selectedIds;e=0,l=0;for(let t=0;t<a.length;t++){const n=a[t];if(!1===n.$.filtered)continue;const r=n.$.id;e++,-1!==i.indexOf(r)&&l++}}else e=t.dataSource.length}void 0===l&&(l=t._selectedIds.length),0===l||0===e?(a.classList.remove("selected","indeterminate"),a.firstElementChild.setAttribute("aria-checked",!1)):l===e+t._selectableGroupRecords.length?(a.classList.remove("indeterminate"),a.classList.add("selected"),a.firstElementChild.setAttribute("aria-checked",!0)):(a.classList.remove("selected"),a.classList.add("indeterminate"),a.firstElementChild.setAttribute("aria-checked","mixed"))}_resizeHandler(){const e=this;clearTimeout(e._resizeTimeout);const t=()=>{if(Smart.Utilities.Core.Browser.Firefox&&e.virtualization){const t=e.$.virtualizationContainer.$.verticalScrollBar.value;e._onVerticalChange({detail:{value:t}},!0)}};t(),"default"===e.columnSizeMode&&e._handleAutoSizeMode(),e._resizeTimeout=setTimeout((function(){if(e.columnGroups&&e._columns.some((e=>e.responsivePriority&&e.responsivePriority>1)))return void e.refresh();const a=e.offsetWidth,l=e.offsetHeight;if(e.virtualization&&e._cachedHeight!==l){const i=e._getFractionOfMax();return e._refreshDataRows(),e._setFractionOfMax(i),e._cachedWidth=a,e._cachedHeight=l,void t()}e._handleAutoSizeMode(),e._handleFrozenColumnPositions(),e._refreshHorizontalScrollbar(),e._cachedWidth=a,e._cachedHeight=l,t()}),75)}_hierarchyArrowClickHandler(e,t){const a=this,l=!a.grouping,i=e.data;if(a.animation=a._animation,a.expandHierarchy&&(a._collapsedIds||(a._collapsedIds=[]),!0===i.expanded?a._collapsedIds[i.$.id]=!0:delete a._collapsedIds[i.$.id],a.dataSource&&a.expandHierarchy&&(a.dataSource._collapsedIds=a._collapsedIds)),l&&a.dataSource.virtualDataSource&&!i.expanded&&i.children&&0===i.children.length)return a._requestVirtualDataSource("expand",void 0,i),void a.$.fireEvent("expand",{id:i.$.id,record:i});if(a.virtualization)return void a._hierarchyArrowClickHandlerVirtualization(e,t);const n=a.$.tableContainer,r=i.$.id;function o(e){e.forEach((e=>{a._expandSingleChildRow(n.querySelector(`tr[row-id="${e.$.id}"]:not([unused])`)),e.children&&e.expanded&&requestAnimationFrame((()=>o(e.children)))}))}if(i.expanded?function e(t){t.forEach((t=>{a._collapseSingleChildRow(n.querySelector(`tr[row-id="${t.$.id}"]:not([unused])`)),t.children&&e(t.children)}))}(i.children):requestAnimationFrame((()=>o(i.children))),i.expanded=!i.expanded,e.setAttribute("aria-expanded",i.expanded),e.classList.toggle("expanded",i.expanded),l)i.expanded?(-1===a._expandedIds.indexOf(r)&&a._expandedIds.push(r),a.$.fireEvent("expand",{id:i.$.id,record:i})):(a._expandedIds=a._expandedIds.filter((e=>e!==r)),a.$.fireEvent("collapse",{id:i.$.id,record:i})),a._updateState("expanded");else if(!0!==t){let e=""+i.$.id;e=e.replace("Item","").replace(/_/gi,"."),i.expanded?a.$.fireEvent("group",{action:"expand",path:e,dataField:i.groupDataField,label:i.label}):a.$.fireEvent("group",{action:"collapse",path:e,dataField:i.groupDataField,label:i.label})}}_expandSingleChildRow(e,t=[]){e&&(t.push(!1),"none"!==this.animation?(e.classList.remove("smart-hidden"),requestAnimationFrame((()=>{e.classList.add("no-height"),e.ontransitionend=function(){e.classList.remove("no-height"),e.ontransitionend=null,t.pop()},e.removeAttribute("aria-hidden"),e.classList.remove("collapsed")}))):(e.removeAttribute("aria-hidden"),e.classList.remove("collapsed","smart-hidden"),t.pop()))}_collapseSingleChildRow(e,t=[]){e&&(t.push(!1),"none"!==this.animation?e.ontransitionend=function(){e.classList.add("smart-hidden"),e.ontransitionend=null,t.pop()}:(e.classList.add("smart-hidden"),t.pop()),e.setAttribute("aria-hidden",!0),e.classList.add("collapsed"))}_getGroupByIndex(e){"number"==typeof e&&(e=e.toString());const t=this.dataSource.boundHierarchy,a=e.split(".");let l=t[a[0]];if(l){for(let e=1;e<a.length;e++)if(l=l.children[a[e]],!l||l.leaf)return;return l}}getGroupChildren(e){"number"==typeof e&&(e=e.toString());const t=this.dataSource.boundHierarchy,a=e.split(".");let l=t[a[0]];if(!l)return[];for(let e=1;e<a.length;e++)if(l=l.children[a[e]],!l||l.leaf)return[];return l.children}_createDialog(){const e=this,t=document.createElement("smart-window"),a=document.createElement("template"),l=` animation=${e.animation} theme="${e.theme}"${e.rightToLeft?" right-to-left":""}${!e.keyboardNavigation||e.unfocusable?" unfocusable":""}`;a.innerHTML=`<smart-button class="ok primary"${l}>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${l}>${e.localize("cancel")}</smart-button>`,t.animation=e.animation,t.footerTemplate=a,t.headerButtons=["close"],t.rightToLeft=e.rightToLeft,t.theme=e.theme,t.unfocusable=!e.keyboardNavigation||e.unfocusable,t.className="smart-table-window",t.ownerElement=e,e._dialog=t,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(t),e.setAttribute("aria-owns",t.id)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("close",e._dialogEventHandler),t.addEventListener("click",e._dialogEventHandler)}_dialogEventHandler(e){const t=this,a=t.ownerElement,l=t.isInShadowDOM?e.composedPath()[0]:e.target,i=e.type,n=a.context;if(a.context=a,"close"===i){if(l!==t)return void(a.context=n);const e=t.classList.contains("conditional-formatting"),i=t.classList.contains("fields");t.ok?(e&&a._applyConditionalFormatting(),delete t.ok):e&&JSON.stringify(a._formattingPanel.items)!==JSON.stringify(a._formattingPanel.getItems())&&(a._formattingPanel.$.itemsContainer.innerHTML="",a._formattingPanel._addDefaultItems()),t.content.innerHTML="",t.classList.remove("conditional-formatting","drill-down","fields"),!a.keyboardNavigation||a.disabled||a.unfocusable||(a.$.tableContainer.setAttribute("tabindex",0),"smart-table"===a.nodeName.toLowerCase()&&(a.$.filterInput.unfocusable=!1,a.$.pager.unfocusable=!1),a.$.conditionalFormattingButton.unfocusable=!1),a.removeAttribute("modal"),e?a.$.conditionalFormattingButton.focus():i&&a.$.fieldsButton?a.$.fieldsButton.focus():a.$.tableContainer.focus()}else"click"===i&&t.$.footer.contains(l)&&(l.closest(".ok")?(t.ok=!0,t.close()):l.closest(".cancel")&&t.close());a.context=n}_openDialog(e,t,a){const l=this;l._dialog||l._createDialog();const i=l._dialog;i.label=e,i.classList.add(a),i.appendChild(t),l.$.tableContainer.removeAttribute("tabindex"),"smart-table"===l.nodeName.toLowerCase()&&(l.$.filterInput.unfocusable=!0,l.$.pager.unfocusable=!0),"drill-down"!==a?i.setAttribute("aria-controls",l.$.tableContainer.id):i.removeAttribute("aria-controls"),l.$.conditionalFormattingButton.unfocusable=!0,l.setAttribute("modal",""),i.open()}_conditionalFormattingButtonClickHandler(e,t,a){const l=this;let i;l._formattingPanel?i=l._formattingPanel:(i=document.createElement("smart-formatting-panel"),i.animation=l.animation,i.columns=t||l._columns,i.dataSource=a||l.dataSource,i.locale=l.locale,i.messages=l.messages,i.rightToLeft=l.rightToLeft,i.theme=l.theme,i.unfocusable=!l.keyboardNavigation||l.unfocusable,i.ownerElement=l,l._formattingPanel=i),l.conditionalFormatting&&(i.items=l.conditionalFormatting.slice(0)),l._openDialog(l.localize("conditionalFormatting"),i,"conditional-formatting")}_transformDataSource(){const e=this;if(!e.isRendered&&e.dataTransform){const t=e.dataSource;for(let a=0;a<t.length;a++)e.dataTransform(t[a])}}_applyInitialConditionalFormatting(e){const t=this,a=t.conditionalFormatting;if(!a||0===a.length)return void(t._conditionalFormatting=null);const l=t._defaults,i=new Smart.Utilities.ConditionalFormatter(e),n=[];let r;if("smart-pivot-table"===t.nodeName.toLowerCase()){const e=t._dynamicColumns;r=function(t){return"all"===t?e.map((e=>e.id)):e.filter((e=>e.dataFields[e.dataFields.length-1].dataField===t)).map((e=>e.id))}}else r=function(e){return"all"===e?t._columns.map((e=>e.value)):[e]};for(let e=0;e<a.length;e++){a[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},a[e]);const t=a[e],o=r(t.column),s=t.condition;i.color=t.highlight,i.comparator=t.firstValue,i.min=t.firstValue,i.max=t.secondValue;const d=i.format(s,o);for(let e in d){const a=d[e];for(let e in a){const l=a[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=a.slice(0)),0===n.length)return n[0];const o={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const a=t[e];o[e]||(o[e]={});for(let t in a)o[e][t]=Object.assign({},o[e][t],a[t])}}t._conditionalFormatting=o}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_applyConditionalFormatting(){const e=this,t=e._conditionalFormatting;e._conditionalFormatting=e._formattingPanel.apply(),e.conditionalFormatting=e._formattingPanel.getItems(),e._conditionalFormatting!==t&&e._refreshDataRows()}_updateState(e,t){const a=this;let l;if("selected"===e&&(l=a.getSelection(),a.selected=l),-1===a.stateSettings.indexOf(e))return;const i=a._state;switch(e){case"columns":i.columns=a._columns;break;case"expanded":i.expanded=a._expandedIds;break;case"filtered":i.filtered=a._filterInfo;break;case"grouped":i.grouped=a.dataSource.groupBy._array.slice(0);break;case"selected":i.selected=l;break;case"sorted":i.sorted=a._sortColumns||[]}a.autoSaveState&&a.isRendered&&!1!==t&&window.localStorage.setItem("smartTable"+a.id,a._stringifyState())}_stringifyState(){const e=this,t=JSON.parse(JSON.stringify(e._state));return["columns","expanded","filtered","grouped","selected","sorted"].forEach((a=>{-1===e.stateSettings.indexOf(a)&&delete t[a]})),JSON.stringify(t,(function(e,t){if(!("function"==typeof t||t instanceof HTMLElement||"sortOrder"===e||"thHierarchy"===e))return t}))}_handleAutoSizeMode(){const e=this;if("default"===e.columnSizeMode){const t=e._columns.filter((e=>e.visible)),a=[],l=t=>{const a=t.headerCellElement;if(!a)return;const l=parseInt(t.minWidth||e.columnMinWidth);a.offsetWidth<l?a.style.width=l+"px":(a.style.width="",a.offsetWidth<l&&(a.style.width=l+"px"))};t.forEach((t=>{if(t.width||t._manualWidth||(l(t),a.push(t)),t.width&&"string"==typeof t.width&&t.width.endsWith("%")){const a=e._getColumnWidth(t.width,!1,t);!1===t.autoWidth?t.headerCellElement.style.width=t.width:(t.headerCellElement.setAttribute("responsive-width",t.width),t.headerCellElement.style.width=a+"px")}else if(t._manualPercentageWidth)if(t._isResponsive){const a=e._getColumnWidth(t._manualPercentageWidth+"%",!1,t);!1===t.autoWidth?t.headerCellElement.style.width=t.width:(t.headerCellElement.setAttribute("responsive-width",t._manualPercentageWidth+"%"),t.headerCellElement.style.width=a+"px")}else t.headerCellElement.style.width=t._manualWidth+"px"}));for(let e=0;e<a.length;e++)l(a[e]);if(e.columnResizeNormalize&&""===e._columns[e._columns.length-1].dataField){const t=e._columns[e._columns.length-1].headerCellElement.offsetWidth;if(t){let a=[];e._columns.forEach((e=>{e.width&&e.width.indexOf("%")>=0&&a.push(e)}));let l=t/a.length;a.forEach((e=>{e.width&&e.width.indexOf("%")>=0&&(e.headerCellElement.style.width=parseInt(e.headerCellElement.style.width)+l+"px")}))}}return}const t=e._columns.filter((e=>e.visible)),a=e._getNumericMinWidth();let l,i;t.forEach((e=>{e.width||e._manualWidth||(l||(l=e),i=e,e.headerCellElement.style.width=null)}));const n=e.$.tableContainer.offsetWidth-(e.selection?e.$.tableContainer.querySelector(".smart-table-select-all").offsetWidth:0);let r=new Map,o=0,s=0,d=0;e.removeAttribute("resize-max-reached"),e.setAttribute("auto-size",""),l&&(l.headerCellElement.style.width="100%");for(let i=0;i<t.length;i++){const n=t[i];if(n===l){d++;continue}const c=n.headerCellElement;let u,f;n.width?(u=f=e._getColumnWidth(n.width,!1,n),n.minWidth&&u<f&&(u=n.minWidth,f=n.minWidth)):n._manualWidth?(u=n._manualWidth,f=n.minWidth||a,u<f&&(u=f)):(u=Math.max(c.offsetWidth,a),f=n.minWidth||a,d++),o+=u,s+=f,n._isResponsive&&(u=e._getColumnWidth(n._manualPercentageWidth+"%",!1,n),u<f&&(u=f)),r.set(n,{width:u,minWidth:f})}function c(){l.headerCellElement.style.width=null;const e=Math.max(l.headerCellElement.offsetWidth,a),t=l.minWidth||a;r.set(l,{width:e,minWidth:t}),o+=Math.max(e,t),s+=t}if(l)if(l!==i)i.headerCellElement.style.width="100%",c(),i.headerCellElement.style.width=null;else if(t.length>1){const e=t.find((e=>e!==l));e.headerCellElement.style.width="100%",c(),e._isResponsive?e.headerCellElement.style.width=r.get(e).width+"%":e.headerCellElement.style.width=r.get(e).width+"px"}else c();if(n<=s||0===d)t.forEach((t=>{if(t._isResponsive){if(t.headerCellElement.style.width=(t._manualPercentageWidth?t._manualPercentageWidth+"%":r.get(t).minWidth)+"px",t._manualPercentageWidth){const a=e._getColumnWidth(t._manualPercentageWidth+"%",!1,t),l=t.minWidth||e.columnMinWidth;a===l&&(t.headerCellElement.style.width=l+"px")}}else t.headerCellElement.style.width=(t._manualWidth?t._manualWidth:r.get(t).minWidth)+"px"})),n<=s&&e.setAttribute("resize-max-reached","");else if(n>s)if(n<o){const a=[];let l,i=o-n,s=d;for(;i>0&&s>0;)l=Math.ceil(i/s),t.forEach((e=>{if(e.width||e._manualWidth||-1!==a.indexOf(e))return;const t=r.get(e);let n=Math.max(t.width-l,t.minWidth);const o=t.width-n;i-=o,n===t.minWidth&&(s--,a.push(e)),t.width=n}));t.forEach((t=>{if(t._isResponsive){if(t.headerCellElement.style.width=r.get(t).width+"%",t._manualPercentageWidth){const a=e._getColumnWidth(t._manualPercentageWidth+"%",!1,t),l=t.minWidth||e.columnMinWidth;a===l&&(t.headerCellElement.style.width=l+"px")}}else t.headerCellElement.style.width=r.get(t).width+"px"}))}else n===o?t.forEach((e=>{e._isResponsive?e.headerCellElement.style.width=r.get(e).width+"%":e.headerCellElement.style.width=r.get(e).width+"px"})):t.forEach((e=>{const t=r.get(e).width;e.headerCellElement.style.width=e===l?n-o+t+"px":t+"px"}));e.removeAttribute("auto-size")}_getNumericMinWidth(){const e=this,t=e.columnMinWidth;return"string"==typeof t&&-1!==t.indexOf("%")?e.offsetWidth*(parseFloat(t)/100):parseFloat(t)}_getCurrentResizeMax(){const e=this;if("default"===e.columnSizeMode)return 1/0;const t=e._resizeDetails,a=e._columns,l=a.find((e=>e.headerCellElement===t.Item)),i=a.indexOf(l);let n,r=a.length-1;for(let e=a.length-1;e>=0;e--)if(a[e].visible){r=e;break}if(i===r)return t.Item.offsetWidth;for(let t=i+1;t<a.length;t++){const l=a[t];t===r&&l.headerCellElement&&(n=l.headerCellElement.getBoundingClientRect()[e.rightToLeft?"left":"right"]+window.scrollX)}return n}_autoResizeColumnOnDblclick(){const e=this,t=e._resizeDetails,a=t.Item,l=e._columns.find((e=>e.headerCellElement!==a)).headerCellElement,i=l.style.width;e.setAttribute("auto-size",""),a.style.width=null,l.style.width="100%";let n=a.offsetWidth;l.style.width=i,e.removeAttribute("auto-size",""),n=Math.min(t.Max,Math.max(t.Min,n)),t.Width=n,e._resolveResize()}_isExpandCollapseForbidden(){const e=this;return(!e.hasAttribute("hierarchy")||e.grouping)&&"smart-pivot-table"!==e.nodeName.toLowerCase()}_selectSingle(e){const t=this,a=t.rowById?t.rowById[e]||t.dataSource.dataItemById[e]:t.rows.dataItemById[e];if(!a)return;const l=a.data?a.data.$.id:a.$.id;if(-1!==t._selectedIds.indexOf(l)||-1!==t._disabledSelection.indexOf(l))return;const i=t.$.tableContainer.querySelector(`tr[row-id="${l}"]:not([unused])`);if("one"===t.selectionMode&&(t._clearSelection(),t._selectedIds=[]),t._selectedIds.push(l),i){const e=i.firstElementChild;e.classList.remove("indeterminate"),e.classList.add("selected"),e.firstElementChild.setAttribute("aria-checked",!0),i.setAttribute("aria-selected",!0)}return t._handleHierarchicalSelection(a,!0),!0}_unselectSingle(e){const t=this,a=t.rowById?t.rowById[e]||t.dataSource.dataItemById[e]:t.rows.dataItemById[e];if(!a)return;const l=a.data?a.data.$.id:a.$.id,i=t._selectedIds.indexOf(l),n=t.$.tableContainer.querySelector(`tr[row-id="${l}"]:not([unused])`);if(-1!==i&&t._selectedIds.splice(i,1),n){const e=n.firstElementChild;e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1),n.setAttribute("aria-selected",!1)}return t._handleHierarchicalSelection(a,!1),!0}_changeSelectionOfMultiple(e,t,a="programmatic",l){const i=this;l||(l=JSON.stringify(i._selectedIds.slice(0).sort()));for(let a=0;a<e.length;a++)i[`_${t}Single`](e[a]);l!==JSON.stringify(i._selectedIds.slice(0).sort())&&(i._updateSelectAllState(),i._updateState("selected"),i.$.fireEvent("change",{type:a}))}_handleHierarchicalSelection(e,t){const a=this;if(!a.hasAttribute("hierarchy"))return;if(!1===a.selectionByHierarchy)return;const l=e.data;let i=l;for(l&&l.children&&function e(t,l){const i=t.children;let n=0;for(let t=0;t<i.length;t++){const r=i[t];if(!1===r.$.filtered)continue;let o=a._setThreeStateCheckbox(r,l);r.children&&r.children.length>0&&(o=e(r,l)),l&&!1===o&&n++}if(l&&n>0)return a._setThreeStateCheckbox(t,n!==i.length&&null)}(l,t);i&&i.parent;){const e=i.parent,t=a._getChildCheckState(e).state;a._setThreeStateCheckbox(e,t),i=e}}_getChildCheckState(e){const t=this,a=t._selectedIds,l=t._disabledSelection,i=e.children;if(!i||0===i.length||!t.selectionByHierarchy){const t=e.$.id,i=-1!==a.indexOf(t);return{state:i,maxSelected:!!i||-1!==l.indexOf(t)}}let n=!0,r=0,o=0,s=0;for(let e=0;e<i.length;e++){const a=i[e];if(!1===a.$.filtered)continue;const l=t._getChildCheckState(a);r++,l.state?o++:null===l.state?s++:!1===l.maxSelected&&(n=!1)}return 0!==o&&o===r?{state:!0,maxSelected:!0}:0===o&&0===s?{state:!1,maxSelected:n}:{state:null,maxSelected:n}}_setThreeStateCheckbox(e,t){const a=this,l=e.$.id,i=a._selectedIds,n=i.indexOf(l);t&&(-1!==a._disabledSelection.indexOf(l)?t=!1:-1===n&&i.push(l)),t||-1===n||i.splice(n,1);const r=a.$.tableContainer.querySelector(`tr[row-id="${l}"]:not([unused])`);if(!r)return t;const o=r.firstElementChild,s=o.firstElementChild;return t?(o.classList.remove("indeterminate"),o.classList.add("selected"),s.setAttribute("aria-checked",!0),r.setAttribute("aria-selected",!0)):!1===t?(o.classList.remove("selected","indeterminate"),s.setAttribute("aria-checked",!1),r.setAttribute("aria-selected",!1)):(o.classList.remove("selected"),o.classList.add("indeterminate"),s.setAttribute("aria-checked","mixed"),r.setAttribute("aria-selected",!1)),t}_getSelectableGroupRecords(){const e=this,t=e.dataSource,a=t.boundHierarchy;e._selectableGroupRecords=[],a?(function t(a){a.forEach((a=>{a.groupDataField&&(e._selectableGroupRecords.push(a.$.id),t(a.children))}))}(a),e._selectedIds=e._selectedIds.filter((a=>void 0!==t.dataItemById[a]||-1!==e._selectableGroupRecords.indexOf(a)))):e._selectedIds=e._selectedIds.filter((e=>void 0!==t.dataItemById[e]))}_clearSelection(e){const t=this;if(0===t._selectedIds.length)return;const a=t.$.tableContainer.querySelector(".smart-table-select-all");Array.from(t.$.tableContainer.querySelectorAll(".smart-table-select-row")).forEach((e=>{e.parentElement.classList.contains("disable-select")||e.parentElement.setAttribute("aria-selected",!1),e.classList.remove("selected","indeterminate"),e.firstElementChild.setAttribute("aria-checked",!1)})),a&&(a.classList.remove("indeterminate","selected"),a.firstElementChild.setAttribute("aria-checked",!1)),t._selectedIds=[],e&&(t._updateState("selected"),t.$.fireEvent("change",{type:"programmatic"}))}_updateCellsWithFormulas(e){const t=this,a=t.formulas,l=t._cellsWithFormulas;if(a||e)for(let e in l){const a=/(.+):(.+)/.exec(e),l=t.columnByDataField[a[1]],i=t.rowById[a[2]];if(!l||!i)continue;const n=t.$.tableContainer.querySelector(`tr[row-id="${i.data.$.id}"]:not([unused]) td[data-field="${l.dataField}"]`);n&&t._setCellContent(n,t._formatCellValue(i,l,n),n.classList.contains("tree-cell"))}}_createVirtualDataRows(e){const t=this,a=t.rowDetailTemplate,l=t.selection,i=t.hasAttribute("hierarchy"),n=document.createDocumentFragment(),r=t.$.virtualizationContainer,o=t.$.tableContainer,s=t._rowHeight;t.isRendered&&(r.scrollWidth=0,r.scrollHeight=0,r.$.scrollViewerContainer.classList.remove("hscroll","vscroll"));const d=r.$.scrollViewerContainer.offsetHeight-o.firstElementChild.offsetHeight-(t.filtering&&t.filterRow?s:0)-(t.footerRow?o.lastElementChild.offsetHeight:0),c=d<5,u=t._getVirtualRecords(i,c),f=u.length;let m=i?2*d:d+3*s,h=s*f,p=0;t._rowsVirtual=u,t._rowsInDOM=[];for(let e=0;e<f;e++){const r=u[e],o=r.data;if(!r.detail){if(o.groupDataField)t._rowsInDOM.push(t._createGroupHeader(o,n));else{const e=t._createDataRow(r,n,{hierarchical:i,rowDetailTemplate:a,selection:l,virtualization:!0});t._rowsInDOM.push(e.row),e.detail&&(t._rowsInDOM.push(e.detail),p+=t._rowDetailHeight,m+=t._rowDetailHeight)}if(p+=s,!c&&p>m)break}}e.appendChild(n),t._updateState("expanded"),e.parentElement||t.$.tableContainer.insertBefore(e,t.$.tableContainer.querySelector("tfoot")),r.refresh(),a&&(h+=t._expandedRowDetailIds.length*(t._rowDetailHeight-s));let g=Math.max(0,h-d);g>0&&r.computedHorizontalScrollBarVisibility&&(g+=r.$.horizontalScrollBar.offsetHeight),r.$.scrollViewerContentContainer.style.top=0,r.$.verticalScrollBar.max=g,t._scrollHeight=h,t._start={view:0,data:0},!c&&t._rowsInDOM.length>0&&r.$.scrollViewerContentContainer.offsetHeight<r.$.scrollViewerContainer.offsetHeight&&t._rowsInDOM[t._rowsInDOM.length-1].classList.add("last-row"),t._fixFrozenHeaderFirefox(),t._focusEquivalentCell()}_getVirtualRecords(e,t){const a=this,l=e&&!t?a.rows.filter((e=>0===e.data.level||!a._isCollapsed(e.data))):a.rows;if(e||!a.rowDetailTemplate)return l;const i=[];return l.forEach((e=>{i.push(e),-1!==a._expandedRowDetailIds.indexOf(e.data.$.id)&&i.push({detail:!0,data:e.data})})),i}_onVerticalChange(e,t){const a=this;if(a._ignoreVerticalChange)return;const l=a.rows,i=a._rowHeight,n=a.$.virtualizationContainer;let r,o,s=e.detail.value;if(Smart.Utilities.Core.Browser.Firefox&&a.virtualization&&(n.$.scrollViewerContentContainer.style.top=null),a.setAttribute("ignore-detail-animation",""),a._rowsInDOM.length===l.length||0===n.$.verticalScrollBar.max){const e=Math.floor(s/i);return a._start={view:e,data:e},n.$.scrollViewerContentContainer.style.top=-s+"px",requestAnimationFrame((()=>a.removeAttribute("ignore-detail-animation"))),void a._fixFrozenHeaderFirefox()}if(a._expandedRowDetailIds.length>0){let e,t=0;r=1;for(let l=0;l<a._rowsVirtual.length;l++){const i=t;if(a._rowsVirtual[l].detail?t+=a._rowDetailHeight:t+=a._rowHeight,void 0===o&&s<=t){o=l,e=s-i;break}}n.computedVerticalScrollBarVisibility?s=e+a._rowHeight:r=0}else{for(s=s%(2*i)+i,s<i&&(s+=i);s+n.$.scrollViewerContainer.offsetHeight>a.$.tableContainer.offsetHeight;)s-=i;r=Math.floor(s/i),o=Math.floor(e.detail.value/i),r<0&&(o-=r,r=0)}n.$.scrollViewerContentContainer.style.top=-s+"px",a._updateVisibleRows(r,o,t||a._expandedRowDetailIds.length>0),a._fixFrozenHeaderFirefox(),requestAnimationFrame((()=>a.removeAttribute("ignore-detail-animation")))}_fixFrozenHeaderFirefox(){const e=this;e.virtualization&&e.$.virtualizationContainer&&e.$.virtualizationContainer.$.scrollViewerContentContainer&&(e._tableHeader.style.top=-parseFloat(e.$.virtualizationContainer.$.scrollViewerContentContainer.style.top)+"px"),Smart.Utilities.Core.Browser.Firefox&&e.virtualization}_focusEquivalentCell(e){const t=this,a=t._focusedCell;if(!e&&!a)return;let l;if(!e){if(!a.parentElement)return;e={rowId:a.parentElement.data.$.id,dataField:a.getAttribute("data-field")}}l=e.dataField?t.$.tableContainer.querySelector(`tr[row-id="${e.rowId}"]:not([unused]) td[data-field="${e.dataField}"]`):t.$.tableContainer.querySelector(`tr[row-id="${e.rowId}"]:not([unused]) td.group-header`),t._focusCell(l)}_detachCachedTemplates(){const e=this;e._cachedTemplates&&(delete e._cachedTemplates,e._tableCachedTemplates&&(e._tableCachedTemplates.remove(),delete e._tableCachedTemplates))}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let a in e._cachedTemplates)t.appendChild(e._cachedTemplates[a]);e._tableCachedTemplates.appendChild(t)}}_updateVisibleRows(e,t,a){const l=this,i=t-e,n=l._rowsVirtual.length,r={hierarchical:l.hasAttribute("hierarchy"),selection:l.selection};let o;if(a=a&&(r.hierarchical||!!l.rowDetailTemplate),r.hierarchical&&!l.grouping&&(a=!0),l._sortColumns&&l._sortColumns.length>0&&(a=!0),l._focusedCell){const e=l._focusedCell.parentElement;e&&(o={rowId:e.data.$.id,dataField:l._focusedCell.getAttribute("data-field")})}for(let t=0;t<e;t++){const e=l._rowsInDOM[t];let n=i+t;n>=0&&(a||e.data.$.index!==n||e.data.detail)&&l._updateVisibleRow(e,n,r),e.setAttribute("unused",""),e.setAttribute("aria-hidden",!0),e.classList.remove("smart-table-row-detail")}for(let t=e;t<l._rowsInDOM.length;t++){const e=l._rowsInDOM[t],o=i+t;o<n?(e.removeAttribute("unused"),e.removeAttribute("aria-hidden"),(a||e.data.$.index!==o||e.data.parent)&&l._updateVisibleRow(e,o,r)):e.setAttribute("aria-hidden",!0)}l._start={view:e,data:t},l._focusEquivalentCell(o)}_updateVisibleRow(e,t,a){const l=this,i=l._columns.filter((e=>e.visible));if(!i.length)return;const n=l._rowsVirtual[t],r=n.data,o=r.$.id,s=Number(a.selection),d=!r.groupDataField&&!e.firstElementChild.classList.contains("group-header")&&!n.detail&&!e.classList.contains("smart-table-row-detail")&&e.childElementCount>1;if(e.className="",d){const t=e.attributes;for(;t.length>0;)e.removeAttribute(t[0].name)}else e.innerHTML="";if(r.groupDataField)l._createGroupHeader(r,void 0,e);else if(n.detail)l._createRowDetailOnDemand(e,n,r);else{e.setAttribute("aria-rowindex",r.$.index+1),l._processAndRenderSelection(r,e,a.hierarchical,d);for(let t=0;t<i.length;t++){const c=i[t];let u=d?e.children[t+s]:document.createElement("td"),f=!1;if(u&&(l.grouping&&!r.groupDataField||l.dataSource&&l.dataSource.groupBy&&l.dataSource.groupBy.length>0)&&u.removeAttribute("colspan"),!u){if(!d)continue;u=document.createElement("td"),f=!0,e.appendChild(u)}d&&(u.className=""),u.setAttribute("data-field",c.dataField),u.setAttribute("aria-colindex",t+1+s);let m,h=l._formatCellValue(n,c,u);if(f&&l._setCellContent(u,h,m),c.freeze&&u.classList.add("freeze-"+("far"===c.freeze?"far":"near")),c.responsivePriority&&u.classList.add("priority-"+c.responsivePriority),!1===c.allowEdit?(u.classList.add("no-edit"),u.setAttribute("aria-readonly",!0)):u.removeAttribute("aria-readonly"),0===t&&a.hierarchical){const e=l._areChildrenFiltered(r);r.leaf||(u.classList.add("tree-cell"),m=e),r.level&&(u.classList.add("outline-level-"+Math.min(r.level,10)),!r.leaf&&e||u.classList.add("tree-leaf"))}if(c.templateElement){if(f&&l.grouping){const e=c.templateElement+"",t=u;e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=e}else if(a.hierarchical&&l.grouping&&r.leaf){const e=c.templateElement+"",t=u;if((!t.firstElementChild||!(t.firstElementChild.hasAttribute("ng-version")||t.innerHTML.indexOf("ng-version")>=0))&&t.firstElementChild&&!t.firstElementChild.classList.contains(".smart-table-cell-template")){const a=t.innerHTML;e.substring(e.lastIndexOf("</"))!==a.substring(a.lastIndexOf("</"))&&(e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=e)}}if(m&&!u.querySelector(".hierarchy-arrow")){l._setCellContent(u,h,m);const e=u.children[0].children[1],t=c.templateElement+"";t.indexOf("{{value}}")>=0?e.innerHTML=t.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):e.innerHTML=t}else if(a.hierarchical&&!l.grouping&&r.leaf){const e=u;if(!e.firstElementChild||!(e.firstElementChild.hasAttribute("ng-version")||e.innerHTML.indexOf("ng-version")>=0)){l._setCellContent(u,h,!1);const t=c.templateElement+"";t.indexOf("{{value}}")>=0?e.innerHTML=t.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):e.innerHTML=t}}if(!d){const e=c.templateElement+"",t=m?u.children[0].children[1]:u;e.indexOf("{{value}}")>=0?t.innerHTML=e.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=e}let e=m?u.children[0].children[1].firstElementChild:u.firstElementChild;if(!e&&a.hierarchical){l._setCellContent(u,h,!1);const t=u,a=c.templateElement+"";a.indexOf("{{value}}")>=0?t.innerHTML=a.replace(/{{value}}/gi,'<div class="smart-table-cell-template">'+r[c.dataField]+"</div>"):t.innerHTML=a,e=m?u.children[0].children[1].firstElementChild:u.firstElementChild}c.templateElementSettings?c.templateElementSettings(r[c.dataField],o,e):c.templateElement.indexOf("{{value}}")>=0&&(u.querySelector(".smart-table-cell-template").textContent=r[c.dataField])}else c.formatFunction,l._setCellContent(u,h,m);l.onCellRender&&l.onCellRender(r,c.dataField,r[c.dataField],u),l._applyConditionalFormattingToCell(u,c.dataField,r.$.index),d||e.appendChild(u)}e.data=r,e.setAttribute("row-id",o),-1!==l._disabledSelection.indexOf(o)&&(e.removeAttribute("aria-selected"),e.classList.add("disable-select"),a.selection&&e.firstElementChild.firstElementChild.setAttribute("aria-disabled",!0)),r.expanded?(-1===l._expandedIds.indexOf(o)&&l._expandedIds.push(o),e.setAttribute("aria-expanded",!0),e.classList.add("expanded")):!1===r.expanded&&e.setAttribute("aria-expanded",!1),r.level&&l._isCollapsed(r)&&(e.setAttribute("aria-hidden",!0),e.classList.add("collapsed","smart-hidden"))}}_createRowDetailOnDemand(e,t,a){const l=this,i=Number(l.selection)+l._columns.filter((e=>e.visible)).length;e.data=Object.assign(a,{detail:!0}),e.classList.add("smart-table-row-detail"),e.removeAttribute("aria-rowindex"),e.removeAttribute("row-id"),e.innerHTML=`<td colspan="${i}"><div class="smart-table-detail-container">${l._applyRowDetailTemplate(t)}</div></td>`}_hierarchyArrowClickHandlerVirtualization(e,t){const a=this,l=!a.grouping,i=a.$.tableContainer,n={nextRow:e.nextElementSibling,tbody:i.children[1]},r=e.data,o=[],s=[],d=Math.ceil((a.$.virtualizationContainer.$.scrollViewerContainer.offsetHeight-i.firstElementChild.offsetHeight)/a._rowHeight);function c(){0===o.length?function(){if(a._ignoreVerticalChange=!0,r.expanded=!r.expanded,l)r.expanded?(-1===a._expandedIds.indexOf(r.$.id)&&a._expandedIds.push(r.$.id),a.$.fireEvent("expand",{id:r.$.id,record:r})):(a._expandedIds=a._expandedIds.filter((e=>e!==r.$.id)),a.$.fireEvent("collapse",{id:r.$.id,record:r})),a._updateState("expanded");else if(!0!==t){const e=t=>{for(let a=0;a<t.length;a++){const l=t[a];if(l.$.id===r.$.id)return l;if(l.children){let t=e(l.children);if(t)return t}}return null},t=e(a.dataSource.boundHierarchy);t&&(t.expanded=r.expanded);let l=""+r.$.id;l=l.replace("Item","").replace(/_/gi,"."),r.expanded?a.$.fireEvent("group",{action:"expand",path:l,dataField:r.groupDataField,label:r.label}):a.$.fireEvent("group",{action:"collapse",path:l,dataField:r.groupDataField,label:r.label})}for(const e of s)e.remove();let e=a.$.virtualizationContainer.$.verticalScrollBar,i=a.$.virtualizationContainer.$.verticalScrollBar.value;a._refreshDataRows(),i=Math.min(e.max,i),e.value=i,delete a._ignoreVerticalChange,a._onVerticalChange({detail:{value:i}},!0)}():requestAnimationFrame((()=>c()))}function u(e){for(const t of e){if(s.length>=d)break;!1!==t.$.filtered&&(s.push(a._expandSingleChildRowVirtualization(t,n,o)),t.children&&t.expanded&&u(t.children))}}r.expanded?function e(t){t.forEach((t=>{a._collapseSingleChildRow(i.querySelector(`tr[row-id="${t.$.id}"]:not([unused])`),o),t.children&&e(t.children)}))}(r.children):requestAnimationFrame((()=>u(r.children))),e.setAttribute("aria-expanded",!r.expanded),e.classList.toggle("expanded",!r.expanded),requestAnimationFrame((()=>c()))}_expandSingleChildRowVirtualization(e,t,a){const l=this,i=l.rowById[e.$.id],n=document.createDocumentFragment();let r;if(i){if(r=i.data.groupDataField?l._createGroupHeader(i.data,n):l._createDataRow(i,n,{virtualization:!0,hierarchical:!0,selection:l.selection}).row,-1===[...t.tbody.children].indexOf(t.nextRow)){let a=!1;e.children&&0===e.children.length&&(a=!0),e.children||(a=!0),l._rowsInDOM&&l._rowsInDOM.length===l.rows.length&&(a=!0),a||t.tbody.appendChild(n)}else t.tbody.insertBefore(n,t.nextRow);return l._expandSingleChildRow(r,a),r}}_getFractionOfMax(){const e=this;return e.isRendered&&e.virtualization?{vertical:function(){const t=e.$.virtualizationContainer.$.verticalScrollBar,a=t.max;return 0===a?0:t.value/a}(),horizontal:function(){const t=e.$.virtualizationContainer.$.horizontalScrollBar,a=t.max;return 0===a?0:t.value/a}()}:null}_setFractionOfMax(e){if(!this.virtualization||null===e)return;const t=this.$.virtualizationContainer,a=t.$.verticalScrollBar,l=t.$.horizontalScrollBar;a.value=a.max*e.vertical,l.value=l.max*e.horizontal}_refreshHorizontalScrollbar(){const e=this.$.virtualizationContainer;if(!e)return;const t=e.$.scrollViewerContainer,a=e.$.horizontalScrollBar,l=e.$.verticalScrollBar,i=e.$.scrollViewerContentContainer.offsetWidth-t.offsetWidth;let n,r;i>0&&!t.classList.contains("hscroll")?(t.classList.add("hscroll"),n="add"):i<=0&&t.classList.contains("hscroll")&&(r=a.offsetHeight,t.classList.remove("hscroll"),n="subtract"),e.scrollWidth!==i&&(e.scrollWidth=i),e.computedVerticalScrollBarVisibility&&("add"===n?(r=a.offsetHeight,l.max+=r):"subtract"===n&&(l.max-=r))}_scrollToVirtualization(e,t){const a=this;if(!a.virtualization)return;const l=a.$.virtualizationContainer,i=l.$.scrollViewerContentContainer,n=l.$.verticalScrollBar,r=l.$.horizontalScrollBar,o=a.$.tableContainer,s=i.offsetLeft,d=i.offsetTop,c=n.value;let u,f;switch(t&&(u=t.offsetLeft,f=t.offsetTop),e){case"nextArrow":{if(!t||!l.computedHorizontalScrollBarVisibility)return;const e=s+u+t.offsetWidth-l.offsetWidth;e>0&&(r.value+=e+n.offsetWidth);break}case"prevArrow":if(!t||!l.computedHorizontalScrollBarVisibility||u>=-s)return;r.value=u-s-r.value;break;case"ArrowUp":{const e=o.firstElementChild.offsetHeight-d-f;if(e<=0)return;let t;if(a._focusedCell){const e=a._focusedCell.parentElement;e&&(t={rowId:e.data.$.id,dataField:a._focusedCell.getAttribute("data-field")})}const l=Math.max(0,c-e);l!==c&&(n.value=l,a._focusEquivalentCell(t));break}case"ArrowDown":{const e=d+f+t.offsetHeight-l.offsetHeight;if(e<=0)return;const a=Math.min(n.max,c+e);a!==c&&(n.value=a);break}case"Home":case"End":if(!l.computedHorizontalScrollBarVisibility)return;r.value="Home"===e?0:r.max}}_getExpandedGroups(e){const t=this,a=[];return e?(function e(l){l.forEach((l=>{l.expanded&&a.push({groupDataField:l.groupDataField,label:l.label,ancestorSignature:t._getGroupAncestorSignature(l)}),l.children&&l.children.length>0&&!1===l.children[0].leaf&&e(l.children)}))}(e),a):[]}_getGroupAncestorSignature(e){const t=[];let a=e.parent;for(;a;)t.push({groupDataField:a.groupDataField,label:a.label}),a=a.parent;return JSON.stringify(t)}_restoreExpandedGroups(e){if(0===e.length)return;const t=this,a=t.dataSource,l=[];!function a(i){i&&i.forEach(((i,n)=>{if(e.some((e=>e.groupDataField===i.groupDataField&&e.label===i.label&&e.ancestorSignature===t._getGroupAncestorSignature(i)))){let e=i.$.id;"string"==typeof e&&(e=e.replace("Item","").replace(/_/g,".")),0===i.level?l.push(n):l.push(e)}i.children&&i.children.length>0&&!1===i.children[0].leaf&&a(i.children)}))}(a.boundHierarchy);const i=t._doNotFireEvent;t._doNotFireEvent=!0,l.forEach((e=>t.expandGroup(e))),t._doNotFireEvent=i}});
|
|
101
|
-
Smart("smart-pivot-table",class extends Smart.Table{static get properties(){return{columnTotals:{value:!1,type:"boolean"},columnTotalsPosition:{value:"near",allowedValues:["near","far"],type:"string"},defaultSortByRowGroups:{value:!1,type:"boolean"},designer:{value:!1,type:"boolean"},designerPosition:{value:"far",allowedValues:["near","far"],type:"string"},drillDown:{value:!1,type:"boolean"},drillDownDataExport:{value:"",allowedValues:["","xlsx","pdf","html","json","csv","tsv","xml"],type:"string"},drillDownDataExportFileName:{value:"smartPivotTableDrillDownDetails",type:"string"},drillDownTableInit:{value:null,type:"function?"},drillDownCustomAction:{value:null,type:"function?"},enableSortByRowGroups:{value:!1,type:"boolean"},getDefaultSummaryFunction:{value:null,type:"function?"},grandTotal:{value:!1,type:"boolean"},groupLayout:{value:"default",allowedValues:["default","classic"],type:"string"},hideCellSelectionTooltip:{value:!1,type:"boolean"},hideEmptyRows:{value:!1,type:"boolean"},messages:{value:{en:{average:"Average",calculation:"Calculation",center:"center",clear:"Clear",columns:"Columns",columnSettings:"Column settings",count:"Count",decimalPlaces:"Decimal places",decimalSeparator:"Decimal separator",details:"Details",dragHereRowGroups:"Drag here to set row groups",dragHereSummaries:"Drag here to set summaries",dragHerePivots:"Drag here to set pivots",fields:"Fields",filter:"Filter",filters:"Filters",grandTotal:"Grand Total",groupHeader:"Group",left:"left",moveTo:"Move to",negativesInBrackets:"Negatives in brackets",numberAlignment:"Number alignment",numberFormat:"Number format",numberPrefix:"Number prefix",notApplicable:"N/A",export:"Export to",pivots:"Pivots",right:"right",row:"Row",rowGroups:"Row Groups",sameSummaryFunctionRequired:'smartPivotTable: When "columnTotals" is enabled, all summary columns must have the same "summary" function set (e.g. \'{{example}}\').',search:"Search...",showRows:"Show records where:",sum:"Sum",summaries:"Summaries",summaryRequired:'smartPivotTable: At least one column with "summary" is required.',textAlignment:"Text alignment",total:"Total",thousandsSeparator:"Thousands separator",summaryPrefix:"of",previousButton:"Previous",itemsPerPage:"Items per page:",firstButton:"First",lastButton:"Last",nextButton:"Next"}},type:"object",extend:!0},nullDefaultValue:{value:null,type:"number?"},rowSort:{value:!1,type:"boolean"},rowSummary:{value:!0,type:"boolean"},rowTotals:{value:!1,type:"boolean"},rowTotalsPosition:{value:"near",allowedValues:["near","far"],type:"string"},selectionMode:{value:"many",type:"string",allowedValues:["many","extended","cell"]},toolbar:{value:!1,type:"boolean"}}}static get listeners(){return{resize:"_overriddenTableHandler","designerContainer.change":"_designerChangeHandler","designerContainer.clear":"_designerFilterHandler","designerContainer.filter":"_designerFilterHandler","fieldsButton.click":"_fieldsButtonClickHandler","tableContainer.change":"_overriddenTableHandler","tableContainer.keyup":"_overriddenTableHandler","tableContainer.touchmove":"_tableContainerTouchmoveHandler","toolbar.close":"_breadcrumbCloseHandler","toolbar.dragEnd":"_breadcrumbDragEndHandler","toolbar.dragging":"_breadcrumbDraggingHandler"}}template(){return'<div id="container" class="smart-container" role="presentation">\n <div id="toolbar" class="smart-pivot-table-toolbar" role="toolbar">\n <smart-breadcrumb id="rowGroupBreadcrumb" class="smart-pivot-table-row-group-breadcrumb" allow-drag allow-drop animation="[[animation]]" close-buttons right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-breadcrumb>\n <smart-breadcrumb id="pivotBreadcrumb" class="smart-pivot-table-pivot-breadcrumb" allow-drag allow-drop animation="[[animation]]" close-buttons right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-breadcrumb>\n <smart-button id="conditionalFormattingButton" class="smart-table-toolbar-button conditional-formatting" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" aria-label="Conditional Formatting"></smart-button>\n <smart-button id="fieldsButton" class="smart-table-toolbar-button fields" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" aria-label="Fields"></smart-button>\n </div>\n <div id="main" class="smart-pivot-table-main-container">\n <table id="tableContainer" class="smart-table-container"></table>\n </div>\n <smart-pager id="pager" animation="[[animation]]" locale="[[locale]]" page-index="[[pageIndex]]" page-size="[[pageSize]]" pages-count="null" show-first-last-navigation-buttons show-page-size-selector show-prev-next-navigation-buttons show-summary right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-pager>\n <div id="designerContainer" class="smart-pivot-table-designer-container"></div>\n </div>'}clearFilters(){const e=this;e._filterInfo.appliedFilters&&(e._clearSortByRow(!0),delete e._filterInfo.appliedFilters,e._clearDesignerFilters(),e.dataSource.clearFilter(),e.refresh(!0),e._originalDynamicColumnsOrder=e._dynamicColumns.map((e=>e.id)),e.$.fireEvent("filter",{action:"remove"}))}clearSelection(){const e=this;"cell"===e.selectionMode?e._clearCellSelection(!0):super.clearSelection()}exportData(e,t,a){const l=this,o=getComputedStyle(l),i=o.borderRightColor,r={hierarchical:!0},n={},s=l._dynamicColumns;let d=[];if(s&&0!==s.length){if(r.style={border:"1px solid "+i,borderCollapse:"collapse",backgroundColor:o.backgroundColor,color:o.color,fontFamily:"Helvetica",header:{border:"1px solid "+i,fontWeight:"bold"},columns:{border:"1px solid "+i}},-1!==["csv","json","tsv","xml"].indexOf(e)){for(let e=0;e<s.length;e++){const t=s[e];t.group?n[t.id]=t.label:n[t.id]=t.dataFields.map((e=>e.label)).join(" -> ")}d.push(n)}else{const e=[],t=[];for(let a=0;a<s.length;a++){const o=s[a],i=o.id,n={},d={};if(l._getColumnExportFormat(o,n,d),r.style.columns[i]=d,r.style.header[i]=n,o.group){n.width=1.25*l._cellWidth+"px",e.push({label:o.label,dataField:i});continue}n.width=l._cellWidth+"px";const c=o.dataFields,u={label:c[c.length-1].label,dataField:i};if(e.push(u),1!==c.length)for(let e=c.length-2;e>=0;e--){const a=c[e].label,l=c.slice(0,e+1).map((e=>e.label)).join("_").replace(/[ ,]/g,"_");if(e===c.length-2&&(u.columnGroup=l),t.find((e=>e.name===l)))continue;const o={label:a,name:l};c[e-1]&&(o.parentGroup=c[e-1].label.replace(/[ ,]/g,"_")),t.push(o)}}n.columns=e,n.columngroups=t,r.header=n}for(let t=0;t<l.rows.length;t++){const a=l.rows[t],o={};for(let t in a){if(-1!==["$","children","count","expanded","leaf","level","parent","sortOrder","tr"].indexOf(t))continue;if("id"===t){o._keyDataField=a.id;continue}if("parentid"===t){o._parentDataField=a.parentid;continue}const l=a[t];o[t]=null!==l?l:"pdf"===e?" ":""}!0!==a.leaf&&(o._expanded=!0===a.expanded),d.push(o)}return new Smart.Utilities.DataExporter(r).exportData(d,e,t,a)}}getDynamicColumns(){return this._dynamicColumns}getSelection(){const e=this;return"cell"===e.selectionMode?e._selectedCells.collection.map((e=>({dataField:e.dataField,rowId:e.rowData.$.id}))):super.getSelection()}select(e,t){const a=this;a.selection&&("cell"!==a.selectionMode?super.select(e):a._toggleCellSelectionProgrammatically(e,t,!0))}sortBy(e,t){const a=this;let l;if(e){let t=null;if(e.group&&(t=a._rowGroupColumns.find((t=>t.label===e.label?t:null))),!t&&(-1===a._dynamicColumns.indexOf(e)||0===a._rowGroupColumns.length))return;if(!1===e.dataFields[e.dataFields.length-1].originalColumn.allowSort)return;l=e.id}a._sortBy({column:e,columnDataField:l,sortOrder:t,dataFields:a._dynamicDataFields,columnByDataField:"_getDynamicColumnById"})}unselect(e,t){const a=this;a.selection&&("cell"!==a.selectionMode?super.unselect(e):a._toggleCellSelectionProgrammatically(e,t,!1))}propertyChangedHandler(e,t,a){const l=this;function o(){l._dynamicColumns.filter((e=>e.rowTotal)).forEach((e=>{delete l._getDynamicColumnById[e.id],l._dynamicDataFields=l._dynamicDataFields.filter((t=>t.name!==e.id))})),l._dynamicColumns=l._dynamicColumns.filter((e=>!0!==e.rowTotal))}switch(e){case"animation":case"rightToLeft":case"theme":super.propertyChangedHandler(e,t,a),l._designer&&(l._designer[e]=a,"rightToLeft"===e&&(l._designer.inverted=l.designer&&("near"===l.designerPosition&&!a||"far"===l.designerPosition&&a))),"rightToLeft"===e&&l.selection&&"cell"===l.selectionMode&&l._showSelectionDetails(!0);break;case"columns":l._conditionalFormatting&&delete l._conditionalFormatting,l._updateColumns(),l._formattingPanel&&(l._formattingPanel.columns=l._aggregateColumns.map((e=>({label:`${e.summary}(${e.label})`,dataField:e.dataField,dataType:"number"}))));break;case"columnTotals":l._clearSortByRow(!0),l.refresh(!0),l._originalDynamicColumnsOrder=l._dynamicColumns.map((e=>e.id));break;case"columnTotalsPosition":{if(!l.columnTotals)return;l._clearSortByRow(!0,!0),o();const e=l._dynamicColumns.filter((e=>e.columnTotal&&0===e.pivotLevel)),t=l._dynamicColumns.filter((e=>e.group)),i=[];!function e(t,l){for(let o=0;o<t.length;o++){const i=t[o];"far"===a&&i.columnTotal&&e(i.children,l),l.push(i),"near"===a&&i.columnTotal&&e(i.children,l)}}(e,i),t.push(...i),l._dynamicColumns=t,l._addRowTotalsDynamicColumnDefinitions(),l.refresh(void 0,l._getCurrentDataStructure()),l._originalDynamicColumnsOrder=l._dynamicColumns.map((e=>e.id));break}case"conditionalFormatting":l._applyInitialConditionalFormatting(l.rows),l.refresh(void 0,l._getCurrentDataStructure());break;case"dataSource":delete l._dataSourceSortedByDefault,delete l._filterInfo.appliedFilters,l._sortColumns=[],l._clearSortByRow(!0),l._clearDesignerFilters(),l._validateDataSource(),l.refresh(!0),l._dynamicColumns&&(l._originalDynamicColumnsOrder=l._dynamicColumns.map((e=>e.id)));break;case"designer":a&&(l._designer?(l._dialog&&l._dialog.classList.contains("fields")&&l._dialog.close(),l._designer.inverted="near"===l.designerPosition&&!l.rightToLeft||"far"===l.designerPosition&&l.rightToLeft,l.$.designerContainer.appendChild(l._designer)):l._initDesigner(l.$.designerContainer));break;case"designerPosition":l.designer&&(l._designer.inverted="near"===a&&!l.rightToLeft||"far"===a&&l.rightToLeft);break;case"disabled":case"unfocusable":case"keyboardNavigation":super.propertyChangedHandler(e,t,a),l._designer&&(l._designer.unfocusable=l.disabled||l.unfocusable||!l.keyboardNavigation);break;case"filtering":a||l.clearFilters();break;case"grandTotal":a?(l.footerRow="footer",l.freezeFooter=!0,l._createGrandTotalRow(l.rows.boundHierarchy,!0)):(l.footerRow=null,l.freezeFooter=!1,l.$.tableContainer.querySelector("tfoot").remove());break;case"groupLayout":l.refresh(!0);break;case"hideCellSelectionTooltip":if(!l.selection||"cell"!==l.selectionMode)return;if(a){const e=l.$.tableContainer.querySelector("[selection-detail]");e&&(e.removeAttribute("selection-detail"),e.removeAttribute("detail-position-x"),e.removeAttribute("detail-position-y"))}else l._showSelectionDetails();break;case"hideEmptyRows":l._rowGroupColumns.length>0&&l.refresh(!0,l._getCurrentDataStructure());break;case"locale":case"messages":if(super.propertyChangedHandler(e,t,a),l._rowGroupColumns){const e=l.$.tableContainer.querySelectorAll(".smart-pivot-table-grouping-header");e[e.length-1].innerHTML=l.localize("groupHeader")}l.columnTotals&&l._dynamicColumns.forEach((e=>{e.columnTotal&&(e.cell.textContent=`${l._totalSummaryFunction}(${l.localize("total")})`)})),l._designer&&(l._designer[e]=l[e]),l.selection&&"cell"===l.selectionMode&&l._showSelectionDetails();break;case"nullDefaultValue":l.refresh(!0,l._getCurrentDataStructure());break;case"rowSort":!a&&l._sortRow&&l._clearSortByRow();break;case"rowTotals":case"rowTotalsPosition":{if(0===l._pivotColumns.length||"rowTotalsPosition"===e&&!l.rowTotals)return;let t=!1;l._clearSortByRow(!0,!0),"rowTotals"===e?a?(t=!0,l._addRowTotalsDynamicColumnDefinitions()):o():"rowTotalsPosition"===e&&(o(),l._addRowTotalsDynamicColumnDefinitions()),l.refresh(t,l._getCurrentDataStructure()),l._originalDynamicColumnsOrder=l._dynamicColumns.map((e=>e.id));break}case"selection":{const e="cell"!==l.selectionMode;e&&l.refresh(void 0,l._getCurrentDataStructure()),a?(l.$.tableContainer.setAttribute("aria-multiselectable",!0),e?l._updateSelectAllState():(l._selectedCells.collection.forEach((e=>e.element.classList.add("selected"))),l._showSelectionDetails(),l.$.main.onscroll=l._mainContainerOnscroll.bind(l))):(l.$.tableContainer.removeAttribute("aria-multiselectable"),e||(l._clearCellSelection(),l.$.main.onscroll=null));break}case"selectionMode":if(super.propertyChangedHandler(e,t,a),"many"===t&&"extended"===a||"many"===a&&"extended"===t)return;"cell"===a?l._selectedIds=[]:l._selectedCells={collection:[]},l.selection&&(l.refresh(void 0,l._getCurrentDataStructure()),l.$.main.onscroll="cell"===a?l._mainContainerOnscroll.bind(l):null);break;default:super.propertyChangedHandler(e,t,a)}}_updateColumns(e){const t=this,a=t._filterInfo.appliedFilters;if(delete t._filterInfo.appliedFilters,t._sortColumns=[],t._clearSortByRow(!0),t._initColumns(),t._designerFiltersApplied)if(e){t._applyingDesignerFilters=!0,t._restoringFilters=!0;for(const e in a)t.addFilter(e,a[e]);delete t._applyingDesignerFilters,delete t._restoringFilters}else t._clearDesignerFilters();t.refresh(!0),t._originalDynamicColumnsOrder=t._dynamicColumns.map((e=>e.id))}_pagerChangeHandler(e){const t=this;(t.isInShadowDOM?e.composedPath()[0]:e.target)===t.$.pager&&(t.pageIndex=e.detail.index,t.refresh(!1),t.$.fireEvent("page",{action:"pageIndexChange"}))}_pagerPageSizeChanged(e){const t=this;t.pageSize=e.detail.value,t.refresh(!1),t.$.fireEvent("page",{action:"pageSizeChange"})}_createElement(){const e=this;e.classList.add("smart-table"),e._cellWidth=parseFloat(getComputedStyle(e.$.container).getPropertyValue("--smart-pivot-table-cell-width")),e._autoScrollCoefficient*=2,e._filterInfo={},e._selectedCells={collection:[]},e.$.header={offsetHeight:0},e.grandTotal&&(e.footerRow="footer",e.freezeFooter=!0),e.selection&&"cell"===e.selectionMode&&(e.$.main.onscroll=e._mainContainerOnscroll.bind(e)),e._setMainContainerMaxHeight(),e._localize(),e._validateDataSource(),e._initColumns(),e.refresh(!0),e.designer&&e._initDesigner(e.$.designerContainer),e._originalDynamicColumnsOrder=(e._dynamicColumns||[]).map((e=>e.id))}_setMainContainerMaxHeight(){const e=getComputedStyle(this.$.container).maxHeight;isNaN(parseFloat(e))||(this.$.main.style.maxHeight=`calc(${e} - 2 * var(--smart-border-width)`)}_validateDataSource(){const e=this,t=e.dataSource;if(!(t instanceof Smart.DataAdapter))if(Array.isArray(e.dataSource)){let a;if(t.length>0){const e=t[0];a=[];for(let t in e){const l=e[t];"number"==typeof l?a.push({name:t,dataType:"number"}):"boolean"==typeof l?a.push({name:t,dataType:"boolean"}):l instanceof Date?a.push({name:t,dataType:"date"}):a.push({name:t,dataType:"string"})}}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:a})}else e.dataSource=new Smart.DataAdapter({dataSource:[]})}_processPivotColumns(){const e=this,t=e.columnTotals,a=[],l=[],o=[],i=[],r=[];let n,s=e.dataSource;if(0===e._columns.length)return!1;for(let s=0;s<e._columns.length;s++){const d=e._columns[s];d.pivot&&d.allowPivot&&(a.push(d),i.push(d.dataField)),d.rowGroup&&d.allowRowGroup&&(l.push(d),r.push(d.dataField)),d.summary&&(o.push(d),n?t&&n!==d.summary&&e.error(e.localize("sameSummaryFunctionRequired",{example:n})):n=d.summary)}return 0===o.length&&e.error(e.localize("summaryRequired")),e._groupByPrimary=i,e._groupBySecondary=r,e._pivotColumns=a,e._rowGroupColumns=l,e._aggregateColumns=o,e._totalSummaryFunction=n,e.defaultSortByRowGroups&&!e._dataSourceSortedByDefault&&l.length>0&&(s=new Smart.DataAdapter({dataSource:e._defaultSortByRowGroups(s),dataFields:s.dataFields}),e.dataSource=s),s.groupBy=i,s.refreshHierarchy(),e._primaryHierarchy=s.boundHierarchy,e.$.rowGroupBreadcrumb.dataSource=l.map((e=>({label:e.label,value:e}))),e.$.pivotBreadcrumb.dataSource=a.map((e=>({label:e.label,value:e}))),!0}refresh(e,t){const a=this,l=a.isRendered;if(a.columns.canNotify=!1,l&&!t&&(a.$.tableContainer.innerHTML=""),t){const e=a.$.tableContainer.firstElementChild,l=document.createDocumentFragment();e.innerHTML="",a._createHeaderCells(t,l),e.appendChild(l)}else{if(!a._processPivotColumns())return;a._createHeader()}a._hideColumnTotalsBorder(),e&&(a._selectedCells={collection:[]},a._createAggregatesSource(),a._applyInitialConditionalFormatting(a.rows)),a._createDataRows(!t);const o=a._sortColumns;l&&(e||t)&&o&&(delete a._sortColumns,o.forEach((e=>{const t=a._getDynamicColumnById[e.dataField];t&&(delete t.sortOrder,a.sortBy(t,e.direction))}))),a.columns.canNotify=!0}_createHeader(){const e=this,t=e.columnTotals,a=e.columnTotalsPosition,l=document.createElement("thead"),o=document.createDocumentFragment(),i=e._pivotColumns.length,r=[];function n(a,l,o){if(t)for(let t=0;t<=i;t++)t<a?r[t].push(l[t]):t===a?r[t].push(o.label):t===i?r[t].push(`TL="${a}"${e._totalSummaryFunction}(${e.localize("total")})`):r[t].push("")}function s(a){const l=e._aggregateColumns;return t&&0===a&&r[0].push(`TL="0"${e._totalSummaryFunction}(${e.localize("total")})`),l.forEach((e=>{r[a].push(`${e.summary}(${e.label})`)})),l.length}for(let e=0;e<=i;e++)r.push([]);i>0?function t(l,o,i){let d=0;for(let c=0;c<l.length;c++){const u=l[c];let m=0;e._filterInfo.appliedFilters&&!e._areChildrenFiltered(void 0,u.children)||("near"===a&&n(o,i,u),u.children&&u.children.length>0&&!0!==u.children[0].leaf?m+=t(u.children,o+1,i.concat([u.label])):m+=s(o+1),"far"===a&&n(o,i,u),r[o].push(...Array(m).fill(u.label)),d+=m)}return d}(e._primaryHierarchy,0,[]):s(0),e._createDynamicColumnDefinitions(r),e._createHeaderCells(r,o),l.appendChild(o),e.$.tableContainer.appendChild(l)}_createDynamicColumnDefinitions(e){const t=this,a=e[e.length-1].length,l=[],o=[],i={};let r=-1;t._dynamicColumns=l,t._dynamicDataFields=o,t._getDynamicColumnById=i;for(let n=0;n<a;n++){const a=e[e.length-1][n];if(t._createTotalColumnDefinition(a,e,n))continue;const s={dataFields:[]},d=[];r++;for(let a=0;a<e.length-1;a++){const l=e[a][n],o=t._pivotColumns[a],i={originalColumn:o,label:l,dataField:o.dataField};s.dataFields.push(i),d.push(l),e[a][n]={label:l,columnDefinition:s,info:i}}const c=t._aggregateColumns[r%t._aggregateColumns.length],u={originalColumn:c,label:a,dataField:c.dataField,summary:c.summary};s.dataFields.push(u),d.push(c.dataField),e[e.length-1][n]={label:a,columnDefinition:s,info:u},s.id=d.join(",").replace(/[ ,]/g,"_"),l.push(s),o.push({name:s.id,dataType:"any"}),i[s.id]=s}if(t._rowGroupColumns.length>0){const e=t.localize("groupHeader"),a={dataFields:t._rowGroupColumns.map((t=>({originalColumn:t,label:e}))),id:"pivotgroup",label:e,group:!0};let r;l.unshift(a),i.pivotgroup=a;for(let e=0;e<a.dataFields.length&&(r=a.dataFields[e].originalColumn.dataType,"string"!==r);e++);o.push({name:"pivotgroup",dataType:r}),o.push({name:"count",dataType:"number"})}t._setColumnTotalsRelations(),t._addRowTotalsDynamicColumnDefinitions(),t.$.tableContainer.removeAttribute("aria-colcount")}_createTotalColumnDefinition(e,t,a){const l=this,o=/TL="(\d+)"/.exec(e);if(!o)return!1;const i=parseFloat(o[1]),r={dataFields:[]},n=[];e=e.replace(/TL="(\d+)"/,"");for(let e=0;e<t.length-1;e++){if(e>i){t[e][a]=Object.assign({},t[e-1][a],{label:""});continue}const o=t[e][a],s=l._pivotColumns[e],d={originalColumn:s,label:o,dataField:s.dataField};r.dataFields.push(d),n.push(o),t[e][a]={label:o,columnDefinition:r,info:d}}return n.push("TOTAL"),r.columnTotal=!0,r.emptyCells=[],r.expanded=!1,r.id=n.join(",").replace(/[ ,]/g,"_"),r.pivotLevel=i,t[t.length-1][a]={label:e,columnDefinition:r,info:{originalColumn:{},label:e,dataField:"TOTAL"}},l._dynamicColumns.push(r),l._dynamicDataFields.push({name:r.id,dataType:"any"}),l._getDynamicColumnById[r.id]=r,!0}_setColumnTotalsRelations(){const e=this;if(!e.columnTotals)return;const t=e._dynamicColumns;for(let a=0;a<e._dynamicColumns.length;a++){const l=e._dynamicColumns[a];if(!l.columnTotal)continue;const o=l.id.replace("_TOTAL","");let i;0===e._pivotColumns.length?(l.expanded=!0,i=t.filter((e=>{if(!e.columnTotal&&!e.group)return e.parent=l,!0}))):i=l.pivotLevel===e._pivotColumns.length-1?t.filter((e=>{if(!e.columnTotal&&0===e.id.indexOf(o))return e.parent=l,!0})):t.filter((e=>{if(e.columnTotal&&e.pivotLevel===l.pivotLevel+1&&0===e.id.indexOf(o))return e.parent=l,!0})),l.children=i}}_addRowTotalsDynamicColumnDefinitions(){const e=this;if(!e.rowTotals||0===e._pivotColumns.length)return;const t=[];e._aggregateColumns.forEach((a=>{const l=a.dataField,o="TOTAL_"+l,i={dataFields:[{originalColumn:a,label:`${a.summary}(${a.label})`,dataField:l,summary:a.summary}],id:o,rowTotal:!0};t.push(i),e._getDynamicColumnById[o]=i,e._dynamicDataFields.push({name:o,dataType:"any"})})),"near"===e.rowTotalsPosition?e._dynamicColumns.splice(0+Number(e._rowGroupColumns.length>0),0,...t):e._dynamicColumns.push(...t)}_createHeaderCells(e,t){const a=this,l=e[e.length-1].length,o=a.columnTotals,i=a.selection&&"cell"!==a.selectionMode,r=a.onColumnRender,n=a.rowTotalsPosition,s=a._rowGroupColumns.length>0,d=a._cellWidth;function c(t,a){if(0===a)return!0;let l=t,o=!1;for(;l>=0&&!o;){const t=e[l][a-1],i=e[l][a];o=t.label!==i.label||JSON.stringify(t.info)!==JSON.stringify(i.info),l--}return o}for(let u=0;u<e.length;u++){const m=document.createElement("tr"),p=e[u];if(i)if(u===e.length-1)m.innerHTML='<th class="smart-pivot-table-selection-header smart-table-select-all freeze-near"><div role="checkbox" aria-checked="false" aria-label="Toggle selection of all rows"></div></th>';else{const e=document.createElement("th");0===u&&(e.style.width=getComputedStyle(a.$.container).getPropertyValue("--smart-table-row-height")),e.classList.add("smart-pivot-table-selection-header","freeze-near"),m.appendChild(e)}s&&a._createGroupHeaderCells(u,e,m),"near"===n&&a._createRowTotalsHeaders(u,e,m);const g={};for(let t=0;t<l;t++){let i=p[t],n=i.label,s=i.columnDefinition;if(void 0===n)break;const f=document.createElement("th");if(c(u,t)){if(g.cell&&!o&&(g.span>1&&(g.cell.colSpan=g.span),0===u&&(g.cell.style.width=d*g.span+"px")),t===l-1&&0===u?o||(f.style.width=d+"px"):(g.cell=f,g.span=1),f.columnDefinition=s,s.columnTotal&&""===n)s.emptyCells.push(f),f.classList.add("empty");else if(r){const e={text:n,cell:f,column:i.info,fullDefinition:s};a.onColumnRender(e),n=e.text}u===e.length-1&&(a._addSortingCapability(f,s),n=`<div class="wrapper" role="presentation"><div class="label">${n}</div></div>`),i.info&&i.info.originalColumn&&i.info.originalColumn.align&&f.classList.add("align-"+i.info.originalColumn.align),f.innerHTML=n,o&&a._processColumnTotalsHeaderCells(f,s,u),m.appendChild(f)}else g.span++,t!==l-1||o||(g.cell.colSpan=g.span,0===u&&(g.cell.style.width=d*g.span+"px"))}"far"===n&&a._createRowTotalsHeaders(u,e,m),t.appendChild(m)}}_createGroupHeaderCells(e,t,a){const l=this,o="classic"===l.groupLayout,i=o?l._rowGroupColumns.length:1;for(let r=0;r<i;r++){const i=document.createElement("th");if(i.classList.add("smart-pivot-table-grouping-header"),e===t.length-1){const e=l._dynamicColumns[0];let t=o?e.dataFields[r].originalColumn.label:l.localize("groupHeader");if(l.onColumnRender){const a={text:t,cell:i,column:e.dataFields[0],fullDefinition:e};l.onColumnRender(a),t=a.text}if(0===r)l._addSortingCapability(i,e),t=`<div class="wrapper" role="presentation"><div class="label">${t}</div></div>`;else if(o&&l.enableSortByRowGroups){const a=JSON.parse(JSON.stringify(l._dynamicColumns[0]));a.dataFields=[],a.dataFields.push(e.dataFields[r]),a.headerCellElement=i,a.cell=i,a.id=e.dataFields[r].originalColumn.dataField,a.label=e.dataFields[r].originalColumn.label,l._getDynamicColumnById[a.id]=a,l._addSortingCapability(i,a),t=`<div class="wrapper" role="presentation"><div class="label">${t}</div></div>`}i.innerHTML=t}a.appendChild(i)}}_processColumnTotalsHeaderCells(e,t,a){const l=this,o=l.columnTotalsPosition;if(a<l._pivotColumns.length&&!e.classList.contains("empty")){const i=document.createElement("div");if(i.className="total-arrow smart-arrow smart-arrow-right",i.setAttribute("role","button"),i.setAttribute("aria-label","Toggle column"),!l.keyboardNavigation||l.disabled||l.unfocusable||(i.tabIndex=0),e.appendChild(i),"far"!==o||t.columnTotal)e.controller=t;else{let o=l._pivotColumns.length,i=t;for(;o>a;)i=i.parent,o--;e.controller=i}e.controller.arrowCell=e,l._getColumnTotalColspan(e)}const i=function e(t){return!!t.parent&&(!t.parent.expanded||e(t.parent))}(t);t.hidden=i,"near"===o?(e.classList.toggle("smart-hidden",i),e.classList.toggle("expanded",t.expanded)):(e.controller&&t!==e.controller||e.classList.toggle("smart-hidden",i),t.arrowCell&&t.arrowCell!==e&&(t.arrowCell.classList.toggle("smart-hidden",i),t.arrowCell.classList.toggle("expanded",t.expanded)))}_getColumnTotalColspan(e){const t=function e(t){let a=1;if(t.expanded)for(let l=0;l<t.children.length;l++){const o=t.children[l];o.columnTotal?a+=e(o):a+=1}return a}(e.controller);t>1?e.colSpan=t:e.removeAttribute("colspan"),e.style.width=this._cellWidth*t+"px"}_createRowTotalsHeaders(e,t,a){const l=this;if(l.rowTotals&&0!==l._pivotColumns.length)for(let o=0;o<l._aggregateColumns.length;o++){const i=l._getDynamicColumnById["TOTAL_"+l._aggregateColumns[o].dataField],r=document.createElement("th");if(r.classList.add("smart-pivot-table-total-header"),e===t.length-1){let e=i.dataFields[0].label;if(l.onColumnRender){const t={text:e,cell:r,column:i.dataFields[0],fullDefinition:i};l.onColumnRender(t),e=t.text}r.innerHTML=`<div class="wrapper" role="presentation"><div class="label">${e}</div></div>`,l._addSortingCapability(r,i)}a.appendChild(r)}}_createAggregatesSource(){const e=this,t=e.dataSource,a=e.hideEmptyRows,l=e.nullDefaultValue,o=e._aggregateColumns,i=[],r=[],n={id:0,totals:[]},s=[],d=e._selectedIds.slice(0);let c;e._cachedSecondaryHierarchy=null;for(let e=0;e<o.length;e++){const t=o[e],a={};a[t.dataField]=[t.summary],r.push(a)}function u(t,a){for(let l=e._groupByPrimary.length-1;l>=0;l--){const o=t[e._groupByPrimary[l]],i=a[e._groupByPrimary[l]];if(o instanceof Date){if(o.getTime()!==i.getTime())return!1}else if(o!==i)return!1}return!0}function m(a,l,o,i){if(0!==e._pivotColumns.length)for(let n=0;n<a.length;n++){const s=a[n];if(s.children&&s.children.length>0&&!0!==s.children[0].leaf)m(s.children,l,o,i.concat([s.label]));else{const a=l.children.filter((e=>!1!==e.$.filtered&&(!c||u(s.data,e))));if(0===a.length)continue;const n=i.concat([s.label]).filter((e=>void 0!==e)),d=t.summarize(r,a);e._setRowValue(o,n,d,a)}}else{const a=l.children.filter((e=>!1!==e.$.filtered));if(a.length>0){const l=t.summarize(r,a);e._setRowValue(o,i,l,a)}}}if(e._originalRecords={},e._cachedSecondaryHierarchy=null,0===e._rowGroupColumns.length?(function a(l,o){if(0!==e._pivotColumns.length)for(let i=0;i<l.length;i++){const s=l[i];if(s.children&&s.children.length>0){const l=o.concat([s.label]);if(!0!==s.children[0].leaf)a(s.children,l);else{const a=s.children.filter((e=>!1!==e.$.filtered));if(0===a.length)continue;const o=t.summarize(r,a);e._setRowValue(n,l,o,a)}}}else{const a=e.dataSource.toArray().filter((e=>!1!==e.$.filtered));if(0===a.length)return;const l=t.summarize(r,a);e._setRowValue(n,o,l,a)}}(e._primaryHierarchy,[]),i.push(n),s.push(n.id)):(c=e._groupByPrimary[e._groupByPrimary.length-1],function l(o,r,n){let d=e._getSecondaryHierarchy(o);if(r)for(let e=0;e<n.length;e++)d=d[n[e]].children;d.forEach(((d,c)=>{let u=d.children.length;if(e._filterInfo.appliedFilters&&(u=e._areChildrenFiltered(void 0,d.children),!1===d.data.$.filtered&&!u))return;const p={},g=new Smart.DataAdapter({dataSource:d.children,dataFields:t.dataFields,groupBy:e._groupByPrimary});if(r&&(p.parentid=r.id),p.id=(r?r.id:"")+d.label+o,p.level=o,p.totals=[],s.push(p.id),m(g.boundHierarchy||g,d,p,[]),a){let e=!0;for(const t in p){if(-1!==["children","count","expanded","pivotgroup","group","id","level","parent","parentid","totals","tr"].indexOf(t))continue;const a=p[t];if(0!==a&&null!==a){e=!1;break}}if(e)return void(r&&(r.hiddenChildren?r.hiddenChildren++:r.hiddenChildren=1))}i.push(p),o<e._groupBySecondary.length-1&&l(o+1,p,n.concat([c])),p.hiddenChildren&&(u-=p.hiddenChildren,delete p.hiddenChildren),p[e._dynamicColumns[0].id]=d.label,p.count=u}))}(0,void 0,[])),e._setRowTotalsSource(i,r),e._setColumnTotalsSource(i),null!==l)for(const t of i)for(const a of e._dynamicDataFields)void 0===t[a.name]&&(t[a.name]=l);if(e.rows=new Smart.DataAdapter({dataSource:i,id:"id",keyDataField:"id",parentDataField:"parentid",dataFields:e._dynamicDataFields}),!e.isRendered&&e.onInit&&e.onInit(),d.length>0){const t=[];for(let e=0;e<d.length;e++)-1!==s.indexOf(d[e])&&t.push(d[e]);e._selectedIds=t}delete e._selectionStart,e.selection&&"cell"!==e.selectionMode&&e._updateSelectAllState()}_setRowValue(e,t,a,l){const o=this;let i=[];o._aggregateColumns.forEach((r=>{const n=r.dataField,s=a[n][r.summary],d=t.concat([n]).join(",").replace(/[ ,]/g,"_");e[d]=s,o._originalRecords[e.id+d]=l,i.push({dataPoint:s})})),e.totals=e.totals.concat(l)}_setRowTotalsSource(e,t){const a=this;if(!a.rowTotals||0===a._pivotColumns.length)return;const l=new Smart.DataAdapter({dataSource:[],dataFields:a.dataSource._dataFields});for(let o=0;o<e.length;o++){const i=e[o],r=i.id,n=i.totals,s=l.summarize(t,n);for(let e in s)i["TOTAL_"+e]=Object.values(s[e])[0],a._originalRecords[r+"TOTAL_"+e]=n;delete i.totals}}_setColumnTotalsSource(e){const t=this;if(!t.columnTotals)return;const a=t._dynamicColumns.filter((e=>e.columnTotal)),l=new Smart.DataAdapter({dataSource:[],dataFields:[{name:"dataPoint"}]});for(let o=0;o<e.length;o++){const i=e[o],r=i.id;for(let e=0;e<a.length;e++){const o=a[e],n=t._getColumnTotalsOriginalRecords(o,r);0!==n.length&&(t._originalRecords[r+o.id]=n,i[o.id]=t._getTotalSummary(n,l))}}}_getTotalSummary(e,t){const a=[];return this._aggregateColumns.forEach((t=>{e.forEach((e=>{a.push({dataPoint:e[t.dataField]})}))})),t.summarize([{dataPoint:[this._totalSummaryFunction]}],a).dataPoint[this._totalSummaryFunction]}_getSecondaryHierarchy(e){const t=this,a=t.dataSource;return t._cachedSecondaryHierarchy&&t._cachedSecondaryHierarchy[e]?t._cachedSecondaryHierarchy[e]:(Array.isArray(a.groupBy)?a._groupBy=t._groupBySecondary.slice(0,e+1):(a._groupBy.canNotify=!1,a._groupBy=t._groupBySecondary.slice(0,e+1),a._groupBy.canNotify=!0),a.refreshHierarchy(),t._cachedSecondaryHierarchy||(t._cachedSecondaryHierarchy=[]),t._cachedSecondaryHierarchy[e]=a.boundHierarchy,a.boundHierarchy)}_createDataRows(e){const t=this;let a,l,o=t.rows.boundHierarchy,i=document.createDocumentFragment(),r={collection:[]},n=0,s=o.length,d=!1;if(t.paging&&o&&o.length>0){const e=t.pageSize;if(t._filterInfo.query||t._filterInfo.rowFilters||t._filterInfo.appliedFilters){let e=0;for(let t=0;t<s;t++)!1!==o[t].$.filtered&&e++;s=e,d=!0}const a=Math.max(Math.ceil(s/e),1);if(t.$.pager.pagesCount=a,t.$.pager.totalRecords=s,t.pageIndex=Math.max(Math.min(t.pageIndex,a-1),0),n=t.pageIndex*e,s=n+e,d){let e=-1,t=[];for(let a=0;a<o.length;a++){const l=o[a];if(l&&!1!==l.$.filtered){if(e++,e<n)continue;if(e>=s)break;t.push(l)}}o=t}else{let e=[];for(let t=n;t<s;t++){const a=o[t];a&&!1!==a.$.filtered&&e.push(a)}o=e}}o&&o.length>0&&("default"===t.groupLayout?t._createRowElements(o,i,r):(t._expanded=[],t._hidden={},t._rowGroupColumns.forEach(((e,a)=>{t._expanded.push([]),t._hidden[a]=!1})),t._createRowElementsClassic(o,i,r))),i.appendChild(t._createLastRow()),e?(a=document.createElement("tbody"),t.$.tableContainer.appendChild(a)):(a=t.$.tableContainer.querySelector("tbody"),a.innerHTML=""),a.appendChild(i),"classic"===t.groupLayout&&(t._updateGroupColumnsVisibility(),t._updateDisplayedRecordsVisibility(t.rows.boundHierarchy),t._updateDisplayedRecordsUIVisibility(t.rows.boundHierarchy)),t._createGrandTotalRow(o,e),t._selectedCells=r,t.selection&&"cell"===t.selectionMode&&(l=!0,t._showSelectionDetails()),t.getRootNode().activeElement===t.$.tableContainer&&(l&&r.start?super._focusCell(r.start.element):t._tableContainerFocusHandler())}_createRowElements(e,t,a){const l=this,o=l.selection&&"cell"!==l.selectionMode,i=l._dynamicColumns;for(let r=0;r<e.length;r++){const n=document.createElement("tr"),s=e[r],d=s.level;if(s.tr=n,n.data=s,o){const e=document.createElement("td"),t=-1!==l._selectedIds.indexOf(s.$.id);e.className="smart-table-select-row freeze-near"+(t?" selected":""),e.innerHTML=`<div class="selection-checkbox" role="checkbox" aria-checked="${t}" aria-label="Toggle row selection"></div>`,n.appendChild(e),n.setAttribute("aria-selected",t)}for(let e=0;e<i.length;e++){const t=document.createElement("td"),o=i[e],r=s[o.id];let c,u,m=r;if(l._restoreSelectedCells(t,o,s,m,a),0===e&&o.group){const e=s.leaf;c=o.dataFields[d].originalColumn,m=l._formatCellValue(s,c,t,m),l.rowSummary&&(m=`${m}<span class="group-label-count"> (${s.count})</span>`),e||(t.classList.add("tree-cell"),u=!0),d>0&&(t.classList.add("outline-level-"+d),e&&t.classList.add("tree-leaf")),c.align&&t.classList.add("align-"+c.align),s.sortOrder&&(t.classList.add("sort-by",s.sortOrder),t.setAttribute("aria-sort",s.sortOrder+"ending"))}else c=o.columnTotal?l._aggregateColumns[0]:o.dataFields[o.dataFields.length-1].originalColumn,m=l._formatSummaryValue(s,c,t,m);l.onCellRender&&l.onCellRender(s,o,r,t),l._applyConditionalFormattingToCell(t,o.id,s.$.index),t.setAttribute("data-field",o.id),t.classList.toggle("smart-hidden",!0===o.hidden),l._setCellContent(t,m,u),n.appendChild(t)}s.expanded&&(n.setAttribute("aria-expanded",!0),n.classList.add("expanded")),d>0&&l._isCollapsed(s)&&(n.setAttribute("aria-hidden",!0),n.classList.add("collapsed","smart-hidden")),n.setAttribute("row-id",s.$.id),t.appendChild(n),s.children&&s.children.length>0&&l._createRowElements(s.children,t,a)}}_restoreSelectedCells(e,t,a,l,o){const i=this._selectedCells;if(0===i.collection.length)return;if(!i.collection.find((e=>e.dataField===t.id&&e.rowData.$.id===a.$.id)))return;const r={dataField:t.id,element:e,row:a.tr,rowData:a,value:l};o.collection.push(r),r.dataField===i.start.dataField&&r.rowData.$.id===i.start.rowData.$.id&&(o.start=r),r.dataField===i.end.dataField&&r.rowData.$.id===i.end.rowData.$.id&&(o.end=r),this.selection&&e.classList.add("selected")}_createRowElementsClassic(e,t,a){const l=this,o=l.selection&&"cell"!==l.selectionMode,i=l._dynamicColumns;for(let r=0;r<e.length;r++){const n=e[r],s=n.level;if(s>0&&0===r){n.expanded&&l._expanded[s].push(n),n.children&&n.children.length>0&&l._createRowElementsClassic(n.children,t,a);continue}const d=document.createElement("tr");let c=l._getRecordToDisplay(n);if(n.tr=d,d.data=n,n.expanded&&(d.setAttribute("aria-expanded",!0),d.classList.add("expanded"),l._expanded[s].push(n)),s>0&&l._isCollapsed(n)&&(d.setAttribute("aria-hidden",!0),d.classList.add("collapsed","smart-hidden")),o){const e=document.createElement("td"),t=-1!==l._selectedIds.indexOf(n.$.id);e.className="smart-table-select-row freeze-near"+(t?" selected":""),e.innerHTML=`<div class="selection-checkbox" role="checkbox" aria-checked="${t}" aria-label="Toggle row selection"></div>`,d.appendChild(e),d.setAttribute("aria-selected",t)}for(let e=0;e<i.length;e++){const t=i[e];let o,r=n[t.id],s=r;if(0===e&&t.group){l._createGroupCellsClassic(d,n,t,r,a);continue}const u=document.createElement("td");r=c[t.id],s=r,l._restoreSelectedCells(u,t,n,s,a),o=t.columnTotal?l._aggregateColumns[0]:t.dataFields[t.dataFields.length-1].originalColumn,s=l._formatSummaryValue(c,o,u,s),l.onCellRender&&l.onCellRender(c,t,r,u),l._applyConditionalFormattingToCell(u,t.id,c.$.index),u.setAttribute("data-field",t.id),u.classList.toggle("smart-hidden",!0===t.hidden),l._setCellContent(u,s),d.appendChild(u)}d.setAttribute("row-id",n.$.id),t.appendChild(d),n.children&&n.children.length>0&&l._createRowElementsClassic(n.children,t,a)}}_updateGroupColumnsVisibility(){const e=this,t=e._expanded;function a(e){return!e.parent||!!e.parent.expanded&&a(e.parent)}if(!(t.length<2)){for(let l=0;l<t.length-1;l++){const o=t[l],i=l+1;let r=0;if(o.forEach((e=>r+=Number(a(e)))),0===r&&!e._hidden[i]||r>0&&e._hidden[i]||e._hidden[l]&&!e._hidden[i]){e._hidden[i]=!e._hidden[i];const t=Array.from(e.$.tableContainer.querySelectorAll(`.smart-pivot-table-grouping-header:nth-child(${i+1+Number(e.selection&&"cell"!==e.selectionMode)})`)).concat(Array.from(e.$.tableContainer.querySelectorAll(`td[data-field="group${i}"]`)));e._hidden[i]?t.forEach((e=>e.classList.add("smart-hidden"))):t.forEach((e=>e.classList.remove("smart-hidden")))}}if(e._focusedCell&&e._focusedCell.classList.contains("smart-hidden")&&-1!==e._focusedCell.getAttribute("data-field").indexOf("pivotgroup")){let t=e._focusedCell.previousElementSibling;for(;t.classList.contains("smart-hidden");)t=t.previousElementSibling;e._focusCell(t)}}}_getRecordToDisplay(e){return e.leaf||!e.expanded?e:this._getRecordToDisplay(e.children[0])}_getFirstChildAtLevel(e,t){let a=t.children[0];for(;a.children&&a.level!==e;)a=a.children[0];return a}_createGroupCellsClassic(e,t,a,l,o){const i=this,r=i._rowGroupColumns.length,n=t.level;for(let s=0;s<r;s++){const r=document.createElement("td");if(i._restoreSelectedCells(r,a,t,l,o),r.setAttribute("data-field","pivotgroup"+s),e.appendChild(r),s<n)continue;let d,c=t,u=a.dataFields[s].originalColumn;s>n?(c=i._getFirstChildAtLevel(s,t),l=c[a.id]):r.classList.add("main"),c.cell=r,c.sortOrder&&(r.classList.add("sort-by",c.sortOrder),r.setAttribute("aria-sort",c.sortOrder+"ending"));let m=l;m=i._formatCellValue(c,u,r,m),i.rowSummary&&(m=`${m}<span class="group-label-count"> (${c.count})</span>`),c.leaf||(r.data=c,d=!0,r.classList.add("tree-cell"),c.expanded&&r.classList.add("expanded","main")),u.align&&r.classList.add("align-"+u.align),i.onCellRender&&i.onCellRender(c,a,l,r),i._applyConditionalFormattingToCell(r,a.id,t.$.index),i._setCellContent(r,m,d)}}_createGrandTotalRow(e,t){const a=this;if(!a._rowGroupColumns)return;if(!a.grandTotal||0===a._rowGroupColumns.length||!e)return;const l=a.columnTotals,o=a._dynamicColumns,i=l?new Smart.DataAdapter({dataSource:[],dataFields:[{name:"dataPoint"}]}):void 0,r=document.createElement("tr"),n={grandTotal:!0};let s;function d(e){const t=[{}],o=e.dataFields[e.dataFields.length-1],i=o.dataField;return t[0][i]=[l?a._totalSummaryFunction:o.summary],t}if(a.selection&&"cell"!==a.selectionMode){const e=document.createElement("td");e.className="freeze-near",r.appendChild(e)}for(let t=0;t<o.length;t++){const l=document.createElement("td"),s=o[t];let c,u,m;if(0===t&&s.group)c=a.localize("grandTotal"),u=c,a._sortRow&&a._sortRow.grandTotal&&(n.sortOrder=a._sortRow.sortOrder,a._sortRow=n,l.classList.add("sort-by",n.sortOrder),l.setAttribute("aria-sort",n.sortOrder+"ending"));else{const t=s.columnTotal?a._aggregateColumns[0]:s.dataFields[s.dataFields.length-1].originalColumn;let o=[];for(let t=0;t<e.length;t++){const l=a._originalRecords[e[t].id+s.id];l&&(o=o.concat(l))}0!==o.length&&(s.columnTotal?(m=a._getTotalSummary(o,i),c=m):(m=a.rows.summarize(d(s),o),c=Object.values(Object.values(m)[0])[0]),a._originalRecords["GRAND_TOTAL"+s.id]=o),u=c,void 0!==m&&void 0!==u&&(u=a._formatSummaryValue(m,t,l,u))}if(a.onCellRender&&a.onCellRender(m,s,c,l),n[s.id]=void 0!==c?c:0,l.setAttribute("data-field",s.id),l.classList.toggle("smart-hidden",!0===s.hidden),a._setCellContent(l,u),r.appendChild(l),0===t&&s.group&&"classic"===a.groupLayout){l.setAttribute("data-field","pivotgroup0");for(let e=1;e<a._rowGroupColumns.length;e++){const t=document.createElement("td");t.setAttribute("data-field","pivotgroup"+e),a._hidden[e]&&t.classList.add("smart-hidden"),r.appendChild(t)}}}r.classList.add("grand-total"),r.data=n,t?(s=document.createElement("tfoot"),a.$.tableContainer.appendChild(s)):(s=a.$.tableContainer.querySelector("tfoot"),s.innerHTML=""),s.appendChild(r)}_updateGrandTotalRow(){const e=this;if(!e.grandTotal||0===e._rowGroupColumns.length)return;const t=e._dynamicColumns,a=e.querySelector("tfoot .grand-total");for(let l=0;l<t.length;l++){const o=t[l];if(0===l&&o.group&&"classic"===e.groupLayout)for(let t=1;t<e._rowGroupColumns.length;t++){const l=a.children[t];e._hidden[t]?l.classList.add("smart-hidden"):l.classList.remove("smart-hidden")}}}_formatSummaryValue(e,t,a,l){const o=this;let i=t.summarySettings;if(t.formatFunction||!i)return o._formatCellValue(e,t,a,l);if(i.align&&a.classList.add("align-"+i.align),isNaN(l)||""===l|null===l)return o._formatCellValue(e,t,a,l);let r=l;if(void 0!==i.decimalPlaces||void 0!==i.thousandsSeparator&&""!==i.thousandsSeparator||void 0!==i.decimalSeparator){const e=new Smart.Utilities.NumberRenderer(l);let t="F";void 0!==i.thousandsSeparator&&""!==i.thousandsSeparator&&(e.localizationObject.thousandsseparator=i.thousandsSeparator,t="N"),void 0!==i.decimalSeparator&&(e.localizationObject.decimalseparator=i.decimalSeparator),isNaN(i.decimalPlaces)&&(i.decimalPlaces=e.localizationObject.defaultPrecision),r=e.formatNumber(l,t+i.decimalPlaces)}return!0===i.negativesInBrackets&&l<0&&(r=`(${r.toString().replace("-","")})`),void 0!==i.prefix&&(r=i.prefix.toString()+r),o._formatCellValue(e,t,a,r)}_overriddenTableHandler(){}_hierarchyArrowClickHandler(e,t,a){const l=this;let o,i,r;function n(e){e.forEach((e=>{const t=e.children;l._expandSingleChildRow(e.tr),t&&e.expanded&&requestAnimationFrame((()=>n(t)))}))}if("classic"===l.groupLayout){for(t=t&&t.data?t:Array.from(e.querySelectorAll('td[data-field^="pivotgroup"]')).find((e=>e.data));!t.classList.contains("main")&&!t.previousElementSibling.classList.contains("expanded");)t=t.previousElementSibling;o=t.data;const a=o.level;r=o.children,i=!o.expanded,o.expanded=i,0===a?(e.setAttribute("aria-expanded",i),e.classList.toggle("expanded",i)):a>0&&o===o.parent.children[0]&&t.classList.toggle("main",i);let n=o.children[0],s=t.nextElementSibling;for(;n&&!n.leaf&&n.expanded;)s.classList.toggle("main",i),n=n.children[0],s=t.nextElementSibling;t.classList.toggle("expanded",i),i?l._expanded[a].push(o):l._expanded[a]=l._expanded[a].filter((e=>e!==o)),l._updateDisplayedRecord(o,e),l._updateGroupColumnsVisibility(),l._updateDisplayedRecordsVisibility(l.rows.boundHierarchy),l._updateDisplayedRecordsUIVisibility(l.rows.boundHierarchy),l._updateGrandTotalRow()}else o=e.data,r=o.children,i=!o.expanded,o.expanded=i,e.setAttribute("aria-expanded",i),e.classList.toggle("expanded",i);if(i?(requestAnimationFrame((()=>n(r))),l.$.fireEvent("expand",{record:o})):(function e(t){t.forEach((t=>{const a=t.children;l._collapseSingleChildRow(t.tr),a&&e(a)}))}(r),l.$.fireEvent("collapse",{record:o})),a&&"cell"===l.selectionMode){const e=l._selectedCells.collection;e.length>1&&(l._selectedCells.isDirty=!0),e.forEach(((t,a)=>{e[a]=l._getCellInfo(t.element)})),l._selectedCells.start&&(l._selectedCells.start=l._getCellInfo(l._selectedCells.start.element)),l._selectedCells.end&&(l._selectedCells.end=l._getCellInfo(l._selectedCells.end.element)),"none"!==l.animation?l.$.tableContainer.ontransitionend=function(){requestAnimationFrame(l._showSelectionDetails.bind(l)),l.$.tableContainer.ontransitionend=null}:requestAnimationFrame(l._showSelectionDetails.bind(l))}}_updateDisplayedRecord(e,t){const a=this;if("classic"!==a.groupLayout)return;const l=a._getRecordToDisplay(e);for(let e=0;e<a._dynamicColumns.length;e++){const o=a._dynamicColumns[e],i=o.id;if("pivotgroup"===i)continue;const r=t.querySelector('td[data-field="'+i+'"]'),n=o.columnTotal?a._aggregateColumns[0]:o.dataFields[o.dataFields.length-1].originalColumn;let s=l[o.id];s=a._formatSummaryValue(l,n,r,s),r.style.backgroundColor=null,r.style.color=null,r.style.fontFamily=null,r.style.fontSize=null,a._applyConditionalFormattingToCell(r,o.id,l.$.index),a._setCellContent(r,s)}}_updateDisplayedRecordsUIVisibility(e){const t=this;if("classic"!==t.groupLayout)return;const a=t._rowGroupColumns.length;for(let l=0;l<e.length;l++){const o=e[l];let i=t._getRecordToDisplay(o),r=i.tr;if((!r||r&&!r.parentNode)&&i.parent){r=i.parent.tr;let e=i.parent;for(;e&&(r=e.tr,!r);)e=e.parent}o.level>0&&a>1&&o.level<=a-1&&((()=>{let e=o.parent,t=e.expanded;for(;e;)!1===e.expanded&&(t=!1),e=e.parent;return t})()?r.children[o.level].style.color="":r.children[o.level].style.color="rgba(0,0,0,0)"),o.children&&o.children.length>0&&t._updateDisplayedRecordsUIVisibility(o.children)}}_updateDisplayedRecordsVisibility(e){const t=this;if("classic"!==t.groupLayout)return;const a=t._dynamicColumns;for(let l=0;l<e.length;l++){const o=e[l];if(o.level>0&&0===l){o.children&&o.children.length>0&&t._updateDisplayedRecordsVisibility(o.children);continue}let i=t._getRecordToDisplay(o),r=i.tr;if((!r||r&&!r.parentNode)&&i.parent){r=i.parent.tr;let e=i.parent;for(;e&&(r=e.tr,!r);)e=e.parent}for(let e=0;e<a.length;e++){const l=a[e];0===e&&l.group&&r&&t._updateGroupCellsClassic(r,o)}o.children&&o.children.length>0&&t._updateDisplayedRecordsVisibility(o.children)}}_updateGroupCellsClassic(e,t){const a=this,l=a._rowGroupColumns.length,o=t.level;for(let t=0;t<l;t++){const l=e.children[t];t<o||(a._hidden[t]?l.classList.add("smart-hidden"):l.classList.remove("smart-hidden"))}}_addSortingCapability(e,t){const a=this;t.cell=e,"pivotgroup"!==t.id&&e.setAttribute("data-field",t.id),0!==a._rowGroupColumns.length&&(t.headerCellElement=e,e.onclick=function(){const l=t.dataFields[t.dataFields.length-1].originalColumn;a.$.fireEvent("columnClick",{columnDefinition:t,dataField:l.dataField}),"none"===a.sortMode||!1===l.allowSort||a._preventClickSort||(a._addSortIconContainer(t),e.sortIconContainerElement.classList.contains("asc")?a.sortBy(t,"desc"):e.sortIconContainerElement.classList.contains("desc")?a.sortBy(t,null):a.sortBy(t,"asc"))})}_sortCallback(e,t,a){const l=this,o=l.rows;if(l._rowGroupColumns.length>0&&l.enableSortByRowGroups){const a=e[0],i=l._rowGroupColumns.find((e=>e.dataField===a?e:null));if(i){i.sortOrder=t[0];const e=l._rowGroupColumns.indexOf(i);for(let a=0;a<o.length;a++){const l=o[a];if(l.children.length>0&&l.level===e-1){const e=Smart.DataAdapter.Sort(l.children,["pivotgroup"],t);l.children=e}}return void l._createDataRows()}}o._sort(o.boundSource,e,t,a),o.refreshHierarchy(),l._createDataRows()}_selectAllCheckboxClickHandler(e){super._selectAllCheckboxClickHandler(e,this.rows)}_updateSelectAllState(){super._updateSelectAllState(this.rows.length)}_refreshFilters(e){const t=this,a=[];for(const e in t._filterInfo.appliedFilters){let l=t._filterInfo.appliedFilters[e];a.push([e,l])}0!==a.length?(t.dataSource._filter(a,t._applyingDesignerFilters?"and":"or"),t._applyingDesignerFilters||t.refresh(!0),t._restoringFilters&&t.$.fireEvent("filter",{action:e,filters:a})):t.clearFilters()}_areChildrenFiltered(e,t){if(1===arguments.length&&(t=e.children),!t||0===t.length)return;let a=0;for(let e=0;e<t.length;e++)!1===t[e].leaf?a+=this._areChildrenFiltered(void 0,t[e].children)?1:0:!1!==t[e].$.filtered&&a++;return a}_localize(){const e=this,t=e.$.pager;e.$.rowGroupBreadcrumb.placeholder=e.localize("dragHereRowGroups"),e.$.pivotBreadcrumb.placeholder=e.localize("dragHerePivots"),e.$.conditionalFormattingButton.setAttribute("tooltip",e.localize("conditionalFormatting")),e.$.fieldsButton.setAttribute("tooltip",e.localize("fields")),t.messages[e.locale]||(t.messages[e.locale]={}),t.messages[e.locale].pageSizeLabel=e.localize("itemsPerPage"),t.messages[e.locale].summaryPrefix=e.localize("summaryPrefix"),t.messages[e.locale].summarySuffix="",t.$.firstButton.setAttribute("tooltip",e.localize("firstButton")),t.$.previousButton.setAttribute("tooltip",e.localize("previousButton")),t.$.nextButton.setAttribute("tooltip",e.localize("nextButton")),t.$.lastButton.setAttribute("tooltip",e.localize("lastButton"))}_columnNotify(e){const t=this,a=e.propertyName,l=e.target;switch(a){case"allowFilter":{const a=t._designer;if(a&&a._filtersViewInitialized){const o=Array.from(a.$.filtersView.querySelectorAll("smart-filter-panel")).find((e=>e.column.dataField===l.dataField));o&&(!1===e.newValue?(o.closest("smart-accordion-item.filtered")&&(t._clearDesignerFilters(l.dataField),t._designerFilterHandler({target:o})),o.disabled=!0):o.disabled=!1)}break}case"allowPivot":if(!0!==l.pivot)return;break;case"allowRowGroup":if(!0!==l.rowGroup)return;break;case"pivot":if(!0!==l.allowPivot)return;break;case"rowGroup":if(!0!==l.allowRowGroup)return;break;case"summary":if(!e.newValue&&e.oldValue&&1===t._aggregateColumns.length||t.columnTotals&&e.newValue!==t._totalSummaryFunction)return void(l.summary=e.oldValue)}t._refreshColumns()}_refreshColumns(){const e=this;e._columns=e.columns._array,e.columnByDataField=[],e._columns.forEach((t=>e.columnByDataField[t.dataField]=t)),e.refresh(!0),e._designer&&(e._designer.columns=JSON.parse(JSON.stringify(e._columns)))}_initDesigner(e){const t=this,a=t.rightToLeft,l=document.createElement("smart-pivot-panel");l.animation=t.animation,l.columns=JSON.parse(JSON.stringify(t._columns)),l.dataSource=t.dataSource.toArray(),l.inverted=e===t.$.designerContainer&&("near"===t.designerPosition&&!a||"far"===t.designerPosition&&a),l.locale=t.locale,l.messages=t.messages,l.rightToLeft=a,l.theme=t.theme,l.unfocusable=!t.keyboardNavigation||t.disabled||t.unfocusable,l.ownerElement=t,t._designer=l,e&&e.appendChild(l)}_designerChangeHandler(e){const t=this;(t.isInShadowDOM?e.composedPath()[0]:e.target)instanceof Smart.PivotPanel!=0&&(t.columns=e.detail.columns,t._updateColumns(!0))}_designerFilterHandler(){const e=this,t=Array.from(e._designer.$.filtersView.querySelectorAll("smart-filter-panel")),a=[];if(t.forEach((e=>{const t=e.column,l=e.getFilter();l.filters.length>0&&a.push([t.dataField,l])})),e._filterInfo.appliedFilters){if(0===a.length)return void e.clearFilters();delete e._filterInfo.appliedFilters,e.dataSource.clearFilter()}e._applyingDesignerFilters=!0,a.forEach((t=>e.addFilter(...t))),delete e._applyingDesignerFilters,e.refresh(!0),e._designerFiltersApplied=!0}_clearDesignerFilters(e){const t=this;if(!t._designerFiltersApplied||t._applyingDesignerFilters)return;const a=t._designer,l=a.view,o=Array.from(a.$.filtersView.querySelectorAll("smart-filter-panel"));a.view="filters",o.forEach((t=>{e&&e!==t.column.dataField||(t._filterHandler.excelClear(),t.closest("smart-accordion-item").classList.remove("filtered"))})),a.view=l}_setFocusable(){const e=this,t=!e.keyboardNavigation||e.disabled||e.unfocusable;super._setFocusable(),e._designer&&(e._designer.unfocusable=t);const a=Array.from(e.$.tableContainer.getElementsByClassName("total-arrow"));t?a.forEach((e=>e.removeAttribute("tabindex"))):a.forEach((e=>e.setAttribute("tabindex",0)))}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=document.createElement("div");return a.className="smart-table-feedback",a.setAttribute("parent-table-id",e.id),a.innerHTML=t.columnDefinition.dataFields.map((e=>e.label)).join("→"),e.theme&&a.setAttribute("theme",e.theme),document.body.appendChild(a),a}_applyColumnReorder(e,t){const a=this,l=a.rightToLeft,o=a._dynamicColumns,i=e.Item.columnDefinition,r=t.classList.contains("right"),n=a._dynamicColumns.filter((e=>e!==i)),s=n.indexOf(t.columnDefinition);t.classList.remove("drop-column","left","right"),r&&!l||!r&&l?n.splice(s+1,0,i):n.splice(s,0,i),o.map((e=>e.id)).join(",")!==n.map((e=>e.id)).join(",")&&(a._clearSortByRow(!0),a._dynamicColumns=n,a.refresh(void 0,a._getCurrentDataStructure()))}_getCurrentDataStructure(){const e=this,t=e._dynamicColumns,a=[],l=`${e._totalSummaryFunction}(${e.localize("total")})`;let o=Number(e._rowGroupColumns.length>0),i=0;if(e.rowTotals&&e._pivotColumns.length>0){const t=e._aggregateColumns.length;"near"===e.rowTotalsPosition?o+=t:i=t}const r=t.find((e=>!e.rowTotal&&!e.columnTotal&&!e.group)).dataFields.length;for(let e=0;e<r;e++)for(let n=o;n<t.length-i;n++){void 0===a[e]&&(a[e]=[]);const o=t[n];if(o.columnTotal){const t=o.dataFields[e];e===r-1?a[e].push({label:l,columnDefinition:o,info:{dataField:"TOTAL",label:l,originalColumn:{}}}):t?a[e].push({label:t.label,columnDefinition:o,info:t}):a[e].push({label:"",columnDefinition:o,info:o.dataFields[e-1]})}else a[e].push({label:o.dataFields[e].label,columnDefinition:o,info:o.dataFields[e]})}return a}_breadcrumbCloseHandler(e){const t=this,a=t.columns.find((t=>t.dataField===e.detail.item.value.dataField));a&&((t.isInShadowDOM?e.composedPath()[0]:e.target===t.$.rowGroupBreadcrumb)?a.rowGroup=void 0:a.pivot=void 0)}_breadcrumbDragEndHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=a===t.$.rowGroupBreadcrumb,o=t._breadcrumbOperation;let i=t.columns.find((t=>t.dataField===e.detail.item.data.value.dataField));if("forbidden"===o)return void(a.dataSource=l?t._rowGroupColumns.map((e=>({label:e.label,value:e}))):t._pivotColumns.map((e=>({label:e.label,value:e}))));const r=t.columns;if("remove"!==o){if("reorder"===o){const a=e.detail.target;if(!a)return;const l=a.data.value;if(void 0===i||void 0===l||i.dataField===l.dataField)return;const o=e.detail.droppedBeforeTarget?"top":"bottom",n=r.findIndex((e=>e.dataField===i.dataField));let s=r.findIndex((e=>e.dataField===l.dataField));if(n>s&&"bottom"===o||n<s&&"top"===o)return;r.canNotify=!1,r.splice(n,1),s=r.findIndex((e=>e.dataField===l.dataField)),"bottom"===o?r.splice(s+1,0,i):r.splice(s,0,i),t.columns=r,r.canNotify=!0}else o instanceof HTMLElement&&(o.$.container.classList.remove("drop-target"),r.canNotify=!1,o===t.$.rowGroupBreadcrumb||t._designer&&o===t._designer.$.rowGroupsTree?(i.pivot=void 0,i.rowGroup=!0):t._designer&&o===t._designer.$.summariesTree?(i[l?"rowGroup":"pivot"]=void 0,i.summary=t._getDefaultSummaryFunction(i)):(o===t.$.pivotBreadcrumb||t._designer&&o===t._designer.$.pivotsTree)&&(i.rowGroup=void 0,i.pivot=!0),r.canNotify=!0);t._refreshColumns()}else l?i.rowGroup=void 0:i.pivot=void 0}_getDefaultSummaryFunction(e){const t=this;return t.columnTotals?t._totalSummaryFunction:t.getDefaultSummaryFunction?t.getDefaultSummaryFunction(e):"count"}_breadcrumbDraggingHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=a._dragDrop.dragDetails.feedback,o=e.detail.item.data.value,i=e.detail.originalEvent,r=t._isMobile?t.getRootNode().elementFromPoint(i.clientX,i.clientY):t.isInShadowDOM?i.composedPath()[0]:i.target;let n,s;if(l){if(l.classList.remove("cancel","delete","row-group","summary","pivot"),t._breadcrumbOperation&&t._breadcrumbOperation instanceof HTMLElement&&t._breadcrumbOperation.$.container.classList.remove("drop-target"),a.contains(r))s="reorder";else if(r===document)n="delete",s="remove";else{const e=t._designer;if(s=r.closest("smart-breadcrumb, smart-tree"),s&&s instanceof Smart.Breadcrumb)s===t.$.rowGroupBreadcrumb&&!o.allowRowGroup||s===t.$.pivotBreadcrumb&&!o.allowPivot?(n="cancel",s="forbidden"):n=s===t.$.rowGroupBreadcrumb?"row-group":"pivot";else if(s&&e&&s!==e.$.columnsTree)switch(s){case e.$.rowGroupsTree:a===t.$.rowGroupBreadcrumb?(n="row-group",s="forbidden"):o.allowRowGroup?n="row-group":(n="cancel",s="forbidden");break;case e.$.summariesTree:n="summary";break;case e.$.pivotsTree:a===t.$.pivotBreadcrumb?(n="pivot",s="forbidden"):o.allowPivot?n="pivot":(n="cancel",s="forbidden")}else n="delete",s="remove"}n&&l.classList.add(n),t._breadcrumbOperation=s,s instanceof HTMLElement&&s.$.container.classList.add("drop-target")}}_tableContainerClickHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target;if(a.classList.contains("total-arrow"))t._totalArrowClickHandler(a);else{if(t.rowSort&&!a.classList.contains("hierarchy-arrow")){const e=a.closest('td[data-field^="pivotgroup"]');if(e){if("classic"===t.groupLayout&&(""===e.textContent||e.closest('td:not(.expanded)+td[data-field^="pivotgroup"]:not(.main), td.expanded:not(.main)+td[data-field^="pivotgroup"]:not(.main)')))return;return void t._sortByRow(e)}}super._tableContainerClickHandler(e)}}_tableContainerKeydownHandler(e){const t=this,a=t.getRootNode().activeElement;"Enter"===e.key&&a.classList.contains("total-arrow")?t._totalArrowClickHandler(a):"F2"===e.key&&t._focusedCell?t._drillDown({cell:t._focusedCell,dataField:t._focusedCell.getAttribute("data-field"),rowElement:t._focusedCell.parentElement}):super._tableContainerKeydownHandler(e)}_totalArrowClickHandler(e){const t=this,a=e.parentElement,l=a.controller;l.expanded?(l.expanded=!1,function e(a){if(a.children)for(let l=0;l<a.children.length;l++){const o=a.children[l];Array.from(t.$.tableContainer.querySelectorAll(`td[data-field="${o.id}"]`)).forEach((e=>e.classList.add("smart-hidden"))),e(o),o.hidden=!0,o.cell.classList.add("smart-hidden"),o.columnTotal&&(o.arrowCell.classList.add("smart-hidden"),o.emptyCells.forEach((e=>e.classList.add("smart-hidden"))))}}(l),t.$.fireEvent("collapseTotalColumn",{columnDefinition:l})):(l.expanded=!0,function e(a){if(a.children)for(let l=0;l<a.children.length;l++){const o=a.children[l];Array.from(t.$.tableContainer.querySelectorAll(`td[data-field="${o.id}"]`)).forEach((e=>e.classList.remove("smart-hidden"))),o.expanded&&e(o),o.hidden=!1,o.cell.classList.remove("smart-hidden"),o.columnTotal&&(o.arrowCell.classList.remove("smart-hidden"),o.emptyCells.forEach((e=>e.classList.remove("smart-hidden"))))}}(l),t.$.fireEvent("expandTotalColumn",{columnDefinition:l})),a.classList.toggle("expanded",l.expanded),function e(a){const l=a.controller;t._getColumnTotalColspan(a),l.parent&&e(l.parent.arrowCell)}(a),t._hideColumnTotalsBorder(),"cell"===t.selectionMode&&t._selectedCells.collection.length>1&&(t._selectedCells.isDirty=!0)}_hideColumnTotalsBorder(){if(!this.columnTotals)return;const e=this.$.tableContainer.firstElementChild;Array.from(e.querySelectorAll(".last-visible")).forEach((e=>e.classList.remove("last-visible")));for(let t=1;t<e.childElementCount;t++){const a=e.children[t].querySelectorAll("th:not(.smart-hidden)");a[a.length-1].classList.add("last-visible")}}_getColumnExportFormat(e,t,a){if(e.columnTotal)return;const l=e.dataFields[e.dataFields.length-1].originalColumn;if(l.align&&(e.group?a.textAlign=l.align:t.textAlign=l.align),e.group||!l.summarySettings)return;const o=l.summarySettings;let i="#.",r=!1;o.align&&(a.textAlign=o.align),void 0!==o.thousandsSeparator&&""!==o.thousandsSeparator&&(i="#"+o.thousandsSeparator+i,r=!0),void 0!==o.decimalPlaces&&(i+="0".repeat(o.decimalPlaces),r=!0),void 0!==o.prefix&&(i=o.prefix.toString()+i,r=!0),o.negativesInBrackets&&(i=`${i};(${i})`,r=!0),r&&(a.format=i)}_beginEdit(e){this._drillDown(e)}_drillDown(e){const t=this,a=e.dataField;if(/^group\d*$/g.test(a))return;const l=e.rowElement,o=e.cell,i=document.createElement("div"),r=document.createElement("smart-table"),n=t._dynamicColumns.find((e=>e.id===a)),s=[],d=JSON.parse(JSON.stringify(t._columns)),c=t.localize("total");let u,m,p,g,f=l.data;if(f&&!l.classList.contains("grand-total"))if("classic"===t.groupLayout&&(f=t._getRecordToDisplay(f)),u=f.$.id,f.group){for(m=[f.group.replace(/ \(\d+\)/,"")],g=f.parent;g;)m.push(g.group.replace(/ \(\d+\)/,"")),g=g.parent;m=m.reverse().join("→")}else if(f.pivotgroup){for(m=[f.pivotgroup.replace(/ \(\d+\)/,"")],g=f.parent;g;)m.push(g.pivotgroup.replace(/ \(\d+\)/,"")),g=g.parent;m=m.reverse().join("→")}else m=t.localize("notApplicable");else u="GRAND_TOTAL",m=t.localize("grandTotal");if(!n)return;if(n.rowTotal)s.push(c);else if(n.columnTotal){for(let e=0;e<=n.dataFields.length-1;e++)s.push(n.dataFields[e].label);s.push(c),p=`${t._totalSummaryFunction}(${c})`}else for(let e=0;e<n.dataFields.length;e++)s.push(n.dataFields[e].label);const h=t._originalRecords[u+n.id];if(h&&0!==h.length){if(i.innerHTML=`<div class="drill-down-details">\n <span>${t.localize("row")}:</span><strong>${m}</strong>\n <span>${t.localize("column")}</span><strong>${s.join("→")||t.localize("notApplicable")}</strong>\n <span>${p||n.dataFields[n.dataFields.length-1].label}:</span><strong>${o.textContent}</strong>\n </div>`,i.appendChild(r),""!==t.drillDownDataExport){const e=document.createElement("smart-button");e.innerHTML=t.localize("export")+" "+t.drillDownDataExport.toUpperCase(),e.onclick=()=>{r.exportData(t.drillDownDataExport,t.drillDownDataExportFileName)},i.appendChild(e)}d.forEach((e=>e.width=t._cellWidth)),r.columns=d,r.dataSource=new window.Smart.DataAdapter({dataSource:h,dataFields:t.dataSource._dataFields}),r.freezeHeader=!0,r.keyboardNavigation=t.keyboardNavigation,h&&h.length>100&&d&&d.length>10&&(r.virtualization=!0,r.style.height="100%",r.style.width="100%"),t.drillDownTableInit&&t.drillDownTableInit(r),t.drillDownCustomAction?t.drillDownCustomAction(h):t._openDialog(t.localize("details"),i,"drill-down")}}_getColumnTotalsOriginalRecords(e,t){const a=this;let l=[];for(let o=0;o<e.children.length;o++){const i=e.children[o];if(!i.columnTotal){const e=a._originalRecords[t+i.id];e&&(l=e);break}l=l.concat(a._getColumnTotalsOriginalRecords(i,t))}return l}_conditionalFormattingButtonClickHandler(e){const t=this._aggregateColumns.map((e=>({label:`${e.summary}(${e.label})`,dataField:e.dataField,dataType:"number"})));super._conditionalFormattingButtonClickHandler(e,t,this.rows)}_applyConditionalFormatting(){const e=this,t=e._conditionalFormatting;e._conditionalFormatting=e._formattingPanel.apply(),e.conditionalFormatting=e._formattingPanel.getItems(),e._conditionalFormatting!==t&&e.refresh(void 0,e._getCurrentDataStructure())}_fieldsButtonClickHandler(){const e=this;e._designer?e._designer.inverted=!1:e._initDesigner(),e._openDialog(e.localize("fields"),e._designer,"fields")}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("change",e._dialogEventHandler),t.addEventListener("clear",e._dialogEventHandler),t.addEventListener("filter",e._dialogEventHandler),super._addDialogHandlers()}_dialogEventHandler(e){const t=e.type;if(-1===["change","clear","filter"].indexOf(t))return void super._dialogEventHandler(e);const a=this.ownerElement;if(!(this.isInShadowDOM?e.composedPath()[0]:e.target).closest("smart-pivot-panel"))return;const l=a.context;a.context=a,"change"===t?a._designerChangeHandler(e):a._designerFilterHandler(e),a.context=l}_sortByRow(e){const t=this,a=t.columnTotalsPosition,l=t._originalDynamicColumnsOrder,o=e.parentElement,i=o.data;let r=i;function n(e){"asc"===r.sortOrder?e.sort((function(e,t){return e.value-t.value})):e.sort((function(e,t){return t.value-e.value}))}if("classic"===t.groupLayout&&(r=e.data?e.data:t._getRecordToDisplay(i)),r.sortOrder?"asc"===r.sortOrder?r.sortOrder="desc":delete r.sortOrder:r.sortOrder="asc",t._sortRow&&t._sortRow!==r&&delete t._sortRow.sortOrder,r.sortOrder){if(t.columnTotals){const e=[];if(function e(l,o){const i=[];for(const e of l)i.push({dynamicColumnName:e.id,value:r[e.id]});n(i);for(const l of i){const i=t._getDynamicColumnById[l.dynamicColumnName];"near"===a&&o.push(i),i.children&&e(i.children,o),"far"===a&&o.push(i)}}(t._dynamicColumns.filter((e=>e.columnTotal&&0===e.pivotLevel)),e),t._rowGroupColumns.length>0&&e.unshift(t._dynamicColumns[0]),t.rowTotals){const a=t._dynamicColumns.filter((e=>e.rowTotal));"near"===t.rowTotalsPosition?e.splice(1,0,...a):e.push(...a)}t._dynamicColumns=e}else{let e=[];Object.keys(r).filter((e=>-1===["$","children","count","expanded","pivotgroup","group","id","leaf","level","parent","parentid","sortOrder","tr"].indexOf(e))).forEach((t=>{e.push({dynamicColumnName:t,value:r[t]})})),n(e),t._dynamicColumns=t._dynamicColumns.sort((function(a,l){return a.group||a.rowTotal||l.group||l.rowTotal?t._dynamicColumns.indexOf(a)-t._dynamicColumns.indexOf(l):e.findIndex((e=>e.dynamicColumnName===a.id))-e.findIndex((e=>e.dynamicColumnName===l.id))}))}t._sortRow=r}else t._dynamicColumns=t._dynamicColumns.sort((function(e,t){return l.findIndex((t=>t===e.id))-l.findIndex((e=>e===t.id))})),delete t._sortRow;t.refresh(void 0,t._getCurrentDataStructure()),t._focusCell(t.$.tableContainer.querySelector(`tr[row-id="${o.getAttribute("row-id")}"] td[data-field="${e.getAttribute("data-field")}"]`))}_clearSortByRow(e,t){const a=this;if(!a._sortRow)return;if(delete a._sortRow.sortOrder,delete a._sortRow,e&&!t)return;const l=a._originalDynamicColumnsOrder;a._dynamicColumns=a._dynamicColumns.sort((function(e,t){return l.findIndex((t=>t===e.id))-l.findIndex((e=>e===t.id))})),e||a.refresh(void 0,a._getCurrentDataStructure())}_defaultSortByRowGroups(e){const t=this,a=t._rowGroupColumns,l=a.find((e=>-1!==e.dataField.toLowerCase().indexOf("month")&&"string"===e.dataType)),o=new Smart.DataAdapter({dataSource:e,dataFields:e.dataFields}),i=[],r=[],n=[];let s;if(a.forEach((e=>{const t=e.sortOrder?e.sortOrder:"asc";i.push(e.dataField),r.push(t),n.push(e.dataType)})),l){const e=new Intl.DateTimeFormat(t.locale,{month:"long"}),a=[0,1,2,3,4,5,6,7,8,9,10,11].map((t=>e.format(new Date(2e3,t,1))));s=function(e,t,i,r){e.sort((function(e,o){for(let n=0;n<t.length;n++){if(l.dataField===t[n])return a.indexOf(e.month)-a.indexOf(o.month);const s=r[n](e[t[n]],o[t[n]]);if(0===s){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-o.$.index)*("asc"===i[n]?1:-1):0}return s*("asc"===i[n]?1:-1)}}));for(let t=0;t<e.length;t++)o[t]=e[t]}}return o._sort(o.boundSource,i,r,n,s),t._dataSourceSortedByDefault=!0,o.toArray()}_tableContainerDownHandler(e){const t=this;if(super._tableContainerDownHandler(e),"cell"!==t.selectionMode)return;clearTimeout(t._mobileScrollTimeout),delete t._selectDrag;const a=(t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest("tbody td[data-field]");if(!a)return;const l=t._selectedCells;if((e.ctrlKey||e.metaKey)&&l.collection.length>0){const e=l.collection.findIndex((e=>e.element===a));if(-1===e)a.classList.add("selected"),l.collection.push(t._getCellInfo(a));else{a.classList.remove("selected"),l.collection.splice(e,1);const t=l.start&&l.start.element===a,o=l.end&&l.end.element===a;(t||o)&&(delete l.start,delete l.end)}return l.collection.length>0&&(l.isDirty=!0),t._showSelectionDetails(),void t.$.fireEvent("change",{type:"interaction"})}if(e.shiftKey&&l.start)return void t._selectTo(e);const o=(new Date).getTime();let i;function r(){const e=l.collection.slice(0);l.collection.forEach((e=>e.element.classList.remove("selected"))),a.classList.add("selected"),delete l.isDirty,l.start=t._getCellInfo(a),l.end=l.start,l.collection=[l.start],l.time=o,t._selectDrag=!0,t._showSelectionDetails(),1===e.length&&e[0].element===a||t.$.fireEvent("change",{type:"interaction"})}t._isMobile&&(i=a.getBoundingClientRect()),t._isMobile?(clearTimeout(t._mobileScrollTimeout),t._mobileScrollTimeout=setTimeout((function(){const e=a.getBoundingClientRect();Math.abs(i.top-e.top)<5&&Math.abs(i.left-e.left)<5&&r()}),500)):r()}_getCellInfo(e){const t=this,a=e.parentElement,l=e.getAttribute("data-field");let o=a.data,i=o[l];return"classic"===this.groupLayout&&(o=t._getRecordToDisplay(o),i=/^group\d*$/.test(l)?o.group:o[l]),{dataField:l,element:e,row:a,rowData:o,value:i}}_documentMoveHandler(e){!this._selectDrag||e.ctrlKey||e.metaKey?super._documentMoveHandler(e):this._selectTo(e)}_selectTo(e){const t=this,a=t._selectedCells;let l;if(l=t._isMobile?t.getRootNode().elementFromPoint(e.originalEvent.clientX,e.originalEvent.clientY):t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target,!l)return;const o=l.closest("tbody td[data-field]");if(!o||o===a.end.element)return;a.collection.forEach((e=>e.element.classList.remove("selected"))),a.collection=[],a.end=t._getCellInfo(o);let i=Array.from(t.$.tableContainer.querySelectorAll("tbody>tr:not(.smart-hidden)")),r=i.indexOf(a.start.row),n=a.start.row===a.end.row?r:i.indexOf(a.end.row),s=t._getDynamicColumnsForCellSelection(),d=s.findIndex((e=>e.id===a.start.dataField)),c=a.start.dataField===a.end.dataField?d:s.findIndex((e=>e.id===a.end.dataField));for(let e=Math.min(r,n);e<=Math.max(r,n);e++){const t=i[e],l=t.data;for(let e=Math.min(d,c);e<=Math.max(d,c);e++){const o=s[e].id,i=t.querySelector(`td[data-field="${o}"]`);a.collection.push({dataField:o,element:i,row:t,rowData:l,value:l[o]}),i.classList.add("selected")}}t._showSelectionDetails(),t.$.fireEvent("change",{type:"interaction"}),"down"===e.type&&(t._selectDrag=!0,super._focusCell(a.start.element))}_getDynamicColumnsForCellSelection(){const e=this;let t=e._dynamicColumns.filter((e=>!0!==e.hidden));if(e._rowGroupColumns.length>0&&"classic"===e.groupLayout){const a=t.splice(0,1)[0];for(let l=e._rowGroupColumns.length-1;l>=0;l--)t.unshift(Object.assign({},a,{id:"pivotgroup"+l}))}return t}_tableContainerTouchmoveHandler(e){const t=this;t._selectDrag&&t._isMobile&&(t._isMobile&&(new Date).getTime()-t._selectedCells.time<500?delete t._selectDrag:(t.$.main.classList.add("prevent-scroll"),e.preventDefault()))}_showSelectionDetails(e){const t=this;if(t.hideCellSelectionTooltip)return;const a=t._selectedCells.collection,l=t.$.tableContainer.querySelector("[selection-detail]");let o;if(l&&(e&&(o=l.getAttribute("selection-detail")),l.removeAttribute("selection-detail"),l.removeAttribute("detail-position-x"),l.removeAttribute("detail-position-y")),!(a.length<=1)){if(void 0===o){let e=0,l=0;for(const t of a)null===t.value||/^group\d*$/.test(t.dataField)||(e++,l+=t.value);if(e<=1)return;let i=l/e;const r=t._aggregateColumns.find((e=>e.summarySettings));if(r){const e=document.createElement("td"),a={summarySettings:r.summarySettings};l=t._formatSummaryValue(void 0,a,e,l),i=t._formatSummaryValue(void 0,a,e,i)}o=`${t.localize("average")}: ${i}; ${t.localize("count")}: ${e}; ${t.localize("sum")}: ${l}`}t._positionTooltipOnLastVisible(a,o)}}_positionTooltipOnLastVisible(e,t){const a=this,l=a.rightToLeft,o=a._getDynamicColumnsForCellSelection(),i=a.getRootNode(),r=a.$.main,n=a.$.tableContainer,s=Array.from(n.children[1].querySelectorAll("tr:not(.smart-hidden):not(.last-visible)")),d=parseFloat(getComputedStyle(a).getPropertyValue("--smart-pivot-table-cell-width")),c=a.grandTotal?n.lastElementChild.offsetHeight:0,u=r.getBoundingClientRect(),m=u.left,p=u.top,g=r.clientWidth,f=r.clientHeight;let h=n.firstElementChild.offsetHeight,_=1,b=1,y=0;a.freezeHeader||(h=Math.max(0,h-r.scrollTop)),a._rowGroupColumns.length>0&&"classic"===a.groupLayout&&(l?(b=.7,y=Math.max(0,r.offsetWidth-g)):_=.7);const v=i.elementFromPoint(m-d*_+5,p+h+5),C=i.elementFromPoint(m+g+d*b-5,p+h+5);let w,S=i.elementFromPoint(m+5,p+h+5),T=i.elementFromPoint(m+g-5,p+h+5);if(v!==S?(S=i.elementFromPoint(m+d*_-5,p+h+5),w=i.elementFromPoint(m+d*_-5,p+f-c-a._rowHeight-5)):w=i.elementFromPoint(m+5,p+f-c-a._rowHeight-5),S||(S=s[0].querySelector("td:not(.smart-hidden)")),w&&"td"===w.tagName.toLowerCase()||(w=s[s.length-1].querySelector(`td[data-field="${S.getAttribute("data-field")}"]`)),C!==T&&(T=i.elementFromPoint(m+g-d*b+y,p+h+5)),!T){const e=s[0].querySelectorAll("td:not(.smart-hidden)");T=e[e.length-1]}const $=s.indexOf(S.parentElement),F=s.indexOf(w.parentElement);let D,x,L,A=o.findIndex((e=>e.id===S.getAttribute("data-field"))),E=o.findIndex((e=>e.id===T.getAttribute("data-field")));if(l){const e=A;A=E,E=e}for(const t of e){if(t.row.classList.contains("smart-hidden"))continue;let e,a;if(void 0===t.rowIndex?(e=s.indexOf(t.row),t.rowIndex=e):e=t.rowIndex,void 0===t.columnIndex?(a=o.findIndex((e=>e.id===t.dataField)),t.columnIndex=a):a=t.columnIndex,a>=A&&a<=E)if(e>=$&&e<=F){const l=D,o=x;(!D||D.temp||e>=D.rowIndex&&a>=D.columnIndex)&&(D=t),(!x||e>=x.rowIndex&&a<=x.columnIndex)&&(x=t),l&&l.temp&&delete l.temp,o&&o.temp&&delete o.temp}else e>F&&((!D||D.temp&&e<=D.rowIndex&&a>=D.columnIndex)&&(D=t,t.temp=!0),(!x||x.temp&&e<=D.rowIndex&&a<=x.columnIndex)&&(x=t,t.temp=!0))}D&&(Math.abs(D.columnIndex-A)>Math.abs(D.columnIndex-E)?(L=D,l||L.element.setAttribute("detail-position-x","right")):(L=x,l&&L.element.setAttribute("detail-position-x","right")),L.temp&&(L.element.setAttribute("detail-position-y","top"),delete L.temp),L.element.setAttribute("selection-detail",t))}_mainContainerOnscroll(){const e=this;e._selectedCells.collection.length>1&&e._showSelectionDetails(!0)}_focusCell(e,t,a){const l=this;if(!a||"cell"!==l.selectionMode||!l.selection)return void super._focusCell(e,t);const o=l._selectedCells,i=a&&a.shiftKey&&0===a.key.indexOf("Arrow");if(o.isDirty||!i||0===o.collection.length){if(!1===super._focusCell(e,t))return;o.collection.forEach((e=>e.element.classList.remove("selected"))),e.classList.add("selected"),o.start=l._getCellInfo(e),o.end=o.start,o.collection=[o.start],delete o.isDirty,l.$.fireEvent("change",{type:"interaction"})}else l._shiftArrowSelection(a);l._showSelectionDetails()}_shiftArrowSelection(e){const t=this,a=t._selectedCells,l=t._getDynamicColumnsForCellSelection(),o=e.key,i=Array.from(t.$.tableContainer.children[1].querySelectorAll("tr:not(.smart-hidden):not(.last-visible)")),r=i.indexOf(a.start.row),n=i.indexOf(a.end.row),s=l.findIndex((e=>e.id===a.start.dataField)),d=l.findIndex((e=>e.id===a.end.dataField));if("ArrowUp"===o||"ArrowDown"===o){if("ArrowUp"===o&&n<r||"ArrowDown"===o&&n>r||n===r){if("ArrowUp"===o&&0===n||"ArrowDown"===o&&n===i.length-1)return;const e=i[n+1*("ArrowUp"===o?-1:1)];for(let o=Math.min(s,d);o<=Math.max(s,d);o++){const i=e.querySelector(`td[data-field="${l[o].id}"]`),r=t._getCellInfo(i);a.end.dataField===r.dataField&&(a.end=r,super._focusCell(i,!0)),a.collection.push(r),i.classList.add("selected")}}else if("ArrowDown"===o&&n<r||"ArrowUp"===o&&n>r){const e=i[n+1*(n>r?-1:1)];a.collection.filter((e=>e.row===a.end.row)).forEach((e=>e.element.classList.remove("selected"))),a.collection=a.collection.filter((e=>e.row!==a.end.row));const t=a.collection.find((t=>t.row===e&&t.dataField===a.end.dataField));a.end=t,super._focusCell(t.element,!0)}}else{let e="ArrowRight",c="ArrowLeft";if(t.rightToLeft&&(e="ArrowLeft",c="ArrowRight"),o===c&&d<s||o===e&&d>s||d===s){if(o===c&&0===d||o===e&&d===l.length-1)return;const s=l[d+1*(o===c?-1:1)];for(let e=Math.min(r,n);e<=Math.max(r,n);e++){const l=i[e].querySelector(`td[data-field="${s.id}"]`),o=t._getCellInfo(l);a.end.row===o.row&&(a.end=o,super._focusCell(l,!0)),a.collection.push(o),l.classList.add("selected")}}else if(o===e&&d<s||o===c&&d>s){const e=l[d+1*(d>s?-1:1)];a.collection.filter((e=>e.dataField===a.end.dataField)).forEach((e=>e.element.classList.remove("selected"))),a.collection=a.collection.filter((e=>e.dataField!==a.end.dataField));const t=a.collection.find((t=>t.dataField===e.id&&t.row===a.end.row));a.end=t,super._focusCell(t.element,!0)}}t.$.fireEvent("change",{type:"interaction"})}_clearCellSelection(e){const t=this,a=t.$.tableContainer.querySelector("[selection-detail]");a&&(a.removeAttribute("selection-detail"),a.removeAttribute("detail-position-x"),a.removeAttribute("detail-position-y")),t._selectedCells.collection.forEach((e=>e.element.classList.remove("selected"))),e&&(t._selectedCells={collection:[]})}_toggleCellSelectionProgrammatically(e,t,a){const l=this,o=l._getDynamicColumnsForCellSelection(),i=l.rows.dataItemById[e];"pivotgroup"===t&&"classic"===l.groupLayout&&(t="pivotgroup0");const r=o.find((e=>e.id===t));if(!i||!r)return;const n=l._selectedCells,s=n.collection.find((e=>e.rowData.$.id===i.$.id&&e.dataField===t));if(a){if(s)return;const e=l.$.tableContainer.querySelector(`tr[row-id="${i.$.id}"]>td[data-field="${t}"]`),a=l._getCellInfo(e);e.classList.add("selected"),super._focusCell(e,!0),n.collection.push(a),1===n.collection.length?(n.start=a,n.end=a,delete n.isDirty):n.isDirty=!0}else{if(!s)return;const e=n.start&&n.start.rowData.$.id===i.$.id&&n.start.dataField===t,a=n.end&&n.end.rowData.$.id===i.$.id&&n.end.dataField===t;s.element.classList.remove("selected"),n.collection.splice(n.collection.indexOf(s),1),n.isDirty=!0,(e||a)&&(delete n.start,delete n.end)}l._showSelectionDetails(),l.$.fireEvent("change",{type:"programmatic"})}}),Smart("smart-pivot-panel",class extends Smart.BaseElement{static get properties(){return{columns:{value:[],type:"any",reflectToAttribute:!1},dataSource:{value:[],type:"any?",reflectToAttribute:!1},inverted:{value:!1,type:"boolean"},messages:{value:{en:{calculation:"Calculation",cancel:"Cancel",center:"center",clear:"Clear",columns:"Columns",columnSettings:"Column settings",decimalPlaces:"Decimal places",decimalSeparator:"Decimal separator",dragHereRowGroups:"Drag here to set row groups",dragHereSummaries:"Drag here to set summaries",dragHerePivots:"Drag here to set pivots",filter:"Filter",filters:"Filters",left:"left",moveTo:"Move to",negativesInBrackets:"Negatives in brackets",numberAlignment:"Number alignment",numberFormat:"Number format",numberPrefix:"Number prefix",ok:"OK",pivots:"Pivots",right:"right",rowGroups:"Row Groups",search:"Search...",showRows:"Show records where:",summaries:"Summaries",textAlignment:"Text alignment",thousandsSeparator:"Thousands separator"}},type:"object",extend:!0},view:{value:"columns",allowedValues:["columns","filters"],type:"string"}}}static get listeners(){return{keydown:"_keydownHandler","columnsView.click":"_settingsIconClickHandler","columnsView.dragEnd":"_dragEndHandler","columnsView.dragging":"_draggingHandler","filtersView.clear":"_filterPanelFilterHandler","filtersView.expanding":"_accordionItemExpandingHandler","filtersView.filter":"_filterPanelFilterHandler","summariesTree.dragStart":"_summariesTreeDragStartHandler","tabs.click":"_tabsClickHandler"}}template(){return'<div id="container" role="presentation">\n <div id="main" role="presentation">\n <div id="columnsView" class="smart-pivot-panel-columns-view" role="tabpanel">\n <div id="columns" class="smart-pivot-panel-columns-container" role="presentation">\n <smart-tree id="columnsTree" allow-drag allow-drop animation="[[animation]]" filterable selection-mode="zeroOrOne" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]" aria-label="Columns"></smart-tree>\n </div>\n <div id="rowGroups" class="smart-pivot-panel-active-columns" role="presentation">\n <div id="rowGroupsLabel" class="smart-pivot-panel-row-groups-label smart-pivot-panel-label"><span class="icon" aria-hidden="true"></span><span></span></div>\n <smart-tree id="rowGroupsTree" allow-drag allow-drop animation="[[animation]]" selection-mode="zeroOrOne" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-tree>\n </div>\n <div id="summaries" class="smart-pivot-panel-active-columns" role="presentation">\n <div id="summariesLabel" class="smart-pivot-panel-summaries-label smart-pivot-panel-label"><span class="icon" aria-hidden="true"></span><span></span></div>\n <smart-tree id="summariesTree" allow-drag allow-drop animation="[[animation]]" selection-mode="zeroOrOne" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-tree>\n </div>\n <div id="pivots" class="smart-pivot-panel-active-columns" role="presentation">\n <div id="pivotsLabel" class="smart-pivot-panel-pivots-label smart-pivot-panel-label"><span class="icon" aria-hidden="true"></span><span></span></div>\n <smart-tree id="pivotsTree" allow-drag allow-drop animation="[[animation]]" selection-mode="zeroOrOne" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-tree>\n </div>\n </div>\n <div id="filtersView" class="smart-pivot-panel-filters-view" role="tabpanel"></div>\n </div>\n <div id="tabs" class="smart-pivot-panel-tabs smart-unselectable">\n <div id="columnsTab" class="smart-pivot-panel-tab-item" role="tab" aria-selected="false"><span class="icon" aria-hidden="true"></span><span></span></div>\n <div id="filtersTab" class="smart-pivot-panel-tab-item" role="tab" aria-selected="false"><span class="icon" aria-hidden="true"></span><span></span></div>\n </div>\n </div>'}render(){const e=this;e._isMobile=Smart.Utilities.Core.isMobile,e._initializedFilters={},e._cachedFilters={},e._setFocusable(),e._localize(),e._setAriaRelations(),e.dataSource instanceof Smart.DataAdapter&&(e.dataSource=e.dataSource.toArray()),"columns"===e.view?(e.$.columnsTab.classList.add("selected"),e.$.columnsTab.setAttribute("aria-selected",!0),e.$.filtersView.remove(),e._initializeColumnsView()):(e.$.filtersTab.classList.add("selected"),e.$.filtersTab.setAttribute("aria-selected",!0),e.$.columnsView.remove(),e._initializeFiltersView()),super.render()}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog))}detached(){const e=this;if(super.detached(),!e._dialog)return;const t=e._dialog;t.removeEventListener("close",e._dialogCloseHandler),t.removeEventListener("click",e._dialogClickHandler),t.remove()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"disabled":case"rightToLeft":case"theme":case"unfocusable":"disabled"!==e&&"unfocusable"!==e||l._setFocusable(),l._columnsViewInitialized&&"filters"===l.view&&[l.$.columnsTree,l.$.rowGroupsTree,l.$.summariesTree,l.$.pivotsTree].forEach((t=>t[e]=a)),l._filtersViewInitialized&&(Array.from(l.$.filtersView.querySelectorAll("smart-filter-panel")).forEach((t=>t[e]=a)),"animation"!==e&&(l.$.filtersView.querySelector("smart-accordion")[e]=a)),l._dialog&&(Array.from(l._dialog.$.container.querySelectorAll(".editor, .ok, .cancel")).forEach((t=>t[e]=a)),l._dialog[e]=a);break;case"columns":case"dataSource":"dataSource"===e&&l.dataSource instanceof Smart.DataAdapter&&(l.dataSource=l.dataSource.toArray()),"columns"===e&&l._columnsViewInitialized&&(delete l._columnsViewInitialized,"columns"===l.view&&l._initializeColumnsView()),l._filtersViewInitialized&&("columns"!==e||t.map((e=>e.dataField)).join(",")!==a.map((e=>e.dataField)).join(",")?("columns"===e&&Array.from(l.$.filtersView.querySelectorAll("smart-accordion-item.filtered smart-filter-panel")).forEach((e=>{l._cachedFilters[e.column.dataField]=e.$.mainContainer.firstElementChild.selectedIndexes})),delete l._filtersViewInitialized,l._initializedFilters={},l.$.filtersView.innerHTML="","filters"===l.view&&l._initializeFiltersView()):"columns"===e&&Array.from(l.$.filtersView.querySelectorAll("smart-accordion-item, smart-filter-panel")).forEach((e=>{e.column=a.find((t=>t.dataField===e.column.dataField))})));break;case"locale":case"messages":{const e=Array.from(l.$.filtersView.querySelectorAll("smart-filter-panel")),t=l._dialog;l._localize(),e.forEach((e=>{e.messages.en.clear=l.localize("clear"),e.messages.en.filter=l.localize("filter"),e.messages.en.showRows=l.localize("showRows"),e.propertyChangedHandler("messages")})),t&&(t.close(),t.removeEventListener("close",l._dialogCloseHandler),t.removeEventListener("click",l._dialogClickHandler),t.remove(),delete l._dialog);break}case"view":l._tabsClickHandler({target:l.$[a+"Tab"]})}}_localize(){const e=this;e.$.columnsTab.children[1].innerHTML=e.localize("columns"),e.$.filtersTab.children[1].innerHTML=e.localize("filters"),e.$.columnsTree.filterInputPlaceholder=e.localize("search"),e.$.rowGroupsLabel.children[1].innerHTML=e.localize("rowGroups"),e.$.summariesLabel.children[1].innerHTML=e.localize("summaries"),e.$.pivotsLabel.children[1].innerHTML=e.localize("pivots")}_initializeColumnsView(){const e=this;e._columnsViewInitialized||(e._columnsViewInitialized=!0,e._createColumnItems())}_initializeFiltersView(){const e=this;if(e._filtersViewInitialized)return;const t=e.columns,a=document.createElement("smart-accordion");e._filtersViewInitialized=!0;for(let l=0;l<t.length;l++){const o=t[l],i=document.createElement("smart-accordion-item");i.label=o.label,i.column=o,0===l&&e._initFilterPanel(i),e._cachedFilters[o.dataField]&&i.classList.add("filtered"),a.appendChild(i)}a.animation="none",a.expandMode="single",a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=e.unfocusable,e.$.filtersView.appendChild(a)}_initFilterPanel(e){const t=this,a=e.column,l=a.dataField;if(t._initializedFilters[l]){const t=e.querySelector("smart-filter-panel");return void(0===t._filterHandler.filterObject.filters.length&&t._filterHandler.tree.select("0"))}const o=document.createElement("smart-filter-panel"),i=a.dataType;o.animation=t.animation,o.column=a,o.disabled=!1===a.allowFilter,o.filterType="number"===i?"numeric":i,o.mode="excel",o.data=t.dataSource,o.dataField=l,o.messages.en.clear=t.localize("clear"),o.messages.en.filter=t.localize("filter"),o.messages.en.showRows=t.localize("showRows"),o.rightToLeft=t.rightToLeft,o.theme=t.theme,o.unfocusable=t.unfocusable,e.isRendered?e.$.contentContainer.appendChild(o):e.appendChild(o),t._initializedFilters[l]=!0,t._cachedFilters[l]&&o.whenRendered((function(){o.$.mainContainer.firstElementChild.selectedIndexes=t._cachedFilters[l],o._filterHandler.excelFilter(),delete t._cachedFilters[l]}))}_accordionItemExpandingHandler(e){const t=this.isInShadowDOM?e.composedPath()[0]:e.target;if(t instanceof Smart.Accordion==0)return;const a=t._items[e.detail.index];this._initFilterPanel(a)}_filterPanelFilterHandler(e){const t=(this.isInShadowDOM?e.composedPath()[0]:e.target).closest("smart-accordion-item");"clear"!==e.type||t.classList.contains("filtered")||e.stopPropagation(),t.classList.toggle("filtered","filter"===e.type)}_tabsClickHandler(e){const t=this,a=t.view,l=e.type&&t.isInShadowDOM?e.composedPath()[0]:e.target;if(t.$.columnsTab.contains(l)){if("columns"===a&&e.type)return;return t.view="columns",t.$.columnsTab.classList.add("selected"),t.$.columnsTab.setAttribute("aria-selected",!0),t.$.filtersTab.classList.remove("selected"),t.$.filtersTab.setAttribute("aria-selected",!1),t.$.filtersView.remove(),t.$.main.appendChild(t.$.columnsView),void t._initializeColumnsView()}if(t.$.filtersTab.contains(l)){if("filters"===a&&e.type)return;t.view="filters",t.$.filtersTab.classList.add("selected"),t.$.filtersTab.setAttribute("aria-selected",!0),t.$.columnsTab.classList.remove("selected"),t.$.columnsTab.setAttribute("aria-selected",!1),t.$.columnsView.remove(),t.$.main.appendChild(t.$.filtersView),t._initializeFiltersView()}}_createColumnItems(e){const t=this,a=t.columns,l=[],o=[],i=[],r=[];for(let t=0;t<a.length;t++){const n=a[t];n.allowPivot&&n.pivot&&l.push(n),n.allowRowGroup&&n.rowGroup&&o.push(n),n.summary&&i.push(n),!1!==e&&r.push({label:n.label,value:n})}function n(e,a){const l=[];for(let a=0;a<e.length;a++)l.push({label:t._getTreeItemLabel(e[a]),value:e[a]});a.dataSource=l}n(l,t.$.pivotsTree),n(o,t.$.rowGroupsTree),n(i,t.$.summariesTree),!1!==e&&(t.$.columnsTree.dataSource=r)}_summariesTreeDragStartHandler(e){const t=this.$.summariesTree;1===Object.keys(t.items).length&&e.preventDefault()}_draggingHandler(e){const t=this,a=e.detail.data.Feedback,l=e.detail.item.closest("smart-tree"),o=e.detail.originalEvent.originalEvent,i=t._isMobile?t.getRootNode().elementFromPoint(o.clientX,o.clientY):t.isInShadowDOM?o.composedPath()[0]:o.target,r=i.closest("smart-tree"),n=e.detail.item.value,s=t.ownerElement;if(t._breadcrumbTarget&&(t._breadcrumbTarget.$.container.classList.remove("drop-target"),delete t._breadcrumbTarget),s&&s.contains(i)){const e=i.closest("smart-breadcrumb");if(e)return a.classList.remove("forbidden"),e===s.$.rowGroupBreadcrumb?n.allowRowGroup?n.rowGroup||e.$.container.classList.add("drop-target"):a.classList.add("forbidden"):n.allowPivot?n.pivot||e.$.container.classList.add("drop-target"):a.classList.add("forbidden"),void(t._breadcrumbTarget=e)}l===t.$.columnsTree&&!r||r===t.$.rowGroupsTree&&!n.allowRowGroup||r===t.$.pivotsTree&&!n.allowPivot?a.classList.add("forbidden"):a.classList.remove("forbidden")}_dragEndHandler(e){const t=this,a=e.detail,l=a.previousContainer,o=a.container,i=a.item,r=t.columns.find((e=>e.dataField===i.value.dataField)),n=a.target,s=a.data.DropDetails?a.data.DropDetails.position:void 0;function d(){switch(o){case t.$.rowGroupsTree:return!!r.allowRowGroup&&(r.rowGroup=!0,!0);case t.$.summariesTree:return r.summary||(r.summary=t._getDefaultSummaryFunction(r)),!0;case t.$.pivotsTree:return!!r.allowPivot&&(r.pivot=!0,!0)}}function c(){const e=document.createElement("smart-tree-item");return e.label=t._getTreeItemLabel(r),e.value=r,e}function u(){if(l!==o)switch(l){case t.$.rowGroupsTree:delete r.rowGroup;break;case t.$.summariesTree:delete r.summary;break;case t.$.pivotsTree:delete r.pivot}}function m(){if(n.value)return t.columns.find((e=>e.dataField===n.value.dataField))}if(t._breadcrumbTarget)t._breadcrumbDropHandler(r,l);else{if(l===t.$.columnsTree){if(o instanceof Smart.Tree==0)return i.selected=!!(r.pivot||r.rowGroup||r.summary),void e.preventDefault();if(o===l){let e=!1;return(r.rowGroup&&Object.keys(t.$.rowGroupsTree.items).length>1||r.summary&&Object.keys(t.$.summariesTree.items).length>1||r.pivot&&Object.keys(t.$.pivotsTree.items).length>1)&&(e=!0),void requestAnimationFrame((()=>{const a=t.context;t.context=t,t.columns=t.$.columnsTree.dataSource.map((e=>e.value)),e&&(t._createColumnItems(!1),t.$.fireEvent("change",{columns:JSON.parse(JSON.stringify(t.columns))})),t.context=a}))}return Object.values(o._menuItems).find((e=>e.value===r))||(d()?(0===o.dataSource.length?o.insert({label:t._getTreeItemLabel(r),value:r}):("top"===s?o.addBefore(c(),n):o.addAfter(c(),n),t._reorder(r,m(),s)),t.$.fireEvent("change",{columns:JSON.parse(JSON.stringify(t.columns))})):i.selected=!!(r.pivot||r.rowGroup||r.summary)),void e.preventDefault()}if(o instanceof Smart.Tree==0||o===t.$.columnsTree)return u(),l.removeItem(i),t.$.fireEvent("change",{columns:JSON.parse(JSON.stringify(t.columns))}),void e.preventDefault();d()?(u(),t._reorder(r,m(),s),t.$.fireEvent("change",{columns:JSON.parse(JSON.stringify(t.columns))})):e.preventDefault()}}_reorder(e,t,a){const l=this,o=l.columns,i=o.indexOf(e);let r=o.indexOf(t);void 0===e||void 0===t||i>r&&"bottom"===a||i<r&&"top"===a||(o.splice(i,1),r=o.indexOf(t),"bottom"===a?o.splice(r+1,0,e):o.splice(r,0,e),l.columns=o,l.$.columnsTree.dataSource=o.map((e=>({label:e.label,value:e,selected:!!(e.pivot||e.rowGroup||e.summary)}))))}_breadcrumbDropHandler(e,t){const a=this,l=a._breadcrumbTarget,o=a.ownerElement,i=o.columns.find((t=>t.dataField===e.dataField)),r=a.context;function n(){switch(a.context=document,o.columns.canNotify=!1,t){case a.$.rowGroupsTree:i.rowGroup=void 0;break;case a.$.summariesTree:i.summary=void 0;break;case a.$.pivotsTree:i.pivot=void 0}}if(l.$.container.classList.remove("drop-target"),delete a._breadcrumbTarget,l===o.$.rowGroupBreadcrumb){if(!e.allowRowGroup||e.rowGroup)return;n(),i.rowGroup=!0}else{if(!e.allowPivot||e.pivot)return;n(),i.pivot=!0}o._refreshColumns(),a.context=r,o.columns.canNotify=!0}_getTreeItemLabel(e){return'<span class="settings-icon"></span>'+e.label}_settingsIconClickHandler(e){const t=this.isInShadowDOM?e.composedPath()[0]:e.target;t.classList.contains("settings-icon")&&this._openDialog(t.closest("smart-tree-item"))}_openDialog(e){const t=this;t._dialog||t._createDialog();const a=t._dialog,l=e.value,o=!!l.summary,i=Array.from(a.$.container.querySelectorAll(".editor"));let r=l.align||"left";if(t.$.container.setAttribute("modal",""),t._editedItem=e,a.classList.toggle("summary",o),a.setAttribute("aria-controls",e.id),i[0].value="",i[0].$.input.dataValue="",i[0].disabled=e.menu===t.$.summariesTree&&1===Object.keys(e.menu.items).length,i[1].value=t.localize(r),i[1].$.input.dataValue=r,o){let e=Object.assign({align:"left",prefix:"",decimalPlaces:0,thousandsSeparator:"",decimalSeparator:".",negativesInBrackets:!1},l.summarySettings||{});i[2].value=l.summary,i[2].disabled=t.ownerElement&&t.ownerElement.columnTotals,i[3].value=t.localize(e.align),i[3].$.input.dataValue=e.align,i[4].value=e.prefix,i[5].value=e.decimalPlaces.toString(),i[6].value=e.thousandsSeparator,i[7].value=e.decimalSeparator,i[8].checked=e.negativesInBrackets}a.open()}_createDialog(){const e=this,t=e.id,a=document.createElement("smart-window"),l=document.createElement("template"),o=` animation=${e.animation} theme="${e.theme}"${e.rightToLeft?" right-to-left":""}${e.unfocusable?" unfocusable":""}`;l.innerHTML=`<smart-button class="ok primary"${o}>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${o}>${e.localize("cancel")}</smart-button>`;const i=JSON.stringify([{label:e.localize("columns"),value:"columns"},{label:e.localize("rowGroups"),value:"rowGroups"},{label:e.localize("summaries"),value:"summaries"},{label:e.localize("pivots"),value:"pivots"}]),r=JSON.stringify([{label:e.localize("left"),value:"left"},{label:e.localize("center"),value:"center"},{label:e.localize("right"),value:"right"}]),n=JSON.stringify(["min","max","sum","avg","stdev","stdevp","var","varp","product","count","median"]);a.animation=e.animation,a.footerTemplate=l,a.headerButtons=["close"],a.label=e.localize("columnSettings"),a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=e.unfocusable,a.className="smart-pivot-window",a.innerHTML=`<div id="${t}MoveToLabel" class="label">${e.localize("moveTo")}</div>\n <div><smart-input class="editor underlined move-to"${o} data-source='${i}' drop-down-button-position="right" readonly aria-labelledby="${t}MoveToLabel"></smart-input></div>\n <div id="${t}TextAlignmentLabel" class="label">${e.localize("textAlignment")}</div>\n <div><smart-input class="editor underlined text-alignment"${o} data-source='${r}' drop-down-button-position="right" readonly aria-labelledby="${t}TextAlignmentLabel"></smart-input></div>\n <div id="${t}CalculationLabel" class="label summary">${e.localize("calculation")}</div>\n <div class="summary"><smart-input class="editor underlined calculation"${o} data-source='${n}' drop-down-button-position="right" readonly aria-labelledby="${t}CalculationLabel"></smart-input></div>\n <div class="label category summary">${e.localize("numberFormat")}</div>\n <div id="${t}NumberAlignmentLabel" class="label summary">${e.localize("numberAlignment")}</div>\n <div class="summary"><smart-input class="editor underlined number-alignment"${o} data-source='${r}' drop-down-button-position="right" readonly aria-labelledby="${t}NumberAlignmentLabel"></smart-input></div>\n <div id="${t}NumberPrefixLabel" class="label summary">${e.localize("numberPrefix")}</div>\n <div class="summary"><smart-input class="editor underlined number-prefix"${o} aria-labelledby="${t}NumberPrefixLabel"></smart-input></div>\n <div id="${t}DecimalPlacesLabel" class="label summary">${e.localize("decimalPlaces")}</div>\n <div class="summary"><smart-input class="editor underlined decimal-places"${o} aria-labelledby="${t}DecimalPlacesLabel"></smart-input></div>\n <div id="${t}ThousandsSeparatorLabel" class="label summary">${e.localize("thousandsSeparator")}</div>\n <div class="summary"><smart-input class="editor underlined thousands-separator"${o} aria-labelledby="${t}ThousandsSeparatorLabel"></smart-input></div>\n <div id="${t}DecimalSeparatorLabel" class="label summary">${e.localize("decimalSeparator")}</div>\n <div class="summary"><smart-input class="editor underlined decimal-separator"${o} aria-labelledby="${t}DecimalSeparatorLabel"></smart-input></div>\n <div id="${t}NegativesInBracketsLabel" class="label summary">${e.localize("negativesInBrackets")}</div>\n <div class="summary"><smart-check-box class="editor"${o} aria-labelledby="${t}NegativesInBracketsLabel"></smart-check-box></div>`,a.ownerElement=e,e._dialog=a,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(a),e.setAttribute("aria-owns",a.id)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("close",e._dialogCloseHandler),t.addEventListener("click",e._dialogClickHandler)}_dialogClickHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target;a.closest(".ok")?(t.ok=!0,t.close()):a.closest(".cancel")&&t.close()}_dialogCloseHandler(e){const t=this.ownerElement,a=t._dialog,l=t.context;if((a.isInShadowDOM?e.composedPath()[0]:e.target)!==a)return;const o=t._editedItem;if(t.context=t,t.$.container.removeAttribute("modal"),o.menu.focus(),a.ok){const e=o.value,l=Array.from(a.$.container.querySelectorAll(".editor")),i=l[0].$.input.dataValue,r=l[1].$.input.dataValue;let n=!1,s=!1;if(i&&!("rowGroups"===i&&(e.rowGroup||!e.allowRowGroup)||"summaries"===i&&e.summary||"pivots"===i&&(e.pivot||!e.allowPivot))){const a=o.menu;let l;switch(a.removeItem(o.path),a){case t.$.rowGroupsTree:delete e.rowGroup;break;case t.$.summariesTree:delete e.summary;break;case t.$.pivotsTree:delete e.pivot}switch(i){case"rowGroups":l=t.$.rowGroupsTree,e.rowGroup=!0;break;case"summaries":l=t.$.summariesTree,e.summary=t._getDefaultSummaryFunction(e),s=!0;break;case"pivots":l=t.$.pivotsTree,e.pivot=!0}if(l){const a=document.createElement("smart-tree-item");a.label=t._getTreeItemLabel(e),a.value=e,l.addTo(a),a.previousElementSibling&&t._reorder(e,a.previousElementSibling.value,"bottom")}n=!0}if((!e.align&&"left"!==r||e.align&&e.align!==r)&&(e.align=r,n=!0),e.summary&&!s){const t={align:"left",prefix:"",decimalPlaces:0,thousandsSeparator:"",decimalSeparator:".",negativesInBrackets:!1},a=e.summarySettings,o={align:l[3].$.input.dataValue,prefix:l[4].value,decimalPlaces:parseFloat(l[5].value),thousandsSeparator:l[6].value,decimalSeparator:l[7].value,negativesInBrackets:l[8].checked},i=l[2].value;if(isNaN(o.decimalPlaces)&&(o.decimalPlaces=a?a.decimalPlaces:0),i!==e.summary&&(e.summary=i,n=!0),a){const l=Object.assign({},t,a);Object.keys(l).forEach((t=>{l[t]!==o[t]&&(e.summarySettings[t]=o[t],n=!0)}))}else JSON.stringify(t)!==JSON.stringify(o)&&(e.summarySettings=o,n=!0)}delete a.ok,n&&t.$.fireEvent("change",{columns:JSON.parse(JSON.stringify(t.columns))})}delete t._editedItem,t.context=l}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.$.columnsTab.removeAttribute("tabindex"),void e.$.filtersTab.removeAttribute("tabindex");const t=e.$.columnsTab.getAttribute("tabindex");(null===t||t<0)&&(e.$.columnsTab.setAttribute("tabindex",0),e.$.filtersTab.setAttribute("tabindex",0))}_keydownHandler(e){const t=this,a=e.key,l=t.getRootNode().activeElement;if("Enter"!==a&&" "!==a||l!==t.$.columnsTab&&l!==t.$.filtersTab){if("Enter"===a&&-1!==[t.$.rowGroupsTree,t.$.summariesTree,t.$.pivotsTree].indexOf(l)){const e=l.querySelector("[focus]");e&&this._openDialog(e)}}else t._tabsClickHandler({target:l})}_getDefaultSummaryFunction(e){const t=this.ownerElement;return t&&t._getDefaultSummaryFunction?t._getDefaultSummaryFunction(e):"count"}_setAriaRelations(){const e=this,t=e.id;e.setAttribute("role","tablist"),e.$.columnsView.id=t+"ColumnsView",e.$.columnsTab.id=t+"columnsTab",e.$.columnsTab.setAttribute("aria-controls",e.$.columnsView.id),e.$.columnsView.setAttribute("aria-labelledby",e.$.columnsTab.id),e.$.filtersView.id=t+"FiltersView",e.$.filtersTab.id=t+"FiltersTab",e.$.filtersTab.setAttribute("aria-controls",e.$.filtersView.id),e.$.filtersView.setAttribute("aria-labelledby",e.$.filtersTab.id),e.$.rowGroupsLabel.id=t+"RowGroupsLabel",e.$.rowGroupsTree.setAttribute("aria-labelledby",e.$.rowGroupsLabel.id),e.$.summariesLabel.id=t+"SummariesLabel",e.$.summariesTree.setAttribute("aria-labelledby",e.$.summariesLabel.id),e.$.pivotsLabel.id=t+"PivotsLabel",e.$.pivotsTree.setAttribute("aria-labelledby",e.$.pivotsLabel.id)}});
|
|
101
|
+
Smart("smart-pivot-table",class extends Smart.Table{static get properties(){return{columnTotals:{value:!1,type:"boolean"},columnTotalsPosition:{value:"near",allowedValues:["near","far"],type:"string"},defaultSortByRowGroups:{value:!1,type:"boolean"},designer:{value:!1,type:"boolean"},designerPosition:{value:"far",allowedValues:["near","far"],type:"string"},drillDown:{value:!1,type:"boolean"},drillDownDataExport:{value:"",allowedValues:["","xlsx","pdf","html","json","csv","tsv","xml"],type:"string"},drillDownDataExportFileName:{value:"smartPivotTableDrillDownDetails",type:"string"},drillDownTableInit:{value:null,type:"function?"},drillDownCustomAction:{value:null,type:"function?"},enableSortByRowGroups:{value:!1,type:"boolean"},getDefaultSummaryFunction:{value:null,type:"function?"},grandTotal:{value:!1,type:"boolean"},groupLayout:{value:"default",allowedValues:["default","classic"],type:"string"},hideCellSelectionTooltip:{value:!1,type:"boolean"},hideEmptyRows:{value:!1,type:"boolean"},messages:{value:{en:{average:"Average",calculation:"Calculation",center:"center",clear:"Clear",columns:"Columns",columnSettings:"Column settings",count:"Count",decimalPlaces:"Decimal places",decimalSeparator:"Decimal separator",details:"Details",dragHereRowGroups:"Drag here to set row groups",dragHereSummaries:"Drag here to set summaries",dragHerePivots:"Drag here to set pivots",fields:"Fields",filter:"Filter",filters:"Filters",grandTotal:"Grand Total",groupHeader:"Group",left:"left",moveTo:"Move to",negativesInBrackets:"Negatives in brackets",numberAlignment:"Number alignment",numberFormat:"Number format",numberPrefix:"Number prefix",notApplicable:"N/A",export:"Export to",pivots:"Pivots",right:"right",row:"Row",rowGroups:"Row Groups",sameSummaryFunctionRequired:'smartPivotTable: When "columnTotals" is enabled, all summary columns must have the same "summary" function set (e.g. \'{{example}}\').',search:"Search...",showRows:"Show records where:",sum:"Sum",summaries:"Summaries",summaryRequired:'smartPivotTable: At least one column with "summary" is required.',textAlignment:"Text alignment",total:"Total",thousandsSeparator:"Thousands separator",summaryPrefix:"of",previousButton:"Previous",itemsPerPage:"Items per page:",firstButton:"First",lastButton:"Last",nextButton:"Next"}},type:"object",extend:!0},nullDefaultValue:{value:null,type:"number?"},rowSort:{value:!1,type:"boolean"},rowSummary:{value:!0,type:"boolean"},rowTotals:{value:!1,type:"boolean"},rowTotalsPosition:{value:"near",allowedValues:["near","far"],type:"string"},selectionMode:{value:"many",type:"string",allowedValues:["many","extended","cell"]},toolbar:{value:!1,type:"boolean"}}}static get listeners(){return{resize:"_overriddenTableHandler","designerContainer.change":"_designerChangeHandler","designerContainer.clear":"_designerFilterHandler","designerContainer.filter":"_designerFilterHandler","fieldsButton.click":"_fieldsButtonClickHandler","tableContainer.change":"_overriddenTableHandler","tableContainer.keyup":"_overriddenTableHandler","tableContainer.touchmove":"_tableContainerTouchmoveHandler","toolbar.close":"_breadcrumbCloseHandler","toolbar.dragEnd":"_breadcrumbDragEndHandler","toolbar.dragging":"_breadcrumbDraggingHandler"}}template(){return'<div id="container" class="smart-container" role="presentation">\n <div id="toolbar" class="smart-pivot-table-toolbar" role="toolbar">\n <smart-breadcrumb id="rowGroupBreadcrumb" class="smart-pivot-table-row-group-breadcrumb" allow-drag allow-drop animation="[[animation]]" close-buttons right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-breadcrumb>\n <smart-breadcrumb id="pivotBreadcrumb" class="smart-pivot-table-pivot-breadcrumb" allow-drag allow-drop animation="[[animation]]" close-buttons right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-breadcrumb>\n <smart-button id="conditionalFormattingButton" class="smart-table-toolbar-button conditional-formatting" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" aria-label="Conditional Formatting"></smart-button>\n <smart-button id="fieldsButton" class="smart-table-toolbar-button fields" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" aria-label="Fields"></smart-button>\n </div>\n <div id="main" class="smart-pivot-table-main-container">\n <table id="tableContainer" class="smart-table-container"></table>\n </div>\n <smart-pager id="pager" animation="[[animation]]" locale="[[locale]]" page-index="[[pageIndex]]" page-size="[[pageSize]]" pages-count="null" show-first-last-navigation-buttons show-page-size-selector show-prev-next-navigation-buttons show-summary right-to-left="[[rightToLeft]]" theme="[[theme]]"></smart-pager>\n <div id="designerContainer" class="smart-pivot-table-designer-container"></div>\n </div>'}clearFilters(){const e=this;e._filterInfo.appliedFilters&&(e._clearSortByRow(!0),delete e._filterInfo.appliedFilters,e._clearDesignerFilters(),e.dataSource.clearFilter(),e.refresh(!0),e._originalDynamicColumnsOrder=e._dynamicColumns.map((e=>e.id)),e.$.fireEvent("filter",{action:"remove"}))}clearSelection(){const e=this;"cell"===e.selectionMode?e._clearCellSelection(!0):super.clearSelection()}exportData(e,t,a){const l=this,o=getComputedStyle(l),i=o.borderRightColor,r={hierarchical:!0},n={},s=l._dynamicColumns;let d=[];if(s&&0!==s.length){if(r.style={border:"1px solid "+i,borderCollapse:"collapse",backgroundColor:o.backgroundColor,color:o.color,fontFamily:"Helvetica",header:{border:"1px solid "+i,fontWeight:"bold"},columns:{border:"1px solid "+i}},-1!==["csv","json","tsv","xml"].indexOf(e)){for(let e=0;e<s.length;e++){const t=s[e];t.group?n[t.id]=t.label:n[t.id]=t.dataFields.map((e=>e.label)).join(" -> ")}d.push(n)}else{const e=[],t=[];for(let a=0;a<s.length;a++){const o=s[a],i=o.id,n={},d={};if(l._getColumnExportFormat(o,n,d),r.style.columns[i]=d,r.style.header[i]=n,o.group){n.width=1.25*l._cellWidth+"px",e.push({label:o.label,dataField:i});continue}n.width=l._cellWidth+"px";const c=o.dataFields,u={label:c[c.length-1].label,dataField:i};if(e.push(u),1!==c.length)for(let e=c.length-2;e>=0;e--){const a=c[e].label,l=c.slice(0,e+1).map((e=>e.label)).join("_").replace(/[ ,]/g,"_");if(e===c.length-2&&(u.columnGroup=l),t.find((e=>e.name===l)))continue;const o={label:a,name:l};c[e-1]&&(o.parentGroup=c[e-1].label.replace(/[ ,]/g,"_")),t.push(o)}}n.columns=e,n.columngroups=t,r.header=n}for(let t=0;t<l.rows.length;t++){const a=l.rows[t],o={};for(let t in a){if(-1!==["$","children","count","expanded","leaf","level","parent","sortOrder","tr"].indexOf(t))continue;if("id"===t){o._keyDataField=a.id;continue}if("parentid"===t){o._parentDataField=a.parentid;continue}const l=a[t];o[t]=null!==l?l:"pdf"===e?" ":""}!0!==a.leaf&&(o._expanded=!0===a.expanded),d.push(o)}return new Smart.Utilities.DataExporter(r).exportData(d,e,t,a)}}getDynamicColumns(){return this._dynamicColumns}getSelection(){const e=this;return"cell"===e.selectionMode?e._selectedCells.collection.map((e=>({dataField:e.dataField,rowId:e.rowData.$.id}))):super.getSelection()}select(e,t){const a=this;a.selection&&("cell"!==a.selectionMode?super.select(e):a._toggleCellSelectionProgrammatically(e,t,!0))}sortBy(e,t){const a=this;let l;if(e){let t=null;if(e.group&&(t=a._rowGroupColumns.find((t=>t.label===e.label?t:null))),!t&&(-1===a._dynamicColumns.indexOf(e)||0===a._rowGroupColumns.length))return;if(!1===e.dataFields[e.dataFields.length-1].originalColumn.allowSort)return;l=e.id}a._sortBy({column:e,columnDataField:l,sortOrder:t,dataFields:a._dynamicDataFields,columnByDataField:"_getDynamicColumnById"})}unselect(e,t){const a=this;a.selection&&("cell"!==a.selectionMode?super.unselect(e):a._toggleCellSelectionProgrammatically(e,t,!1))}propertyChangedHandler(e,t,a){const l=this;function o(){l._dynamicColumns.filter((e=>e.rowTotal)).forEach((e=>{delete l._getDynamicColumnById[e.id],l._dynamicDataFields=l._dynamicDataFields.filter((t=>t.name!==e.id))})),l._dynamicColumns=l._dynamicColumns.filter((e=>!0!==e.rowTotal))}switch(e){case"animation":case"rightToLeft":case"theme":super.propertyChangedHandler(e,t,a),l._designer&&(l._designer[e]=a,"rightToLeft"===e&&(l._designer.inverted=l.designer&&("near"===l.designerPosition&&!a||"far"===l.designerPosition&&a))),"rightToLeft"===e&&l.selection&&"cell"===l.selectionMode&&l._showSelectionDetails(!0);break;case"columns":l._conditionalFormatting&&delete l._conditionalFormatting,l._updateColumns(),l._formattingPanel&&(l._formattingPanel.columns=l._aggregateColumns.map((e=>({label:`${e.summary}(${e.label})`,dataField:e.dataField,dataType:"number"}))));break;case"columnTotals":l._clearSortByRow(!0),l.refresh(!0),l._originalDynamicColumnsOrder=l._dynamicColumns.map((e=>e.id));break;case"columnTotalsPosition":{if(!l.columnTotals)return;l._clearSortByRow(!0,!0),o();const e=l._dynamicColumns.filter((e=>e.columnTotal&&0===e.pivotLevel)),t=l._dynamicColumns.filter((e=>e.group)),i=[];!function e(t,l){for(let o=0;o<t.length;o++){const i=t[o];"far"===a&&i.columnTotal&&e(i.children,l),l.push(i),"near"===a&&i.columnTotal&&e(i.children,l)}}(e,i),t.push(...i),l._dynamicColumns=t,l._addRowTotalsDynamicColumnDefinitions(),l.refresh(void 0,l._getCurrentDataStructure()),l._originalDynamicColumnsOrder=l._dynamicColumns.map((e=>e.id));break}case"conditionalFormatting":l._applyInitialConditionalFormatting(l.rows),l.refresh(void 0,l._getCurrentDataStructure());break;case"dataSource":delete l._dataSourceSortedByDefault,delete l._filterInfo.appliedFilters,l._sortColumns=[],l._clearSortByRow(!0),l._clearDesignerFilters(),l._validateDataSource(),l.refresh(!0),l._dynamicColumns&&(l._originalDynamicColumnsOrder=l._dynamicColumns.map((e=>e.id)));break;case"designer":a&&(l._designer?(l._dialog&&l._dialog.classList.contains("fields")&&l._dialog.close(),l._designer.inverted="near"===l.designerPosition&&!l.rightToLeft||"far"===l.designerPosition&&l.rightToLeft,l.$.designerContainer.appendChild(l._designer)):l._initDesigner(l.$.designerContainer));break;case"designerPosition":l.designer&&(l._designer.inverted="near"===a&&!l.rightToLeft||"far"===a&&l.rightToLeft);break;case"disabled":case"unfocusable":case"keyboardNavigation":super.propertyChangedHandler(e,t,a),l._designer&&(l._designer.unfocusable=l.disabled||l.unfocusable||!l.keyboardNavigation);break;case"filtering":a||l.clearFilters();break;case"grandTotal":a?(l.footerRow="footer",l.freezeFooter=!0,l._createGrandTotalRow(l.rows.boundHierarchy,!0)):(l.footerRow=null,l.freezeFooter=!1,l.$.tableContainer.querySelector("tfoot").remove());break;case"groupLayout":l.refresh(!0);break;case"hideCellSelectionTooltip":if(!l.selection||"cell"!==l.selectionMode)return;if(a){const e=l.$.tableContainer.querySelector("[selection-detail]");e&&(e.removeAttribute("selection-detail"),e.removeAttribute("detail-position-x"),e.removeAttribute("detail-position-y"))}else l._showSelectionDetails();break;case"hideEmptyRows":l._rowGroupColumns.length>0&&l.refresh(!0,l._getCurrentDataStructure());break;case"locale":case"messages":if(super.propertyChangedHandler(e,t,a),l._rowGroupColumns){const e=l.$.tableContainer.querySelectorAll(".smart-pivot-table-grouping-header");e[e.length-1].innerHTML=l.localize("groupHeader")}l.columnTotals&&l._dynamicColumns.forEach((e=>{e.columnTotal&&(e.cell.textContent=`${l._totalSummaryFunction}(${l.localize("total")})`)})),l._designer&&(l._designer[e]=l[e]),l.selection&&"cell"===l.selectionMode&&l._showSelectionDetails();break;case"nullDefaultValue":l.refresh(!0,l._getCurrentDataStructure());break;case"rowSort":!a&&l._sortRow&&l._clearSortByRow();break;case"rowTotals":case"rowTotalsPosition":{if(0===l._pivotColumns.length||"rowTotalsPosition"===e&&!l.rowTotals)return;let t=!1;l._clearSortByRow(!0,!0),"rowTotals"===e?a?(t=!0,l._addRowTotalsDynamicColumnDefinitions()):o():"rowTotalsPosition"===e&&(o(),l._addRowTotalsDynamicColumnDefinitions()),l.refresh(t,l._getCurrentDataStructure()),l._originalDynamicColumnsOrder=l._dynamicColumns.map((e=>e.id));break}case"selection":{const e="cell"!==l.selectionMode;e&&l.refresh(void 0,l._getCurrentDataStructure()),a?(l.$.tableContainer.setAttribute("aria-multiselectable",!0),e?l._updateSelectAllState():(l._selectedCells.collection.forEach((e=>e.element.classList.add("selected"))),l._showSelectionDetails(),l.$.main.onscroll=l._mainContainerOnscroll.bind(l))):(l.$.tableContainer.removeAttribute("aria-multiselectable"),e||(l._clearCellSelection(),l.$.main.onscroll=null));break}case"selectionMode":if(super.propertyChangedHandler(e,t,a),"many"===t&&"extended"===a||"many"===a&&"extended"===t)return;"cell"===a?l._selectedIds=[]:l._selectedCells={collection:[]},l.selection&&(l.refresh(void 0,l._getCurrentDataStructure()),l.$.main.onscroll="cell"===a?l._mainContainerOnscroll.bind(l):null);break;default:super.propertyChangedHandler(e,t,a)}}_updateColumns(e){const t=this,a=t._filterInfo.appliedFilters;if(delete t._filterInfo.appliedFilters,t._sortColumns=[],t._clearSortByRow(!0),t._initColumns(),t._designerFiltersApplied)if(e){t._applyingDesignerFilters=!0,t._restoringFilters=!0;for(const e in a)t.addFilter(e,a[e]);delete t._applyingDesignerFilters,delete t._restoringFilters}else t._clearDesignerFilters();t.refresh(!0),t._originalDynamicColumnsOrder=t._dynamicColumns.map((e=>e.id))}_pagerChangeHandler(e){const t=this;(t.isInShadowDOM?e.composedPath()[0]:e.target)===t.$.pager&&(t.pageIndex=e.detail.index,t.refresh(!1,t._getCurrentDataStructure()),t.$.fireEvent("page",{action:"pageIndexChange"}))}_pagerPageSizeChanged(e){const t=this;t.pageSize=e.detail.value,t.refresh(!1,t._getCurrentDataStructure()),t.$.fireEvent("page",{action:"pageSizeChange"})}_createElement(){const e=this;e.classList.add("smart-table"),e._cellWidth=parseFloat(getComputedStyle(e.$.container).getPropertyValue("--smart-pivot-table-cell-width")),e._autoScrollCoefficient*=2,e._filterInfo={},e._selectedCells={collection:[]},e.$.header={offsetHeight:0},e.grandTotal&&(e.footerRow="footer",e.freezeFooter=!0),e.selection&&"cell"===e.selectionMode&&(e.$.main.onscroll=e._mainContainerOnscroll.bind(e)),e._setMainContainerMaxHeight(),e._localize(),e._validateDataSource(),e._initColumns(),e.refresh(!0),e.designer&&e._initDesigner(e.$.designerContainer),e._originalDynamicColumnsOrder=(e._dynamicColumns||[]).map((e=>e.id))}_setMainContainerMaxHeight(){const e=getComputedStyle(this.$.container).maxHeight;isNaN(parseFloat(e))||(this.$.main.style.maxHeight=`calc(${e} - 2 * var(--smart-border-width)`)}_validateDataSource(){const e=this,t=e.dataSource;if(!(t instanceof Smart.DataAdapter))if(Array.isArray(e.dataSource)){let a;if(t.length>0){const e=t[0];a=[];for(let t in e){const l=e[t];"number"==typeof l?a.push({name:t,dataType:"number"}):"boolean"==typeof l?a.push({name:t,dataType:"boolean"}):l instanceof Date?a.push({name:t,dataType:"date"}):a.push({name:t,dataType:"string"})}}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:a})}else e.dataSource=new Smart.DataAdapter({dataSource:[]})}_processPivotColumns(){const e=this,t=e.columnTotals,a=[],l=[],o=[],i=[],r=[];let n,s=e.dataSource;if(0===e._columns.length)return!1;for(let s=0;s<e._columns.length;s++){const d=e._columns[s];d.pivot&&d.allowPivot&&(a.push(d),i.push(d.dataField)),d.rowGroup&&d.allowRowGroup&&(l.push(d),r.push(d.dataField)),d.summary&&(o.push(d),n?t&&n!==d.summary&&e.error(e.localize("sameSummaryFunctionRequired",{example:n})):n=d.summary)}return 0===o.length&&e.error(e.localize("summaryRequired")),e._groupByPrimary=i,e._groupBySecondary=r,e._pivotColumns=a,e._rowGroupColumns=l,e._aggregateColumns=o,e._totalSummaryFunction=n,e.defaultSortByRowGroups&&!e._dataSourceSortedByDefault&&l.length>0&&(s=new Smart.DataAdapter({dataSource:e._defaultSortByRowGroups(s),dataFields:s.dataFields}),e.dataSource=s),s.groupBy=i,s.refreshHierarchy(),e._primaryHierarchy=s.boundHierarchy,e.$.rowGroupBreadcrumb.dataSource=l.map((e=>({label:e.label,value:e}))),e.$.pivotBreadcrumb.dataSource=a.map((e=>({label:e.label,value:e}))),!0}refresh(e,t){const a=this,l=a.isRendered;if(a.columns.canNotify=!1,l&&!t&&(a.$.tableContainer.innerHTML=""),t){const e=a.$.tableContainer.firstElementChild,l=document.createDocumentFragment();e.innerHTML="",a._createHeaderCells(t,l),e.appendChild(l)}else{if(!a._processPivotColumns())return;a._createHeader()}a._hideColumnTotalsBorder(),e&&(a._selectedCells={collection:[]},a._createAggregatesSource(),a._applyInitialConditionalFormatting(a.rows)),a._createDataRows(!t);const o=a._sortColumns;l&&(e||t)&&o&&(delete a._sortColumns,o.forEach((e=>{const t=a._getDynamicColumnById[e.dataField];t&&(delete t.sortOrder,a.sortBy(t,e.direction))}))),a.columns.canNotify=!0}_createHeader(){const e=this,t=e.columnTotals,a=e.columnTotalsPosition,l=document.createElement("thead"),o=document.createDocumentFragment(),i=e._pivotColumns.length,r=[];function n(a,l,o){if(t)for(let t=0;t<=i;t++)t<a?r[t].push(l[t]):t===a?r[t].push(o.label):t===i?r[t].push(`TL="${a}"${e._totalSummaryFunction}(${e.localize("total")})`):r[t].push("")}function s(a){const l=e._aggregateColumns;return t&&0===a&&r[0].push(`TL="0"${e._totalSummaryFunction}(${e.localize("total")})`),l.forEach((e=>{r[a].push(`${e.summary}(${e.label})`)})),l.length}for(let e=0;e<=i;e++)r.push([]);i>0?function t(l,o,i){let d=0;for(let c=0;c<l.length;c++){const u=l[c];let m=0;e._filterInfo.appliedFilters&&!e._areChildrenFiltered(void 0,u.children)||("near"===a&&n(o,i,u),u.children&&u.children.length>0&&!0!==u.children[0].leaf?m+=t(u.children,o+1,i.concat([u.label])):m+=s(o+1),"far"===a&&n(o,i,u),r[o].push(...Array(m).fill(u.label)),d+=m)}return d}(e._primaryHierarchy,0,[]):s(0),e._createDynamicColumnDefinitions(r),e._createHeaderCells(r,o),l.appendChild(o),e.$.tableContainer.appendChild(l)}_createDynamicColumnDefinitions(e){const t=this,a=e[e.length-1].length,l=[],o=[],i={};let r=-1;t._dynamicColumns=l,t._dynamicDataFields=o,t._getDynamicColumnById=i;for(let n=0;n<a;n++){const a=e[e.length-1][n];if(t._createTotalColumnDefinition(a,e,n))continue;const s={dataFields:[]},d=[];r++;for(let a=0;a<e.length-1;a++){const l=e[a][n],o=t._pivotColumns[a],i={originalColumn:o,label:l,dataField:o.dataField};s.dataFields.push(i),d.push(l),e[a][n]={label:l,columnDefinition:s,info:i}}const c=t._aggregateColumns[r%t._aggregateColumns.length],u={originalColumn:c,label:a,dataField:c.dataField,summary:c.summary};s.dataFields.push(u),d.push(c.dataField),e[e.length-1][n]={label:a,columnDefinition:s,info:u},s.id=d.join(",").replace(/[ ,]/g,"_"),l.push(s),o.push({name:s.id,dataType:"any"}),i[s.id]=s}if(t._rowGroupColumns.length>0){const e=t.localize("groupHeader"),a={dataFields:t._rowGroupColumns.map((t=>({originalColumn:t,label:e}))),id:"pivotgroup",label:e,group:!0};let r;l.unshift(a),i.pivotgroup=a;for(let e=0;e<a.dataFields.length&&(r=a.dataFields[e].originalColumn.dataType,"string"!==r);e++);o.push({name:"pivotgroup",dataType:r}),o.push({name:"count",dataType:"number"})}t._setColumnTotalsRelations(),t._addRowTotalsDynamicColumnDefinitions(),t.$.tableContainer.removeAttribute("aria-colcount")}_createTotalColumnDefinition(e,t,a){const l=this,o=/TL="(\d+)"/.exec(e);if(!o)return!1;const i=parseFloat(o[1]),r={dataFields:[]},n=[];e=e.replace(/TL="(\d+)"/,"");for(let e=0;e<t.length-1;e++){if(e>i){t[e][a]=Object.assign({},t[e-1][a],{label:""});continue}const o=t[e][a],s=l._pivotColumns[e],d={originalColumn:s,label:o,dataField:s.dataField};r.dataFields.push(d),n.push(o),t[e][a]={label:o,columnDefinition:r,info:d}}return n.push("TOTAL"),r.columnTotal=!0,r.emptyCells=[],r.expanded=!1,r.id=n.join(",").replace(/[ ,]/g,"_"),r.pivotLevel=i,t[t.length-1][a]={label:e,columnDefinition:r,info:{originalColumn:{},label:e,dataField:"TOTAL"}},l._dynamicColumns.push(r),l._dynamicDataFields.push({name:r.id,dataType:"any"}),l._getDynamicColumnById[r.id]=r,!0}_setColumnTotalsRelations(){const e=this;if(!e.columnTotals)return;const t=e._dynamicColumns;for(let a=0;a<e._dynamicColumns.length;a++){const l=e._dynamicColumns[a];if(!l.columnTotal)continue;const o=l.id.replace("_TOTAL","");let i;0===e._pivotColumns.length?(l.expanded=!0,i=t.filter((e=>{if(!e.columnTotal&&!e.group)return e.parent=l,!0}))):i=l.pivotLevel===e._pivotColumns.length-1?t.filter((e=>{if(!e.columnTotal&&0===e.id.indexOf(o))return e.parent=l,!0})):t.filter((e=>{if(e.columnTotal&&e.pivotLevel===l.pivotLevel+1&&0===e.id.indexOf(o))return e.parent=l,!0})),l.children=i}}_addRowTotalsDynamicColumnDefinitions(){const e=this;if(!e.rowTotals||0===e._pivotColumns.length)return;const t=[];e._aggregateColumns.forEach((a=>{const l=a.dataField,o="TOTAL_"+l,i={dataFields:[{originalColumn:a,label:`${a.summary}(${a.label})`,dataField:l,summary:a.summary}],id:o,rowTotal:!0};t.push(i),e._getDynamicColumnById[o]=i,e._dynamicDataFields.push({name:o,dataType:"any"})})),"near"===e.rowTotalsPosition?e._dynamicColumns.splice(0+Number(e._rowGroupColumns.length>0),0,...t):e._dynamicColumns.push(...t)}_createHeaderCells(e,t){const a=this,l=e[e.length-1].length,o=a.columnTotals,i=a.selection&&"cell"!==a.selectionMode,r=a.onColumnRender,n=a.rowTotalsPosition,s=a._rowGroupColumns.length>0,d=a._cellWidth;function c(t,a){if(0===a)return!0;let l=t,o=!1;for(;l>=0&&!o;){const t=e[l][a-1],i=e[l][a];o=t.label!==i.label||JSON.stringify(t.info)!==JSON.stringify(i.info),l--}return o}for(let u=0;u<e.length;u++){const m=document.createElement("tr"),p=e[u];if(i)if(u===e.length-1)m.innerHTML='<th class="smart-pivot-table-selection-header smart-table-select-all freeze-near"><div role="checkbox" aria-checked="false" aria-label="Toggle selection of all rows"></div></th>';else{const e=document.createElement("th");0===u&&(e.style.width=getComputedStyle(a.$.container).getPropertyValue("--smart-table-row-height")),e.classList.add("smart-pivot-table-selection-header","freeze-near"),m.appendChild(e)}s&&a._createGroupHeaderCells(u,e,m),"near"===n&&a._createRowTotalsHeaders(u,e,m);const g={};for(let t=0;t<l;t++){let i=p[t],n=i.label,s=i.columnDefinition;if(void 0===n)break;const f=document.createElement("th");if(c(u,t)){if(g.cell&&!o&&(g.span>1&&(g.cell.colSpan=g.span),0===u&&(g.cell.style.width=d*g.span+"px")),t===l-1&&0===u?o||(f.style.width=d+"px"):(g.cell=f,g.span=1),f.columnDefinition=s,s.columnTotal&&""===n)s.emptyCells.push(f),f.classList.add("empty");else if(r){const e={text:n,cell:f,column:i.info,fullDefinition:s};a.onColumnRender(e),n=e.text}u===e.length-1&&(a._addSortingCapability(f,s),n=`<div class="wrapper" role="presentation"><div class="label">${n}</div></div>`),i.info&&i.info.originalColumn&&i.info.originalColumn.align&&f.classList.add("align-"+i.info.originalColumn.align),f.innerHTML=n,o&&a._processColumnTotalsHeaderCells(f,s,u),m.appendChild(f)}else g.span++,t!==l-1||o||(g.cell.colSpan=g.span,0===u&&(g.cell.style.width=d*g.span+"px"))}"far"===n&&a._createRowTotalsHeaders(u,e,m),t.appendChild(m)}}_createGroupHeaderCells(e,t,a){const l=this,o="classic"===l.groupLayout,i=o?l._rowGroupColumns.length:1;for(let r=0;r<i;r++){const i=document.createElement("th");if(i.classList.add("smart-pivot-table-grouping-header"),e===t.length-1){const e=l._dynamicColumns[0];let t=o?e.dataFields[r].originalColumn.label:l.localize("groupHeader");if(l.onColumnRender){const a={text:t,cell:i,column:e.dataFields[0],fullDefinition:e};l.onColumnRender(a),t=a.text}if(0===r)l._addSortingCapability(i,e),t=`<div class="wrapper" role="presentation"><div class="label">${t}</div></div>`;else if(o&&l.enableSortByRowGroups){const a=JSON.parse(JSON.stringify(l._dynamicColumns[0]));a.dataFields=[],a.dataFields.push(e.dataFields[r]),a.headerCellElement=i,a.cell=i,a.id=e.dataFields[r].originalColumn.dataField,a.label=e.dataFields[r].originalColumn.label,l._getDynamicColumnById[a.id]=a,l._addSortingCapability(i,a),t=`<div class="wrapper" role="presentation"><div class="label">${t}</div></div>`}i.innerHTML=t}a.appendChild(i)}}_processColumnTotalsHeaderCells(e,t,a){const l=this,o=l.columnTotalsPosition;if(a<l._pivotColumns.length&&!e.classList.contains("empty")){const i=document.createElement("div");if(i.className="total-arrow smart-arrow smart-arrow-right",i.setAttribute("role","button"),i.setAttribute("aria-label","Toggle column"),!l.keyboardNavigation||l.disabled||l.unfocusable||(i.tabIndex=0),e.appendChild(i),"far"!==o||t.columnTotal)e.controller=t;else{let o=l._pivotColumns.length,i=t;for(;o>a;)i=i.parent,o--;e.controller=i}e.controller.arrowCell=e,l._getColumnTotalColspan(e)}const i=function e(t){return!!t.parent&&(!t.parent.expanded||e(t.parent))}(t);t.hidden=i,"near"===o?(e.classList.toggle("smart-hidden",i),e.classList.toggle("expanded",t.expanded)):(e.controller&&t!==e.controller||e.classList.toggle("smart-hidden",i),t.arrowCell&&t.arrowCell!==e&&(t.arrowCell.classList.toggle("smart-hidden",i),t.arrowCell.classList.toggle("expanded",t.expanded)))}_getColumnTotalColspan(e){const t=function e(t){let a=1;if(t.expanded)for(let l=0;l<t.children.length;l++){const o=t.children[l];o.columnTotal?a+=e(o):a+=1}return a}(e.controller);t>1?e.colSpan=t:e.removeAttribute("colspan"),e.style.width=this._cellWidth*t+"px"}_createRowTotalsHeaders(e,t,a){const l=this;if(l.rowTotals&&0!==l._pivotColumns.length)for(let o=0;o<l._aggregateColumns.length;o++){const i=l._getDynamicColumnById["TOTAL_"+l._aggregateColumns[o].dataField],r=document.createElement("th");if(r.classList.add("smart-pivot-table-total-header"),e===t.length-1){let e=i.dataFields[0].label;if(l.onColumnRender){const t={text:e,cell:r,column:i.dataFields[0],fullDefinition:i};l.onColumnRender(t),e=t.text}r.innerHTML=`<div class="wrapper" role="presentation"><div class="label">${e}</div></div>`,l._addSortingCapability(r,i)}a.appendChild(r)}}_createAggregatesSource(){const e=this,t=e.dataSource,a=e.hideEmptyRows,l=e.nullDefaultValue,o=e._aggregateColumns,i=[],r=[],n={id:0,totals:[]},s=[],d=e._selectedIds.slice(0);let c;e._cachedSecondaryHierarchy=null;for(let e=0;e<o.length;e++){const t=o[e],a={};a[t.dataField]=[t.summary],r.push(a)}function u(t,a){for(let l=e._groupByPrimary.length-1;l>=0;l--){const o=t[e._groupByPrimary[l]],i=a[e._groupByPrimary[l]];if(o instanceof Date){if(o.getTime()!==i.getTime())return!1}else if(o!==i)return!1}return!0}function m(a,l,o,i){if(0!==e._pivotColumns.length)for(let n=0;n<a.length;n++){const s=a[n];if(s.children&&s.children.length>0&&!0!==s.children[0].leaf)m(s.children,l,o,i.concat([s.label]));else{const a=l.children.filter((e=>!1!==e.$.filtered&&(!c||u(s.data,e))));if(0===a.length)continue;const n=i.concat([s.label]).filter((e=>void 0!==e)),d=t.summarize(r,a);e._setRowValue(o,n,d,a)}}else{const a=l.children.filter((e=>!1!==e.$.filtered));if(a.length>0){const l=t.summarize(r,a);e._setRowValue(o,i,l,a)}}}if(e._originalRecords={},e._cachedSecondaryHierarchy=null,0===e._rowGroupColumns.length?(function a(l,o){if(0!==e._pivotColumns.length)for(let i=0;i<l.length;i++){const s=l[i];if(s.children&&s.children.length>0){const l=o.concat([s.label]);if(!0!==s.children[0].leaf)a(s.children,l);else{const a=s.children.filter((e=>!1!==e.$.filtered));if(0===a.length)continue;const o=t.summarize(r,a);e._setRowValue(n,l,o,a)}}}else{const a=e.dataSource.toArray().filter((e=>!1!==e.$.filtered));if(0===a.length)return;const l=t.summarize(r,a);e._setRowValue(n,o,l,a)}}(e._primaryHierarchy,[]),i.push(n),s.push(n.id)):(c=e._groupByPrimary[e._groupByPrimary.length-1],function l(o,r,n){let d=e._getSecondaryHierarchy(o);if(r)for(let e=0;e<n.length;e++)d=d[n[e]].children;d.forEach(((d,c)=>{let u=d.children.length;if(e._filterInfo.appliedFilters&&(u=e._areChildrenFiltered(void 0,d.children),!1===d.data.$.filtered&&!u))return;const p={},g=new Smart.DataAdapter({dataSource:d.children,dataFields:t.dataFields,groupBy:e._groupByPrimary});if(r&&(p.parentid=r.id),p.id=(r?r.id:"")+d.label+o,p.level=o,p.totals=[],s.push(p.id),m(g.boundHierarchy||g,d,p,[]),a){let e=!0;for(const t in p){if(-1!==["children","count","expanded","pivotgroup","group","id","level","parent","parentid","totals","tr"].indexOf(t))continue;const a=p[t];if(0!==a&&null!==a){e=!1;break}}if(e)return void(r&&(r.hiddenChildren?r.hiddenChildren++:r.hiddenChildren=1))}i.push(p),o<e._groupBySecondary.length-1&&l(o+1,p,n.concat([c])),p.hiddenChildren&&(u-=p.hiddenChildren,delete p.hiddenChildren),p[e._dynamicColumns[0].id]=d.label,p.count=u}))}(0,void 0,[])),e._setRowTotalsSource(i,r),e._setColumnTotalsSource(i),null!==l)for(const t of i)for(const a of e._dynamicDataFields)void 0===t[a.name]&&(t[a.name]=l);if(e.rows=new Smart.DataAdapter({dataSource:i,id:"id",keyDataField:"id",parentDataField:"parentid",dataFields:e._dynamicDataFields}),!e.isRendered&&e.onInit&&e.onInit(),d.length>0){const t=[];for(let e=0;e<d.length;e++)-1!==s.indexOf(d[e])&&t.push(d[e]);e._selectedIds=t}delete e._selectionStart,e.selection&&"cell"!==e.selectionMode&&e._updateSelectAllState()}_setRowValue(e,t,a,l){const o=this;let i=[];o._aggregateColumns.forEach((r=>{const n=r.dataField,s=a[n][r.summary],d=t.concat([n]).join(",").replace(/[ ,]/g,"_");e[d]=s,o._originalRecords[e.id+d]=l,i.push({dataPoint:s})})),e.totals=e.totals.concat(l)}_setRowTotalsSource(e,t){const a=this;if(!a.rowTotals||0===a._pivotColumns.length)return;const l=new Smart.DataAdapter({dataSource:[],dataFields:a.dataSource._dataFields});for(let o=0;o<e.length;o++){const i=e[o],r=i.id,n=i.totals,s=l.summarize(t,n);for(let e in s)i["TOTAL_"+e]=Object.values(s[e])[0],a._originalRecords[r+"TOTAL_"+e]=n;delete i.totals}}_setColumnTotalsSource(e){const t=this;if(!t.columnTotals)return;const a=t._dynamicColumns.filter((e=>e.columnTotal)),l=new Smart.DataAdapter({dataSource:[],dataFields:[{name:"dataPoint"}]});for(let o=0;o<e.length;o++){const i=e[o],r=i.id;for(let e=0;e<a.length;e++){const o=a[e],n=t._getColumnTotalsOriginalRecords(o,r);0!==n.length&&(t._originalRecords[r+o.id]=n,i[o.id]=t._getTotalSummary(n,l))}}}_getTotalSummary(e,t){const a=[];return this._aggregateColumns.forEach((t=>{e.forEach((e=>{a.push({dataPoint:e[t.dataField]})}))})),t.summarize([{dataPoint:[this._totalSummaryFunction]}],a).dataPoint[this._totalSummaryFunction]}_getSecondaryHierarchy(e){const t=this,a=t.dataSource;return t._cachedSecondaryHierarchy&&t._cachedSecondaryHierarchy[e]?t._cachedSecondaryHierarchy[e]:(Array.isArray(a.groupBy)?a._groupBy=t._groupBySecondary.slice(0,e+1):(a._groupBy.canNotify=!1,a._groupBy=t._groupBySecondary.slice(0,e+1),a._groupBy.canNotify=!0),a.refreshHierarchy(),t._cachedSecondaryHierarchy||(t._cachedSecondaryHierarchy=[]),t._cachedSecondaryHierarchy[e]=a.boundHierarchy,a.boundHierarchy)}_createDataRows(e){const t=this;let a,l,o=t.rows.boundHierarchy,i=document.createDocumentFragment(),r={collection:[]},n=0,s=o.length,d=!1;if(t.paging&&o&&o.length>0){const e=t.pageSize;if(t._filterInfo.query||t._filterInfo.rowFilters||t._filterInfo.appliedFilters){let e=0;for(let t=0;t<s;t++)!1!==o[t].$.filtered&&e++;s=e,d=!0}const a=Math.max(Math.ceil(s/e),1);if(t.$.pager.pagesCount=a,t.$.pager.totalRecords=s,t.pageIndex=Math.max(Math.min(t.pageIndex,a-1),0),n=t.pageIndex*e,s=n+e,d){let e=-1,t=[];for(let a=0;a<o.length;a++){const l=o[a];if(l&&!1!==l.$.filtered){if(e++,e<n)continue;if(e>=s)break;t.push(l)}}o=t}else{let e=[];for(let t=n;t<s;t++){const a=o[t];a&&!1!==a.$.filtered&&e.push(a)}o=e}}o&&o.length>0&&("default"===t.groupLayout?t._createRowElements(o,i,r):(t._expanded=[],t._hidden={},t._rowGroupColumns.forEach(((e,a)=>{t._expanded.push([]),t._hidden[a]=!1})),t._createRowElementsClassic(o,i,r))),i.appendChild(t._createLastRow()),e?(a=document.createElement("tbody"),t.$.tableContainer.appendChild(a)):(a=t.$.tableContainer.querySelector("tbody"),a.innerHTML=""),a.appendChild(i),"classic"===t.groupLayout&&(t._updateGroupColumnsVisibility(),t._updateDisplayedRecordsVisibility(t.rows.boundHierarchy),t._updateDisplayedRecordsUIVisibility(t.rows.boundHierarchy)),t._createGrandTotalRow(o,e),t._selectedCells=r,t.selection&&"cell"===t.selectionMode&&(l=!0,t._showSelectionDetails()),t.getRootNode().activeElement===t.$.tableContainer&&(l&&r.start?super._focusCell(r.start.element):t._tableContainerFocusHandler())}_createRowElements(e,t,a){const l=this,o=l.selection&&"cell"!==l.selectionMode,i=l._dynamicColumns;for(let r=0;r<e.length;r++){const n=document.createElement("tr"),s=e[r],d=s.level;if(s.tr=n,n.data=s,o){const e=document.createElement("td"),t=-1!==l._selectedIds.indexOf(s.$.id);e.className="smart-table-select-row freeze-near"+(t?" selected":""),e.innerHTML=`<div class="selection-checkbox" role="checkbox" aria-checked="${t}" aria-label="Toggle row selection"></div>`,n.appendChild(e),n.setAttribute("aria-selected",t)}for(let e=0;e<i.length;e++){const t=document.createElement("td"),o=i[e],r=s[o.id];let c,u,m=r;if(l._restoreSelectedCells(t,o,s,m,a),0===e&&o.group){const e=s.leaf;c=o.dataFields[d].originalColumn,m=l._formatCellValue(s,c,t,m),l.rowSummary&&(m=`${m}<span class="group-label-count"> (${s.count})</span>`),e||(t.classList.add("tree-cell"),u=!0),d>0&&(t.classList.add("outline-level-"+d),e&&t.classList.add("tree-leaf")),c.align&&t.classList.add("align-"+c.align),s.sortOrder&&(t.classList.add("sort-by",s.sortOrder),t.setAttribute("aria-sort",s.sortOrder+"ending"))}else c=o.columnTotal?l._aggregateColumns[0]:o.dataFields[o.dataFields.length-1].originalColumn,m=l._formatSummaryValue(s,c,t,m);l.onCellRender&&l.onCellRender(s,o,r,t),l._applyConditionalFormattingToCell(t,o.id,s.$.index),t.setAttribute("data-field",o.id),t.classList.toggle("smart-hidden",!0===o.hidden),l._setCellContent(t,m,u),n.appendChild(t)}s.expanded&&(n.setAttribute("aria-expanded",!0),n.classList.add("expanded")),d>0&&l._isCollapsed(s)&&(n.setAttribute("aria-hidden",!0),n.classList.add("collapsed","smart-hidden")),n.setAttribute("row-id",s.$.id),t.appendChild(n),s.children&&s.children.length>0&&l._createRowElements(s.children,t,a)}}_restoreSelectedCells(e,t,a,l,o){const i=this._selectedCells;if(0===i.collection.length)return;if(!i.collection.find((e=>e.dataField===t.id&&e.rowData.$.id===a.$.id)))return;const r={dataField:t.id,element:e,row:a.tr,rowData:a,value:l};o.collection.push(r),r.dataField===i.start.dataField&&r.rowData.$.id===i.start.rowData.$.id&&(o.start=r),r.dataField===i.end.dataField&&r.rowData.$.id===i.end.rowData.$.id&&(o.end=r),this.selection&&e.classList.add("selected")}_createRowElementsClassic(e,t,a){const l=this,o=l.selection&&"cell"!==l.selectionMode,i=l._dynamicColumns;for(let r=0;r<e.length;r++){const n=e[r],s=n.level;if(s>0&&0===r){n.expanded&&l._expanded[s].push(n),n.children&&n.children.length>0&&l._createRowElementsClassic(n.children,t,a);continue}const d=document.createElement("tr");let c=l._getRecordToDisplay(n);if(n.tr=d,d.data=n,n.expanded&&(d.setAttribute("aria-expanded",!0),d.classList.add("expanded"),l._expanded[s].push(n)),s>0&&l._isCollapsed(n)&&(d.setAttribute("aria-hidden",!0),d.classList.add("collapsed","smart-hidden")),o){const e=document.createElement("td"),t=-1!==l._selectedIds.indexOf(n.$.id);e.className="smart-table-select-row freeze-near"+(t?" selected":""),e.innerHTML=`<div class="selection-checkbox" role="checkbox" aria-checked="${t}" aria-label="Toggle row selection"></div>`,d.appendChild(e),d.setAttribute("aria-selected",t)}for(let e=0;e<i.length;e++){const t=i[e];let o,r=n[t.id],s=r;if(0===e&&t.group){l._createGroupCellsClassic(d,n,t,r,a);continue}const u=document.createElement("td");r=c[t.id],s=r,l._restoreSelectedCells(u,t,n,s,a),o=t.columnTotal?l._aggregateColumns[0]:t.dataFields[t.dataFields.length-1].originalColumn,s=l._formatSummaryValue(c,o,u,s),l.onCellRender&&l.onCellRender(c,t,r,u),l._applyConditionalFormattingToCell(u,t.id,c.$.index),u.setAttribute("data-field",t.id),u.classList.toggle("smart-hidden",!0===t.hidden),l._setCellContent(u,s),d.appendChild(u)}d.setAttribute("row-id",n.$.id),t.appendChild(d),n.children&&n.children.length>0&&l._createRowElementsClassic(n.children,t,a)}}_updateGroupColumnsVisibility(){const e=this,t=e._expanded;function a(e){return!e.parent||!!e.parent.expanded&&a(e.parent)}if(!(t.length<2)){for(let l=0;l<t.length-1;l++){const o=t[l],i=l+1;let r=0;if(o.forEach((e=>r+=Number(a(e)))),0===r&&!e._hidden[i]||r>0&&e._hidden[i]||e._hidden[l]&&!e._hidden[i]){e._hidden[i]=!e._hidden[i];const t=Array.from(e.$.tableContainer.querySelectorAll(`.smart-pivot-table-grouping-header:nth-child(${i+1+Number(e.selection&&"cell"!==e.selectionMode)})`)).concat(Array.from(e.$.tableContainer.querySelectorAll(`td[data-field="group${i}"]`)));e._hidden[i]?t.forEach((e=>e.classList.add("smart-hidden"))):t.forEach((e=>e.classList.remove("smart-hidden")))}}if(e._focusedCell&&e._focusedCell.classList.contains("smart-hidden")&&-1!==e._focusedCell.getAttribute("data-field").indexOf("pivotgroup")){let t=e._focusedCell.previousElementSibling;for(;t.classList.contains("smart-hidden");)t=t.previousElementSibling;e._focusCell(t)}}}_getRecordToDisplay(e){return e.leaf||!e.expanded?e:this._getRecordToDisplay(e.children[0])}_getFirstChildAtLevel(e,t){let a=t.children[0];for(;a.children&&a.level!==e;)a=a.children[0];return a}_createGroupCellsClassic(e,t,a,l,o){const i=this,r=i._rowGroupColumns.length,n=t.level;for(let s=0;s<r;s++){const r=document.createElement("td");if(i._restoreSelectedCells(r,a,t,l,o),r.setAttribute("data-field","pivotgroup"+s),e.appendChild(r),s<n)continue;let d,c=t,u=a.dataFields[s].originalColumn;s>n?(c=i._getFirstChildAtLevel(s,t),l=c[a.id]):r.classList.add("main"),c.cell=r,c.sortOrder&&(r.classList.add("sort-by",c.sortOrder),r.setAttribute("aria-sort",c.sortOrder+"ending"));let m=l;m=i._formatCellValue(c,u,r,m),i.rowSummary&&(m=`${m}<span class="group-label-count"> (${c.count})</span>`),c.leaf||(r.data=c,d=!0,r.classList.add("tree-cell"),c.expanded&&r.classList.add("expanded","main")),u.align&&r.classList.add("align-"+u.align),i.onCellRender&&i.onCellRender(c,a,l,r),i._applyConditionalFormattingToCell(r,a.id,t.$.index),i._setCellContent(r,m,d)}}_createGrandTotalRow(e,t){const a=this;if(!a._rowGroupColumns)return;if(!a.grandTotal||0===a._rowGroupColumns.length||!e)return;const l=a.columnTotals,o=a._dynamicColumns,i=l?new Smart.DataAdapter({dataSource:[],dataFields:[{name:"dataPoint"}]}):void 0,r=document.createElement("tr"),n={grandTotal:!0};let s;function d(e){const t=[{}],o=e.dataFields[e.dataFields.length-1],i=o.dataField;return t[0][i]=[l?a._totalSummaryFunction:o.summary],t}if(a.selection&&"cell"!==a.selectionMode){const e=document.createElement("td");e.className="freeze-near",r.appendChild(e)}for(let t=0;t<o.length;t++){const l=document.createElement("td"),s=o[t];let c,u,m;if(0===t&&s.group)c=a.localize("grandTotal"),u=c,a._sortRow&&a._sortRow.grandTotal&&(n.sortOrder=a._sortRow.sortOrder,a._sortRow=n,l.classList.add("sort-by",n.sortOrder),l.setAttribute("aria-sort",n.sortOrder+"ending"));else{const t=s.columnTotal?a._aggregateColumns[0]:s.dataFields[s.dataFields.length-1].originalColumn;let o=[];for(let t=0;t<e.length;t++){const l=a._originalRecords[e[t].id+s.id];l&&(o=o.concat(l))}0!==o.length&&(s.columnTotal?(m=a._getTotalSummary(o,i),c=m):(m=a.rows.summarize(d(s),o),c=Object.values(Object.values(m)[0])[0]),a._originalRecords["GRAND_TOTAL"+s.id]=o),u=c,void 0!==m&&void 0!==u&&(u=a._formatSummaryValue(m,t,l,u))}if(a.onCellRender&&a.onCellRender(m,s,c,l),n[s.id]=void 0!==c?c:0,l.setAttribute("data-field",s.id),l.classList.toggle("smart-hidden",!0===s.hidden),a._setCellContent(l,u),r.appendChild(l),0===t&&s.group&&"classic"===a.groupLayout){l.setAttribute("data-field","pivotgroup0");for(let e=1;e<a._rowGroupColumns.length;e++){const t=document.createElement("td");t.setAttribute("data-field","pivotgroup"+e),a._hidden[e]&&t.classList.add("smart-hidden"),r.appendChild(t)}}}r.classList.add("grand-total"),r.data=n,t?(s=document.createElement("tfoot"),a.$.tableContainer.appendChild(s)):(s=a.$.tableContainer.querySelector("tfoot"),s.innerHTML=""),s.appendChild(r)}_updateGrandTotalRow(){const e=this;if(!e.grandTotal||0===e._rowGroupColumns.length)return;const t=e._dynamicColumns,a=e.querySelector("tfoot .grand-total");for(let l=0;l<t.length;l++){const o=t[l];if(0===l&&o.group&&"classic"===e.groupLayout)for(let t=1;t<e._rowGroupColumns.length;t++){const l=a.children[t];e._hidden[t]?l.classList.add("smart-hidden"):l.classList.remove("smart-hidden")}}}_formatSummaryValue(e,t,a,l){const o=this;let i=t.summarySettings;if(t.formatFunction||!i)return o._formatCellValue(e,t,a,l);if(i.align&&a.classList.add("align-"+i.align),isNaN(l)||""===l|null===l)return o._formatCellValue(e,t,a,l);let r=l;if(void 0!==i.decimalPlaces||void 0!==i.thousandsSeparator&&""!==i.thousandsSeparator||void 0!==i.decimalSeparator){const e=new Smart.Utilities.NumberRenderer(l);let t="F";void 0!==i.thousandsSeparator&&""!==i.thousandsSeparator&&(e.localizationObject.thousandsseparator=i.thousandsSeparator,t="N"),void 0!==i.decimalSeparator&&(e.localizationObject.decimalseparator=i.decimalSeparator),isNaN(i.decimalPlaces)&&(i.decimalPlaces=e.localizationObject.defaultPrecision),r=e.formatNumber(l,t+i.decimalPlaces)}return!0===i.negativesInBrackets&&l<0&&(r=`(${r.toString().replace("-","")})`),void 0!==i.prefix&&(r=i.prefix.toString()+r),o._formatCellValue(e,t,a,r)}_overriddenTableHandler(){}_hierarchyArrowClickHandler(e,t,a){const l=this;let o,i,r;function n(e){e.forEach((e=>{const t=e.children;l._expandSingleChildRow(e.tr),t&&e.expanded&&requestAnimationFrame((()=>n(t)))}))}if("classic"===l.groupLayout){for(t=t&&t.data?t:Array.from(e.querySelectorAll('td[data-field^="pivotgroup"]')).find((e=>e.data));!t.classList.contains("main")&&!t.previousElementSibling.classList.contains("expanded");)t=t.previousElementSibling;o=t.data;const a=o.level;r=o.children,i=!o.expanded,o.expanded=i,0===a?(e.setAttribute("aria-expanded",i),e.classList.toggle("expanded",i)):a>0&&o===o.parent.children[0]&&t.classList.toggle("main",i);let n=o.children[0],s=t.nextElementSibling;for(;n&&!n.leaf&&n.expanded;)s.classList.toggle("main",i),n=n.children[0],s=t.nextElementSibling;t.classList.toggle("expanded",i),i?l._expanded[a].push(o):l._expanded[a]=l._expanded[a].filter((e=>e!==o)),l._updateDisplayedRecord(o,e),l._updateGroupColumnsVisibility(),l._updateDisplayedRecordsVisibility(l.rows.boundHierarchy),l._updateDisplayedRecordsUIVisibility(l.rows.boundHierarchy),l._updateGrandTotalRow()}else o=e.data,r=o.children,i=!o.expanded,o.expanded=i,e.setAttribute("aria-expanded",i),e.classList.toggle("expanded",i);if(i?(requestAnimationFrame((()=>n(r))),l.$.fireEvent("expand",{record:o})):(function e(t){t.forEach((t=>{const a=t.children;l._collapseSingleChildRow(t.tr),a&&e(a)}))}(r),l.$.fireEvent("collapse",{record:o})),a&&"cell"===l.selectionMode){const e=l._selectedCells.collection;e.length>1&&(l._selectedCells.isDirty=!0),e.forEach(((t,a)=>{e[a]=l._getCellInfo(t.element)})),l._selectedCells.start&&(l._selectedCells.start=l._getCellInfo(l._selectedCells.start.element)),l._selectedCells.end&&(l._selectedCells.end=l._getCellInfo(l._selectedCells.end.element)),"none"!==l.animation?l.$.tableContainer.ontransitionend=function(){requestAnimationFrame(l._showSelectionDetails.bind(l)),l.$.tableContainer.ontransitionend=null}:requestAnimationFrame(l._showSelectionDetails.bind(l))}}_updateDisplayedRecord(e,t){const a=this;if("classic"!==a.groupLayout)return;const l=a._getRecordToDisplay(e);for(let e=0;e<a._dynamicColumns.length;e++){const o=a._dynamicColumns[e],i=o.id;if("pivotgroup"===i)continue;const r=t.querySelector('td[data-field="'+i+'"]'),n=o.columnTotal?a._aggregateColumns[0]:o.dataFields[o.dataFields.length-1].originalColumn;let s=l[o.id];s=a._formatSummaryValue(l,n,r,s),r.style.backgroundColor=null,r.style.color=null,r.style.fontFamily=null,r.style.fontSize=null,a._applyConditionalFormattingToCell(r,o.id,l.$.index),a._setCellContent(r,s)}}_updateDisplayedRecordsUIVisibility(e){const t=this;if("classic"!==t.groupLayout)return;const a=t._rowGroupColumns.length;for(let l=0;l<e.length;l++){const o=e[l];let i=t._getRecordToDisplay(o),r=i.tr;if((!r||r&&!r.parentNode)&&i.parent){r=i.parent.tr;let e=i.parent;for(;e&&(r=e.tr,!r);)e=e.parent}o.level>0&&a>1&&o.level<=a-1&&((()=>{let e=o.parent,t=e.expanded;for(;e;)!1===e.expanded&&(t=!1),e=e.parent;return t})()?r.children[o.level].style.color="":r.children[o.level].style.color="rgba(0,0,0,0)"),o.children&&o.children.length>0&&t._updateDisplayedRecordsUIVisibility(o.children)}}_updateDisplayedRecordsVisibility(e){const t=this;if("classic"!==t.groupLayout)return;const a=t._dynamicColumns;for(let l=0;l<e.length;l++){const o=e[l];if(o.level>0&&0===l){o.children&&o.children.length>0&&t._updateDisplayedRecordsVisibility(o.children);continue}let i=t._getRecordToDisplay(o),r=i.tr;if((!r||r&&!r.parentNode)&&i.parent){r=i.parent.tr;let e=i.parent;for(;e&&(r=e.tr,!r);)e=e.parent}for(let e=0;e<a.length;e++){const l=a[e];0===e&&l.group&&r&&t._updateGroupCellsClassic(r,o)}o.children&&o.children.length>0&&t._updateDisplayedRecordsVisibility(o.children)}}_updateGroupCellsClassic(e,t){const a=this,l=a._rowGroupColumns.length,o=t.level;for(let t=0;t<l;t++){const l=e.children[t];t<o||(a._hidden[t]?l.classList.add("smart-hidden"):l.classList.remove("smart-hidden"))}}_addSortingCapability(e,t){const a=this;t.cell=e,"pivotgroup"!==t.id&&e.setAttribute("data-field",t.id),0!==a._rowGroupColumns.length&&(t.headerCellElement=e,e.onclick=function(){const l=t.dataFields[t.dataFields.length-1].originalColumn;a.$.fireEvent("columnClick",{columnDefinition:t,dataField:l.dataField}),"none"===a.sortMode||!1===l.allowSort||a._preventClickSort||(a._addSortIconContainer(t),e.sortIconContainerElement.classList.contains("asc")?a.sortBy(t,"desc"):e.sortIconContainerElement.classList.contains("desc")?a.sortBy(t,null):a.sortBy(t,"asc"))})}_sortCallback(e,t,a){const l=this,o=l.rows;if(l._rowGroupColumns.length>0&&l.enableSortByRowGroups){const a=e[0],i=l._rowGroupColumns.find((e=>e.dataField===a?e:null));if(i){i.sortOrder=t[0];const e=l._rowGroupColumns.indexOf(i);for(let a=0;a<o.length;a++){const l=o[a];if(l.children.length>0&&l.level===e-1){const e=Smart.DataAdapter.Sort(l.children,["pivotgroup"],t);l.children=e}}return void l._createDataRows()}}o._sort(o.boundSource,e,t,a),o.refreshHierarchy(),l._createDataRows()}_selectAllCheckboxClickHandler(e){super._selectAllCheckboxClickHandler(e,this.rows)}_updateSelectAllState(){super._updateSelectAllState(this.rows.length)}_refreshFilters(e){const t=this,a=[];for(const e in t._filterInfo.appliedFilters){let l=t._filterInfo.appliedFilters[e];a.push([e,l])}0!==a.length?(t.dataSource._filter(a,t._applyingDesignerFilters?"and":"or"),t._applyingDesignerFilters||t.refresh(!0),t._restoringFilters&&t.$.fireEvent("filter",{action:e,filters:a})):t.clearFilters()}_areChildrenFiltered(e,t){if(1===arguments.length&&(t=e.children),!t||0===t.length)return;let a=0;for(let e=0;e<t.length;e++)!1===t[e].leaf?a+=this._areChildrenFiltered(void 0,t[e].children)?1:0:!1!==t[e].$.filtered&&a++;return a}_localize(){const e=this,t=e.$.pager;e.$.rowGroupBreadcrumb.placeholder=e.localize("dragHereRowGroups"),e.$.pivotBreadcrumb.placeholder=e.localize("dragHerePivots"),e.$.conditionalFormattingButton.setAttribute("tooltip",e.localize("conditionalFormatting")),e.$.fieldsButton.setAttribute("tooltip",e.localize("fields")),t.messages[e.locale]||(t.messages[e.locale]={}),t.messages[e.locale].pageSizeLabel=e.localize("itemsPerPage"),t.messages[e.locale].summaryPrefix=e.localize("summaryPrefix"),t.messages[e.locale].summarySuffix="",t.$.firstButton.setAttribute("tooltip",e.localize("firstButton")),t.$.previousButton.setAttribute("tooltip",e.localize("previousButton")),t.$.nextButton.setAttribute("tooltip",e.localize("nextButton")),t.$.lastButton.setAttribute("tooltip",e.localize("lastButton"))}_columnNotify(e){const t=this,a=e.propertyName,l=e.target;switch(a){case"allowFilter":{const a=t._designer;if(a&&a._filtersViewInitialized){const o=Array.from(a.$.filtersView.querySelectorAll("smart-filter-panel")).find((e=>e.column.dataField===l.dataField));o&&(!1===e.newValue?(o.closest("smart-accordion-item.filtered")&&(t._clearDesignerFilters(l.dataField),t._designerFilterHandler({target:o})),o.disabled=!0):o.disabled=!1)}break}case"allowPivot":if(!0!==l.pivot)return;break;case"allowRowGroup":if(!0!==l.rowGroup)return;break;case"pivot":if(!0!==l.allowPivot)return;break;case"rowGroup":if(!0!==l.allowRowGroup)return;break;case"summary":if(!e.newValue&&e.oldValue&&1===t._aggregateColumns.length||t.columnTotals&&e.newValue!==t._totalSummaryFunction)return void(l.summary=e.oldValue)}t._refreshColumns()}_refreshColumns(){const e=this;e._columns=e.columns._array,e.columnByDataField=[],e._columns.forEach((t=>e.columnByDataField[t.dataField]=t)),e.refresh(!0),e._designer&&(e._designer.columns=JSON.parse(JSON.stringify(e._columns)))}_initDesigner(e){const t=this,a=t.rightToLeft,l=document.createElement("smart-pivot-panel");l.animation=t.animation,l.columns=JSON.parse(JSON.stringify(t._columns)),l.dataSource=t.dataSource.toArray(),l.inverted=e===t.$.designerContainer&&("near"===t.designerPosition&&!a||"far"===t.designerPosition&&a),l.locale=t.locale,l.messages=t.messages,l.rightToLeft=a,l.theme=t.theme,l.unfocusable=!t.keyboardNavigation||t.disabled||t.unfocusable,l.ownerElement=t,t._designer=l,e&&e.appendChild(l)}_designerChangeHandler(e){const t=this;(t.isInShadowDOM?e.composedPath()[0]:e.target)instanceof Smart.PivotPanel!=0&&(t.columns=e.detail.columns,t._updateColumns(!0))}_designerFilterHandler(){const e=this,t=Array.from(e._designer.$.filtersView.querySelectorAll("smart-filter-panel")),a=[];if(t.forEach((e=>{const t=e.column,l=e.getFilter();l.filters.length>0&&a.push([t.dataField,l])})),e._filterInfo.appliedFilters){if(0===a.length)return void e.clearFilters();delete e._filterInfo.appliedFilters,e.dataSource.clearFilter()}e._applyingDesignerFilters=!0,a.forEach((t=>e.addFilter(...t))),delete e._applyingDesignerFilters,e.refresh(!0),e._designerFiltersApplied=!0}_clearDesignerFilters(e){const t=this;if(!t._designerFiltersApplied||t._applyingDesignerFilters)return;const a=t._designer,l=a.view,o=Array.from(a.$.filtersView.querySelectorAll("smart-filter-panel"));a.view="filters",o.forEach((t=>{e&&e!==t.column.dataField||(t._filterHandler.excelClear(),t.closest("smart-accordion-item").classList.remove("filtered"))})),a.view=l}_setFocusable(){const e=this,t=!e.keyboardNavigation||e.disabled||e.unfocusable;super._setFocusable(),e._designer&&(e._designer.unfocusable=t);const a=Array.from(e.$.tableContainer.getElementsByClassName("total-arrow"));t?a.forEach((e=>e.removeAttribute("tabindex"))):a.forEach((e=>e.setAttribute("tabindex",0)))}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=document.createElement("div");return a.className="smart-table-feedback",a.setAttribute("parent-table-id",e.id),a.innerHTML=t.columnDefinition.dataFields.map((e=>e.label)).join("→"),e.theme&&a.setAttribute("theme",e.theme),document.body.appendChild(a),a}_applyColumnReorder(e,t){const a=this,l=a.rightToLeft,o=a._dynamicColumns,i=e.Item.columnDefinition,r=t.classList.contains("right"),n=a._dynamicColumns.filter((e=>e!==i)),s=n.indexOf(t.columnDefinition);t.classList.remove("drop-column","left","right"),r&&!l||!r&&l?n.splice(s+1,0,i):n.splice(s,0,i),o.map((e=>e.id)).join(",")!==n.map((e=>e.id)).join(",")&&(a._clearSortByRow(!0),a._dynamicColumns=n,a.refresh(void 0,a._getCurrentDataStructure()))}_getCurrentDataStructure(){const e=this,t=e._dynamicColumns,a=[],l=`${e._totalSummaryFunction}(${e.localize("total")})`;let o=Number(e._rowGroupColumns.length>0),i=0;if(e.rowTotals&&e._pivotColumns.length>0){const t=e._aggregateColumns.length;"near"===e.rowTotalsPosition?o+=t:i=t}const r=t.find((e=>!e.rowTotal&&!e.columnTotal&&!e.group)).dataFields.length;for(let e=0;e<r;e++)for(let n=o;n<t.length-i;n++){void 0===a[e]&&(a[e]=[]);const o=t[n];if(o.columnTotal){const t=o.dataFields[e];e===r-1?a[e].push({label:l,columnDefinition:o,info:{dataField:"TOTAL",label:l,originalColumn:{}}}):t?a[e].push({label:t.label,columnDefinition:o,info:t}):a[e].push({label:"",columnDefinition:o,info:o.dataFields[e-1]})}else a[e].push({label:o.dataFields[e].label,columnDefinition:o,info:o.dataFields[e]})}return a}_breadcrumbCloseHandler(e){const t=this,a=t.columns.find((t=>t.dataField===e.detail.item.value.dataField));a&&((t.isInShadowDOM?e.composedPath()[0]:e.target===t.$.rowGroupBreadcrumb)?a.rowGroup=void 0:a.pivot=void 0)}_breadcrumbDragEndHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=a===t.$.rowGroupBreadcrumb,o=t._breadcrumbOperation;let i=t.columns.find((t=>t.dataField===e.detail.item.data.value.dataField));if("forbidden"===o)return void(a.dataSource=l?t._rowGroupColumns.map((e=>({label:e.label,value:e}))):t._pivotColumns.map((e=>({label:e.label,value:e}))));const r=t.columns;if("remove"!==o){if("reorder"===o){const a=e.detail.target;if(!a)return;const l=a.data.value;if(void 0===i||void 0===l||i.dataField===l.dataField)return;const o=e.detail.droppedBeforeTarget?"top":"bottom",n=r.findIndex((e=>e.dataField===i.dataField));let s=r.findIndex((e=>e.dataField===l.dataField));if(n>s&&"bottom"===o||n<s&&"top"===o)return;r.canNotify=!1,r.splice(n,1),s=r.findIndex((e=>e.dataField===l.dataField)),"bottom"===o?r.splice(s+1,0,i):r.splice(s,0,i),t.columns=r,r.canNotify=!0}else o instanceof HTMLElement&&(o.$.container.classList.remove("drop-target"),r.canNotify=!1,o===t.$.rowGroupBreadcrumb||t._designer&&o===t._designer.$.rowGroupsTree?(i.pivot=void 0,i.rowGroup=!0):t._designer&&o===t._designer.$.summariesTree?(i[l?"rowGroup":"pivot"]=void 0,i.summary=t._getDefaultSummaryFunction(i)):(o===t.$.pivotBreadcrumb||t._designer&&o===t._designer.$.pivotsTree)&&(i.rowGroup=void 0,i.pivot=!0),r.canNotify=!0);t._refreshColumns()}else l?i.rowGroup=void 0:i.pivot=void 0}_getDefaultSummaryFunction(e){const t=this;return t.columnTotals?t._totalSummaryFunction:t.getDefaultSummaryFunction?t.getDefaultSummaryFunction(e):"count"}_breadcrumbDraggingHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=a._dragDrop.dragDetails.feedback,o=e.detail.item.data.value,i=e.detail.originalEvent,r=t._isMobile?t.getRootNode().elementFromPoint(i.clientX,i.clientY):t.isInShadowDOM?i.composedPath()[0]:i.target;let n,s;if(l){if(l.classList.remove("cancel","delete","row-group","summary","pivot"),t._breadcrumbOperation&&t._breadcrumbOperation instanceof HTMLElement&&t._breadcrumbOperation.$.container.classList.remove("drop-target"),a.contains(r))s="reorder";else if(r===document)n="delete",s="remove";else{const e=t._designer;if(s=r.closest("smart-breadcrumb, smart-tree"),s&&s instanceof Smart.Breadcrumb)s===t.$.rowGroupBreadcrumb&&!o.allowRowGroup||s===t.$.pivotBreadcrumb&&!o.allowPivot?(n="cancel",s="forbidden"):n=s===t.$.rowGroupBreadcrumb?"row-group":"pivot";else if(s&&e&&s!==e.$.columnsTree)switch(s){case e.$.rowGroupsTree:a===t.$.rowGroupBreadcrumb?(n="row-group",s="forbidden"):o.allowRowGroup?n="row-group":(n="cancel",s="forbidden");break;case e.$.summariesTree:n="summary";break;case e.$.pivotsTree:a===t.$.pivotBreadcrumb?(n="pivot",s="forbidden"):o.allowPivot?n="pivot":(n="cancel",s="forbidden")}else n="delete",s="remove"}n&&l.classList.add(n),t._breadcrumbOperation=s,s instanceof HTMLElement&&s.$.container.classList.add("drop-target")}}_tableContainerClickHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target;if(a.classList.contains("total-arrow"))t._totalArrowClickHandler(a);else{if(t.rowSort&&!a.classList.contains("hierarchy-arrow")){const e=a.closest('td[data-field^="pivotgroup"]');if(e){if("classic"===t.groupLayout&&(""===e.textContent||e.closest('td:not(.expanded)+td[data-field^="pivotgroup"]:not(.main), td.expanded:not(.main)+td[data-field^="pivotgroup"]:not(.main)')))return;return void t._sortByRow(e)}}super._tableContainerClickHandler(e)}}_tableContainerKeydownHandler(e){const t=this,a=t.getRootNode().activeElement;"Enter"===e.key&&a.classList.contains("total-arrow")?t._totalArrowClickHandler(a):"F2"===e.key&&t._focusedCell?t._drillDown({cell:t._focusedCell,dataField:t._focusedCell.getAttribute("data-field"),rowElement:t._focusedCell.parentElement}):super._tableContainerKeydownHandler(e)}_totalArrowClickHandler(e){const t=this,a=e.parentElement,l=a.controller;l.expanded?(l.expanded=!1,function e(a){if(a.children)for(let l=0;l<a.children.length;l++){const o=a.children[l];Array.from(t.$.tableContainer.querySelectorAll(`td[data-field="${o.id}"]`)).forEach((e=>e.classList.add("smart-hidden"))),e(o),o.hidden=!0,o.cell.classList.add("smart-hidden"),o.columnTotal&&(o.arrowCell.classList.add("smart-hidden"),o.emptyCells.forEach((e=>e.classList.add("smart-hidden"))))}}(l),t.$.fireEvent("collapseTotalColumn",{columnDefinition:l})):(l.expanded=!0,function e(a){if(a.children)for(let l=0;l<a.children.length;l++){const o=a.children[l];Array.from(t.$.tableContainer.querySelectorAll(`td[data-field="${o.id}"]`)).forEach((e=>e.classList.remove("smart-hidden"))),o.expanded&&e(o),o.hidden=!1,o.cell.classList.remove("smart-hidden"),o.columnTotal&&(o.arrowCell.classList.remove("smart-hidden"),o.emptyCells.forEach((e=>e.classList.remove("smart-hidden"))))}}(l),t.$.fireEvent("expandTotalColumn",{columnDefinition:l})),a.classList.toggle("expanded",l.expanded),function e(a){const l=a.controller;t._getColumnTotalColspan(a),l.parent&&e(l.parent.arrowCell)}(a),t._hideColumnTotalsBorder(),"cell"===t.selectionMode&&t._selectedCells.collection.length>1&&(t._selectedCells.isDirty=!0)}_hideColumnTotalsBorder(){if(!this.columnTotals)return;const e=this.$.tableContainer.firstElementChild;Array.from(e.querySelectorAll(".last-visible")).forEach((e=>e.classList.remove("last-visible")));for(let t=1;t<e.childElementCount;t++){const a=e.children[t].querySelectorAll("th:not(.smart-hidden)");a[a.length-1].classList.add("last-visible")}}_getColumnExportFormat(e,t,a){if(e.columnTotal)return;const l=e.dataFields[e.dataFields.length-1].originalColumn;if(l.align&&(e.group?a.textAlign=l.align:t.textAlign=l.align),e.group||!l.summarySettings)return;const o=l.summarySettings;let i="#.",r=!1;o.align&&(a.textAlign=o.align),void 0!==o.thousandsSeparator&&""!==o.thousandsSeparator&&(i="#"+o.thousandsSeparator+i,r=!0),void 0!==o.decimalPlaces&&(i+="0".repeat(o.decimalPlaces),r=!0),void 0!==o.prefix&&(i=o.prefix.toString()+i,r=!0),o.negativesInBrackets&&(i=`${i};(${i})`,r=!0),r&&(a.format=i)}_beginEdit(e){this._drillDown(e)}_drillDown(e){const t=this,a=e.dataField;if(/^group\d*$/g.test(a))return;const l=e.rowElement,o=e.cell,i=document.createElement("div"),r=document.createElement("smart-table"),n=t._dynamicColumns.find((e=>e.id===a)),s=[],d=JSON.parse(JSON.stringify(t._columns)),c=t.localize("total");let u,m,p,g,f=l.data;if(f&&!l.classList.contains("grand-total"))if("classic"===t.groupLayout&&(f=t._getRecordToDisplay(f)),u=f.$.id,f.group){for(m=[f.group.replace(/ \(\d+\)/,"")],g=f.parent;g;)m.push(g.group.replace(/ \(\d+\)/,"")),g=g.parent;m=m.reverse().join("→")}else if(f.pivotgroup){for(m=[f.pivotgroup.replace(/ \(\d+\)/,"")],g=f.parent;g;)m.push(g.pivotgroup.replace(/ \(\d+\)/,"")),g=g.parent;m=m.reverse().join("→")}else m=t.localize("notApplicable");else u="GRAND_TOTAL",m=t.localize("grandTotal");if(!n)return;if(n.rowTotal)s.push(c);else if(n.columnTotal){for(let e=0;e<=n.dataFields.length-1;e++)s.push(n.dataFields[e].label);s.push(c),p=`${t._totalSummaryFunction}(${c})`}else for(let e=0;e<n.dataFields.length;e++)s.push(n.dataFields[e].label);const h=t._originalRecords[u+n.id];if(h&&0!==h.length){if(i.innerHTML=`<div class="drill-down-details">\n <span>${t.localize("row")}:</span><strong>${m}</strong>\n <span>${t.localize("column")}</span><strong>${s.join("→")||t.localize("notApplicable")}</strong>\n <span>${p||n.dataFields[n.dataFields.length-1].label}:</span><strong>${o.textContent}</strong>\n </div>`,i.appendChild(r),""!==t.drillDownDataExport){const e=document.createElement("smart-button");e.innerHTML=t.localize("export")+" "+t.drillDownDataExport.toUpperCase(),e.onclick=()=>{r.exportData(t.drillDownDataExport,t.drillDownDataExportFileName)},i.appendChild(e)}d.forEach((e=>e.width=t._cellWidth)),r.columns=d,r.dataSource=new window.Smart.DataAdapter({dataSource:h,dataFields:t.dataSource._dataFields}),r.freezeHeader=!0,r.keyboardNavigation=t.keyboardNavigation,h&&h.length>100&&d&&d.length>10&&(r.virtualization=!0,r.style.height="100%",r.style.width="100%"),t.drillDownTableInit&&t.drillDownTableInit(r),t.drillDownCustomAction?t.drillDownCustomAction(h):t._openDialog(t.localize("details"),i,"drill-down")}}_getColumnTotalsOriginalRecords(e,t){const a=this;let l=[];for(let o=0;o<e.children.length;o++){const i=e.children[o];if(!i.columnTotal){const e=a._originalRecords[t+i.id];e&&(l=e);break}l=l.concat(a._getColumnTotalsOriginalRecords(i,t))}return l}_conditionalFormattingButtonClickHandler(e){const t=this._aggregateColumns.map((e=>({label:`${e.summary}(${e.label})`,dataField:e.dataField,dataType:"number"})));super._conditionalFormattingButtonClickHandler(e,t,this.rows)}_applyConditionalFormatting(){const e=this,t=e._conditionalFormatting;e._conditionalFormatting=e._formattingPanel.apply(),e.conditionalFormatting=e._formattingPanel.getItems(),e._conditionalFormatting!==t&&e.refresh(void 0,e._getCurrentDataStructure())}_fieldsButtonClickHandler(){const e=this;e._designer?e._designer.inverted=!1:e._initDesigner(),e._openDialog(e.localize("fields"),e._designer,"fields")}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("change",e._dialogEventHandler),t.addEventListener("clear",e._dialogEventHandler),t.addEventListener("filter",e._dialogEventHandler),super._addDialogHandlers()}_dialogEventHandler(e){const t=e.type;if(-1===["change","clear","filter"].indexOf(t))return void super._dialogEventHandler(e);const a=this.ownerElement;if(!(this.isInShadowDOM?e.composedPath()[0]:e.target).closest("smart-pivot-panel"))return;const l=a.context;a.context=a,"change"===t?a._designerChangeHandler(e):a._designerFilterHandler(e),a.context=l}_sortByRow(e){const t=this,a=t.columnTotalsPosition,l=t._originalDynamicColumnsOrder,o=e.parentElement,i=o.data;let r=i;function n(e){"asc"===r.sortOrder?e.sort((function(e,t){return e.value-t.value})):e.sort((function(e,t){return t.value-e.value}))}if("classic"===t.groupLayout&&(r=e.data?e.data:t._getRecordToDisplay(i)),r.sortOrder?"asc"===r.sortOrder?r.sortOrder="desc":delete r.sortOrder:r.sortOrder="asc",t._sortRow&&t._sortRow!==r&&delete t._sortRow.sortOrder,r.sortOrder){if(t.columnTotals){const e=[];if(function e(l,o){const i=[];for(const e of l)i.push({dynamicColumnName:e.id,value:r[e.id]});n(i);for(const l of i){const i=t._getDynamicColumnById[l.dynamicColumnName];"near"===a&&o.push(i),i.children&&e(i.children,o),"far"===a&&o.push(i)}}(t._dynamicColumns.filter((e=>e.columnTotal&&0===e.pivotLevel)),e),t._rowGroupColumns.length>0&&e.unshift(t._dynamicColumns[0]),t.rowTotals){const a=t._dynamicColumns.filter((e=>e.rowTotal));"near"===t.rowTotalsPosition?e.splice(1,0,...a):e.push(...a)}t._dynamicColumns=e}else{let e=[];Object.keys(r).filter((e=>-1===["$","children","count","expanded","pivotgroup","group","id","leaf","level","parent","parentid","sortOrder","tr"].indexOf(e))).forEach((t=>{e.push({dynamicColumnName:t,value:r[t]})})),n(e),t._dynamicColumns=t._dynamicColumns.sort((function(a,l){return a.group||a.rowTotal||l.group||l.rowTotal?t._dynamicColumns.indexOf(a)-t._dynamicColumns.indexOf(l):e.findIndex((e=>e.dynamicColumnName===a.id))-e.findIndex((e=>e.dynamicColumnName===l.id))}))}t._sortRow=r}else t._dynamicColumns=t._dynamicColumns.sort((function(e,t){return l.findIndex((t=>t===e.id))-l.findIndex((e=>e===t.id))})),delete t._sortRow;t.refresh(void 0,t._getCurrentDataStructure()),t._focusCell(t.$.tableContainer.querySelector(`tr[row-id="${o.getAttribute("row-id")}"] td[data-field="${e.getAttribute("data-field")}"]`))}_clearSortByRow(e,t){const a=this;if(!a._sortRow)return;if(delete a._sortRow.sortOrder,delete a._sortRow,e&&!t)return;const l=a._originalDynamicColumnsOrder;a._dynamicColumns=a._dynamicColumns.sort((function(e,t){return l.findIndex((t=>t===e.id))-l.findIndex((e=>e===t.id))})),e||a.refresh(void 0,a._getCurrentDataStructure())}_defaultSortByRowGroups(e){const t=this,a=t._rowGroupColumns,l=a.find((e=>-1!==e.dataField.toLowerCase().indexOf("month")&&"string"===e.dataType)),o=new Smart.DataAdapter({dataSource:e,dataFields:e.dataFields}),i=[],r=[],n=[];let s;if(a.forEach((e=>{const t=e.sortOrder?e.sortOrder:"asc";i.push(e.dataField),r.push(t),n.push(e.dataType)})),l){const e=new Intl.DateTimeFormat(t.locale,{month:"long"}),a=[0,1,2,3,4,5,6,7,8,9,10,11].map((t=>e.format(new Date(2e3,t,1))));s=function(e,t,i,r){e.sort((function(e,o){for(let n=0;n<t.length;n++){if(l.dataField===t[n])return a.indexOf(e.month)-a.indexOf(o.month);const s=r[n](e[t[n]],o[t[n]]);if(0===s){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-o.$.index)*("asc"===i[n]?1:-1):0}return s*("asc"===i[n]?1:-1)}}));for(let t=0;t<e.length;t++)o[t]=e[t]}}return o._sort(o.boundSource,i,r,n,s),t._dataSourceSortedByDefault=!0,o.toArray()}_tableContainerDownHandler(e){const t=this;if(super._tableContainerDownHandler(e),"cell"!==t.selectionMode)return;clearTimeout(t._mobileScrollTimeout),delete t._selectDrag;const a=(t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest("tbody td[data-field]");if(!a)return;const l=t._selectedCells;if((e.ctrlKey||e.metaKey)&&l.collection.length>0){const e=l.collection.findIndex((e=>e.element===a));if(-1===e)a.classList.add("selected"),l.collection.push(t._getCellInfo(a));else{a.classList.remove("selected"),l.collection.splice(e,1);const t=l.start&&l.start.element===a,o=l.end&&l.end.element===a;(t||o)&&(delete l.start,delete l.end)}return l.collection.length>0&&(l.isDirty=!0),t._showSelectionDetails(),void t.$.fireEvent("change",{type:"interaction"})}if(e.shiftKey&&l.start)return void t._selectTo(e);const o=(new Date).getTime();let i;function r(){const e=l.collection.slice(0);l.collection.forEach((e=>e.element.classList.remove("selected"))),a.classList.add("selected"),delete l.isDirty,l.start=t._getCellInfo(a),l.end=l.start,l.collection=[l.start],l.time=o,t._selectDrag=!0,t._showSelectionDetails(),1===e.length&&e[0].element===a||t.$.fireEvent("change",{type:"interaction"})}t._isMobile&&(i=a.getBoundingClientRect()),t._isMobile?(clearTimeout(t._mobileScrollTimeout),t._mobileScrollTimeout=setTimeout((function(){const e=a.getBoundingClientRect();Math.abs(i.top-e.top)<5&&Math.abs(i.left-e.left)<5&&r()}),500)):r()}_getCellInfo(e){const t=this,a=e.parentElement,l=e.getAttribute("data-field");let o=a.data,i=o[l];return"classic"===this.groupLayout&&(o=t._getRecordToDisplay(o),i=/^group\d*$/.test(l)?o.group:o[l]),{dataField:l,element:e,row:a,rowData:o,value:i}}_documentMoveHandler(e){!this._selectDrag||e.ctrlKey||e.metaKey?super._documentMoveHandler(e):this._selectTo(e)}_selectTo(e){const t=this,a=t._selectedCells;let l;if(l=t._isMobile?t.getRootNode().elementFromPoint(e.originalEvent.clientX,e.originalEvent.clientY):t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target,!l)return;const o=l.closest("tbody td[data-field]");if(!o||o===a.end.element)return;a.collection.forEach((e=>e.element.classList.remove("selected"))),a.collection=[],a.end=t._getCellInfo(o);let i=Array.from(t.$.tableContainer.querySelectorAll("tbody>tr:not(.smart-hidden)")),r=i.indexOf(a.start.row),n=a.start.row===a.end.row?r:i.indexOf(a.end.row),s=t._getDynamicColumnsForCellSelection(),d=s.findIndex((e=>e.id===a.start.dataField)),c=a.start.dataField===a.end.dataField?d:s.findIndex((e=>e.id===a.end.dataField));for(let e=Math.min(r,n);e<=Math.max(r,n);e++){const t=i[e],l=t.data;for(let e=Math.min(d,c);e<=Math.max(d,c);e++){const o=s[e].id,i=t.querySelector(`td[data-field="${o}"]`);a.collection.push({dataField:o,element:i,row:t,rowData:l,value:l[o]}),i.classList.add("selected")}}t._showSelectionDetails(),t.$.fireEvent("change",{type:"interaction"}),"down"===e.type&&(t._selectDrag=!0,super._focusCell(a.start.element))}_getDynamicColumnsForCellSelection(){const e=this;let t=e._dynamicColumns.filter((e=>!0!==e.hidden));if(e._rowGroupColumns.length>0&&"classic"===e.groupLayout){const a=t.splice(0,1)[0];for(let l=e._rowGroupColumns.length-1;l>=0;l--)t.unshift(Object.assign({},a,{id:"pivotgroup"+l}))}return t}_tableContainerTouchmoveHandler(e){const t=this;t._selectDrag&&t._isMobile&&(t._isMobile&&(new Date).getTime()-t._selectedCells.time<500?delete t._selectDrag:(t.$.main.classList.add("prevent-scroll"),e.preventDefault()))}_showSelectionDetails(e){const t=this;if(t.hideCellSelectionTooltip)return;const a=t._selectedCells.collection,l=t.$.tableContainer.querySelector("[selection-detail]");let o;if(l&&(e&&(o=l.getAttribute("selection-detail")),l.removeAttribute("selection-detail"),l.removeAttribute("detail-position-x"),l.removeAttribute("detail-position-y")),!(a.length<=1)){if(void 0===o){let e=0,l=0;for(const t of a)null===t.value||/^group\d*$/.test(t.dataField)||(e++,l+=t.value);if(e<=1)return;let i=l/e;const r=t._aggregateColumns.find((e=>e.summarySettings));if(r){const e=document.createElement("td"),a={summarySettings:r.summarySettings};l=t._formatSummaryValue(void 0,a,e,l),i=t._formatSummaryValue(void 0,a,e,i)}o=`${t.localize("average")}: ${i}; ${t.localize("count")}: ${e}; ${t.localize("sum")}: ${l}`}t._positionTooltipOnLastVisible(a,o)}}_positionTooltipOnLastVisible(e,t){const a=this,l=a.rightToLeft,o=a._getDynamicColumnsForCellSelection(),i=a.getRootNode(),r=a.$.main,n=a.$.tableContainer,s=Array.from(n.children[1].querySelectorAll("tr:not(.smart-hidden):not(.last-visible)")),d=parseFloat(getComputedStyle(a).getPropertyValue("--smart-pivot-table-cell-width")),c=a.grandTotal?n.lastElementChild.offsetHeight:0,u=r.getBoundingClientRect(),m=u.left,p=u.top,g=r.clientWidth,f=r.clientHeight;let h=n.firstElementChild.offsetHeight,_=1,b=1,y=0;a.freezeHeader||(h=Math.max(0,h-r.scrollTop)),a._rowGroupColumns.length>0&&"classic"===a.groupLayout&&(l?(b=.7,y=Math.max(0,r.offsetWidth-g)):_=.7);const v=i.elementFromPoint(m-d*_+5,p+h+5),C=i.elementFromPoint(m+g+d*b-5,p+h+5);let w,S=i.elementFromPoint(m+5,p+h+5),T=i.elementFromPoint(m+g-5,p+h+5);if(v!==S?(S=i.elementFromPoint(m+d*_-5,p+h+5),w=i.elementFromPoint(m+d*_-5,p+f-c-a._rowHeight-5)):w=i.elementFromPoint(m+5,p+f-c-a._rowHeight-5),S||(S=s[0].querySelector("td:not(.smart-hidden)")),w&&"td"===w.tagName.toLowerCase()||(w=s[s.length-1].querySelector(`td[data-field="${S.getAttribute("data-field")}"]`)),C!==T&&(T=i.elementFromPoint(m+g-d*b+y,p+h+5)),!T){const e=s[0].querySelectorAll("td:not(.smart-hidden)");T=e[e.length-1]}const $=s.indexOf(S.parentElement),F=s.indexOf(w.parentElement);let D,x,L,A=o.findIndex((e=>e.id===S.getAttribute("data-field"))),E=o.findIndex((e=>e.id===T.getAttribute("data-field")));if(l){const e=A;A=E,E=e}for(const t of e){if(t.row.classList.contains("smart-hidden"))continue;let e,a;if(void 0===t.rowIndex?(e=s.indexOf(t.row),t.rowIndex=e):e=t.rowIndex,void 0===t.columnIndex?(a=o.findIndex((e=>e.id===t.dataField)),t.columnIndex=a):a=t.columnIndex,a>=A&&a<=E)if(e>=$&&e<=F){const l=D,o=x;(!D||D.temp||e>=D.rowIndex&&a>=D.columnIndex)&&(D=t),(!x||e>=x.rowIndex&&a<=x.columnIndex)&&(x=t),l&&l.temp&&delete l.temp,o&&o.temp&&delete o.temp}else e>F&&((!D||D.temp&&e<=D.rowIndex&&a>=D.columnIndex)&&(D=t,t.temp=!0),(!x||x.temp&&e<=D.rowIndex&&a<=x.columnIndex)&&(x=t,t.temp=!0))}D&&(Math.abs(D.columnIndex-A)>Math.abs(D.columnIndex-E)?(L=D,l||L.element.setAttribute("detail-position-x","right")):(L=x,l&&L.element.setAttribute("detail-position-x","right")),L.temp&&(L.element.setAttribute("detail-position-y","top"),delete L.temp),L.element.setAttribute("selection-detail",t))}_mainContainerOnscroll(){const e=this;e._selectedCells.collection.length>1&&e._showSelectionDetails(!0)}_focusCell(e,t,a){const l=this;if(!a||"cell"!==l.selectionMode||!l.selection)return void super._focusCell(e,t);const o=l._selectedCells,i=a&&a.shiftKey&&0===a.key.indexOf("Arrow");if(o.isDirty||!i||0===o.collection.length){if(!1===super._focusCell(e,t))return;o.collection.forEach((e=>e.element.classList.remove("selected"))),e.classList.add("selected"),o.start=l._getCellInfo(e),o.end=o.start,o.collection=[o.start],delete o.isDirty,l.$.fireEvent("change",{type:"interaction"})}else l._shiftArrowSelection(a);l._showSelectionDetails()}_shiftArrowSelection(e){const t=this,a=t._selectedCells,l=t._getDynamicColumnsForCellSelection(),o=e.key,i=Array.from(t.$.tableContainer.children[1].querySelectorAll("tr:not(.smart-hidden):not(.last-visible)")),r=i.indexOf(a.start.row),n=i.indexOf(a.end.row),s=l.findIndex((e=>e.id===a.start.dataField)),d=l.findIndex((e=>e.id===a.end.dataField));if("ArrowUp"===o||"ArrowDown"===o){if("ArrowUp"===o&&n<r||"ArrowDown"===o&&n>r||n===r){if("ArrowUp"===o&&0===n||"ArrowDown"===o&&n===i.length-1)return;const e=i[n+1*("ArrowUp"===o?-1:1)];for(let o=Math.min(s,d);o<=Math.max(s,d);o++){const i=e.querySelector(`td[data-field="${l[o].id}"]`),r=t._getCellInfo(i);a.end.dataField===r.dataField&&(a.end=r,super._focusCell(i,!0)),a.collection.push(r),i.classList.add("selected")}}else if("ArrowDown"===o&&n<r||"ArrowUp"===o&&n>r){const e=i[n+1*(n>r?-1:1)];a.collection.filter((e=>e.row===a.end.row)).forEach((e=>e.element.classList.remove("selected"))),a.collection=a.collection.filter((e=>e.row!==a.end.row));const t=a.collection.find((t=>t.row===e&&t.dataField===a.end.dataField));a.end=t,super._focusCell(t.element,!0)}}else{let e="ArrowRight",c="ArrowLeft";if(t.rightToLeft&&(e="ArrowLeft",c="ArrowRight"),o===c&&d<s||o===e&&d>s||d===s){if(o===c&&0===d||o===e&&d===l.length-1)return;const s=l[d+1*(o===c?-1:1)];for(let e=Math.min(r,n);e<=Math.max(r,n);e++){const l=i[e].querySelector(`td[data-field="${s.id}"]`),o=t._getCellInfo(l);a.end.row===o.row&&(a.end=o,super._focusCell(l,!0)),a.collection.push(o),l.classList.add("selected")}}else if(o===e&&d<s||o===c&&d>s){const e=l[d+1*(d>s?-1:1)];a.collection.filter((e=>e.dataField===a.end.dataField)).forEach((e=>e.element.classList.remove("selected"))),a.collection=a.collection.filter((e=>e.dataField!==a.end.dataField));const t=a.collection.find((t=>t.dataField===e.id&&t.row===a.end.row));a.end=t,super._focusCell(t.element,!0)}}t.$.fireEvent("change",{type:"interaction"})}_clearCellSelection(e){const t=this,a=t.$.tableContainer.querySelector("[selection-detail]");a&&(a.removeAttribute("selection-detail"),a.removeAttribute("detail-position-x"),a.removeAttribute("detail-position-y")),t._selectedCells.collection.forEach((e=>e.element.classList.remove("selected"))),e&&(t._selectedCells={collection:[]})}_toggleCellSelectionProgrammatically(e,t,a){const l=this,o=l._getDynamicColumnsForCellSelection(),i=l.rows.dataItemById[e];"pivotgroup"===t&&"classic"===l.groupLayout&&(t="pivotgroup0");const r=o.find((e=>e.id===t));if(!i||!r)return;const n=l._selectedCells,s=n.collection.find((e=>e.rowData.$.id===i.$.id&&e.dataField===t));if(a){if(s)return;const e=l.$.tableContainer.querySelector(`tr[row-id="${i.$.id}"]>td[data-field="${t}"]`),a=l._getCellInfo(e);e.classList.add("selected"),super._focusCell(e,!0),n.collection.push(a),1===n.collection.length?(n.start=a,n.end=a,delete n.isDirty):n.isDirty=!0}else{if(!s)return;const e=n.start&&n.start.rowData.$.id===i.$.id&&n.start.dataField===t,a=n.end&&n.end.rowData.$.id===i.$.id&&n.end.dataField===t;s.element.classList.remove("selected"),n.collection.splice(n.collection.indexOf(s),1),n.isDirty=!0,(e||a)&&(delete n.start,delete n.end)}l._showSelectionDetails(),l.$.fireEvent("change",{type:"programmatic"})}}),Smart("smart-pivot-panel",class extends Smart.BaseElement{static get properties(){return{columns:{value:[],type:"any",reflectToAttribute:!1},dataSource:{value:[],type:"any?",reflectToAttribute:!1},inverted:{value:!1,type:"boolean"},messages:{value:{en:{calculation:"Calculation",cancel:"Cancel",center:"center",clear:"Clear",columns:"Columns",columnSettings:"Column settings",decimalPlaces:"Decimal places",decimalSeparator:"Decimal separator",dragHereRowGroups:"Drag here to set row groups",dragHereSummaries:"Drag here to set summaries",dragHerePivots:"Drag here to set pivots",filter:"Filter",filters:"Filters",left:"left",moveTo:"Move to",negativesInBrackets:"Negatives in brackets",numberAlignment:"Number alignment",numberFormat:"Number format",numberPrefix:"Number prefix",ok:"OK",pivots:"Pivots",right:"right",rowGroups:"Row Groups",search:"Search...",showRows:"Show records where:",summaries:"Summaries",textAlignment:"Text alignment",thousandsSeparator:"Thousands separator"}},type:"object",extend:!0},view:{value:"columns",allowedValues:["columns","filters"],type:"string"}}}static get listeners(){return{keydown:"_keydownHandler","columnsView.click":"_settingsIconClickHandler","columnsView.dragEnd":"_dragEndHandler","columnsView.dragging":"_draggingHandler","filtersView.clear":"_filterPanelFilterHandler","filtersView.expanding":"_accordionItemExpandingHandler","filtersView.filter":"_filterPanelFilterHandler","summariesTree.dragStart":"_summariesTreeDragStartHandler","tabs.click":"_tabsClickHandler"}}template(){return'<div id="container" role="presentation">\n <div id="main" role="presentation">\n <div id="columnsView" class="smart-pivot-panel-columns-view" role="tabpanel">\n <div id="columns" class="smart-pivot-panel-columns-container" role="presentation">\n <smart-tree id="columnsTree" allow-drag allow-drop animation="[[animation]]" filterable selection-mode="zeroOrOne" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]" aria-label="Columns"></smart-tree>\n </div>\n <div id="rowGroups" class="smart-pivot-panel-active-columns" role="presentation">\n <div id="rowGroupsLabel" class="smart-pivot-panel-row-groups-label smart-pivot-panel-label"><span class="icon" aria-hidden="true"></span><span></span></div>\n <smart-tree id="rowGroupsTree" allow-drag allow-drop animation="[[animation]]" selection-mode="zeroOrOne" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-tree>\n </div>\n <div id="summaries" class="smart-pivot-panel-active-columns" role="presentation">\n <div id="summariesLabel" class="smart-pivot-panel-summaries-label smart-pivot-panel-label"><span class="icon" aria-hidden="true"></span><span></span></div>\n <smart-tree id="summariesTree" allow-drag allow-drop animation="[[animation]]" selection-mode="zeroOrOne" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-tree>\n </div>\n <div id="pivots" class="smart-pivot-panel-active-columns" role="presentation">\n <div id="pivotsLabel" class="smart-pivot-panel-pivots-label smart-pivot-panel-label"><span class="icon" aria-hidden="true"></span><span></span></div>\n <smart-tree id="pivotsTree" allow-drag allow-drop animation="[[animation]]" selection-mode="zeroOrOne" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-tree>\n </div>\n </div>\n <div id="filtersView" class="smart-pivot-panel-filters-view" role="tabpanel"></div>\n </div>\n <div id="tabs" class="smart-pivot-panel-tabs smart-unselectable">\n <div id="columnsTab" class="smart-pivot-panel-tab-item" role="tab" aria-selected="false"><span class="icon" aria-hidden="true"></span><span></span></div>\n <div id="filtersTab" class="smart-pivot-panel-tab-item" role="tab" aria-selected="false"><span class="icon" aria-hidden="true"></span><span></span></div>\n </div>\n </div>'}render(){const e=this;e._isMobile=Smart.Utilities.Core.isMobile,e._initializedFilters={},e._cachedFilters={},e._setFocusable(),e._localize(),e._setAriaRelations(),e.dataSource instanceof Smart.DataAdapter&&(e.dataSource=e.dataSource.toArray()),"columns"===e.view?(e.$.columnsTab.classList.add("selected"),e.$.columnsTab.setAttribute("aria-selected",!0),e.$.filtersView.remove(),e._initializeColumnsView()):(e.$.filtersTab.classList.add("selected"),e.$.filtersTab.setAttribute("aria-selected",!0),e.$.columnsView.remove(),e._initializeFiltersView()),super.render()}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog))}detached(){const e=this;if(super.detached(),!e._dialog)return;const t=e._dialog;t.removeEventListener("close",e._dialogCloseHandler),t.removeEventListener("click",e._dialogClickHandler),t.remove()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"disabled":case"rightToLeft":case"theme":case"unfocusable":"disabled"!==e&&"unfocusable"!==e||l._setFocusable(),l._columnsViewInitialized&&"filters"===l.view&&[l.$.columnsTree,l.$.rowGroupsTree,l.$.summariesTree,l.$.pivotsTree].forEach((t=>t[e]=a)),l._filtersViewInitialized&&(Array.from(l.$.filtersView.querySelectorAll("smart-filter-panel")).forEach((t=>t[e]=a)),"animation"!==e&&(l.$.filtersView.querySelector("smart-accordion")[e]=a)),l._dialog&&(Array.from(l._dialog.$.container.querySelectorAll(".editor, .ok, .cancel")).forEach((t=>t[e]=a)),l._dialog[e]=a);break;case"columns":case"dataSource":"dataSource"===e&&l.dataSource instanceof Smart.DataAdapter&&(l.dataSource=l.dataSource.toArray()),"columns"===e&&l._columnsViewInitialized&&(delete l._columnsViewInitialized,"columns"===l.view&&l._initializeColumnsView()),l._filtersViewInitialized&&("columns"!==e||t.map((e=>e.dataField)).join(",")!==a.map((e=>e.dataField)).join(",")?("columns"===e&&Array.from(l.$.filtersView.querySelectorAll("smart-accordion-item.filtered smart-filter-panel")).forEach((e=>{l._cachedFilters[e.column.dataField]=e.$.mainContainer.firstElementChild.selectedIndexes})),delete l._filtersViewInitialized,l._initializedFilters={},l.$.filtersView.innerHTML="","filters"===l.view&&l._initializeFiltersView()):"columns"===e&&Array.from(l.$.filtersView.querySelectorAll("smart-accordion-item, smart-filter-panel")).forEach((e=>{e.column=a.find((t=>t.dataField===e.column.dataField))})));break;case"locale":case"messages":{const e=Array.from(l.$.filtersView.querySelectorAll("smart-filter-panel")),t=l._dialog;l._localize(),e.forEach((e=>{e.messages.en.clear=l.localize("clear"),e.messages.en.filter=l.localize("filter"),e.messages.en.showRows=l.localize("showRows"),e.propertyChangedHandler("messages")})),t&&(t.close(),t.removeEventListener("close",l._dialogCloseHandler),t.removeEventListener("click",l._dialogClickHandler),t.remove(),delete l._dialog);break}case"view":l._tabsClickHandler({target:l.$[a+"Tab"]})}}_localize(){const e=this;e.$.columnsTab.children[1].innerHTML=e.localize("columns"),e.$.filtersTab.children[1].innerHTML=e.localize("filters"),e.$.columnsTree.filterInputPlaceholder=e.localize("search"),e.$.rowGroupsLabel.children[1].innerHTML=e.localize("rowGroups"),e.$.summariesLabel.children[1].innerHTML=e.localize("summaries"),e.$.pivotsLabel.children[1].innerHTML=e.localize("pivots")}_initializeColumnsView(){const e=this;e._columnsViewInitialized||(e._columnsViewInitialized=!0,e._createColumnItems())}_initializeFiltersView(){const e=this;if(e._filtersViewInitialized)return;const t=e.columns,a=document.createElement("smart-accordion");e._filtersViewInitialized=!0;for(let l=0;l<t.length;l++){const o=t[l],i=document.createElement("smart-accordion-item");i.label=o.label,i.column=o,0===l&&e._initFilterPanel(i),e._cachedFilters[o.dataField]&&i.classList.add("filtered"),a.appendChild(i)}a.animation="none",a.expandMode="single",a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=e.unfocusable,e.$.filtersView.appendChild(a)}_initFilterPanel(e){const t=this,a=e.column,l=a.dataField;if(t._initializedFilters[l]){const t=e.querySelector("smart-filter-panel");return void(0===t._filterHandler.filterObject.filters.length&&t._filterHandler.tree.select("0"))}const o=document.createElement("smart-filter-panel"),i=a.dataType;o.animation=t.animation,o.column=a,o.disabled=!1===a.allowFilter,o.filterType="number"===i?"numeric":i,o.mode="excel",o.data=t.dataSource,o.dataField=l,o.messages.en.clear=t.localize("clear"),o.messages.en.filter=t.localize("filter"),o.messages.en.showRows=t.localize("showRows"),o.rightToLeft=t.rightToLeft,o.theme=t.theme,o.unfocusable=t.unfocusable,e.isRendered?e.$.contentContainer.appendChild(o):e.appendChild(o),t._initializedFilters[l]=!0,t._cachedFilters[l]&&o.whenRendered((function(){o.$.mainContainer.firstElementChild.selectedIndexes=t._cachedFilters[l],o._filterHandler.excelFilter(),delete t._cachedFilters[l]}))}_accordionItemExpandingHandler(e){const t=this.isInShadowDOM?e.composedPath()[0]:e.target;if(t instanceof Smart.Accordion==0)return;const a=t._items[e.detail.index];this._initFilterPanel(a)}_filterPanelFilterHandler(e){const t=(this.isInShadowDOM?e.composedPath()[0]:e.target).closest("smart-accordion-item");"clear"!==e.type||t.classList.contains("filtered")||e.stopPropagation(),t.classList.toggle("filtered","filter"===e.type)}_tabsClickHandler(e){const t=this,a=t.view,l=e.type&&t.isInShadowDOM?e.composedPath()[0]:e.target;if(t.$.columnsTab.contains(l)){if("columns"===a&&e.type)return;return t.view="columns",t.$.columnsTab.classList.add("selected"),t.$.columnsTab.setAttribute("aria-selected",!0),t.$.filtersTab.classList.remove("selected"),t.$.filtersTab.setAttribute("aria-selected",!1),t.$.filtersView.remove(),t.$.main.appendChild(t.$.columnsView),void t._initializeColumnsView()}if(t.$.filtersTab.contains(l)){if("filters"===a&&e.type)return;t.view="filters",t.$.filtersTab.classList.add("selected"),t.$.filtersTab.setAttribute("aria-selected",!0),t.$.columnsTab.classList.remove("selected"),t.$.columnsTab.setAttribute("aria-selected",!1),t.$.columnsView.remove(),t.$.main.appendChild(t.$.filtersView),t._initializeFiltersView()}}_createColumnItems(e){const t=this,a=t.columns,l=[],o=[],i=[],r=[];for(let t=0;t<a.length;t++){const n=a[t];n.allowPivot&&n.pivot&&l.push(n),n.allowRowGroup&&n.rowGroup&&o.push(n),n.summary&&i.push(n),!1!==e&&r.push({label:n.label,value:n})}function n(e,a){const l=[];for(let a=0;a<e.length;a++)l.push({label:t._getTreeItemLabel(e[a]),value:e[a]});a.dataSource=l}n(l,t.$.pivotsTree),n(o,t.$.rowGroupsTree),n(i,t.$.summariesTree),!1!==e&&(t.$.columnsTree.dataSource=r)}_summariesTreeDragStartHandler(e){const t=this.$.summariesTree;1===Object.keys(t.items).length&&e.preventDefault()}_draggingHandler(e){const t=this,a=e.detail.data.Feedback,l=e.detail.item.closest("smart-tree"),o=e.detail.originalEvent.originalEvent,i=t._isMobile?t.getRootNode().elementFromPoint(o.clientX,o.clientY):t.isInShadowDOM?o.composedPath()[0]:o.target,r=i.closest("smart-tree"),n=e.detail.item.value,s=t.ownerElement;if(t._breadcrumbTarget&&(t._breadcrumbTarget.$.container.classList.remove("drop-target"),delete t._breadcrumbTarget),s&&s.contains(i)){const e=i.closest("smart-breadcrumb");if(e)return a.classList.remove("forbidden"),e===s.$.rowGroupBreadcrumb?n.allowRowGroup?n.rowGroup||e.$.container.classList.add("drop-target"):a.classList.add("forbidden"):n.allowPivot?n.pivot||e.$.container.classList.add("drop-target"):a.classList.add("forbidden"),void(t._breadcrumbTarget=e)}l===t.$.columnsTree&&!r||r===t.$.rowGroupsTree&&!n.allowRowGroup||r===t.$.pivotsTree&&!n.allowPivot?a.classList.add("forbidden"):a.classList.remove("forbidden")}_dragEndHandler(e){const t=this,a=e.detail,l=a.previousContainer,o=a.container,i=a.item,r=t.columns.find((e=>e.dataField===i.value.dataField)),n=a.target,s=a.data.DropDetails?a.data.DropDetails.position:void 0;function d(){switch(o){case t.$.rowGroupsTree:return!!r.allowRowGroup&&(r.rowGroup=!0,!0);case t.$.summariesTree:return r.summary||(r.summary=t._getDefaultSummaryFunction(r)),!0;case t.$.pivotsTree:return!!r.allowPivot&&(r.pivot=!0,!0)}}function c(){const e=document.createElement("smart-tree-item");return e.label=t._getTreeItemLabel(r),e.value=r,e}function u(){if(l!==o)switch(l){case t.$.rowGroupsTree:delete r.rowGroup;break;case t.$.summariesTree:delete r.summary;break;case t.$.pivotsTree:delete r.pivot}}function m(){if(n.value)return t.columns.find((e=>e.dataField===n.value.dataField))}if(t._breadcrumbTarget)t._breadcrumbDropHandler(r,l);else{if(l===t.$.columnsTree){if(o instanceof Smart.Tree==0)return i.selected=!!(r.pivot||r.rowGroup||r.summary),void e.preventDefault();if(o===l){let e=!1;return(r.rowGroup&&Object.keys(t.$.rowGroupsTree.items).length>1||r.summary&&Object.keys(t.$.summariesTree.items).length>1||r.pivot&&Object.keys(t.$.pivotsTree.items).length>1)&&(e=!0),void requestAnimationFrame((()=>{const a=t.context;t.context=t,t.columns=t.$.columnsTree.dataSource.map((e=>e.value)),e&&(t._createColumnItems(!1),t.$.fireEvent("change",{columns:JSON.parse(JSON.stringify(t.columns))})),t.context=a}))}return Object.values(o._menuItems).find((e=>e.value===r))||(d()?(0===o.dataSource.length?o.insert({label:t._getTreeItemLabel(r),value:r}):("top"===s?o.addBefore(c(),n):o.addAfter(c(),n),t._reorder(r,m(),s)),t.$.fireEvent("change",{columns:JSON.parse(JSON.stringify(t.columns))})):i.selected=!!(r.pivot||r.rowGroup||r.summary)),void e.preventDefault()}if(o instanceof Smart.Tree==0||o===t.$.columnsTree)return u(),l.removeItem(i),t.$.fireEvent("change",{columns:JSON.parse(JSON.stringify(t.columns))}),void e.preventDefault();d()?(u(),t._reorder(r,m(),s),t.$.fireEvent("change",{columns:JSON.parse(JSON.stringify(t.columns))})):e.preventDefault()}}_reorder(e,t,a){const l=this,o=l.columns,i=o.indexOf(e);let r=o.indexOf(t);void 0===e||void 0===t||i>r&&"bottom"===a||i<r&&"top"===a||(o.splice(i,1),r=o.indexOf(t),"bottom"===a?o.splice(r+1,0,e):o.splice(r,0,e),l.columns=o,l.$.columnsTree.dataSource=o.map((e=>({label:e.label,value:e,selected:!!(e.pivot||e.rowGroup||e.summary)}))))}_breadcrumbDropHandler(e,t){const a=this,l=a._breadcrumbTarget,o=a.ownerElement,i=o.columns.find((t=>t.dataField===e.dataField)),r=a.context;function n(){switch(a.context=document,o.columns.canNotify=!1,t){case a.$.rowGroupsTree:i.rowGroup=void 0;break;case a.$.summariesTree:i.summary=void 0;break;case a.$.pivotsTree:i.pivot=void 0}}if(l.$.container.classList.remove("drop-target"),delete a._breadcrumbTarget,l===o.$.rowGroupBreadcrumb){if(!e.allowRowGroup||e.rowGroup)return;n(),i.rowGroup=!0}else{if(!e.allowPivot||e.pivot)return;n(),i.pivot=!0}o._refreshColumns(),a.context=r,o.columns.canNotify=!0}_getTreeItemLabel(e){return'<span class="settings-icon"></span>'+e.label}_settingsIconClickHandler(e){const t=this.isInShadowDOM?e.composedPath()[0]:e.target;t.classList.contains("settings-icon")&&this._openDialog(t.closest("smart-tree-item"))}_openDialog(e){const t=this;t._dialog||t._createDialog();const a=t._dialog,l=e.value,o=!!l.summary,i=Array.from(a.$.container.querySelectorAll(".editor"));let r=l.align||"left";if(t.$.container.setAttribute("modal",""),t._editedItem=e,a.classList.toggle("summary",o),a.setAttribute("aria-controls",e.id),i[0].value="",i[0].$.input.dataValue="",i[0].disabled=e.menu===t.$.summariesTree&&1===Object.keys(e.menu.items).length,i[1].value=t.localize(r),i[1].$.input.dataValue=r,o){let e=Object.assign({align:"left",prefix:"",decimalPlaces:0,thousandsSeparator:"",decimalSeparator:".",negativesInBrackets:!1},l.summarySettings||{});i[2].value=l.summary,i[2].disabled=t.ownerElement&&t.ownerElement.columnTotals,i[3].value=t.localize(e.align),i[3].$.input.dataValue=e.align,i[4].value=e.prefix,i[5].value=e.decimalPlaces.toString(),i[6].value=e.thousandsSeparator,i[7].value=e.decimalSeparator,i[8].checked=e.negativesInBrackets}a.open()}_createDialog(){const e=this,t=e.id,a=document.createElement("smart-window"),l=document.createElement("template"),o=` animation=${e.animation} theme="${e.theme}"${e.rightToLeft?" right-to-left":""}${e.unfocusable?" unfocusable":""}`;l.innerHTML=`<smart-button class="ok primary"${o}>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${o}>${e.localize("cancel")}</smart-button>`;const i=JSON.stringify([{label:e.localize("columns"),value:"columns"},{label:e.localize("rowGroups"),value:"rowGroups"},{label:e.localize("summaries"),value:"summaries"},{label:e.localize("pivots"),value:"pivots"}]),r=JSON.stringify([{label:e.localize("left"),value:"left"},{label:e.localize("center"),value:"center"},{label:e.localize("right"),value:"right"}]),n=JSON.stringify(["min","max","sum","avg","stdev","stdevp","var","varp","product","count","median"]);a.animation=e.animation,a.footerTemplate=l,a.headerButtons=["close"],a.label=e.localize("columnSettings"),a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=e.unfocusable,a.className="smart-pivot-window",a.innerHTML=`<div id="${t}MoveToLabel" class="label">${e.localize("moveTo")}</div>\n <div><smart-input class="editor underlined move-to"${o} data-source='${i}' drop-down-button-position="right" readonly aria-labelledby="${t}MoveToLabel"></smart-input></div>\n <div id="${t}TextAlignmentLabel" class="label">${e.localize("textAlignment")}</div>\n <div><smart-input class="editor underlined text-alignment"${o} data-source='${r}' drop-down-button-position="right" readonly aria-labelledby="${t}TextAlignmentLabel"></smart-input></div>\n <div id="${t}CalculationLabel" class="label summary">${e.localize("calculation")}</div>\n <div class="summary"><smart-input class="editor underlined calculation"${o} data-source='${n}' drop-down-button-position="right" readonly aria-labelledby="${t}CalculationLabel"></smart-input></div>\n <div class="label category summary">${e.localize("numberFormat")}</div>\n <div id="${t}NumberAlignmentLabel" class="label summary">${e.localize("numberAlignment")}</div>\n <div class="summary"><smart-input class="editor underlined number-alignment"${o} data-source='${r}' drop-down-button-position="right" readonly aria-labelledby="${t}NumberAlignmentLabel"></smart-input></div>\n <div id="${t}NumberPrefixLabel" class="label summary">${e.localize("numberPrefix")}</div>\n <div class="summary"><smart-input class="editor underlined number-prefix"${o} aria-labelledby="${t}NumberPrefixLabel"></smart-input></div>\n <div id="${t}DecimalPlacesLabel" class="label summary">${e.localize("decimalPlaces")}</div>\n <div class="summary"><smart-input class="editor underlined decimal-places"${o} aria-labelledby="${t}DecimalPlacesLabel"></smart-input></div>\n <div id="${t}ThousandsSeparatorLabel" class="label summary">${e.localize("thousandsSeparator")}</div>\n <div class="summary"><smart-input class="editor underlined thousands-separator"${o} aria-labelledby="${t}ThousandsSeparatorLabel"></smart-input></div>\n <div id="${t}DecimalSeparatorLabel" class="label summary">${e.localize("decimalSeparator")}</div>\n <div class="summary"><smart-input class="editor underlined decimal-separator"${o} aria-labelledby="${t}DecimalSeparatorLabel"></smart-input></div>\n <div id="${t}NegativesInBracketsLabel" class="label summary">${e.localize("negativesInBrackets")}</div>\n <div class="summary"><smart-check-box class="editor"${o} aria-labelledby="${t}NegativesInBracketsLabel"></smart-check-box></div>`,a.ownerElement=e,e._dialog=a,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(a),e.setAttribute("aria-owns",a.id)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("close",e._dialogCloseHandler),t.addEventListener("click",e._dialogClickHandler)}_dialogClickHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target;a.closest(".ok")?(t.ok=!0,t.close()):a.closest(".cancel")&&t.close()}_dialogCloseHandler(e){const t=this.ownerElement,a=t._dialog,l=t.context;if((a.isInShadowDOM?e.composedPath()[0]:e.target)!==a)return;const o=t._editedItem;if(t.context=t,t.$.container.removeAttribute("modal"),o.menu.focus(),a.ok){const e=o.value,l=Array.from(a.$.container.querySelectorAll(".editor")),i=l[0].$.input.dataValue,r=l[1].$.input.dataValue;let n=!1,s=!1;if(i&&!("rowGroups"===i&&(e.rowGroup||!e.allowRowGroup)||"summaries"===i&&e.summary||"pivots"===i&&(e.pivot||!e.allowPivot))){const a=o.menu;let l;switch(a.removeItem(o.path),a){case t.$.rowGroupsTree:delete e.rowGroup;break;case t.$.summariesTree:delete e.summary;break;case t.$.pivotsTree:delete e.pivot}switch(i){case"rowGroups":l=t.$.rowGroupsTree,e.rowGroup=!0;break;case"summaries":l=t.$.summariesTree,e.summary=t._getDefaultSummaryFunction(e),s=!0;break;case"pivots":l=t.$.pivotsTree,e.pivot=!0}if(l){const a=document.createElement("smart-tree-item");a.label=t._getTreeItemLabel(e),a.value=e,l.addTo(a),a.previousElementSibling&&t._reorder(e,a.previousElementSibling.value,"bottom")}n=!0}if((!e.align&&"left"!==r||e.align&&e.align!==r)&&(e.align=r,n=!0),e.summary&&!s){const t={align:"left",prefix:"",decimalPlaces:0,thousandsSeparator:"",decimalSeparator:".",negativesInBrackets:!1},a=e.summarySettings,o={align:l[3].$.input.dataValue,prefix:l[4].value,decimalPlaces:parseFloat(l[5].value),thousandsSeparator:l[6].value,decimalSeparator:l[7].value,negativesInBrackets:l[8].checked},i=l[2].value;if(isNaN(o.decimalPlaces)&&(o.decimalPlaces=a?a.decimalPlaces:0),i!==e.summary&&(e.summary=i,n=!0),a){const l=Object.assign({},t,a);Object.keys(l).forEach((t=>{l[t]!==o[t]&&(e.summarySettings[t]=o[t],n=!0)}))}else JSON.stringify(t)!==JSON.stringify(o)&&(e.summarySettings=o,n=!0)}delete a.ok,n&&t.$.fireEvent("change",{columns:JSON.parse(JSON.stringify(t.columns))})}delete t._editedItem,t.context=l}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.$.columnsTab.removeAttribute("tabindex"),void e.$.filtersTab.removeAttribute("tabindex");const t=e.$.columnsTab.getAttribute("tabindex");(null===t||t<0)&&(e.$.columnsTab.setAttribute("tabindex",0),e.$.filtersTab.setAttribute("tabindex",0))}_keydownHandler(e){const t=this,a=e.key,l=t.getRootNode().activeElement;if("Enter"!==a&&" "!==a||l!==t.$.columnsTab&&l!==t.$.filtersTab){if("Enter"===a&&-1!==[t.$.rowGroupsTree,t.$.summariesTree,t.$.pivotsTree].indexOf(l)){const e=l.querySelector("[focus]");e&&this._openDialog(e)}}else t._tabsClickHandler({target:l})}_getDefaultSummaryFunction(e){const t=this.ownerElement;return t&&t._getDefaultSummaryFunction?t._getDefaultSummaryFunction(e):"count"}_setAriaRelations(){const e=this,t=e.id;e.setAttribute("role","tablist"),e.$.columnsView.id=t+"ColumnsView",e.$.columnsTab.id=t+"columnsTab",e.$.columnsTab.setAttribute("aria-controls",e.$.columnsView.id),e.$.columnsView.setAttribute("aria-labelledby",e.$.columnsTab.id),e.$.filtersView.id=t+"FiltersView",e.$.filtersTab.id=t+"FiltersTab",e.$.filtersTab.setAttribute("aria-controls",e.$.filtersView.id),e.$.filtersView.setAttribute("aria-labelledby",e.$.filtersTab.id),e.$.rowGroupsLabel.id=t+"RowGroupsLabel",e.$.rowGroupsTree.setAttribute("aria-labelledby",e.$.rowGroupsLabel.id),e.$.summariesLabel.id=t+"SummariesLabel",e.$.summariesTree.setAttribute("aria-labelledby",e.$.summariesLabel.id),e.$.pivotsLabel.id=t+"PivotsLabel",e.$.pivotsTree.setAttribute("aria-labelledby",e.$.pivotsLabel.id)}});
|
|
102
102
|
Smart("smart-color-panel",class extends Smart.BaseElement{static get properties(){return{applyValueMode:{value:"instantly",allowedValues:["instantly","useButtons"],type:"string"},columnCount:{value:8,type:"number?"},displayMode:{value:"default",allowedValues:["default","grid","palette","radial","hexagonal","spectrumGrid","materialGrid"],type:"string"},disableUndo:{value:!1,type:"boolean"},editAlphaChannel:{value:!1,type:"boolean"},enableCustomColors:{value:!1,type:"boolean"},gridThemeColors:{value:null,type:"array?",reflectToAttribute:!1},gridShadeColors:{value:null,type:"array?",reflectToAttribute:!1},gridStandardColors:{value:null,type:"array?",reflectToAttribute:!1},hideAlphaEditor:{value:!1,type:"boolean"},hideContentToFit:{value:["RGB","HEX","alpha","previewContainer"],type:"array"},hideHEXEditor:{value:!1,type:"boolean"},hidePreviewContainer:{value:!1,type:"boolean"},hideRGBEditor:{value:!1,type:"boolean"},inverted:{value:!1,type:"boolean"},messages:{value:{en:{redPrefix:"R:",greenPrefix:"G:",bluePrefix:"B:",hexPrefix:"#:",alphaPrefix:"Alpha:",ok:"OK",cancel:"CANCEL",customColor:"CUSTOM COLOR",standardColors:"Standard colors",themeColors:"Theme colors"}},type:"object",extend:!0},name:{value:"",type:"string"},palette:{value:"default",allowedValues:["default","gray","red","green","blue","custom"],type:"string"},paletteColors:{value:null,type:"array?",reflectToAttribute:!1},paletteCustomColors:{value:null,type:"array?",reflectToAttribute:!1},tooltipDisplayMode:{value:"hex",allowedValues:["none","rgba","rgb","hex"],type:"string"},value:{value:null,type:"string?"},valueFormat:{value:"default",allowedValues:["rgb","rgba","hex","default"],type:"string"},valueMember:{value:"value",type:"string?"}}}static get listeners(){return{"container.click":"_containerClickHandler","container.mouseover":"_handleGridModeCellHover","paletteModeContainer.down":"_paletteDownHandler","container.change":"_handleInputChange","document.move":"_moveThumbHandler","document.up":"_releaseThumbUpHandler","paletteModeContainer.wheel":"_inputWheelHandler",resize:"_hideControlsByPriority","hexModeResizeTrigger.resize":"_resizeHoneycombItems","paletteModeContainer.move":"_paletteModeContainerMoveHandler"}}static get requires(){return{"Smart.Utilities.Draw":"smart.draw.js","Smart.Button":"smart.button.js","Smart.Tooltip":"smart.tooltip.js"}}static get styleUrls(){return["smart.button.css","smart.tooltip.css","smart.colorpanel.css"]}template(){return'<div id="container" role="presentation">\n <div id="gridModeContainer" class="grid-mode-container" role="presentation"></div>\n <div id="paletteModeContainer" class="palette-mode-container" role="presentation">\n <div id="colorPaletteContainer" class="color-palette-container" role="presentation">\n <div id="colorPalette" class="color-palette no-touch" aria-label="Color palette">\n <div id="colorPaletteThumb" class="color-palette-thumb" role="presentation"></div>\n </div>\n <div id="hueScale" class="hue-scale no-touch" aria-label="Hue scale" role="slider" aria-valuemin="0" aria-valuemax="360">\n <div id="hueScaleThumb" class="hue-scale-thumb" role="presentation"></div>\n </div>\n <div id="colorPaletteRadial" class="color-palette-radial no-touch" aria-label="Radial color palette">\n <span class="white-radial-gradient" role="presentation"></span>\n <div id="colorPaletteRadialThumb" class="color-palette-radial-thumb" role="presentation"></div>\n </div>\n <div id="colorPaletteHexagonal" class="color-palette-hexagonal" aria-label="Hexagonal color palette"></div>\n <div id="brightnessScale" class="brightness-scale no-touch" aria-label="Brightness scale" role="slider" aria-valuemin="0" aria-valuemax="1">\n <div id="brightnessScaleThumb" class="brightness-scale-thumb" role="presentation"></div>\n </div>\n <span id="hexModeResizeTrigger" class="color-sample hex-mode-resize-trigger"></span>\n <div id="colorControlsContainer" class="color-controls-container" role="presentation"></div>\n </div>\n <div id="alphaChannelContainer" class="alpha-channel-container"></div>\n </div>\n <div id="buttonsContainer" class="buttons-container"></div>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>'}propertyChangedHandler(e,a,t){const l=this;switch(e){case"applyValueMode":"instantly"!==t||l.value||(l._HSV={h:0,s:0,v:1},l._selectedItem&&l._selectedItem.classList.contains("selected")&&(l._selectedItem.classList.remove("selected"),l._selectedItem.removeAttribute("aria-current"),l._selectedItem.style.stroke=null)),"palette"!==l.displayMode&&"radial"!==l.displayMode&&"hexagonal"!==l.displayMode||l._handleCancelButtonClick(),"useButtons"===t&&l._createApplyValueButtons();break;case"paletteColors":l._customPalette=l._mapDataSourceToPalette(),r(l.displayMode);break;case"inverted":{if(-1===["hexagonal","radial","spectrumGrid"].indexOf(l.displayMode))return;const e=l.value,a=l.$.hueScaleThumb.offsetHeight,o=l._validateInRange(a/2,0,l.$.hueScale.offsetHeight-a)/l.$.brightnessScale.offsetHeight;if(isNaN(o))return void l._generateGridStructures();t?(l._HSV.v=l._HSV.s,l._HSV.s=1-o):(l._HSV.s=l._HSV.v,l._HSV.v=1-o),l.value=l._HSVtoRGBA(l._HSV),l.$.colorPaletteRadial.style.setProperty("--smart-color-panel-brightness",l.$.brightnessScaleThumb.s||0),r(l.displayMode),l.value!==e&&l.$.fireEvent("change",{oldValue:e,value:l.value});break}case"palette":r(l.displayMode),l._updatePreviewContainerValues(l.value);break;case"displayMode":case"gridThemeColors":case"gridShadeColors":case"gridStandardColors":if("displayMode"===e){const e=l.value;if(l.$.container.className.indexOf("custom-color-selection")>-1&&l._handleCancelButtonClick(),null!==l.value&&"palette"!==t&&"hexagonal"!==t&&"radial"!==t){!l.editAlphaChannel&&l.$.alphaChannelThumb&&(l.$.alphaChannelThumb.style[l.rightToLeft?"left":"right"]="",l.$.alphaChannelThumb.style[l.rightToLeft?"right":"left"]=0,l.$.alphaChannelThumb.a=l._RGBA.a=1,l.$.alphaChannelScale.setAttribute("aria-valuenow",1)),l.value=l._getValue(l.valueFormat),r(),l.$.fireEvent("change",{oldValue:e,value:l.value});break}if(null===l.value&&("palette"===t||"hexagonal"===t||"radial"===t)){l._RGBA={r:255,g:255,b:255,a:1},l._HSV={h:0,s:0,v:1},l.value=l._getValue(l.valueFormat),r(),l.$.fireEvent("change",{oldValue:e,value:l.value});break}if(l.value=l._getValue(l.valueFormat),Smart.Utilities.Core.Browser.Firefox&&"radial"===a){const e=l.$.colorPaletteRadial.querySelector("canvas");e&&e.remove()}}r(l.displayMode);break;case"locale":case"messages":l._localizeLabels();break;case"paletteCustomColors":l._userPalette=t||[],(l.displayMode.toLowerCase().indexOf("grid")>-1||"default"===l.displayMode)&&l._generatePaletteUserColorGrid(!0);break;case"editAlphaChannel":{if(!t&&(l._RGBA.a=1),t&&l._createAlphaChannel(),!l.value)return;const e=l.value;l.value=l._getValue(l.valueFormat),l.value!==e&&l.$.fireEvent("change",{oldValue:e,value:l.value});break}case"value":if(t="string"==typeof t?t.trim():t,!l._isValidColor(t))return void l._reset();l._applyValue(t),l.value=l._getValue(l.valueFormat),"hexagonal"===l.displayMode&&l._generateHoneycomb(l.columnCount,l.inverted?{s:l._HSV.s}:{v:l._HSV.v}),a!==l.value&&l.$.fireEvent("change",{oldValue:a,value:l.value});break;case"columnCount":{const e=l.$.container.style;null===t||isNaN(t)?e.removeProperty("--smart-color-panel-grid-mode-column-count"):e.setProperty("--smart-color-panel-grid-mode-column-count",t),l._generatePaletteUserColorGrid(),"spectrumGrid"===l.displayMode?l._generateSpectrumGrid(parseInt(t)):"hexagonal"===l.displayMode&&l._generateHoneycomb(t,l._HSV)}break;case"valueFormat":{if(!l.value)return;const e=l.value;l.value=l._getValue(t),l.$.fireEvent("change",{oldValue:e,value:l.value});break}case"tooltipDisplayMode":if(!l.$.tooltip)return;"none"===t?(l.$.tooltip.close(),l.$.tooltip.disabled=!0):l.$.tooltip.disabled=!1;break;default:if(super.propertyChangedHandler(e,a,t),"disabled"===e){const a=l.getElementsByClassName("color-input");for(let t=0;t<a.length;t++)a[t][e]}"disabled"!==e&&"theme"!==e&&"animation"!==e||(l.$.buttonOk&&(l.$.buttonOk[e]=t),l.$.buttonCancel&&(l.$.buttonCancel[e]=t),l.$.buttonCustom&&(l.$.buttonCustom[e]=t),l.$.tooltip&&(l.$.tooltip[e]=t))}function r(){l._generateGridStructures(),l._applyValue(l.value)}}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._initializeBaseVars(),null===e.columnCount||isNaN(e.columnCount)?e.$.container.style.removeProperty("--smart-color-panel-grid-mode-column-count"):e.$.container.style.setProperty("--smart-color-panel-grid-mode-column-count",e.columnCount),"useButtons"===e.applyValueMode&&e._createApplyValueButtons(),e.editAlphaChannel&&e._createAlphaChannel(),e._generateGridStructures(),e._localizeLabels(),e.value||"hexagonal"!==e.displayMode&&"radial"!==e.displayMode&&"palette"!==e.displayMode||(e.value=e._getValue(e.valueFormat)),e._applyValue(e.value),e._hideControlsByPriority(),e.enableShadowDOM&&e.appendChild(e.$.hiddenInput),super.render()}_createApplyValueButtons(e){const a=this;function t(e){let t=document.createElement("smart-button");return t.classList.add(e),t.classList.add("primary"),t.rightToLeft=a.rightToLeft,t.disabled=a.disabled,t.theme=a.theme,t.animation=a.animation,a.$.buttonsContainer.appendChild(t),t}(e||"useButtons"===a.applyValueMode)&&(a.$.buttonsContainer.innerHTML.trim()||(a.$.buttonOk=t("button-ok"),a.$.buttonCancel=t("button-cancel"),a.$.buttonOk.content=a.localize("ok"),a.$.buttonCancel.content=a.localize("cancel")))}_createAlphaChannel(){const e=this;!e.editAlphaChannel||e.editAlphaChannel&&e.$.alphaChannelContainer.innerHTML.trim()||(e.$.alphaChannelContainer.innerHTML=`\n <div class="alpha-channel-scale no-touch" aria-label="Alpha channel scale" role="slider">\n <div class="alpha-channel-thumb" aria-hidden="true"></div>\n </div>\n <label for="${e.id}aChannelInput" class="a-channel"></label>\n <input type="number" step="0.01" id="${e.id}aChannelInput" class="color-input a-channel" value="1" min="0" max="1">`,e.$.alphaChannelScale=e.$.alphaChannelContainer.querySelector(".alpha-channel-scale"),e.$.alphaChannelThumb=e.$.alphaChannelContainer.querySelector(".alpha-channel-thumb"),e.$.alphaChannelScale.setAttribute("role","slider"),e.$.alphaChannelScale.setAttribute("aria-valuemin",0),e.$.alphaChannelScale.setAttribute("aria-valuemin",1),e.$.alphaChannelContainer.querySelector("input").disabled=e.disabled,e._localizeLabels(),e._applyAlphaValue(e._RGBA.a,"alphaScale"))}_createGridModeComponents(){const e=this,a=e.id;if(["radial","palette","hexagonal"].indexOf(e.displayMode)>-1)return!1;if(e.$.gridModeContainer.innerHTML.trim())return;const t=e.$.gridModeContainer;t.innerHTML=`\n <div id="${a}defaultSamplesContainer" class="default-samples-container"></div>\n <div id="${a}gridSamplesContainer" class="grid-samples-container"></div>\n <div id="${a}materialGridSamplesContainer" class="material-grid-samples-container" role="menu"></div>\n <div id="${a}spectrumGridSamplesContainer" class="spectrum-grid-samples-container"></div>\n <smart-button id="${a}buttonCustom" class="button-custom-color primary"></smart-button>\n <div id="${a}userSamplesContainer" class="user-samples-container" aria-label="User colors"></div>\n <smart-tooltip id="${a}tooltip" arrow position="auto"></smart-tooltip>`,e.$.defaultSamplesContainer=t.querySelector(".default-samples-container"),e.$.gridSamplesContainer=t.querySelector(".grid-samples-container"),e.$.materialGridSamplesContainer=t.querySelector(".material-grid-samples-container"),e.$.materialGridSamplesContainer.$=Smart.Utilities.Extend(e.$.materialGridSamplesContainer),e.$.spectrumGridSamplesContainer=t.querySelector(".spectrum-grid-samples-container"),e.$.userSamplesContainer=t.querySelector(".user-samples-container"),e.$.buttonCustom=t.querySelector("smart-button"),e.$.tooltip=t.querySelector("smart-tooltip"),e.$.buttonCustom.disabled=e.disabled,e.$.buttonCustom.rightToLeft=e.rightToLeft,e.$.buttonCustom.animation=e.animation,e.$.buttonCustom.theme=e.theme,e.$.buttonCustom.content=e.localize("customColor"),e.$.tooltip.disabled=e.disabled||"none"===e.tooltipDisplayMode,e.$.tooltip.rightToLeft=e.rightToLeft,e.$.tooltip.animation=e.animation,e.$.tooltip.theme=e.theme}_createColorControls(e){const a=this,t=a.id;if(!e&&["radial","palette","hexagonal"].indexOf(a.displayMode)<0)return!1;const l=a.$.colorControlsContainer;if(l.innerHTML.trim())return;l.innerHTML=`<div id="${t}previewContainer" class="preview-container gradient-background" aria-label="Preview"><span class="preview-container-top" aria-label="Current color"></span><span class="preview-container-bottom" aria-label="New color"></span></div><label for="${t}rChannelInput" id="${t}rChannelLabel" class="r-channel"></label><input type="number" min="0" max="255" id="${t}rChannelInput" class="color-input r-channel" value="255"><label for="${t}gChannelInput" id="${t}gChannelLabel" class="g-channel"></label><input type="number" min="0" max="255" id="${t}gChannelInput" class="color-input g-channel" value="255"><label for="${t}bChannelInput" id="${t}bChannelLabel" class="b-channel"></label><input type="number" min="0" max="255" id="${t}bChannelInput" class="color-input b-channel" value="255"><label for="${t}hexInput" id="${t}hexLabel" class="hex"></label><input type="text" id="${t}hexInput" class="color-input hex" value="FFFFFF" maxlength="6">`;const r=l.getElementsByClassName("color-input");for(let e=0;e<r.length;e++)r[e].disabled=a.disabled;a._localizeLabels()}_containerClickHandler(e){const a=this;if(a.disabled||a.readonly||!e.target)return;if(e.target.classList.contains("color-sample"))return void a._handleSampleClick(e);const t=e.target.closest("smart-button");if(t!==a.$.buttonCancel)return t===a.$.buttonCustom?(a.$container.addClass("custom-color-selection"),a._createApplyValueButtons(!0),a._createColorControls(!0),a._applyValueInPaletteMode(),a._customColorSelection=!0,1===a._RGBA.a&&a.$.alphaChannelThumb&&(a.$.alphaChannelThumb.style[a.rightToLeft?"left":"right"]="",a.$.alphaChannelThumb.style[a.rightToLeft?"right":"left"]=0,a.$.alphaChannelThumb.a=a._RGBA.a,a.$.alphaChannelScale.setAttribute("aria-valuenow",a._RGBA.a)),void a.$.fireEvent("customColorSelection",{value:!0})):void(t!==a.$.buttonOk?e.target!==(a.shadowRoot||a).querySelector(".preview-container-top")||"useButtons"!==a.applyValueMode||a.disableUndo||a._applyValue(a.value):a._handleOkButtonClick(!0));a._handleCancelButtonClick(!0)}_reset(e=this.value){const a=this;a._RGBA={r:255,g:255,b:255,a:1},a._HSV={h:0,s:0,v:1},a.$.hueScaleThumb.h=0,a.$.colorPaletteThumb.s=0,a.$.colorPaletteThumb.v=1,a.$.colorPaletteRadialThumb.h=0,a.$.colorPaletteRadialThumb.s=0,a.$.brightnessScaleThumb.v=1,a.$.brightnessScaleThumb.s=0,"hexagonal"!==a.displayMode&&"radial"!==a.displayMode&&"palette"!==a.displayMode?(a.value=null,a._selectedItem&&a._selectedItem.classList.contains("selected")&&(a._selectedItem.classList.remove("selected"),a._selectedItem.removeAttribute("aria-current"),a._selectedItem.style.stroke=null)):a.value=a._getValue(a.valueFormat),a._applyValue(a.value),a.$.fireEvent("change",{oldValue:e,value:a.value})}_handleColorPaletteDown(e){const a=this,t=a._getXYcoordinates(e);if(!t)return;const l="palette"===a.displayMode||"grid"===a.displayMode?a.$.colorPaletteThumb:a.$.colorPaletteRadialThumb;if(a._activeComponent=t.container,"palette"===a.displayMode||a.$.container.className.indexOf("custom-color-selection")>-1){if(l.s=a._HSV.s=t.x/t.container.offsetWidth,l.v=a._HSV.v=1-t.y/t.container.offsetHeight,"grid"===a.displayMode)return a._moveThumbHandler(e,!0),void a._applyValueInPaletteMode(e)}else if("radial"===a.displayMode){const e=a.$.colorPaletteRadial.offsetWidth,r=t.x-e/2,o=t.y-e/2;l.h=a._HSV.h=a._calcHueAngle(r,o)<0?360+a._calcHueAngle(r,o):a._calcHueAngle(r,o);const n=a.$.brightnessScaleThumb,s=a.$.brightnessScale,i=a._validateInRange(2*a._calcSatDistance(r,o)/e,0,1),d=s.offsetHeight-n.offsetHeight,c=a._validateInRange(n.offsetTop,0,d)/d;a.inverted?(l.v=a._HSV.v=i,l.s=a._HSV.s=1-c):(l.s=a._HSV.s=i,l.v=a._HSV.v=1-c)}a._applyValue(a._HSVtoRGBA(a._HSV),e),a._instantUpdate()}_handleScalesDown(e){const a=this,t=a._getXYcoordinates(e);t&&(a._activeComponent=t.container,t.container===a.$.hueScale?a._updateHueScale(t):t.container===a.$.brightnessScale?(a._updateBrightnessScale(t),"hexagonal"===a.displayMode&&a._generateHoneycomb(a.columnCount,a._HSV)):a.$.alphaChannelScale&&(a.$.alphaChannelThumb.a=a._RGBA.a=parseFloat(((t.container.offsetWidth-t.x)/t.container.offsetWidth).toFixed(2)),a.rightToLeft&&(a.$.alphaChannelThumb.a=a._RGBA.a=(1-a._RGBA.a).toFixed(2)),a._applyAlphaValue(a._RGBA.a,"alphaScale")),a._applyValue(a._HSVtoRGBA(a._HSV),e),a._instantUpdate())}_updateBrightnessScale(e){const a=this,t=e.y-a.$.brightnessScaleThumb.offsetHeight/2,l=a.$.brightnessScale.offsetHeight-a.$.brightnessScaleThumb.offsetHeight,r=Math.min(Math.max(parseFloat(t),0),parseFloat(l))/l;a.inverted?a.$.brightnessScaleThumb.s=a._HSV.s=1-r:a.$.brightnessScaleThumb.v=a._HSV.v=1-r,a.$.brightnessScale.setAttribute("aria-valuenow",a._HSV.v),a.$.brightnessScaleThumb.style.top=l*r+"px",a.$.colorPaletteRadial.style.setProperty("--smart-color-panel-brightness",r)}_updateHueScale(e){const a=this,t=e.y-a.$.hueScaleThumb.offsetHeight/2,l=a.$.hueScale.offsetHeight,r=l-a.$.hueScaleThumb.offsetHeight;a.$.hueScaleThumb.h=a._HSV.h=360*(l-e.y)/l,a.$.hueScale.setAttribute("aria-valuenow",a.$.hueScaleThumb.h),a.$.hueScaleThumb.style.top=r*Math.min(Math.max(parseFloat(t),0),parseFloat(r))/r+"px"}_paletteModeContainerMoveHandler(e){Smart.Utilities.Core.isMobile||e.stopPropagation(),"touchmove"===e.originalEvent.type&&this._dragDetails&&e.originalEvent.preventDefault()}_moveThumbHandler(e,a){const t=this,l=e.pageX-window.pageXOffset,r=e.pageY-window.pageYOffset;if(t.disabled||t.readonly||!t._activeComponent||!t._dragDetails||t._dragDetails.x===l&&t._dragDetails.y===r&&!a)return;const o=t._getXYcoordinates(e);if(!o)return;const n=t._activeComponent.offsetWidth,s=t._activeComponent.offsetHeight;switch(t._activeComponent){case t.$.colorPalette:t.$.colorPaletteThumb.style.left=100*o.x/n+"%",t.$.colorPaletteThumb.style.top=100*o.y/s+"%",t.$.colorPaletteThumb.s=t._HSV.s=o.x/n,t.$.colorPaletteThumb.v=t._HSV.v=1-o.y/s;break;case t.$.colorPaletteRadial:{const e=n,a=o.x-e/2,l=o.y-e/2;t.$.colorPaletteRadialThumb.h=t._HSV.h=t._calcHueAngle(a,l)<0?360+t._calcHueAngle(a,l):t._calcHueAngle(a,l),t.inverted?t.$.colorPaletteRadialThumb.v=t._HSV.v=t._validateInRange(2*t._calcSatDistance(a,l)/e,0,1):t.$.colorPaletteRadialThumb.s=t._HSV.s=t._validateInRange(2*t._calcSatDistance(a,l)/e,0,1);const r=(t.shadowRoot||t).querySelector(".preview-container-bottom");r&&(r.style.backgroundColor=t._HSVtoRGBA());break}case t.$.hueScale:t._updateHueScale(o);break;case t.$.brightnessScale:t._updateBrightnessScale(o),"hexagonal"===t.displayMode&&t._generateHoneycomb(t.columnCount,t.inverted?{s:t._HSV.s}:{v:t._HSV.v});break;case t.$.alphaChannelScale:t.$.alphaChannelThumb.a=t._RGBA.a=parseFloat(((n-o.x)/n).toFixed(2)),t.rightToLeft&&(t.$.alphaChannelThumb.a=t._RGBA.a=(1-t._RGBA.a).toFixed(2))}t._applyValue(t._HSVtoRGBA(t._HSV),e),t._instantUpdate()}_releaseThumbUpHandler(){const e=this,a=!!e._activeComponent;e._activeComponent=null,e.disabled||e.readonly||!a||e._dragDetails&&e._dragDetails.isPalettePressed||e._instantUpdate()}_handleCancelButtonClick(e){const a=this,t=a.value;switch("palette"!==a.displayMode&&"radial"!==a.displayMode&&"hexagonal"!==a.displayMode?(a.value=t,a._HSV=a._getValue("hsv",a.value)||{h:1,s:0,v:1},a._RGBA=a._getValue("HSVtoRGBAarray",a.value)):(a._HSV=a._getValue("hsv",a.value)||{h:1,s:0,v:1},a._RGBA=a._getValue("HSVtoRGBAarray",a.value),a.value=a._getValue(a.valueFormat)),a._applyValue(a.value),a.displayMode){case"radial":a._generateRadialCanvas();break;case"hexagonal":a._generateHoneycomb(a.columnCount,a._HSV)}if(null===a.value&&a._selectedItem&&a._selectedItem.classList.contains("selected")&&(a._selectedItem.classList.remove("selected"),a._selectedItem.removeAttribute("aria-current")),t!==a.value&&a.$.fireEvent("change",{oldValue:t,value:a.value}),a.$.container.className.indexOf("custom-color-selection")>-1&&a._applyValueInPaletteMode(),e&&a.$.fireEvent("cancelButtonClick"),!1===a._customColorSelection){a._updatePreviewContainerValues(a.value);let e=("hexagonal"===a.displayMode?a.$.colorPaletteHexagonal:a.$.gridModeContainer).getElementsByClassName("selected");for(let t=0;t<e.length;t++)!e[t]||a.value&&a._equalValues(e[t].colorCode,a.value)||(e[t].style.stroke=null,e[t].classList.remove("selected"),e[t].removeAttribute("aria-current"))}else a.$container.removeClass("custom-color-selection"),a.$.fireEvent("customColorSelection",{value:!1});if(a._customColorSelection=!1,a._customTempColor=void 0,"palette"===a.displayMode||"radial"===a.displayMode){const e=(a.shadowRoot||a).querySelector(".preview-container-top");e&&(e.style.backgroundColor=a.value)}}_handleOkButtonClick(e){const a=this,t=a.value;if(!1!==a._customColorSelection&&void 0!==a._customColorSelection){const l=a._getValue(a.valueFormat);return"useButtons"!==a.applyValueMode&&(a.value=l),a._userPalette.unshift(l),a._generatePaletteUserColorGrid(),a._customColorSelection=!1,t!==a.value&&a.$.fireEvent("change",{oldValue:t,value:a.value}),e&&a.$.fireEvent("okButtonClick",{}),void a.$container.removeClass("custom-color-selection")}if(a._customTempColor&&(a._userPalette.unshift(a._customTempColor),a._generatePaletteUserColorGrid(),a._generateNewPalette=!1,a._customTempColor=""),"palette"===a.displayMode||"radial"===a.displayMode||"hexagonal"===a.displayMode||a._selectedItem&&a._selectedItem.classList.contains("selected")?a.value=a._getValue(a.valueFormat):a.value=null,null===a.value)if("palette"===a.displayMode)a._applyValue(a._HSVtoRGBA(a._HSV),event);else{let e=a.$.gridModeContainer.getElementsByClassName("selected");for(let a=0;a<e.length;a++)e[a]&&(e[a].classList.remove("selected"),e[a].removeAttribute("aria-current"))}t!==a.value&&a.$.fireEvent("change",{oldValue:t,value:a.value}),e&&a.$.fireEvent("okButtonClick",{}),a._customColorSelection=!1,"useButtons"!==a.applyValueMode||a._equalValues(a.value,a._HSVtoRGBA())||a._updatePreviewContainerValues(a._getValue("rgba"),!0)}_handleInputChange(e){const a=this,t=a.value,l=e.target;if(a.disabled||a.readonly)return;e.preventDefault(),e.stopPropagation();const r=["r-channel","g-channel","b-channel"].find((e=>l.className.indexOf(e)>-1)),o=l.classList.contains("a-channel");if(r||o)l.value=r?Math.min(255,Math.max(0,l.value)):Math.min(1,Math.max(0,parseFloat(l.value)||0)),a._RGBA=a._getRGBAFromInputs(),a._HSV=a._getValue("hsv","rgba("+a._RGBA.r+", "+a._RGBA.g+", "+a._RGBA.b+", "+a._RGBA.a+")");else if(l.classList.contains("hex")){const e=a.value?a._getValue("hex"):null,t="#"+l.value;a._isHEX(t)?(a._RGBA.a=1,a._applyValue(a.editAlphaChannel?a._toRGBA(t):a._toHEX(t))):l.value=e?e.substring(1):"ffffff"}a._applyValue(a.editAlphaChannel?a._getValue("rgba"):a._getValue("hex")),"useButtons"===a.applyValueMode||a.$.container.className.indexOf("custom-color-selection")>-1||(a.value=a._getValue(a.valueFormat),a.$.fireEvent("change",{oldValue:t,value:a.value}))}_applyValue(e,a){const t=this;if(!e||null===e||"rgba(NaN, NaN, NaN, 1)"===e)return t._RGBA={r:255,g:255,b:255,a:1},void(t.$.hiddenInput.value=t.value);t._HSVRGBArefresh(e.trim()),"palette"===t.displayMode||t.$.container.className.indexOf("custom-color-selection")>-1?t._applyValueInPaletteMode(a):"radial"===t.displayMode?t._applyValueInRadialMode(a):"hexagonal"===t.displayMode?t._applyValueInHexagonalMode(a):t._applyValueInAnyGridMode(e.trim()),t._applyAlphaValue(t._RGBA.a),t.$.hiddenInput.value=t.value}_applyAlphaValue(e,a){const t=this;if(e=parseFloat(e),t.$.alphaChannelScale){if("alphaScale"!==a){const a=t.$.alphaChannelThumb.offsetWidth,l=t.$.alphaChannelScale.offsetWidth,r=(1-e)*l>a?(1-e)*a:0;t.$.alphaChannelThumb.style[t.rightToLeft?"left":"right"]="",t.$.alphaChannelThumb.style[t.rightToLeft?"right":"left"]=(1-e)*l-r+"px"}"alphaInput"!==a&&(t.$.alphaChannelContainer.querySelector("input.a-channel").value=e),t.$.alphaChannelScale.setAttribute("aria-valuenow",e)}t._RGBA.a=e,t._updatePreviewContainerValues(t._getValue("rgba"))}_applyValueInPaletteMode(e){const a=this,t=a._getValue("hex"),l=a.$.hueScale.offsetHeight,r=a.$.hueScaleThumb.offsetHeight,o=a._HSV.h?l*((360-a._HSV.h)/360):0,n=(a.shadowRoot||a).querySelector("input.hex");if(a._setRGBAToInputs(),n&&(n.value=t.substring(1)),a.$.alphaChannelContainer.style.setProperty("--smart-color-panel-alpha-channel-color",a._rgbArrayToHEX([a._RGBA.r,a._RGBA.g,a._RGBA.b,1])),!a._activeComponent){if(a.$.alphaChannelThumb){const e=a.$.alphaChannelThumb.offsetWidth,t=a.$.alphaChannelScale.offsetWidth,l=(1-a._RGBA.a)*t>e?(1-a._RGBA.a)*e:0;a.$.alphaChannelThumb.style[a.rightToLeft?"left":"right"]="",a.$.alphaChannelThumb.style[a.rightToLeft?"right":"left"]=(1-a._RGBA.a)*t-l+"px",a.$.alphaChannelScale.setAttribute("aria-valuenow",a._RGBA.a)}a.$.hueScaleThumb.style.top=Math.max(0,Math.min(l-r,o-r/2))+"px",a._setPalettePointerXYPosition()}a._activeComponent===a.$.hueScale&&(a.$.colorPalette.style.backgroundColor=a._rgbaToRGB(a._HSVtoRGBA({h:a.$.hueScaleThumb.h,s:1,v:1}))),a._activeComponent&&a._activeComponent!==a.$.colorPalette||a._setPalettePointerXYPosition(e),a.event?a._HSV.h=a.$.hueScaleThumb.h:(a.$.hueScaleThumb.h=a._HSV.h,a.$.colorPalette.style.backgroundColor=a._rgbaToRGB(a._HSVtoRGBA({h:a._HSV.h,s:1,v:1}))),a._updatePreviewContainerValues(a._getValue("rgba")),a.$.hueScale.setAttribute("aria-valuenow",a.$.hueScaleThumb.h)}_applyValueInRadialMode(e){const a=this,t=a._getValue("hex"),l=(a.shadowRoot||a).querySelector("input.hex");if(a._setRGBAToInputs(),l&&(l.value=t.substring(1)),a.$.alphaChannelContainer.style.setProperty("--smart-color-panel-alpha-channel-color",a._rgbArrayToHEX([a._RGBA.r,a._RGBA.g,a._RGBA.b,1])),!a._activeComponent){const e=a.$.brightnessScale.offsetHeight-a.$.brightnessScaleThumb.offsetHeight;if(a.$.alphaChannelThumb){const e=a.$.alphaChannelThumb.offsetWidth,t=a.$.alphaChannelScale.offsetWidth,l=(1-a._RGBA.a)*t>e?(1-a._RGBA.a)*e:0;a.$.alphaChannelThumb.style[a.rightToLeft?"left":"right"]="",a.$.alphaChannelThumb.style[a.rightToLeft?"right":"left"]=(1-a._RGBA.a)*t-l+"px",a.$.alphaChannelScale.setAttribute("aria-valuenow",a._RGBA.a)}const t=a.inverted?a._HSV.v:1-a._HSV.v;a.$.brightnessScale.setAttribute("aria-valuenow",a._HSV.v),a.$.brightnessScaleThumb.style.top=e*t+"px",a.$.colorPaletteRadial.style.setProperty("--smart-color-panel-brightness",t)}if(a._activeComponent&&a._activeComponent!==a.$.colorPaletteRadial||a._setPalettePointerXYPosition(e),a._updatePreviewContainerValues(a._getValue("rgba")),a.inverted){const e=null===a.value?"black":a._HSVtoRGBA({h:a._HSV.h,s:1,v:a._HSV.v});a.$.brightnessScale.style.backgroundImage="linear-gradient("+e+", white)"}else{const e=null===a.value?"white":a._HSVtoRGBA({h:a._HSV.h,s:a._HSV.s,v:1});a.$.brightnessScale.style.backgroundImage="linear-gradient("+e+", black)"}}_applyValueInHexagonalMode(){const e=this,a=e._getValue("hex"),t=(e.shadowRoot||e).querySelector("input.hex");if(e._setRGBAToInputs(),t&&(t.value=a?a.substring(1):null),e.$.alphaChannelContainer.style.setProperty("--smart-color-panel-alpha-channel-color",e._rgbArrayToHEX([e._RGBA.r,e._RGBA.g,e._RGBA.b,1])),!e._activeComponent&&!e._targetItem){const a=e.$.brightnessScale.offsetHeight-e.$.brightnessScaleThumb.offsetHeight;if(e.$.alphaChannelThumb){const a=e.$.alphaChannelThumb.offsetWidth,t=e.$.alphaChannelScale.offsetWidth,l=(1-e._RGBA.a)*t>a?(1-e._RGBA.a)*a:0;e.$.alphaChannelThumb.style[e.rightToLeft?"left":"right"]="",e.$.alphaChannelThumb.style[e.rightToLeft?"right":"left"]=(1-e._RGBA.a)*t-l+"px",e.$.alphaChannelScale.setAttribute("aria-valuenow",e._RGBA.a)}const t=e.inverted?e._HSV.v:1-e._HSV.v;e.$.brightnessScale.setAttribute("aria-valuenow",e._HSV.v),e.$.brightnessScaleThumb.style.top=a*t+"px"}const l=e._getValue("rgba");if(e._updatePreviewContainerValues(l||e._getValue("hex")),e.inverted){const a=e._HSVtoRGBA({h:e._HSV.h,s:1,v:e._HSV.v},1);e.$.brightnessScale.style.backgroundImage="linear-gradient("+a+", white)"}else{const a=e._HSVtoRGBA({h:e._HSV.h,s:e._HSV.s,v:1},1);e.$.brightnessScale.style.backgroundImage="linear-gradient("+a+", black)"}e._applyValueInAnyGridMode(a,e.$.colorPaletteHexagonal)}_radialThumbPoint(e,a,t,l){return{x:Math.round(Math.cos(t*Math.PI/180)*l*e+e),y:Math.round(Math.sin(t*Math.PI/180)*l*e+a)}}_updatePreviewContainerValues(e,a){const t=this,l=(t.shadowRoot||t).querySelector(".preview-container");l&&(("instantly"===t.applyValueMode||a)&&(l.firstElementChild.style.backgroundColor=e),l.lastElementChild.style.backgroundColor=e)}_applyValueInAnyGridMode(e,a){const t=this;if(!e&&null!==e)return;if(!a)switch(t.displayMode){case"default":a=t.$.defaultSamplesContainer;break;case"grid":a=t.$.gridSamplesContainer;break;case"materialGrid":a=t.$.materialGridSamplesContainer;break;case"spectrumGrid":a=t.$.spectrumGridSamplesContainer;break;default:a=t.$.gridModeContainer}if(!a)return;const l=Array.from(a.getElementsByClassName("color-sample"));let r=t._targetItem;if(null==r)for(let a=0;a<l.length;a++){const o=l[a];if(t._equalValues(o.colorCode,e)){r=l[a];break}}t.$.container.className.indexOf("custom-color-selection")>-1&&t._HSV.h&&t._applyValueInPaletteMode(),t._changeSampleSelection(r)}_generatePaletteGrid(){const e=this;if(!e.$.gridSamplesContainer)return;const a=e["_"+e.palette+"Palette"];let t=document.createDocumentFragment();for(let l=0;l<a.length;l++){const r=document.createElement("span"),o=a[l];r.setAttribute("role","menuitem"),r.setAttribute("aria-label",o),r.className="color-sample",r.colorCode=o,r.style.backgroundColor=o,"rgba(255, 255, 255, 0)"===e._toRGBA(o)||"#FFFFFF00"===e._toHEX(e._toRGBA(o))||"transparent"===o?r.setAttribute("transparent",""):r.removeAttribute("transparent"),t.appendChild(r)}e.$.gridSamplesContainer.setAttribute("role","menu"),e.$.gridSamplesContainer.innerHTML="",e.$.gridSamplesContainer.appendChild(t)}_generatePaletteUserColorGrid(e){const a=this;if(!a.$.userSamplesContainer)return;if(!a._userPalette||!a._userPalette.length)return void(a.$.userSamplesContainer.innerHTML="");let t,l=a._userPalette.filter((e=>""!==e)).slice(0,a.columnCount||1),r=document.createDocumentFragment();l=[...new Set(l)];for(let e=0;e<l.length;e++)if(l[e]){const o=a._createColorSample(l[e],"user-color");r.appendChild(o),t||(t=o)}a.$.userSamplesContainer.innerHTML="",a.$.userSamplesContainer.appendChild(r),a.$.userSamplesContainer.setAttribute("role","menu"),!e&&t&&t.colorCode&&a._changeSampleSelection(t),a.paletteCustomColors=a._userPalette.slice(0)}_initializeBaseVars(){const e=this;void 0===e._RGBA&&(e._RGBA={r:255,g:255,b:255,a:1},e._HSV={h:0,s:0,v:1},e.$.hueScaleThumb.h=0,e.$.colorPaletteThumb.s=0,e.$.colorPaletteThumb.v=1,e.$.colorPaletteRadialThumb.h=0,e.$.colorPaletteRadialThumb.s=0,e._defaultPalette=["rgba(255, 255, 255, 0)","rgb(0, 0, 0)","rgb(153, 51, 0)","rgb(51, 51, 0)","rgb(0, 51, 0)","rgb(0, 51, 102)","rgb(0, 0, 128)","rgb(51, 51, 153)","rgb(51, 51, 51)","rgb(128, 0, 0)","rgb(255, 102, 0)","rgb(128, 128, 0)","rgb(0, 128, 0)","rgb(0, 128, 128)","rgb(0, 0, 255)","rgb(102, 102, 153)","rgb(128, 128, 128)","rgb(255, 0, 0)","rgb(255, 153, 0)","rgb(153, 204, 0)","rgb(51, 153, 102)","rgb(51, 204, 204)","rgb(51, 102, 255)","rgb(128, 0, 128)","rgb(153, 153, 153)","rgb(255, 0, 255)","rgb(255, 204, 0)","rgb(255, 255, 0)","rgb(0, 255, 0)","rgb(0, 255, 255)","rgb(0, 204, 255)","rgb(153, 51, 102)","rgb(192, 192, 192)","rgb(255, 153, 204)","rgb(255, 204, 153)","rgb(255, 255, 153)","rgb(204, 255, 204)","rgb(204, 255, 255)","rgb(153, 204, 255)","rgb(204, 153, 255)","rgb(255, 255, 255)"],e._grayPalette=e._generateShades(40,"gray"),e._redPalette=e._generateShades(40,"red"),e._greenPalette=e._generateShades(40,"green"),e._bluePalette=e._generateShades(40,"blue"),e._customPalette=e._mapDataSourceToPalette(),e._userPalette=e.paletteCustomColors||[],e._colorPalette={},e._cssColorNamesHEX={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},e._defaultModeThemeColors=null===e.gridThemeColors?["#FFFFFF","#000000","#E6E6E6","#495469","#5671C2","#D48439","#A5A5A5","#EEC328","#7399D3","#85AA4C"]:e.gridThemeColors,e._defaultModeStandardColors=null===e.gridStandardColors?["#A52A0D","#DB3A15","#EEC328","#FEFE33","#A6CD57","#62AC54","#65ADEE","#3F6FBE","#10205F","#64379E"]:e.gridStandardColors,e._defaultModeShadesColors=null===e.gridShadeColors?["#F2F2F2","#808080","#D0CECE","#D6DCE4","#DDEBF7","#FCE4D6","#EBEBEB","#FFF2CC","#DDE5F7","#E2EFDA","#D8D8D8","#595959","#AEAAAA","#ACB9CA","#BDD7EE","#F6CAAD","#DBDBDB","#FFE699","#B4C6E7","#C6E0B4","#BFBFBF","#404040","#757171","#8497B0","#9BC2E6","#F4B084","#C0C0C0","#FFD966","#8EA9DB","#A9D08E","#A6A6A6","#262626","#312F2F","#333F4F","#2F75B5","#C65911","#7B7B7B","#BF8F00","#305496","#548235","#808080","#0D0D0D","#161616","#222B35","#1F4E78","#833C0C","#525252","#806000","#203764","#375623"]:e.gridShadeColors,e._materialColors={Red:{50:"rgb(255, 235, 238)",100:"rgb(255, 205, 210)",200:"rgb(239, 154, 154)",300:"rgb(229, 115, 115)",400:"rgb(239, 83, 80)",500:"rgb(244, 67, 54)",600:"rgb(229, 57, 53)",700:"rgb(211, 47, 47)",800:"rgb(198, 40, 40)",900:"rgb(183, 28, 28)","A 100":"rgb(255, 138, 128)","A 200":"rgb(255, 82, 82)","A 400":"rgb(255, 23, 68)","A 700":"rgb(213, 0, 0)"},Pink:{50:"rgb(252, 228, 236)",100:"rgb(248, 187, 208)",200:"rgb(244, 143, 177)",300:"rgb(240, 98, 146)",400:"rgb(236, 64, 122)",500:"rgb(233, 30, 99)",600:"rgb(216, 27, 96)",700:"rgb(194, 24, 91)",800:"rgb(173, 20, 87)",900:"rgb(136, 14, 79)","A 100":"rgb(255, 128, 171)","A 200":"rgb(255, 64, 129)","A 400":"rgb(245, 0, 87)","A 700":"rgb(197, 17, 98)"},Purple:{50:"rgb(243, 229, 245)",100:"rgb(225, 190, 231)",200:"rgb(206, 147, 216)",300:"rgb(186, 104, 200)",400:"rgb(171, 71, 188)",500:"rgb(156, 39, 176)",600:"rgb(142, 36, 170)",700:"rgb(123, 31, 162)",800:"rgb(106, 27, 154)",900:"rgb(74, 20, 140)","A 100":"rgb(234, 128, 252)","A 200":"rgb(224, 64, 251)","A 400":"rgb(213, 0, 249)","A 700":"rgb(170, 0, 255)"},"Deep Purple":{50:"rgb(237, 231, 246)",100:"rgb(209, 196, 233)",200:"rgb(179, 157, 219)",300:"rgb(149, 117, 205)",400:"rgb(126, 87, 194)",500:"rgb(103, 58, 183)",600:"rgb(94, 53, 177)",700:"rgb(81, 45, 168)",800:"rgb(69, 39, 160)",900:"rgb(49, 27, 146)","A 100":"rgb(179, 136, 255)","A 200":"rgb(124, 77, 255)","A 400":"rgb(101, 31, 255)","A 700":"rgb(98, 0, 234)"},Indigo:{50:"rgb(232, 234, 246)",100:"rgb(197, 202, 233)",200:"rgb(159, 168, 218)",300:"rgb(121, 134, 203)",400:"rgb(92, 107, 192)",500:"rgb(63, 81, 181)",600:"rgb(57, 73, 171)",700:"rgb(48, 63, 159)",800:"rgb(40, 53, 147)",900:"rgb(26, 35, 126)","A 100":"rgb(140, 158, 255)","A 200":"rgb(83, 109, 254)","A 400":"rgb(61, 90, 254)","A 700":"rgb(48, 79, 254)"},Blue:{50:"rgb(227, 242, 253)",100:"rgb(187, 222, 251)",200:"rgb(144, 202, 249)",300:"rgb(100, 181, 246)",400:"rgb(66, 165, 245)",500:"rgb(33, 150, 243)",600:"rgb(30, 136, 229)",700:"rgb(25, 118, 210)",800:"rgb(21, 101, 192)",900:"rgb(13, 71, 161)","A 100":"rgb(130, 177, 255)","A 200":"rgb(68, 138, 255)","A 400":"rgb(41, 121, 255)","A 700":"rgb(41, 98, 255)"},"Light Blue":{50:"rgb(225, 245, 254)",100:"rgb(179, 229, 252)",200:"rgb(129, 212, 250)",300:"rgb(79, 195, 247)",400:"rgb(41, 182, 246)",500:"rgb(3, 169, 244)",600:"rgb(3, 155, 229)",700:"rgb(2, 136, 209)",800:"rgb(2, 119, 189)",900:"rgb(1, 87, 155)","A 100":"rgb(128, 216, 255)","A 200":"rgb(64, 196, 255)","A 400":"rgb(0, 176, 255)","A 700":"rgb(0, 145, 234)"},Cyan:{50:"rgb(224, 247, 250)",100:"rgb(178, 235, 242)",200:"rgb(128, 222, 234)",300:"rgb(77, 208, 225)",400:"rgb(38, 198, 218)",500:"rgb(0, 188, 212)",600:"rgb(0, 172, 193)",700:"rgb(0, 151, 167)",800:"rgb(0, 131, 143)",900:"rgb(0, 96, 100)","A 100":"rgb(132, 255, 255)","A 200":"rgb(24, 255, 255)","A 400":"rgb(0, 229, 255)","A 700":"rgb(0, 184, 212)"},Teal:{50:"rgb(224, 242, 241)",100:"rgb(178, 223, 219)",200:"rgb(128, 203, 196)",300:"rgb(77, 182, 172)",400:"rgb(38, 166, 154)",500:"rgb(0, 150, 136)",600:"rgb(0, 137, 123)",700:"rgb(0, 121, 107)",800:"rgb(0, 105, 92)",900:"rgb(0, 77, 64)","A 100":"rgb(167, 255, 235)","A 200":"rgb(100, 255, 218)","A 400":"rgb(29, 233, 182)","A 700":"rgb(0, 191, 165)"},Green:{50:"rgb(232, 245, 233)",100:"rgb(200, 230, 201)",200:"rgb(165, 214, 167)",300:"rgb(129, 199, 132)",400:"rgb(102, 187, 106)",500:"rgb(76, 175, 80)",600:"rgb(67, 160, 71)",700:"rgb(56, 142, 60)",800:"rgb(46, 125, 50)",900:"rgb(27, 94, 32)","A 100":"rgb(185, 246, 202)","A 200":"rgb(105, 240, 174)","A 400":"rgb(0, 230, 118)","A 700":"rgb(0, 200, 83)"},"Light Green":{50:"rgb(241, 248, 233)",100:"rgb(220, 237, 200)",200:"rgb(197, 225, 165)",300:"rgb(174, 213, 129)",400:"rgb(156, 204, 101)",500:"rgb(139, 195, 74)",600:"rgb(124, 179, 66)",700:"rgb(104, 159, 56)",800:"rgb(85,139,47)",900:"rgb(51,105,30)","A 100":"rgb(204,255,144)","A 200":"rgb(178,255,89)","A 400":"rgb(118,255,3)","A 700":"rgb(100, 221, 23)"},Lime:{50:"rgb(249, 251, 231)",100:"rgb(255, 249, 196)",200:"rgb(255, 245, 157)",300:"rgb(255, 241, 118)",400:"rgb(255, 238, 88)",500:"rgb(255, 235, 59)",600:"rgb(253, 216, 53)",700:"rgb(251, 192, 45)",800:"rgb(249, 168, 37)",900:"rgb(245, 127, 23)","A 100":"rgb(244, 255, 129)","A 200":"rgb(238, 255, 65)","A 400":"rgb(198, 255, 0)","A 700":"rgb(174, 234, 0)"},Yellow:{50:"rgb(255, 253, 231)",100:"rgb(255, 249, 196)",200:"rgb(255, 245, 157)",300:"rgb(255, 241, 118)",400:"rgb(255, 238, 88)",500:"rgb(255, 235, 59)",600:"rgb(253, 216, 53)",700:"rgb(251, 192, 45)",800:"rgb(249, 168, 37)",900:"rgb(245, 127, 23)","A 100":"rgb(255, 255, 141)","A 200":"rgb(255, 255, 0)","A 400":"rgb(255, 234, 0)","A 700":"rgb(255, 214, 0)"},Amber:{50:"rgb(255, 248, 225)",100:"rgb(255, 236, 179)",200:"rgb(255, 224, 130)",300:"rgb(255, 213, 79)",400:"rgb(255, 202, 40)",500:"rgb(255, 193, 7)",600:"rgb(255, 179, 0)",700:"rgb(255, 160, 0)",800:"rgb(255, 143, 0)",900:"rgb(255, 111, 0)","A 100":"rgb(255, 229, 127)","A 200":"rgb(255, 215, 64)","A 400":"rgb(255, 196, 0)","A 700":"rgb(255, 171, 0)"},Orange:{50:"rgb(255, 243, 224)",100:"rgb(255, 224, 178)",200:"rgb(255, 204, 128)",300:"rgb(255, 183, 77)",400:"rgb(255, 167, 38)",500:"rgb(255, 152, 0)",600:"rgb(251, 140, 0)",700:"rgb(245, 124, 0)",800:"rgb(239, 108, 0)",900:"rgb(230, 81, 0)","A 100":"rgb(255, 209, 128)","A 200":"rgb(255, 171, 64)","A 400":"rgb(255, 145, 0)","A 700":"rgb(255, 109, 0)"},"Deep Orange":{50:"rgb(251, 233, 231)",100:"rgb(255, 204, 188)",200:"rgb(255, 171, 145)",300:"rgb(255, 138, 101)",400:"rgb(255, 112, 67)",500:"rgb(255, 87, 34)",600:"rgb(244, 81, 30)",700:"rgb(230, 74, 25)",800:"rgb(216, 67, 21)",900:"rgb(191, 54, 12)","A 100":"rgb(255, 158, 128)","A 200":"rgb(255, 110, 64)","A 400":"rgb(255, 61, 0)","A 700":"rgb(221, 44, 0)"},Brown:{50:"rgb(239, 235, 233)",100:"rgb(215, 204, 200)",200:"rgb(188, 170, 164)",300:"rgb(161, 136, 127)",400:"rgb(141, 110, 99)",500:"rgb(121, 85, 72)",600:"rgb(109, 76, 65)",700:"rgb(93, 64, 55)",800:"rgb(78, 52, 46)",900:"rgb(62, 39, 35)","A 100":"","A 200":"","A 400":"","A 700":""},Grey:{50:"rgb(250, 250, 250)",100:"rgb(245, 245, 245)",200:"rgb(238, 238, 238)",300:"rgb(224, 224, 224)",400:"rgb(189, 189, 189)",500:"rgb(158, 158, 158)",600:"rgb(117, 117, 117)",700:"rgb(97, 97, 97)",800:"rgb(66, 66, 66)",900:"rgb(33, 33, 33)","A 100":"","A 200":"","A 400":"","A 700":""},"Blue Grey":{50:"rgb(236, 239, 241)",100:"rgb(207, 216, 220)",200:"rgb(176, 190, 197)",300:"rgb(144, 164, 174)",400:"rgb(120, 144, 156)",500:"rgb(96, 125, 139)",600:"rgb(84, 110, 122)",700:"rgb(69, 90, 100)",800:"rgb(55, 71, 79)",900:"rgb(38, 50, 56)","A 100":"","A 200":"","A 400":"","A 700":""}})}_mapDataSourceToPalette(){const e=this;let a=[];if(!e.paletteColors||!Array.isArray(e.paletteColors)||0===e.paletteColors.length)return[];for(let t=0;t<e.paletteColors.length;t++){let l=e.paletteColors[t];"object"==typeof l&&l[e.valueMember]&&"string"==typeof l[e.valueMember]&&(l=l[e.valueMember]),l+="",e._isValidColor(l)&&a.push(l)}return a}_handleSampleClick(e){const a=this,t=e.target,l=a.value;let r=t.colorCode;"hexagonal"===a.displayMode?(r=a._HSVtoRGBA({h:t.h,s:t.s,v:t.v},a._RGBA.a),a._hexagonItems.indexOf(t)>-1&&(a._HSV.h=t.h,a.inverted,a._HSV.s=t.s,a._HSV.v=t.v,a._targetItem=t,a._applyValue(a._HSVtoRGBA(a._HSV),e),delete a._targetItem)):a._changeSampleSelection(t),a._HSVRGBArefresh(t.classList.contains("selected")?r:null),"instantly"===a.applyValueMode&&(a.$.hiddenInput.value=a.value=a._getValue(a.valueFormat,t.classList.contains("selected")?r:null),a.value!==l&&a.$.fireEvent("change",{oldValue:l,value:a.value}))}_changeSampleSelection(e){const a=this;if(a._selectedItem&&"radial"!==a.displayMode&&"hexagonal"!==a.displayMode&&(!e||a._selectedItem===e&&e.classList.contains("selected")))return;if(!e)return;const t=a._getContrastColor(a._rgbaToHEX(a._toRGBA(e.colorCode))),l=e.closest("svg");return Array.from((a.shadowRoot||a).querySelectorAll(".selected")).forEach((e=>{e.classList.remove("selected"),e.removeAttribute("aria-current"),e.style.stroke=null})),e.classList.add("selected"),e.setAttribute("aria-current",!0),a._selectedItem=e,l&&(e.style.stroke=t,l.appendChild(e)),!0}_getContrastColor(e){if(void 0===e)return;let a=(t=e.slice(1,3),l=e.slice(3,5),r=e.slice(5,7),[parseInt(t,16),parseInt(l,16),parseInt(r,16)]);var t,l,r;return(.299*a[0]+.61*a[1]+.114*a[2])/255>.6?"#000000":"#FFFFFF"}_getXYcoordinates(e){if(!e)return;const a=this,t=a._activeComponent||(e.originalEvent||e).target;if(!t.closest)return;const l=t.closest(".color-palette")||t.closest(".color-palette-radial")||t.closest(".hue-scale")||t.closest(".brightness-scale")||t.closest(".alpha-channel-scale");if(!l||a.disabled||a.readonly)return;const r=l.getBoundingClientRect();let o=e.pageX-window.pageXOffset-r.left,n=e.pageY-window.pageYOffset-r.top;return o<0?o=0:o>l.offsetWidth&&(o=l.offsetWidth),n<0?n=0:n>l.offsetHeight&&(n=l.offsetHeight),{x:o,y:n,container:l}}_inputWheelHandler(e){const a=this,t=a.value,l=e.target;if(!(e.target instanceof HTMLInputElement)||e.target.classList.contains("hex"))return;let r;e.preventDefault(),l.classList.contains("a-channel")?(r=parseFloat(l.value)||0,r=e.deltaY<0?r+.01:r-.01,l.value=a._toFixed(a._validateInRange(r,0,1)),a._RGBA=a._getRGBAFromInputs(),a._applyAlphaValue(a._RGBA.a,"alphaInput")):(r=parseInt(l.value)||0,r=e.deltaY<0?r+1:r-1,l.value=a._validateInRange(r,0,255),a._RGBA=a._getRGBAFromInputs(),a._HSV=a._getValue("hsv","rgba("+a._RGBA.r+", "+a._RGBA.g+", "+a._RGBA.b+", "+a._RGBA.a+")")),a._updatePreviewContainerValues(a._getValue(a.valueFormat)),a._setPalettePointerXYPosition(),"useButtons"===a.applyValueMode&&("palette"===a.displayMode?a._applyValueInPaletteMode():"radial"===a.displayMode?a._applyValueInRadialMode():"hexagonal"===a.displayMode&&a._generateHoneycomb(a.columnCount,a._HSV)),a.$.container.className.indexOf("custom-color-selection")>-1?a._applyValue(a._HSVtoRGBA(a._HSV)):"useButtons"!==a.applyValueMode&&(a.value=a._getValue(a.valueFormat),a._applyValue(a.value,e),a.$.fireEvent("change",{oldValue:t,value:a.value}))}_paletteDownHandler(e){const a=this;if(!Smart.Utilities.Core.isMobile&&0!==e.button||a.disabled||a.readonly)return;a._dragDetails={x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset};const t=(e.originalEvent||e).target;if(t&&t.closest){if(a._dragDetails.target=t.closest(".color-palette")||t.closest(".color-palette-radial"),t.closest(".color-palette")||t.closest(".color-palette-radial"))return a._handleColorPaletteDown(e.originalEvent),void(a._dragDetails.isPalettePressed=!0);(t.closest(".hue-scale")||t.closest(".alpha-channel-scale")||t.closest(".brightness-scale"))&&a._handleScalesDown(e.originalEvent)}}_setPalettePointerXYPosition(e){const a=this;let t;if("palette"===a.displayMode||a.$.container.className.indexOf("custom-color-selection")>-1)t=a._getXYcoordinates(e),a.$.colorPaletteThumb.style.left=e&&t&&t.x?100*t.x/t.container.offsetWidth+"%":100*a._HSV.s+"%",a.$.colorPaletteThumb.style.top=e&&t&&t.y?100*t.y/t.container.offsetHeight+"%":100*(1-a._HSV.v)+"%";else if("radial"===a.displayMode){if(e){if(t=a._getXYcoordinates(e),!t)return;const l=t.container.offsetWidth?t.container.offsetWidth:a.$.colorPaletteRadial.offsetWidth,r=t.container.offsetHeight?t.container.offsetHeight:a.$.colorPaletteRadial.offsetHeight,o=Math.round(Math.cos(a._HSV.h*Math.PI/180)*l/2+l/2),n=Math.round(Math.sin(a._HSV.h*Math.PI/180)*l/2+r/2);return Math.abs(l/2-t.x)<5?(a.$.colorPaletteRadialThumb.style.left=100*t.x/a.$.colorPaletteRadial.offsetWidth+"%",void(a.$.colorPaletteRadialThumb.style.top=100*t.y/a.$.colorPaletteRadial.offsetHeight+"%")):(a.$.colorPaletteRadialThumb.style.left=100*(t.x<l/2?Math.max(o,t.x):Math.min(o,t.x))/l+"%",void(a.$.colorPaletteRadialThumb.style.top=100*(t.y<r/2?Math.max(n,t.y):Math.min(n,t.y))/r+"%"))}{const e=a._radialThumbPoint(a.$.colorPaletteRadial.offsetWidth/2,a.$.colorPaletteRadial.offsetHeight/2,a._HSV.h,a._HSV.s);a.$.colorPaletteRadialThumb.style.left=100*e.x/a.$.colorPaletteRadial.offsetWidth+"%",a.$.colorPaletteRadialThumb.style.top=100*e.y/a.$.colorPaletteRadial.offsetHeight+"%"}}}_handleGridModeCellHover(e){const a=this,t=e.target.closest(".color-sample");if(a.disabled||!t||"none"===a.tooltipDisplayMode||!a.$.tooltip)return;if(a.$.tooltip.arrow="hexagonal"!==a.displayMode,!a._isValidColor(t.colorCode))return void(a.$.tooltip.disabled=!0);a.$.tooltip.disabled=!1,a.$.tooltip.selector=t;const l=t.h&&t.s&&t.v?a._HSVtoRGBA({h:t.h,s:t.s,v:t.v},a._RGBA.a):a._toRGBA(t.colorCode);switch(a.tooltipDisplayMode){case"rgba":a.$.tooltip.value=l||"";break;case"rgb":a.$.tooltip.value=a._rgbaToRGB(l)||"";break;case"hex":a.$.tooltip.value=a._rgbaToHEX(l)||""}}_localizeLabels(){const e=this,a=(e.shadowRoot||e).querySelector("label.r-channel"),t=(e.shadowRoot||e).querySelector("label.g-channel"),l=(e.shadowRoot||e).querySelector("label.b-channel"),r=(e.shadowRoot||e).querySelector("label.a-channel"),o=(e.shadowRoot||e).querySelector("label.hex");if(a&&(a.innerHTML=e.localize("redPrefix")),t&&(t.innerHTML=e.localize("greenPrefix")),l&&(l.innerHTML=e.localize("bluePrefix")),r&&(r.innerHTML=e.localize("alphaPrefix")),o&&(o.innerHTML=e.localize("hexPrefix")),e.$.buttonCustom&&(e.$.buttonCustom.content=e.localize("customColor")),e.$.buttonOk&&(e.$.buttonOk.content=e.localize("ok")),e.$.buttonCancel&&(e.$.buttonCancel.content=e.localize("cancel")),e.$.defaultSamplesContainer){const a=e.$.defaultSamplesContainer.querySelector(".theme-colors-label"),t=e.$.defaultSamplesContainer.querySelector(".standard-colors-label");a&&(a.innerHTML=e.localize("themeColors")),t&&(t.innerHTML=e.localize("standardColors"))}}_generateHoneycomb(e,a){const t=this,l=parseInt(getComputedStyle(t).getPropertyValue("--smart-color-panel-grid-mode-item-size"))/4,r=Math.sqrt(5*Math.pow(l,2)),o=e%2==0?parseInt(e)+1:parseInt(e),n=a&&void 0!==a.s?a.s:1,s=a&&void 0!==a.v?a.v:1,i=t._calculateHexagonCoords(o,r,1),d=i[Math.floor(i.length/2)],c=t._getHoneycomb30degDimmensions(i.length,r,1);t._draw||(t._draw=new Smart.Utilities.Draw(t.$.colorPaletteHexagonal)),t._draw.clear(),t.$.colorPaletteHexagonal.firstElementChild.setAttribute("role","presentation"),t.$.colorPaletteHexagonal.firstElementChild.firstElementChild.setAttribute("role","menu"),t._hexagonItems=[],t.$.materialGridSamplesContainer&&t.$.materialGridSamplesContainer.$.addClass("smart-hidden");for(let e=0;e<i.length;e++){const a=i[e].x-d.x,l=i[e].y-d.y,o=t._validateInRange(t._calcSatDistance(a,l)/d.x,0,1);let c,u,h=t._calcHueAngle(a,l)<0?360+t._calcHueAngle(a,l):t._calcHueAngle(a,l);switch(t.inverted?(c=n,u=o):(c=o,u=s),t.palette){case"red":h=0;break;case"green":h=120;break;case"blue":h=240;break;case"gray":c=0,u=t.inverted?o:1-o}const g={offsetX:i[e].x,offsetY:i[e].y,style:{fill:t._HSVtoRGBA({h,s:c,v:u},1),class:"color-sample"}};let b=t._hexagon(r,g);b.colorCode=t._HSVtoRGBA({h,s:c,v:u}),b.h=h,b.s=c,b.v=u,b.setAttribute("role","menuitem"),b.setAttribute("aria-label",b.colorCode),t._hexagonItems.push(b)}t._draw.host.style.width=c.width+"px",t._draw.host.style.height=c.height+"px",t.$.container.style.setProperty("--smart-color-panel-palette-width",c.width+"px"),t.$.container.style.setProperty("--smart-color-panel-palette-height",c.height+"px"),t._applyValueInHexagonalMode(),t._hideControlsByPriority()}_hexagon(e,a){const t=this._shortStepHexagon(e),l=2*t,r=l+(a.offsetX||0),o=a.offsetY||0,n=r+l,s=o+t,i=s+e,d=n-l,c=i+t,u=d-l,h=c-t,g="M "+r+","+o+" L "+n+","+s+" L "+n+","+i+" L "+d+","+c+" L "+u+","+h+" L "+u+","+(h-e)+" Z";return this._draw.path(g,a.style||{class:"color-sample"})}_shortStepHexagon(e){return Math.sqrt(Math.pow(e,2)/5)}_getHoneycomb30degDimmensions(e,a,t){const l=.5*(1+Math.sqrt(1-(1-e)/3*4)),r=this._shortStepHexagon(a);return{width:4*r*(2*l-1)+2*l*2*t,height:(2*l-1)*a+2*l*r+2*l*t}}_generateShades(e,a){const t=this,l=a||"gray";let r,o=[];const n=255/((e=Math.max(parseInt(e),2))-1);for(let a=0;a<e;a++){let e=Math.max(parseInt(255-a*n),0);switch(t.inverted&&(e=255-e),l){case"red":r="rgb("+e+", 0, 0)";break;case"green":r="rgb(0, "+e+", 0)";break;case"blue":r="rgb(0, 0, "+e+")";break;default:r="rgb("+e+", "+e+", "+e+")"}o.push(r)}return o}_generateColorSpectrum(e){const a=this;let t=[];const l=360/((e=Math.max(parseInt(e),2))-1),r=2/e;let o=0,n=1,s=1;for(let i=0;i<e;i++){a.inverted?0===i?n=1:i<e/2?n=Math.max(n-r,r/2):i<e-1?(s=Math.max(s-r,r/2),n=Math.min(n+r,1)):(s=Math.max(s-r,r/2),n=Math.min(n+r/4,1)):0===i?s=1:i<e/2?s=Math.max(s-r,r/2):i<e-1?(n=Math.max(n-r,r/2),s=Math.min(s+r,1)):(n=Math.max(n-r,r/2),s=Math.min(s+r/4,1));for(let r=0;r<e;r++)o=parseInt(l*r),o=360===o?360-l/2:o,t.push(a._HSVtoRGBA({h:o,s:n,v:s},1))}return t}_generateSpectrumGrid(e){const a=this;if(!a.$.spectrumGridSamplesContainer)return;const t=Math.pow(e,2),l=document.createDocumentFragment(),r={},o=a._generateShades(e,"gray"),n=a._customPalette;let s;["grayShadesBox","spectrumBox","customColorsBox"].forEach((e=>{const a=document.createElement("div");let t=Smart.Utilities.Core.toDash(e).split("-").join(" ");r[e]=a,a.className=Smart.Utilities.Core.toDash(e),a.setAttribute("role","menu"),a.setAttribute("aria-label",t.slice(0,1).toUpperCase()+t.slice(1)),l.appendChild(a)})),s="default"===a.palette?a._generateColorSpectrum(e):["gray","red","green","blue"].indexOf(a.palette)>-1?a._generateShades(t,a.palette):a._generateColorSpectrum(e);for(let t=0;t<e;t++){const e=a._createColorSample(o[t],"gray-shade");r.grayShadesBox.appendChild(e)}for(let e=0;e<t;e++){const t=a._createColorSample(s[e],"spectrum");r.spectrumBox.appendChild(t)}for(let t=0;t<e;t++){const e=n[t];if(!e)break;const l=a._createColorSample(e,"custom-color");r.customColorsBox.appendChild(l)}a.$.spectrumGridSamplesContainer.innerHTML="",a.$.spectrumGridSamplesContainer.appendChild(l)}_generateDefaultGrid(){const e=this;if(!e.$.defaultSamplesContainer)return;const a={},t=null===e.gridThemeColors?e._defaultModeThemeColors:e.gridThemeColors,l=null===e.gridShadeColors?e._defaultModeShadesColors:e.gridShadeColors,r=null===e.gridStandardColors?e._defaultModeStandardColors:e.gridStandardColors,o=document.createDocumentFragment();["themeColorsLabel","themeColorsBox","themeShadesBox","standardColorsLabel","standardColorsBox"].forEach((t=>{const l=document.createElement("div");a[t]=l,l.className=Smart.Utilities.Core.toDash(t),-1!==t.indexOf("Box")?l.setAttribute("role","menu"):-1!==t.indexOf("Label")&&(l.id=e.id+t),o.appendChild(l)})),a.themeColorsLabel.innerHTML=e.localize("themeColors"),a.standardColorsLabel.innerHTML=e.localize("standardColors"),a.themeColorsBox.setAttribute("aria-labelledby",e.id+"themeColorsLabel"),a.themeShadesBox.setAttribute("aria-labelledby",e.id+"themeColorsLabel"),a.standardColorsBox.setAttribute("aria-labelledby",e.id+"standardColorsLabel");for(let t=0;t<e._defaultModeShadesColors.length;t++)a.themeShadesBox.appendChild(e._createColorSample(l[t],"shades-color"));for(let l=0;l<10;l++)a.themeColorsBox.appendChild(e._createColorSample(t[l],"theme-color")),a.standardColorsBox.appendChild(e._createColorSample(r[l],"standard-color"));e.$.defaultSamplesContainer.innerHTML="",e.$.defaultSamplesContainer.appendChild(o)}_mixColors(e,a,t){const l=e=>parseInt(e,16);let r,o="#";t=void 0!==t?t:.5,e=e.replace(/#/g,""),a=a.replace(/#/g,"");for(let n=0;n<=5;n+=2){const s=l(e.substr(n,2)),i=l(a.substr(n,2));for(r=Math.round(i+(s-i)*t).toString(16);r.length<2;)r="0"+r;o+=r}return o}_generateMaterialGrid(){const e=this;if(!e.$.materialGridSamplesContainer)return;const a=document.createDocumentFragment();e.$.materialGridSamplesContainer.$.removeClass("smart-hidden"),a.appendChild(e._createColorSample("rgb(255, 255, 255, 0)","material-color label-column")),Object.entries(e._materialColors.Red).forEach((t=>{const l=e._createColorSample("rgb(255, 255, 255, 0)","material-color header");l.textContent=t[0],a.appendChild(l)})),Object.entries(e._materialColors).forEach((t=>{const l=e._createColorSample("rgb(255, 255, 255, 0)","material-color label-column");l.textContent=t[0],a.appendChild(l),Object.entries(t[1]).forEach((t=>{a.appendChild(e._createColorSample(t[1],"material-color"))}))})),e.$.materialGridSamplesContainer.innerHTML="",e.$.materialGridSamplesContainer.appendChild(a)}_createColorSample(e,a){const t=document.createElement("div"),l=e?"":" empty";return e&&-1===a.indexOf("label-column")&&-1===a.indexOf("header")&&(t.setAttribute("role","menuitem"),t.setAttribute("aria-label",e)),t.className="color-sample "+a+l,a.indexOf("header")>-1||a.indexOf("label-column")>-1||(t.colorCode=e,t.style.backgroundColor=e),t}_calculateHexagonCoords(e,a,t){const l=e,r=function(e){return((e=e%2==0?e+1:e)+1)/2}(e),o=this._shortStepHexagon(a),n=4*o+2*t,s=2*o+t,i=a+o+t,d=s*(l-1)/2;let c=[];for(let a=0;a<l;a++){const t=a<r?r+a:e-1-(a-r),l=a<r?d-a*s:d-(e-a-1)*s,o=a*i;for(let e=0;e<t;e++){const a=l+e*n;c.push({x:a,y:o})}}return c}_generateGridStructures(){const e=this,a=e.displayMode;if(!e._initializeOnOpening){if(void 0===e._createGridModeComponents()){switch(a){case"spectrumGrid":e._generateSpectrumGrid(e.columnCount);break;case"materialGrid":e._generateMaterialGrid();break;case"default":e._generateDefaultGrid();break;case"grid":e._generatePaletteGrid()}return e._generatePaletteUserColorGrid(),void t()}switch(e._createColorControls(),a){case"radial":e._generateRadialCanvas();break;case"hexagonal":e._generateHoneycomb(e.columnCount,e._HSV)}t()}function t(){switch(a){case"default":case"grid":e.$.colorPaletteRadial.setAttribute("aria-hidden",!0),e.$.brightnessScale.setAttribute("aria-hidden",!0);break;case"hexagonal":e.$.colorPaletteRadial.setAttribute("aria-hidden",!0),e.$.brightnessScale.removeAttribute("aria-hidden");break;case"materialGrid":e.$.colorPaletteRadial.removeAttribute("aria-hidden"),e.$.brightnessScale.removeAttribute("aria-hidden");break;case"palette":e.$.colorPaletteRadial.removeAttribute("aria-hidden"),e.$.brightnessScale.setAttribute("aria-hidden",!0)}}}_generateRadialCanvas(){const e=this;if("radial"!==e.displayMode||"radial"===e.displayMode&&!Smart.Utilities.Core.Browser.Firefox)return;const a=e.$.colorPaletteRadial.offsetWidth,t=a/2;let l=e.$.colorPaletteRadial.querySelector("canvas");l||(l=document.createElement("canvas"),l.setAttribute("role","presentation"));let r=l.getContext("2d"),o=r.createImageData(a,a),n=o.data;l.width=l.height=a;for(let a=-t;a<t;a++)for(let l=-t;l<t;l++){let[r,o]=e._xy2polar(a,l);if(r>t)continue;let s=4*(a+t+(l+t)*(2*t)),i=e._rad2deg(o),d=1,c=1;const[u,h,g]=e._hsv2rgb(i,d,c);n[s]=u,n[s+1]=h,n[s+2]=g,n[s+3]=255}r.putImageData(o,0,0),e.$.colorPaletteRadial.appendChild(l)}_xy2polar(e,a){return[Math.sqrt(e*e+a*a),Math.atan2(a,e)]}_rad2deg(e){return(e+Math.PI)/(2*Math.PI)*360}_hsv2rgb(e,a,t){let l,r,o,n=t*a,s=e/60,i=n*(1-Math.abs(s%2-1));s>=0&&s<=1?[l,r,o]=[n,i,0]:s>=1&&s<=2?[l,r,o]=[i,n,0]:s>=2&&s<=3?[l,r,o]=[0,n,i]:s>=3&&s<=4?[l,r,o]=[0,i,n]:s>=4&&s<=5?[l,r,o]=[i,0,n]:s>=5&&s<=6&&([l,r,o]=[n,0,i]);let d=t-n,[c,u,h]=[l+d,r+d,o+d];return[255*c,255*u,255*h]}_hideControlsByPriority(){const e=this,a=(e.shadowRoot||e).querySelector(".color-controls-container");if(!a.innerHTML.trim())return;function t(a){const t=e.getElementsByClassName(a);for(let e=0;e<t.length;e++)t[e].classList.add("smart-hidden")}const l=e.hideContentToFit.slice().reverse(),r=["hex","r-channel","g-channel","b-channel","a-channel","preview-container"];let o=l.length;for(r.forEach((a=>{const t=e.getElementsByClassName(a);for(let e=0;e<t.length;e++)t[e].classList.remove("smart-hidden")}));a.scrollHeight>a.offsetHeight&&o>0;)switch(o--,l[o]){case"HEX":t(r[0]);break;case"RGB":r.slice(1,4).forEach((e=>t(e)));break;case"previewContainer":t(r[5]);break;case"alpha":t(r[4])}e._generateRadialCanvas()}_resizeHoneycombItems(){const e=this;"hexagonal"===e.displayMode&&e._generateHoneycomb(e.columnCount,e._HSV)}_getValue(e,a){const t=this,l=t._RGBA;let r,o=null;switch(e){case"hex":o=t._rgbArrayToHEX([l.r,l.g,l.b,l.a]);break;case"rgb":o="rgb("+l.r+", "+l.g+", "+l.b+")";break;case"rgba":o=null!==l.r&&null!==l.g&&null!==l.b?"rgba("+l.r+", "+l.g+", "+l.b+", "+l.a+")":null;break;case"HSVtoRGBAarray":{let e="hexagonal"===t.displayMode||"radial"===t.displayMode||"palette"===t.displayMode?t._RGBA.a:1;a&&(t._isRGBA(a)&&/rgba\((\d*.\d+|\d+),(\d*.\d+|\d+),(\d*.\d+|\d+)\,(\d*.\d+|\d+)\)/gi.test(a.replace(/\s/g,""))?e=/rgba\((\d*.\d+|\d+),(\d*.\d+|\d+),(\d*.\d+|\d+)\,(\d*.\d+|\d+)\)/gi.exec(a.replace(/\s/g,""))[4]:t._isHEX(a)&&/(^#[0-9A-F]{8}$)/gi.test(a.replace(/\s/g,""))&&(e=parseInt(/(^#[0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2}$)/gi.exec(a.replace(/\s/g,""))[4],16)/255),e=Math.min(1,Math.max(0,parseFloat(e))),isNaN(e)&&(e=t._RGBA.a)),o=t._HSVtoRGBA(t._HSV,e),r=/rgba\((\d*.\d+|\d+),(\d*.\d+|\d+),(\d*.\d+|\d+)\,(\d*.\d+|\d+)\)/gi.exec(o.replace(/\s/g,"")),o={r:parseInt(r[1]),g:parseInt(r[2]),b:parseInt(r[3]),a:parseFloat(r[4])};break}case"hsv":a&&t._isValidColor(a)&&(o=t._colorToHSV(a));break;default:"radial"===t.displayMode||"hexagonal"===t.displayMode||"palette"===t.displayMode?(o="rgba("+l.r+", "+l.g+", "+l.b+", "+l.a+")",t.editAlphaChannel||(o=t._rgbaToRGB(o))):o=null!==a?t._rgbArrayToHEX([l.r,l.g,l.b,l.a]):null}return o||null}_instantUpdate(){const e=this,a=e.value;"instantly"!==e.applyValueMode||e.$.container.className.indexOf("custom-color-selection")>-1||(e.value=e._getValue(e.valueFormat),e.$.fireEvent("change",{oldValue:a,value:e.value}))}_equalValues(e,a){return e===a||!(!e||!a)&&this._toRGBA(e,!0)===this._toRGBA(a,!0)}_toHEX(e){const a=this;return a._isHEX(e)?e:(a._isRGB(e)&&(e=e.toLowerCase().replace("rgb","rgba"),e=a.editAlphaChannel?e.replace(")",", "+(a._RGBA.a||1)+")"):e.replace(")",", 1)")),a._isRGBA(e)?a._rgbaToHEX(e):void 0)}_toRGBA(e,a){const t=this;let l=t.value;if(t._isRGBA(e))return a?"rgba("+e.match(/(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})/gi)+", 1)":e;if(t._isValidColorName(e))l=r(t._cssColorNamesHEX[e.trim().toLowerCase()]);else if(t._isHEX(e))l=r(e);else{if(!t._isRGB(e))return!1;l=e.toLowerCase(),l=l.replace("rgb","rgba"),l=t.editAlphaChannel?l.replace(")",", "+(t._RGBA.a||1)+")"):l.replace(")",", 1)")}return l;function r(e){const t=/^#(.)(.)(.)$/gi.exec(e),l=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(e),r=t?parseInt(t[1]+t[1],16):parseInt(l[1],16),o=t?parseInt(t[2]+t[2],16):parseInt(l[2],16),n=t?parseInt(t[3]+t[3],16):parseInt(l[3],16),s=t?parseInt(t[4]+t[4],16):parseInt(l[4],16);return a?"rgba("+r+", "+o+", "+n+", 1)":"rgba("+r+", "+o+", "+n+", "+(isNaN(s)?"1":s/255)+")"}}_rgbaToRGB(e){const a=/rgba\((\d*.\d+|\d+),(\d*.\d+|\d+),(\d*.\d+|\d+)\,(\d*.\d+|\d+)\)/gi.exec(e.replace(/\s/g,""));return"rgb("+a[1].trim()+", "+a[2].trim()+", "+a[3].trim()+")"}_rgbaToHEX(e){const a=/rgba\((\d*.\d+|\d+),(\d*.\d+|\d+),(\d*.\d+|\d+)\,(\d*.\d+|\d+)\)/gi.exec(e.replace(/\s/g,""));return this._rgbArrayToHEX([a[1],a[2],a[3],a[4]])}_rgbArrayToHEX(e){let a="#";if(Array.isArray(e)&&null===e[0])return null;for(let t=0;t<3;t++){let l=parseInt(e[t]).toString(16).toUpperCase();l=1===l.length?0+l:l,a+=l}let t=parseFloat(e[3]);return isNaN(t)||(t=parseInt(255*t).toString(16).toUpperCase(),"FF"!==t&&(a=a.slice(0,7)+(1===t.length?0+t:t))),a}_colorToHSV(e){const a=this;if(!a._isValidColor(e))return;e=a._toRGBA(e).replace(/\s/g,"");const t=/rgba\((\d*.\d+|\d+),(\d*.\d+|\d+),(\d*.\d+|\d+)\,(\d*.\d+|\d+)\)/gi.exec(e),l=Math.min(255,Math.max(0,parseFloat(t[1])))/255,r=Math.min(255,Math.max(0,parseFloat(t[2])))/255,o=Math.min(255,Math.max(0,parseFloat(t[3])))/255;let n={h:0,s:0,v:0},s=0,i=0;if(l>=r&&l>=o?(i=l,s=r>o?o:r):r>=o&&r>=l?(i=r,s=l>o?o:l):(i=o,s=r>l?l:r),n.v=i,n.s=i?(i-s)/i:0,n.s){const e=i-s;n.h=l===i?(r-o)/e:r===i?2+(o-l)/e:4+(l-r)/e,n.h=60*n.h,n.h<0&&(n.h+=360)}else n.h=a._HSV.h?a._HSV.h:0;return n.s=parseFloat(n.s),n.v=parseFloat(n.v),n}_HSVtoRGBA(e,a){const t=this,l=(e=e||{h:0,s:0,v:0})&&e.h>=0?e.h:t._HSV.h,r=e&&e.s>=0?e.s:t._HSV.s,o=e&&e.v>=0?e.v:t._HSV.v;let n,s,i,d=o*r,c=l/60,u=d*(1-Math.abs(c%2-1));c>=0&&c<=1?[n,s,i]=[d,u,0]:c>=1&&c<=2?[n,s,i]=[u,d,0]:c>=2&&c<=3?[n,s,i]=[0,d,u]:c>=3&&c<=4?[n,s,i]=[0,u,d]:c>=4&&c<=5?[n,s,i]=[u,0,d]:c>=5&&c<=6&&([n,s,i]=[d,0,u]);const h=o-d;return"rgba("+Math.round(255*(n+h))+", "+Math.round(255*(s+h))+", "+Math.round(255*(i+h))+", "+(void 0!==a?a:t._RGBA.a||0)+")"}_HSVRGBArefresh(e){const a=this;a._HSV=a._getValue("hsv",e)||{h:1,s:0,v:1},a._RGBA=a._getValue("HSVtoRGBAarray",e)}_toFixed(e,a){return parseFloat(parseFloat(e).toFixed(a||2))}_validateInRange(e,a,t){return Math.min(Math.max(parseFloat(e),parseFloat(a)),parseFloat(t))}_isHEX(e){return/(^#[0-9A-F]{3}$)|(^#[0-9A-F]{6}$)|(^#[0-9A-F]{8}$)/i.test(e)}_isRGB(e){return/rgb\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)/i.test(e)}_isRGBA(e){return/rgba\((\d*.\d+|\d+)\s*,\s*(\d*.\d+|\d+)\s*,\s*(\d*.\d+|\d+)\s*,\s*(\d*.\d+|\d+)\)/i.test(e)}_isValidColorName(e){return!(!e||void 0===this._cssColorNamesHEX[e.trim().toLowerCase()])}_isValidColor(e){return this._isHEX(e)||this._isRGB(e)||this._isRGBA(e)||this._isValidColorName(e)}_getRGBAFromInputs(){const e=this;let a=(e.shadowRoot||e).querySelector("input.r-channel"),t=(e.shadowRoot||e).querySelector("input.g-channel"),l=(e.shadowRoot||e).querySelector("input.b-channel"),r=(e.shadowRoot||e).querySelector("input.a-channel");return a=a?a.value:e._RGBA.r,t=t?t.value:e._RGBA.g,l=l?l.value:e._RGBA.b,r=r?r.value:e._RGBA.a,{r:parseInt(a),g:parseInt(t),b:parseInt(l),a:r}}_setRGBAToInputs(){const e=this;Object.entries(e._RGBA).forEach((a=>{const t=(e.shadowRoot||e).querySelector("input."+a[0]+"-channel");t&&(t.value=e._RGBA[a[0]])}))}_calcHueAngle(e,a){return 180*Math.atan2(a,e)/Math.PI}_calcSatDistance(e,a){return Math.sqrt(Math.pow(e,2)+Math.pow(a,2))}});
|
|
103
103
|
Smart("smart-color-picker",class extends Smart.DropDownButton{static get properties(){return{applyValueMode:{value:"instantly",allowedValues:["instantly","useButtons"],type:"string"},columnCount:{value:8,type:"number"},gridThemeColors:{value:null,type:"array?",reflectToAttribute:!1},gridShadeColors:{value:null,type:"array?",reflectToAttribute:!1},gridStandardColors:{value:null,type:"array?",reflectToAttribute:!1},paletteColors:{value:null,type:"array?",reflectToAttribute:!1},paletteCustomColors:{value:null,type:"array?",reflectToAttribute:!1},disableUndo:{value:!1,type:"boolean"},displayMode:{value:"default",allowedValues:["default","grid","palette","radial","hexagonal","spectrumGrid","materialGrid"],type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownHeight:{value:"auto",type:"string"},dropDownWidth:{value:"auto",type:"string"},editable:{value:!1,type:"boolean"},editAlphaChannel:{value:!1,type:"boolean"},enableCustomColors:{value:!1,type:"boolean"},hidePreviewContainer:{value:!1,type:"boolean"},hideRGBEditor:{value:!1,type:"boolean"},hideHEXEditor:{value:!1,type:"boolean"},hideAlphaEditor:{value:!1,type:"boolean"},messages:{value:{en:{redPrefix:"R:",greenPrefix:"G:",bluePrefix:"B:",hexPrefix:"#:",alphaPrefix:"Alpha:",ok:"OK",cancel:"CANCEL",customColor:"CUSTOM COLOR",standardColors:"Standard colors",themeColors:"Theme colors"}},type:"object",extend:!0},name:{value:"",type:"string"},palette:{value:"default",allowedValues:["default","gray","red","green","blue","custom"],type:"string"},placeholder:{value:"Please Select Color",type:"string"},tooltipDisplayMode:{value:"hex",allowedValues:["none","rgba","rgb","hex"],type:"string"},value:{value:null,type:"string?"},valueDisplayMode:{value:"default",allowedValues:["default","colorBox","colorCode","none"],type:"string"},valueFormat:{value:"default",allowedValues:["default","rgb","rgba","hex"],type:"string"},inverted:{value:!1,type:"boolean"},hideContentToFit:{value:["RGB","HEX","alpha","previewContainer"],type:"array"}}}static get listeners(){return{"input.change":"_inputChangeHandler","input.focus":"_focusEventHandler","input.blur":"_blurEventHandler","colorPanel.cancelButtonClick":"_cancelButtonHandler","colorPanel.okButtonClick":"_okButtonHandler","colorPanel.customColorSelection":"_customColorSelectionHandler","colorPanel.change":"_colorPanelChangeHandler",keydown:"_keyDownHandler"}}static get requires(){return{"Smart.ColorPanel":"smart.colorpanel.js","Smart.DropDownButton":"smart.dropdownbutton.js"}}static get styleUrls(){return["smart.colorpanel.css","smart.colorpicker.css"]}template(){return'<div id="container" role="presentation">\n <span class="smart-label" id="label">[[label]]</span>\n <div id="content" class="smart-content" role="presentation">\n <div id="buttonsContainer" class="smart-buttons-container" role="presentation">\n <div id="actionButton" class="smart-action-button">\n <div id="colorSampleContainer" class="smart-color-box color-picker-sample-container" role="presentation">\n <div id="colorSample" class="color-picker-sample"></div>\n </div>\n <input type="text" id="input" class="smart-input smart-color-input color-picker-action-input" placeholder="[[placeholder]]" spellcheck="false" autocomplete="off" aria-label="[[placeholder]]" />\n </div>\n <span id="dropDownButton" class="smart-drop-down-button">\n <span class="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n <div id="dropDownContainer" class="smart-drop-down smart-drop-down-color-picker smart-drop-down-container smart-visibility-hidden" role="dialog">\n <smart-color-panel id="colorPanel" wait\n animation="[[animation]]"\n apply-value-mode="[[applyValueMode]]"\n column-count="[[columnCount]]"\n disabled="[[disabled]]"\n display-mode="[[displayMode]]"\n edit-alpha-channel="[[editAlphaChannel]]"\n enable-custom-colors="[[enableCustomColors]]"\n grid-theme-colors="[[gridThemeColors]]"\n grid-shade-colors="[[gridShadeColors]]"\n grid-standard-colors="[[gridStandardColors]]"\n hide-content-to-fit="[[hideContentToFit]]"\n hide-preview-container="[[hidePreviewContainer]]"\n hide-r-g-b-editor="[[hideRGBEditor]]"\n hide-h-e-x-editor="[[hideHEXEditor]]"\n hide-alpha-editor="[[hideAlphaEditor]]"\n inverted="[[inverted]]"\n locale="[[locale]]"\n messages="[[messages]]"\n name="[[name]]"\n palette-colors="[[paletteColors]]"\n palette-custom-colors="[[paletteCustomColors]]"\n palette="[[palette]]"\n right-to-left="[[rightToLeft]]"\n theme="[[theme]]"\n tooltip-display-mode="[[tooltipDisplayMode]]"\n value="{{value}}"\n value-format="[[valueFormat]]">\n </smart-color-panel>\n <div id="resizeBar" class="smart-drop-down-resize-bar" aria-label="Resize">\n <div></div>\n </div>\n </div>\n </div>\n <span class="smart-hidden smart-hint" id="hint">[[hint]]</span>\n </div>'}propertyChangedHandler(e,o,t){const a=this;switch(e){case"editable":case"disabled":case"readonly":a.$.input.readOnly=a.disabled||a.readonly||!a.editable;break;case"value":a.$.colorPanel._isValidColor(a.value)&&a._applyValue(a.value);break;case"displayMode":a._applyValue(a.value);break;case"dropDownOpenMode":super.propertyChangedHandler(e,o,t),"dropDownButton"===t?a.$.actionButton.setAttribute("aria-label",a.value||a.placeholder):a.$.actionButton.removeAttribute("aria-label");break;case"resizeMode":a.$.dropDownContainer.setAttribute("resize-mode",a.resizeMode);break;case"valueDisplayMode":"none"===t?a.$.actionButton.setAttribute("role","presentation"):a.$.actionButton.removeAttribute("role");break;default:super.propertyChangedHandler(e,o,t)}"displayMode"===e&&a.$.colorPanel._hideControlsByPriority()}open(){const e=this,o=document.querySelectorAll("smart-drop-down-button, smart-color-picker");e.$.colorPanel._initializeOnOpening&&(delete e.$.colorPanel._initializeOnOpening,e.$.colorPanel._generateGridStructures(),e.$.colorPanel._applyValue(e.value),e.$.colorPanel._hideControlsByPriority());for(let t=0;t<o.length;t++)o[t]!==e&&o[t].opened&&o[t].close();e.$.colorPanel&&e.$.colorPanel.$container.hasClass("custom-color-selection")&&e.$.colorPanel._handleCancelButtonClick(),e._open()}blur(){this.$.input.blur()}focus(){this.$.input.focus()}_createElement(){const e=this;e.$.colorPanel._initializeOnOpening=!e.opened,e.$.colorPanel.wait=!1,e.$.colorPanel.setAttribute("role","presentation"),e.$.input.readOnly=e.disabled||e.readonly||!e.editable,e.editable&&(e.dropDownOpenMode="dropDownButton"),e._setAriaRelations(!0),"none"===e.valueDisplayMode?e.$.actionButton.setAttribute("role","presentation"):e.$.actionButton.removeAttribute("role"),e._applyValue(e.$.colorPanel.value),e._setFocusable()}_colorPanelChangeHandler(e){this._applyValue(e.detail.value),e.stopPropagation(),this.$.fireEvent("change",e.detail)}_cancelButtonHandler(e){const o=this;e.stopPropagation(),o.$.colorPanel.$.container.className.indexOf("custom-color-selection")>-1||o.close(),o.$.fireEvent(e.type,e.detail)}_customColorSelectionHandler(e){const o=this;e.stopPropagation(),o._positionDetection.checkBrowserBounds("vertically"),o._positionDetection.positionDropDown(),o._positionDetection.checkBrowserBounds("horizontally"),o.$.fireEvent(e.type,e.detail)}_okButtonHandler(e){const o=this;e.stopPropagation(),o.$.colorPanel.$.container.className.indexOf("custom-color-selection")>-1||(o._applyValue(o.$.colorPanel.value),o.close()),o.$.fireEvent(e.type,e.detail)}_setFocusable(){const e=this;if(!e.disabled&&!e.unfocusable){let o=e.tabIndex>0?e.tabIndex:0;return e.$.input.tabIndex=o,void("dropDownButton"===e.dropDownOpenMode?e.$.dropDownButton.setAttribute("tabindex",o):e.$.dropDownButton.removeAttribute("tabindex"))}e.$.input.tabIndex=-1,e.$.dropDownButton.removeAttribute("tabindex")}_inputChangeHandler(e){const o=this;e.preventDefault(),e.stopPropagation(),o.value=o.$.colorPanel.value=o.$.input.value}_applyValue(e){const o=this;o.value=o.$.colorPanel.value=o.$.colorSample.style.backgroundColor=o.$.input.value=e,e?(o.$colorSampleContainer.removeClass("no-color"),o.$.colorSample.setAttribute("aria-label",e)):(o.$colorSampleContainer.addClass("no-color"),o.$.colorSample.setAttribute("aria-label","No color")),o.label||o._ariaButton.setAttribute("aria-label",e||o.placeholder),"dropDownButton"===o.dropDownOpenMode&&o.$.actionButton.setAttribute("aria-label",e||o.placeholder)}_keyDownHandler(e){const o=this,t=o.shadowRoot||o.isInShadowDOM?e.composedPath()[0]:e.target,a=(o.shadowRoot||o.getRootNode()).activeElement||document.activeElement;if(!(o.disabled||o.readonly||a!==o&&a!==o.$.dropDownButton&&a!==o.$.input))switch(e.key){case"Enter":case" ":t!==o.$.input?o.opened&&"Enter"===e.key?(e.preventDefault(),o.close()):o.opened||o.readonly||"none"===o.dropDownOpenMode||(e.preventDefault(),o.open()):"Enter"===e.key&&(e.preventDefault(),o.$.colorPanel.value=o.$.input.value);break;case"ArrowUp":case"ArrowDown":if(e.altKey)return void(o.disabled||o.readonly||"none"===o.dropDownOpenMode||("ArrowDown"===e.key?o.open():o.close()));e.preventDefault();break;case"Escape":e.preventDefault(),o.close()}}});
|
|
104
104
|
Smart("smart-scheduler",class extends Smart.ScrollViewer{static get properties(){return{available:{value:[],type:"array"},autoHeightAllDayCells:{value:!1,type:"boolean"},autoScrollStep:{value:30,type:"number"},colorScheme:{value:["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161",""],type:"array"},currentTimeIndicator:{value:!1,type:"boolean"},currentTimeIndicatorInterval:{value:1,validator:"_currentTimeIndicatorIntervalValidator",type:"number"},contextMenuDataSource:{value:null,type:"any",reflectToAttribute:!1},contextMenuClipboardActions:{value:!1,type:"boolean"},eventTemplate:{value:null,type:"any",reflectToAttribute:!1},eventCollectorTemplate:{value:null,type:"any"},eventRenderMode:{allowedValues:["classic","modern"],value:"modern",type:"string"},eventTooltipTemplate:{value:null,type:"any"},cellTemplate:{value:null,type:"any",reflectToAttribute:!1},dateCurrent:{value:new Date,type:"any",validator:"_dateValidator"},dataExport:{value:{header:{value:!0,type:"boolean"},columns:{value:[],type:"array"},style:{value:null,type:"object"},fileName:{value:"smartScheduler",type:"string?"},pageOrientation:{value:"portrait",type:"string"}},type:"object"},dataSource:{value:[],type:"any",reflectToAttribute:!1},dateSelectorFormatFunction:{value:null,reflectToAttribute:!1,type:"function?"},dayFormat:{value:"numeric",allowedValues:["2-digit","numeric"],type:"string"},disableAutoScroll:{value:!1,type:"boolean"},disableDrag:{value:!1,type:"boolean"},disableDrop:{value:!1,type:"boolean"},disableResize:{value:!1,type:"boolean"},disableSelection:{value:!1,type:"boolean"},disableWindowEditor:{value:!1,type:"boolean"},disableContextMenu:{value:!1,type:"boolean"},disableEventMenu:{value:!1,type:"boolean"},disableViewMenu:{value:!1,type:"boolean"},disableDateMenu:{value:!1,type:"boolean"},dragFeedbackFormatFunction:{value:null,type:"function?",reflectToAttribute:!1},dragOffset:{value:[10,10],type:"array"},filterable:{value:!1,type:"boolean"},filter:{value:null,type:"any"},filterMode:{value:"equals",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},firstDayOfWeek:{value:0,type:"number",defaultValue:0,validator:"_firstDayOfWeekValidator"},footerTemplate:{value:null,type:"any",reflectToAttribute:!1},groupByDate:{value:!1,type:"boolean"},groupOrientation:{allowedValues:["horizontal","vertical"],value:"horizontal",type:"string"},groupTemplate:{value:null,type:"any",reflectToAttribute:!1},groups:{value:[],type:"array"},hourEnd:{value:23,type:"number",validator:"_hourValidator"},hourStart:{value:0,type:"number",validator:"_hourValidator"},hourFormat:{value:"numeric",allowedValues:["numeric","2-digit"],type:"string"},headerTemplate:{value:null,type:"any",reflectToAttribute:!1},headerDatePosition:{value:"near",allowedValues:["near","far"],type:"string"},headerNavigationStyle:{value:"flat",allowedValues:["flat","raised"],type:"string"},headerViewPosition:{value:"far",allowedValues:["near","far"],type:"string"},hideAllDay:{value:!1,type:"boolean"},hideNonworkingWeekdays:{value:!1,type:"boolean"},hideOtherMonthDays:{value:!1,type:"boolean"},hideTodayButton:{value:!1,type:"boolean"},hideViewMenuCheckableItems:{value:!1,type:"boolean"},hideWeekend:{value:!1,type:"boolean"},legendLocation:{allowedValues:["header","footer"],value:"footer",type:"string"},legendPosition:{allowedValues:["near","far"],value:"near",type:"string"},legendLayout:{allowedValues:["auto","","menu"],value:"auto",type:"string"},legendLayoutMenuBreakpoint:{value:10,type:"number"},max:{value:new Date(2100,0,1),type:"any",validator:"_dateValidator"},maxEventsPerCell:{value:null,type:"number?"},min:{value:new Date(1900,0,1),type:"any",validator:"_dateValidator"},messages:{extend:!0,value:{en:{invalidValue:"{{elementType}}: Invalid {{property}} value. {{property}} should be of type {{typeOne}} or {{typeTwo}}.",invalidTimeZone:"{{elementType}}: Invalid timeZone value. TimeZone should be the id of an allowed timeZone value.",incorrectArgument:"{{elementType}}: Incorrect argument {{argumentName}} in method {{methodName}}.",exceptionExists:"{{elementType}}: Trying to add an exception via {{methodName}} that already exists. Cannot have duplicate exception of the same event on same date.",noId:"smartScheduler requires an id in order to save/load/clear a state.",agenda:"Agenda",agendaPlaceholder:"No events to display",day:"Day",week:"Week",month:"Month",allDay:"All Day",timelineDay:"Timeline Day",timelineWeek:"Timeline Week",timelineMonth:"Timeline Month",newEvent:"New Event",ok:"Ok",cancel:"Cancel",delete:"Delete",label:"Label",dateStart:"Start Date",dateEnd:"End Date",repeat:"Repeat",description:"Description",repeatFreq:"Repeat",repeatInterval:"Repeat Every",repeatOn:"Repeat On",repeatEnd:"End Repeat",repeatEndOption:"Never",repeatEndOnOption:"On",repeatEndAfterOption:"After",repeatEndAfter:"occurrence(s)",hidden:"Hidden",hourly:"Hourly",daily:"Daily",weekly:"Weekly",monthly:"Monthly",yearly:"Yearly",repeatConfirm:"Do you want to edit only the current event or the whole series ?",repeatConfirmLabel:"Edit Repeating Event",create:"Create new",edit:"Edit",cut:"Cut",copy:"Copy",paste:"Paste",editEvent:"Edit event",editSeries:"Edit series",eventException:"Event Exception",collector:"more",repeatEveryHour:"hours",repeatEveryDay:"days",repeatEveryWeek:"weeks",repeatEveryMonth:"months",repeatEveryYear:"years",backgroundColor:"Background Color",status:"Status",resources:"Resources",selectPlaceholder:"Select...",none:"None",free:"Free",busy:"Busy",tentative:"Tentative",outOfOffice:"Out of Office",exceptions:"Exceptions",resetExceptions:"Reset Exceptions",notifications:"Notification(s)",notificationMessage:"is starting on",today:"Today",agendaShortcut:"A",dayShortcut:"D",weekShortcut:"W",monthShortcut:"M",timelineDayShortcut:"T+D",timelineWeekShortcut:"T+W",timelineMonthShortcut:"T+M",showWeekends:"Show weekends",beforeAt:"before at",days:"days",weeks:"weeks",placeholder:"Add notification",placeholderLink:"Add video conferencing",placeholderSetLink:"Set video conferencing link",invalidConferenceLink:"Invalid video conference link.",now:"Now",dateTabLabel:"DATE",timeTabLabel:"TIME",hours:"Hours",minutes:"Minutes",am:"am",pm:"pm",loadingIndicatorPlaceholder:"Loading...",duplicate:"Copy",deleteConfirm:"Do you want to delete only the current event or the whole repeating series ?",deleteConfirmLabel:"Delete Repeating Event",deleteConfirmEvent:"Delete Event",deleteConfirmSeries:"Delete Series",joinWith:"Join with {{value}}",join:"Join the meeting"}},type:"object"},minuteFormat:{value:"2-digit",allowedValues:["numeric","2-digit"],type:"string"},monthFormat:{value:"long",allowedValues:["2-digit","numeric","long","short","narrow"],type:"string"},mouseWheelStep:{value:50,type:"number"},nonworkingDays:{value:[],type:"array",validator:"_nonworkingDayValidator"},nonworkingHours:{value:[],type:"array",validator:"_nonworkingTimeValidator"},notificationInterval:{value:60,validator:"_currentTimeIndicatorIntervalValidator",type:"number"},resizeHandlesVisibility:{allowedValues:["auto","hidden","visible"],value:"auto",type:"string"},resizeInterval:{value:0,type:"number"},resources:{value:[],type:"any",reflectToAttribute:!1},restrictedDates:{value:[],type:"array",validator:"_datesValidator"},restricted:{value:[],type:"array"},restrictedHours:{value:[],type:"array",validator:"_nonworkingTimeValidator"},scrollButtonsPosition:{value:"near",allowedValues:["near","far","both"],type:"string"},shadeUntilCurrentTime:{value:!1,type:"boolean"},showLegend:{value:!1,type:"boolean"},sortBy:{value:null,type:"string?"},sortFunction:{value:null,type:"function?"},sortOrder:{allowedValues:["asc","desc","custom"],value:"asc",type:"string"},spinButtonsDelay:{value:80,type:"number"},spinButtonsInitialDelay:{value:0,type:"number"},statuses:{value:[{label:"None",value:void 0},{label:"Free",value:"free"},{label:"Tentative",value:"tentative"},{label:"Busy",value:"busy"},{label:"Out of Office",value:"outOfOffice"}],type:"array"},timelineHeaderFormatFunction:{value:null,type:"function?",reflectToAttribute:!1},timelineDayScale:{value:"hour",allowedValues:["hour","halfHour","quarterHour","tenMinutes","fiveMinutes"],type:"string"},timeRulerTicks:{value:!1,type:"boolean"},timeZone:{value:"local",type:"string",validator:"_timeZoneValidator"},timeZones:{value:[],type:"array",validator:"_timeZonesValidator"},tooltipDelay:{value:0,type:"number"},tooltipOffset:{value:[],type:"array"},undoRedoSteps:{value:100,type:"number"},view:{value:"day",type:"string",validator:"_viewValidator"},viewType:{allowedValues:["agenda","day","week","month","timelineDay","timelineWeek","timelineMonth"],defaultReflectToAttribute:!0,value:"day",type:"string",validator:"_viewTypeValidator"},views:{value:["day","week","month"],type:"array",validator:"_viewsValidator"},viewSelectorType:{allowedValues:["auto","tabs","menu"],value:"menu",type:"string"},viewStartDay:{value:"firstDayOfWeek",type:"string",allowedValues:["dateCurrent","firstDayOfWeek"]},weekdayFormat:{value:"short",allowedValues:["long","short","narrow"],type:"string"},yearFormat:{value:"numeric",allowedValues:["2-digit","numeric"],type:"string"},windowCustomizationFunction:{value:null,reflectToAttribute:!1,type:"function?"}}}template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-scheduler-header" role="heading" aria-level="1">\n <div id="dateSelectorContainer" class="smart-scheduler-date-nav" role="presentation">\n <smart-button today id="todayDate" right-to-left="[[rightToLeft]]" class="smart-scheduler-nav"></smart-button>\n <smart-repeat-button prev id="previousDate" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]"\n aria-label="Previous date" class="smart-scheduler-nav"></smart-repeat-button>\n <smart-repeat-button next id="nextDate" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]"\n aria-label="Next date" class="smart-scheduler-nav"></smart-repeat-button>\n <smart-button current id="currentDate" right-to-left="[[rightToLeft]]" class="smart-scheduler-nav"></smart-button>\n </div>\n <div id="viewSelectorContainer" class="smart-scheduler-view-nav" role="presentation">\n <div id="viewItemsContainer" class="smart-scheduler-items-container" role="listbox" aria-label="View Items"></div>\n <smart-button id="viewItemsButton" class="smart-scheduler-view-items-button smart-visibility-hidden"\n aria-label="View Selector DropDown" right-to-left="[[rightToLeft]]"></smart-button>\n </div>\n </div>\n <div class="smart-scheduler-view-container" id="viewContent" role="presentation">\n <div id="timeline" class="smart-scheduler-view">\n <div id="timelineHeaderHorizontal" class="smart-scheduler-view-header-horizontal" role="rowgroup">\n <div class="smart-scheduler-view-time-container" id="timelineViewCellsContainer" role="row">\n <div class="smart-scheduler-view-label-container" id="timelineViewCellsLabelContainer" role="presentation"></div>\n <div class="smart-scheduler-view-header-horizontal-content" id="timelineHeaderHorizontalContent" role="presentation">\n <div class="smart-scheduler-view-details" role="row"></div>\n <div class="smart-scheduler-view-time" role="row">\n <div class="smart-scheduler-cells" role="presentation"></div>\n </div>\n </div>\n </div>\n <div class="smart-scheduler-view-all-day" id="timelineViewAllDay" role="row">\n <div class="smart-scheduler-view-all-day-label-container" id="timelineAllDayLabelContainer" role="presentation">\n <div class="smart-scheduler-view-all-day-label" id="timelineViewAllDaylabel" role="presentation"></div>\n <div class="smart-scheduler-time-zone-container" id="timelineTimeZoneLabelContainer"></div>\n </div>\n <div class="smart-scheduler-view-all-day-content" id="timelineViewAllDayContent" role="presentation">\n <div class="smart-scheduler-cells-container" id="timelineViewAllDayCellsContainer" role="row"></div>\n <div class="smart-scheduler-events-container" id="allDayEventsContainer" role="menu"></div>\n </div>\n </div>\n </div>\n <div id="timelineHeaderVertical" class="smart-scheduler-view-header-vertical" role="rowgroup">\n <div class="smart-scheduler-view-header-vertical-content" id="timelineHeaderVerticalContent" role="presentation">\n <div class="smart-scheduler-view-time" role="row">\n <div class="smart-scheduler-cells" role="presentation"></div>\n </div>\n </div>\n </div>\n <div id="timelineContainer" class="smart-scheduler-scrollable-container" role="rowgroup">\n <div id="timelineContent" class="smart-scheduler-content" role="presentation">\n <div id="timelineCellsContainer" class="smart-scheduler-cells-container" role="presentation"></div>\n <div id="timelineEventsContainer" class="smart-scheduler-events-container" role="menu"></div>\n <div id="timelineIndicatorsContainer" class="smart-scheduler-indicators-container" role="presentation"></div>\n </div>\n </div>\n </div>\n <smart-scroll-bar wait id="verticalScrollBar" class="smart-scheduler-view-scroll-bar" orientation="vertical"\n right-to-left="[[rightToLeft]]" aria-controls="[[id]]" animation="[[animation]]"></smart-scroll-bar>\n <smart-scroll-bar wait id="horizontalScrollBar" class="smart-scheduler-view-scroll-bar"\n right-to-left="[[rightToLeft]]" aria-controls="[[id]]" animation="[[animation]]"></smart-scroll-bar>\n </div>\n <div id="footer" class="smart-scheduler-footer"></div>\n <smart-tooltip id="tooltip" class="smart-scheduler-tooltip" role="presentation" position="auto" arrow open-mode="manual"\n right-to-left="[[rightToLeft]]" delay="[[tooltipDelay]]" offset="[[tooltipOffset]]"></smart-tooltip>\n </div>'}static get listeners(){return{down:"_downHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","document.dragstart":"_dragStartHandler","container.click":"_containerClickHandler","container.contextmenu":"_containerContextMenuHandler","container.wheel":"_mouseWheelHandler","horizontalScrollBar.change":"_horizontalScrollbarHandler","verticalScrollBar.change":"_verticalScrollbarHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",move:"_moveHandler",dragover:"_dragoverHandler",drop:"_dropHandler",resize:"_resizeEventHandler","tooltip.open":"_tooltipVisibilityHandler","tooltip.opening":"_tooltipVisibilityHandler","tooltip.closing":"_tooltipVisibilityHandler","tooltip.close":"_tooltipVisibilityHandler","tooltip.change":"_tooltipChangeHandler","tooltip.click":"_tooltipClickHandler","tooltip.keydown":"_tooltipKeyDownHandler","tooltip.keyup":"_tooltipKeyUpHandler","tooltip.down":"_tooltipDownHandler","tooltip.contextmenu":"_tooltipContextMenuHandler","timeline.focus":"_timelineFocusHandler","timeline.focusin":"_timelineFocusHandler","timeline.focusout":"_timelineFocusHandler"}}static get styleUrls(){return["smart.scheduler.css"]}static get requires(){return{"Smart.Window":"smart.window.js","Smart.Calendar":"smart.calendar.js","Smart.Tooltip":"smart.tooltip.js"}}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const i=this;switch(e){case"contextMenuClipboardActions":{const e=i.$.tooltip;e.visible&&e.contains(i._contextList)&&i._getContextMenu(e.selector);break}case"dataSource":i._handleDataAdapter(),i._createEvents(),i._createTimeline(),i.closeWindow();break;case"disabled":i._setFocusable(),i._refreshEvents();break;case"disableSelection":i._handleCellSelection();break;case"disableContextMenu":case"disableDateMenu":case"disableEventMenu":case"disableViewMenu":i.$.tooltip.close();break;case"disableWindowEditor":i.closeWindow();break;case"currentTimeIndicator":case"shadeUntilCurrentTime":i._setCurrentTimeIndicators();break;case"eventRenderMode":i._refreshEvents();break;case"filter":case"filterable":case"filterMode":if("filter"===e){const e=i._legend;e&&i.$.container.contains(e)&&e.querySelectorAll(".smart-scheduler-legend-res-item").forEach((e=>{e.removeAttribute("unselected"),e.setAttribute("aria-selected",!0)})),delete i._eventsBetween,i._createTimeline()}else i._refreshTimelineEvents();break;case"autoHeightAllDayCells":case"firstDayOfWeek":case"viewStartDay":case"max":case"min":i._calendar&&(i._calendar[e]=n),i._createTimeline(),i._refreshDateNavButtons();break;case"maxEventsPerCell":i._refreshEvents();break;case"hideAllDay":["day","week"].indexOf(i.viewType)>-1&&i._createTimeline();break;case"hideOtherMonthDays":i._refreshTimelineEvents();break;case"hideWeekend":case"hideNonworkingWeekdays":i._checkHideWekendItem(),i.viewType.toLowerCase().indexOf("day")<0&&i._createTimeline();break;case"hideViewMenuCheckableItems":i._refreshViewSelector();break;case"timeZone":i._events.forEach((e=>i._setEventTimeZone(e,t))),i._createTimeline();break;case"timeZones":i._createTimeline();break;case"dateCurrent":case"groups":case"groupOrientation":case"hourStart":case"hourEnd":case"nonworkingDays":case"nonworkingHours":case"timelineDayScale":case"resources":case"rightToLeft":{const t=i.$.schedulerWindow,r=i.$.confirmSchedulerWindow;if([i.$.toast,i.$.tooltip,i._calendar,i._list,t,r].forEach((t=>t?t[e]=n:void 0)),t&&t.opened){const i=t.querySelectorAll(".smart-element[event-editor]"),r=n?"left":"right";for(let t=0;t<i.length;t++){const a=i[t];a[e]=n,a.calendarButtonPosition?a.calendarButtonPosition=r:"none"!==a.dropDownButtonPosition&&(a.dropDownButtonPosition=r)}}"resources"===e&&i._setLegend(),i._createTimeline(),i._refreshDateSelector();break}case"sortBy":case"sortOrder":case"sortFunction":i._createTimeline();break;case"undoRedoSteps":delete i._undoRedoHistory;break;case"view":i._handleViewSelection(),i._createTimeline(),i._refreshDateSelector(),i._scrollToView(),i.$.fireEvent("viewChange",{oldValue:t,value:n});break;case"views":i._refreshViewSelector();break;case"viewSelectorType":i._setHeader();break;case"headerTemplate":i._setHeader(),i._createTimeline();break;case"footerTemplate":i._setFooter(),i._createTimeline();break;case"cellTemplate":case"groupTemplate":i._templates&&delete i._templates[e],i._createTimeline();break;case"unfocusable":i._setFocusable(),i._refreshEvents();break;case"hourFormat":case"minuteFormat":case"dayFormat":case"monthFormat":case"weekdayFormat":case"yearFormat":case"dateSelectorFormatFunction":case"timelineHeaderFormatFunction":case"messages":case"locale":{i._createTimeline(),i._setHeader(),i._calendar&&"locale"===e&&(i._calendar[e]=n);const t=i.$.schedulerWindow,r=i.$.confirmSchedulerWindow;if(t&&t.opened){const e=t._target;t.close(),i._openWindow(e.event,e.originalTarget)}else if(r&&r.opened){const e=r._target;r.close(),i._openWindow(e.event,e.originalTarget)}break}case"legendLocation":case"showLegend":i._setLegend(),i._createTimeline();break;case"restrictedDates":case"restrictedHours":delete i._eventsBetween,i._createTimeline();break;case"windowCustomizationFunction":{const e=i.$.schedulerWindow||i.$.confirmSchedulerWindow;if(!e)return;if(null===n)e.clear();else if(e.opened){const t=e===i.$.confirmSchedulerWindow?"confirm":"";i.windowCustomizationFunction(e,t,i._cloneObject(e._target))}break}}}attached(){const e=this;super.attached(),e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e.$.timeline,e.$.horizontalScrollBar,e.$.verticalScrollBar));const t=[e.$.schedulerWindow,e.$.confirmSchedulerWindow],n=e.$.tooltip;n.visible&&e.getShadowRootOrBody().appendChild(n);for(let n=0;n<t.length;n++){const i=t[n];if(i&&i.opened){const t=e.$schedulerWindow;e._handleModal(!0),t.listen("open",e._windowOpenHandler.bind(e)),t.listen("close",e._windowCloseHandler.bind(e)),t.listen("closing",e._windowClosingHandler.bind(e)),t.listen("click",e._windowClickHandler.bind(e)),t.listen("change",e._windowChangeHandler.bind(e)),t.listen("keydown",e._windowKeyDownHandler.bind(e)),i.hasAnimation&&i.listen("transitionend",e._windowTransitionendHandler.bind(e)),e.getShadowRootOrBody().appendChild(i)}}e.$.container.contains(e.$.toast)||e._checkNotifications(!0)}detached(){const e=this;super.detached(),e._scrollView&&(e._scrollView.unlisten(),e._scrollView.disableSwipeScroll=!1,delete e._scrollView),e._touchmoveInside=!1,delete e._dragDetails,Smart.Scheduler.schedulerStart===e&&(Smart.Scheduler.feedback.remove(),delete Smart.Scheduler.schedulerStart,delete Smart.Scheduler.hoveredCell,delete Smart.Scheduler.hoveredScheduler,delete Smart.Scheduler.feedback);const t=[e.$.schedulerWindow,e.$.confirmSchedulerWindow],n=e.$.tooltip;e.$.container.contains(n)||e.$.container.appendChild(n),e._removeToast();for(let n=0;n<t.length;n++){const i=t[n];if(e._handleModal(),i){i.remove();const t=i===e.$.schedulerWindow?e.$schedulerWindow:e.$confirmSchedulerWindow;t.unlisten("open"),t.unlisten("close"),t.unlisten("closing"),t.unlisten("click"),t.unlisten("change"),t.unlisten("keydown"),t.unlisten("transitionend")}}}ready(){this._customScrollView=!0,super.ready()}render(){const e=this,t=e.viewType.toLowerCase();0!==e.firstDayOfWeek&&t.indexOf("week")>-1&&e.dateCurrent&&e.dateCurrent.getDay()!==e.firstDayOfWeek&&(e.dateCurrent=e.dateCurrent.setDate(e.dateCurrent.getDate()-e.dateCurrent.getDay()-7+e.firstDayOfWeek)),e._isViewUpdated=!0,e._setViewType(e.view),delete e._isViewUpdated,e.hasAttribute("role")||e.setAttribute("role","grid"),window.rrule&&window.rrule.RRule||e.error(e.localize("missingReference",{elementType:e.nodeName.toLowerCase(),files:"rrule.min.js"})),e._rRule=window.rrule.RRule,Smart.Utilities.Core.isMobile&&(e._isMobile=!0,e.$.timeline.setAttribute("mobile","")),e._handleDataAdapter(),e._setFocusable(),e._setScrollBars(),e._setHeader(),e._setFooter(),e._createEvents(),e._createTimeline(),e.checkLicense(),super.render()}get events(){const e=this,t=e._events;return e.isReady&&t&&t.length?t.map((t=>e._cloneObject(t))):[]}addEvent(e){this.insertEvent(e)}containsEvent(e){return!!this._containsEvent(e)}clearState(){const e=this;e.id?window.localStorage.removeItem("smartScheduler"+e.id):e.warn(e.localize("noId"))}getState(){const e=this,t=e._events||[];return{dateCurrent:e.dateCurrent.toISOString(),dataSource:JSON.parse(JSON.stringify(t.map((t=>e._cloneObject(t,!0))))),timeZone:e.timeZone}}loadState(e){const t=this;if(!e){if(!t.id)return;e=JSON.parse(window.localStorage.getItem("smartScheduler"+t.id))}if(!e)return;let n=JSON.parse(JSON.stringify(e.dataSource)),i=new Date(e.dateCurrent),r=e.timeZone;i instanceof Date&&!isNaN(i.getTime())&&(t.set("dateCurrent",i),t._refreshDateSelector()),Array.isArray(n)&&(t.set("dataSource",n),t._createEvents(void 0,r),t._createTimeline())}saveState(e){const t=this;t.id?(e||(e=t.getState()),window.localStorage.setItem("smartScheduler"+t.id,JSON.stringify(e))):t.warn(t.localize("noId"))}createEvent(e,t,n,i,r,a=""){const l={label:e,value:t,id:t,dateStart:n,dateEnd:i,description:a,allDay:r};this.addEvent(l)}insertEvent(e,t){const n=this,i=n._events;if(i.indexOf(e)>-1||n._containsEvent(e))return;const r=n._createEvents(Array.isArray(e)?e:[e])[0];if(!r)return;const a=n._cloneObject(r);n.$.fireEvent("itemChanging",{type:"inserting",item:a}).defaultPrevented||("number"==typeof t?i.splice(Math.max(0,Math.min(i.length,t)),0,r):i.push(r),n._isUpdating||(n._refreshTimelineEvents(),n._updateUndoRedo(void 0,n._cloneObject(r),"itemInsert"),n.$.fireEvent("itemInsert",{item:a}),n.$.fireEvent("itemChange",{type:"insert",item:a})))}updateEvent(e,t){const n=this,i=n._events;if(!(e="number"==typeof e&&i?i[e]:n._containsEvent(e)))return;const r=n._cloneObject(e);if(!n.$.fireEvent("itemChanging",{type:"updating",item:r}).defaultPrevented){for(let n in t)e[n]=t[n];e.dateStart=n._dateValidator(void 0,e.dateStart),e.dateEnd=n._dateValidator(void 0,e.dateEnd),e.dateEnd=new Date(Math.max(e.dateStart.getTime(),e.dateEnd.getTime())),n._isUpdating||(n._refreshTimelineEvents(),n.$.fireEvent("itemUpdate",{item:r}),n.$.fireEvent("itemChange",{type:"update",item:r}))}}removeEvent(e){const t=this,n=t._events;if(!(e="number"==typeof e&&n?n[e]:t._containsEvent(e)))return;const i=t._cloneObject(e);t.$.fireEvent("itemChanging",{type:"removing",item:i}).defaultPrevented||(n.splice(n.indexOf(e),1),t._isUpdating||(t._refreshTimelineEvents(),t._updateUndoRedo(t._cloneObject(e),void 0,"itemRemove"),t.$.fireEvent("itemRemove",{item:i}),t.$.fireEvent("itemChange",{type:"remove",item:i})))}getEventExceptions(e){const t=this,n=t._events;if(!(e="number"==typeof e&&n?n[e]:t._containsEvent(e))||!e.repeat)return[];const i=e.repeat.exceptions;return i&&i.length?i:[]}addEventException(e,t){const n=this,i=n._events;if(!(e="number"==typeof e&&i?i[e]:n._containsEvent(e))||!e.repeat)return[];if(!(t&&"object"==typeof t&&t.date instanceof Date))return;const r=t.date;let a=e.repeat.exceptions;a||(a=e.repeat.exceptions=[]),delete t.repeat;for(let e=0,t=a.length;e<t;e+=1)if(a[e].date.getTime()===r.getTime())return void n.error(n.localize("exceptionExists",{elementType:n.nodeName.toLowerCase(),elementMethod:"addEventException"}));n.$.fireEvent("itemChanging",{type:"exceptionInserting",item:n._cloneObject(e)}).defaultPrevented||(a.push(t),n._isUpdating||(n._refreshTimelineEvents(),n.$.fireEvent("itemChange",{type:"exceptionInsert",item:n._cloneObject(e)})))}updateEventException(e,t,n){const i=this,r=i._events;if(!(e="number"==typeof e&&r?r[e]:i._containsEvent(e))||!e.repeat||null==t||!n||"object"!=typeof n)return[];const a=e.repeat.exceptions;if(!a||!a.length)return[];let l;if("number"==typeof t&&(l=a.indexOf(t)),!l){const e=t instanceof Date?t:new Date(n.date);for(let n=0,i=a.length;n<i;n+=1){const i=a[n];if(n===t&&(l=i),i.id===t||i.date.getTime()===e.getTime()){l=i;break}}}if(l){if(i.$.fireEvent("itemChanging",{type:"exceptionUpdating",item:i._cloneObject(e)}).defaultPrevented)return;for(let e in n)"date"!==e&&"repeat"!==e&&"$"!==e&&(l[e]="dateStart"===e||"dateEnd"===e?i._dateValidator(void 0,n[e]):n[e]);if(l.dateEnd=new Date(Math.max(l.dateStart.getTime(),l.dateEnd.getTime())),i._isUpdating)return;i._refreshTimelineEvents(),i.$.fireEvent("itemChange",{type:"exceptionUpdate",item:i._cloneObject(e)})}}removeEventException(e,t){const n=this,i=n._events;if(!(e="number"==typeof e&&i?i[e]:n._containsEvent(e))||!e.repeat)return;const r=e.repeat.exceptions;if(!r||!r.length)return;let a=r.indexOf(t);if(a<0){const e=new Date(t);for(let n=0,i=r.length;n<i;n+=1){const i=r[n];if(n===t&&(a=n),i.id===t||i.date.getTime()===e.getTime()){a=n;break}}}if(a>-1){if(n.$.fireEvent("itemChanging",{type:"exceptionRemoving",item:n._cloneObject(e)}).defaultPrevented)return;if(r.splice(a,1),r.length||delete e.repeat.exceptions,n._isUpdating)return;n._refreshTimelineEvents(),n.$.fireEvent("itemChange",{type:"exceptionRemove",item:n._cloneObject(e)})}}exportData(e,t){const n=this;if(!Smart.Utilities.DataExporter)return void n.error(n.localize("missingReference",{elementType:n.nodeName.toLowerCase(),methodName:"exportData",files:"smart.export.js"}));try{new JSZip}catch(e){return void n.error(n.localize("missingReference",{elementType:n.nodeName.toLowerCase(),methodName:"exportData",files:"jszip.min.js"}))}if("pdf"===e&&!window.pdfMake)return void n.error(n.localize("missingReference",{elementType:n.nodeName.toLowerCase(),methodName:"exportData",files:"pdfMake.min.js"}));const i=n._events;if(!i||!i.length)return;if("ical"===(e+"").toLowerCase())return n._exportToICal(t);const r=new Smart.Utilities.DataExporter({exportHeader:n.dataExport.header,pageOrientation:n.dataExport.pageOrientation,style:n.dataExport.style}),a=n._getExportRecord();let l={columns:[]};for(let e in a)l.columns.push({label:a[e],dataField:e});r.header=l,n._setExportStyles(r,e);let o=[];for(let e=0;e<i.length;e++)o.push(n._getExportRecord(i[e]));return r.exportData(o,e,n.dataExport.fileName,t)}getDataSource(){const e=this,t=e._events;return t&&t.length?JSON.parse(JSON.stringify(t.map((t=>e._cloneObject(t,!0))))):""}getResources(){const e=this.resources;return e&&e.length?JSON.parse(JSON.stringify(e)):""}print(){const e=this,t=e.dataExport.fileName;e.dataExport.fileName=null;const n=e.exportData("html"),i=window.open("","","width=800,height=500"),r=i.document.open(),a='<!DOCTYPE html><html><head><meta charset="utf-8" /><title>'+t+"</title></head><body>"+n+"</body></html>";try{r.write(a),r.close(),setTimeout((function(){i.print(),i.close()}),100)}catch(e){}e.dataExport.fileName=t}refresh(e){const t=this;e?t.isRendered&&t._createTimeline():t._refresh()}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=!0,e.$.fireEvent("beginUpdate"))}endUpdate(){const e=this;e._isUpdating&&(e._refreshTimelineEvents(),e.$.fireEvent("endUpdate"))}addView(e,t,n,i,r,a){const l=this,o={label:t,type:e,value:n,hideWeekend:i,hideNonworkingWeekdays:r,additionalDays:a};l.views.push(o),l._refreshViewSelector(),l.refresh()}setView(e){const t=this,n=t.view,i=t.views.find((t=>t.value&&t.value===e));e!==n&&(t.set("view",e),e=i?i.type:e,t._createTimeline(),t._refreshDateSelector(),t._checkHideWekendItem(),t._scrollToView(i),t._handleViewSelection(),t.$.fireEvent("viewChange",{oldValue:n,value:e}))}scrollToDate(e,t,n){const i=this;if(e instanceof Date)e=new Date(e);else{if(e instanceof HTMLElement&&(!e.classList.contains("smart-scheduler-cell")||!i.$.timeline.contains(e)))return;if("object"==typeof e){const t=new Date(i.dateCurrent);e.year=void 0!==e.year?e.year:t.getFullYear(),e.month=void 0!==e.month?e.month:t.getMonth(),e.date=void 0!==e.date?e.date:t.getDate(),e=new Date(e.year,e.month,e.date,e.hours,e.getMinutes)}else if("string"==typeof e){if(e.indexOf("Date")>=0){e=(e=e.replace("new Date(","").replace(")","")).split(", ");let t="";for(let n=0;n<e.length;n++)t+=e[n],n<2?t+="-":2===n?t+=" ":n<e.length-1&&(t+=":");e=t}e=new Date(e)}}e&&!isNaN(e.getTime())&&i._scrollTo(e,t,n)}scrollToEvent(e){const t=this,n=t._events;(e="number"==typeof e&&n?n[e]:t._containsEvent(e))&&t._scrollTo(e)}openNotification(e,t){const n=this;if(!(e+=""))return;n._setToast();const i=n.$.toast;if(i){if("object"==typeof t)for(let e in t)i[e]=t[e];n._appendToast(),i.open(e)}}closeNotifications(){this._checkNotifications(!0)}openWindow(e){const t=this;let n=e;if(void 0===e||"object"==typeof e){if(e=t._containsEvent(e))return void t._openWindow(e);e=new Date(t.dateCurrent)}else if("string"==typeof e){if(n=t._events.find((t=>t.id+""===e)),n)return void t._openWindow(n);n||(n=new Date(e))}else if("number"==typeof e)return n=t._events[e],void(n&&t._openWindow(n));if(e instanceof Date){if(isNaN(e.getTime()))return;e={dateStart:new Date(t.dateCurrent)}}"object"!=typeof e||e.dateStart||(e.dateStart=new Date(t.dateCurrent)),(e=t._createEvents([e]))&&t._openWindow(e[0])}closeWindow(){const e=this.$.confirmSchedulerWindow,t=this.$.schedulerWindow;t&&(t.close(),delete t._target),e&&(e.close(),delete e._target)}occurrences(e,t=100){const n=this,i=n._events,r=n._rRule;if("number"==typeof e&&i)e=i[e];else{const t=n._containsEvent(e);t&&(e=t)}if(!e)return;const a=n._getEventRepeatOptions(e);return a?(t=parseInt(t),t=isNaN(t)?100:t,new r(a).all(((e,n)=>!(!a.count&&n===t))).map((e=>new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds())))):void 0}occurrencesBetween(e,t,n){const i=this,r=i._events,a=i._rRule;if("number"==typeof e&&r)e=r[e];else{const t=i._containsEvent(e);t&&(e=t)}if(!e||isNaN(new Date(t).getTime())||isNaN(new Date(n).getTime()))return;const l=i._getEventRepeatOptions(e);return l?(t=new Date(Math.min(t.getTime(),n.getTime())),n=new Date(Math.max(t.getTime(),n.getTime())),new a(l).between(new Date(Date.UTC(...i._getDateArgs(t))),new Date(Date.UTC(...i._getDateArgs(n))),!0).map((e=>new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds())))):void 0}occurrenceAfter(e,t){return this._occurrence(e,t,"after")}occurrenceBefore(e,t){return this._occurrence(e,t,"before")}getCellDateRange(e){if(e&&this.$.timelineCellsContainer.contains(e)&&e.classList.contains("smart-scheduler-cell"))return e.classList.contains("scale")&&(e=e.children[0]),this._getCellDateRange(e)}undo(e){return this._handleUndoRedo("undo",e)}redo(e){return this._handleUndoRedo("redo",e)}deleteUndoRedoHistory(){this._updateUndoRedo()}canUndo(){return this._isUndoPossible()}canRedo(){return this._isRedoPossible()}_occurrence(e,t,n){const i=this,r=i._rRule;if(!r||!e||isNaN(new Date(t).getTime()))return;const a=i._getEventRepeatOptions(e);if(!a)return;const l=new r(a)[n](new Date(Date.UTC(...i._getDateArgs(t))),!0);return l?new Date(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate(),l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds()):void 0}openEventTooltip(e){const t=this,n=t.$.tooltip,i=t._events;if((e="number"==typeof e&&i?i[e]:t._containsEvent(e))&&n){const n=t.$.timeline.querySelectorAll(".smart-scheduler-event");for(let i=0;i<n.length;i++){const r=n[i].$?[n[i]]||0:void 0;if(r&&r.some((t=>{const n=t.$?t.$.event:void 0;return n&&(n===e||n.$&&n.$.event===e)}))){delete t._openEventMenu,t._handleTooltipContent(r[0]);break}}}}closeEventTooltip(){const e=this.$.tooltip;e.visible&&e.contains(this._eventList)&&e.close()}isEventRestricted(e){return e&&e.classList&&e.classList.contains("smart-scheduler-event")&&(e=e.$?e.$.event:void 0),!!(e&&e.dateStart instanceof Date&&e.dateEnd instanceof Date)&&this._isEventRestricted(e)}isDateRestricted(e){return e&&e.classList&&e.classList.contains("smart-scheduler-cell")&&(e=e.$&&e.$.cellObj?new Date(e.$.cellObj.time):void 0),!(!e||void 0===e.getTime||isNaN(e.getTime()))&&this._isDateRestricted(e)}isHourRestricted(e){return e&&e.classList&&e.classList.contains("smart-scheduler-cell")&&(e=e.$&&e.$.cellObj?new Date(e.$.cellObj.time):void 0),this._isHourRestricted(e)}_checkDoubleClick(e){const t=this;if(void 0===t._dblClickDetails&&(t._dblClickDetails={clicks:0}),clearTimeout(t._dblClickDetails.timeOut),e!==t._dblClickDetails.target&&(t._dblClickDetails.clicks=0),t._dblClickDetails.target=e,t._dblClickDetails.clicks++,t._dblClickDetails.timeOut=setTimeout((function(){t._dblClickDetails&&(t._dblClickDetails.clicks=0),t._openEventMenu&&(t._handleTooltipContent(t._openEventMenu),delete t._openEventMenu)}),250),2===t._dblClickDetails.clicks)return t._doubleClickHandler(e),t._dblClickDetails.clicks=0,delete t._openEventMenu,!0}_cloneObject(e,t,n){const i=this;let r={};for(let n in e){let a=e[n];if(a instanceof Date)r[n]=t?a.toISOString():new Date(a);else if("repeat"===n){if(r[n]=Object.assign({},a),r[n].exceptions){const e=r[n].exceptions=r[n].exceptions.slice();for(let t=0;t<e.length;t++)e[t]=i._cloneObject(e[t])}}else r[n]=a}return n||(delete r.$,r.repeat&&r.repeat.exceptions&&r.repeat.exceptions.forEach((e=>delete e.$))),r}_doubleClickHandler(e){const t=this;if(t.disabled||t.disableWindowEditor)return;const n=t.$.tooltip;let i=e.closest?e.closest(".smart-scheduler-cell:not(.scale)"):void 0;if(t.$.timelineContainer.contains(i)||t.$.timelineViewAllDay.contains(i))t._openWindow();else if(i=e.classList.contains("smart-scheduler-event")?e:e.closest(".smart-scheduler-event-content"),i&&(t.$.timeline.contains(i)||n.contains(i))){i=i.closest(".smart-scheduler-event");let e=i&&i.$?i.$:void 0;if(!e||e.events)return;e=e.event;const r=e.$?e.$.event:void 0,a=r&&r.repeat?r.repeat.exceptions:void 0;let l;if(a&&a.indexOf(e)>-1)l=e;else{const t=i.$;l=r?Object.assign({},e,{dateStart:t.dateStart,dateEnd:t.dateEnd}):e}n.close(),t._openWindow(l,r?i:void 0)}}_createEventFromSelection(e){const t=this;if(e||(e=t._selectedCellObj),e instanceof HTMLElement&&e.$&&(e={from:e.$.cellObj,to:e.$.cellObj}),!e||!e.from)return;const n=e.from,i=e.to;if(t.hideOtherMonthDays&&new Date(n.time).getMonth()!==new Date(t.dateCurrent).getMonth())return;const r=new Date(Math.min(n.time,i.time)),a=new Date(Math.max(n.time,i.time)),l=n.horizontal.group||n.vertical.group;!n.allDay&&t.viewType.toLowerCase().indexOf("month")<0?a.setHours(a.getHours(),a.getMinutes()+60/t._getCellsScaleCount(),0,0):a.setHours(23,59,59,999);const o={allDay:!!n.allDay,dateStart:r,dateEnd:a};if(l)for(let e in l)o[e]=l[e];return t._isEventRestricted(o)?void 0:o}_downHandler(e){const t=this,n=t.$.tooltip,i=e.originalEvent;let r=t.shadowRoot||t.isInShadowDOM?i.composedPath()[0]:i.target;if(e.stopPropagation(),0===e.button&&n.contains(t._contextList)&&r&&r.closest&&!r.closest(".smart-scheduler-nav[current]")&&!r.closest(".smart-scheduler-view-items-button")&&!n.contains(r)&&n.close(),t._dragDetails)return t._endDrag(),t._endResize(),delete t._dragDetails,clearInterval(t._scrollInterval),void delete t._scrollInterval;if(!t.$.timeline.contains(r)&&!t.$.tooltip.contains(r))return;if(t._isMobile&&(t.$.timelineContent.classList.add("hide-overlay"),r=(t.shadowRoot||document).elementFromPoint(i.pageX-window.pageXOffset,i.pageY-window.pageYOffset),t.$.timelineContent.classList.remove("hide-overlay")),!r||!r.closest)return;t._dragDetails={target:r,button:e.button,timestamp:Date.now()};const a=r.closest(".smart-scheduler-cell:not(.scale)");if(a&&a.$&&(t.$.timelineContainer.contains(a)||t.$.timelineViewAllDay.contains(a))){const n=a.$.cellObj;if(!n)return;if(t._dragDetails.timelineCellObj=Object.assign({},n),0===e.button&&t._checkDoubleClick(r))return;if(t._isMobile)return;if(0===e.button&&e.shiftKey&&t._selectedCellObj)t._handleCellSelection(t._selectedCellObj.from,n);else{if(0!==e.button&&t._isCellObjSelected(n))return;t._handleCellSelection(n)}return void(t._dragDetails.selectedCellObj=Object.assign({},t._selectedCellObj))}const l=r.closest(".smart-scheduler-event");if(l){if(0===e.button&&t._checkDoubleClick(r))return;t._dragDetails.schedulerEvent=l,t._dragDetails.coordinates={x:e.pageX,y:e.pageY},t._dragDetails.originialEvent=e,("visible"===t.resizeHandlesVisibility||t._isMobile&&"auto"===t.resizeHandlesVisibility)&&t._checkEventResizability(e)}}_dropHandler(e){const t=this,n=Smart.Scheduler.hoveredScheduler,i=Smart.Scheduler.hoveredCell,r=document.body;delete Smart.Scheduler.hoveredScheduler,delete Smart.Scheduler.hoveredCell,delete Smart.Scheduler.schedulerStart,delete Smart.Scheduler.feedback,n&&(n.removeAttribute("dragged"),clearInterval(n._scrollInterval),delete n._scrollInterval,i&&i.classList.remove("smart-scheduler-feedback")),i&&t.$.fireEvent("dropoverCell",{target:e.target,allDay:i.hasAttribute("all-day"),date:i.getAttribute("date")}),r.classList.remove("smart-dragging"),r.classList.remove("smart-dragging-disabled"),t._scrollView.disableSwipeScroll=t._touchmoveInside=!1,t._list&&(t._list.disableSwipeScroll=t._list._touchmoveInside=!1),delete t._dragDetails}_dragoverHandler(e){this._setDropTarget(e)}_documentMoveHandler(e){const t=this,n=e.originalEvent,i=t._dragDetails,r=Smart.Scheduler.schedulerStart;let a=t.shadowRoot||t.isInShadowDOM?n.composedPath()[0]:n.target;if(r)t._setDropTarget(e);else if(!i)return void t._checkEventResizability(e);if(i&&0===i.button)if(t.$.timeline.getAttribute("event-hovered"))t._handleEventResize(e);else if(t.disableDrag||!i.schedulerEvent||r){if(r===t){const n=t.dragOffset,i=Smart.Scheduler.feedback;if(!i)return;return i.parentElement||document.body.appendChild(i),t.rightToLeft?i.style.left=e.pageX-n[0]-i.offsetWidth+"px":i.style.left=e.pageX+n[0]+"px",void(i.style.top=e.pageY+n[1]+"px")}if(t._isMobile){const e=t.$.tooltip;r===t&&e.visible&&e.close()}else if(!t.disableSelection&&"agenda"!==t.viewType&&!e.shiftKey){Smart.Utilities.Core.Browser.Firefox&&(a=(t.shadowRoot||document).elementFromPoint(n.pageX-window.pageXOffset,n.pageY-window.pageYOffset));const e=i.timelineCellObj,r=t.$.timeline.contains(a)?a.closest(".smart-scheduler-cell:not(.scale)"):void 0;e&&r&&t._selectCell(e,r)}}else t._setDragStart(e)}_documentUpHandler(e){const t=this,n=e.originalEvent,i=t._dragDetails,r=n.pageX-window.pageXOffset,a=n.pageY-window.pageYOffset;let l=t.shadowRoot||t.isInShadowDOM?n.composedPath()[0]:n.target;if(t._isMobile&&(t.$.timelineContent.classList.add("hide-overlay"),l=(t.shadowRoot||document).elementFromPoint(r,a),t.$.timelineContent.classList.remove("hide-overlay")),t._upHandler(),clearInterval(t._scrollInterval),delete t._scrollInterval,i&&Smart.Scheduler.schedulerStart)return void t._endDrag(e,l);if(i&&t.hasAttribute("resized"))return void t._endResize(e);const o=t.$.tooltip;if(!o.visible||o.contains(l)||(t.shadowRoot||t).contains(l)||o.close(),l&&l.closest){if(!i){const e=t.$.schedulerWindow;return void(t.contains(l)&&l.classList.contains("smart-scheduler-window-modal")&&e&&e.focus())}{const n=l.closest(".smart-scheduler-event");if(i.schedulerEvent===n){t._handleCellSelection(),t.$.fireEvent("itemClick",{item:n,type:"event",itemObj:t._cloneObject(n.$.event)});const e=!t._isMobile||Date.now()-i.timestamp<250;!o.contains(l)&&e&&0===i.button&&(t._dblClickDetails&&0===t._dblClickDetails.clicks?(t._handleTooltipContent(n),delete t._openEventMenu):t.disableEventMenu?delete t._openEventMenu:t._openEventMenu=n)}else{delete t._openEventMenu;const n=o.selector;0!==i.button||e.shiftKey&&t._selectedCellObj||o.contains(l)&&n&&n.classList.contains("smart-scheduler-cell")||t._handleCellSelection(i.timelineCellObj,l)}}}delete t._dragDetails}_handleDataAdapter(){const e=this;if(e.dataSource&&e.dataSource instanceof Smart.DataAdapter){const t=e.querySelector(".smart-loader-container");if(t&&t.remove(),e.dataSource.url){const t=document.createElement("div");t.classList.add("smart-loader-container","smart-scheduler-loading-container"),t.innerHTML=`<span id='loadingIndicator' class='smart-scheduler-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label'>${e.localize("loadingIndicatorPlaceholder")}</span>`,e.appendChild(t)}e.dataSource.notify((function(t){if(e.dataSource._updating)return;const n=e.querySelector(".smart-loader-container");n&&n.remove();let i=t.data,r=t.index;switch(t.action){case"add":case"insert":i=e._parseAdapterData(i.length?i:[i]),e.insertEvent(i,r);break;case"update":i=e._parseAdapterData(i.length?i:[i]),e.updateEvent(r,i);break;case"remove":case"removeLast":e.removeEvent(void 0!==r?r:e._events.length-1);break;case"bindingComplete":e.dataSource.canNotify=!1,e.dataSource.dataSource=e._parseAdapterData(e.dataSource.toArray()).filter((e=>void 0!==e)),e.dataSource.canNotify=!0,e._createEvents(),e._createTimeline(),e.closeWindow()}}))}}_parseAdapterData(e){const t=this,n=["month","agenda"].indexOf(t.viewType.toLowerCase())>-1;Array.isArray(e)||(e=Array.from(e));for(let i=0;i<e.length;i++){const r=e[i],a=r.dateStart,l=r.dateEnd;let o=[];if(!n&&a instanceof Date&&l instanceof Date&&l.getTime()-a.getTime()>=864e5&&(r.allDay=!0),r.rrule&&t._parseIcalRrule(r),r.extdate){let e=r.extdate;e.indexOf("EXDATE:")>=0&&(e=e.substring(e.indexOf("EXDATE:")+7)),e.indexOf(",")>=0?o=e.split(","):o.push(e)}if(r.reccurenceId){const n=e.find((e=>e.uid===r.uid&&!e.reccurenceId));if(!n)continue;t._parseICalReccurenceId(r,n,o),e[i]=void 0}r.alarm&&t._parseICalAlarm(r),r.categories&&t._parseICalCategories(r)}return e}_parseIcalRrule(e){const t=this,n=t._rRule;if(!n)return;const i=n.parseString(e.rrule);let r;if(i){let a;switch(n.FREQUENCIES[i.freq].toLowerCase()){case"weekly":void 0!==i.byweekday&&(a=(Array.isArray(i.byweekday)?i.byweekday:Array.from(i.byweekday)).map((e=>(e.weekday+1+7)%7)));break;case"monthly":void 0!==i.bymonthday&&(a=i.bymonthday);break;case"yearly":void 0!==i.bymonth&&void 0!==i.bymonthday&&(a={month:i.bymonth-1,date:i.bymonthday})}e.repeat={repeatFreq:n.FREQUENCIES[i.freq].toLowerCase(),repeatInterval:i.interval,repeatOn:a},i.until instanceof Date?r=new Date(Date.UTC(...t._getUTCDateArgs(i.until))):"number"==typeof i.count&&(r=i.count),void 0!==r&&(e.repeat.repeatEnd=r)}}_parseICalReccurenceId(e,t,n){const i=e.reccurenceId;if(!e)return;const r=this._cloneObject(e);delete r.repeat,r.date=(e=>{let t;e.indexOf("VALUE=DATE:")>-1&&(e=e.replace("VALUE=DATE:",""),t=!0);const n=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!n)throw new Error("Invalid DATE value: "+e);return t?new Date(n[1],n[2]-1,n[3],0,0,0,0):new Date(Date.UTC(n[1],n[2]-1,n[3],n[5]||0,n[6]||0,n[7]||0))})(i),n.indexOf(r.date)>-1&&(r.hidden=!0),t.repeat&&(t.repeat.exceptions||(t.repeat.exceptions=[]),t.repeat.exceptions.push(r))}_parseICalAlarm(e){if(!e)return;const t=JSON.parse(e.alarm),n=e.dateStart.getTime();if(Array.isArray(t)){let i=[],r=/^(-)?P(\d+)DT(\d{1,2})H(\d{1,2})M(\d{1,2})S$/;for(let e=0;e<t.length;e++){const a=t[e],l=a.TRIGGER;if(r.test(l)){const e=r.exec(l);if(!e)continue;let t,o=parseInt(e[2]),s="-"===e[1]?-1:1,d=new Date(n);d.setDate(d.getDate()+s*o),d=new Date(d.getTime()+s*(1e3*(e[3]||0)*60*60+1e3*(e[4]||0)*60+1e3*(e[5]||0))),o>28?(o=Math.round(o/7),t="weeks"):t="days",i.push({interval:o,type:t,time:[d.getHours(),d.getMinutes()],message:a.description||""})}}delete e.alarm,e.notifications=i}}_parseICalCategories(e){e&&(e.categories.split(",").forEach((t=>{const n=t.split("/");void 0!==n[1]&&(e[n[0]]=parseInt(n[1]))})),delete e.categories)}_exportToICal(e){const t=this,n=t.id,i=t._rRule,r=t.resources,a=t._getUTCDate(new Date),l=t._events;let o=`BEGIN:VCALENDAR\r\nPRODID:-//HTMLElements//Smart Scheduler//EN\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\nMETHOD:PUBLISH\r\nX-WR-CALNAME:${n}\r\nX-WR-TIMEZONE:${t.timeZone}\r\n`;for(let e=0;e<l.length;e++){const s=l[e],d=t._getEventRepeatOptions(s,!0),c=r.filter((e=>s[e.value])),u=s.status,h=s.id?s.id:n+Math.floor(65536*(1+Math.random())).toString(16).substring(1);if(o+="BEGIN:VEVENT\r\n",o+=t._getICalEventDates(s),o+=`DTSTAMP:${a}\r\nUID:${h}\r\nCREATED:${a}\r\nDESCRIPTION:${s.description||""}\r\nTRANSP:${u&&"free"!==u?"OPAQUE":"TRANSPARENT"}\r\nSEQUENCE:0\r\nSTATUS:${t._getICalStatus(s.status)}\r\nSUMMARY:${s.label||""}\r\n`,c.length&&(o+=`CATEGORIES:${c.map((e=>`${e.value}/${s[e.value]}`)).toString()}\r\n`),o+=t._getICalNotifications(s),d){const e=s.repeat.exceptions;if(delete d.dtstart,o+=new i(d).toString()+"\r\n",e&&e.length){for(let n=0;n<e.length;n++){const i=e[n];i.hidden&&(o+=`EXDATE;VALUE=DATE:${t._getUTCDate(i.date,s.allDay)}\r\n`)}o+="END:VEVENT\r\n";for(let n=0;n<e.length;n++){const i=e[n];if(!i.hidden&&i.dateStart&&i.dateEnd){const e=r.filter((e=>i[e.vlaue]));o+="BEGIN:VEVENT\r\n",o+=t._getICalEventDates(i),o+=`DTSTAMP:${a}\r\nUID:${h}\r\nRECURRENCE-ID${s.allDay?";VALUE=DATE":""}:${t._getUTCDate(i.date,s.allDay)}\r\nCREATED:${a}\r\nDESCRIPTION:${i.description||""}\r\nSEQUENCE:1\r\nSTATUS:${t._getICalStatus(i.status)}\r\nSUMMARY:${i.label||""}\r\n`,e.length&&(o+=`CATEGORIES:${e.map((e=>`${e.value}/${i[e.value]}`)).toString()}\r\n`),o+="END:VEVENT\r\n"}}continue}}o+="END:VEVENT\r\n"}o+="END:VCALENDAR";const s=(new Smart.Utilities.DataExporter).downloadFile(o,"text/calendar",t.dataExport.fileName);return e&&s&&e(s),s}_getICalEventDates(e){const t=this;if(!e.dateStart||!e.dateEnd)return"";if(e.allDay||e.$&&e.$.event.allDay){const n=new Date(e.dateEnd);return n.setDate(n.getDate()+1),`DTSTART;VALUE=DATE:${t._getUTCDate(e.dateStart,!0)}\r\nDTEND;VALUE=DATE:${t._getUTCDate(n,!0)}\r\n`}return`DTSTART:${t._getUTCDate(e.dateStart)}\r\nDTEND:${t._getUTCDate(e.dateEnd)}\r\n`}_getICalNotifications(e){let t="";if(!e)return t;const n=e.notifications;if(n&&n.length){const i=e.dateStart.getTime();for(let e=0;e<n.length;e++){const r=n[e],a="days"===r.type||0===r.type?r.interval:7*r.interval,l=r.time,o=new Date(i-24*a*60*60*1e3);o.setHours(l[0]%23,l[1]%60,0,0);let s=o.getTime()-i;const d=s<0?"-":"";s=Math.abs(s);const c=Math.max(0,Math.floor(s/864e5));s-=1e3*c*60*60*24;const u=Math.max(0,Math.floor(s/36e5));s-=1e3*u*60*60;const h=Math.max(0,Math.floor(s/6e4));t+=`BEGIN:VALARM\r\nACTION:DISPLAY\r\nDESCRIPTION:${r.message}\r\nTRIGGER:${d}P${c}DT${u}H${h}M0S\r\nEND:VALARM\r\n`}}return t}_getUTCDate(e,t){function n(e){return e<10?`0${e}`:`${e}`}return e instanceof Date||(e=new Date(e)),t?`${e.getFullYear()}${e.getMonth()+1}${e.getDate()}`:`${e.getUTCFullYear()}${n(e.getUTCMonth()+1)}${n(e.getUTCDate())}T${n(e.getUTCHours())}${n(e.getUTCMinutes())}${n(e.getUTCSeconds())}Z`}_getICalStatus(e){switch(e){case"tentative":return"TENTATIVE";case"canceled":return"CANCELED";case"draft":return"DRAFT";case"final":return"FINAL";case"in-process":return"IN-PROCESS";case"needs-action":return"NEEDS-ACTION";default:return"CONFIRMED"}}_setDropTarget(e){const t=this,n=e.originalEvent?e.originalEvent:e;let i,r=t.shadowRoot||t.isInShadowDOM?n.composedPath()[0]:n.target,a=Smart.Scheduler.hoveredCell,l=Smart.Scheduler.hoveredScheduler;if((t.shadowRoot||t).contains(r)&&(l&&l!==t&&(l.removeAttribute("dragged"),clearInterval(l._scrollInterval),delete l._scrollInterval),Smart.Scheduler.hoveredScheduler=l=t,t.setAttribute("dragged","")),t._isMobile&&l&&(l.$.timelineContent.classList.add("hide-overlay"),r=(t.shadowRoot||document).elementFromPoint(n.pageX-window.pageXOffset,n.pageY-window.pageYOffset),l.$.timelineContent.classList.remove("hide-overlay")),r&&r.closest&&!r.closest(".smart-scheduler-groups-container")&&(i=r.closest(".smart-scheduler-cell:not(.scale)")),i&&i!==a&&(t.shadowRoot||t).contains(i)){const e=document.body;a&&a.classList.remove("smart-scheduler-feedback"),t.disableDrop&&delete Smart.Scheduler.hoveredCell,Smart.Scheduler.hoveredCell=i,i.hasAttribute("restricted")?(e.classList.remove("smart-dragging"),e.classList.add("smart-dragging-disabled")):(i.classList.add("smart-scheduler-feedback"),e.classList.remove("smart-dragging-disabled"),e.classList.add("smart-dragging")),Smart.Scheduler.hoveredScheduler=l=t}else i||(l!==t||t.$.container.contains(r)||(t.removeAttribute("dragged"),clearInterval(t._scrollInterval),delete t._scrollInterval,delete Smart.Scheduler.hoveredScheduler),a&&(a.classList.remove("smart-scheduler-feedback"),delete Smart.Scheduler.hoveredCell));l&&l._autoScroll(n)}_setDragStart(e){const t=this,n=t.$.tooltip,i=t._dragDetails;let r=!0;if(t._isMobile&&(r=Date.now()-i.timestamp>=250,n.contains(i.schedulerEvent)&&t._list?t._list.disableSwipeScroll=t._list._touchmoveInside=r:t._scrollView.disableSwipeScroll=t._touchmoveInside=r),!r||Math.abs(e.pageX-i.coordinates.x)<5&&Math.abs(e.pageY-i.coordinates.y)<5)return;if(i.schedulerEvent.hasAttribute("collector")||"agenda"===t.viewType||i.resizeDetails)return;const a=i.schedulerEvent.$.event;if(!a||a.disableDrag)return;const l=t._cloneObject(a);if(t.$.fireEvent("dragStart",{target:i.schedulerEvent,item:l,itemDateRange:{dateStart:new Date(l.dateStart),dateEnd:new Date(l.dateEnd)},originalEvent:i.originialEvent}).defaultPrevented)return;i.originalBodyOverflow={overflowX:document.body.style.overflowX,overflowY:document.body.style.overflowY,overflow:document.body.style.overflow};const o=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,s=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth;document.body.style.overflow=document.body.style.overflowX=document.body.style.overflowY="",o&&!s?document.body.style.overflowX="hidden":s&&!o?document.body.style.overflowY="hidden":s||o||(document.body.style.overflow="hidden"),n.contains(i.schedulerEvent)&&t._list&&(t._list.disableSwipeScroll=t._list._touchmoveInside=!0),n.close(),Smart.Scheduler.schedulerStart=t,Smart.Scheduler.feedback=t._createDragFeedback(l),t._dragDetails.schedulerEventObj=l,t._scrollView.disableSwipeScroll=t._touchmoveInside=!0,t.setAttribute("dragged",""),document.body.classList.add("smart-dragging")}_endDrag(e,t){const n=this;if(!Smart.Scheduler.schedulerStart)return;const i=n._dragDetails,r=Smart.Scheduler.schedulerStart,a=Smart.Scheduler.schedulerStart._dragDetails.schedulerEvent,l=Smart.Scheduler.schedulerStart._dragDetails.schedulerEventObj,o=Smart.Scheduler.hoveredScheduler,s=Smart.Scheduler.hoveredCell,d=document.body;if(r!==n)return;let c={};if(Smart.Scheduler.feedback.remove(),delete Smart.Scheduler.hoveredScheduler,delete Smart.Scheduler.hoveredCell,delete Smart.Scheduler.schedulerStart,delete Smart.Scheduler.feedback,i.originalBodyOverflow&&(d.style.overflow=i.originalBodyOverflow.overflow,d.style.overflowX=i.originalBodyOverflow.overflowX,d.style.overflowY=i.originalBodyOverflow.overflowY),o&&(o.removeAttribute("dragged"),clearInterval(o._scrollInterval),delete o._scrollInterval,s)){const t={event:e,schedulerEvent:a,hoveredCell:s,hoveredScheduler:o,schedulerEventObj:l};s.classList.remove("smart-scheduler-feedback"),n._setEventDropDates(t),n._completeEventDragDrop(t),c.dateStart=t.newDateStart,c.dateEnd=t.newDateEnd,i.schedulerEventObj=t.schedulerEventObj}e&&(n.$.fireEvent("dragEnd",{target:t,item:i.schedulerEventObj,itemDateRange:c,originalEvent:e}),n.$.fireEvent("itemChange",{type:"drag",item:i.schedulerEventObj})),d.classList.remove("smart-dragging"),d.classList.remove("smart-dragging-disabled"),r.removeAttribute("dragged"),n._scrollView.disableSwipeScroll=n._touchmoveInside=!1,n._list&&(n._list.disableSwipeScroll=n._list._touchmoveInside=!1);const u=n._handleEventFocus({type:"focusin",target:a});u&&u.focus({preventScroll:!0}),delete n._dragDetails}_endResize(e){const t=this,n=t._dragDetails,i=n?n.resizeDetails:void 0;if(t.removeAttribute("resized"),!n||!i)return;const r=n.schedulerEvent;let a={};r.removeAttribute("resized"),e?(t._setEventResizeDates(a),t._completeEventResize(a),i.schedulerEventObj.dateStart=a.dateStart,i.schedulerEventObj.dateEnd=a.dateEnd,t.$.fireEvent("resizeEnd",{target:n.schedulerEvent,item:i.schedulerEventObj,itemDateRange:a,originalEvent:e.originialEvent||e}),t.$.fireEvent("itemChange",{type:"resize",item:i.schedulerEventObj})):(r.style.left=i.originalPosition.x+"px",r.style.top=i.originalPosition.y+"px",r.style.width=i.originalSize.width+"px",r.style.height=i.originalSize.height+"px"),t._scrollView.disableSwipeScroll=t._touchmoveInside=!1,delete t._dragDetails,t._handleEventHover(),t._refreshTimelineEvents(),r.focus({preventScroll:!0}),t._handleEventFocus({type:"focusin",target:r})}_completeEventResize(e){const t=this,n=t._dragDetails,i=n.resizeDetails,r=i.cellObj,a=e.dateStart,l=e.dateEnd;if(!(r&&e&&a&&l))return;const o=n.schedulerEvent;let s=o.$.event;if(!o||!s||i.otherMonthDate||s.dateStart.getTime()===a.getTime()&&s.dateEnd.getTime()===l.getTime())return;if(t._isEventRestricted({dateStart:a,dateEnd:l}))return;const d=s.$&&s.$.event?s.$.event:void 0;let c;d?(c=t._cloneObject(d),t._handleEventExceptionDrop(s)):c=t._cloneObject(s);const u=s.dateStart.getTime()!==a.getTime();s.dateStart=new Date(a),s.dateEnd=new Date(l),["day","week"].indexOf(t.viewType)>-1&&s.allDay&&!i.isAllDay&&delete s.allDay,u&&(o.$.cellTime=a.getTime()),t._validateEventDateRange(s),t._updateUndoRedo(c,t._cloneObject(d||s),"resizeEnd")}_setEventResizeDates(e){const t=this,n=t._dragDetails,i=n.resizeDetails,r=i.cellObj;if(!r)return;const a=i.side,l=n.schedulerEvent,[o,s]="left"===a||"right"===a?["x","width"]:["y","height"];let d=l.$.event;if(!i.resizeFromMiddle&&i.originalPosition[o]===i.position[o]&&i.originalSize[s]===i.size[s])return e.dateStart=new Date(d.dateStart),void(e.dateEnd=new Date(d.dateEnd));const c=t.viewType,u=t.rightToLeft,h=60/t._getCellsScaleCount(),m=r.date,v=i.scaleIndex||0;let g,f;if("top"===a)f="dateStart",g=new Date(d.dateStart),g.setHours(m.getHours(),m.getMinutes()+h*v,0,0);else if("bottom"===a)f="dateEnd",g=new Date(d.dateEnd),g.setHours(m.getHours(),m.getMinutes()+h*(v+1),0,0);else{f="left"===a&&!u||"right"===a&&u?"dateStart":"dateEnd";const e=d[f];if("month"===c){const n=t._getCellObjOffset(l,i.position,"dateStart"===f?"bottom":"top").cellObj;g=new Date(e);const r=g.getHours(),a=g.getMinutes(),o="dateEnd"===f&&0===r&&0===a;g=new Date(n.date),g.setDate(g.getDate()+(m.getDay()-t.firstDayOfWeek+7)%7),o?g.setDate(g.getDate()+1):g.setHours(e.getHours(),e.getMinutes(),e.getSeconds())}else if(g=new Date(m),"timelineMonth"===c)"dateEnd"===f&&0===g.getHours()&&0===g.getMinutes()?(g.setDate(g.getDate()+1),g.setHours(0,0,0,0)):g.setHours(e.getHours(),e.getMinutes(),e.getSeconds());else if(["day","week"].indexOf(c)>-1&&i.isAllDay)g=new Date(m),"dateEnd"===f&&g.setHours(23,59,59,999);else{const e=t.view,n=t.views.find((t=>t.value&&t.value===e))||{};"timelineWeek"===c&&n&&n.hideHours?"dateEnd"===f?g.setHours(23,59,59,999):g.setHours(0,0,0,0):g.setMinutes(m.getMinutes()+h*(v+("dateStart"===f?0:1)),0,0)}}"dateStart"===f?(e.dateStart=g,e.dateEnd=new Date(d.dateEnd)):(e.dateStart=new Date(d.dateStart),e.dateEnd=g),t.hideOtherMonthDays&&e.dateStart.getMonth()!==t.dateCurrent.getMonth()&&(i.otherMonthDate=!0)}_completeEventDragDrop(e){const t=this,n=e.event,i=e.schedulerEvent,r=e.hoveredCell,a=e.hoveredScheduler,l=e.schedulerEventObj,o=e.newDateStart,s=e.newDateEnd,d=t.view,c=t.views.find((e=>e.value&&e.value===d))||{},u=c&&c.groupOrientation?c.groupOrientation:t.groupOrientation,h=i.$.event,m=h.$?h.$.event:void 0,v=r.$.cellObj,g=v[u].group,f=h.dateStart.getTime(),p=r.$.cellObj.time;let w,y;const _=JSON.parse(JSON.stringify(l));_.dateStart=o,_.dateEnd=s;for(let e in g)_[e]=g[e];if(!(a.disableDrop||n&&"keydown"===n.type&&"Escape"===n.key||e.otherMonthDate)&&o&&s&&!t._isEventRestricted(_)){if(a===t?(y=t._cloneObject(m||h),w=h):w=l,a===t&&f===p||t._handleEventExceptionDrop(h,w),w.dateStart=new Date(o),w.dateEnd=new Date(s),["day","week"].indexOf(t.viewType)>-1&&(w.allDay=!!v.allDay),f!==p&&(i.$.cellTime=p),w.allDay||delete w.allDay,g&&!t._isEventPartOfGroup(h,g)){t.groups.forEach((e=>delete w[e]));for(let e in g)w[e]=g[e]}a===t?(t._validateEventDateRange(w),t._refreshTimelineEvents(),e.schedulerEventObj=t._cloneObject(m||w),t._updateUndoRedo(y,t._cloneObject(m||w),"dragEnd")):(m||t.removeEvent(h),a.insertEvent(w))}}_setEventDropDates(e){const t=this,n=e.schedulerEvent,i=e.hoveredScheduler,r=e.hoveredCell,a=n.$.event,l=r.$.cellObj,o=a.dateStart.getTime(),s=r.$.cellObj.time,d=l[t.groupOrientation].group;if(i===t&&o===s&&!!l.allDay==!!a.allDay&&(!d||t._isEventPartOfGroup(a,d)))return e.newDateStart=new Date(a.dateStart),void(e.newDateEnd=new Date(a.dateEnd));const c=e.schedulerEventObj,u=["day","week"].indexOf(t.viewType)>-1,h=i===t?a:c;let m,v;if(m=new Date(s),u&&!!h.allDay!=!!l.allDay)v=t._getCellDateRange(l).dateEnd;else{const e=h.dateEnd.getTime()-h.dateStart.getTime();v=new Date(m.getTime()+e)}u&&l.allDay&&(m.setHours(0,0,0,0),0!==v.getHours()&&0!==v.getMinutes()&&0!==v.getSeconds()&&v.setHours(23,59,59,999)),e.newDateStart=m,e.newDateEnd=v,t.hideOtherMonthDays&&m.getMonth()!==t.dateCurrent.getMonth()&&(e.otherMonthDate=!0)}_checkEventResizability(e){const t=this,n=t._dragDetails,i=e.originalEvent||e;let r=i.target;if(t._isMobile){if(!n)return;t.$.timelineContent.classList.add("hide-overlay"),r=(t.shadowRoot||document).elementFromPoint(i.pageX-window.pageXOffset,i.pageY-window.pageYOffset),t.$.timelineContent.classList.remove("hide-overlay")}else t.shadowRoot&&r===t&&(r=e.originalEvent.composedPath()[0]);const a=t.$.timeline;let l=r&&r.closest&&!t.disabled?r.closest(".smart-scheduler-event"):void 0;if(t._handleEventHover(l),!l||t.disableResize||"agenda"===t.viewType)return;const o=l.$?l.$.event:void 0;if(!a.contains(l)||l.hasAttribute("collector")||!o||o.disableResize)return;const s=t.viewType,d=t.$.timelineViewAllDay.contains(l),c=e.pageX-window.pageXOffset,u=e.pageY-window.pageYOffset,h="visible"===t.resizeHandlesVisibility||t._isMobile?20:5,m=l.getBoundingClientRect();if(s.toLowerCase().indexOf("timeline")>-1||"month"===s||d){if(Math.round(m.left)+h>=c&&Math.round(m.left)-h<=c)return void a.setAttribute("event-hovered","left");if(Math.round(m.right)+h>=c&&Math.round(m.right)-h<=c)return void a.setAttribute("event-hovered","right")}else{if(Math.round(m.top)+h>=u&&Math.round(m.top)-h<=u)return void a.setAttribute("event-hovered","top");if(Math.round(m.bottom)+h>=u&&Math.round(m.bottom)-h<=u)return void a.setAttribute("event-hovered","bottom")}a.hasAttribute("event-hovered")&&a.setAttribute("event-hovered","")}_handleEventHover(e){const t=this,n=t.$.timeline;if(!e&&!n.hasAttribute("event-hovered")||e&&e.hasAttribute("hover"))return;const i=e&&e.$?e.$.event:void 0;let r=[].concat(Array.from(t.$.timelineEventsContainer.children),Array.from(t.$.allDayEventsContainer.children));t._eventList&&(r=r.concat(Array.from(t._eventList.children)));for(let t=0;t<r.length;t++){const n=r[t],a=n.$.event;n===e||i&&i===a?n.setAttribute("hover",""):n.removeAttribute("hover")}i||e?n.setAttribute("event-hovered",""):n.removeAttribute("event-hovered")}_handleEventResize(e){const t=this,n=t._dragDetails,i=n?n.schedulerEvent:void 0;if(t.disableResize||!n||!i||"agenda"===t.viewType||t._isMobile&&Date.now()-n.timestamp<250)return;t.hasAttribute("resized")||t._setResizeStart(i);const r=n.resizeDetails;if(!r)return;const a=e.pageX-window.pageXOffset,l=e.pageY-window.pageYOffset,o=r.side,s=t.$.timelineContainer.getBoundingClientRect();let d;d=r.rightToLeft?s.right-a:a-s.left;const c={x:Math.max(0,d+t.scrollLeft),y:Math.max(0,l-s.top+t.scrollTop)},u=t._getCellObjOffset(i,c,o);if(t._autoScroll(e),u)if(r.cellObj=u.cellObj,r.scaleIndex=u.scaleIndex,"left"===o||"right"===o){if(!t._resizeEventHorizontal(u,o))return}else if(!t._resizeEventVertical(u,o))return}_setResizeStart(e){const t=this,n=t._dragDetails,i=e.$.event,r=t.$.timeline,a=t._eventList;if(!i||i.disableResize||Smart.Scheduler.schedulerStart||a&&a.contains(e))return;const l=t._cloneObject(i);if(t.$.fireEvent("resizeStart",{target:n.schedulerEvent,item:l,itemDateRange:{dateStart:new Date(i.dateStart),dateEnd:new Date(i.dateEnd)},originalEvent:n.originialEvent}).defaultPrevented)return;t.$.tooltip.close(),t.setAttribute("resized",""),e.setAttribute("resized",""),t._scrollView.disableSwipeScroll=t._touchmoveInside=!0;const o=t.rightToLeft,s=parseFloat(e.style[o?"right":"left"]),d=parseFloat(e.style.top),c={width:parseFloat(e.style.width),height:parseFloat(e.style.height)},u=r.getAttribute("event-hovered"),h={x:s,y:d},m=e.closest(".smart-scheduler-events-container").children;let v;for(let t=0;t<m.length;t++){const n=m[t],r=n.$?n.$.event:void 0,a=parseFloat(n.style.left),l=parseFloat(n.style.top);r===i&&e!==n&&("left"===u&&(l<d||l===d&&a<s)||"right"===u&&(l>d||l===d&&a>s))&&(n.classList.add("smart-hidden"),v=!0)}n.resizeDetails={side:u,originalSize:c,originalPosition:h,position:{x:h.x,y:h.y},size:{width:c.width,height:c.height},isAllDay:t.$.timelineViewAllDay.contains(e),rightToLeft:o,resizeFromEnd:"bottom"===u||"right"===u&&!o||"left"===u&&o,resizeFromMiddle:v,schedulerEventObj:l}}_resizeEventHorizontal(e,t){const n=this._dragDetails,i=n.schedulerEvent,r=this.rightToLeft,a=n.resizeDetails;let l,o=a.position.x,s=e.offset;if("left"===t&&!r||"right"===t&&r){const e=a.originalPosition.x;if(o===s)return;if(o<s?(s=o<e?Math.min(e,s):s,l=a.size.width-(s-o)):(s=o>e?Math.max(e,s):s,l=a.size.width+(o-s)),l<=0)return;a.position.x=s,r?(i.style.left="",i.style.right=s+"px"):(i.style.right="",i.style.left=s+"px")}else{if(o+=a.size.width,s+=e.size,o===s)return;if(l=o<s?a.size.width+(s-o):a.size.width-(o-s),l<=0)return}return a.size.width=l,i.style.width=a.size.width+"px",!0}_resizeEventVertical(e,t){const n=this._dragDetails,i=n.schedulerEvent,r=n.resizeDetails;let a,l=r.position.y,o=e.offset;if("top"===t){const e=r.originalPosition.y;if(l===o)return;if(l<o?(o=l<e?Math.min(e,o):o,a=r.size.height-(o-l)):(o=l>e?Math.max(e,o):o,a=r.size.height+(l-o)),a<=0)return;r.position.y=o,i.style.top=o+"px"}else{if(l+=r.size.height,o+=e.size,l===o)return;if(a=l<o?r.size.height+(o-l):r.size.height-(l-o),a<=0)return}return r.size.height=a,i.style.height=r.size.height+"px",!0}_getCellObjOffset(e,t,n){const i=this,r=i._dragDetails.resizeDetails,a=i._timelineCells,l=e.$.event,o=r.isAllDay?1:i._getCellsScaleCount(),[s,d,c,u]="right"===n||"left"===n?["width","left","horizontal","x"]:["height","top","vertical","y"],h=r.resizeFromEnd,m=a[c],v=r.originalSize[s];let g,f,p,w,y,_=r.originalPosition[u],b=_,D=t[u];h?(_=parseFloat((_+v).toFixed(2)),D=Math.max(b,D),w=b):(b=parseFloat((b+v).toFixed(2)),D=Math.min(b,D),y=b);for(let e=0;e<m.length;e++){const t=m[e];if(t.group&&!i._isEventPartOfGroup(l,t.group))continue;const n=parseFloat((t[d]+t[s]).toFixed(2));f||(void 0===w?n>D&&(f=t):n>w&&(f=t)),void 0===y?t[d]<=D&&(p=t):t[d]<y&&(p=t),D!==b&&t[d]<=D&&n>=D&&(g=t)}if(g||(g=h&&b===D||!h&&b!==D?f:p),!g)return;let C,E=g[d],T=parseFloat((g[s]/o).toFixed(2));for(let e=0;e<o;e++){const t=parseFloat((g[d]+T*e).toFixed(2));(b!==D&&t===D||t+T===D||t<D&&t+T>=D)&&(E=t,C=e)}return _>E&&_<parseFloat((E+T).toFixed(2))&&(h&&D<=_?T=_-E:!h&&D>=_&&(E=_)),{offset:E,size:T,cellObj:g,scaleIndex:C}}_handleEventExceptionDrop(e,t){const n=e.$?e.$.event:void 0;if(t||(t=e),e!==t)return delete t.repeat,void delete t.date;if(!n)return;const i=n.repeat;if(t.date||(t.date=new Date(t.dateStart)),delete t.repeat,i){const e=i.exceptions;e?e.indexOf(t)<0&&e.push(t):i.exceptions=[t]}}_dragStartHandler(e){const t=this,n=e.target.closest;if((t._dragDetails||n&&n.call(t,"smart-scheduler")===t)&&e.target){let t=e.target;for(;t;){if(t.className&&t.className.indexOf("smart-scheduler")>=0)return void e.preventDefault();t=t.parentNode}}}_autoScroll(e){const t=this,n=t.$.timelineContainer,i=(e.originalEvent||e).target,r=t.autoScrollStep,a=t._dragDetails,l=t.rightToLeft;function o(n,i){i?(t.scrollTop-=r*n,a&&(a.coordinates.y+=r*n)):(t.scrollLeft-=(l?-1:1)*r*n,a&&(a.coordinates.x+=r*n)),t.hasAttribute("resized")&&t._handleEventResize(e)}if(t.disableAutoScroll||!e||!n.contains(i)||!t.hasAttribute("dragged")&&!t.hasAttribute("resized"))return void clearInterval(t._scrollInterval);clearInterval(t._scrollInterval);const s=n.getBoundingClientRect(),d=!(!a||!a.resizeDetails)&&a.resizeDetails.isAllDay;t._scrollInterval=setInterval((function(){(t.scrollLeft||l)&&e.clientX<=s.left+50?o(1):t.scrollLeft!==(l?0:t.scrollWidth)&&e.clientX>=s.left+s.width-50?o(-1):d||(t.scrollTop&&e.clientY<=s.top+50?o(1,!0):t.scrollTop!==t.scrollHeight&&e.clientY>=s.top+s.height-50?o(-1,!0):(clearInterval(t._scrollInterval),t._scrollInterval=void 0))}),1)}_createDragFeedback(e){const t=this,n=t.theme,i=t.rightToLeft,r=t._dragDetails.schedulerEvent;let a=document.createElement("div");return t.dragFeedbackFormatFunction?a.innerHTML=t.dragFeedbackFormatFunction(e)||"":(a=r.cloneNode(!0),a.setAttribute("view-type",t.viewType),a.setAttribute("event-render-mode",t.eventRenderMode)),a.classList.remove("smart-scheduler-event"),a.classList.add("smart-scheduler-drag-feedback"),a.setAttribute("parent-scheduler-id",t.id),t._isMobile&&a.setAttribute("mobile",""),n&&a.setAttribute("theme",n),i&&a.setAttribute("right-to-left",""),a}_containsEvent(e){const t=this._events;if(!e)return;if(t.indexOf(e)>-1)return e;const n=["label","description"],i=this.groups,r="string"==typeof e?e:e.id;for(let a=0;a<t.length;a++){const l=t[a];if(void 0!==l.id&&l.id+""===r)return l;if((void 0===l.id||l.id+""==r+"")&&n.every((t=>l[t]instanceof Date?new Date(l[t]).getTime()===new Date(e[t]).getTime():l[t]===e[t]))&&(!i.length||i.every((t=>e[t]===l[t]))))return l}}_keyDownHandler(e){const t=this;if(t.readonly||t.hasAttribute("modal"))return void delete t._keyPressed;const n=t.$.tooltip,i=e.key,r=t.$.viewItemsContainer,a=e.target;switch(i){case"End":case"Home":case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"PageDown":case"PageUp":e.preventDefault(),t._handleKeyNavigation(e);break;case"Enter":case"Escape":if("Enter"===i){if(n.contains(a)){const i=n.querySelector("[selected]");if(!i)return;if(a===r){const e=t.$.showWeekendItem;e&&e.hasAttribute("selected")&&t._checkHideWekendItem(e),n.close(),t.$.viewItemsButton.focus({preventScroll:!0})}else a.classList.contains("smart-scheduler-event-button")?(t._deleteEventViaWindow(a.closest(".smart-scheduler-event").$.event),n.close(),t.$.timeline.focus({preventScroll:!0})):i.classList.contains("smart-scheduler-event")?t._doubleClickHandler(i):i.classList.contains("smart-scheduler-context-menu-item")&&t._handleContextMenuItemClick(i);e.preventDefault()}else if(a.classList.contains("smart-scheduler-event"))t._doubleClickHandler(a);else if(a.classList.contains("smart-scheduler-legend-res-item")){if(!t.filterable)return;t._handleLegendItemClick(a)}else a===t.$.timeline&&(t._openWindow(),e.preventDefault());break}"Escape"===i&&(Smart.Scheduler.schedulerStart===t?(t._endDrag(e,t),e.preventDefault()):t.hasAttribute("resized")&&(t._endResize(),e.preventDefault())),n.close(),n.selector&&n.selector.focus({preventScroll:!0});break;case"Tab":{const i=a;let r;if((i.classList.contains("smart-scheduler-event")||i.classList.contains("smart-scheduler-view"))&&(r=Array.from(t.$.timeline.querySelectorAll(".smart-scheduler-event"))),!r)break;const l=r.indexOf(i),o=l<0?r[0]:r[l+(e.shiftKey?-1:1)];if(n.visible&&n.contains(i))return;o&&(e.preventDefault(),o.focus({preventScroll:!0}));break}case"c":case"C":case"x":case"X":!t._dragDetails&&e.ctrlKey&&a.classList.contains("smart-scheduler-event")&&(t._updateClipboard(a.$.event,"c"===i?"copy":"cut"),t._handleEventCut(a));break;case"z":case"Z":case"y":case"Y":{const n=t.getRootNode(),r=n?n.activeElement.classList:void 0;if(!r.contains("smart-scheduler-event")&&!r.contains("smart-scheduler-view")&&!r.contains("smart-scheduler"))return;!t._dragDetails&&e.ctrlKey&&t._handleUndoRedo("z"===i?"undo":"redo");break}case"v":case"V":!t._dragDetails&&e.ctrlKey&&a.classList.contains("smart-scheduler-view")&&t._selectedCellObj&&t._pasteEvent(t._selectedCellObj.from);break;case"Delete":if(!t._dragDetails&&a.classList.contains("smart-scheduler-event")&&!a.hasAttribute("collector")){if(t.$.fireEvent("eventShortcutKey",{key:i,target:a,eventObj:t._cloneObject(a.$.event)}).defaultPrevented)return;e.preventDefault(),t._handleEventMenuDelete(a)}break;case" ":t.filterable&&a.classList.contains("smart-scheduler-legend-res-item")&&t._handleLegendItemClick(a);break;default:if(a===r||a.closest(".smart-scheduler-view-items-button")){let a=t._keyPressed;a||(a=t._keyPressed={}),a[i.toLowerCase()]=!0;const l=Object.keys(a),o=Array.from(r.children).find((e=>{const t=(e.getAttribute("shortcut-key")||"").toLowerCase().split("+");return t.forEach((e=>e.trim())),l.length===t.length&&l.every((e=>t.indexOf(e)>-1))}));o&&(t._handleViewSelection(o),e.preventDefault(),n.close())}}}_keyUpHandler(e){const t=this;if(t.disabled||t.readonly)return void delete t._keyPressed;let n=t._keyPressed;n&&(delete n[e.key.toLowerCase()],Object.keys(n).length||delete t._keyPressed)}_handleContextMenuItemClick(e){const t=this,n=t.$.tooltip,i=n.selector,r=e.getAttribute("value");let a;switch(r){case"create":if(i.classList.contains("smart-scheduler-cell"))if(t._selectedCellObj)a=t._createEventFromSelection();else{const e=t._getCellDateRange(i),n=i.$.cellObj,r=n.vertical.group||n.horizontal.group;if(a={dateStart:e.dateStart,dateEnd:e.dateEnd,allDay:i.hasAttribute("all-day")},r)for(let e in r)a[e]=r[e]}else if(i.classList.contains("smart-scheduler-event")){const e=Object.assign({},i.$.event);a={dateStart:new Date(e.dateStart),dateEnd:new Date(e.dateEnd),allDay:e.allDay}}t._openWindow(a);break;case"edit":t._doubleClickHandler(i);break;case"copy":case"cut":i.classList.contains("smart-scheduler-event")&&!i.hasAttribute("collector")&&(t._updateClipboard(i.$.event,r),t._handleEventCut(i));break;case"paste":if(e.hasAttribute("disabled"))return;i.classList.contains("smart-scheduler-cell")&&t._pasteEvent(i);break;case"delete":if(!i.classList.contains("smart-scheduler-event")||i.hasAttribute("collector"))return;t._handleEventMenuDelete(i)}if(e instanceof HTMLElement){const n={item:e,type:"context",value:e.getAttribute("value")};a&&(n.itemObj=t._cloneObject(a)),t.$.fireEvent("itemClick",n)}n.close()}_updateClipboard(e,t){const n=this;if(!e||!t)return void delete n._clipboard;n._clipboard={target:e,action:t};let i=[],r=[];const a=n.locale,l={year:n.yearFormat,month:n.monthFormat,day:n.dayFormat,hour:n.hourFormat,minute:n.minuteFormat},o=[{label:"id",value:"Id"},{label:"label",value:"Label"},{label:"description",value:"Description"},{label:"dateStart",value:"Date Start"},{label:"dateEnd",value:"Date End"},{label:"allDay",value:"All Day"},{label:"repeat",value:"Repeat"},{label:"notifications",value:"Notifications"}];for(let t=0;t<o.length;t++){const n=o[t].label;if(void 0!==e[n]){let s=e[n];s instanceof Date?s=new Intl.DateTimeFormat(a,l).format(new Date(s)):"repeat"===n?s=(Object.keys(s).length>0)+"":"notifications"===n&&(s=(Array.isArray(s)&&s.length>0)+""),r.push(o[t].value),i.push(s+"")}}if(i=r.join(",")+"\n"+i.join(","),navigator.clipboard)navigator.clipboard.writeText(i);else if(document.execCommand){const e=document.createElement("textarea"),t=n.getRootNode().activeElement;return e.value=i,e.style.position="fixed",document.body.appendChild(e),e.focus({preventScroll:!0}),e.select(),document.execCommand("copy"),document.body.removeChild(e),void(t&&t.focus({preventScroll:!0}))}}_handleEventCut(e){const t=this,n=t._clipboard,i=Array.from(t.$.timelineEventsContainer.children).concat(Array.from(t.$.allDayEventsContainer.children));let r;if(n&&"cut"===n.action||(e=void 0),e?r=e.$.event:!e&&n&&"cut"===n.action&&(r=n.target),r&&r.$&&r.$.event){const e=r.$.event;e&&e.repeat&&(!e.repeat.exceptions||e.repeat.exceptions.indexOf(r)<0)&&(r=void 0)}for(let e=0;e<i.length;e++){const t=i[e];r&&t.$&&t.$.event===r?t.setAttribute("cut",""):t.removeAttribute("cut")}}_pasteEvent(e){const t=this,n=t._clipboard;if(!n)return;let i=n.target;if(!i)return;if(!(e=e instanceof HTMLElement?e.$.cellObj:e))return;const r=i.$&&i.$.event?i.$.event:void 0;if(r&&r.repeat&&(!r.repeat.exceptions||r.repeat.exceptions.indexOf(i)<0))return;const a=t.view,l=t.views.find((e=>e.value&&e.value===a))||{},o=e[l&&l.groupOrientation?l.groupOrientation:t.groupOrientation].group,s=["day","week"].indexOf(t.viewType)>-1;let d,c,u,h;switch(n.action){case"copy":{if(r)return;const e=t.localize("duplicate"),n=new RegExp(`\\s?-\\s?${e}\\s?(\\(([0-9]+)\\))?$`,"g"),a=t._events;let l=(i.label+"").replace(n,""),o=0;i=t._cloneObject(i);for(let e=0;e<a.length;e++){const t=a[e];if(t.label.indexOf(l)>-1&&(n.lastIndex=0,n.test(t.label))){n.lastIndex=0;const e=n.exec(t.label);o=Math.max(o,parseInt(e[2])||1)+1}}i.label=o>1?`${l} - ${e} (${o})`:`${l} - ${e}`,delete i.id,t._events.push(i),u="itemInsert";break}case"cut":h=t._cloneObject(r||i),o&&!t._isEventPartOfGroup(i,o)&&t.groups.forEach((e=>delete i[e])),t._updateClipboard(),u="itemUpdate"}if(d=new Date(e.time),c=s&&!!i.allDay!=!!e.allDay?t._getCellDateRange(e).dateEnd:new Date(d.getTime()+(i.dateEnd.getTime()-i.dateStart.getTime())),s&&(e.allDay&&(d.setHours(0,0,0,0),0!==c.getHours()&&0!==c.getMinutes()&&0!==c.getSeconds()&&c.setHours(23,59,59,999)),i.allDay=!!e.allDay),i.allDay||delete i.allDay,i.dateStart=d,i.dateEnd=c,o)for(let e in o)i[e]=o[e];t._validateEventDateRange(i),t._refreshTimelineEvents(),"itemInsert"===u?t._updateUndoRedo(void 0,t._cloneObject(r||i),u):t._updateUndoRedo(h,t._cloneObject(r||i),u);const m=t._cloneObject(r||i);t.$.fireEvent(u,{item:m}),t.$.fireEvent("itemChange",{item:m})}_handleKeyNavigation(e){const t=this,n=t.viewType.toLowerCase(),i=n.indexOf("timeline")>-1,r=t.$.tooltip,a=t.rightToLeft,l=e.key;let o=t.enableShadowDOM?e.composedPath()[0]:e.target;if(r.visible){const e=r.$.content instanceof HTMLElement?r.$.content.querySelector("[tabindex]"):null;e&&(e.focus({preventScroll:!0}),o=e)}if(o===t.$.timeline){const r=t.$.timelineContent,o=t.$.timelineViewAllDay,s=o.offsetHeight>0;if(!t._selectedCellObj)return t._handleCellSelection((s?o:r).querySelector(".smart-scheduler-cell:not(.scale)")),void(t._selectedCellObj&&t._scrollTo(t._selectedCellObj.to));const d=t._selectedCellObj[e.shiftKey?"to":"from"],c=t._getCellsScaleCount(),u=d.scaleIndex||0,h=c-1;let m,v,[g,f,p]=[d.horizontal,d.vertical,u],w=d.allDay;switch(l){case"Home":case"End":m=t._timelineCells[i?"horizontal":"vertical"],[v,p,w]="Home"===l?[m[0],0,!e.shiftKey&&s]:[m[m.length-1],h,!1],[g,f]=i?[v,f]:[g,v];break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":{const e=["ArrowUp","ArrowDown"].indexOf(l)>-1,n=a&&"ArrowRight"===l||!a&&"ArrowLeft"===l||"ArrowUp"===l?-1:1;[m,v]=e?[t._timelineCells.vertical,f]:[t._timelineCells.horizontal,g],e&&i||!e&&!i?v=m[m.indexOf(v)+n]:(p+=n,(p<0||p>h)&&(v=m[m.indexOf(v)+n],p=p>h?0:h)),[g,f]=e?[g,v]:[v,f];break}case"PageDown":case"PageUp":{if(i||d.allDay)break;const e=d.vertical.top+t._scrollViewSize.height*("PageUp"===l?-1:1),n=t._timelineCells.vertical;f=t._timelineCells.vertical.find((t=>t.top>=e)),f||(f="PageUp"===l?n[0]:n[n.length-1]);break}}e.shiftKey||(w&&"ArrowDown"===l?(f=t._timelineCells.vertical[0],p=0,w=!1):"ArrowUp"!==l||f||(w=s));const y=t._getCellByObj({horizontal:g,vertical:f,scaleIndex:p,allDay:w});if(y){const i=t._selectedCellObj.from;t._handleCellSelection("agenda"!==n&&e.shiftKey&&!!i.allDay==!!w?i:y,y)}}else if(o===t.$.viewItemsContainer){const e=t.$.viewItemsContainer.children,n=Array.from(e).find((e=>e.hasAttribute("selected")));let i;n&&"Home"!==l?"End"===l?i=e[e.length-1]:(t.$.tooltip.contains(o)&&("ArrowUp"===l||"ArrowDown"===l)||t.$.header.contains(o)&&("ArrowLeft"===l||"ArrowRight"===l))&&(i=n["ArrowUp"===l||"ArrowLeft"===l&&!a||"ArrowRight"===l&&a?"previousElementSibling":"nextElementSibling"]):i=e[0],i&&n!==i&&t._handleViewSelection(i)}else if(o===t._list){const e=(t._list.contains(t._eventList)?t._eventList:t._contextList).children,n=Array.from(e).find((e=>e.hasAttribute("selected")));let i;n&&"Home"!==l?"End"===l?i=e[e.length-1]:"ArrowUp"!==l&&"ArrowDown"!==l||(i=n["ArrowUp"===l?"previousElementSibling":"nextElementSibling"]):i=e[0],i&&n!==i&&t._handleEventItemSelection(e,i)}}_handleEventItemSelection(e,t){const n=this;if((n._eventList||n._contextList)&&(n._list.contains(n._eventList)?n._eventList:n._contextList)){e||(e=(n._list.contains(n._eventList)?n._eventList:n._contextList).children);for(let n=0;n<e.length;n++){const i=e[n];i===t?i.setAttribute("selected",""):i.removeAttribute("selected")}}}_getCellByObj(e){const t=this;if(!e)return;if(!t._scrollTo(e))return;const n=e.allDay,i=n?t.$.timelineViewAllDay:t.$.timelineCellsContainer,r=Array.from(i.querySelectorAll(".smart-scheduler-cell:not(.scale)"));n&&delete e.vertical;const a=Object.keys(e);return r.find((t=>a.every((n=>e[n]===t.$.cellObj[n]||void 0===t.$.cellObj[n]))))}_scrollTo(e,t,n){const i=this,r=i._getCellsScaleCount(),a=i.viewType.toLowerCase().indexOf("timeline")>-1;let l,o,s,d,c,u,h,m;if(e instanceof HTMLElement&&e.classList.contains("smart-scheduler-event")||i._events&&i._events.indexOf(e)>-1){const t=i._scrollToEvent(e);if(!t)return;[l,o,s,d]=[t.hCell,t.vCell,t.scaleIndex,t.allDay]}else if(e instanceof Date){let t=i._getCellObjByDate(e);if(!t&&(i.navigateToDate(e),t=i._getCellObjByDate(e),!t))return;[l,o,s,d]=[t.hCell,t.vCell,t.scaleIndex,t.allDay]}else{if(e instanceof HTMLElement&&e.$&&(e=e.$.cellObj),!e)return;l=e.horizontal||e,o=e.vertical||e,s=e.scaleIndex||0,d=e.allDay}const v=()=>{const e=i[c];t||e>m?(i[c]=m,i.isCompleted||(i.$.timelineContainer[c]=i[c],i._recycle())):e+h<m+u&&(i[c]=Math.max(0,m+u-h),i.isCompleted||(i.$.timelineContainer[c]=i[c],i._recycle()))};return l&&([c,u,h]=["scrollLeft",l.width/(a?r:1),i._scrollViewSize.width],m=l.left+u*(a?s:0),v()),o&&!d&&([c,u,h]=["scrollTop",o.height/(a?1:r),i._scrollViewSize.height],m=o.top+u*(a?0:s),n&&(t&&(m=Math.max(0,m+u-h)),m+=(i._scrollViewSize.height-u)/2),v()),!0}_scrollToEvent(e){const t=this;if(!e)return;e instanceof HTMLElement&&e.classList.contains("smart-scheduler-event")&&!t.$.timeline.contains(e)&&(e=e.$?e.$.event:void 0);const n=t._events;if(!e||!n||n.indexOf(e)<0)return;const i=t._getEventHorizontallCellObjs(e),r=t._getEventVerticalCellObjs(e),a=i.start||i.first,l=r.start||r.first;let o=0;return e.allDay||(o=t._getEventScaleIndex(e,t.viewType.indexOf("timeline")>-1?a:l).start),{hCell:a,vCell:r,scaleIndex:o,allDay:e.allDay}}_getCellObjByDate(e){if(!(e instanceof Date)||!e||isNaN(e.getTime()))return;const t=this,n=t.viewType.toLowerCase(),i=t._timelineCells.horizontal,r=t._timelineCells.vertical,a=n.indexOf("month")>-1;let l,o,s,[d,c,u,h,m]=[e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getDay()];if("agenda"===n){if(o=r.find((e=>{const t=e.date;return t.getFullYear()===d&&t.getMonth()===c&&t.getDate()===u})),!o)return}else if(n.indexOf("timeline")<0){if(l=i.find((e=>{const t=e.date;return a&&t.getDay()===m||t.getFullYear()===d&&t.getMonth()===c&&t.getDate()===u})),a&&(s=new Date,s.setDate(s.getDate()-s.getDay()+t.firstDayOfWeek),[d,c,u,h,m]=[s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getDay()]),o=r.find((e=>{const t=e.date;return a?t.getFullYear()===d&&t.getMonth()===c&&t.getDate()===u&&t.getHours()===h:t.getHours()===h})),!l||!o)return}else if(l=i.find((e=>{const t=e.date;return t.getFullYear()===d&&t.getMonth()===c&&t.getDate()===u&&(a||t.getHours()===h)})),!l)return;return{hCell:l,vCell:o,scaleIndex:Math.floor(e.getMinutes()/60*t._getCellsScaleCount())}}_mouseWheelHandler(e){const t=this,n=e.target;t.$.viewSelectorContainer.contains(n)?t._handleViewNavigation(e):t.disabled||n.closest(".smart-scheduler-window-modal")||(e.shiftKey&&t.computedHorizontalScrollBarVisibility?t._handleHorizontalScroll(e):t.computedVerticalScrollBarVisibility&&t._handleVerticalScroll(e))}_handleCellSelection(e,t){const n=this,i=n._dragDetails?n._dragDetails.selectedCellObj:n._selectedCellObj;let r,a,l,o;i&&(r=i.from,a=i.to),n.disableSelection?n._selectCell():n._selectCell(e,t),n._selectedCellObj&&(l=n._selectedCellObj.from,o=n._selectedCellObj.to);const s={dateStart:void 0,dateEnd:void 0,group:void 0};let d,c,u,h,m,v;r&&(d=new Date(r.time),c=new Date(a.time),m=r.horizontal.group||r.vertical.group),l&&(u=new Date(l.time),v=l.horizontal.group||l.vertical.group,s.dateStart=u,s.group=v,h=new Date(o.time),s.dateEnd=h),(r&&!l||!r&&l||d&&(d.getTime()!==u.getTime()||c.getTime()!==h.getTime()||m!==v))&&n.$.fireEvent("change",s)}_selectCell(e,t){const n=this;function i(){const e=n.$.timeline.querySelectorAll(".smart-scheduler-cell[selected]");for(let t=0;t<e.length;t++)e[t].removeAttribute("selected");delete n._selectedCellObj}if(t||(t=e),!e||"agenda"===n.viewType)return void i();let r=e,a=t;if(e.closest){const t=e.closest(".smart-scheduler-cell:not(.scale)");if(!t||!n.$.timeline.contains(t))return;r=t.$?t.$.cellObj:void 0}if(t.closest){const e=t.closest(".smart-scheduler-cell:not(.scale)");if(!e||!n.$.timeline.contains(e))return;a=e.$?e.$.cellObj:void 0}if(!r||!a||n._isMobile&&Object.keys(r).some((e=>r[e]!==a[e]))||void 0===r.time||void 0===a.time)return;if(r.allDay&&!a.allDay){const e=n.$.timelineViewAllDayCellsContainer.children;for(let t=0;t<e.length;t++){const n=e[t];if(!n.$)continue;const i=n.$.cellObj;if(i.horizontal===a.horizontal){a=i;break}}}if(r.allDay!==a.allDay)return;const l=n.view,o=n.views.find((e=>e.value&&e.value===l))||{},s=o&&o.groupOrientation?o.groupOrientation:n.groupOrientation,d=(r[s]||r).group;if(d!==(a[s]||a).group)return;i();let c,[u,h]=[r.time,a.time];if("agenda"===n.viewType&&u!==h)return;let m={};if(u>h){const e=u;u=h,h=e}m.from=Object.assign({},r),m.to=Object.assign({},a),n._selectedCellObj=m;const v=(r.allDay?n.$.timelineViewAllDay:n.$.timelineContent).querySelectorAll(".smart-scheduler-cell:not(.scale)");for(let e=0;e<v.length;e++){if(c=v[e],c.removeAttribute("selected"),!c.$)continue;const t=c.$.cellObj;if((t[s]||t).group!==d)continue;const n=t.time,i=Object.keys(t);n>=u&&n<=h&&c.setAttribute("selected",r===a||i.every((e=>t[e]===r[e]))?"start":"")}n._scrollTo(a)}_isCellObjSelected(e){const t=this,n=t._selectedCellObj;if(!n||!e)return;const i=n.from,r=n.to,a=t.view,l=t.views.find((e=>e.value&&e.value===a))||{},o=l&&l.groupOrientation?l.groupOrientation:t.groupOrientation;if((i[o]||i).group!==(e[o]||e).group)return;const s=Math.min(i.time,r.time),d=Math.max(i.time,r.time),c=e.time;return c>=s&&c<=d||void 0}_getCellTime(e){if(!e)return 0;const t=this,n=t.viewType;let i,r;if(e instanceof HTMLElement&&e.closest(".smart-scheduler-cell:not(.scale)")){if(!e.$||!e.$.cellObj)return 0;i=e.$.cellObj}else i=e;if("agenda"===n)return i.vertical.date.getTime();if("month"===n){r=new Date(i.vertical.date);const e=new Date(i.horizontal.date).getDay()-t.firstDayOfWeek;return r.setDate(r.getDate()+(e<0?7+e:e)),r.getTime()}const a=i.scaleIndex||0,l=60/t._getCellsScaleCount()*60*1e3;return n.indexOf("timeline")<0?(r=new Date(i.horizontal.date),i.allDay||r.setHours(i.vertical.date.getHours())):r=new Date(i.horizontal.date),r.getTime()+l*a}_handleVerticalScroll(e){const t=this;if(!t.computedVerticalScrollBarVisibility)return!0;const n=t.scrollTop;0===n&&e.deltaY<0||n===t.scrollHeight&&e.deltaY>0?e.stopPropagation():(e.preventDefault(),t.mouseWheelStep>0?t.scrollTop=n+(e.deltaY<0?-t.mouseWheelStep:t.mouseWheelStep):t.scrollTo(n+t._getScrollCoefficient(e,t.offsetHeight)))}_handleHorizontalScroll(e){const t=this;if(!t.computedHorizontalScrollBarVisibility)return!0;const n=t.scrollLeft;0===n&&e.deltaY<0||n===t.scrollWidth&&e.deltaY>0?e.stopPropagation():(e.preventDefault(),t.scrollWidth>0&&t.scrollTo(void 0,t.scrollLeft+t._getScrollCoefficient(e,t.offsetWidth)))}_horizontalScrollbarHandler(e){const t=this;t._hscrollTimer&&clearTimeout(t._hscrollTimer),t.$.timelineContainer.scrollLeft=t._getScrollLeft(e.detail.value),t.dataSource&&t.dataSource.length>100?(t._recycle(e,!1),t._hscrollTimer=setTimeout((()=>{t._recycle(e)}),25)):t._recycle(e)}_verticalScrollbarHandler(e){const t=this;t._scrollTimer&&clearTimeout(t._scrollTimer),t.$.timelineContainer.scrollTop=Math.round(e.detail.value),t.dataSource&&t.dataSource.length>100?(t._recycle(e,!1),t._scrollTimer=setTimeout((()=>{t._recycle(e)}),25)):t._recycle(e)}_recycle(e,t){const n=this,i=n._timelineCells,r=n.$.tooltip;if(i.vertical&&i.horizontal){if(r.visible&&n.$.timeline.contains(r.selector)&&r.close(),!e)return n._recycleHeaderCells(n.$.timelineHeaderHorizontalContent),n._recycleHeaderCells(n.$.timelineHeaderVerticalContent),n._refreshTimelineContentCells(),n._refreshTimelineAllDayCells(),void(!1!==t&&n._refreshEvents());if("horizontal"===e.context.orientation)return n._recycleHeaderCells(n.$.timelineHeaderHorizontalContent),n._refreshTimelineContentCells(),n._refreshTimelineAllDayCells(),void(!1!==t&&n._refreshEvents());n._recycleHeaderCells(n.$.timelineHeaderVerticalContent),n._refreshTimelineContentCells(),!1!==t&&n._refreshEvents()}}_recycleHeaderCells(e){const t=this,n=t.rightToLeft,[i,r,a,l]=e===t.$.timelineHeaderHorizontalContent?["horizontal","left","width","scrollLeft"]:["vertical","top","height","scrollTop"],o=e.querySelector(".smart-scheduler-view-time"),s=t._timelineCells[i];if(!s||!s.length)return;const d=t._getFirstCellObjInView(i),c=t._getTimelineVisibleCellsCount(i),u=o.children;for(let e=0;e<u.length;e++){const l=u[e],o=l.children;let h=document.createDocumentFragment();for(;o.length;)h.appendChild(l.firstElementChild);t._recycleContainerCells({fragment:h,cellsNeeded:c});let m=s.indexOf(d);for(let l=0;l<h.children.length;l++){const o=h.children[l],d=s[m];if(o.$={cellObj:d},!d)break;"horizontal"===i?n?(o.style.left="",o.style.right=d.left+"px"):(o.style.right="",o.style.left=d.left+"px"):o.style[r]=d[r]+"px",o.style[a]=d[a]+"px",o.innerHTML=`<div>${d.noLabel?"":t._getDateString({date:new Date(d.date),timeZone:u[e].timeZone},i)}</div>`,d.weekend?o.setAttribute("weekend",""):o.removeAttribute("weekend"),d.nonworking?o.setAttribute("nonworking",""):o.removeAttribute("nonworking"),d.separator?o.setAttribute("separator",""):o.removeAttribute("separator"),d.groupSeparator?o.setAttribute("group-separator",""):o.removeAttribute("group-separator"),d.showLabel?o.setAttribute("show-label",d.showLabel):o.removeAttribute("show-label"),d.restricted?o.setAttribute("restricted",""):o.removeAttribute("restricted"),m++}l.appendChild(h)}t._refreshHeaderDetailCells(i),t._refreshHeaderGroupCells(i),e[l]="scrollLeft"===l?t._getScrollLeft(t[l]):t[l]}_moveHandler(e){const t=this;t._isMobile||e.stopPropagation(),(t.hasAttribute("dragged")||t.hasAttribute("resized"))&&"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_getScrollLeft(e){return this.rightToLeft?e*=-1:e}_containerClickHandler(e){const t=this;if(t.readonly||t.hasAttribute("modal"))return;const n=t.$.tooltip;let i=(e||e.originalEvent).target;if(t.$.dateSelectorContainer.contains(i)){const e=i.closest(".smart-scheduler-nav");return e&&e.hasAttribute("current")&&t.disableDateMenu?void n.close():void t._handleDateSelection(e)}if(!n.contains(i)){if(i.closest(".smart-scheduler-view-items-button")){if(t.disableViewMenu)return void n.close();const e=n.visible&&!n.contains(t.$.viewItemsContainer);return t._handleTooltipContent(t.$.viewItemsButton),void(e||n.toggle())}if(i.classList.contains("smart-scheduler-legend-res-item"))t._handleLegendItemClick(i);else if(t._isMobile&&(t.$.timelineContent.classList.add("hide-overlay"),i=(t.shadowRoot||document).elementFromPoint(e.pageX-window.pageXOffset,e.pageY-window.pageYOffset),t.$.timelineContent.classList.remove("hide-overlay")),!i.closest(".smart-scheduler-event")&&(n.close(),t.$.viewSelectorContainer.contains(i))){const e=i.closest(".smart-scheduler-nav");if(e)return void t._handleViewNavigation(e);const n=i.closest(".smart-scheduler-item");n===t.$.showWeekendItem?t._checkHideWekendItem(n):t._handleViewSelection(n)}}}_handleLegendItemClick(e){const t=this,n=t._legend;if(!t.filterable||!n)return;e.hasAttribute("unselected")?(e.removeAttribute("unselected"),e.setAttribute("aria-selected",!0)):(e.setAttribute("unselected",""),e.setAttribute("aria-selected",!1));const i=n.querySelectorAll(".smart-scheduler-legend-res-item[unselected]");let r=[],a={};for(let e=0;e<i.length;e++){const t=i[e],n=t.getAttribute("resource"),r=t.getAttribute("resource-id");a[n]||(a[n]=[]),a[n].push(r+"")}for(let e in a)r.push({name:e,value:t=>!a[e].includes(t+"")});t.set("filter",null),r.length&&t.set("filter",r),t._refreshTimelineEvents()}_containerContextMenuHandler(e){const t=this;let n=e.target;if(t.disableContextMenu)return;const i=e.pageX-window.pageXOffset,r=e.pageY-window.pageYOffset;if(t._isMobile&&(t.$.timelineContent.classList.add("hide-overlay"),n=(t.shadowRoot||document).elementFromPoint(i,r),t.$.timelineContent.classList.remove("hide-overlay")),t.$.timelineContent.contains(n)||t.$.timelineViewAllDayContent.contains(n)){if(e.preventDefault(),n=n.closest(".smart-scheduler-event")||n.closest(".smart-scheduler-cell"),!n||t.disableContextMenu)return;n.classList.contains("smart-scheduler-event")&&t._handleCellSelection(),t._handleTooltipContent(n,{x:e.pageX,y:e.pageY})}else t.$.tooltip.close()}_handleViewNavigation(e){const t=this;let n;if(!e)return;const i=t.$.viewItemsContainer;n=e instanceof Smart.RepeatButton?10*(e.hasAttribute("prev")?-1:1):e.deltaY,i.scrollLeft+=t._getScrollLeft(n);const r=t._viewButtons;if(!r)return;n=i.scrollLeft;const a=r.prev,l=r.next;a.disabled=!n,l.disabled=i.offsetWidth+Math.abs(n)===i.scrollWidth}_handleDateSelection(e){const t=this,n=t.$.tooltip;if(e instanceof HTMLElement)if(e.hasAttribute("prev"))n.close(),t._navigateDate(-1);else if(e.hasAttribute("current")){const e=n.visible&&!n.contains(t._calendar);t._handleTooltipContent(t.$.currentDate),e||n.toggle()}else e.hasAttribute("next")?(n.close(),t._navigateDate(1)):e.hasAttribute("today")&&(n.close(),t._navigateDate())}navigateToDate(e){const t=this;if(e instanceof Date)e=new Date(e);else{if(e instanceof HTMLElement&&(!e.classList.contains("smart-scheduler-cell")||!t.$.timeline.contains(e)))return;if("object"==typeof e){const n=new Date(t.dateCurrent);e.year=void 0!==e.year?e.year:n.getFullYear(),e.month=void 0!==e.month?e.month:n.getMonth(),e.date=void 0!==e.date?e.date:n.getDate(),e=new Date(e.year,e.month,e.date,e.hours,e.getMinutes)}else if("string"==typeof e){if(e.indexOf("Date")>=0){e=(e=e.replace("new Date(","").replace(")","")).split(", ");let t="";for(let n=0;n<e.length;n++)t+=e[n],n<2?t+="-":2===n?t+=" ":n<e.length-1&&(t+=":");e=t}e=new Date(e)}}let n=e;t._refreshDateNavButtons(n),n.getTime()>t.max||n.getTime()<t.min||(t.set("dateCurrent",n),t.dateCurrent.getTime()!==n.getTime()&&t.$.fireEvent("dateChange",{oldValue:new Date(t.dateCurrent),value:new Date(n)}),t._calendar&&(t._calendar.selectedDates=[new Date(n)],t.$.tooltip.contains(t._calendar))||(t._createTimeline(),t._refreshDateSelector()))}_navigateDate(e){const t=this,n=t.viewType.toLowerCase();let i=t.dateCurrent,r=new Date(i);if(void 0===e)r=new Date;else{if(r.setHours(0,0,0,0),n.includes("day"))r.setDate(r.getDate()+e);else if(n.includes("week")||"agenda"===n){r.setDate(r.getDate()+7*e);const n=t.views.find((e=>e.value&&e.value===t.view))||{};if(n.additionalDays){let t=new Smart.Utilities.DateTime(i);t=t.addDays(e*(6+n.additionalDays)),r=t.toDate(),r.setHours(0,0,0,0)}}else{let t=new Date(r);e>0?(t.setDate(1),t.setMonth(t.getMonth()+2),t.setDate(0)):t.setDate(0),r.setMonth(r.getMonth()+e),r.getMonth()!==t.getMonth()&&(r=t)}r.setHours(i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds())}t._refreshDateNavButtons(r),r.getTime()>t.max||r.getTime()<t.min||(t.set("dateCurrent",r),i.getTime()!==r.getTime()&&t.$.fireEvent("dateChange",{oldValue:new Date(i),value:new Date(r)}),t._calendar&&(t._calendar.selectedDates=[new Date(r)],t.$.tooltip.contains(t._calendar))||(t._createTimeline(),t._scrollTo(r),t._refreshDateSelector()))}_refreshDateNavButtons(e){const t=this;e||(e=t.dateCurrent);const n=t.$.dateSelectorContainer,i=n.querySelector(".smart-scheduler-nav[prev]"),r=n.querySelector(".smart-scheduler-nav[next]");i&&(i.disabled=e.getTime()<=t.min),r&&(r.disabled=e.getTime()>=t.max)}_handleTooltipContent(e,t){const n=this,i=n.$.tooltip;if(e){if(e===n.$.currentDate){i.selector=e,i.position="auto",i.arrow=!0;let t=n._calendar;t||(t=document.createElement("smart-calendar"),t.firstDayOfWeek=n.firstDayOfWeek,t.selectionMode="oneExtended",t.selectedDates=[new Date(n.dateCurrent)],t.max=n.max,t.min=n.min,t.rightToLeft=n.rightToLeft,t.locale=n.locale,t.id=n.id+"Calendar",t.classList.add("smart-scheduler-calendar-popup"),n._calendar=t),r(t)}else if(e===n.$.viewItemsButton)i.selector=e,i.position="auto",i.arrow=!0,r(n.$.viewItemsContainer),n._handleViewSelection(),n._checkHideWekendItem();else if(e.classList.contains("smart-scheduler-event")||e.classList.contains("smart-scheduler-cell")){let a,l=n._list;if(l||(n._list=l=document.createElement("smart-scroll-viewer"),l.horizontalScrollBarVisibility="hidden"),l.theme=n.theme,l.tabIndex=n.tabIndex,l.rightToLeft=n.rightToLeft,n.inverted?l.setAttribute("inverted",""):l.removeAttribute("inverted"),a=t?n._getContextMenu(e):n._getEventList(e),!a||!a.innerHTML)return;if(n._handleEventItemSelection(),l.contains(a)){if(i.selector===e&&i.contains(l)){if(t){const e=n.getBoundingClientRect();return i.style.top=Math.min(t.y+1,e.bottom+window.pageYOffset-i.offsetHeight)+"px",i.style.left=Math.min(t.x+1,e.right+window.pageXOffset-i.offsetWidth)+"px",i.visible&&n._fireTooltipVisibilityEvent({type:"opening",detail:{owner:i.selector}})?(n._skipEventFiring=!0,i.close(),void delete n._skipEventFiring):void i.open()}return i.visible&&i.selector&&i.selector.focus({preventScroll:!0}),l.refresh(),void i.toggle()}}else l.isCompleted&&l.removeAll(),l.appendChild(a);if(i.selector=e,r(l),l.refresh(),t){const e=n.getBoundingClientRect();i.style.top=Math.min(t.y+1,e.bottom+window.pageYOffset-i.offsetHeight)+"px",i.style.left=Math.min(t.x+1,e.right+window.pageXOffset-i.offsetWidth)+"px"}if(i.visible)return n._fireTooltipVisibilityEvent({type:"opening",detail:{owner:i.selector}})?(n._skipEventFiring=!0,i.close(),void delete n._skipEventFiring):void(t||i.reposition());i.visible||i.open()}}else i.close();function r(e){e&&!i.contains(e)&&(i.clear(),i.appendChild(e))}}_getContextMenu(e){const t=this,n=t.$.tooltip;let i,r,a=t._contextList,l=t.contextMenuDataSource;if(e.classList.contains("smart-scheduler-event")&&!e.hasAttribute("collector")){const n=e.$?e.$.event:void 0;n&&n.$&&n.$.event&&(r=!0),l||(l=["create","edit","delete"],t.contextMenuClipboardActions&&["copy","cut"].forEach((e=>l.push(e))))}else{if(!e.classList.contains("smart-scheduler-cell"))return void n.close();i=!0,l||(l=["create"],t.contextMenuClipboardActions&&l.push("paste"))}n.position="absolute",n.arrow=!1,a||(t._contextList=a=document.createElement("div"),a.classList.add("smart-scheduler-context-menu"),a.setAttribute("role","listbox"),a.setAttribute("aria-label","Context Menu"));const o=document.createDocumentFragment(),s=Array.from(a.children),d=t.hideOtherMonthDays;let c=["copy","cut"];for(let e=0;e<s.length;e++){const t=s[e];l.indexOf(t.getAttribute("value"))<0&&t.remove()}for(let n=0;n<l.length;n++){const a=l[n];let u,h,m=s[n];"object"==typeof a?(u=a.label,h=a.value):u=h=a+"",m||(m=document.createElement("div"),m.classList.add("smart-scheduler-context-menu-item"),m.setAttribute("role","option")),m.parentElement||o.appendChild(m),e.hasAttribute("restricted")||d&&e.hasAttribute("other-month")?m.setAttribute("disabled",""):i&&"paste"===h?t._clipboard?m.removeAttribute("disabled"):m.setAttribute("disabled",""):r&&c.indexOf(h)>-1?m.setAttribute("disabled",""):m.removeAttribute("disabled"),m.innerHTML=t.localize(u)||u,m.setAttribute("value",h)}return a.appendChild(o),a}_getEventList(e){const t=this;if(!e.classList.contains("smart-scheduler-event")||!e.$)return;const n=e.hasAttribute("collector"),i=n?e.$.events:[e.cloneNode(!0)];let r=t._eventList;if(!i||!i.length)return void(r&&(r.innerHTML=""));const a=t.$.tooltip;a.position="auto",a.arrow=!0,r||(r=document.createElement("div"),r.classList.add("smart-scheduler-collector-event-list"),r.setAttribute("role","menu"),r.id=t.id+"EventMenu",t._eventList=r),r._target=e;const l=document.createDocumentFragment(),o=Array.from(r.children),s={isAllDayEvent:t.$.timelineViewAllDay.contains(e),isTooltipEvent:!0};for(let e=0;e<o.length;e++){const t=o[e];i.indexOf(t)<0&&t.remove()}for(let r=0;r<i.length;r++){const a=i[r];n||(a.$=e.$),s.eventObj=a.$.event,s.isAllDayEvent=s.eventObj.allDay,t._setEventCellContent(a,s),l.appendChild(i[r])}return r.appendChild(l),r}_tooltipVisibilityHandler(e){const t=this,n=e.type,i=t.$.tooltip,r=t.getRootNode().host||t.getRootNode();e.stopPropagation(),t._skipEventFiring||!t._fireTooltipVisibilityEvent(e)?(r===document||document.body.contains(r))&&("opening"===n?(i.classList.remove("smart-visibility-hidden"),t.getShadowRootOrBody().appendChild(i)):"closing"===n&&(t.hasAnimation?i.addEventListener("animationend",(()=>{i.visible||(i.classList.add("smart-visibility-hidden"),i.style.top=i.style.left=0,t.$.container.appendChild(i))}),{once:!0}):t.$.container.appendChild(i))):e.preventDefault()}_fireTooltipVisibilityEvent(e){const t=this,n=e.type,i=t.$.tooltip,r=i.contains(t._contextList),a=i.contains(t._eventList),l=e.detail.owner;let o,s={target:i,owner:l};if(r)if(l.classList.contains("smart-scheduler-event"))s.eventObj=[t._cloneObject(l.$.event)];else{let e,n;if(t._selectedCellObj){const i=t._selectedCellObj.from,r=t._selectedCellObj.to,a=Math.min(i.time,r.time),l=Math.max(i.time,r.time);e=a===l?[new Date(a)]:[new Date(a),new Date(l)],n=i.vertical.group||i.horizontal.group}else{const t=l.$.cellObj;e=[new Date(t.time)],n=t.vertical.group||t.horizontal.group}s.cellObj={date:e},n&&(s.group=n)}else a&&(l.$.events?s.eventObj=l.$.events.map((e=>t._cloneObject(e.$.event))):l.$.event&&(s.eventObj=[t._cloneObject(l.$.event)]));if("open"===n||"close"===n){r?o="contextMenu":a?o="eventMenu":i.contains(t._calendar)?o="dateMenu":i.contains(t.$.viewItemsContainer)&&(o="viewMenu");let e=(t.getAttribute("aria-owns")||"")+" "+i.id;return"open"===n?t.setAttribute("aria-owns",e.trim()):t.hasAttribute("aria-owns")&&(e=t.getAttribute("aria-owns").replace(i.id,"").trim(),e?t.setAttribute("aria-owns",e):t.removeAttribute("aria-owns")),void(o&&t.$.fireEvent(o+("open"===n?"Open":"Close"),s))}if(r?o="opening"===n?"contextMenuOpening":"contextMenuClosing":a&&(o="opening"===n?"eventMenuOpening":"eventMenuClosing"),o&&t.$.fireEvent(o,s).defaultPrevented)return!0}_tooltipChangeHandler(e){const t=this,n=t._calendar;if(e.target===n){e.stopPropagation();const i=t.dateCurrent;return t.set("dateCurrent",n.selectedDates[0]||t.dateCurrent),t.dateCurrent.getTime()!==i.getTime()&&t.$.fireEvent("dateChange",{oldValue:new Date(t.dateCurrent),value:new Date(i)}),t._refreshDateSelector(),t._createTimeline(),void e.context.close()}}_tooltipClickHandler(e){const t=this,n=t.$.tooltip,i=t.isInShadowDOM?(e||e.originalEvent).composedPath()[0]:(e||e.originalEvent).target;if(t.$.viewItemsContainer.contains(i)){const e=i.closest(".smart-scheduler-item");return e===t.$.showWeekendItem?t._checkHideWekendItem(e):t._handleViewSelection(e),void n.close()}const r=i.closest(".smart-scheduler-event");if(r)return i.closest(".smart-scheduler-event-button")?void t._handleEventMenuDelete(r):void t._doubleClickHandler(i);const a=i.closest(".smart-scheduler-context-menu-item");a&&t._handleContextMenuItemClick(a)}_handleEventMenuDelete(e){const t=this,n=t.$.tooltip,i=e.$?e.$.event:void 0;if(n.close(),!i)return void t.$.timeline.focus({preventScroll:!0});const r=i.$?i.$.event:void 0;if(r){const n=r&&r.repeat?r.repeat.exceptions:void 0;t._openWindow(n&&n.indexOf(i)>-1?i:Object.assign({},i,{dateStart:e.$.dateStart,dateEnd:e.$.dateEnd}),e,"deleteConfirm")}else t._deleteEventViaWindow(i),t.$.timeline.focus({preventScroll:!0})}_tooltipKeyDownHandler(e){this._keyDownHandler(e)}_tooltipKeyUpHandler(e){this._keyUpHandler(e)}_tooltipDownHandler(e){e.stopPropagation(),this._downHandler(e)}_tooltipContextMenuHandler(e){const t=e.target;t&&t.closest&&t.closest(".smart-scheduler-event")&&e.preventDefault()}_timelineFocusHandler(e){const t=this;if("focusin"===e.type||"focusout"===e.type)return void t._handleEventFocus(e);if(t.readonly||t.hasAttribute("modal"))return;const n=t.$.timelineViewAllDay,i=n.offsetHeight>0;if(!(t._isMobile||t._dragDetails&&t._dragDetails.timelineCellObj))if(t._selectedCellObj){const n=e.relatedTarget,i=t.$.schedulerWindow,r=t.$.confirmWindow;if(i&&i.contains(n)||r&&r.contains(n))return;t._selectedCellObj.from.time!==t._selectedCellObj.to.time&&t._handleCellSelection(t._selectedCellObj.from)}else t._handleCellSelection((i?n:t.$.timelineContent).querySelector(".smart-scheduler-cell:not(.scale)"))}_handleEventFocus(e){const t=e&&"focusin"===e.type?e.target:void 0,n=t&&t.$?t.$.event:void 0,i=this.$.timeline.querySelectorAll(".smart-scheduler-event");let r;for(let e=0;e<i.length;e++){const a=i[e],l=a.$.event;a===t||n&&n===l?(a.setAttribute("focus",""),r=a):a.removeAttribute("focus")}return r}_handleViewSelection(e){const t=this,n=t.$.showWeekendItem,i=t.$.viewItemsContainer.children,r=t.view;let a;if(e instanceof HTMLElement&&(a=e.$?e.$.value:null),a||(a=t.view),a===r||!t.$.fireEvent("viewChanging",{oldValue:r,value:a}).defaultPrevented){for(let t=0;t<i.length;t++){const n=i[t];n.removeAttribute("selected"),!e&&n.$&&n.$.value===a&&(e=n)}e&&e.setAttribute("selected",""),e!==n&&(a!==r&&(t.set("view",a),t._createTimeline(),t._refreshDateSelector(),t._checkHideWekendItem(),t._scrollToView(e),t.$.fireEvent("viewChange",{oldValue:r,value:a})),t.$.viewItemsButton.innerHTML=`<span>${e?e.textContent.trim():t.localize(a)||a}</span>`)}}_checkHideWekendItem(e){const t=this,n=t.viewType.toLowerCase().indexOf("day")<0,i=t.view,r=t.views.find((e=>e.value&&e.value===i))||{},a=r&&void 0!==r.hideWeekend?r.hideWeekend:void 0,l=a&&r.hideWeekend||t.hideWeekend;if(!e){if(!(e=t.$.showWeekendItem)||!e.parentElement)return;return e&&(l&&n?e.removeAttribute("checked"):e.setAttribute("checked","")),void(t.viewType.toLowerCase().indexOf("day")>-1?e.setAttribute("disabled",""):e.removeAttribute("disabled"))}if(!e||!e.parentElement||e!==t.$.showWeekendItem)return;e.hasAttribute("checked")?(e.removeAttribute("checked"),t.set("hideWeekend",!0)):(e.setAttribute("checked",""),t.set("hideWeekend",!1));const o=t.hideWeekend;void 0!==a&&(r.hideWeekend=o),l!==o&&n&&t._createTimeline()}_scrollToView(e){const t=this;if("tabs"!==t.viewSelectorType)return;const n=t.$.viewItemsContainer;if(!(e=e||n.querySelector(".smart-scheduler-item[selected]")))return;const i=n.offsetWidth,r=e.offsetLeft,a=r+e.offsetWidth;let l=n.scrollLeft;l>r?l=n.scrollLeft=r:l+i<a&&(l=n.scrollLeft=a-i);const o=t._viewButtons;o&&(o.prev.disabled=!l,o.next.disabled=Math.abs(l)+i===n.scrollWidth)}_resizeEventHandler(e){const t=this;function n(){if(t._noResizeHandler)return void delete t._noResizeHandler;t._refreshHeaderControlsVisibility();const e=t.$.tooltip;t._positionWindow(),t._createTimeline(),e.visible&&(e.contains(t._contextList)?e.close():e.reposition()),t._refreshViewSelector(),t._resizeLegend&&t._resizeLegend()}(e?t.enableShadowDOM?e.composedPath()[0]:e.target:void 0)===t&&(clearTimeout(t._resizeTimeout),t.resizeInterval?t._resizeTimeout=setTimeout(n.bind(t),t.resizeInterval):n())}_setScrollBars(){const e=this;e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e.$.timeline,e.$.horizontalScrollBar,e.$.verticalScrollBar));const t=e._scrollView.vScrollBar,n=e._scrollView.hScrollBar;n.$.addClass("smart-hidden"),t.$.addClass("smart-hidden"),t.hasStyleObserver=!1,n.hasStyleObserver=!1,t.hasResizeObserver=!1,n.hasResizeObserver=!1,n.wait=!1,t.wait=!1,e._refresh()}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.removeAttribute("tabindex"),e.$.timeline.removeAttribute("tabindex"),void e.$.viewItemsContainer.removeAttribute("tabindex");const t=e.tabIndex>0?e.tabIndex:0;e.tabIndex=t,e.$.tooltip.tabIndex=t,e.$.timeline.tabIndex=t,e.$.viewItemsContainer.tabIndex=t}_toHex(e){function t(e){const t=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");return isNaN(e)?"00":t[(e-e%16)/16]+t[e%16]}return(e=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+t(e[1])+t(e[2])+t(e[3]).toUpperCase():"#ffffff"}_setExportStyles(e,t){const n=this;if(e.style)return;const i=e.header.columns,r=window.getComputedStyle(n),a={height:r.getPropertyValue("--smart-scheduler-timeline-header-horizontal-cells-size"),border:"1px solid "+n._toHex(r.borderColor),fontFamily:"Helvetica",fontSize:r.fontSize,color:n._toHex(r.color),backgroundColor:n._toHex(r.backgroundColor),fontWeight:"400"},l={border:"1px solid "+n._toHex(r.borderColor),fontFamily:r.fontFamily,fontSize:r.fontSize},o=n._timelineCells;let s,d;o&&o.vertical&&o.horizontal&&(s=o.vertical[0]?o.vertical[0].height:void 0,d=o.horizontal[0]?o.horizontal[0].width:void 0),void 0===s&&(s=Math.max(parseFloat(r.getPropertyValue("--smart-scheduler-timeline-cell-height"))||0,parseFloat(r.getPropertyValue("--smart-scheduler-timeline-cell-min-height")||0))),void 0===d&&(d=Math.max(parseFloat(r.getPropertyValue("--smart-scheduler-timeline-cell-width"))||0,parseFloat(r.getPropertyValue("--smart-scheduler-timeline-cell-min-width")||0))),"pdf"===t?d=100/i.length+"%":d+="px",s+="px";for(let e=0;e<i.length;e++){const t=i[e];a[t.dataField]={textAlign:"center",width:d},l[t.dataField]={textAlign:"start",format:t.dataField.indexOf("date")>-1?"f":""}}e.style={border:"1px solid "+n._toHex(r.borderColor),borderCollapse:"collapse",header:a,columns:l,rows:{height:s}}}_getExportRecord(e){const t=this,n=t.locale,i=t._events,r=t.resources,a=i[0],l=t.yearFormat,o=t.monthFormat,s=t.dayFormat,d=t.hourFormat,c=t.minuteFormat;let u=t.dataExport.columns,h={};if(!u||!u.length){const e=["id","label","description","dateStart","dateEnd"];u=Object.keys(a).filter((t=>e.indexOf(t)>-1)),r.forEach((e=>u.push(e.value)))}for(let a=0;a<u.length;a++){const m=u[a],v=r.find((e=>e.value===m));if(e){if(v&&e[v.value]){if(v&&v.dataSource){const t=v.dataSource.find((t=>t.id===e[v.value]));h[m]=t&&t.label||""}}else{const t=e[m];t instanceof Date?h[m]=new Intl.DateTimeFormat(n,{year:l,month:o,day:s,hour:d,minute:c}).format(t):h[m]=t||""}h._keyDataField=i.indexOf(e)}else h[m]=(v?v.label:t.localize(m)||m)||""}return h}_refresh(){const e=this;function t(){const t=e.$.timelineContent.offsetWidth-e.$.timelineContainer.offsetWidth;return t>0&&"hidden"!==e.horizontalScrollBarVisibility||"visible"===e.horizontalScrollBarVisibility?e.$container.addClass("hscroll"):e.$container.removeClass("hscroll"),t}function n(){const t=e.$.timelineContent.offsetHeight-e.$.timelineContainer.offsetHeight;return t>0&&"hidden"!==e.verticalScrollBarVisibility||"visible"===e.verticalScrollBarVisibility?e.$container.addClass("vscroll"):e.$container.removeClass("vscroll"),t}const i=e.scrollWidth,r=e.scrollHeight;let a=t(),l=n();l&&r===l||(a=t()),a&&i===a||(l=n()),e.scrollWidth=a,e.scrollHeight=l,e.$.horizontalScrollBar.refresh(),e.$.verticalScrollBar.refresh()}_setHeader(){const e=this,t=e.$.header,n=e.$.todayDate;if(e.headerTemplate)e._applyTemplate("headerTemplate",t);else{const n=e.$.dateSelectorContainer;t.contains(n)||(t.innerHTML="",t.appendChild(n),t.appendChild(e.$.viewSelectorContainer)),e._setLegend(t)}t.contains(n)&&(n.innerHTML=`<span>${e.localize("today")}</span>`),e._refreshDateSelector(),e._refreshViewSelector(),e._refreshHeaderControlsVisibility()}_refreshHeaderControlsVisibility(){const e=this,t=e.viewSelectorType;if("tabs"===t||"auto"===t&&!e._isMobile)return;const n=e.offsetWidth,i=e.$.todayDate,r=e.$.currentDate;n<=500?i.classList.add("smart-hidden"):i.classList.remove("smart-hidden"),n<=320?r.classList.add("smart-hidden"):r.classList.remove("smart-hidden")}_setFooter(){const e=this,t=e.$.footer;if(null===e.footerTemplate)return t.innerHTML=null,e._setLegend(t),void(t.children.length||e.$.container.removeAttribute("show-footer"));e.$.container.setAttribute("show-footer",""),e._applyTemplate("footerTemplate",t)}_setLegend(e){const t=this,n=t.$.footer,i="header"===t.legendLocation?t.$.header:n;if(e&&e!==i)return;let r=t._legend;if(!t.showLegend)return r&&(r.innerHTML="",r.remove()),void(i!==n||n.children.length||t.$.container.removeAttribute("show-footer"));r||(r=t._legend=document.createElement("div"),r.classList.add("smart-scheduler-legend"),r.setAttribute("role","presentation"));const a=t.resources,l=1===a.length,o=r.children;for(let e=0;e<a.length;e++)a[e].dataSource.length&&t._refreshLegendItems(e,l);for(;a.length<o.length;)o.lastElementChild.remove();i.contains(r)||i.appendChild(r)}_refreshLegendItems(e,t){const n=this,i=n.resources[e],r=n._legend;let a,l,o=r.children[e];o||(o=document.createElement("div"),o.classList.add("smart-scheduler-legend-item"),o.setAttribute("role","listbox")),o.setAttribute("resource",i.value+"");const s=o.children;for(let e=0;e<s.length;e++){const t=s[e];t.classList.contains("smart-scheduler-legend-res-label")?a=t:t.classList.contains("smart-scheduler-legend-res-items")&&(l=t)}a||t?a&&t&&a.remove():(a=document.createElement("label"),a.classList.add("smart-scheduler-legend-res-label"),a.id=n.id+"LegendResourceLabel"),a&&(a.textContent=i.label||"",o.setAttribute("aria-labelledby",a.id)),l||(l=document.createElement("div"),l.classList.add("smart-scheduler-legend-res-items"),l.setAttribute("role","presentation")),n._refereshLegendResItems(i,l),o.contains(l)||o.appendChild(l),t||o.contains(a)||o.insertBefore(a,l),r.contains(o)||r.appendChild(o)}_refereshLegendResItems(e,t){const n=this,i=n.filter,r=t.children,a=Math.max(n.tabIndex,0),l=e.dataSource,o=e.value;let s=0;for(let e=0;e<l.length;e++){const n=l[e];let d=r[e];if(d||(d=document.createElement("div"),d.classList.add("smart-scheduler-legend-res-item"),d.setAttribute("role","option")),d.innerHTML=`<span>${n.label||""}</span>`,d.title=n.label,s+=n.label.length,d.setAttribute("aria-label",n.label),d.setAttribute("resource",o+""),d.setAttribute("resource-id",n.id+""),i&&Array.isArray(i)){let e=i.find((e=>e.name===o));e&&"function"==typeof e.value&&!e.value(n.id)?d.setAttribute("unselected",""):d.removeAttribute("unselected")}else d.removeAttribute("unselected");n.disabled?(d.setAttribute("disabled",""),d.removeAttribute("tabindex"),d.removeAttribute("aria-selected")):(d.removeAttribute("disabled"),d.setAttribute("tabindex",a),d.hasAttribute("unselected")?d.setAttribute("aria-selected",!1):d.setAttribute("aria-selected",!0)),n.backgroundColor?d.style.setProperty("--smart-scheduler-legend-item-background",n.backgroundColor):d.style.removeProperty("--smart-scheduler-legend-item-background"),t.contains(d)||t.appendChild(d)}for(;l.length<r.length;)t.lastElementChild.remove();n._resizeLegend=()=>{let e=14*s*.52;const i=[...t.querySelectorAll(".smart-scheduler-legend-res-item")];i.forEach((e=>{e.classList.remove("smart-hidden")})),"auto"===this.legendLayout?e>n.offsetWidth?(t.querySelectorAll("span").forEach((e=>{e.classList.add("smart-hidden")})),n.offsetWidth<550||i.length>n.legendLayoutMenuBreakpoint?(i.forEach((e=>{e.classList.add("smart-hidden")})),n._legendList.close(),n._legendList.classList.remove("smart-hidden")):(n._legendList.close(),n._legendList.classList.add("smart-hidden"))):(n._legendList.close(),n._legendList.classList.add("smart-hidden"),t.querySelectorAll("span").forEach((e=>{e.classList.remove("smart-hidden")}))):""===this.legendLayout?(n._legendList.close(),n._legendList.classList.add("smart-hidden"),t.querySelectorAll("span").forEach((e=>{e.classList.remove("smart-hidden")}))):"menu"===this.legendLayout&&(t.querySelectorAll("span").forEach((e=>{e.classList.add("smart-hidden")})),i.forEach((e=>{e.classList.add("smart-hidden")})),n._legendList.close(),n._legendList.classList.remove("smart-hidden"))},(()=>{const e=document.createElement("smart-check-input");e.classList.add("smart-scheduler-legend-list"),e.dataSource=l.map((e=>{const t=e.label,n=""+e.id;return{label:t,color:e.backgroundColor,value:n}})),e.readonly=!0,e.dataSource.length>10?e.dropDownHeight=200:e.dropDownHeight="auto",e.dropDownOpenPosition="auto",e.dropDownButtonPosition="none",e.checkAll(),e.onItemClick=e=>{const n=e.detail.index;t.children[n].click()},t.appendChild(e),n._legendList=e,e.classList.add("smart-hidden")})(),n._resizeLegend()}_refreshDateSelector(){const e=this,t=e.locale,n=e.$.currentDate;if(!e.$.header.contains(n))return;let i=new Smart.Utilities.DateTime(new Date(e.dateCurrent)).toDate(e.timeZone);isNaN(i.getTime())&&(i=new Date);let r="";if(e.dateSelectorFormatFunction)r=e.dateSelectorFormatFunction(i)+"";else{const n=e.viewType.toLowerCase(),a=e.dayFormat,l=e.monthFormat,o=e.yearFormat;if(n.indexOf("day")>-1)r=new Intl.DateTimeFormat(t,{day:a}).format(i);else if(n.indexOf("week")>-1||"agenda"===n){let s=new Date(i);"agenda"!==n&&s.setDate(s.getDate()-s.getDay()+e.firstDayOfWeek),"dateCurrent"===e.viewStartDay&&(s=new Date(i));let d=new Date(s);d.setDate(d.getDate()+6);const c=e.views.find((t=>t.value&&t.value===e.view))||{};if(c.additionalDays){let e=new Smart.Utilities.DateTime(s);e=e.addDays(6+c.additionalDays),d=e.toDate()}r=new Intl.DateTimeFormat(t,{day:a}).format(s),s.getMonth()!==d.getMonth()&&(r+=" "+new Intl.DateTimeFormat(t,{month:l}).format(s)),s.getFullYear()!==d.getFullYear()&&(r+=" "+new Intl.DateTimeFormat(t,{year:o}).format(s)),r+="-"+new Intl.DateTimeFormat(t,{day:a}).format(d),i=d}r+=" "+new Intl.DateTimeFormat(t,{month:l}).format(i)+" "+new Intl.DateTimeFormat(t,{year:o}).format(i)}n.innerHTML=r}_refreshViewSelector(){const e=this,t=e.views,n=e.viewSelectorType,i=e.$.viewSelectorContainer,r=e.$.viewItemsContainer,a=e.$.viewItemsButton,l=e.$.tooltip,o=l.contains(r);let s=e.$.showWeekendItem;if(!e.$.header.contains(a))return;for(i.classList.add("smart-visibility-hidden"),a.classList.add("smart-visibility-hidden"),i.classList.remove("no-overflowing"),r.remove(),s&&s.remove();t.length<r.children.length;)r.firstElementChild.remove();for(;t.length>r.children.length;){const e=document.createElement("div");e.classList.add("smart-scheduler-item"),e.setAttribute("role","option"),r.appendChild(e)}const d=r.children;for(let n=0;n<d.length;n++){const i=d[n],r=t[n];let a,l;if("string"==typeof t[n])i.innerHTML="<div>"+e.localize(a=t[n])+"</div>";else{const t=r.label;a=r.value,i.innerHTML="<div>"+("string"!=typeof t&&isNaN(t)?e.localize(a):t)+"</div>",l=r.shortcutKey}void 0===l&&(l=e.localize(a+"Shortcut")),l?i.setAttribute("shortcut-key",e.localize(l)||l):i.removeAttribute("shortcut-key"),i.$={value:a}}if(i.appendChild(r),e._viewButtons)for(let t in e._viewButtons)e._viewButtons[t].remove();const c=i.offsetWidth-r.offsetWidth<0;if("tabs"===n){let t,n;return o&&l.close(),c&&(e._viewButtons||(t=document.createElement("smart-repeat-button"),n=document.createElement("smart-repeat-button"),t.classList.add("smart-scheduler-nav"),n.classList.add("smart-scheduler-nav"),t.setAttribute("prev",""),n.setAttribute("next",""),t.setAttribute("aria-label","Previous View"),n.setAttribute("aria-label","Next View"),e._viewButtons={prev:t,next:n}),t=e._viewButtons.prev,n=e._viewButtons.next,i.classList.add("no-overflowing"),i.insertBefore(t,r),i.appendChild(n),e._scrollToView()),i.removeAttribute("show-menu"),i.classList.remove("smart-visibility-hidden"),void e._handleViewSelection()}delete e._viewButtons,"menu"===n||c?(e.hideViewMenuCheckableItems?s&&s.remove():r.contains(s)||(s||(s=e.$.showWeekendItem=document.createElement("div"),s.classList.add("smart-scheduler-item"),s.setAttribute("checkable",""),s.setAttribute("separator","")),s.innerHTML="<div>"+e.localize("showWeekends")+"</div>",e._checkHideWekendItem(),r.appendChild(s)),o?(l.clear(),l.appendChild(r)):r.remove(),i.setAttribute("show-menu",""),a.classList.remove("smart-visibility-hidden")):(i.removeAttribute("show-menu"),o&&l.close()),i.classList.remove("smart-visibility-hidden"),e._handleViewSelection()}_checkNotifications(e){const t=this,n=t._events,i=t.$.toast;if(e&&(i&&i.isCompleted&&i.items.forEach((e=>{e.classList.contains("smart-scheduler-event-notification")&&i.closeItem(e)})),delete t._notificationObj,delete t._notificationsInterval),clearInterval(t._notificationsInterval),!n)return t._removeToast(),delete t._notificationsInterval,void delete t._notificationObj;let r=t._notificationObj;if(r||(r=t._notificationObj={events:n.filter((e=>Array.isArray(e.notifications)))}),!r.events)return t._removeToast(),void delete t._notificationsInterval;t._notificationsInterval||t._refreshNotifications(),t._notificationsInterval=setInterval(t._refreshNotifications.bind(t),1e3*t.notificationInterval)}_removeToast(){const e=this,t=e.$.toast;if(t){const n=e.$toast;n.unlisten("open"),n.unlisten("close"),t.remove()}}_appendToast(){const e=this,t=e.$.toast;if(!e.$.container.contains(t)){const n=e.$toast;n.listen("open",e._toastVisibilityHandler.bind(e)),n.listen("close",e._toastVisibilityHandler.bind(e)),e.$.container.appendChild(t)}}_toastVisibilityHandler(e){const t=this.$.toast;e.target===t&&(e.stopPropagation(),this.$.fireEvent("open"===e.type?"notificationOpen":"notificationClose",e.detail))}_refreshNotifications(){const e=this,t=e._notificationObj;if(!t)return void clearInterval(e._notificationsInterval);const n=t.events;let i=new Date;if(i.setSeconds(0,0),i=i.getTime(),t.time===i)return;t.time=i;const r=e._getNotificationEvents(n,i);let a=[];for(let e=0;e<r.length;e++){const t=r[e],n=t.dateStart.getTime(),l=t.notifications;Array.isArray(l)&&l.forEach((e=>{const r=(e.interval||0)*("days"===e.type||0===e.type?1:7),l=e.time,o=new Date(n-24*r*60*60*1e3);o.setHours(l[0]%23,l[1]%60,0,0),o.getTime()===i&&a.push({dateStart:t.dateStart,label:t.label,message:e.message,iconType:e.iconType})}))}e._notifyForUpcomingEvents(a)}_getNotificationEvents(e,t){const n=this;let i=[];const r=t+24192e5,a=n._rRule,l={isMonthView:!0,hourStart:n.hourStart,hourEnd:n.hourEnd,restrictedDates:n.restrictedDates,restrictedHours:n.restrictedHours,dateStart:new Date(t),dateEnd:new Date(r),rRule:a,targetEvents:i};for(let o=0;o<e.length;o++){const s=e[o],d=s.dateStart,c=s.dateEnd;if(!d||!c)continue;const u=d.getTime(),h=c.getTime();if(s.repeat&&a){const e=n._getEventRepeatOptions(s);if(e){l.event=s,l.repeatObj=s.repeat,l.options=e,l.eventTimeStart=u,l.eventTimeEnd=h,n._setRepeatingEvents(l);continue}}else u>=t&&u<=r&&i.push(s)}return i}_notifyForUpcomingEvents(e){const t=this;if(!e.length)return;t._setToast();const n=t.$.toast;t._appendToast();const i=t.dayFormat,r=t.monthFormat,a=t.weekdayFormat,l=t.locale,o=t.hourFormat,s=t.minuteFormat,d=Smart.Utilities.DateTime,c=t.timeZone;for(let u=0;u<e.length;u++){const h=e[u],m=new d(h.dateStart).toDate(c),v=h.message?h.message:h.label+" "+t.localize("notificationMessage")+" "+new Intl.DateTimeFormat(l,{day:i,weekday:a,month:r}).format(m)+" at "+new Intl.DateTimeFormat(l,{hour:o,minute:s}).format(m);n.open(v,h.iconType)}}_setToast(){const e=this;let t=e.$.toast;t||(e.$.toast=t=document.createElement("smart-toast"),t.appendTo=e.$.timeline,t.showCloseButton=!0,t.itemClass="smart-scheduler-event-notification",e.$toast=Smart.Utilities.Extend(t)),t.rightToLeft=e.rightToLeft,t.theme=e.theme,t.animation=e.animation}_createEvents(e,t){const n=this;let i=void 0!==e;if(i||(e=n.dataSource,n._clearEvents()),n.dataSource instanceof Smart.DataAdapter&&(e="ics"===n.dataSource.dataSourceType?n.dataSource.dataSource:n.dataSource.toArray()),!Array.isArray(e)||!e.length)return;const r=n.viewType;let a=[];for(let i=0;i<e.length;i++){const l=e[i];if(!l)continue;let o,s,d=l.allDay;if("string"==typeof d&&(d="true"===d),d=!!d,o=n._dateValidator(void 0,l.dateStart),s=n._dateValidator(void 0,l.dateEnd),!o||!o.getTime())continue;switch(s&&s.getTime()||(s=new Date(o),s.setHours(s.getHours(),s.getMinutes()+60/n._getCellsScaleCount(),0,0)),s=new Date(Math.max(o.getTime(),s.getTime())),r){case"week":case"day":case"timelineWeek":case"timelineDay":d&&s.setHours(23,59,59,999);break;default:d&&0===s.getHours()&&0===s.getMinutes()&&0===s.getSeconds()&&0===s.getMilliseconds()&&(s=new Date(s.getTime()-1))}const c=Object.assign({},l,{dateStart:o,dateEnd:s,allDay:d,label:l.label||""});let u=c.repeat;if(u){u=c.repeat=Object.assign({},u);const e=["hourly","daily","weekly","monthly","yearly"];for(let t in u)if("repeatFreq"===t&&e.indexOf(u[t])<0)u[t]=e[0];else if("repeatInterval"===t)u[t]=isNaN(u[t])?1:u[t];else if("exceptions"===t){let e=u[t];e=Array.isArray(e)?e.slice():[e];for(let t=0;t<e.length;t++){let i=e[t];void 0===i.date?i={date:n._parseDate(i)}:(i=Object.assign({},i),i.date?i.date instanceof Date||(i.date=n._parseDate(i.date)):i.date=new Date(i.dateStart)),i.dateStart?i.dateStart instanceof Date||(i.dateStart=n._parseDate(i.dateStart)):i.dateStart=new Date(i.date),i.dateEnd?i.dateEnd instanceof Date||(i.dateEnd=n._parseDate(i.dateEnd)):i.dateEnd=new Date(i.dateStart.getTime()+c.dateEnd.getTime()-c.dateStart.getTime()),delete i.$,e[t]=i}e&&(u[t]=e)}}n._containsEvent(c)||(n._setEventTimeZone(c,t),a.push(c))}if(i)return a;n._removeToast(),delete n._notificationsInterval,delete n._notificationObj,n._events=a}_setEventTimeZone(e,t="local"){const n=(new(0,Smart.Utilities.DateTime)).timeZones,i=this.timeZone.toLowerCase(),r=(t||this.timeZone).toLowerCase();if(!e||!e.dateStart||!e.dateEnd)return;if(t&&i===r)return;const a=n.find((e=>e.id.toLowerCase()===i));if(!a)return;let l=n.find((e=>e.id.toLowerCase()===r)),o=new Date(e.dateStart),s=new Date(e.dateEnd);const d=n.find((e=>"local"===e.id.toLowerCase()));l||(l=d);const c=d.offset,u=60*(-1*o.getTimezoneOffset()-d.offset)*1e3,h=60*(-1*s.getTimezoneOffset()-d.offset)*1e3,m=60*l.offset*1e3,v=60*a.offset*1e3;if(e.allDay||(e.dateStart=new Date(o.getTime()-u-m+v),e.dateEnd=new Date(s.getTime()-h-m+v)),e.repeat&&e.repeat.exceptions){const t=e.repeat.exceptions;for(let e=0;e<t.length;e++){const n=t[e];if(n.allDay)continue;const i=60*(-1*n.date.getTimezoneOffset()-c)*1e3,r=60*(-1*n.dateStart.getTimezoneOffset()-c)*1e3,a=60*(-1*n.dateEnd.getTimezoneOffset()-c)*1e3;n.date=new Date(n.date.getTime()-i-m+v),n.dateStart=new Date(n.dateStart.getTime()-r-m+v),n.dateEnd=new Date(n.dateEnd.getTime()-a-m+v)}}}_clearEvents(){const e=this;e._events=[],e._eventList&&(e._eventList.innerHTML=null),e.$.timelineEventsContainer.innerHTML="",e.$.allDayEventsContainer.innerHTML="",delete e._eventsBetween,e.rendered&&e._refreshTimelineEvents()}_refreshEvents(){const e=this,t=e._events,n=e.$.timelineEventsContainer,i=e.$.allDayEventsContainer,r=e._timelineCells;if(!(t&&r.horizontal&&r.horizontal.length&&r.vertical&&r.vertical.length))return n.innerHTML="",i.innerHTML="",void delete e._eventsBetween;let a=e._eventsBetween?e._eventsBetween.eventCellDetails:void 0,l=[],o={};const s=e.view,d=e.views.find((e=>e.value&&e.value===s))||{},c=d?parseFloat(d.maxEventsPerCell):NaN;if(isNaN(c)?null!==e.maxEventsPerCell&&(o.maxEventsPerCell=e.maxEventsPerCell):o.maxEventsPerCell=c,a){const t=a.eventGroups,n=a.cellRanges,i=a.allDayEventGroups,r=a.allDayEventCellRanges;for(let i=0;i<t.length;i++)o.events=t[i],o.eventCells=n[i],l=l.concat(e._createTimelineEvents(o));for(let t=0;t<i.length;t++)o.events=i[t],o.eventCells=r[t],o.isAllDay=!0,l=l.concat(e._createTimelineEvents(o))}else l=e._createViewEvents();if(e.hasAttribute("resized"))return;const u=Array.from(n.children).concat(Array.from(i.children)),h=e._eventList;for(let e=0;e<u.length;e++){const t=u[e];l.indexOf(t)<0&&(t.remove(),h&&h._target===t&&(h.innerHTML="",delete h._target))}e._handleEventCut()}_createViewEvents(){const e=this,t=e._events,n=e._timelineCells.groups,i=e._getViewEvents();let r=[];const a=e.$.timeline.querySelectorAll(".smart-scheduler-event[collector]");for(let e=0;e<a.length;e++)a[e].$&&(a[e].$.events=a[e].$.events.reduce(((e,n)=>(t.indexOf(n)>-1&&e.push(n),e)),[]));return r=n&&n.length>0?e._createGroupedEvents(i,n):e._createNonGroupedEvents(i),r}_createNonGroupedEvents(e){const t=this;let n=[],i={};const r={eventGroups:[],cellRanges:[],allDayEventGroups:[],allDayEventCellRanges:[]},a=t.view,l=t.views.find((e=>e.value&&e.value===a))||{},o=l?parseFloat(l.maxEventsPerCell):NaN;isNaN(o)?null!==t.maxEventsPerCell&&(i.maxEventsPerCell=t.maxEventsPerCell):i.maxEventsPerCell=o;const s=t._getTimelineEventCells(e,[]),d=t._separateAllDayEvents(e,s);return d.events.length&&(i.events=d.events,i.eventCells=d.eventCells,r.eventGroups.push(d.events),r.cellRanges.push(d.eventCells),n=n.concat(t._createTimelineEvents(i))),d.allDayEvents.length&&(i.events=d.allDayEvents,i.eventCells=d.allDayEventCells,i.isAllDay=!0,r.allDayEventGroups.push(d.allDayEvents),r.allDayEventCellRanges.push(d.allDayEventCells),n=n.concat(t._createTimelineEvents(i))),t._eventsBetween.eventCellDetails=r,n}_createGroupedEvents(e,t){const n=this;let i=[],r={};const a=n.view,l=n.views.find((e=>e.value&&e.value===a))||{},o=l?parseFloat(l.maxEventsPerCell):NaN;isNaN(o)?null!==n.maxEventsPerCell&&(r.maxEventsPerCell=n.maxEventsPerCell):r.maxEventsPerCell=o;const s={eventGroups:[],cellRanges:[],allDayEventGroups:[],allDayEventCellRanges:[]};let d=[];const c=t[t.length-1].cells;let u={events:[],eventCells:[]};for(let t=0;t<c.length;t++){const a=e.filter((e=>n._isEventPartOfGroup(e,c[t]))),l=n._getTimelineEventCells(a,d),o=n._separateAllDayEvents(a,l);u.events=u.events.concat(o.allDayEvents),u.eventCells=u.eventCells.concat(o.allDayEventCells),o.events.length&&(r.events=o.events,r.eventCells=o.eventCells,s.eventGroups.push(o.events),s.cellRanges.push(o.eventCells),i=i.concat(n._createTimelineEvents(r)))}const h=u.events.slice();n._sortEventCellObjs(u.events,["day","week"].indexOf(n.viewType)>-1),u.eventCells=u.events.map((e=>u.eventCells[h.indexOf(e)]));for(let e=0;e<u.events.length;e++)r.events=u.events,r.eventCells=u.eventCells,r.isAllDay=!0,s.allDayEventGroups.push(u.events),s.allDayEventCellRanges.push(u.eventCells),i=i.concat(n._createTimelineEvents(r));return n._eventsBetween.eventCellDetails=s,i}_separateAllDayEvents(e,t){let[n,i,r,a]=[[],[],[],[]];if(["day","week"].indexOf(this.viewType)<0)r=e,a=t;else for(let l=0;l<e.length;l++){const o=e[l];o.allDay||o.dateEnd.getTime()-o.dateStart.getTime()>=864e5?(n.push(o),i.push(t[l])):(r.push(o),a.push(t[l]))}return{allDayEvents:n,allDayEventCells:i,events:r,eventCells:a}}_getViewEvents(){const e=this,t=e.viewType.toLowerCase(),n=e.dateCurrent,i=e.firstDayOfWeek;let r=new Date(n),a=new Date(n);if("agenda"===t)r.setHours(0,0,0,0),a.setDate(a.getDate()+6),a.setHours(23,59,59,999);else if(t.indexOf("month")>-1)if(r.setDate(1),e.hideOtherMonthDays)r.setHours(0,0,0,0),a=new Date(r),a.setDate(32),a.setDate(0),a.setHours(23,59,59,999);else{r.setDate(r.getDate()-(r.getDay()-i+7)%7),r.setHours(0,0,0,0),a=new Date(r);for(let e=0;e<5;e++)a.setDate(a.getDate()+7);a.setDate(a.getDate()+6),a.setHours(23,59,59,999)}else if(t.indexOf("week")>-1){"dateCurrent"!==e.viewStartDay&&r.setDate(r.getDate()-r.getDay()+i),a.setDate(r.getDate()+6),r.setHours(0,0,0,0);const t=e.views.find((t=>t.value&&t.value===e.view))||{};if(t.additionalDays){let e=new Smart.Utilities.DateTime(r);e=e.addDays(6+t.additionalDays),a=e.toDate()}a.setHours(23,59,59,999)}else t.indexOf("day")>-1&&(r.setHours(0,0,0,0),a.setHours(23,59,59,999));return e._getEventsBetween(r,a)}_refreshTimelineEvents(){const e=this;delete e._eventsBetween,"agenda"===e.viewType?e._createTimeline():(e._refreshEvents(),e._checkNotifications(!0))}_getTimelineEventCells(e,t){const n=this,i=["day","week"].indexOf(n.viewType)>-1,r=n.hideAllDay;let a=[];for(let l=0;l<e.length;l++){const o=e[l];let s,d=[];i&&(o.allDay||o.dateEnd.getTime()-o.dateStart.getTime()>=864e5)&&(s=!0),o.hidden||s&&r?a.push(d):(d=n._getEventTimelineCells(o,t,s),a.push(n._getEventTimelineCellRanges(d,s)))}return a}_createTimelineEvents(e){const t=this,n=e.events,i=e.eventCells,r=e.isAllDay,a=t.viewType,l=t.view,o=t.views.find((e=>e.value&&e.value===l))||{},s=t.eventRenderMode,d=e.maxEventsPerCell,c="classic"===s?"month"===a?t._monthViewNumberSize:0:t._eventCollectorSize,u=["day","week"].indexOf(a)>-1,h=t._getCellSize(),m=h[u?"width":"height"]-c,v=void 0!==d?m/d:Math.min(m,t._eventSize);let g={events:n,eventCells:i,viewType:a,viewDetails:o,isAllDayEvent:r,isMobile:t.$.timeline.hasAttribute("mobile"),isDayOrWeekView:u,rightToLeft:t.rightToLeft,eventRenderMode:s,eventSize:v,collectorSize:c,usedEventCells:[],eventIndexes:[],maxEventsPerCell:d};return r?(g.cellSize={height:t._allDayCellSize,width:h.width},g.spaceAvailable=t._allDayCellSize-c,g.currentEvents=t.$.allDayEventsContainer.children,void 0!==d&&(g.eventSize=g.spaceAvailable/d),t._setVerticalTimelineEvents(g)):(g.cellSize=h,g.spaceAvailable=m,g.currentEvents=t.$.timelineEventsContainer.children,u?t._setHorizontalTimelineEvents(g):t._setVerticalTimelineEvents(g)),g.usedEventCells}_setHorizontalTimelineEvents(e){const t=this,n=e.events,i=e.eventCells,r=e.eventRenderMode;if("modern"===r&&e.isMobile)return t._setAgendaOrMobileEvents(e);const a=e.eventIndexes,l=e.spaceAvailable,o="classic"===r?1:void 0!==e.maxEventsPerCell?e.eventSize:t._eventSize,[s,d]=[t.scrollTop,t.scrollLeft],[c,u]=[s+t._scrollViewSize.height,d+t._scrollViewSize.width],h=t._getEventsCollisionIndexes(e),m=h.eventOverlaps,v=h.eventCollisionsCount;for(let h=0;h<n.length;h++){const g=i[h],f=n[h];let p=v[h];for(let i=0;i<g.length;i++){const w=g[i],y=w[0];if(!y)continue;const _=w[w.length-1],[b,D]=[y.vertical,_.vertical],[C,E]=[y.horizontal,_.horizontal];if(D.top+D.height<s||b.top>c||E.left+E.width<d||C.left>u)continue;const T=a[h],S=m.filter((e=>e.indexOf(f)>-1));for(let e=0;e<S.length;e++){const t=S[e].reduce(((e,t)=>Math.max(e,v[n.indexOf(t)]||1)),1);p=Math.max(p,t)}"modern"===r&&(p=Math.min(Math.floor(l/o),p));let O=1;for(let e=T+1;e<p&&S.every((t=>t.map((e=>a[n.indexOf(e)])).indexOf(e)<0));e++)O++;e.eventObj=f,e.cellEventsCount=p,e.cellRange=w,e.eventIndex=T,e.eventSize=l/p*O,"modern"===r&&(T+1)*o>l?t._addEventToCollector(e):t._setEventCell(e)}}return e.usedEventCells}_getAllEventCollisions(e,t,n){const i=this;n||(n=t);for(let r=0;r<n.length;r++){let a=e.filter((e=>n[r].some((t=>e.indexOf(t)>-1))&&t.indexOf(e)<0));a.length&&(t=i._getAllEventCollisions(e,t.concat(a),a))}return t}_getEventsCollisionIndexes(e){const t=this,n=e.events,i=e.eventCells,r=e.eventIndexes;let a=[],l=[],o=0;for(let s=0;s<n.length;s++){const d=n[s];if(!i[s].length)continue;e.eventObj=d;const c=t._getEventsInCollision(e);let u=a.filter((e=>c.some((t=>e.indexOf(t)>-1))));if(l[s]=c.length,u.length){o!==l[s]&&(u=t._getAllEventCollisions(a,u)),u.sort(((e,t)=>t.length-e.length));let e=Math.max(c.length,u[0].length);u.forEach((t=>t.forEach((t=>{const i=n.indexOf(t);l[i]=Math.max(l[i]||0,e)}))))}o=Math.max(o,l[s]),a[s]=c,r[s]=c.indexOf(d)}return{eventOverlaps:a,eventCollisionsCount:l}}_getEventsInCollision(e){const t=this,n=t._getEventCellDetails(e),i=n.eventCellStartTime,r=n.eventCellEndTime,a=n.hCellGroup,l=n.vCellGroup,o=e.isDayOrWeekView&&void 0!==l?void 0:l||a;let s=e.events,d=[],c=[];for(let e=0;e<s.length;e++){const n=s[e];if(o&&!t._isEventPartOfGroup(n,o))continue;const a=n.dateStart.getTime(),l=n.dateEnd.getTime();a>=i&&a<=r?d.push(n):l>i&&a<r&&c.push(n)}return!d.length&&c.length&&(d=c,c=[]),t._sortEventCellObjs(d,e.isDayOrWeekView),t._getOrderedEventCollision(e,d,c)}_sortEventCellObjs(e,t){t?e.sort(((e,t)=>{const n=e instanceof HTMLElement?e.$.event:e,i=t instanceof HTMLElement?t.$.event:t,r=n.dateStart.getTime(),a=i.dateStart.getTime();return r===a?i.dateEnd.getTime()-n.dateEnd.getTime():r-a})):e.sort(((e,t)=>{const n=e instanceof HTMLElement?e.$.event:e,i=t instanceof HTMLElement?t.$.event:t;n.dateStart.getTime(),i.dateStart.getTime()}))}_getOrderedEventCollision(e,t,n){const i=e.events,r=e.eventIndexes,a=Math.max(e.eventsInCollision||1,t.length+n.length);let l=[];if(n.length){const e=n.map((e=>r[i.indexOf(e)]));for(let i=0;i<a;i++){const r=n[e.indexOf(i)];if(r)l.push(r);else{const e=t.find((e=>l.indexOf(e)<0));e&&l.push(e)}}n.forEach((e=>l.indexOf(e)<0?l.push(e):null))}else l=t;return l}_getEventCellDetails(e){const t=this,n=t.viewType;if("month"===n)return t._getMonthEventCellDetails(e);const i=t.view,r=t.views.find((e=>e.value&&e.value===i))||{},a=e.eventObj,l=a.dateStart,o=a.dateEnd,s=t._getEventHorizontallCellObjs(a),d=t._getEventVerticalCellObjs(a),c=d.start||d.first,u=c.group;let h,m,v,g=s.start,f=0;if(g||(g=s.first),m=g.group,h=g.date,e.isAllDayEvent)h>l.getTime()&&(h=new Date(l),h.setHours(h.getHours(),0,0,0)),v=new Date(h),v.setHours(23,59,59,999),h=h.getTime(),v=v.getTime();else{let e=t._getCellsScaleCount();f=t._getEventScaleIndex(a,n.indexOf("timeline")>-1?g:c).start,h=t._getCellTime({horizontal:g,vertical:c,scaleIndex:f}),h>l.getTime()?(h=new Date(l),h.setHours(h.getHours(),0,0,0),h=h.getTime(),e=1):h<l.getTime()&&(h=new Date(h),h.setMinutes(l.getMinutes()),h=h.getTime()),v=h,"timelineMonth"===n||"timelineWeek"===n&&r&&r.hideHours?v+=86399999:v+=60/e*60*1e3-1,v>o.getTime()&&(v=new Date(v),v.setMinutes(o.getMinutes()),v=v.getTime())}return{eventCellStartTime:h,eventCellEndTime:v,hCellGroup:m,vCellGroup:u}}_getMonthEventCellDetails(e){const t=this,n=e.eventObj,i=n.dateStart,r=n.dateEnd,a=t._getEventVerticalCellObjs(n);let l,o,s,d,c,u=a.start||a.first;u=a.start,d=u.group;const h=new Date(u.date),m=new Date(u.date),v=Object.assign({},n);m.setDate(m.getDate()+6),m.setHours(23,59,59,999),h.setHours(0,0,0,0),v.dateStart=new Date(Math.max(i.getTime(),h.getTime())),v.dateEnd=new Date(Math.min(r.getTime(),m.getTime()));const g=t._getEventHorizontallCellObjs(v);return l=g.start,l||(l=g.first),s=l.group,o=l.date,o=t._getCellTime({horizontal:l,vertical:u,scaleIndex:0}),o>i.getTime()&&(o=new Date(i),o=o.getTime()),c=o+864e5-1,c>r.getTime()&&(c=new Date(c),c.setMinutes(r.getMinutes()),c=c.getTime()),{eventCellStartTime:o,eventCellEndTime:c,hCellGroup:s,vCellGroup:d}}_getEventScaleIndex(e,t){const n=this,i=n._getCellsScaleCount(),r=60/i,a=e.dateStart,l=e.dateEnd;let o,s,d,c,u=0,h=r;if(t){const e=t.date;let r=new Date(e),u=new Date(e);n.viewType.indexOf("timeline")<0&&(r=new Date(a),u=new Date(l),r.setHours(e.getHours(),e.getMinutes(),0,0),u.setHours(e.getHours(),e.getMinutes(),0,0)),r=r.getTime(),u=r+36e5,a.getTime()<=r&&(d=!0,o=0),l.getTime()>=u&&(c=!0,s=i-1)}if(void 0===o||void 0===s){const e=a.getMinutes(),t=l.getMinutes();for(let n=0;n<i;n++)!d&&u<=e&&h>=e&&(o=n),!c&&u<t&&h>=t&&(s=n),u+=r,h+=r}return{start:o||0,end:s||0}}_getEventVisibleDateRange(e){const t=this,n=e.dateStart,i=e.dateEnd;if(t.viewType.toLowerCase().indexOf("day")>-1)return{dateStart:n,dateEnd:i};const r=t.view,a=t.views.find((e=>e.value&&e.value===r))||{};let l,o,s=new Date(n),d=new Date(i),c=[];if(0===d.getHours()&&0===d.getMinutes()&&0===d.getSeconds()&&(d.setDate(d.getDate()-1),d.setHours(23,59,59,999)),(t.hideNonworkingWeekdays||a.hideNonworkingWeekdays)&&(t.nonworkingDays||a.nonworkingDays).forEach((e=>c.push(e))),(t.hideWeekend||a.hideWeekend)&&[0,6].forEach((e=>c.push(e))),![0,1,2,3,4,5,6].every((e=>c.indexOf(e)>-1))){for(;c.indexOf(s.getDay())>-1;)s.setDate(s.getDate()+1),l=!0;for(;c.indexOf(d.getDay())>-1;)d.setDate(d.getDate()-1),o=!0;return s.getTime()<=d.getTime()?{dateStart:l?s:n,dateEnd:o?d:i}:void 0}}_getEventHorizontallCellObjs(e){const t=this,n=t.hourStart,i=t.hourEnd,r=t._getEventVisibleDateRange(e);if(!r)return;const a=r.dateStart,l=r.dateEnd,o=a.getHours(),s=l.getHours(),d=a.getMinutes()+a.getSeconds()+a.getMilliseconds()===0,c=l.getMinutes()+l.getSeconds()+l.getMilliseconds()===0,u=l.getTime()>a.getTime()&&c,h=t.viewType,m=t.view,v=t.views.find((e=>e.value&&e.value===m))||{},g=a.getFullYear()===l.getFullYear()&&a.getMonth()===l.getMonth()&&a.getDate()===l.getDate();return t._getEventCellObjs(e,(function(r,m){let f;arguments.length?(f=!0,m||(m=r)):(r=a,m=l);let p=new Date(r),w=new Date(m);switch(h){case"agenda":p=a,w=l;break;case"day":case"week":case"timelineMonth":if(f)p.setHours(0,0,0,0),w.setHours(23,59,59,999);else{if(e.allDay||"day"!==h)w=new Date(l);else{const e=new Date(a);e.setHours(23,59,59,999),w=new Date(Math.min(l.getTime(),e.getTime()))}w.setHours(w.getHours(),w.getMinutes(),0,0),u&&(w=new Date(w.getTime()-1),w.setHours(w.getHours(),59,59,999))}break;case"timelineDay":case"timelineWeek":if("timelineWeek"===h&&v&&v.hideHours)return!f&&u&&(w=new Date(l.getTime()-1),w.setHours(w.getHours(),59,59,999)),{start:p.getDay(),end:w.getDay()};if(f){const e=r.getHours(),t=m.getHours();g&&(o<n&&(s<n||s===n&&c)||(o>i||o===n&&d)&&s>i)?(p.setHours(e,0,0,0),w.setHours(t,59,59,999)):(p.setHours(e===n&&o<n?o:e,0,0,0),w.setHours(t===i&&s>i?s:t,59,59,999))}else if(u&&(w=new Date(w.getTime()-1),w.setHours(w.getHours(),59,59,999)),!g){if(o>i){p.setHours(0),p.setDate(p.getDate()+1),p.setHours(n);const e=t._getEventVisibleDateRange({dateStart:p,dateEnd:w});p=e&&e.dateStart.getTime()<w.getTime()?e.dateStart:new Date(r)}if(s<n||s===n&&c){w.setHours(0),w.setDate(w.getDate()-1),w.setHours(i);const e=t._getEventVisibleDateRange({dateStart:p,dateEnd:w});w=e&&e.dateEnd.getTime()>p.getTime()?e.dateEnd:new Date(m)}s>i&&w.setHours(i)}break;case"month":return!f&&u&&(w=new Date(l.getTime()-1),w.setHours(w.getHours(),59,59,999)),{start:p.getDay(),end:w.getDay()}}return p=p.getTime(),w=w.getTime(),{start:p,end:w}}),"horizontal")}_getEventVerticalCellObjs(e){const t=this,n=t.hourStart,i=t.hourEnd,r=t._getEventVisibleDateRange(e);if(!r)return;const a=r.dateStart,l=r.dateEnd,o=a.getHours(),s=l.getHours(),d=l.getTime()>a.getTime()&&l.getMinutes()+l.getSeconds()+l.getMilliseconds()===0,c=t.viewType;return t._getEventCellObjs(e,(function(e,t){let r;arguments.length?(r=!0,t||(t=e)):(e=a,t=l);let u=new Date(e),h=new Date(t);switch(c){case"day":case"week":if(u=new Date(a),h=new Date(l),r){h=new Date(u);const r=e.getHours(),a=t.getHours();s<=n&&o<=n||o>=i&&s>=i?(u.setHours(r,0,0,0),h.setHours(a,59,59,999)):(u.setHours(r===n&&o<n?o:r,0,0,0),h.setHours(a===i&&s>i?s:a,59,59,999))}else u.setHours(u.getHours(),u.getMinutes(),0,0),h.setHours(h.getHours(),h.getMinutes(),0,0),d&&(h=new Date(h.getTime()-1),h.setHours(h.getHours(),59,59,999));break;case"agenda":r&&(u.setHours(0,0,0,0),h.setHours(23,59,59,999));break;case"month":r?(u.setHours(0,0,0,0),h=new Date(e),h.setDate(h.getDate()+6),h.setHours(23,59,59,999)):d&&(h=new Date(h.getTime()-1),h.setHours(h.getHours(),59,59,999));break;case"timelineDay":case"timelineWeek":case"timelineMonth":return{start:0,end:0}}return u=u.getTime(),h=h.getTime(),{start:u,end:h}}),"vertical")}_getEventCellObjs(e,t,n="horizontal"){const i=this,r=i._timelineCells;if(!r||!r[n])return;const a=r[n],l=t(),o=l.start,s=l.end;let d,c,u,h,m,v;for(let n=0;n<a.length;n++){const r=a[n],l=r.date,g=r.group;if(g&&!i._isEventPartOfGroup(e,g))continue;const f=t(l,l),p=f.start,w=f.end;!d&&o>=p&&o<=w&&(d=r),s>=p&&s<=w&&(c=r),u||(u=r,m=p),h=r,v=p}return!d&&o<=m&&s>m&&(d=u),!c&&d&&(c=s>=m&&s<=v?d:h),{start:d,end:c,first:u,last:h}}_setVerticalTimelineEvents(e){const t=this,n=e.events,i=e.eventCells,r=e.eventRenderMode;if("agenda"===e.viewType||"modern"===r&&e.isMobile)return t._setAgendaOrMobileEvents(e);const a=e.isAllDayEvent,l=e.spaceAvailable,o=e.eventSize,s=Math.floor(l/o),d=e.eventIndexes,[c,u]=[t.scrollTop,t.scrollLeft],[h,m]=[c+t._scrollViewSize.height,u+t._scrollViewSize.width];let v,g;if("classic"===r||t.autoHeightAllDayCells){const n=t._getEventsCollisionIndexes(e,"vertical");v=n.eventOverlaps,g=n.eventCollisionsCount}t.autoHeightAllDayCells&&(t._allDayCellSize=t.__allDayCellSize);for(let f=0;f<n.length;f++){const p=i[f],w=n[f];e.eventObj=w;for(let i=0;i<p.length;i++){const y=p[i],_=y[0];if(!_)continue;e.cellRange=y;let b=d[f];if(void 0===b){const n=t._getEventsInCollision(e);e.cellEventsCount=n.length,d[f]=n.indexOf(w)}if(!a){const e=y[y.length-1],[t,n]=[_.vertical,e.vertical],[i,r]=[_.horizontal,e.horizontal];if(n.top+n.height<c||t.top>h||r.left+r.width<u||i.left>m)continue}if(e.eventIndex=b=d[f],!t.autoHeightAllDayCells&&"modern"===r&&(b+1)*o>l)t._addEventToCollector(e);else{if("classic"===r||t.autoHeightAllDayCells){const i=v.filter((e=>e.indexOf(w)>-1)),r=v[f].reduce(((e,t)=>Math.max(e,g[n.indexOf(t)]||1)),1);let a=1;for(let e=b+1;e<r&&i.every((t=>t.map((e=>d[n.indexOf(e)])).indexOf(e)<0));e++)a++;e.isMaxSizeReached=r>s,e.cellEventsCount=r,e.eventSize=Math.min(o,l/r*a),t.autoHeightAllDayCells&&(e.eventSize=o,t._allDayCellSize=Math.max(t._allDayCellSize,25+o*r),t.style.setProperty("--smart-scheduler-timeline-header-all-day-cells-size",t._allDayCellSize+"px"),t._refresh())}t._setEventCell(e)}}}}_setAgendaOrMobileEvents(e){const t=this,n=e.events,i=e.isAllDayEvent,r=e.eventCells,a="agenda"===e.viewType;let l,o,s,d;i||([l,o]=[t.scrollTop,t.scrollLeft],[s,d]=[l+t._scrollViewSize.height,o+t._scrollViewSize.width]);for(let c=0;c<n.length;c++){const u=r[c],h=n[c];e.eventObj=h,u.forEach((n=>{if(n[0])if(e.cellRange=n,i)a?t._setEventCell(e):t._addEventToCollector(e);else{const i=n[0],r=n[n.length-1],[c,u]=[i.vertical,r.vertical],[h,m]=[i.horizontal,r.horizontal];u.top+u.height>=l&&c.top<=s&&m.left+m.width>=o&&h.left<=d&&(a?t._setEventCell(e):t._addEventToCollector(e))}}))}return e.usedEventCells}_addEventToCollector(e){const t=this,n=e.viewType,i=n.indexOf("timeline")>-1,r=e.eventObj,a=e.cellRange,l=e.usedEventCells,o=t.$.allDayEventsContainer,s=e.isAllDayEvent,d=e.isDayOrWeekView,c="month"===n,u=s?o:t.$.timelineEventsContainer,h=t._getCellsScaleCount(),m=t._setEventCell(e,!0),v=a.length,g=t.hasAttribute("tabindex")?t.tabIndex:void 0;let f=document.createDocumentFragment(),p={tabIndex:g};e:for(let n=0;n<v;n++){const o=a[n],u=o.scaleIndex,g=o.vertical.group||o.horizontal.group;let w;w=s?1:1===v?t._getEventScaleIndex(r,i?o.horizontal:o.vertical).end+1:n===v-1?u+1:h;for(let i=0===n&&u||0;i<w;i++){o.scaleIndex=i;const n=t._getCellTime(o);let a=t._findCollector(e,n,g);if(a){const e=a.$.events;e.map((e=>e.$.event)).indexOf(r)<0&&(e.push(m),t._sortEventCellObjs(e,d))}else a=document.createElement("div"),a.classList.add("smart-scheduler-event"),a.setAttribute("collector",""),a.setAttribute("role","menuitem"),a.setAttribute("aria-haspopup",!0),a.$={group:g,cellTime:n,collector:!0,events:[m]},f.appendChild(a);if(c&&1===new Date(n).getDate()?a.setAttribute("first-month-day",""):a.removeAttribute("first-month-day"),p.eventCollector=a,p.cellObj=o,t._setEventCollectorStyles(e,p),t._setEventCellContent(a,e),l.indexOf(a)<0&&l.push(a),d&&!s)break e}o.scaleIndex=u}f.children.length&&u.appendChild(f)}_findCollector(e,t,n){const i=this;if(!e)return;const r=e.currentEvents;for(let e=0;e<r.length;e++){const a=r[e];if(a.$.events&&a.$.cellTime===t&&(!n||i._isEventPartOfGroup(a.$.group,n)))return a}}_setEventCollectorStyles(e,t){const n=this,i=e.cellSize,r=e.eventRenderMode,a=t.eventCollector,l=t.cellObj,o=t.tabIndex,s=e.isMobile,d=e.rightToLeft?"right":"left",c=e.isAllDayEvent,u=e.isDayOrWeekView,h=n._getCellOffset(l);let m=e.collectorSize;a.style[e.rightToLeft?"left":"right"]="","modern"===r&&s?(m=Math.min(i.width,i.height),a.style.width=a.style.height=m+"px",a.style[d]=h.left+(i.width-m)/2+"px",a.style.top=h.top+(i.height-m)/2+"px"):(a.style.top=h.top+"px",a.style.height=n._eventCollectorSize+"px",u&&!c?(a.style[d]=h.left+i.width-m+"px",a.style.width=m+"px"):(a.style[d]=h.left+"px",a.style.width=Math.max(0,i.width)+"px")),void 0!==o?a.tabIndex=o:a.removeAttribute("tabindex")}_removeEventFromCollector(e){const t=this,n=e.eventObj,i=e.cellRange;let r;for(let a=0;a<i.length;a++){const l=i[a],o=l.vertical.group||l.horizontal.group,s=t._getCellTime(l),d=t._findCollector(e,s,o);if(d){const i=d.$.events,a=i.map((e=>e.$.event)).indexOf(n);a>-1&&(r=i.splice(a,1)[0]),i.length?t._setEventCellContent(d,e):d.remove()}}return r}_findEventElement(e,t,n){if(!e)return;const i=e.currentEvents;for(let e=0;e<i.length;e++){const r=i[e];if(r.$.event===n&&r.$.cellTime===t)return r}}_setEventCell(e,t){const n=this,i=e.viewType,r=e.eventObj,a=e.usedEventCells,l=r.$?r.$.event:void 0,o=r.dateStart,s=r.dateEnd,d=r.status,c=n._getCellTime(e.cellRange[0]),u=e.isAllDayEvent?n.$.allDayEventsContainer:n.$.timelineEventsContainer,h=n._dragDetails,m=n.tabIndex;let v,g,f=n._findEventElement(e,c,r);if(!t){const t=n._removeEventFromCollector(e);!f&&t&&(f=t)}if(!f||!n.hasAttribute("resized")||f!==h.schedulerEvent){if(f?f.classList.remove("smart-hidden"):(f=document.createElement("div"),f.classList.add("smart-scheduler-event"),f.setAttribute("role","menuitem"),f.setAttribute("aria-haspopup",!0)),n._setEventCellStyles(e,{eventCell:f}),"agenda"===i?(v=new Date(c),v.setHours(o.getHours(),o.getMinutes())):v=new Date(o),f.$||(f.$={}),g=f.$,g.cellTime=c,g.dateStart=v,g.dateEnd=new Date(v.getTime()+s.getTime()-o.getTime()),g.event=r,n.resources.forEach((e=>{void 0!==r[e.value]&&f.setAttribute(e.value,r[e.value])})),d&&n.statuses.some((e=>e.value===d))?f.setAttribute("status",d):f.removeAttribute("status"),l){const e=l.repeat.exceptions;f.setAttribute("repeating",""),e&&e.indexOf(r)>-1?f.setAttribute("exception",""):f.removeAttribute("exception")}else f.removeAttribute("repeating"),f.removeAttribute("exception");if(r.allDay?f.setAttribute("all-day",""):f.removeAttribute("all-day"),t)return f;n._setEventCellContent(f,e),n.hasAttribute("tabindex")?f.tabIndex=m:f.removeAttribute("tabindex"),r.disableResize?f.setAttribute("disable-resize",""):f.removeAttribute("disable-resize"),f.setAttribute("title",r.label),a.indexOf(f)<0&&a.push(f),u.contains(f)||u.appendChild(f)}}_setEventCellStyles(e,t){const n=this,i=e.viewType,r=e.eventObj,a=e.eventIndex,l=t.eventCell,o=e.collectorSize,s=e.cellRange,d=e.cellSize,c=s[0],u=s[s.length-1],h=n._getCellOffset(c),m=e.isDayOrWeekView,v=e.isAllDayEvent,g=e.rightToLeft?"right":"left",f=i.indexOf("timeline")>-1,p=e.viewDetails,w=["timelineDay","timelineWeek"].indexOf(i)>-1,y=r.class?Array.isArray(r.class)?r.class:[r.class]:[];let _=r.backgroundColor,b=r.color;if(!_||!b){const e=n.resources.find((e=>void 0!==r[e.value]));if(e&&e.dataSource){const t=e.dataSource.find((t=>t.id===r[e.value]));t&&(_=_||t.backgroundColor,b=b||t.color)}}if(l.style[e.rightToLeft?"left":"right"]="",l.style.setProperty("--smart-scheduler-event-background",n._getRGBA(_)),l.style.setProperty("--smart-scheduler-event-focus",n._getRGBA(_,-1)),l.style.setProperty("--smart-scheduler-event-hover",n._getRGBA(_,-2)),l.style.setProperty("--smart-scheduler-event-color",n._getRGBA(b)),l.style.setProperty("--smart-scheduler-event-color-hover",n._getRGBA(b)),l.style.setProperty("--smart-scheduler-event-color-focus",n._getRGBA(b)),"agenda"===i)l.style.top=h.top+"px",l.style[g]=h.left+"px",l.style.width=d.width+"px",l.style.height=d.height+"px";else{const t=e.cellEventsCount,s=u.scaleIndex;let _,b=0,D=0,C=e.eventSize;if((w||m)&&(b=n._getEventCellOffset(r,c)),c===u&&(u.scaleIndex=n._getEventScaleIndex(r,f?u.horizontal:u.vertical).end),_=n._getCellOffset(u),m&&!v){b=parseFloat((d.height*b).toFixed(2)),D=parseFloat((d.height*n._getEventCellOffset(r,u,!0)).toFixed(2));const e=D+_.top-h.top-b;l.style.height=(0===e?d.height:e)+"px",l.style.width=C+"px",l.style.top=h.top+b+"px",l.style[g]=h.left+a*((d.width-o)/t)+"px"}else{"timelineDay"!==i&&("timelineWeek"!==i||p&&p.hideHours)?(D=d.width,b=0):(b=parseFloat((d.width*b).toFixed(2)),D=parseFloat((d.width*n._getEventCellOffset(r,u,!0)).toFixed(2)));const s=D+_.left-h.left-b;l.style.height=C+"px",l.style.width=(0===s?d.width:s)+"px",l.style[g]=h.left+b+"px","classic"===n.eventRenderMode&&e.isMaxSizeReached?l.style.top=h.top+o+a*((d.height-o)/t)+"px":l.style.top=h.top+o+a*C+"px"}y.length?y.forEach((e=>l.classList.add(e))):"smart-scheduler-event"!==l.className&&(l.className="smart-scheduler-event"),void 0!==r.id?l.id=r.id+"":delete r.id,u.scaleIndex=s}}_getEventCellOffset(e,t,n){if(void 0===t.scaleIndex)return 0;const i=["day","week"].indexOf(this.viewType)>-1?"vertical":"horizontal",r=60/this._getCellsScaleCount()*60*1e3;let a=n?e.dateEnd:e.dateStart,l=t[i].date;return l=new Date(l.getTime()+r*t.scaleIndex),"vertical"===i&&(l=new Date(a.getFullYear(),a.getMonth(),a.getDate(),l.getHours(),l.getMinutes(),0,0),l.getHours()!==a.getHours())?n?1:0:(l=l.getTime(),a=a.getTime(),Math.max(0,Math.min(1,l>a?n?1:0:parseFloat(((a-l)/r).toFixed(2)))))}_getRGBA(e,t){if(!e)return"";const n=/^#(.)(.)(.)$/gi.exec(e),i=void 0!==t&&t<0?parseFloat((1+t/10).toFixed(2)):void 0;let r,a,l,o;if(n)r=parseInt(n[1]+n[1],16),a=parseInt(n[2]+n[2],16),l=parseInt(n[3]+n[3],16),t<0&&(t=parseFloat((1+t/10).toFixed()));else{const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(e);if(!n)return"";r=parseInt(n[1],16),a=parseInt(n[2],16),l=parseInt(n[3],16),o=parseInt(n[4],16)/255,isNaN(o)||(t=parseFloat((void 0!==t&&t<0?o+t/10:o).toFixed(2)))}return void 0!==t&&t<0&&(t=i),`rgba(${r},${a},${l},${t||1})`}_getCellRanges(e,t="horizontal"){if(!e)return[];const n=this._timelineCells[t],i=e.start,r=e.end,a=e.first,l=e.last;if(!i&&!r||!a&&!l)return[];const o=e.start||a,s=e.end||l,d=n.indexOf(o),c=n.indexOf(s),u=n.indexOf(a),h=n.indexOf(l);let m=[];return m=d>c?[{fromIndex:d,toIndex:h},{fromIndex:u,toIndex:c}]:[{fromIndex:d,toIndex:c}],m}_getEventTimelineCells(e,t,n){const i=this,r=i.viewType,a="agenda"===r,l=new Date(e.dateStart),o=new Date(e.dateEnd),s=i._timelineCells.horizontal,d=i._timelineCells.vertical;let c=[];if("month"===r)return i._getEventTimelineCellsMonth(e);if(n){const t={height:i._allDayCellSize,top:0,date:new Date(i.dateCurrent)};return t.date.setHours(0,0,0,0),i._getCellRanges(i._getEventHorizontallCellObjs(e)).forEach((n=>{const r=n.fromIndex,a=n.toIndex;for(let n=r;n<=a;n++){const r=s[n],a=r.group;a&&!i._isEventPartOfGroup(e,a)||c.push({allDay:!0,horizontal:r,vertical:t})}})),c}const u=Object.assign({},e),h=r.indexOf("timeline")>-1;let m,v;return i._getCellRanges(i._getEventHorizontallCellObjs(e)).forEach((n=>{const g=n.fromIndex,f=n.toIndex;for(let n=g;n<=f;n++){const p=s[n],w=new Date(p.date),y=p.group;let _,b=new Date(p.date);if(!y||i._isEventPartOfGroup(e,y)){if(l.getTime()>=w.getTime()&&w.setHours(l.getHours(),l.getMinutes()),b.setHours(o.getHours(),o.getMinutes()),b.getTime()<w.getTime())if("timelineWeek"===r||"timelineDay"===r)for(;b.getTime()<w.getTime();){const e=b.getHours();b.setHours(e+1,0,0,0),e===b.getHours()&&b.setHours(b.getHours()+2,0,0,0)}else b.setDate(b.getDate()+1),b.setHours(0,0,0,0);a||(u.dateStart=w,u.dateEnd=b),i._getCellRanges(i._getEventVerticalCellObjs(u),"vertical").forEach((r=>{const l=r.fromIndex,o=r.toIndex;for(let r=l;r<=o;r++){const s=d[r],w=s.group;if(w&&!i._isEventPartOfGroup(u,w))continue;if(a&&(_&&_.date.getTime()===s.date.getTime()||t.some((e=>e.horizontal===p&&e.vertical===s))))continue;const y={horizontal:p,vertical:s};h&&n!==g||r!==l?h&&n!==f||r!==o||(void 0===v&&(v=i._getEventScaleIndex(e,h?p:s).end),y.scaleIndex=v):(void 0===m&&(m=i._getEventScaleIndex(e,h?p:s).start),y.scaleIndex=m),_=s,c.push(y),t.push(y)}}))}}})),c}_getEventTimelineCellsMonth(e){const t=this,n=new Date(e.dateStart),i=new Date(e.dateEnd),r=t._timelineCells.horizontal,a=t._timelineCells.vertical,l=Object.assign({},e);let o=[];return t._getCellRanges(t._getEventVerticalCellObjs(e),"vertical").forEach((s=>{const d=s.fromIndex,c=s.toIndex;for(let s=d;s<=c;s++){const u=a[s],h=new Date(u.date),m=new Date(u.date),v=u.group;v&&!t._isEventPartOfGroup(e,v)||(m.setDate(m.getDate()+6),m.setHours(23,59,59,999),h.setHours(0,0,0,0),l.dateStart=new Date(Math.max(n.getTime(),h.getTime())),l.dateEnd=new Date(Math.min(i.getTime(),m.getTime())),t._getCellRanges(t._getEventHorizontallCellObjs(l)).forEach((n=>{const i=n.fromIndex,a=n.toIndex;for(let n=i;n<=a;n++){const i=r[n],a=u.group;if(a&&!t._isEventPartOfGroup(e,a))continue;const l={horizontal:i,vertical:u};s!==d&&s!==c||(l.scaleIndex=0),o.push(l)}})))}})),o}_getEventTimelineCellRanges(e,t){const n=this,i=n.viewType;if(!e.length)return[];if("agenda"===i)return e.map((e=>[e]));{let r,a=[],l=[];const o=["day","week"].indexOf(i)>-1&&!t;for(let t=0;t<e.length;t++){const i=e[t];if(!r){a.push(r=i);continue}const s=i.horizontal,d=i.vertical,c=r.horizontal,u=r.vertical,h=n._getCellOffset(i,void 0===d.scaleIndex),m=n._getCellOffset(r,void 0===d.scaleIndex);!o&&(d!==u||m.right!==h.left)||o&&(s!==c||m.bottom!==h.top)?(l.push(a),a=[i]):a.push(i),r=i}return a.length&&l.push(a),l}}_getCellSize(e){const t=this,n=t.viewType;let i,r;if(e){let t=e;if(e instanceof HTMLElement&&(t=e.$?e.$.cellObj:void 0),!t)return{width:0,height:0};i=t.vertical,r=t.horizontal}else{const e=t._timelineCells,n=e.vertical,a=e.horizontal;if(!n.length||!a.length)return{width:0,height:0};i=n[0],r=a[0]}const a=t._getCellsScaleCount();let l,o;switch(n){case"agenda":case"month":case"timelineMonth":l=r.width,o=i.height;break;case"day":case"week":l=r.width,o=i.height/a;break;case"timelineDay":case"timelineWeek":l=r.width/a,o=i.height}return{width:l,height:o}}_getCellOffset(e,t){const n=this.viewType;let i,r,a=e;if(!e)return{left:0,top:0};if(e instanceof HTMLElement&&(a=e.$?e.$.cellObj:void 0),!a)return{left:0,top:0};i=a.vertical,r=a.horizontal;const l=this._getCellsScaleCount(),o=t||a.allDay?0:a.scaleIndex||0;let s,d;switch(n){case"agenda":case"month":case"timelineMonth":s=r.left,d=i.top;break;case"day":case"week":s=r.left,d=parseFloat((i.top+i.height/l*o).toFixed(2));break;case"timelineDay":case"timelineWeek":s=parseFloat((r.left+r.width/l*o).toFixed(2)),d=i.top}return{left:s,right:parseFloat((s+r.width).toFixed(2)),top:d,bottom:parseFloat((d+i.height).toFixed(2))}}_getCellDateRange(e){const t=this;let n=e;if(e instanceof HTMLElement&&(n=e&&e.$?e.$.cellObj:void 0),!n)return;const i=t.viewType;let r=new Date(n.time?n.time:t._getCellTime(n)),a=new Date(r);switch(i){case"agenda":case"month":case"timelineMonth":a.setHours(23,59,59,999);break;case"week":case"day":case"timelineWeek":case"timelineDay":n.allDay?a.setHours(23,59,59,999):a=new Date(a.getTime()+60/t._getCellsScaleCount()*60*1e3)}return{dateStart:r,dateEnd:a}}_setEventCellContent(e,t){const n=this,i=t.eventObj;if(!e||!i)return;const r=t.isDayOrWeekView,a=t.isAllDayEvent;let l=e.querySelector(".smart-scheduler-event-content");if(e.$&&e.$.events){const t=e.$.events;if(l||(e.innerHTML='<div class="smart-scheduler-event-content"><div></div></div>',l=e.firstElementChild),n.eventCollectorTemplate)n._applyTemplate("eventCollectorTemplate",l,t.map((e=>n._cloneObject(e))));else{const e=n.eventRenderMode,i=n.$.timeline.hasAttribute("mobile"),o=t.length+(i||"modern"===e&&r&&!a?"":" "+n.localize("collector"));l.firstElementChild.textContent=o}return}l||(e.innerHTML='<div class="smart-scheduler-event-content"></div><div class="smart-scheduler-event-button"></div>',l=e.firstElementChild);const o=e.querySelector(".smart-scheduler-event-button");let s;if(o&&(o.tabIndex=t.tabIndex),t.isTooltipEvent&&n.eventTooltipTemplate)n._applyTemplate("eventTooltipTemplate",l,n._cloneObject(i));else if(n.eventTemplate)n._applyTemplate("eventTemplate",l,n._cloneObject(i));else{const e=void 0!==t.isMonthView?t.isMonthView:["timelineMonth","month"].indexOf(n.viewType)>-1;let r=l.querySelector(".smart-scheduler-event-time"),a=i.label;s=l.querySelector(".smart-scheduler-event-label");const o=n.locale,d=i.dateStart,c=i.dateEnd;let u;if(t.isAllDayEvent||e){const e="short",t=n.dayFormat;if(d.getFullYear()===c.getFullYear()&&d.getMonth()===c.getMonth()&&d.getDate()===c.getDate())u=new Intl.DateTimeFormat(o,{day:t,month:e}).format(d);else{const n=new Intl.DateTimeFormat(o,{day:t,month:e});u=n.format(d)+" - "+n.format(c)}}else{const e=new Intl.DateTimeFormat(o,{hour:n.hourFormat,minute:n.minuteFormat});u=e.format(d)+" - "+e.format(c)}if(r&&s||(i.label+""?l.innerHTML='\n <div role="presentation"><label class="smart-scheduler-event-label"></label></div>\n <div role="presentation"><label class="smart-scheduler-event-time"></label></div>':l.innerHTML='<div role="presentation"><label class="smart-scheduler-event-time"></label></div>',s=l.querySelector(".smart-scheduler-event-label"),r=l.querySelector(".smart-scheduler-event-time")),s&&(s.textContent=a),r&&(r.textContent=u,s&&e&&t.eventSize<45?l.setAttribute("single-line",""):l.removeAttribute("single-line")),t.isTooltipEvent&&i.conference&&/^(ftp|http|https):\/\/[^ "]+$/.test(i.conference)){const e=document.createElement("div");e.innerHTML=`<a target="_blank" href="${i.conference}" class="info">${n.localize("join")}</a>`,e.classList.add("meeting");const t=i.conference;t.startsWith("https://zoom.us/")?e.innerHTML=`<a target="_blank" href="${i.conference}" class="info">${n.localize("joinWith",{value:"Zoom"})}</a>`:t.startsWith("https://meet.google.com/")?e.innerHTML=`<a target="_blank" href="${i.conference}" class="info">${n.localize("joinWith",{value:"Google Meet"})}</a>`:t.startsWith("https://teams.microsoft.com/")&&(e.innerHTML=`<a target="_blank" href="${i.conference}" class="info">${n.localize("joinWith",{value:"Microsoft Teams"})}</a>`),l.appendChild(e)}}}_createTimeline(){const e=this,t=e.resizeTrigger,n=e.scrollTop,i=e.scrollLeft,r=e.$.timeline;let a,l;t&&(a=t.offsetWidth,l=t.offsetHeight,t.style.display="none"),delete e._selectedCellObj,delete e._eventsBetween,e._createTimelineHeader(),e._refreshTimelineContentCells(),e._handleMenuAria(),r.classList.contains("no-agenda")?r.setAttribute("agenda-placeholder",e.localize("agendaPlaceholder")):r.removeAttribute("agenda-placeholder"),e.scrollTop=n,e.scrollLeft=i,t&&(t.style.display=null,a===t.offsetWidth&&l===t.offsetHeight||(e._noResizeHandler=!0)),e._refreshEvents(),e._checkNotifications()}_createTimelineHeader(){const e=this,t=e.$.timelineContent;if(t.style.width=t.style.height=null,Smart.Utilities.Core.Browser.Chrome){const t=e.$.timelineHeaderVertical;t.style.display="none",t.offsetHeight,t.style.display=null}e._validateEventDateRange(),e._createTimelineCellsObj(),e._createTimelineHeaderCells("horizontal"),e._createTimelineHeaderCells("vertical"),e._refreshTimelineHeaderCells(),e._refreshTimelineAllDayCells(),e._refresh()}_validateEventDateRange(e){const t=this.viewType;if(["month","agenda"].indexOf(t.toLowerCase())>-1)return;const n="day"===t||"week"===t,i=e?[e]:this._events;for(let e=0;e<i.length;e++){const t=i[e],r=t.dateStart,a=t.dateEnd;n&&a.getTime()-r.getTime()>=864e5&&(t.allDay=!0),t.allDay&&(t.dateStart.setHours(0,0,0,0),t.dateEnd.setHours(23,59,59,999))}}_handleMenuAria(){const e=this,t=e.$.currentDate,n=e.$.viewItemsButton,i=e.$.tooltip;t.setAttribute("aria-haspopup",!0),n.setAttribute("aria-controls",i.id),n.setAttribute("aria-haspopup",!0)}_handleTimelineGroupHeader(e){const t=this,n=t._timelineCells.groups;let i=t.$.groupsContainer;if(!n||!n.length||"agenda"===t.viewType&&!Object.keys(e.vertical).length)return void(i&&i.remove());i||(i=document.createElement("div"),i.classList.add("smart-scheduler-groups-container"),i.innerHTML='\n <div class="smart-scheduler-view-groups-label-container" role="presentation"></div>\n <div class="smart-scheduler-view-groups-content" role="presentation">\n <div class="smart-scheduler-view-header-groups-container" role="presentation"></div>\n </div>',t.$.groupsContainer=i);const r=t.view,a=t.views.find((e=>e.value&&e.value===r))||{},l="vertical"!==(a&&a.groupOrientation?a.groupOrientation:t.groupOrientation)?t.$.timelineHeaderHorizontal:t.$.timelineHeaderVertical;l.contains(i)||l.insertBefore(i,l.firstElementChild)}_handleTimeZoneHeader(e){const t=this;e||(e="horizontal",t._handleTimeZoneHeader("vertical"));const n=t.viewType.toLowerCase(),i=n.indexOf("timeline")>-1,r=("vertical"===e?t.$.timelineHeaderVerticalContent:t.$.timelineHeaderHorizontalContent).querySelector(".smart-scheduler-view-time"),a=r.children,l=t.$.timelineViewCellsLabelContainer,o=!i&&"agenda"!==n&&"vertical"===e||"horizontal"===e&&i;let s=t.timeZones.slice(0);const d=t.$.viewDetailsLabel,c=t.$.timelineViewAllDay,u=t.$.timelineTimeZoneLabelContainer;if(u.remove(),d&&d.remove(),t._recycleContainerCells({fragment:r,cellsNeeded:1+(o&&n.indexOf("month")<0?s.length:0),className:"smart-scheduler-cells"}),s.push(t.timeZone),(i&&o||!i)&&t._recycleContainerCells({fragment:l,cellsNeeded:!i&&n.indexOf("month")<0&&"agenda"!==n?s.length:0,className:"smart-scheduler-time-zone"}),c.offsetHeight&&l.offsetHeight&&(t.$.timelineViewAllDaylabel.style.maxWidth=l.offsetWidth+"px"),o){const e=u.parentElement;t._recycleContainerCells({fragment:u,cellsNeeded:1===a.length?0:a.length,className:"smart-scheduler-time-zone"}),a.length&&e&&e.appendChild(u)}}_createTimelineHeaderCells(e="vertical"){const t=this,n=t.viewType.toLowerCase(),i=n.indexOf("timeline")>-1,r="vertical"===e?t.$.timelineHeaderVerticalContent:t.$.timelineHeaderHorizontalContent,a=r.querySelector(".smart-scheduler-view-time"),l=r.querySelector(".smart-scheduler-view-details"),o=a.children,s=!i&&"agenda"!==n&&"vertical"===e||"horizontal"===e&&i;let d=t.timeZones.slice(0);const c=t._getTimelineVisibleCellsCount(e),u=t.timeZone,h=o.length;d.push(t.timeZone);for(let e=0;e<h;e++){const n=o[e],i=d[e];n.timeZone=1===h?u:i.id||i,t._recycleContainerCells({fragment:n,cellsNeeded:c})}if(l&&t._recycleContainerCells({fragment:l,cellsNeeded:t._getTimelineVisibleCellsCount({orientation:e,type:"details"})}),t._createTimelineHeaderGroupCells(e),s){const e=t.$.timelineTimeZoneLabelContainer,r=t.$.timelineViewCellsLabelContainer;e.remove();const a=t.$.timelineAllDayLabelContainer;let o=t.$.viewDetailsLabel;if(i&&n.indexOf("week")>-1&&l?(o||(o=document.createElement("div"),o.classList.add("smart-scheduler-view-details-label"),t.$.viewDetailsLabel=o),o.parentElement||r.appendChild(o)):o&&o.parentElement&&o.remove(),!e.children.length)return;!i&&a.offsetHeight?a.appendChild(e):r.offsetHeight&&r.appendChild(e)}}_createTimelineHeaderGroupCells(e){const t=this,n=t.view,i=t.viewType,r=i.indexOf("timeline")>-1,a=t.views.find((e=>e.value&&e.value===n))||{},l=t._timelineCells,o=l.groups,s=a&&a.groupOrientation?a.groupOrientation:t.groupOrientation;let d=t.$.groupsContainer;if("vertical"===e&&"vertical"!==s||("horizontal"===e&&"day"!==i||!e)&&"vertical"===s)return;if(d&&d.remove(),!o||!o.length||"agenda"===i&&!l.vertical.length)return;const c=t._timelineCells.groups,u=d.querySelector(".smart-scheduler-view-header-groups-container"),h=u.children;t._recycleContainerCells({fragment:u,cellsNeeded:c.length,className:"smart-scheduler-cell-container",role:"row"});for(let n=0;n<h.length;n++)t._recycleContainerCells({fragment:h[n],cellsNeeded:t._getTimelineVisibleCellsCount({orientation:e,type:"groups",resource:c[n].resource})});let m="vertical"===e||i.toLowerCase().indexOf("month")>-1?0:t.timeZones.length+("month"===i?0:1);if(r&&(m=m>1?1:0),"agenda"===i&&(m="vertical"!==s&&t._timelineCells.vertical.length?1:0),t._recycleContainerCells({fragment:d.querySelector(".smart-scheduler-view-groups-label-container"),cellsNeeded:m,className:"smart-scheduler-time-zone"}),!d.parentElement&&e===s){const n="horizontal"===e?t.$.timelineHeaderHorizontal:t.$.timelineHeaderVertical;n.insertBefore(d,n.firstElementChild)}}_recycleContainerCells(e){const t=this,n=e.fragment;if(!n)return;const i=n.children,r=n.children.length,a=e.cellsNeeded,l=e.className,o=e.role,s=e.isBackwards?"lastElementChild":"firstElementChild";if(r>a)for(;i.length&&i.length!==a;)n.removeChild(n[s]);else r<a&&n.appendChild(t._createCells(a-r,l,o))}_createTimelineCellsObj(){const e=this,t=e.viewType,n=t.indexOf("timeline")>-1,i=e._getCellsCount(),r=e._getCellsScaleCount(),a=window.getComputedStyle(e);e.timeZones.length>0&&n&&"timelineMonth"!==t?e.$.timeline.setAttribute("show-vertical-header",""):e.$.timeline.removeAttribute("show-vertical-header");let l=Math.max(parseFloat(a.getPropertyValue("--smart-scheduler-timeline-cell-height"))||0,parseFloat(a.getPropertyValue("--smart-scheduler-timeline-cell-min-height")||0)),o=Math.max(parseFloat(a.getPropertyValue("--smart-scheduler-timeline-cell-width"))||0,parseFloat(a.getPropertyValue("--smart-scheduler-timeline-cell-min-width")||0));e._eventSize=parseFloat(a.getPropertyValue("--smart-scheduler-event-size"))||0,e._allDayCellSize=parseFloat(a.getPropertyValue("--smart-scheduler-timeline-header-all-day-cells-size"))||e.$.timelineViewAllDay.offsetHeight,e.__allDayCellSize||(e.__allDayCellSize=e._allDayCellSize),e._eventCollectorSize=parseFloat(a.getPropertyValue("--smart-scheduler-event-collector-size"))||0,e._monthViewNumberSize="month"!==t?0:parseFloat(a.getPropertyValue("--smart-scheduler-month-view-number-size"))||0,t.indexOf("timeline")>-1?o*=r:l*=r,e._timelineCells={},e._scrollViewSize={},e.groups.length&&(e._timelineCells.groups=e._getTimelineCellsObjGroups()),e._handleTimelineGroupHeader(i),e._handleTimeZoneHeader(),e._refresh(),e._handleTimelineContentSize(i,l,"height");let s=e.$.timelineContainer.offsetHeight;e._handleTimelineContentSize(i,o,"width"),s!==(s=e.$.timelineContainer.offsetHeight)&&e._handleTimelineContentSize(i,l,"height"),e._scrollViewSize.height=s,e._scrollViewSize.width=e.$.timelineContainer.offsetWidth,e._timelineCells.horizontal=e._getTimelineCellsObjHorizontal(i.horizontal,o),e._timelineCells.vertical=e._getTimelineCellsObjVertical(i.vertical,l),"timelineWeek"===t&&(e._timelineCells.details=e._getTimelineCellsObjDetails())}_getResourceGroups(){const e=this,t=e.groups,n=e.resources;let i,r=[],a=[];if(!t.length||!n.length)return a;for(let a=0;a<t.length;a++){const l=n.find((e=>e.value===t[a]));if(!l||!l.dataSource.length)continue;const o=e._getResourceData(l);if(Object.keys(o).length){const t=Object.values(o),n=i?i.cells.length:1;let a=[];e._applyResourceSorting(l,t);for(let e=0;e<n;e++)for(let n=0;n<t.length;n++){const r={resource:l.value,label:t[n].label,group:i?Object.assign({},i.cells[e].group):{},groupSeparator:!0};r.group[l.value]=t[n].id,a.push(r)}r.push(i={resource:l.value,groups:t,cells:a})}}return r}_getResourceData(e){const t=e?e.dataSource:void 0;if(!t||!t.length)return;let n={};for(let e=0;e<t.length;e++){const i=t[e];n[i.id]={id:i.id,label:i.label,color:i.color}}return n}_applyResourceSorting(e,t){const n=this,i=e.sortFunction?e.sortFunction:n.sortFunction,r=e.sortBy?e.sortBy:n.sortBy,a=e.sortOrder?e.sortOrder:n.sortOrder;if(!r)return;const l=(e,t)=>{const n=e[r],i=t[r];return"string"==typeof n&&"string"==typeof i?n.toLowerCase().localeCompare(i.toLowerCase()):"boolean"==typeof n&&"boolean"==typeof i?n===i:n instanceof Date&&i instanceof Date?n.getTime()-i.getTime():n-i};switch(a){case"asc":case"ascending":t.sort(((e,t)=>l(e,t)));break;case"desc":case"descending":t.sort(((e,t)=>l(t,e)));break;case"custom":"function"==typeof i&&t.sort(i);break;default:return}}_getTimelineCellsObjGroups(){const e=this,t=e._getResourceGroups();let n=[];if(!t.length)return n;for(let e=t.length-1;e>-1;e--){const i=t[e];if(n.length){const e=n.slice(0);n=[],i.groups.forEach((t=>{e.forEach((e=>{const r=Object.assign({},e);r.group=Object.assign({},r.group),r.group[i.resource]=t.id,n.push(r)}))}))}else i.groups.forEach((e=>{const t={label:e.label,color:e.color,group:{},resource:i.resource,groupSeparator:!0};t.group[i.resource]=e.id,n.push(t)}))}if(n.length){const t=e.view,n=e.views.find((e=>e.value&&e.value===t))||{},i=n&&n.groupOrientation?n.groupOrientation:e.groupOrientation;e.$.timeline.setAttribute("show-group-header",i)}else e.$.timeline.removeAttribute("show-group-header");return t[t.length-1].cells=n,t}_getTimelineCellsObjHorizontal(e,t){const n=this,i=n.view,r=n.viewType,a=i.indexOf("timeline")>-1,l=n.views.find((e=>e.value&&e.value===i))||{},o=new Date(n.dateCurrent);a?o.setHours(n.hourStart,0,0,0):o.setHours(0,0,0,0);const s=n.firstDayOfWeek;let d,c;switch(r){case"week":case"timelineWeek":"dateCurrent"!==n.viewStartDay&&o.setDate(o.getDate()-o.getDay()+s),c=n.hideWeekend||l.hideWeekend,d=n.hideNonworkingWeekdays||l.hideNonworkingWeekdays;break;case"month":case"timelineMonth":o.setDate(1),a||"dateCurrent"!==n.viewStartDay&&o.setDate(o.getDate()-o.getDay()+s),o.setHours(0,0,0,0),c=n.hideWeekend||l.hideWeekend,d=n.hideNonworkingWeekdays||l.hideNonworkingWeekdays}return n._getCellsObject({orientation:"horizontal",cells:[],cellSize:t,cellCount:e,date:o,hideWeekend:c,hideNonworkingWeekdays:d,hourStart:n.hourStart,hourEnd:n.hourEnd,viewSize:n.$.timelineContent.offsetWidth,viewDetails:l,offset:0})}_getCellsObject(e){const t=this,n=t.view,i=t.viewType,r=e.viewDetails||t.views.find((e=>e.value&&e.value===n))||{},a=t._timelineCells.groups,l=r&&r.groupOrientation?r.groupOrientation:t.groupOrientation,o=e.cellCount,s=e.viewSize,d=e.orientation,c=e.cells;let u,h=e.cellSize,[m,v]="horizontal"===d?["width","left"]:["height","top"];if(e.restrictedDates=t.restrictedDates,e.restrictedHours=t.restrictedHours,a&&a.length&&(u=a[a.length-1].cells),!u||!u.length||"horizontal"===d&&"vertical"===l||"vertical"===d&&"vertical"!==l)o*h<s&&(h=s/o),e.cellSize=parseFloat(h.toFixed(2)),"agenda"===i&&u&&u.length&&(e.groups=u),t._createCellObjects(e);else{const n=u.length;if(1===o){let e=s/n;e>=h&&(h=e)}else{const e=o*n;e*h<s&&(h=s/e)}if(e.cellSize=parseFloat(h.toFixed(2)),t.groupByDate&&d===l)e.groupHeader=a[a.length-1],t._createCellObjects(e);else{for(let n=0;n<u.length;n++){const i=u[n];i[v]=e.offset,e.size=0,e.group=i.group,t._createCellObjects(e),i[m]=e.size||0,t._refreshGroupHeaderCells(d,i)}c.length||t._createCellObjects(e)}}return c}_refreshGroupHeaderCells(e="horizontal",t){const n=t.group,i=this._timelineCells.groups;if(!i)return;let r=t.date,a=r?"cellsByDate":"cells";const[l,o]="horizontal"===e?["width","left"]:["height","top"];i.forEach((e=>{if(e.resource!==t.resource){const i=e[a];for(let e=0;e<i.length;e++){const a=i[e],s=a.group;r&&r.getTime()!==a.date.getTime()||Object.keys(s).every((e=>s[e]===n[e]))&&(a[l]=(void 0===a[l]?0:a[l])+t[l],void 0===a[o]&&(a[o]=t[o]))}}}))}_createCellObjects(e){const t=this;"horizontal"===e.orientation?t._createCellsObjectHorizontal(e):t._createCellsObjectVertical(e)}_createCellsObjectHorizontal(e){if(!e)return[];const t=this,n=t.viewType,i=n.indexOf("timeline")>-1,r=e.cells,a=new Date(e.date),l=e.cellSize,o=e.cellCount,s=e.hideWeekend,d=e.hideNonworkingWeekdays,c=e.hourStart,u=e.hourEnd,h=e.group,m=e.groupHeader,v=e.viewDetails,g=["timelineDay","timelineWeek"].indexOf(n)>-1;let f,p,w,y,_,b=e.offset,D=0;"agenda"===n?p=w=y=_=[]:(p=t.nonworkingDays,w=t.nonworkingHours,y=e.restrictedDates,_=e.restrictedHours),g?a.setHours(c):a.setHours(0,0,0,0);for(let C=0;C<o;C++){if(f={width:l},d){let e=0;const t=a.getHours();for(;e<7&&p.indexOf(a.getDay())>-1;)a.setDate(a.getDate()+1),e++;a.setHours(t)}if(s&&[0,6].indexOf(a.getDay())>-1){const e=a.getHours();a.setDate(a.getDate()+1),a.setHours(e)}if(f.restricted=t._isDateRestricted(a,y),!f.restricted&&i&&(f.restricted=t._isHourRestricted(a,_)),t.restricted)for(let e=0;e<t.restricted.length;e++){const n=t.restricted[e];t._isDateRestricted(a,[n.date])&&0===n.hours.length&&(f.restricted=!0)}if("agenda"===n?f.noLabel=!0:f.weekend=0===a.getDay()||6===a.getDay(),f.nonworking=p.indexOf(a.getDay())>-1,g&&(f.nonworking=f.nonworking||w.indexOf(a.getHours())>-1),m?(e.offset=b,e.date=a,t._createCellsObjByDate(f,e),b=e.offset):(h&&(f.group=h),f.left=b,f.date=new Date(a),r.push(f),b=parseFloat((b+l).toFixed(2))),!i||"timelineMonth"===n||"timelineWeek"===n&&v&&v.hideHours)a.setDate(a.getDate()+1),a.setHours(0,0,0,0);else{const e=a.getHours();"timelineWeek"===n&&e===u?(a.setDate(a.getDate()+1),a.setHours(c)):(a.setHours(a.getHours()+1),e===a.getHours()&&a.setHours(a.getHours()+2))}D+=l}f&&h&&(f.groupSeparator=!0),e.offset=b,e.size=D}_getTimelineCellsObjVertical(e,t){const n=this;return n._getCellsObject({orientation:"vertical",cells:[],date:new Date(n.dateCurrent),cellSize:t,cellCount:e,viewSize:n._scrollViewSize.height,offset:0})}_isEventPartOfGroup(e,t){if(e)return t=t.group||t,Object.keys(t).every((n=>e[n]&&e[n]===t[n]))}_createCellsObjByDate(e,t){const n=this,i=t.groupHeader;if(!i)return;const[r,a]="horizontal"===t.orientation?["width","left"]:["height","top"],l=i.cells,o=t.date,s=e[r],d=t.cells,c=t.agendaItem;let u=t.offset;n._createGroupCellsByDate(t,c);const h=i.cellsByDate,m=l.length,v=m%2==0?"center":"offset";for(let i=0;i<m;i++){const g=l[i],f=g.group;if(c&&!n._isEventPartOfGroup(c,f))continue;const p=Object.assign({},e),w=h.find((e=>e.date.getTime()===o.getTime()&&Object.keys(f).every((t=>f[t]===e.group[t]))));w&&(w[a]=void 0===w[a]?u:w[a],w[r]=p[r]+(c&&w[r]||0),p[a]=u,p.date=new Date(o),p.group=g.group,c||(i===m-1&&(p.groupSeparator=!0),i===Math.round(m/2)&&(p.showLabel=v)),n._refreshGroupHeaderCells(t.orientation,w),d.push(p),u=parseFloat((u+s).toFixed(2)))}t.offset=u}_createGroupCellsByDate(e,t){const n=this,i=e.date,r=n._timelineCells.groups;if(i)for(let a=0;a<r.length;a++){const l=r[a];let o=l.cellsByDate;o||(o=l.cellsByDate=[]);const s=l.cells;for(let r=0;r<s.length;r++){let a;if(t){if(!n._isEventPartOfGroup(t,s[r]))continue;a=o.find((e=>e.date.getTime()===i.getTime()&&e.group[e.resource]===t[e.resource]))}a=a||Object.assign({},s[r]),a.date||(a.date=new Date(i)),a.separator=!!e.separator,a.groupSeparator=t?!a.separator:r===s.length-1,o.includes(a)||o.push(a)}}}_createCellsObjectVertical(e){const t=this;if(!e)return;const n=t.firstDayOfWeek,i=t.viewType,r=i.indexOf("timeline")>-1,a=e.cells,l=new Date(e.date),o=e.cellCount,s=e.viewSize,d=t.nonworkingHours,c=e.group,u=e.groups,h=e.groupHeader;let m,v=e.offset,g=0,f=e.cellSize;if("agenda"===i){const n=Object.keys(o).sort(((e,t)=>parseInt(e)-parseInt(t)));for(let i of n){let n=o[i],r=f;if(c)n=n.filter((e=>t._isEventPartOfGroup(e,c)));else if(u)n=t._getAgendaGroupEvents(n);else if(h){const e=h.cells;let i=n.slice(0);n=[];for(let r=0;r<e.length;r++)n.push(...i.filter((n=>t._isEventPartOfGroup(n,e[r]))))}const l=n.length,d=new Date(parseInt(i));l*r<s&&(r=s/l),r=parseFloat(f.toFixed(2));for(let i=0;i<l;i++){const o=d;m={height:r,separator:i===l-1,weekend:0===o.getDay()||6===o.getDay(),nonworking:t.nonworkingDays.indexOf(o.getDay())>-1},i>0&&(m.noLabel=!0),h?(e.offset=v,e.date=o,e.agendaItem=n[i],e.separator=m.separator,t._createCellsObjByDate(m,e),v=e.offset):(c&&(m.group=c),m.top=v,m.date=o,a.push(m),v=parseFloat((v+r).toFixed(2))),g+=r}}t.$.timeline.classList[a.length?"remove":"add"]("no-agenda")}else if(r)for(let n=0;n<o;n++)l.setHours(0,0,0,0),m={height:f,weekend:0===l.getDay()||6===l.getDay()},h?(e.offset=v,e.date=l,t._createCellsObjByDate(m,e),v=e.offset):(c&&(m.group=c),m.top=v,m.date=new Date(l),a.push(m),v=parseFloat((v+f).toFixed(2))),g+=f;else{let r;"month"===i?(l.setDate(1),l.setDate(l.getDate()-(l.getDay()-n+7)%7),l.setHours(0,0,0,0)):(l.setHours(t.hourStart,0,0,0),r=e.restrictedHours);for(let n=0;n<o;n++)m={height:f},h?(e.offset=v,e.date=l,t._createCellsObjByDate(m,e),v=e.offset):(c&&(m.group=c),m.top=v,m.date=new Date(l),a.push(m),v=parseFloat((v+f).toFixed(2))),g+=f,"month"===i?l.setDate(l.getDate()+7):(m.nonworking=d.indexOf(l.getHours())>-1,l.setHours(l.getHours()+1),r&&(m.restricted=t._isHourRestricted(l,r)))}m&&c&&(m.groupSeparator=!0),e.offset=v,e.size=g}_getTimelineCellsObjDetails(){const e=this,t=e.view,n=e.views.find((e=>e.value&&e.value===t));if("timelineWeek"!==e.viewType||n&&n.hideHours)return[];function i(e){let t="";if(!a&&e)for(const n in e)t+=n+e[n];return t}const r=e.hourStart,a=e.groupByDate,l=e._timelineCells.horizontal;let o,s={};for(let e=0;e<l.length;e++){const t=l[e],n=t.date,a=n.getDate()+i(t.group);if(o=s[a],o||(o=s[a]={width:0,left:t.left}),o.width+=t.width,t.groupSeparator&&(o.groupSeparator=t.groupSeparator),!o.date){const e=new Date(n);e.setHours(r,0,0,0),o.date=e}}return s=Object.values(s).sort(((e,t)=>e.left-t.left)),s}_getAgendaGroupEvents(e){const t=this,n=t._timelineCells.groups;let i;n&&n.length&&(i=n[n.length-1].cells);const r={};let a=0;for(let n=0;n<i.length;n++)r[n]=e.filter((e=>t._isEventPartOfGroup(e,i[n]))),r[n].length>r[a].length&&(a=n);return r[a]}_handleTimelineContentSize(e,t,n){const i=this,r=i.view,a=i.viewType,l=i._timelineCells.groups,o=i.views.find((e=>e.value&&e.value===r))||{},s=o&&o.groupOrientation?o.groupOrientation:i.groupOrientation,d="agenda"===a&&Object.keys(e.vertical).length?i.$.timelineHeaderVertical.offsetWidth:Math.max(i.$.timelineViewCellsLabelContainer.offsetWidth,i.$.timelineViewAllDaylabel.offsetWidth),c="width"===n?Math.max(0,i.$.timeline.offsetWidth-d):i.$.timelineContainer.offsetHeight;let u=0,h=[],m=e["width"===n?"horizontal":"vertical"];if(l&&l.length&&(h=l[l.length-1].cells),"agenda"===a&&"height"===n)for(let e in m){let n=m[e];h.length&&(n="horizontal"===s?i._getAgendaGroupEvents(n):n.filter((e=>h.some((t=>i._isEventPartOfGroup(e,t)))))),u+=n.length*t}else{let e=1;i.groups.length&&("vertical"!==s&&"width"===n||"vertical"===s&&"height"===n)&&(e=Math.max(h.length,1)),1===m?c<t?u=t*e:(u=c/e,u<t&&(u=t*e)):(m*=e,m*t<c&&(t=c/m),u=m*(t=parseFloat(t.toFixed(2))))}u=Math.max(u,c,t),i.$.timelineContent.style[n]=u===c?"":u+"px",i._refresh()}_createCells(e,t="smart-scheduler-cell",n="gridcell"){let i,r=document.createDocumentFragment();Array.isArray(t)||(t=[t]);for(let a=0;a<e;a++)i=document.createElement("div"),t.forEach((e=>i.classList.add(e))),i.setAttribute("role",n),r.appendChild(i);return r}_refreshTimelineContentCells(){const e=this,t=e._timelineCells;if(!t||!t.vertical||!t.horizontal)return;const n=e.$.timelineContainer,i=e.$.timelineCellsContainer,r=e.$.timelineContent,a=e.view,l=e.viewType,o=e.views.find((e=>e.value&&e.value===a))||{},s=o&&o.groupOrientation?o.groupOrientation:e.groupOrientation,d=e._getVisibleCellObj();if(!d)return;const c={viewType:l,isTimelineView:l.indexOf("timeline")>-1,visibleCellObjs:d,groupOrientation:s,locale:e.locale,timeZone:e.timeZone,isRightToLeft:e.rightToLeft,dateCurrent:e.dateCurrent,restrictedDates:e.restrictedDates,restrictedHours:e.restrictedHours};i.remove(),e._recycleContainerCells({fragment:i,cellsNeeded:d[e.viewType.indexOf("timeline")>-1?"horizontal":"vertical"].length,className:"smart-scheduler-cell-container",role:"row"}),e._refreshContainerCells(i,c),r.insertBefore(i,r.firstElementChild),n.scrollTop=e.scrollTop,n.scrollLeft=e._getScrollLeft(e.scrollLeft),e._setCurrentTimeIndicators()}_getVisibleCellObj(){const e=this,t=e._timelineCells;if(!t||!t.vertical||!t.horizontal)return;const n=t.vertical,i=t.horizontal,[r,a]=[e.scrollTop,e.scrollLeft],[l,o]=[r+e._scrollViewSize.height,a+e._scrollViewSize.width];let[s,d]=[[],[]];for(let e=0;e<n.length;e++){const t=n[e];t.top+t.height>=r&&t.top<=l&&s.push(t)}for(let e=0;e<i.length;e++){const t=i[e];t.left+t.width>=a&&t.left<=o&&d.push(t)}return{vertical:s,horizontal:d}}_refreshContainerCells(e,t){const n=this,i=t.viewType,r=t.groupOrientation,a=t.isTimelineView,l=t.visibleCellObjs,o=e.children,s=e===n.$.timelineCellsContainer,d=t.isRightToLeft,c=t.dateCurrent,u=t.restrictedDates,h=t.restrictedHours,m=new Date;let v,g,f,p,w,y,_;if(s)a?(f=l.horizontal,[w,y,_]=["horizontal","left","width"]):(f=l.vertical,[w,y,_]=["vertical","top","height"]),v=l.vertical,p=n._getCellsScaleCount();else if(a?(v=l.horizontal,f=l.vertical,[w,y,_]=["vertical","top","height"]):(v=l.vertical,f=l.horizontal,[w,y,_]=["horizontal","left","width"]),n._selectedCellObj){const e=n._selectedCellObj.from;if(!e.allDay){const t=n._selectedCellObj.to;g={lastTime:e.time,fromTime:Math.min(e.time,t.time),toTime:Math.max(e.time,t.time),group:e[r]?e[r].group:void 0}}}for(let l=0;l<o.length;l++){const b=o[l],D=f[l];let C;if(D.nonworking?b.setAttribute("nonworking",""):b.removeAttribute("nonworking"),D.weekend?b.setAttribute("weekend",""):b.removeAttribute("weekend"),D.separator?b.setAttribute("separator",""):b.removeAttribute("separator"),C=D.groupSeparator,s)a||"vertical"!==r||(C=v[l].groupSeparator),C&&(a&&"vertical"!==r||!a&&"vertical"===r)?b.setAttribute("group-separator",""):b.removeAttribute("group-separator"),b.$={cellObj:D},n._refreshScaleCells(b,t,p);else{b.$||(b.$={cellObj:{}});const t=b.$.cellObj;t.scaleIndex=e._scaleIndex,a?(t.horizontal=e.$.cellObj,t.vertical=D):(t.horizontal=D,t.vertical=e.$.cellObj);const l=t[r]?t[r].group:void 0;if(l)for(const e in l)b.setAttribute(e,l[e]||"");C&&(!a&&"vertical"!==r||a&&"vertical"===r)?b.setAttribute("group-separator",""):b.removeAttribute("group-separator");const o=new Date(t.time=n._getCellTime(t));if(n._isDateRestricted(o,u)||n._isHourRestricted(o,h)?b.setAttribute("restricted",""):b.removeAttribute("restricted"),n.restricted)for(let e=0;e<n.restricted.length;e++){const t=n.restricted[e];if(n._isDateRestricted(o,[t.date])){const e=o.getHours();for(let n=0;n<t.hours.length;n++){const i=t.hours[n];Array.isArray(i)?e>=i[0]&&e<=i[1]&&b.setAttribute("restricted",""):e===i&&b.setAttribute("restricted","")}}}n._refreshAvailableState(D,b,o),o.getFullYear()===m.getFullYear()&&o.getMonth()===m.getMonth()&&o.getDate()===m.getDate()?b.setAttribute("today",""):b.removeAttribute("today",""),n._setCellContent(b,o),b.setAttribute("aria-haspopup",!0),"month"===i&&o.getMonth()!==c.getMonth()?b.setAttribute("other-month",""):b.removeAttribute("other-month"),b.setAttribute("date",o),b.removeAttribute("selected"),g&&l===g.group&&t.time>=g.fromTime&&t.time<=g.toTime&&b.setAttribute("selected",t.time===g.lastTime?"start":"")}b.style.top=b.style.left=b.style.right=b.style.width=b.style.height="",b.style[_]=D[_]+"px","horizontal"===w?b.style[d?"right":"left"]=D.left+"px":b.style[y]=D[y]+"px"}}getViewDates(){const e=this.querySelectorAll(".smart-scheduler-cell");let t=null,n=null;for(let i=0;i<e.length;i++)!e[i].hasAttribute("all-day")&&e[i].hasAttribute("date")&&(t||(t=e[i]),n=e[i]);if(t&&n){const e=new Date(t.getAttribute("date")),i=new Date(n.getAttribute("date"));return e.setHours(0,0,0,0),i.setHours(23,59,59,999),[e,i]}return null}_refreshScaleCells(e,t,n){const i=this,r=t.visibleCellObjs,a=t.isTimelineView,l=e.children;i._recycleContainerCells({fragment:e,cellsNeeded:n,className:["smart-scheduler-cell","scale"],role:"presentation"});const o=a?"width":"height",s=l.length,d=e.$.cellObj,c=r[a?"vertical":"horizontal"].length;for(let r=0;r<s;r++){const a=l[r];a.$=e.$,a._scaleIndex=r,d.nonworking?a.setAttribute("nonworking",""):a.removeAttribute("nonworking"),a.style.width=a.style.height=null,a.style[o]=100/n+"%",i._recycleContainerCells({fragment:a,cellsNeeded:c}),i._refreshContainerCells(a,t),delete a._scaleIndex}}getDateFromCoordinates(e,t){const n=this.querySelectorAll(".smart-scheduler-cell");for(let i=0;i<n.length;i++){const r=n[i],a=r.getBoundingClientRect();if(r.hasAttribute("date")&&a.left<=e&&a.right>=e&&a.top<=t&&a.bottom>=t){const e=r.getAttribute("date");return new Date(e)}}return null}getIsAllDayCellFromCoordinates(e,t){const n=this.querySelectorAll(".smart-scheduler-cell");for(let i=0;i<n.length;i++){const r=n[i],a=r.getBoundingClientRect();if(r.hasAttribute("date")&&a.left<=e&&a.right>=e&&a.top<=t&&a.bottom>=t&&r.hasAttribute("all-day"))return!0}return!1}_refreshAvailableState(e,t,n){const i=this;if(i.available&&i.available.length){t.setAttribute("restricted",""),e.restricted=!0;for(let r=0;r<i.available.length;r++){const a=i.available[r],l=e.group?Object.keys(e.group)[0]:null;if(!e.group||void 0===a[l]||e.group&&e.group[l]===a[l])if("string"==typeof a.start&&5===a.start.length&&a.start.indexOf(":")>=0){const i=a.start.split(":"),r=parseInt(i[0]),l=parseInt(i[1]),o=a.end.split(":"),s=parseInt(o[0]),d=parseInt(o[1]),c=new Date(n.getFullYear(),n.getMonth(),n.getDate(),r,l,0),u=new Date(n.getFullYear(),n.getMonth(),n.getDate(),s,d,0);c<=n&&n<=u&&(t.removeAttribute("restricted"),e.restricted=!1)}else if("string"==typeof a.start&&a.start.length<=2){const i=parseInt(a.start),r=parseInt(a.end),l=new Date(n.getFullYear(),n.getMonth(),n.getDate(),i,0,0),o=new Date(n.getFullYear(),n.getMonth(),n.getDate(),r,0,0);l<=n&&n<=o&&(t.removeAttribute("restricted"),e.restricted=!1)}else if(a.date){if(a.date.getFullYear()===n.getFullYear()&&a.date.getMonth()===n.getMonth()&&a.date.getDate()===n.getDate()){const i=n.getHours();if(a.hours)for(let n=0;n<a.hours.length;n++){const r=a.hours[n];Array.isArray(r)?i>=r[0]&&i<=r[1]&&(t.removeAttribute("restricted",""),e.restricted=!1):i===r&&(t.removeAttribute("restricted",""),e.restricted=!1)}else t.removeAttribute("restricted",""),e.restricted=!1}}else if("number"==typeof a.start){const i=a.start,r=a.end,l=new Date(n.getFullYear(),n.getMonth(),n.getDate(),i,0,0),o=new Date(n.getFullYear(),n.getMonth(),n.getDate(),r,0,0);l<=n&&n<=o&&(t.removeAttribute("restricted"),e.restricted=!1)}else{const i=new Smart.Utilities.DateTime(a.start).toDate(),r=new Smart.Utilities.DateTime(a.end).toDate();i<=n&&n<=r&&(t.removeAttribute("restricted"),e.restricted=!1)}}}}_refreshTimelineAllDayCells(){const e=this,t=new Date,n=e.restrictedHours,i=e.viewType.toLowerCase(),r=e.$.timelineViewAllDayContent,a=e.$.timelineViewAllDayCellsContainer;if(i.indexOf("timeline")>-1||i.indexOf("month")>-1)return void(a.innerHTML="");a.remove();const l=a.children,o=e.locale,s=e.rightToLeft,d={height:e._allDayCellSize,top:0},c=e.$.timelineHeaderHorizontalContent.querySelector(".smart-scheduler-cells").children;e._recycleContainerCells({fragment:a,cellsNeeded:"agenda"===i?0:c.length});for(let i=0;i<l.length;i++){const r=l[i],a=c[i],u=a.$.cellObj;r.$||(r.$={cellObj:{}});const h=r.$.cellObj;h.horizontal=u,h.vertical=d,h.allDay=!0,r.setAttribute("all-day","");const m=h.horizontal.group;if(m)for(const e in m)r.setAttribute(e,m[e]||"");const v=new Date(h.time=e._getCellTime(h));u.restricted||n.length?r.setAttribute("restricted",""):r.removeAttribute("restricted"),v.getFullYear()===t.getFullYear()&&v.getMonth()===t.getMonth()&&v.getDate()===t.getDate()?r.setAttribute("today",""):r.removeAttribute("today",""),e._setCellContent(r,v),r.setAttribute("date",v.toLocaleDateString(o)),u.groupSeparator?r.setAttribute("group-separator",""):r.removeAttribute("group-separator"),u.weekend?r.setAttribute("weekend",""):r.removeAttribute("weekend"),u.nonworking?r.setAttribute("nonworking",""):r.removeAttribute("nonworking"),e._refreshAvailableState(u,r,v),s?(r.style.left="",r.style.right=a.style.right):(r.style.right="",r.style.left=a.style.left),r.style.width=a.style.width}r.insertBefore(a,r.firstElementChild),r.scrollLeft=e._getScrollLeft(e.scrollLeft)}_getCellsScaleCount(){const e=this,t=e.viewType,n=e.view;if(["timelineMonth","month","agenda"].indexOf(t)>-1)return 1;if("timelineWeek"===t){const t=e.views.find((e=>e.value&&e.value===n))||{};if(t&&t.hideHours)return 1}switch(e.timelineDayScale){case"hour":return 1;case"halfHour":return 2;case"quarterHour":return 4;case"tenMinutes":return 6;case"fiveMinutes":return 12;default:return 1}}_getTimelineVisibleCellsCount(e="horizontal"){const t=this,n=e.orientation||e,i=e.type,r=e.resource;let a=t._timelineCells[n];if(i&&(a=r?t._timelineCells.groups.find((e=>e.resource===r))[t.groupByDate?"cellsByDate":"cells"]:t._timelineCells[i]),!a)return 0;const l=t._getFirstCellObjInView({orientation:n,type:i,resource:r});if(!l)return 0;const[o,s,d]="horizontal"===n?["left","width",t.scrollLeft]:["top","height",t.scrollTop];let c;if("vertical"===n?c=t._scrollViewSize.height:(c=t.$.timelineHeaderHorizontalContent.offsetWidth||t.$.timelineViewAllDayContent.offsetWidth,!c&&t.hideAllDay&&"day"===t.viewType&&(c=t.offsetWidth),"agenda"===t.viewType&&t._timelineCells.vertical.length&&(c-=t.$.timelineHeaderVertical.offsetWidth)),i){let e=0;if("details"===i&&("timelineWeek"!==t.viewType||"vertical"===n))return e;for(let t=a.indexOf(l);t<a.length;t++){const n=a[t];n[o]+n[s]>=d&&n[o]<c+d&&e++}return e}const u=1-(l[o]+l[s]-d)/a[0][s];return isNaN(u)||!isFinite(u)?0:Math.min(a.length,Math.ceil(parseFloat((c/l[s]+u).toFixed(2))))}_getFirstCellObjInView(e="horizontal"){const t=this,n=e.orientation||e,i=e.type,r=e.resource,a=t._timelineCells;if(!a)return;let l,o,s;const[d,c,u]="horizontal"===n?["scrollLeft","left","width"]:["scrollTop","top","height"],h=Math.abs(t[d]);s=a[n],i&&(s=r?t._timelineCells.groups.find((e=>e.resource===r))[t.groupByDate?"cellsByDate":"cells"]:t._timelineCells[i]);for(let e=0;e<s.length;e++){const t=s[e];if(t[c]+t[u]>=h){l=t;break}o=t}return!l&&o&&(l=h>o[c]?o:s[0]),l}_getCellsCount(e){const t=this,n=t.dateCurrent,i=new Date(t.dateCurrent);e||(e=t.view);const r=t.viewType,a=t.views.find((t=>t.value&&t.value===e))||{},l=t.nonworkingDays;let[o,s,d,c]=[0,0,0,0,0];const u=t.hideNonworkingWeekdays||a.hideNonworkingWeekdays,h=t.hideWeekend||a.hideWeekend;switch(h&&(c=2,u&&(c-=(l.includes(0)?1:0)+(l.includes(6)?1:0))),r){case"agenda":s=t._getAgendaEvents(i,a),o=1;break;case"day":s=t._getDayHours(i),o=1;break;case"month":case"week":s="month"===r?6:t.hourEnd-t.hourStart+1,o=7-(u?l.length:0)-c,a.additionalDays&&(o+=a.additionalDays);break;case"timelineDay":o=t._getDayHours(i),s=1;break;case"timelineWeek":{const e=t.firstDayOfWeek,n=a&&a.hideHours;let r=new Date(i);s=1,r.setDate(r.getDate()-r.getDay()+e);for(let e=0;e<7;e++)(!h||h&&[0,6].indexOf(r.getDay())<0)&&(!u||u&&l.indexOf(r.getDay())<0)&&(o+=n?1:t._getDayHours(r),d++),r.setDate(r.getDate()+1);break}case"timelineMonth":{const e=new Date(n);e.setDate(1),e.setMonth(e.getMonth()+1),e.setDate(0),o=e.getDate(),s=1;break}}return{horizontal:o,vertical:s,detail:d}}_getAgendaEvents(e,t){const n=this;if(!t){const e=n.view;t=n.views.find((t=>t.value&&t.value===e))||{}}e||(e=new Date(n.currentDate));const i=n.hideNonworkingWeekdays||t.hideNonworkingWeekdays,r=n.hideWeekend||t.hideWeekend,a=n.nonworkingDays,l=new Date(e),o=n.hourStart,s=n.hourEnd;l.setHours(0,0,0,0);const d=new Date(l);d.setDate(l.getDate()+6),d.setHours(23,59,59,999);const[c,u]=[l.getTime(),d.getTime()],h=n._getEventsBetween(c,u);let m={};if(!h||!h.length)return m;for(let e=0;e<h.length;e++){const t=h[e],n=t.dateStart,d=t.dateEnd,v=n.getTime(),g=d.getTime();if(!(v>=u||g<=c||t.hidden))for(let e=0;e<7;e++){const n=new Date(l);if(n.setDate(n.getDate()+e),i&&a.indexOf(n.getDay())>-1||r&&[0,6].indexOf(n.getDay())>-1)continue;n.setHours(o,0,0,0);const d=new Date(n);d.setHours(s,59,59,999);const c=n.getTime(),u=d.getTime();if(c<=g&&u>=v){let e=m[c];e||(m[c]=e=[]),e.push(t)}}}for(let e in m)m[e].sort(((e,t)=>e.dateStart.getTime()-t.dateStart.getTime()));return m}_getEventsBetween(e,t){const n=this;if(!e||!t)return[];e instanceof Date&&(e=e.getTime()),t instanceof Date&&(t=t.getTime());let i=n._eventsBetween;if(n._eventsBetween){if(i.timeStart===e&&i.timeEnd===t)return i.events}else i=n._eventsBetween={timeStart:e,timeEnd:t,events:[]};let r=[];const a=n._events,l=n._rRule,o=n.restrictedDates,s=n.restrictedHours,d={isMonthView:n.viewType.toLowerCase().indexOf("month")>-1,restrictedDates:n.restrictedDates,restrictedHours:n.restrictedHours,hourStart:n.hourStart,hourEnd:n.hourEnd,dateStart:new Date(e),dateEnd:new Date(t),rRule:l,targetEvents:r};for(let i=0;i<a.length;i++){const c=a[i],u=c.repeat,h=c.dateStart,m=c.dateEnd,v=h.getTime(),g=m.getTime();if(n._applyFiltering(c)){if(u&&l){const e=n._getEventRepeatOptions(c);if(e){d.event=c,d.repeatObj=u,d.options=e,d.eventTimeStart=v,d.eventTimeEnd=g,n._setRepeatingEvents(d);continue}}else if(n._isEventRestricted(c,o,s)||v>t||g<e)continue;r.push(c)}}return r.sort(((e,t)=>e.dateStart.getTime()-t.dateStart.getTime())),i.timeStart=e,i.timeEnd=t,i.events=r}_applyFiltering(e){const t=this;if(!t.filterable)return!0;const n=t.filter;if("function"==typeof n)return!!n(t._cloneObject(e));if(!Array.isArray(n))return!0;if(!n.length)return!0;for(let i=0;i<n.length;i++){const r=n[i];if(void 0===r.name)continue;const a=e[r.name],l=r.value;return"function"==typeof l?!!l(a):t._checkFilterMode(a+"",l+"")}}_checkFilterMode(e,t){switch(this.filterMode){case"startsWith":return 0===e.indexOf(t);case"startsWithIgnoreCase":return 0===e.toLowerCase().indexOf(t.toLowerCase());case"doesNotContain":return e.indexOf(t)<0;case"doesNotContainIgnoreCase":return e.toLowerCase().indexOf(t.toLowerCase())<0;case"contains":return e.indexOf(t)>-1;case"containsIgnoreCase":return e.toLowerCase().indexOf(t.toLowerCase())>-1;case"equals":return 0===e.localeCompare(t);case"equalsIgnoreCase":return 0===e.toLowerCase().localeCompare(t.toLowerCase());case"endsWith":return e.endsWith(t);case"endsWithIgnoreCase":return e.toLowerCase().endsWith(t.toLowerCase())}}_isEventRestricted(e,t,n){const i=this;if(!e)return!1;const r=e.dateStart,a=e.dateEnd,l=r.getTime(),o=a.getTime();let s;if(t||(t=i.restrictedDates),n||(n=i.restrictedHours),n.length){let e=Math.max(1,Math.min(23,Math.floor((a.getTime()-r.getTime())/36e5))),t=r.getHours();if(e>0)for(s=[];e>=0;)s.push(t),t=23===t?0:t+1,e--;if(s&&n.some((e=>s.includes(e))))return!0}for(let e=0;e<t.length;e++){const n=t[e],i=n.getTime();let r=new Date(n);if(r.setHours(23,59,59,999),r=r.getTime(),l<=r&&o>=i)return!0}if(i.restricted)for(let e=0;e<i.restricted.length;e++){const t=i.restricted[e];if(i._isDateRestricted(r,[t.date])){const e=r.getHours();for(let n=0;n<t.hours.length;n++){const i=t.hours[n];if(Array.isArray(i)){if(e>=i[0]&&e<=i[1])return!0}else if(e===i)return!0}}}if(i.available&&i.available.length){let t=!0;for(let n=0;n<i.available.length;n++){const a=i.available[n],l=i.resources.length>0?i.resources[0].value:null;if(!l||void 0===e[l]||l&&e[l]===a[l])if("string"==typeof a.start&&5===a.start.length&&a.start.indexOf(":")>=0){const e=a.start.split(":"),n=parseInt(e[0]),i=parseInt(e[1]),l=a.end.split(":"),o=parseInt(l[0]),s=parseInt(l[1]),d=new Date(r.getFullYear(),r.getMonth(),r.getDate(),n,i,0),c=new Date(r.getFullYear(),r.getMonth(),r.getDate(),o,s,0);d<=r&&r<=c&&(t=!1)}else if("string"==typeof a.start&&a.start.length<=2){const e=parseInt(a.start),n=parseInt(a.end),i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),e,0,0),l=new Date(r.getFullYear(),r.getMonth(),r.getDate(),n,0,0);i<=r&&r<=l&&(t=!1)}else if(a.date){if(a.date.getFullYear()===r.getFullYear()&&a.date.getMonth()===r.getMonth()&&a.date.getDate()===r.getDate()){const e=r.getHours();if(a.hours)for(let n=0;n<a.hours.length;n++){const i=a.hours[n];Array.isArray(i)?e>=i[0]&&e<=i[1]&&(t=!1):e===i&&(t=!1)}else t=!1}}else if("number"==typeof a.start){const e=a.start,n=a.end,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),e,0,0),l=new Date(r.getFullYear(),r.getMonth(),r.getDate(),n,0,0);i<=r&&r<=l&&(t=!1)}else{const e=new Smart.Utilities.DateTime(a.start).toDate(),n=new Smart.Utilities.DateTime(a.end).toDate();e<=r&&r<=n&&(t=!1)}}return t}return!1}_isDateRestricted(e,t){const n=this;if(!e||!e.getTime||isNaN(e.getTime()))return!1;const i=e.getFullYear(),r=e.getMonth(),a=e.getDate();t||(t=n.restrictedDates);for(let e=0;e<t.length;e++){const n=t[e],l=n.getFullYear(),o=n.getMonth(),s=n.getDate();if(i===l&&r===o&&a===s)return!0}return!1}_isHourRestricted(e,t){const n=this;return e instanceof Date&&(e=e.getHours()),void 0!==e&&!isNaN(e)&&(t||(t=n.restrictedHours),t.includes(e))}_setRepeatingEvents(e){const t=this,n=e.isMonthView,i=e.hourStart,r=e.hourEnd,a=e.rRule,l=e.dateStart,o=e.dateEnd,s=e.restrictedDates,d=e.restrictedHours,c=l.getTime(),u=o.getTime(),h=e.event,m=e.options,v=e.repeatObj,g=e.eventTimeStart,f=e.eventTimeEnd,p=v.exceptions,w=e.targetEvents,y=h.dateStart,_=h.dateEnd;let b=l;y.getFullYear()===_.getFullYear()&&y.getMonth()===_.getMonth()&&y.getDate()===_.getDate()||(b=h.dateStart);let D=new a(m).between(new Date(Date.UTC(...t._getDateArgs(b))),new Date(Date.UTC(...t._getDateArgs(o))),!0);if(!D.length){const e=new a(m).before(new Date(Date.UTC(...t._getDateArgs(l))));e&&new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes()).getTime()+f-g>=c&&D.push(e)}for(let e=0;e<D.length;e++){let a=D[e];a=new Date(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes());let l,o=new Date(a),m=new Date(a.getTime()+f-g);if(!(t._isEventRestricted(h,s,d)||o.getTime()>u||m.getTime()<c)&&(p&&(l=p.find((e=>{const t=e.date;return h.allDay&&t.setHours(a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()),t.getTime()===a.getTime()}))),l&&(o=l.dateStart,m=l.dateEnd),o&&!isNaN(o.getTime())||(o=new Date(a)),m&&!isNaN(m.getTime())||(m=new Date(o.getTime()+f-g)),n||!(o.getHours()<i&&m.getHours()<i||o.getHours()>r&&m.getHours()>r))){if(l)l.dateStart&&!isNaN(l.dateStart.getTime())||(l.dateStart=o),l.dateEnd&&!isNaN(l.dateEnd.getTime())||(l.dateEnd=m),l.$={event:h};else if(l=t._cloneObject(h,!1,!0),l.dateStart=o,l.dateEnd=m,l.$={event:h},p){const e=l.dateStart.getTime(),t=l.dateEnd.getTime();for(let n=0;n<p.length;n++){const i=p[n],r=i.date.getTime();r>e&&r<=t&&(void 0===i.dateStart&&(i.dateStart=new Date(o)),void 0===i.dateEnd&&(i.dateEnd=new Date(m)),w.push(i))}}w.push(l)}}}_getEventRepeatOptions(e,t){const n=this,i=n._rRule;if(!e||!e.repeat||!i)return;const r=e.repeat,a=r.repeatFreq,l=a?i[a.toUpperCase()]:void 0;if(void 0===l)return;const o=r.repeatOn,s=r.repeatEnd;let d={freq:l,wkst:(n.firstDayOfWeek-1+7)%7,interval:r.repeatInterval||1};const c=n._getRepeatOnCondition(a,o);switch(a){case"weekly":d.byweekday=c.map((e=>(e-1+7)%7));break;case"monthly":d.bymonthday=c;break;case"yearly":d.bymonth=c.index+1,d.bymonthday=c.value}return s instanceof Date?d.until=new Date(Date.UTC(...n[t?"_getUTCDateArgs":"_getDateArgs"](s))):"number"!=typeof s||isNaN(s)||(d.count=s),d.dtstart=new Date(Date.UTC(...n[t?"_getUTCDateArgs":"_getDateArgs"](e.dateStart))),d}_getUTCDateArgs(e){if(!isNaN(new Date(e).getTime()))return[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes()]}_getDateArgs(e){if(!isNaN(new Date(e).getTime()))return[e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes()]}_getRepeatOnCondition(e,t){if(!e||!t)return[];let n;if("weekly"===e){let e=[];Array.isArray(t)||(t=[t]);for(let i=0;i<t.length;i++)n=t[i],"string"==typeof n&&(n=isNaN(parseInt(n))?new Date(n):parseInt(n)),n instanceof Date&&!isNaN(n.getTime())?e.push(n.getDay()):e.push(Math.max(0,Math.min(6,parseInt(t[i])||0)));return e}if("monthly"===e)return Array.isArray(t)&&(t=t[0]),n=t,"string"==typeof n&&(n=isNaN(parseInt(n))?new Date(n):parseInt(n)),n=n instanceof Date&&!isNaN(n.getTime())?n.getDate():Math.max(0,Math.min(31,parseInt(t)||0)),n;if("yearly"===e){let e,i;if(Array.isArray(t)&&(t=t[0]),n=t,"string"==typeof n&&(n=isNaN(parseInt(n))?new Date(n):parseInt(n)),n instanceof Date&&!isNaN(n.getTime()))e=n.getMonth(),i=n.getDate();else{let n=t,r=t;"object"==typeof t&&(n=t.month,r=t.date),e=Math.max(0,Math.min(11,parseInt(n)||0)),i=Math.max(0,Math.min(31,parseInt(r)||0))}return{index:e,value:i}}}_getDayHours(e){const t=this,n=new Date(e||t.dateCurrent),i=n.getDate(),r=t.hourStart,a=t.hourEnd;let l=0;for(n.setHours(r,0,0,0);i===n.getDate()&&n.getHours()<=a;){l++;const e=n.getHours();n.setHours(n.getHours()+1,0,0,0),e===n.getHours()&&n.setHours(n.getHours()+2,0,0,0)}return l}_getDateString(e,t="horizontal",n){const i=this,r=i.locale,a=i.view,l=i.viewType,o=i.views.find((e=>e.value&&e.value===a)),s=l.indexOf("timeline")>-1,d=e.timeZone||i.timeZone;let c;if(e=e.timeZone&&e.timeZone===i.timeZone?e.date||e:new Smart.Utilities.DateTime(e.date||e).toDate(d),s){if("vertical"===t)return"";c="timelineMonth"===l||"timelineWeek"===l&&(n||o&&o.hideHours)?new Intl.DateTimeFormat(r,{day:i.dayFormat,weekday:i.weekdayFormat}).format(e):new Intl.DateTimeFormat(r,{hour:i.hourFormat,minute:i.minuteFormat}).format(e)}else if("horizontal"===t){if("day"===l)return"";"week"===l?c=new Intl.DateTimeFormat(r,{day:i.dayFormat,weekday:i.weekdayFormat}).format(e):"month"===l&&(c=new Intl.DateTimeFormat(r,{weekday:i.weekdayFormat}).format(e))}else{if("month"===l)return"";c="agenda"===l?new Intl.DateTimeFormat(r,{day:i.dayFormat,weekday:i.weekdayFormat}).format(e):new Intl.DateTimeFormat(r,{hour:i.hourFormat,minute:i.minuteFormat}).format(e)}return i.timelineHeaderFormatFunction?i.timelineHeaderFormatFunction(e,t,n,c):c}_setGroupContent(e){const t=this,n=e.$.cellObj;if(t.groupTemplate)t._applyTemplate("groupTemplate",e,n);else{const i=t.resources.find((e=>e.value===n.resource));if(!i)return void(e.innerHTML="");let r;n.group&&(r=n.label);let a=r||i.label;t.timelineHeaderGroupFormatFunction&&(a=t.timelineHeaderGroupFormatFunction(r,i,a)),e.innerHTML=`<div>${a}</div>`}}_applyTemplate(e,t,n){const i=this;let r,a=i[e];if("groupTemplate"===e){if(r=i.resources.find((e=>e.value===n.resource)),r){const e=n.group[n.resource];n=r.dataSource.find((t=>t.id===e))}n||(n=r)}i._templates||(i._templates={});const l=i._templates;if("function"==typeof a)return a.call(i,t,n),void delete l[e];if("string"==typeof a){const e=a;if(a=document.getElementById(a),!a){if(a=e,"object"==typeof n)for(let e in n)a=a.replaceAll("{{"+e+"}}",n[e]);else{const e=/{{\s*\w*\s*}}/gm;let t=[],i=a;if(e.test(i)){const n=i.match(e);t||(t=[]),n&&n.forEach((e=>{t.includes(e)||t.push(e)}))}if(t)for(let e=0;e<t.length;e++){const r=t[e];i=i.replace(r,"object"==typeof n?n[r.replace(/{{|}}/gm,"").trim()]||"":n)}a=i}return void(t.innerHTML=a)}}if(!("content"in document.createElement("template")))return i.error(i.localize("htmlTemplateNotSuported",{elementType:i.nodeName.toLowerCase()})),void delete l[e];if(null===a||!("content"in a))return i.error(i.localize("invalidTemplate",{elementType:i.nodeName.toLowerCase(),property:"groupTemplate"})),void delete l[e];let o=l[e];o||(o=l[e]={}),t.innerHTML="";const s=document.importNode(a.content,!0);if("cellTemplate"===e)n=new Intl.DateTimeFormat(i.locale,{day:i.dayFormat}).format(n);else if("eventCollectorTemplate"===e||"headerTemplate"===e||"footerTemplate"===e)return t.innerHTML="",void t.appendChild(s);const d=s.childNodes,c=o.bindings;let u;c&&(u=c);for(let e=0;e<d.length;e++){let i=d[e].outerHTML;if(i){if(!c){const e=/{{\s*\w*\s*}}/gm;if(e.test(i)){const t=i.match(e);u||(u=[]),t&&t.forEach((e=>{u.includes(e)||u.push(e)}))}}if(u)for(let e=0;e<u.length;e++){const t=u[e];i=i.replace(t,"object"==typeof n?n[t.replace(/{{|}}/gm,"").trim()]||"":n)}t.innerHTML+=i}}u&&(o.bindings=u)}_setCellContent(e,t){const n=this;t=new Date(t||n.dateCurrent),n.cellTemplate?n._applyTemplate("cellTemplate",e,t):"month"===n.viewType?1!==t.getDate()||e.hasAttribute("today")?e.innerHTML=`<div>${new Intl.DateTimeFormat(n.locale,{day:n.dayFormat}).format(t)}</div>`:e.innerHTML=`<div>${new Intl.DateTimeFormat(n.locale,{month:"short",day:n.dayFormat}).format(t)}</div>`:e.innerHTML=""}_setCurrentTimeIndicators(){const e=this;clearInterval(e._currentTimeIndicatorInterval),delete e._currentTimeIndicatorInterval,e._refreshIndicators(),(e.currentTimeIndicator||e.shadeUntilCurrentTime)&&(e._currentTimeIndicatorInterval=setInterval(e._refreshIndicators.bind(e),1e3*e.currentTimeIndicatorInterval))}_refreshIndicators(){const e=this,t=e.viewType,n=new Date,i=e.$.timelineCellsContainer,r=60/e._getCellsScaleCount(),a=t.toLowerCase().indexOf("month")>-1,l=i.querySelectorAll(".smart-scheduler-cell:not(.scale)");let o,s=[];for(let e=0;e<l.length;e++){const t=l[e],i=new Date(t.$.cellObj.time);if(t.$&&n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()){if(!a&&i.getHours()!==n.getHours()||i.getMinutes()+r<n.getMinutes()||i.getMinutes()>n.getMinutes())continue;s.push(t)}}if(s.length){const e=s[0].$.cellObj,t=new Date(e.time),i=e.scaleIndex||0;let l,d;a?(d=60*n.getHours()+n.getMinutes(),l=1440):(d=n.getMinutes(),l=t.getMinutes()+r),o={cells:s,minutes:d,max:l,scaleIndex:i}}e._refreshCurrentTimeIndicator(o),e._refreshCurrentTimeShader(o)}_refreshCurrentTimeIndicatorHeader(){const e=this,t=e.currentTimeIndicator,n=e.timeZone,i=new Date,r=i.getFullYear(),a=i.getMonth(),l=i.getDate(),o=i.getHours(),s=e.viewType.toLowerCase(),d=e=>{let t=new Date(e);for(let e=0;e<6;e++){if(t.getFullYear()===r&&t.getMonth()===a&&t.getDate()===l)return!0;t.setDate(t.getDate()+7)}},c=s.indexOf("agenda")>-1,u=s.indexOf("timeline")>-1,h=s.indexOf("month")>-1;function m(e,i){let s;const m=!c&&!h&&(i&&!u||!i&&u);for(let t=0;t<e.length;t++){const i=e[t];if(i.timeZone===n){s=i.children;break}}if(s)for(let e=0;e<s.length;e++){const n=s[e];if(!n.$||!n.$.cellObj)return;const i=n.$.cellObj.date;if(t){if(h&&!u){d(i)?n.setAttribute("current",""):n.removeAttribute("current");continue}if(i.getDate()===l&&(!m||i.getFullYear()===r&&i.getMonth()===a&&i.getHours()===o)){n.setAttribute("current","");continue}}n.removeAttribute("current")}}m(e.$.timelineHeaderHorizontalContent.querySelectorAll(".smart-scheduler-cells")),m(e.$.timelineHeaderVerticalContent.querySelectorAll(".smart-scheduler-cells"),!0)}_refreshCurrentTimeIndicator(e){const t=this,n=t.viewType,i=t.$.timelineIndicatorsContainer;let r=i.querySelector(".smart-scheduler-current-time");if(t._refreshCurrentTimeIndicatorHeader(),!t.currentTimeIndicator||"agenda"===n||!e)return r&&r.remove(),void(i.firstElementChild||(clearInterval(t._currentTimeIndicatorInterval),delete t._currentTimeIndicatorInterval));const[a,l,o,s]=[e.cells,e.minutes,e.max,e.scaleIndex],d=a.length,c=t._getCellsScaleCount();r||(r=document.createElement("div"),r.classList.add("smart-scheduler-current-time"),r.setAttribute("role","presentation"));const u=r.children;t._recycleContainerCells({fragment:r,cellsNeeded:d,className:"smart-scheduler-current-time-indicator"});for(let e=0;e<u.length;e++){const t=a[e],i=u[e],r=t.closest(".smart-scheduler-cell-container");let d;n.toLowerCase().indexOf("timeline")>-1?(d=parseFloat(r.style.width)/c*(s+1),i.style.width=t.style.width,i.style.height=t.style.height,i.style.left=parseFloat(r.style.left)+d*(l/o)+"px",i.style.top=t.style.top):(d=parseFloat(r.style.height)/c*(s+1),i.style.width=t.style.width,i.style.height=t.style.height,i.style.left=t.style.left,i.style.top=parseFloat(r.style.top)+d*(l/o)+"px"),i.setAttribute("aria-label","Current Time Indicator")}r.parentElement||i.appendChild(r)}_refreshCurrentTimeShader(e){const t=this,n=t.$.timelineIndicatorsContainer;let i=n.querySelector(".smart-scheduler-shader");if(!t.shadeUntilCurrentTime||"agenda"===t.viewType)return i&&i.remove(),void(t.currentTimeIndicator||(clearInterval(t._currentTimeIndicatorInterval),delete t._currentTimeIndicatorInterval));i||(i=document.createElement("div"),i.classList.add("smart-scheduler-shader"));const r=i.children;if(e)t._shadeUntilToday(i,e);else{const e=t._getCellShadeRangesByDate(),a=e.length;if(t._recycleContainerCells({fragment:i,cellsNeeded:a,className:"smart-scheduler-shade"}),!a&&(i.remove(),!n.firstElementChild))return clearInterval(t._currentTimeIndicatorInterval),void delete t._currentTimeIndicatorInterval;for(let n=0;n<a;n++){const i=e[n],a=i.hFrom,l=i.hTo,o=t._getFirstShadeCell(i.vFrom.$.cellObj,!0),s=t._getFirstShadeCell(i.vTo.$.cellObj,!0,!0),d=r[n];t._recycleContainerCells({fragment:d,cellsNeeded:1,className:"smart-scheduler-shade-section"});const c=d.children[0];c.style.width=parseFloat(l.style.left)+parseFloat(l.style.width)-parseFloat(a.style.left)+"px",c.style.height=parseFloat(s.style.top)+parseFloat(s.style.height)-parseFloat(o.style.top)+"px",c.style.left=a.style.left,c.style.top=o.style.top}}i.parentElement||n.insertBefore(i,n.firstElementChild)}_shadeUntilToday(e,t){const n=this;if(!t)return void(e.innerHTML="");const i=e.children,r=n.viewType,a=r.indexOf("month")>-1,l=n._getCellsScaleCount(),[o,s,d,c]=[t.cells,t.minutes,t.max,t.scaleIndex],u=o?o.length:1;n._recycleContainerCells({fragment:e,cellsNeeded:u,className:"smart-scheduler-shade"});for(let e=0;e<u;e++){const t=o[e],u=i[e],h=t.closest(".smart-scheduler-cell-container"),m=t.$.cellObj.horizontal,v=t.$.cellObj.vertical;let g;if(r.toLowerCase().indexOf("timeline")>-1){n._recycleContainerCells({fragment:u,cellsNeeded:1,className:"smart-scheduler-shade-section"});const e=u.children[0],i=n._getFirstShadeCell(m);g=parseFloat(h.style.width)/l*(c+1),e.style.width=parseFloat(h.style.left)-parseFloat(i.style.left)+g*(s/d)+"px",e.style.height=t.style.height,e.style.left=i.style.left,e.style.top=t.style.top}else{n._recycleContainerCells({fragment:u,cellsNeeded:a?3:2,className:"smart-scheduler-shade-section"});const e=u.children[0],i=u.children[1],r=n._getFirstShadeCell(m),o=n._getFirstShadeCell(v,!0),f=n._getFirstShadeCell(v,!0,!0);if(g=parseFloat(h.style.height)/l*(c+1),e.style.top=o.style.top,e.style.left=r.style.left,a){e.style.width=parseFloat(t.style.left)-parseFloat(r.style.left)+"px",e.style.height=parseFloat(h.style.top)-parseFloat(o.style.top)+parseFloat(h.style.height)+"px";const a=n._getFirstShadeCell(m,void 0,!0),l=u.children[2];i.style.width=parseFloat(a.style.left)+parseFloat(a.style.width)-parseFloat(r.style.left)-parseFloat(e.style.width)+"px",i.style.height=parseFloat(h.style.top)-parseFloat(o.style.top)+"px",i.style.top=o.style.top,i.style.left=parseFloat(r.style.left)+parseFloat(e.style.width)+"px",l.style.top=parseFloat(i.style.top)+parseFloat(i.style.height)+"px",l.style.left=i.style.left,l.style.width=t.style.width,l.style.height=g*(s/d)+"px"}else e.style.width=parseFloat(t.style.left)+parseFloat(t.style.width)-parseFloat(r.style.left)+"px",e.style.height=parseFloat(h.style.top)-parseFloat(o.style.top)+g*(s/d)+"px",i.style.top=parseFloat(e.style.top)+parseFloat(e.style.height)+"px",i.style.left=r.style.left,i.style.width=parseFloat(t.style.left)-parseFloat(r.style.left)+"px",i.style.height=parseFloat(f.style.top)+parseFloat(f.style.height)-parseFloat(i.style.top)+"px"}}}_getFirstShadeCell(e,t,n){const i=(t?this.$.timelineHeaderVerticalContent:this.$.timelineHeaderHorizontalContent).querySelectorAll(".smart-scheduler-view-time .smart-scheduler-cell"),r=e.group;if(!r)return n?i[i.length-1]:i[0];let a;for(let e=0;e<i.length;e++){const t=i[e],l=t.$.cellObj.group;if(l&&Object.keys(l).every((e=>l[e]===r[e]))&&(a=t,!n))return a}return a}_getCellShadeRangesByDate(){const e=this,t=e.viewType.indexOf("timeline")>-1,n=new Date,i=n.getFullYear(),r=n.getMonth(),a=n.getDate(),l=n.getHours(),o=e.$.timelineHeaderHorizontalContent.querySelectorAll(".smart-scheduler-view-time .smart-scheduler-cell"),s=e.$.timelineHeaderVerticalContent.querySelectorAll(".smart-scheduler-cell"),d=e=>{let t,i;for(let r=0;r<s.length;r++){if(i=s[r],!i.$)continue;const a=new Date(i.$.cellObj.date);a.setDate(e.getDate());const l=a.getTime()||0;if(!t&&l<=n.getTime()&&(t=i),t&&l>n.getTime())break}return t&&i?{from:t,to:i}:void 0},c=e=>e.getFullYear()===i&&e.getMonth()===r&&e.getDate()===a;let u,h,m,v=[];for(let e=0;e<o.length;e++){const i=o[e],r=i.$.cellObj.date;!u&&r.getTime()<=n.getTime()&&(u=i),!c(r)||t&&r.getHours()!==l||(m=d(r),h=m?i:h,h&&(m=d(h.$.cellObj.date),m&&v.push({hFrom:u,hTo:h,vFrom:m.from,vTo:m.to})),u=void 0),h=i}return u&&!v.length&&(h=o[o.length-1],(h.$?h.$.cellObj.date.getTime():0)>n.getTime()&&(h=u),m=h.$?d(h.$.cellObj.date):void 0,m&&v.push({hFrom:u,hTo:h,vFrom:m.from,vTo:m.to})),v}_refreshTimelineHeaderCells(e){const t=this;e||(e="horizontal",t._refreshTimelineHeaderCells("vertical")),"horizontal"===e&&t.$.timelineViewAllDay.offsetHeight&&(t.$.timelineViewAllDaylabel.innerHTML=`<div>${t.localize("allDay")}</div>`);const[n,i,r,a]="horizontal"===e?["scrollLeft","left","width",t.$.timelineHeaderHorizontalContent]:["scrollTop","top","height",t.$.timelineHeaderVerticalContent],l=t.$.timelineTimeZoneLabelContainer,o=t.timeZones,s=t.rightToLeft,d=a.querySelector(".smart-scheduler-view-time"),c=t.viewType,u=c.indexOf("timeline")>-1,h=d.children,m=t[n],v=t._timelineCells[e];let g,f;for(let e=0;e<v.length;e++){const t=v[e];if(m<=t[i]+t[r]){g=e;break}}(l.parentElement&&!u&&"agenda"!==c&&"vertical"===e||u&&"horizontal"===e)&&(f=l.children);for(let n=0;n<h.length;n++){const a=h[n],l=a.children;let d=g;if(f){const e=o.find((e=>e.id===a.timeZone));f[n]&&(f[n].innerHTML=e?`<div>${e.label}</div>`:"")}for(let n=0;n<l.length;n++){const o=l[n],c=v[d];if(!c)break;d++,o.$={cellObj:c},o.innerHTML=`<div>${c.noLabel?"":t._getDateString({date:new Date(c.date),timeZone:a.timeZone},e)}</div>`,o.style[r]=c[r]+"px","horizontal"===e?s?(o.style.left="",o.style.right=c[i]+"px"):(o.style.right="",o.style.left=c[i]+"px"):o.style[i]=c[i]+"px",c.weekend?o.setAttribute("weekend",""):o.removeAttribute("weekend"),c.nonworking?o.setAttribute("nonworking",""):o.removeAttribute("nonworking"),c.separator?o.setAttribute("separator",""):o.removeAttribute("separator"),c.groupSeparator?o.setAttribute("group-separator",""):o.removeAttribute("group-separator"),c.showLabel?o.setAttribute("show-label",c.showLabel):o.removeAttribute("show-label"),c.restricted?o.setAttribute("restricted",""):o.removeAttribute("restricted")}}t._refreshHeaderDetailCells(e),t._refreshHeaderGroupCells(e),a[n]="scrollLeft"===n?t._getScrollLeft(t[n]):t[n]}_refreshHeaderGroupCells(e){const t=this,n=t._timelineCells.groups,i=t.$.groupsContainer,r=t.groupByDate;let a,l,o,s,d;if(!i)return;if(d=i.querySelector(".smart-scheduler-view-header-groups-container"),s="horizontal"===e?t.$.timelineHeaderHorizontal:t.$.timelineHeaderVertical,!n||!d||!s.contains(d))return;[a,l,o]="vertical"===e?["top","height","scrollTop"]:["left","width","scrollLeft"];let c=d.children,u=document.createDocumentFragment();for(;c.length;)u.appendChild(d.firstElementChild);c=u.children;for(let i=0;i<c.length;i++){const o=c[i],s=n[i];t._refreshAdditionalHeaderCells({orientation:e,fragment:o,type:"groups",offset:a,size:l,cellsObj:s[r?"cellsByDate":"cells"],resource:s.resource})}d.appendChild(u),t.$.groupsContainer.querySelector(".smart-scheduler-view-groups-content")[o]="scrollLeft"===o?t._getScrollLeft(t[o]):t[o]}_refreshHeaderDetailCells(e,t){const n=this,i=n._timelineCells.details;let r,a,l,o;if(!i||"horizontal"!==e||"timelineWeek"!==n.viewType)return;if(l=n.$.timelineHeaderHorizontalContent,o=l.querySelector(".smart-scheduler-view-details"),!o)return;[r,a]=["left","width"];let s=o.children,d=document.createDocumentFragment();for(;s.length;)d.appendChild(o.firstElementChild);n._refreshAdditionalHeaderCells({orientation:e,fragment:d,type:"details",offset:r,size:a,cellsObj:i,refreshContentOnly:t}),o.appendChild(d)}_refreshAdditionalHeaderCells(e){const t=this,n="agenda"===t.viewType,i=e.orientation,r=e.fragment,[a,l,o,s,d]=[e.type,e.offset,e.size,e.cellsObj,e.resource],c=t._getFirstCellObjInView({orientation:i,type:a,resource:d});if(!c)return;t._recycleContainerCells({fragment:r,cellsNeeded:t._getTimelineVisibleCellsCount({orientation:i,type:a,resource:d})});const u=Array.from(r.children),h=s.indexOf(c),m=t.rightToLeft,v="top"===l?l:"left";for(let e=0;e<u.length;e++){const r=u[e],d=s[h+e];if(r.$={cellObj:d},"groups"===a){if(!d[o]&&n){r.remove();continue}t._setGroupContent(r)}else{const e=d.date;r.innerHTML=`<div>${d.noLabel?"":t._getDateString({date:new Date(e)},i,!0)}</div>`}if(d.groupSeparator?r.setAttribute("group-separator",""):r.removeAttribute("group-separator"),d.separator?r.setAttribute("separator",""):r.removeAttribute("separator"),d.group){const e=d.group;for(const t in e)r.setAttribute(t,e[t]||"")}r.style.top=r.style.left=r.style.width=r.style.height=null,r.style[o]=d[o]+"px","left"===v?m?(r.style.left="",r.style.right=d[l]+"px"):(r.style.right="",r.style.left=d[l]+"px"):(r.style.left="",r.style.right="",r.style[v]=d[l]+"px")}}_createWindow(e){const t=this,n=e?e+"SchedulerWindow":"schedulerWindow";if(t.$[n])return t.$[n];const i=document.createElement("smart-window");return i.classList.add("smart-scheduler-window"),e?(i.classList.add(e),i.id=t.id+"ConfirmWindow"):i.id=t.id+"Window",i.setAttribute("smart-id",n),t.$[n]=i,t["$"+n]=Smart.Utilities.Extend(i),i.rightToLeft=t.rightToLeft,i.theme=t.theme,i.animation=t.animation,i.disableSnap=!0,i.headerButtons=["close"],i}_openWindow(e,t,n){const i=this;if(!e&&!(e=i._createEventFromSelection()))return;if([i.$.schedulerWindow,i.$.confirmSchedulerWindow].some((e=>e&&e.opened))||i.disableWindowEditor)return;const r=t?"confirm":"";function a(){function t(){i._positionWindow(),l.opened?(l.bringToFront(),l._handleActiveState(),l._onOpenCallback&&l._onOpenCallback()):l.open()}if(i.windowCustomizationFunction?i.windowCustomizationFunction(l,r,i._cloneObject(e)):(i._setPopupWindowTemplate("header",r,n),i._setPopupWindowTemplate("footer",r,n),i._setPopupWindowTemplate("content",r,n)),!l.opened){const e=i["$"+(r?r+"SchedulerWindow":"schedulerWindow")];e.unlisten("transitionend"),e.unlisten("open"),e.unlisten("close"),e.unlisten("closing"),e.unlisten("click"),e.unlisten("change"),e.unlisten("keydown"),r||(l._onOpenCallback=()=>{((l.shadowRoot||l).querySelector(".smart-input")||l).focus({preventScroll:!0})}),l.hasAnimation&&e.listen("transitionend",i._windowTransitionendHandler.bind(i)),e.listen("open",i._windowOpenHandler.bind(i)),e.listen("close",i._windowCloseHandler.bind(i)),e.listen("closing",i._windowClosingHandler.bind(i)),e.listen("click",i._windowClickHandler.bind(i)),e.listen("change",i._windowChangeHandler.bind(i)),e.listen("keydown",i._windowKeyDownHandler.bind(i))}l.shadowRoot?(l.importStyle(Smart.Utilities.Core.getScriptLocation()+Smart.StyleBaseUrl.replace("/scoped/","/smart.textbox.css")),i._onShadowDomLoaded(l,"smart.window.css",t)):t();const a=(i.getAttribute("aria-owns")||"")+" "+l.id;i.setAttribute("aria-owns",a.trim())}if(!e)return;const l=i._createWindow(r);i.$.fireEvent("editDialogOpening",{target:l,type:r,item:i._cloneObject(e)}).defaultPrevented||(l._target={event:e,originalTarget:t,windowType:n},l.parentElement||i.getShadowRootOrBody().appendChild(l),l.isCompleted?a():l.whenReady((()=>a())))}_positionWindow(){const e=this,t=e.getShadowRootOrBody(),n=[e.$.schedulerWindow,e.$.confirmSchedulerWindow];for(let i=0;i<n.length;i++){const r=n[i];if(!r||!t.contains(r))continue;const a=e.getBoundingClientRect();if(r.opened||(r.style.left=r.style.top=""),r.querySelector(".smart-scheduler-window-repeat")){const e=r.offsetWidth;!r.hasAttribute("horizontal")&&2*e<=a.width?r.setAttribute("horizontal",""):r.hasAttribute("horizontal")&&e>a.width&&r.removeAttribute("horizontal")}else r.removeAttribute("horizontal");e._isMobile?(r.setAttribute("mobile",""),r.style.left=a.left+window.pageXOffset+"px",r.style.top=a.top+window.pageYOffset+"px",r.style.width=a.width+"px",r.style.height=a.height+"px"):(r.style.left=Math.max(a.left+window.pageXOffset,a.left+window.pageXOffset+a.width/2-r.offsetWidth/2)+"px",r.style.top=Math.max(a.top+window.pageYOffset,a.top+window.pageYOffset+a.height/2-r.offsetHeight/2)+"px")}}_windowTransitionendHandler(e){const t=this,n=e.target;if(!n.classList.contains("smart-scheduler-window"))return;let i,r;n.classList.contains("confirm")?(i=t.$.confirmSchedulerWindow,r=t.$confirmSchedulerWindow):(i=t.$.schedulerWindow,r=t.$schedulerWindow),i.opened||"visibility"!==e.propertyName||(r.unlisten("transitionend"),i.remove())}_windowOpenHandler(e){const t=this,n=e.target;if(!n.classList.contains("smart-scheduler-window"))return;const i=n.classList.contains("confirm")?t.$confirmSchedulerWindow:t.$schedulerWindow,r=n._target.event;i&&(t._handleModal(!0),n===t.$.schedulerWindow?t.$.fireEvent("editDialogOpen",{target:e.target,editors:t._windowEditors,item:t._cloneObject(r)}):t.$.fireEvent("editDialogOpen",{target:e.target,item:t._cloneObject(r)}),i.unlisten("open"))}_windowClosingHandler(e){const t=this,n=e.target;if(!n.classList.contains("smart-scheduler-window"))return;const i=n.classList.contains("confirm")?t.$confirmSchedulerWindow:t.$schedulerWindow;if(i){const r={target:e.target,item:t._cloneObject(e.target._target.event)};if(n===t.$.schedulerWindow&&(r.editors=t._windowEditors),t.$.fireEvent("editDialogClosing",r).defaultPrevented)return void e.preventDefault();if(i.unlisten(e.type),t.hasAttribute("aria-owns")){const e=t.getAttribute("aria-owns").replace(i.id,"").trim();e?t.setAttribute("aria-owns",e):t.removeAttribute("aria-owns")}}}_windowCloseHandler(e){const t=this,n=e.target;if(!n.classList.contains("smart-scheduler-window"))return;const i=n.classList.contains("confirm")?t.$confirmSchedulerWindow:t.$schedulerWindow;if(i){const r=e.target._target.event;t._handleModal(),n===t.$.schedulerWindow?t.$.fireEvent("editDialogClose",{target:e.target,editors:t._windowEditors,item:t._cloneObject(r)}):t.$.fireEvent("editDialogClose",{target:e.target,item:t._cloneObject(r)}),i.unlisten("close"),i.unlisten("click"),i.unlisten("keydown"),t.hasAttribute("aria-owns")&&t.removeAttribute("aria-owns"),t.hasAnimation||i.remove();const a=t._getEventCell(n._target.originalTarget||r);(a||t.$.timeline).focus({preventScroll:!0})}}_getEventCell(e){if(e instanceof HTMLElement&&(e=e.$.event),!e)return;const t=this.$.timelineEventsContainer.children;for(let n=0;n<t.length;n++){const i=t[n],r=i.$?i.$.event:void 0;if(!r)continue;const a=r.$?r.$.event:void 0;if(r===e||a&&(a===e||e.$&&a===e.$.event))return i}}_windowChangeHandler(e){const t=this,n=e.target,i=n.closest(".smart-scheduler-window.confirm")?t.$.confirmSchedulerWindow:t.$.schedulerWindow;if(e.stopPropagation(),i!==t.$.schedulerWindow)return;const r=n.closest(".smart-scheduler-window-editor"),a=r?r.getAttribute("type"):void 0;if(a)if(a.indexOf("repeatEnd")>-1){const e=n.closest(".smart-scheduler-window-editor[multiple]");if(e){const t=e.children;for(let e=0;e<t.length;e++){const i=t[e],r=i.querySelector("[event-editor]");r&&(r.disabled=!i.contains(n))}}}else if(t._windowEditors&&n.hasAttribute("event-editor"))if("allDay"!==a)if("repeat"!==a){if("repeatFreq"===a)return t._setPopupWindowEditor(t._windowEditors.repeatOn),void t._setPopupWindowEditor(t._windowEditors.repeatInterval);"dateStart"!==a&&"dateEnd"!==a?"resources"!==a||t._setResourceDataEditor(t._windowEditors.resourceData):t._handleEditorDateValidation(n)}else i._target.event&&(t._createWindowEditor("repeat"),t._positionWindow());else t._handleEditorAllDay(n,i)}_windowKeyDownHandler(e){const t=this,n=e.target.closest(".smart-scheduler-window.confirm")?t.$.confirmSchedulerWindow:t.$.schedulerWindow;if(e.stopPropagation(),n!==t.$.schedulerWindow||"Enter"!==e.key)return;const i=n.getRootNode().activeElement,r=t._windowEditors,a=n._target.event;a&&r&&r.label&&r.label.contains(i)&&(t._updateEventViaWindow(a,r),n.close(),delete n._target)}_handleEditorDateValidation(e){const t=this,n=t._windowEditors.dateStart,i=t._windowEditors.dateEnd,r=t._windowEditors.allDay?t._windowEditors.allDay.querySelector("[event-editor]"):void 0;if(!n||!i)return;const a=n.querySelector("[event-editor]"),l=i.querySelector("[event-editor]"),o={dateStart:a.value.toDate(),dateEnd:l.value.toDate(),allDay:!!r&&r.checked};e===a?(o.type="end",l.value=t._getValidDate(o)):e===l&&(o.type="start",a.value=t._getValidDate(o))}_handleEditorAllDay(e){const t=this,n=t._windowEditors.dateStart,i=t._windowEditors.dateEnd;if(!n||!i)return;const r=n.querySelector("[event-editor]"),a=i.querySelector("[event-editor]"),l=e.checked;let o=r.value.toDate(),s=a.value.toDate();if(l){const e={dateStart:o,dateEnd:s,allDay:l,type:"start"};r.formatString="yyyy-MMM-dd",a.formatString="yyyy-MMM-dd",o.setHours(t.hourStart,0,0,0),s.setHours(t.hourEnd,0,0,0),r.value=t._getValidDate(e),e.type="end",a.value=t._getValidDate(e)}else{const e=t.hourStart,n=t.$.schedulerWindow;n&&n._target?(o=n._target.event.dateStart,s=n._target.event.dateEnd):(s=new Date(o),o.setHours(e,0,0,0),s.setHours(e,60/t._getCellsScaleCount(),0,0)),r.value=o,a.value=s,r.formatString="yyyy-MMM-dd HH:mm",a.formatString="yyyy-MMM-dd HH:mm"}}_windowClickHandler(e){const t=this;let n=(e.originalEvent||e).target;n.shadowRoot&&(n=(e.originalEvent||e).composedPath()[0]);const i=n.closest(".smart-scheduler-window.confirm")?t.$.confirmSchedulerWindow:t.$.schedulerWindow,r=n.closest(".smart-scheduler-window-button"),a=t._windowEditors,l=i._target.event,o=i._target.windowType;if(i&&r)if(r.classList.contains("ok")&&a?t._updateEventViaWindow(l,a):r.classList.contains("delete")&&t._deleteEventViaWindow(l),i.close(),delete i._target,r.classList.contains("edit-event")){if(l.date||(l.date=new Date(l.dateStart)),delete l.repeat,"deleteConfirm"===o)return l.hidden=!0,void t._updateEventViaWindow(l);t._openWindow(l)}else if(r.classList.contains("edit-series")&&l.$){if("deleteConfirm"===o)return delete l.$.event.repeat,void t._updateEventViaWindow(l);t._openWindow(l.$.event)}}_deleteEventViaWindow(e){const t=this,n=t._events.indexOf(e),i=e.$?e.$.event:void 0;if(i){const n=i.repeat?i.repeat.exceptions:void 0,r=n?n.indexOf(e):void 0;r>-1&&(n.splice(r,1),t._refreshTimelineEvents())}else if(n>-1){const i=t._cloneObject(e);if(t.$.fireEvent("itemChanging",{type:"removing",item:i}).defaultPrevented)return;t._events.splice(n,1),t._refreshTimelineEvents(),t._updateUndoRedo(t._cloneObject(e),void 0,"itemRemove"),t.$.fireEvent("itemRemove",{item:i}),t.$.fireEvent("itemChange",{type:"remove",item:i})}}_updateEventViaWindow(e,t){const n=this,i=n._events.indexOf(e),r=e.$?e.$.event:void 0,a=i<0;if(!a&&n.$.fireEvent("itemChanging",{type:"updating",item:n._cloneObject(e)}).defaultPrevented)return;if(a&&!r&&n.$.fireEvent("itemChanging",{type:"inserting",item:n._cloneObject(e)}).defaultPrevented)return;let l,o="Update";if(t&&n._updateEventSettings(e,t),a)if(r){if(r.repeat){const t=r.repeat;t.exceptions||(t.exceptions=[]);const i=t.exceptions;delete t.repeat,i.indexOf(e)<0&&t.exceptions.push(e),l=n._cloneObject(r)}}else o="Insert",l=n._cloneObject(e),n._events.push(e),n._updateUndoRedo(void 0,l,"itemInsert");else l=n._cloneObject(e);n.$.fireEvent("item"+o,{item:l}),n.$.fireEvent("itemChange",{type:o.toLowerCase(),item:l}),n._validateEventDateRange(e),n._refreshTimelineEvents()}_updateEventSettings(e,t){const n=this,i=Object.keys(t);for(let r=0;r<i.length;r++){const a=i[r],l=t[a].querySelectorAll("[event-editor]"),o=l[0];if(o)switch(a){case"allDay":e[a]=o.checked,o.checked&&(e.dateStart.setHours(0,0,0,0),e.dateEnd.setHours(23,59,59,999),e.dateEnd=n._getValidDate({dateStart:e.dateStart,dateEnd:e.dateEnd,allDay:!0,type:"end"}));break;case"dateEnd":case"dateStart":{const t=o.value.toDate();let i,r;"dateStart"===a?(i=t,r=e.dateEnd):(i=e.dateStart,r=t),r=n._getValidDate({dateStart:i,dateEnd:r,type:"end"}),n._isEventRestricted({dateStart:i,dateEnd:r})||(e.dateStart=i,e.dateEnd=r);break}case"conference":e[a]=o.value;break;case"description":case"label":e[a]=o.value;break;case"exceptions":e.repeat&&o.checked&&delete e.repeat.exceptions;break;case"notifications":o.value.length?e.notifications=o.value.slice(0):delete e.notifications;break;case"hidden":e.$&&e.$.event&&(e[a]=o.checked);break;case"backgroundColor":e[a]=o.value,e[a]||delete e[a];break;case"resources":n._updateEventResources(e,t,o);break;case"resoruceData":break;case"status":{const t=n.statuses[o.selectedIndex];t&&t.value?e[a]=t.value:delete e[a];break}default:n._updateEventRepeating(e,t,a,l)}}}_updateEventResources(e,t,n){const i=this.resources;if(!n.value)return void i.forEach((t=>delete e[t.value]));const r=t.resourceData.querySelectorAll(".smart-scheduler-window-editor[resource-type]");let a,l=[];for(let t=0;t<r.length;t++){const n=r[t],o=n.querySelector("[event-editor]"),s=n.getAttribute("resource-type");if(!o||o.value&&o.selectedIndex<0){l.push(s);continue}const d=i.find((e=>e.value===s));if(d){const t=d.dataSource[o.selectedIndex];a=!0,t?(e[s]=t.id,l.push(s)):delete e[s]}}a&&i.forEach((t=>{l.indexOf(t.value)<0&&delete e[t.value]}))}_updateEventRepeating(e,t,n,i){const r=i[0];if("repeat"===n)r.checked?e.repeat=e.repeat||{}:delete e.repeat;else{if(n.toLowerCase().indexOf("repeat")<0||!e.repeat)return;"object"!=typeof e.repeat&&(e.repeat={});const a=e.repeat;switch(n){case"repeatEnd":case"repeatEndAfter":case"repeatEndOn":{const e=t[n].querySelector(".smart-radio-button");if(e&&e.checked){const e=r.value;a.repeatEnd="repeatEndOn"===n?e.toDate():parseInt(e)}break}case"repeatFreq":a[n]=r.value.toLowerCase();break;case"repeatInterval":a[n]=parseInt(r.value);break;case"repeatOn":switch(a.repeatFreq){case"weekly":a[n]=r.selectedValues;break;case"monthly":a[n]=r.value;break;case"yearly":{const e=i[1]?parseInt(i[1].value):0;a[n]={month:r.selectedIndex,date:e};break}}}}}_updateUndoRedo(e,t,n){const i=this;if(!t&&!e)return void delete i._undoRedoHistory;let r=i._undoRedoHistory;if(r||(r=i._undoRedoHistory={currentStep:1,steps:[]}),n){const a=r.currentStep;a!==r.steps.length&&(r.steps=a<1?[]:r.steps.slice(0,a)),r.steps.length===i.undoRedoSteps&&r.steps.shift(),r.steps.push({oldValue:e,newValue:t,action:n,timeStamp:Date.now()})}r.currentStep=Math.max(1,r.steps.length)}_isUndoPossible(){const e=this._undoRedoHistory;if(e)return e.steps.length&&e.currentStep>0}_isRedoPossible(){const e=this._undoRedoHistory;if(!e)return;const t=e.steps;return t.length&&e.currentStep<t.length}_handleUndoRedo(e="undo",t){const n=this,i=n._undoRedoHistory;if(!i)return;const r=i.steps,a="undo"===e?0:1,l=r[(isNaN(t)?i.currentStep+a:t)-1];if(l){const t=n._events;let o,s,d;switch("undo"===e?l.newValue&&!l.oldValue?(s="delete",o=l.newValue):!l.newValue&&l.oldValue?(s="insert",o=l.oldValue):l.newValue&&l.oldValue&&(s="update",o=l.oldValue):l.newValue&&!l.oldValue?(s="insert",o=l.newValue):!l.newValue&&l.oldValue?(s="delete",o=l.oldValue):l.newValue&&l.oldValue&&(s="update",o=l.newValue),s){case"insert":d=o,t.push(d);break;case"delete":d=n._containsEvent(o),d&&t.splice(t.indexOf(d),1);break;case"update":if(d=n._containsEvent(l.newValue),d){for(let e in d)delete d[e];const e=n._cloneObject(o);for(let t in e)d[t]=e[t]}}if(d)return i.currentStep=Math.max(0,r.indexOf(l)+a),n.$.tooltip.close(),n.closeWindow(),n._refreshTimelineEvents(),n.$.fireEvent(l.action,{operation:e,eventObj:n._cloneObject(d),itemDateRange:{dateStart:new Date(o.dateStart),dateEnd:new Date(o.dateEnd)}}),n.unfocusable||n.$.timeline.focus({preventScroll:!0}),!0}}_getValidDate(e){const[t,n,i,r]=[e.dateStart,e.dateEnd,e.type,e.allDay];let a=new Date(t),l=new Date(n);if(isNaN(a)||isNaN(l)||n.getTime()>t.getTime())return"start"===i?a:l;for("start"===i?a=new Date(l):l=new Date(a);a.getTime()>l.getTime();){const e=a.getTime();"start"===i?(a.setHours(a.getHours()-1),a.getTime()===e&&a.setHours(a.getHours()-2)):(l.setHours(l.getHours()+1),l.getTime()===e&&l.setHours(l.getHours()+2))}return r&&a.getFullYear()===l.getFullYear()&&a.getMonth()===l.getMonth()&&a.getDate()===l.getDate()&&(l.setHours(0,0,0,0),l.setDate(l.getDate()+1)),"start"===i?a:l}_handleModal(e){const t=this;let n=(t.shadowRoot||t).querySelector(".smart-scheduler-window-modal");e?(n||(n=document.createElement("div"),n.classList.add("smart-scheduler-window-modal")),n.parentElement||(t.$.container.appendChild(n),t.setAttribute("modal",""))):n&&n.parentElement&&(n.parentElement.removeChild(n),t.removeAttribute("modal"))}_onShadowDomLoaded(e,t,n){requestAnimationFrame((function i(){const r=(e.shadowRoot||e.getRootNode()).querySelectorAll("link");for(let e=0;e<r.length;e++)if(-1!==r[e].href.indexOf(t))return void n();requestAnimationFrame(i)}))}_setPopupWindowTemplate(e,t,n){const i=this,r=i.$[t?t+"SchedulerWindow":"schedulerWindow"];if(!r)return;if("content"===e)return void i._setWindowContent(t,n);if(r[e+"Template"]||(r[e+"Template"]=i._createWindowTemplate(e,t)),t)return void i._setWindowTypeSection(e,t,n);const a=r._target.event,l=a.$&&a.$.event,o=i._events.indexOf(a)<0&&!l;let s;if(l&&l.repeat.exceptions&&(s=l.repeat.exceptions.indexOf(a)>-1),"header"===e){const e=(r.shadowRoot||r).querySelector(".smart-scheduler-window-label");a&&e&&(e.innerHTML=o?i.localize("newEvent"):l&&!s?i.localize("eventException"):a.label)}else if("footer"===e){const e=(r.shadowRoot||r).querySelectorAll(".smart-scheduler-window-button");for(let t=0;t<e.length;t++){const n=e[t];n.innerHTML='<span class="smart-icon"></span>',n.theme=i.theme,n.rightToLeft=i.rightToLeft,n.animation=i.animation,n.classList.contains("ok")?(n.innerHTML+=i.localize("ok"),n.setAttribute("aria-label","ok")):n.classList.contains("cancel")?(n.innerHTML+=i.localize("cancel"),n.setAttribute("aria-label","cancel")):n.classList.contains("delete")&&(n.innerHTML+=i.localize("delete"),n.setAttribute("aria-label","delete"),n.classList[o||l&&!s?"add":"remove"]("smart-hidden"));const r=n.querySelector(".smart-ripple");r&&r.parentElement.removeChild(r)}}}_setWindowTypeSection(e,t,n){const i=this,r=i.$[t?t+"SchedulerWindow":"schedulerWindow"];if(t&&r)if("confirm"!==t);else if("header"===e){const e=(r.shadowRoot||r).querySelector(".smart-scheduler-window-label");e&&(e.innerHTML=i.localize(n?n+"Label":"repeatConfirmLabel")||"")}else if("footer"===e){const e=(r.shadowRoot||r).querySelectorAll(".smart-scheduler-window-button");for(let t=0;t<e.length;t++){const r=e[t];r.theme=i.theme,r.rightToLeft=i.rightToLeft,r.animation=i.animation,r.classList.contains("edit-event")?(r.innerHTML=i.localize(n?n+"Event":"editEvent"),r.setAttribute("aria-label","edit-event")):r.classList.contains("edit-series")&&(r.innerHTML=i.localize(n?n+"Series":"editSeries"),r.setAttribute("aria-label","edit-series"));const a=r.querySelector(".smart-ripple");a&&a.parentElement.removeChild(a)}}}_setWindowContent(e,t){const n=this,i=n.$[e?e+"SchedulerWindow":"schedulerWindow"];if(e){let r=i.querySelector(".smart-scheduler-confirm-label");if(!i.content||i.content.innerHTML&&!r)return;return r||(r=document.createElement("label"),r.classList.add("smart-scheduler-confirm-label"),i.appendChild(r)),void("confirm"===e&&r&&(r.innerHTML=n.localize(t||"repeatConfirm")||""))}const r=i._target.event,a=[].slice.call(i.getElementsByClassName("smart-scheduler-window-editor"));i.innerHTML&&!a.length||r&&(n._createWindowEditor(),n._createWindowEditor("repeat"),r.id&&i.setAttribute("aria-controls",r.id))}_createWindowEditor(e="main"){const t=this,n=t.$.schedulerWindow,i=n._target.event,r=t._windowEditors;let a=n.querySelector(".smart-scheduler-window-content-wrapper"),l=n.querySelector(`.smart-scheduler-window-${e}`),o=i.repeat,s=i.$&&i.$.event;if(r&&r.repeat){const e=r.repeat.querySelector("[event-editor]");e&&(o=e.checked)}if(a||(a=document.createElement("div"),a.classList.add("smart-scheduler-window-content-wrapper"),n.appendChild(a)),"repeat"===e&&(!o||s))return void(l&&l.remove());if(!l){if(r){const t="main"===e?r.label:r.repeatFreq;t&&(l=t.closest(`.smart-scheduler-window-${e}`))}l||(l=document.createElement("div"),l.classList.add(`smart-scheduler-window-${e}`),l.innerHTML=t._getWindowEditorTemplate(e))}a.contains(l)||a.appendChild(l);const d=l.querySelectorAll(".smart-scheduler-window-editor[type]");for(let e=0;e<d.length;e++)t._setPopupWindowEditor(d[e])}_getWindowEditorTemplate(e){return e&&"main"!==e?"repeat"===e?'\n <div class="smart-scheduler-window-editor" type="repeatFreq">\n <label></label>\n <smart-input readonly event-editor drop-down-button-position="right"></smart-input>\n </div>\n <div class="smart-scheduler-window-editor" type="repeatInterval">\n <label></label>\n <smart-number-input min="1" event-editor></smart-number-input>\n </div>\n <div class="smart-scheduler-window-editor" type="repeatOn" multiple>\n <label></label>\n </div>\n <div class="smart-scheduler-window-editor" multiple>\n <div class="smart-scheduler-window-editor" type="repeatEnd">\n <label></label>\n <smart-radio-button group-name="repeat"></smart-radio-button>\n </div>\n <div class="smart-scheduler-window-editor" type="repeatEndOn">\n <smart-radio-button group-name="repeat"></smart-radio-button>\n <smart-date-time-picker calendar-button drop-down-append-to="body" event-editor\n enable-mouse-wheel-action drop-down-display-mode="auto"></smart-date-time-picker>\n </div>\n <div class="smart-scheduler-window-editor" type="repeatEndAfter">\n <smart-radio-button group-name="repeat"></smart-radio-button>\n <smart-number-input min="1" event-editor></smart-number-input>\n <label></label>\n </div>\n </div>\n <div class="smart-scheduler-window-editor smart-hidden" type="exceptions">\n <label></label>\n <smart-check-box event-editor></smart-check-box>\n </div>':void 0:'\n <div class="smart-scheduler-window-editor" type="label">\n <label></label>\n <smart-input event-editor></smart-input>\n </div>\n <div class="smart-scheduler-window-editor" multiple>\n <div class="smart-scheduler-window-editor" type="dateStart">\n <label></label>\n <smart-date-time-picker calendar-button drop-down-append-to="body" event-editor\n enable-mouse-wheel-action drop-down-display-mode="auto"></smart-date-time-picker>\n </div>\n <div class="smart-scheduler-window-editor" type="dateEnd">\n <label></label>\n <smart-date-time-picker calendar-button drop-down-append-to="body" event-editor\n enable-mouse-wheel-action drop-down-display-mode="auto"></smart-date-time-picker>\n </div>\n </div>\n <div class="smart-scheduler-window-editor" type="description">\n <label></label>\n <smart-text-area event-editor></smart-text-area>\n </div>\n <div class="smart-scheduler-window-editor" multiple>\n <div class="smart-scheduler-window-editor" type="allDay">\n <label></label>\n <smart-switch-button event-editor></smart-switch-button>\n </div>\n <div class="smart-scheduler-window-editor" type="hidden">\n <label></label>\n <smart-switch-button event-editor></smart-switch-button>\n </div>\n <div class="smart-scheduler-window-editor" type="repeat">\n <label></label>\n <smart-switch-button event-editor></smart-switch-button>\n </div>\n </div>\n <div class="smart-scheduler-window-editor" type="conference">\n <label></label>\n <smart-input event-editor></smart-input>\n <div style="color: var(--smart-error);" class="smart-hidden smart-invalid-conference-link-label"></div>\n <div class="smart-hidden" class="smart-conference-link"></div>\n </div>\n <div class="smart-scheduler-window-editor" type="notifications">\n <label></label>\n <smart-notification-panel event-editor></smart-notification-panel>\n </div>\n <div class="smart-scheduler-window-editor" multiple>\n <div class="smart-scheduler-window-editor" type="backgroundColor">\n <label></label>\n <smart-color-input event-editor></smart-color-input>\n </div>\n <div class="smart-scheduler-window-editor" type="status">\n <label></label>\n <smart-input event-editor></smart-input>\n </div>\n </div>\n <div class="smart-scheduler-window-editor smart-hidden" type="resources">\n <label></label>\n <smart-check-input event-editor disabled></smart-check-input>\n </div>\n <div class="smart-scheduler-window-editor smart-hidden" multiple type="resourceData"></div>\n </div>'}_setPopupWindowEditor(e){const t=this,n=e.getAttribute("type"),i=e.querySelector("label"),r=t.$.schedulerWindow._target.event,a=r.$&&r.$.event;let l=e.querySelector("[event-editor]");if(!r)return;t._windowEditors||(t._windowEditors={});const o=t._windowEditors,s=t.rightToLeft;if(o[n]||(o[n]=e),i&&(i.id=t.id+n+"Label",i.innerHTML=t.localize(n)),"label"===n||"description"===n)l.value=void 0!==r[n]?r[n]+"":"";else if(n.indexOf("date")>-1){const e=!!r.allDay;l.formatString=e?"yyyy-MMM-dd":"yyyy-MMM-dd HH:mm",l.calendarButtonPosition=s?"left":"right",l.value=new Date(r[n])}else if("allDay"===n||"repeat"===n)l.checked=!!r[n],e.classList["repeat"===n&&a?"add":"remove"]("smart-hidden");else if("notifications"===n)t._setNotificationEditor(e,l);else if("conference"===n){const e=l.nextElementSibling;e.innerHTML=t.localize("invalidConferenceLink"),e.classList.add("smart-hidden");const a=l.nextElementSibling.nextElementSibling;a.innerHTML=`<smart-button class="info">${t.localize("join")}</smart-button>`,a.classList.add("smart-hidden"),i.innerHTML=`<div class="smart-notification-panel">\n <div class="smart-notification-placeholder" role="button" smart-id="placeholder" tabindex="0">${t.localize("placeholderLink")}</div>\n </div>`,i.onclick=()=>{l.classList.contains("smart-hidden")&&(l.classList.remove("smart-hidden"),i.innerHTML=`<div class="smart-notification-panel">\n <div role="button" smart-id="placeholder" tabindex="0">${t.localize("placeholderSetLink")}</div>\n </div>`,l.focus())},a.onclick=e=>{e.target&&e.target.classList.contains("smart-button")&&window.open(a.getAttribute("link"),"_blank")};const o=()=>{l.value.startsWith("https://zoom.us/")?a.innerHTML=`<smart-button class="info">${t.localize("joinWith",{value:"Zoom"})}</smart-button>`:l.value.startsWith("https://meet.google.com/")?a.innerHTML=`<smart-button class="info">${t.localize("joinWith",{value:"Google Meet"})}</smart-button>`:l.value.startsWith("https://teams.microsoft.com/")&&(a.innerHTML=`<smart-button class="info">${t.localize("joinWith",{value:"Microsoft Teams"})}</smart-button>`),a.setAttribute("link",l.value),a.classList.remove("smart-hidden")},s=()=>{/^(ftp|http|https):\/\/[^ "]+$/.test(l.value)?(e.classList.add("smart-hidden"),o()):(e.classList.remove("smart-hidden"),a.classList.add("smart-hidden"))};l.onchange=l.onkeyup=()=>{const n=/^(ftp|http|https):\/\/[^ "]+$/.test(l.value);t._typing&&clearTimeout(t._typing),t._typing=setTimeout((()=>{n?(e.classList.add("smart-hidden"),o()):(e.classList.remove("smart-hidden"),a.classList.add("smart-hidden"))}),300)},l.classList.add("smart-hidden"),r[n]?(l.value=r[n],l.classList.remove("smart-hidden"),i.innerHTML=`<div class="smart-notification-panel">\n <div role="button" smart-id="placeholder" tabindex="0">${t.localize("placeholderSetLink")}</div>\n </div>`,o(),s()):l.value=""}else if("repeatFreq"===n){const e=["hourly","daily","weekly","monthly","yearly"],n=r.repeat?(r.repeat.repeatFreq+"").toLowerCase():e[0];l.dataSource=[{label:t.localize(e[0]),value:e[0]},{label:t.localize(e[1]),value:e[1]},{label:t.localize(e[2]),value:e[2]},{label:t.localize(e[3]),value:e[3]},{label:t.localize(e[4]),value:e[4]}],l.value=t.localize(e.indexOf(n)>-1?n:e[0])}else if("repeatInterval"===n){const e=parseInt(r.repeat?r.repeat.repeatInterval:void 0);if(l.value=isNaN(e)?1:e,i&&o.repeatFreq){const e=o.repeatFreq.querySelector("[event-editor]");if(e){const n={hourly:"repeatEveryHour",daily:"repeatEveryDay",weekly:"repeatEveryWeek",monthly:"repeatEveryMonth",yearly:"repeatEveryYear"},r=e.dataSource[Math.max(0,e.selectedIndex)].value||"";i.innerHTML+=` (${t.localize(n[r.toLowerCase()])||""})`}}}else if("repeatOn"===n)t._setRepeatOnEditor(e,l);else if(n.indexOf("repeatEnd")>-1){let i=r.repeat?r.repeat.repeatEnd:void 0,a=i;switch(n){case"repeatEnd":a=!a;break;case"repeatEndOn":a=a instanceof Date;break;case"repeatEndAfter":a="number"==typeof a&&!isNaN(a)}const o=e.querySelector(".smart-radio-button");o&&(o.innerHTML=t.localize(n+"Option"),o.checked=a,t._setEditorCommonProperties(o)),l&&(l instanceof Smart.DateTimePicker?(i=new Date(i),l.formatString="yyyy-MMM-dd",l.calendarButtonPosition=s?"left":"right",l.value=a&&!isNaN(i.getTime())?i:new Date):(i=parseInt(i),l.value=a&&!isNaN(i)?i:1),l.disabled=o&&!o.checked)}else if("exceptions"===n){const n=!a&&r.repeat&&r.repeat.exceptions&&r.repeat.exceptions.length;l.checked=!1,l.innerHTML=t.localize("resetExceptions"),e.classList[n?"remove":"add"]("smart-hidden")}else if("hidden"===n)l.checked=!!r[n],e.classList[a?"remove":"add"]("smart-hidden");else if("backgroundColor"===n){l.dataSource||(l.dataSource=r.colorScheme||t.colorScheme);const e=l.$.scrollView;e&&e.classList.add("smart-scheduler-color-input"),l.valueDisplayMode="colorBox",l.value=r.backgroundColor||""}else"status"===n?t._setStatusEditor(e,l):"resources"===n?t._setResourceEditor(e,l):"resourceData"===n&&t._setResourceDataEditor(e);l&&i&&l.setAttribute("aria-labelledby",i.id),t._setEditorCommonProperties(l)}_setEditorCommonProperties(e){const t=this;if(e){const n=e.messages,i=t.messages,r=t.locale;if(n)for(let e in n.en){const t=i[r][e];void 0!==t&&(n[r]||(n[r]={}),n[r][e]=t)}e.locale=t.locale,e.rightToLeft=t.rightToLeft,e.animation=t.animation,e.theme=t.theme}}_setNotificationEditor(e,t){const n=this,i=n.$.schedulerWindow._target.event;i?(t.value=Array.isArray(i.notifications)?i.notifications.slice():[],t.hourStart=n.hourStart,t.hourFormat=n.hourFormat,t.minuteFormat=n.minuteFormat,t.timeZone=n.timeZone,n._setEditorCommonProperties(t)):t.value=[]}_setStatusEditor(e,t){const n=this,i=n.statuses,r=n.$.schedulerWindow._target.event;if(!r||!i.length)return void e.classList.add("smart-hidden");const a=r.status,l=i.find((e=>e.value===a));e.classList.remove("smart-hidden"),t.dataSource=n.statuses.map((e=>{const t=void 0===e.value?"none":e.value;return e.label=n.localize(t)||t})),t.value=l?n.localize(l.label)||l.label:"",t.readonly=!0,t.placeholder=n.localize("selectPlaceholder"),t.dropDownButtonPosition=n.rightToLeft?"left":"right",n._setEditorCommonProperties(t)}_setResourceEditor(e,t){const n=this,i=n.resources,r=n.$.schedulerWindow._target.event;let a=[],l=[];r&&i.length?(e.classList.remove("smart-hidden"),a=i.map((e=>(e&&r[e.value]&&l.push(e.label),{label:e.label,value:e.value}))),t.readonly=!0,t.placeholder=n.localize("selectPlaceholder"),t.dropDownButtonPosition=n.rightToLeft?"left":"right",t.disabled=!i.length,t.dataSource=a,t.value=l.toString(),n._setEditorCommonProperties(t),t.wait&&(t.wait=!1)):e.classList.add("smart-hidden")}_setResourceDataEditor(e){const t=this,n=t.resources,i=t.$.schedulerWindow._target.event;let r,a,l=Array.from(e.querySelectorAll(".smart-scheduler-window-editor")),o=[];if(i&&n.length){t._windowEditors.resources&&(a=t._windowEditors.resources.querySelector("[event-editor]"),a&&a.value&&(r=a.selectedValues));for(let a=0;a<n.length;a++){const s=n[a],d=s.label,c=s.value,u=s.dataSource;if(!u||!r)continue;const h=r.length;if(h&&r.indexOf(c)>-1||!h&&i[c]){const n=u.find((e=>s&&e.id===i[c]));let r,a,h=l.find((e=>e.getAttribute("resource-type")===c));h?(r=h.querySelector("label"),a=h.querySelector("[event-editor]")):(h=document.createElement("div"),r=document.createElement("label"),a=document.createElement("smart-input"),a.setAttribute("event-editor",""),h.appendChild(r),h.appendChild(a),h.classList.add("smart-scheduler-window-editor"),h.setAttribute("resource-type",c),e.appendChild(h)),o.push(h),t._setEditorCommonProperties(a),r.innerHTML=t.localize(d)||d,a.dataSource=s.dataSource.map((e=>Object.create({label:e.label,value:e.value}))),a.value=n?n.label:"",a.dropDownButtonPosition=t.rightToLeft?"left":"right",a.readonly=!0,a.placeholder=t.localize("selectPlaceholder")}}for(let e=0;e<l.length;e++)o.indexOf(l[e])<0&&l[e].remove();e.classList.remove("smart-hidden")}else e.classList.add("smart-hidden")}_setRepeatOnEditor(e){const t=this,n=t.$.schedulerWindow._target.event,i=t._windowEditors,r=i.repeatOn,a=i.repeatFreq.querySelector("[event-editor]").value.toLowerCase();let l,o=n.repeat?n.repeat.repeatOn:void 0;if(!n||!a||["weekly","monthly","yearly"].indexOf(a)<0)return void e.classList.add("smart-hidden");r.$||(r.$={});const s=r.$;for(let e in s)e!==a&&s[e]&&s[e].remove();void 0===o&&(o=new Date(n.dateStart));let d=s[a];switch(a){case"weekly":d||(d=document.createElement("smart-button-group"),d.dataSource=t._getWeekDays(),d.selectionMode="zeroOrMany",d.setAttribute("event-editor",""),s[a]=d),t._setEditorCommonProperties(d),d.selectedValues=t._getRepeatOnCondition(a,o).map((e=>e.toString()));break;case"monthly":d||(d=document.createElement("smart-number-input"),d.min=1,d.max=31,d.setAttribute("event-editor",""),s[a]=d),t._setEditorCommonProperties(d),d.value=t._getRepeatOnCondition(a,o).toString();break;case"yearly":{let e,n;if(!d){d=document.createElement("div");const e=document.createElement("smart-input"),n=document.createElement("smart-number-input");e.dataSource=t._getMonthNames(),e.dropDownButtonPosition=t.rightToLeft?"left":"right",e.readonly=!0,n.min=1,n.max=31,e.setAttribute("event-editor",""),n.setAttribute("event-editor",""),t._setEditorCommonProperties(e),t._setEditorCommonProperties(n),d.appendChild(e),d.appendChild(n),d.classList.add("smart-scheduler-window-editor"),s[a]=d}e||(e=d.querySelector("smart-input")),n||(n=d.querySelector("smart-number-input")),l=t._getRepeatOnCondition(a,o),e.selectedIndex=l.index,n.value=l.value.toString();break}}d=s[a],e.contains(d)||e.appendChild(d),e.classList.remove("smart-hidden")}_getMonthNames(){const e=[],t=this.monthFormat,n=this.locale,i=new Date;i.setMonth(0);for(let r=0;r<12;r++)e.push({label:new Intl.DateTimeFormat(n,{month:t}).format(i),value:i.getMonth()}),i.setMonth(i.getMonth()+1);return e}_getWeekDays(){const e=this,t=[],n=e.weekdayFormat,i=e.locale,r=new Date;r.setDate(r.getDate()-r.getDay()+e.firstDayOfWeek);for(let e=0;e<7;e++)t.push({label:new Intl.DateTimeFormat(i,{weekday:n}).format(r),value:r.getDay()}),r.setDate(r.getDate()+1);return t}_createWindowTemplate(e,t){const n=this,i=n.animation,r=n.theme,a=n.rightToLeft,l=document.createElement("template");return"footer"===e?t?"confirm"===t&&(l.innerHTML=`\n <smart-button class="smart-scheduler-window-button edit-event"\n animation="${i}" theme="${r}" ${a?"right-to-left":""}>\n </smart-button>\n <smart-button class="smart-scheduler-window-button edit-series"\n animation="${i}" theme="${r}" ${a?"right-to-left":""}>\n </smart-button>`):l.innerHTML=`<smart-button class="smart-scheduler-window-button ok primary"\n animation="${i}" theme="${r}" ${a?"right-to-left":""}>\n </smart-button>\n <smart-button class="smart-scheduler-window-button cancel"\n animation="${i}" theme="${r}" ${a?"right-to-left":""}>\n </smart-button>\n <smart-button class="smart-scheduler-window-button delete secondary"\n animation="${i}" theme="${r}" ${a?"right-to-left":""}>\n </smart-button>`:"header"===e&&(l.innerHTML='<span class="smart-scheduler-window-label"></span>'),l}_currentTimeIndicatorIntervalValidator(e,t){return Math.max(1,t)}_hourValidator(e,t){return Math.max(0,Math.min(23,t))}_datesValidator(e,t){const n=this;let i=[];for(let e=0;e<t.length;e++){const r=n._parseDate(t[e]);isNaN(r)||(r.setHours(0,0,0,0),i.push(r))}return i}_dateValidator(e,t){return t=this._parseDate(t),this._minMaxDateValidator(isNaN(t)?e:t)}_parseDate(e){let t;if(e instanceof Date)return e;if(Smart.Utilities.DateTime&&e instanceof Smart.Utilities.DateTime)return e.toDate();if("string"==typeof e){const n=/\d+:\d+:\d+/;if("new Date()"===e.trim()||"new Smart.Utilities.DateTime()"===e.trim())return new Date;if(isNaN(Date.parse(e))){const i=/(\d+[,-.\/]{1}\s*\d+[,-.\/]{1}\s*\d+)/;if(i.test(e)){const r=i.exec(e)[0].replace(/[,-.\/]/g,",").split(",");if(3===r.length){const[i,a]=parseInt(r[0])<parseInt(r[2])?[r[0],r[2]]:[r[2],r[0]];if(t=new Date(parseInt(a),parseInt(r[1])-1,parseInt(i)),n.test(e)){const i=n.exec(e)[0].split(":");t.setHours(i[0]||0,i[1]||0,i[2]||0)}e=t}}}else t=new Date(Date.parse(e)),n.test(e)||t.setHours(0,0,0,0),e=t}return new Date(e)}_firstDayOfWeekValidator(e,t){return Math.min(6,Math.max(0,t))}_minMaxDateValidator(e){if(!e||isNaN(e.getTime()))return e;const t=new Date(this.min),n=new Date(this.max);return t&&(e=new Date(Math.max(t.getTime(),e.getTime()))),n&&(e=new Date(Math.min(n.getTime(),e.getTime()))),e}_nonworkingDayValidator(e,t){return this._nonworkingDateTimeValidator(e,t)}_nonworkingTimeValidator(e,t){return this._nonworkingDateTimeValidator(e,t,!0)}_nonworkingDateTimeValidator(e,t,n){let i=[];const[r,a]=[0,n?23:6];for(let e=0;e<t.length;e++){const l=t[e];if("number"!=typeof l||isNaN(l))if(Array.isArray(l)){let e=Math.max(r,Math.min(a,parseInt(l[0]))),t=Math.max(r,Math.min(a,parseInt(l[1])));if(!isNaN(e)&&!isNaN(t)){for(;e!==t;)i.push(e),e=e===a?r:++e;i.push(e)}}else{const e=this._dateValidator(l,l);e instanceof Date&&i.push(n?e.getHours():e.getDay())}else i.push(Math.max(r,Math.min(a,parseInt(l))))}return i}_setViewType(e){const t=this,n=t.views.find((t=>t.value&&t.value===e));e=n?n.type:e,t.set("viewType",t.properties.viewType.allowedValues.indexOf(e)>-1?e:"day")}_timeZoneValidator(e,t){const n=this,i=(new Smart.Utilities.DateTime).timeZones;t||(t="local"),t=t.toLowerCase();const r=i.find((e=>e.id.toLowerCase()===t));return r?r.id:(n.error(n.localize("invalidTimeZone",{elementType:n.nodeName.toLowerCase()})),e)}_timeZonesValidator(e,t){const n=this;let i=[];for(let e=0;e<t.length;e++){const r=t[e],a=r.id||r;null!==n._timeZoneValidator(null,a)&&i.push({id:a,label:r.label||a})}return i}_viewValidator(e,t){const n=this;return n._isViewUpdated=!0,n._setViewType(t),delete n._isViewUpdated,t}_viewTypeValidator(e,t){return this._isViewUpdated?t:e}_viewsValidator(e,t){const n=this,i=n.properties.viewType.allowedValues;let r=[];for(let e=0;e<t.length;e++){const a=t[e];"string"==typeof a&&i.includes(a)?r.push(a):"object"==typeof a&&i.includes(a.type)&&(a.value=a.value||a.type,a.label=void 0===a.label?n.localize(a.type):a.label+"",r.push(a))}return r}}),Smart("smart-notification-panel",class extends Smart.BaseElement{static get properties(){return{hourStart:{value:0,type:"number"},hourFormat:{value:"numeric",allowedValues:["numeric","2-digit"],type:"string"},messages:{extend:!0,value:{en:{beforeAt:"before at",days:"days",weeks:"weeks",placeholder:"Add notification",hours:"Hours",minutes:"Minutes",am:"am",pm:"pm"}},type:"object"},minuteFormat:{value:"2-digit",allowedValues:["numeric","2-digit"],type:"string"},placeholder:{value:"placeholder",type:"string"},timeZone:{value:"local",type:"string"},value:{value:[],type:"array"}}}template(){return'<div id="container" role="presentation">\n <div id="notificationsContainer" class="smart-notification-container" role="group"></div>\n <div id="placeholder" class="smart-notification-placeholder" role="button"></div>\n <smart-input wait right-to-left="[[rightToLeft]]" readonly id="typeInput" class="smart-notification-editor smart-hidden"></smart-input>\n <smart-time-input wait right-to-left="[[rightToLeft]]" id="timeInput" class="smart-notification-editor smart-hidden"></smart-time-input>\n <smart-number-input wait right-to-left="[[rightToLeft]]" id="intervalInput" class="smart-notification-editor smart-hidden"></smart-number-input>\n </div>'}static get listeners(){return{"document.click":"_clickHandler",keydown:"_keyDownHandler","container.change":"_containerChangeHandler"}}static get requires(){return{"Smart.Input":"smart.input.js","Smart.TimeInput":"smart.timeinput.js","Smart.NumberInput":"smart.numberinput.js"}}propertyChangedHandler(e,t,n){const i=this;if("placeholder"!==e){if("rightToLeft"===e){const e=n?"left":"right";i.$.typeInput.dropDownButtonPosition=e,i.$.intervalInput.dropDownButtonPosition=e}else"locale"===e?(i.$.placeholder.textContent=i.localize(i.placeholder),i._handleNotificationEditors()):super.propertyChangedHandler(e,t,n);i._handleNotifications()}else i.$.placeholder.textContent=i.localize(i.placeholder)}render(){const e=this;e.hasAttribute("role")||e.setAttribute("role","dialog"),e.$.placeholder.textContent=e.localize(e.placeholder),e._handleNotifications(),e._handleNotificationEditors(),e._setFocusable(),super.render()}_setFocusable(){const e=this,t=e.$.placeholder;if(e.disabled||e.unfocusable)return e.removeAttribute("tabindex"),void t.removeAttribute("tabindex");const n=e.tabIndex>0?e.tabIndex:0;e.tabIndex=n,t.setAttribute("tabindex",n);const i=e.$.notificationsContainer.children;for(let e=0;e<i.length;e++){const t=i[e];Array.from(t.children).forEach((e=>{e instanceof HTMLLabelElement||(e.tabIndex=n)}))}}_keyDownHandler(e){const t=this;if(t.disabled||t.readonly)return;const n=e.target;switch(e.key){case"Enter":(n.closest(".smart-notification-item")||n.closest(".smart-notification-placeholder"))&&(e.preventDefault(),t._clickHandler({target:n}));break;case"Escape":case"Tab":t._hideEditor()}}_clickHandler(e){const t=this;let n=e.target;if(!n||!n.closest||!t.$.container.contains(n)||t.disabled||t.readonly)return void t._hideEditor();if(n.closest(".smart-notificaiton-editor"))return;if(n.closest(".smart-notification-placeholder"))return t._createNotificaiton(),void t._hideEditor();const i=n.closest(".smart-notification-item");if(!i){if(t._editor&&!t._editor.classList.contains("smart-hidden")&&n.closest(".smart-notification-editor"))return;return void t._hideEditor()}t._hideEditor();const r=i._notificationObj;if(n.hasAttribute("delete"))return void t._deleteNotification(i);const a=n.closest(".smart-input");if(!a)return;let l;n.hasAttribute("interval")?(l=t.$.intervalInput,l.value=r.interval,l.min=0,l.max="days"===r.type?28:4):n.hasAttribute("type")?(l=t.$.typeInput,l.value=l.dataSource.find((e=>e.value===r.type)).label):n.hasAttribute("time")&&(l=t.$.timeInput,l.dateTimeFormat={hour:t.hourFormat,minute:t.minuteFormat},l.value=r.time),l._notificationObj=r,l.classList.remove("smart-hidden"),l.wait=!1,l.style.width=a.offsetWidth+"px",l.style.height=a.offsetHeight+"px",l.style.top=a.offsetTop+"px",l.style.left=a.offsetLeft+"px",l&&l.open(),t._editor=l}_hideEditor(){const e=this,t=e._editor;if(!t)return;const n=e._editor._notificationObj;n&&(t===e.$.timeInput?n.time=t.value:t===e.$.typeInput?n.type=t.value:n.interval=t.value,e._refreshNotificationItem(n)),t.close&&t.close(),e._editor.classList.add("smart-hidden"),delete e._editor}_createNotificaiton(){const e=this,t=e._notifications;if(!t)return;const n={interval:1,type:"days",time:[e.hourStart,0]};t.push(n),e._refreshNotificationItems()}_deleteNotification(e){const t=this._notifications;if(!t||!e)return;const n=e._notificationObj;if(delete e._notificationObj,e.remove(),!n)return;const i=t.indexOf(n);i<0||(t.splice(i,1),this._refreshNotificationItems())}_containerChangeHandler(e){const t=this,n=e.target,i=n._notificationObj;n===t.$.timeInput?i.time=n.value:n===t.$.typeInput?i.type=n.dataSource.find((e=>e.label===n.value)).value:n===t.$.intervalInput&&(i.interval=n.value),t._refreshNotificationItem(i)}_refreshNotificationItem(e){const t=this,n=t.$.notificationsContainer.children;for(let i=0;i<n.length;i++){const r=n[i];if(r._notificationObj===e){let n=new Date;n.setHours(e.time[0],e.time[1]);const i=r.children;for(let r=0;r<i.length;r++){const a=i[r];a.hasAttribute("interval")?a.textContent=e.interval:a.hasAttribute("type")?a.textContent=t.localize(e.type)||e.type:a.hasAttribute("time")&&(a.textContent=n.toLocaleTimeString(t.locale,{hour:t.hourFormat,minute:t.minuteFormat}))}}}}_refreshNotificationItems(){const e=this,t=e.$.notificationsContainer,n=e._notifications;for(;t.firstElementChild;)delete t.firstElementChild._notificationObj,t.firstElementChild.remove();if(n&&n.length){const i=document.createDocumentFragment();for(let t=0;t<n.length;t++)i.appendChild(e._createNotificationItem(n[t]));i.children.length&&t.appendChild(i)}e._setFocusable(),e.set("value",n)}_handleNotifications(){const e=this,t=e.value;let n;e.$.notificationsContainer.innerHTML="",n=e._notifications=[];for(let e=0;e<t.length;e++){const i=t[e];let r=i.interval,a=i.type,l=i.time;if(void 0===r||void 0===a||void 0===l)continue;l instanceof Date?l=[l.getHours(),l.getMinutes()]:Array.isArray(l)||(l=[]),a=a&&"days"!==a?"weeks":"days","days"===a?r=Math.max(0,Math.min(28,r)):(a="weeks",r=Math.max(0,Math.min(4,r))),l[0]=Math.max(0,Math.min(23,l[0]||0)),l[1]=Math.max(0,Math.min(59,l[1]||0));const o={interval:r,type:a,time:l};n.push(o)}e._refreshNotificationItems()}_createNotificationItem(e){const t=this,n=document.createElement("div");n.classList.add("smart-notification-item"),n.setAttribute("role","group");let i=new Smart.Utilities.DateTime(new Date).toDate(t.timeZone);return i.setHours(e.time[0],e.time[1]),n.innerHTML=`\n <div class="smart-input" interval>${e.interval}</div>\n <div class="smart-input" type>${t.localize(e.type)||e.type}</div>\n <label>${t.localize("beforeAt")||""}</label>\n <div class="smart-input" time>${i.toLocaleTimeString(t.locale,{hour:t.hourFormat,minute:t.minuteFormat})}</div>\n <div class="smart-button" delete aria-label="Delete" role="button"></div>`,n._notificationObj=e,n}_handleNotificationEditors(){const e=this,t=e.rightToLeft,n=e.locale,i=e.theme,r=e.$.intervalInput,a=e.$.typeInput,l=e.$.timeInput,o=e.messages;[r,a,l].forEach((e=>{const r=e.messages;for(let e in r.en){const t=o[n][e];void 0!==t&&(r[n]||(r[n]={}),r[n][e]=t)}e.rigtToLeft=t,e.locale=n,e.theme=i}));const s=t?"left":"right";l.dropDownButtonPosition="none",a.dropDownButtonPosition=s,r.dropDownButtonPosition=s,a.dataSource=[{label:e.localize("days"),value:"days"},{label:e.localize("weeks"),value:"weeks"}]}});
|