smart-webcomponents-react 17.0.0 → 17.1.0
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/accordion/accordion.d.ts +0 -1
- package/accordion/accordion.esm.js +19 -10
- package/accordion/accordion.umd.js +8 -3
- package/accordion/accordionitem.d.ts +0 -1
- package/alertwindow/alertwindow.d.ts +0 -1
- package/alertwindow/alertwindow.esm.js +15 -9
- package/alertwindow/alertwindow.umd.js +4 -2
- package/array/array.d.ts +0 -1
- package/array/array.esm.js +15 -9
- package/array/array.umd.js +4 -2
- package/barcode/barcode.d.ts +0 -1
- package/barcode/barcode.esm.js +15 -9
- package/barcode/barcode.umd.js +4 -2
- package/breadcrumb/breadcrumb.d.ts +0 -1
- package/breadcrumb/breadcrumb.esm.js +15 -9
- package/breadcrumb/breadcrumb.umd.js +4 -2
- package/button/button.d.ts +0 -1
- package/button/button.esm.js +27 -12
- package/button/button.umd.js +16 -5
- package/button/buttongroup.d.ts +0 -1
- package/button/dropdownbutton.d.ts +0 -1
- package/button/multisplitbutton.d.ts +0 -1
- package/button/powerbutton.d.ts +0 -1
- package/button/radiobutton.d.ts +0 -1
- package/button/repeatbutton.d.ts +0 -1
- package/button/switchbutton.d.ts +0 -1
- package/button/togglebutton.d.ts +0 -1
- package/buttongroup/buttongroup.d.ts +0 -1
- package/buttongroup/buttongroup.esm.js +15 -9
- package/buttongroup/buttongroup.umd.js +4 -2
- package/calendar/calendar.d.ts +0 -1
- package/calendar/calendar.esm.js +15 -9
- package/calendar/calendar.umd.js +4 -2
- package/card/card.d.ts +0 -1
- package/card/card.esm.js +15 -9
- package/card/card.umd.js +4 -2
- package/card/cardview.d.ts +0 -1
- package/cardview/cardview.d.ts +0 -1
- package/cardview/cardview.esm.js +15 -9
- package/cardview/cardview.umd.js +4 -2
- package/carousel/carousel.d.ts +0 -1
- package/carousel/carousel.esm.js +15 -9
- package/carousel/carousel.umd.js +4 -2
- package/chart/chart.d.ts +0 -1
- package/chart/chart.esm.js +15 -9
- package/chart/chart.umd.js +4 -2
- package/chart/ganttchart.d.ts +0 -11
- package/chart/threedchart.d.ts +0 -1
- package/checkbox/checkbox.d.ts +0 -1
- package/checkbox/checkbox.esm.js +15 -9
- package/checkbox/checkbox.umd.js +4 -2
- package/checkinput/checkinput.d.ts +0 -1
- package/checkinput/checkinput.esm.js +15 -9
- package/checkinput/checkinput.umd.js +4 -2
- package/chip/chip.d.ts +0 -1
- package/chip/chip.esm.js +15 -9
- package/chip/chip.umd.js +4 -2
- package/colorinput/colorinput.d.ts +0 -1
- package/colorinput/colorinput.esm.js +15 -9
- package/colorinput/colorinput.umd.js +4 -2
- package/colorpanel/colorpanel.d.ts +0 -1
- package/colorpanel/colorpanel.esm.js +15 -9
- package/colorpanel/colorpanel.umd.js +4 -2
- package/colorpicker/colorpicker.d.ts +0 -1
- package/colorpicker/colorpicker.esm.js +15 -9
- package/colorpicker/colorpicker.umd.js +4 -2
- package/columnpanel/columnpanel.d.ts +0 -1
- package/columnpanel/columnpanel.esm.js +15 -9
- package/columnpanel/columnpanel.umd.js +4 -2
- package/combobox/combobox.d.ts +0 -1
- package/combobox/combobox.esm.js +23 -11
- package/combobox/combobox.umd.js +12 -4
- package/countryinput/countryinput.d.ts +0 -1
- package/countryinput/countryinput.esm.js +15 -9
- package/countryinput/countryinput.umd.js +4 -2
- package/customizationdialog/customizationdialog.d.ts +0 -1
- package/customizationdialog/customizationdialog.esm.js +15 -9
- package/customizationdialog/customizationdialog.umd.js +4 -2
- package/dateinput/dateinput.d.ts +0 -1
- package/dateinput/dateinput.esm.js +15 -9
- package/dateinput/dateinput.umd.js +4 -2
- package/daterangeinput/daterangeinput.d.ts +0 -1
- package/daterangeinput/daterangeinput.esm.js +15 -9
- package/daterangeinput/daterangeinput.umd.js +4 -2
- package/datetimepicker/datetimepicker.d.ts +0 -1
- package/datetimepicker/datetimepicker.esm.js +15 -9
- package/datetimepicker/datetimepicker.umd.js +4 -2
- package/dialogwindow/dialogwindow.d.ts +0 -1
- package/dialogwindow/dialogwindow.esm.js +15 -9
- package/dialogwindow/dialogwindow.umd.js +4 -2
- package/dockinglayout/dockinglayout.d.ts +0 -1
- package/dockinglayout/dockinglayout.esm.js +15 -9
- package/dockinglayout/dockinglayout.umd.js +4 -2
- package/dropdownbutton/dropdownbutton.d.ts +0 -1
- package/dropdownbutton/dropdownbutton.esm.js +15 -9
- package/dropdownbutton/dropdownbutton.umd.js +4 -2
- package/dropdownlist/dropdownlist.d.ts +0 -1
- package/dropdownlist/dropdownlist.esm.js +23 -11
- package/dropdownlist/dropdownlist.umd.js +12 -4
- package/editor/editor.d.ts +0 -1
- package/editor/editor.esm.js +15 -9
- package/editor/editor.umd.js +4 -2
- package/element/element.d.ts +0 -1
- package/element/element.esm.js +15 -9
- package/element/element.umd.js +4 -2
- package/fileupload/fileupload.d.ts +0 -1
- package/fileupload/fileupload.esm.js +15 -9
- package/fileupload/fileupload.umd.js +4 -2
- package/filterbuilder/filterbuilder.d.ts +0 -1
- package/filterbuilder/filterbuilder.esm.js +15 -9
- package/filterbuilder/filterbuilder.umd.js +4 -2
- package/filterpanel/filterpanel.d.ts +0 -1
- package/filterpanel/filterpanel.esm.js +15 -9
- package/filterpanel/filterpanel.umd.js +4 -2
- package/filterpanel/multicolumnfilterpanel.d.ts +0 -1
- package/form/form.d.ts +0 -1
- package/form/form.esm.js +23 -11
- package/form/form.umd.js +12 -4
- package/form/formcontrol.d.ts +0 -1
- package/form/formgroup.d.ts +0 -1
- package/ganttchart/ganttchart.d.ts +0 -11
- package/ganttchart/ganttchart.esm.js +16 -32
- package/ganttchart/ganttchart.umd.js +5 -25
- package/gauge/gauge.d.ts +0 -1
- package/gauge/gauge.esm.js +15 -9
- package/gauge/gauge.umd.js +4 -2
- package/grid/grid.d.ts +0 -1
- package/grid/grid.esm.js +15 -9
- package/grid/grid.umd.js +4 -2
- package/grouppanel/grouppanel.d.ts +0 -1
- package/grouppanel/grouppanel.esm.js +15 -9
- package/grouppanel/grouppanel.umd.js +4 -2
- package/index.d.ts +1 -11
- package/input/checkinput.d.ts +0 -1
- package/input/colorinput.d.ts +0 -1
- package/input/countryinput.d.ts +0 -1
- package/input/dateinput.d.ts +0 -1
- package/input/daterangeinput.d.ts +0 -1
- package/input/input.d.ts +0 -1
- package/input/input.esm.js +15 -9
- package/input/input.umd.js +4 -2
- package/input/multicomboinput.d.ts +0 -1
- package/input/multiinput.d.ts +0 -1
- package/input/numberinput.d.ts +0 -1
- package/input/passwordinput.d.ts +0 -1
- package/input/phoneinput.d.ts +0 -1
- package/input/timeinput.d.ts +0 -1
- package/kanban/kanban.d.ts +0 -1
- package/kanban/kanban.esm.js +15 -9
- package/kanban/kanban.umd.js +4 -2
- package/layout/dockinglayout.d.ts +0 -1
- package/layout/layout.d.ts +0 -1
- package/layout/layout.esm.js +31 -13
- package/layout/layout.umd.js +20 -6
- package/layout/layoutgroup.d.ts +0 -1
- package/layout/layoutitem.d.ts +0 -1
- package/layout/tablayoutgroup.d.ts +0 -1
- package/layout/tablayoutitem.d.ts +0 -1
- package/led/led.d.ts +0 -1
- package/led/led.esm.js +15 -9
- package/led/led.umd.js +4 -2
- package/listbox/listbox.d.ts +0 -1
- package/listbox/listbox.esm.js +23 -11
- package/listbox/listbox.umd.js +12 -4
- package/listmenu/listmenu.d.ts +0 -1
- package/listmenu/listmenu.esm.js +23 -11
- package/listmenu/listmenu.umd.js +12 -4
- package/map/map.d.ts +0 -1
- package/map/map.esm.js +15 -9
- package/map/map.umd.js +4 -2
- package/maskedtextbox/maskedtextbox.d.ts +0 -1
- package/maskedtextbox/maskedtextbox.esm.js +15 -9
- package/maskedtextbox/maskedtextbox.umd.js +4 -2
- package/menu/listmenu.d.ts +0 -1
- package/menu/menu.d.ts +0 -1
- package/menu/menu.esm.js +23 -11
- package/menu/menu.umd.js +12 -4
- package/menu/menuitem.d.ts +0 -1
- package/menu/menuitemsgroup.d.ts +0 -1
- package/multicolumnfilterpanel/multicolumnfilterpanel.d.ts +0 -1
- package/multicolumnfilterpanel/multicolumnfilterpanel.esm.js +15 -9
- package/multicolumnfilterpanel/multicolumnfilterpanel.umd.js +4 -2
- package/multicomboinput/multicomboinput.d.ts +0 -1
- package/multicomboinput/multicomboinput.esm.js +15 -9
- package/multicomboinput/multicomboinput.umd.js +4 -2
- package/multiinput/multiinput.d.ts +0 -1
- package/multiinput/multiinput.esm.js +15 -9
- package/multiinput/multiinput.umd.js +4 -2
- package/multilinetextbox/multilinetextbox.d.ts +0 -1
- package/multilinetextbox/multilinetextbox.esm.js +23 -11
- package/multilinetextbox/multilinetextbox.umd.js +12 -4
- package/multilinewindow/multilinewindow.d.ts +0 -1
- package/multilinewindow/multilinewindow.esm.js +15 -9
- package/multilinewindow/multilinewindow.umd.js +4 -2
- package/multisplitbutton/multisplitbutton.d.ts +0 -1
- package/multisplitbutton/multisplitbutton.esm.js +23 -11
- package/multisplitbutton/multisplitbutton.umd.js +12 -4
- package/numberinput/numberinput.d.ts +0 -1
- package/numberinput/numberinput.esm.js +15 -9
- package/numberinput/numberinput.umd.js +4 -2
- package/numerictextbox/numerictextbox.d.ts +0 -1
- package/numerictextbox/numerictextbox.esm.js +15 -9
- package/numerictextbox/numerictextbox.umd.js +4 -2
- package/package.json +2 -1
- package/pager/pager.d.ts +0 -1
- package/pager/pager.esm.js +15 -9
- package/pager/pager.umd.js +4 -2
- package/passwordinput/passwordinput.d.ts +0 -1
- package/passwordinput/passwordinput.esm.js +15 -9
- package/passwordinput/passwordinput.umd.js +4 -2
- package/passwordtextbox/passwordtextbox.d.ts +0 -1
- package/passwordtextbox/passwordtextbox.esm.js +15 -9
- package/passwordtextbox/passwordtextbox.umd.js +4 -2
- package/path/path.d.ts +0 -1
- package/path/path.esm.js +15 -9
- package/path/path.umd.js +4 -2
- package/phoneinput/phoneinput.d.ts +0 -1
- package/phoneinput/phoneinput.esm.js +15 -9
- package/phoneinput/phoneinput.umd.js +4 -2
- package/pivottable/pivottable.d.ts +0 -1
- package/pivottable/pivottable.esm.js +15 -9
- package/pivottable/pivottable.umd.js +4 -2
- package/progressbar/circularprogressbar.d.ts +0 -1
- package/progressbar/progressbar.d.ts +0 -1
- package/progressbar/progressbar.esm.js +19 -10
- package/progressbar/progressbar.umd.js +8 -3
- package/progresswindow/progresswindow.d.ts +0 -1
- package/progresswindow/progresswindow.esm.js +15 -9
- package/progresswindow/progresswindow.umd.js +4 -2
- package/promptwindow/promptwindow.d.ts +0 -1
- package/promptwindow/promptwindow.esm.js +15 -9
- package/promptwindow/promptwindow.umd.js +4 -2
- package/qrcode/qrcode.d.ts +0 -1
- package/qrcode/qrcode.esm.js +15 -9
- package/qrcode/qrcode.umd.js +4 -2
- package/querybuilder/querybuilder.d.ts +0 -1
- package/querybuilder/querybuilder.esm.js +15 -9
- package/querybuilder/querybuilder.umd.js +4 -2
- package/radiobutton/radiobutton.d.ts +0 -1
- package/radiobutton/radiobutton.esm.js +15 -9
- package/radiobutton/radiobutton.umd.js +4 -2
- package/rating/rating.d.ts +0 -1
- package/rating/rating.esm.js +15 -9
- package/rating/rating.umd.js +4 -2
- package/ribbon/ribbon.d.ts +0 -1
- package/ribbon/ribbon.esm.js +27 -12
- package/ribbon/ribbon.umd.js +16 -5
- package/ribbon/ribbongroup.d.ts +0 -1
- package/ribbon/ribbonitem.d.ts +0 -1
- package/ribbon/ribbontab.d.ts +0 -1
- package/scheduler/scheduler.d.ts +0 -1
- package/scheduler/scheduler.esm.js +15 -9
- package/scheduler/scheduler.umd.js +4 -2
- package/scrollbar/scrollbar.d.ts +0 -1
- package/scrollbar/scrollbar.esm.js +15 -9
- package/scrollbar/scrollbar.umd.js +4 -2
- package/slider/slider.d.ts +0 -1
- package/slider/slider.esm.js +15 -9
- package/slider/slider.umd.js +4 -2
- package/sortable/sortable.d.ts +0 -1
- package/sortable/sortable.esm.js +15 -9
- package/sortable/sortable.umd.js +4 -2
- package/sortpanel/sortpanel.d.ts +0 -1
- package/sortpanel/sortpanel.esm.js +15 -9
- package/sortpanel/sortpanel.umd.js +4 -2
- package/source/modules/smart.3dchart.js +2 -2
- package/source/modules/smart.accordion.js +1 -1
- package/source/modules/smart.array.js +2 -2
- 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 +2 -2
- package/source/modules/smart.card.js +1 -1
- package/source/modules/smart.cardview.js +5 -5
- 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 +2 -2
- package/source/modules/smart.colorpicker.js +2 -2
- package/source/modules/smart.combobox.js +2 -2
- package/source/modules/smart.common.js +3 -3
- package/source/modules/smart.countryinput.js +1 -1
- package/source/modules/smart.dateinput.js +2 -2
- package/source/modules/smart.daterangeinput.js +3 -3
- package/source/modules/smart.datetimepicker.js +4 -4
- package/source/modules/smart.dockinglayout.js +1 -1
- package/source/modules/smart.dropdownbutton.js +1 -1
- package/source/modules/smart.dropdownlist.js +2 -2
- package/source/modules/smart.editor.js +2 -2
- package/source/modules/smart.element.js +1 -1
- package/source/modules/smart.fileupload.js +2 -2
- package/source/modules/smart.form.js +1 -1
- package/source/modules/smart.formulaparser.js +1 -1
- package/source/modules/smart.ganttchart.js +5 -5
- package/source/modules/smart.gauge.js +2 -2
- package/source/modules/smart.grid.js +15 -15
- package/source/modules/smart.gridpanel.js +5 -5
- package/source/modules/smart.input.js +1 -1
- package/source/modules/smart.kanban.js +6 -6
- 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 +2 -2
- package/source/modules/smart.multisplitbutton.js +2 -2
- package/source/modules/smart.numberinput.js +1 -1
- package/source/modules/smart.numerictextbox.js +2 -2
- 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 +4 -4
- package/source/modules/smart.progressbar.js +1 -1
- package/source/modules/smart.qrcode.js +1 -1
- package/source/modules/smart.querybuilder.js +4 -4
- package/source/modules/smart.radiobutton.js +1 -1
- package/source/modules/smart.rating.js +1 -1
- package/source/modules/smart.ribbon.js +2 -2
- package/source/modules/smart.router.js +2 -2
- package/source/modules/smart.scheduler.js +6 -6
- package/source/modules/smart.scrollbar.js +1 -1
- package/source/modules/smart.slider.js +2 -2
- 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 +4 -4
- package/source/modules/smart.tabs.js +1 -1
- package/source/modules/smart.tank.js +2 -2
- package/source/modules/smart.textarea.js +1 -1
- package/source/modules/smart.textbox.js +2 -2
- 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 +2 -2
- package/source/smart.3dchart.js +1 -1
- package/source/smart.accordion.js +1 -1
- package/source/smart.ajax.js +1 -1
- package/source/smart.array.js +1 -1
- package/source/smart.barcode.js +1 -1
- package/source/smart.bootstrap.js +1 -1
- package/source/smart.breadcrumb.js +1 -1
- package/source/smart.button.js +1 -1
- package/source/smart.buttongroup.js +1 -1
- package/source/smart.calendar.js +1 -1
- package/source/smart.card.js +1 -1
- package/source/smart.cardview.js +1 -1
- package/source/smart.carousel.js +1 -1
- package/source/smart.chart.annotations.js +1 -1
- package/source/smart.chart.api.js +1 -1
- package/source/smart.chart.core.js +1 -1
- package/source/smart.chart.js +1 -1
- package/source/smart.chart.rangeselector.js +1 -1
- package/source/smart.chart.waterfall.js +1 -1
- package/source/smart.checkbox.js +1 -1
- package/source/smart.checkinput.js +1 -1
- package/source/smart.chip.js +1 -1
- package/source/smart.colorinput.js +1 -1
- package/source/smart.colorpanel.js +1 -1
- package/source/smart.colorpicker.js +1 -1
- package/source/smart.combobox.js +1 -1
- package/source/smart.complex.js +1 -1
- package/source/smart.core.js +1 -1
- package/source/smart.countryinput.js +1 -1
- package/source/smart.data.js +2 -2
- package/source/smart.date.js +2 -2
- package/source/smart.dateformatpanel.js +1 -1
- package/source/smart.dateinput.js +1 -1
- package/source/smart.daterangeinput.js +1 -1
- package/source/smart.datetimepicker.js +2 -2
- package/source/smart.dockinglayout.js +1 -1
- package/source/smart.draw.js +1 -1
- package/source/smart.dropdownbutton.js +1 -1
- package/source/smart.dropdownlist.js +2 -2
- package/source/smart.editor.js +2 -2
- package/source/smart.element.js +1 -1
- package/source/smart.elements.js +17 -17
- package/source/smart.export.js +1 -1
- package/source/smart.fileupload.js +1 -1
- package/source/smart.filter.js +1 -1
- package/source/smart.filterbuilder.js +1 -1
- package/source/smart.filterpanel.js +1 -1
- package/source/smart.form.js +1 -1
- package/source/smart.format.js +1 -1
- package/source/smart.formulaparser.js +1 -1
- package/source/smart.ganttchart.js +1 -1
- package/source/smart.gauge.js +1 -1
- package/source/smart.grid.cell.js +2 -2
- package/source/smart.grid.chart.js +1 -1
- package/source/smart.grid.column.js +1 -1
- package/source/smart.grid.core.js +2 -2
- package/source/smart.grid.dialog.js +2 -2
- package/source/smart.grid.edit.js +2 -2
- package/source/smart.grid.export.js +1 -1
- package/source/smart.grid.filter.js +1 -1
- package/source/smart.grid.group.js +2 -2
- package/source/smart.grid.js +1 -1
- package/source/smart.grid.menu.js +1 -1
- package/source/smart.grid.pager.js +1 -1
- package/source/smart.grid.reorder.js +2 -2
- package/source/smart.grid.resize.js +1 -1
- package/source/smart.grid.row.js +1 -1
- package/source/smart.grid.select.js +2 -2
- package/source/smart.grid.sort.js +2 -2
- package/source/smart.grid.toolbar.js +2 -2
- package/source/smart.grid.tree.js +1 -1
- package/source/smart.grid.view.js +2 -2
- package/source/smart.gridpanel.js +1 -1
- package/source/smart.input.js +1 -1
- package/source/smart.kanban.js +2 -2
- package/source/smart.layout.js +1 -1
- package/source/smart.led.js +1 -1
- package/source/smart.listbox.js +1 -1
- package/source/smart.listmenu.js +1 -1
- package/source/smart.map.js +1 -1
- package/source/smart.maskedtextbox.js +1 -1
- package/source/smart.math.js +1 -1
- package/source/smart.menu.js +1 -1
- package/source/smart.multicomboinput.js +1 -1
- package/source/smart.multiinput.js +1 -1
- package/source/smart.multilinetextbox.js +1 -1
- package/source/smart.multisplitbutton.js +1 -1
- package/source/smart.numberformatpanel.js +1 -1
- package/source/smart.numberinput.js +1 -1
- package/source/smart.numeric.js +1 -1
- package/source/smart.numerictextbox.js +1 -1
- package/source/smart.pager.js +1 -1
- package/source/smart.passwordinput.js +1 -1
- package/source/smart.passwordtextbox.js +1 -1
- package/source/smart.path.js +1 -1
- package/source/smart.phoneinput.js +1 -1
- package/source/smart.pivottable.js +1 -1
- package/source/smart.powerbutton.js +1 -1
- package/source/smart.progressbar.js +1 -1
- package/source/smart.qrcode.js +1 -1
- package/source/smart.radiobutton.js +1 -1
- package/source/smart.rating.js +1 -1
- package/source/smart.ribbon.js +1 -1
- package/source/smart.router.js +1 -1
- package/source/smart.scheduler.js +2 -2
- package/source/smart.scrollbar.js +1 -1
- package/source/smart.slider.js +1 -1
- package/source/smart.sortable.js +1 -1
- package/source/smart.splitter.js +1 -1
- package/source/smart.switchbutton.js +1 -1
- package/source/smart.table.js +1 -1
- package/source/smart.tabs.js +1 -1
- package/source/smart.tank.js +1 -1
- package/source/smart.textarea.js +1 -1
- package/source/smart.textbox.js +1 -1
- package/source/smart.tickintervalhandler.js +1 -1
- package/source/smart.timeinput.js +1 -1
- package/source/smart.timepicker.js +1 -1
- package/source/smart.toast.js +1 -1
- package/source/smart.tooltip.js +1 -1
- package/source/smart.tree.js +1 -1
- package/source/smart.validationpanel.js +1 -1
- package/source/smart.validator.js +1 -1
- package/source/smart.window.js +1 -1
- package/source/styles/components/smart.grid.css +1 -1
- package/source/styles/components/smart.kanban.css +1 -1
- package/source/styles/default/scss/smart.grid.scss +14 -3
- package/source/styles/default/scss/smart.kanban.scss +13 -2
- package/source/styles/default/smart.grid.css +15 -3
- package/source/styles/default/smart.kanban.css +1607 -1599
- package/source/styles/smart.default.css +2 -2
- package/source/typescript/smart.elements.d.ts +1 -11
- package/source/typescript/smart.ganttchart.d.ts +0 -10
- package/source/typescript/smart.ribbon.d.ts +1 -1
- package/splitter/splitter.d.ts +0 -1
- package/splitter/splitter.esm.js +23 -11
- package/splitter/splitter.umd.js +12 -4
- package/splitter/splitterbar.d.ts +0 -1
- package/splitter/splitteritem.d.ts +0 -1
- package/switchbutton/switchbutton.d.ts +0 -1
- package/switchbutton/switchbutton.esm.js +15 -9
- package/switchbutton/switchbutton.umd.js +4 -2
- package/table/pivottable.d.ts +0 -1
- package/table/sortable.d.ts +0 -1
- package/table/table.d.ts +0 -1
- package/table/table.esm.js +15 -9
- package/table/table.umd.js +4 -2
- package/tabs/tabs.d.ts +0 -1
- package/tabs/tabs.esm.js +23 -11
- package/tabs/tabs.umd.js +12 -4
- package/tabs/tabswindow.d.ts +0 -1
- package/tabswindow/tabswindow.d.ts +0 -1
- package/tabswindow/tabswindow.esm.js +15 -9
- package/tabswindow/tabswindow.umd.js +4 -2
- package/tank/tank.d.ts +0 -1
- package/tank/tank.esm.js +15 -9
- package/tank/tank.umd.js +4 -2
- package/textarea/textarea.d.ts +0 -1
- package/textarea/textarea.esm.js +15 -9
- package/textarea/textarea.umd.js +4 -2
- package/textbox/maskedtextbox.d.ts +0 -1
- package/textbox/multilinetextbox.d.ts +0 -1
- package/textbox/numerictextbox.d.ts +0 -1
- package/textbox/passwordtextbox.d.ts +0 -1
- package/textbox/textbox.d.ts +0 -1
- package/textbox/textbox.esm.js +23 -11
- package/textbox/textbox.umd.js +12 -4
- package/threedchart/threedchart.d.ts +0 -1
- package/threedchart/threedchart.esm.js +15 -9
- package/threedchart/threedchart.umd.js +4 -2
- package/timeinput/timeinput.d.ts +0 -1
- package/timeinput/timeinput.esm.js +15 -9
- package/timeinput/timeinput.umd.js +4 -2
- package/timepicker/datetimepicker.d.ts +0 -1
- package/timepicker/timepicker.d.ts +0 -1
- package/timepicker/timepicker.esm.js +15 -9
- package/timepicker/timepicker.umd.js +4 -2
- package/toast/toast.d.ts +0 -1
- package/toast/toast.esm.js +15 -9
- package/toast/toast.umd.js +4 -2
- package/tooltip/tooltip.d.ts +0 -1
- package/tooltip/tooltip.esm.js +15 -9
- package/tooltip/tooltip.umd.js +4 -2
- package/tree/tree.d.ts +0 -1
- package/tree/tree.esm.js +23 -11
- package/tree/tree.umd.js +12 -4
- package/tree/treeitem.d.ts +0 -1
- package/tree/treeitemsgroup.d.ts +0 -1
- package/validator/validator.d.ts +0 -1
- package/validator/validator.esm.js +15 -9
- package/validator/validator.umd.js +4 -2
- package/waitwindow/waitwindow.d.ts +0 -1
- package/waitwindow/waitwindow.esm.js +15 -9
- package/waitwindow/waitwindow.umd.js +4 -2
- package/window/alertwindow.d.ts +0 -1
- package/window/dialogwindow.d.ts +0 -1
- package/window/multilinewindow.d.ts +0 -1
- package/window/progresswindow.d.ts +0 -1
- package/window/promptwindow.d.ts +0 -1
- package/window/tabswindow.d.ts +0 -1
- package/window/waitwindow.d.ts +0 -1
- package/window/window.d.ts +0 -1
- package/window/window.esm.js +15 -9
- package/window/window.umd.js +4 -2
|
@@ -98,21 +98,21 @@ Smart("smart-color-input",class extends Smart.Input{static get properties(){retu
|
|
|
98
98
|
/***/ 6057:
|
|
99
99
|
/***/ (() => {
|
|
100
100
|
|
|
101
|
-
(()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0)t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0)t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0)t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0)t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType))t._bindToICS(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType))t._bindToXML(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType))t._bindToCSV(),a();else if("array"===t.dataSourceType)t._bindToArray(),a();else if("json"===t.dataSourceType){if(t.dataSource&&t.dataSource.url)return t.url=t.dataSource.url,t.dataSource.method&&(t.type=t.dataSource.method),t.dataSource.type&&(t.type=t.dataSource.type),t.dataSource.data&&(t.data=t.dataSource.data),void new e(t,(e=>{t.dataSource=e}));t._bindToJSON(),a()}}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),t.data=r.data,a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{let a=t.value,n=t.valueTo;if(a&&a instanceof Date){a=`'${new Smart.Utilities.DateTime(a).toString("yyyy-MM-dd")}'`}if(t.valueTo&&t.valueTo instanceof Date){n=`'${new Smart.Utilities.DateTime(n).toString("yyyy-MM-dd")}'`}switch(t.condition){case"EQUAL":return e+" = "+a;case"NOT_EQUAL":return e+" != "+a;case"GREATER_THAN":return e+" > "+a;case"GREATER_THAN_OR_EQUAL":return e+" >= "+a;case"LESS_THAN":return e+" < "+a;case"LESS_THAN_OR_EQUAL":return e+" <= "+a;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+a+" and "+e+" <= "+n+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1!==o.logicalOperators[t]&&"or"!==o.logicalOperators[t]||(s=" OR ")}l.length&&r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e)}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n]+"'");null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{if("parent"===e[t])e[t]="$"+e[t]})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let f=new Array;for(let t=0;t<e.length;t++)f[t]=u();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const h=new Array,p=new Array;let g=0;const S=function(t){let a=t;for(let n=0;n<e.length;n++){if(void 0===t[e[n]]){a=s._getDataItem(t,t.$.index);break}}if(n)for(let e in n){const t=n[e];t.name&&t.map&&(a[t.map]=a[t.name])}return a};let y=!1;for(let n=0;n<d.length;n++){let m=Object.assign({},S(d[n]));m[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=m[a];null!=n?((""===n||void 0===n&&0===t)&&(y=!0),T[b++]={value:n,group:a,hash:f[t]}):(T[b++]={value:null,group:a,hash:f[t]},0===t&&(y=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===p[v]||null===p[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=m,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==m[c.expanded]?x[c.expanded]=m[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=m[i]),x[t]=new Array;let e=h.length+l;this.id&&"number"!=typeof m.$.id&&!isFinite(m.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),h[g++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=m,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==m[c.expanded]?e[c.expanded]=m[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=m[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}p[v]=x}else x=p[v]}m&&(m[c.leaf]=!0),null!==x?(null===this.id?void 0===m.$.id&&(m.$.id=x.$.id+"_"+x[t].length):void 0===m.$.id&&-1===m.$.id.toString().indexOf(x.$.id)&&(m.$.id=x.$.id+"_"+m.$.id),m[o]=x,m[c.level]=x[c.level]+1,x[t][x[t].length]=m):void 0===m.$.id&&(m.$.id=u())}if(y){let e=null,t=!1;for(let a=0;a<h.length;a++){const n=h[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),h.splice(a,1);break}}if(e&&(h.push(e),t))for(let e=0;e<h.length;e++){const t=h[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return h}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(void 0!==d&&"uncategorized"!==d||(d=""),o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("status"===t)n=r[o.dataField][t],null==n&&(n=[]),n[d]||(n[d]=[]),n[d].push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}else if("status"===t){let e=r[o.dataField][t];null==e&&(e=[]),e[d]||(e[d]=[]),e[d].push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].status){const e=r[n.dataField].status;r[n.dataField].status=e}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType){if(o&&"string"==typeof o&&o.indexOf("[")>=0){const e=JSON.parse(o);if(r.formatString&&Smart.Utilities.DateTime){const t=Smart.Utilities.DateTime.ParseDate(e[0],r.formatString),a=Smart.Utilities.DateTime.ParseDate(e[1],r.formatString);e[0]=t,e[1]=a}else{const t=a.$document.deserialize(""+e[0],r.dataType,!0),n=a.$document.deserialize(""+e[1],r.dataType,!0);e[0]=t,e[1]=n}o=e,n[r.name]=o;continue}if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0)}else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o),o.indexOf("<br")>=0&&(o=o.replaceAll("<br/>","\n\r"),o=o.replaceAll("<br>","\n\r")))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];if(""!==t&&" "!==t){if("true"===t.trim()){i.push(!0);continue}if("false"===t.trim()){i.push(!1);continue}if(t.indexOf("or ")>=0||t.indexOf("and ")>=0||t.indexOf("1 ")>=0||t.indexOf("0 ")>=0||t.indexOf("| ")>=0||t.indexOf("& ")>=0){const e=t.trim().split(" ");if(e.length>1){const t=e[0].trim(),a=e[1].trim();"1"===t?i.push("or"):"0"===t?i.push("and"):i.push(t),i.push(a)}else i.push(t.trim())}else i.push(t.trim())}}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){const e=function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0};return e}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
|
|
101
|
+
(()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0)t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0)t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0)t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0)t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType))t._bindToICS(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType))t._bindToXML(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType))t._bindToCSV(),a();else if("array"===t.dataSourceType)t._bindToArray(),a();else if("json"===t.dataSourceType){if(t.dataSource&&t.dataSource.url)return t.url=t.dataSource.url,t.dataSource.method&&(t.type=t.dataSource.method),t.dataSource.type&&(t.type=t.dataSource.type),t.dataSource.data&&(t.data=t.dataSource.data),void new e(t,(e=>{t.dataSource=e}));t._bindToJSON(),a()}}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),t.data=r.data,a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{let a=t.value,n=t.valueTo;if(a&&a instanceof Date){a=`'${new Smart.Utilities.DateTime(a).toString("yyyy-MM-dd")}'`}if(t.valueTo&&t.valueTo instanceof Date){n=`'${new Smart.Utilities.DateTime(n).toString("yyyy-MM-dd")}'`}switch(t.condition){case"EQUAL":return e+" = "+a;case"NOT_EQUAL":return e+" != "+a;case"GREATER_THAN":return e+" > "+a;case"GREATER_THAN_OR_EQUAL":return e+" >= "+a;case"LESS_THAN":return e+" < "+a;case"LESS_THAN_OR_EQUAL":return e+" <= "+a;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+a+" and "+e+" <= "+n+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1!==o.logicalOperators[t]&&"or"!==o.logicalOperators[t]||(s=" OR ")}l.length&&r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e)}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n]+"'");null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{if("parent"===e[t])e[t]="$"+e[t]})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=s.boundSource.canNotify;s.boundSource.canNotify=!1;const f=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let h=new Array;for(let t=0;t<e.length;t++)h[t]=f();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const p=new Array,g=new Array;let S=0;const y=function(t){let a=t;for(let n=0;n<e.length;n++){if(void 0===t[e[n]]){a=s._getDataItem(t,t.$.index);break}}if(n)for(let e in n){const t=n[e];t.name&&t.map&&(a[t.map]=a[t.name])}return a};let m=!1;for(let n=0;n<d.length;n++){let u=y(d[n]);u[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=u[a];null!=n?((""===n||void 0===n&&0===t)&&(m=!0),T[b++]={value:n,group:a,hash:h[t]}):(T[b++]={value:null,group:a,hash:h[t]},0===t&&(m=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===g[v]||null===g[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=u,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==u[c.expanded]?x[c.expanded]=u[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=u[i]),x[t]=new Array;let e=p.length+l;this.id&&"number"!=typeof u.$.id&&!isFinite(u.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),p[S++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=u,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==u[c.expanded]?e[c.expanded]=u[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=u[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}g[v]=x}else x=g[v]}u&&(u[c.leaf]=!0),null!==x?(null===this.id?void 0===u.$.id&&(u.$.id=x.$.id+"_"+x[t].length):void 0===u.$.id&&-1===u.$.id.toString().indexOf(x.$.id)&&(u.$.id=x.$.id+"_"+u.$.id),u[o]=x,u[c.level]=x[c.level]+1,x[t][x[t].length]=u):void 0===u.$.id&&(u.$.id=f())}if(m){let e=null,t=!1;for(let a=0;a<p.length;a++){const n=p[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),p.splice(a,1);break}}if(e&&(p.push(e),t))for(let e=0;e<p.length;e++){const t=p[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return s.boundSource.canNotify=u,p}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(void 0!==d&&"uncategorized"!==d||(d=""),o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("status"===t)n=r[o.dataField][t],null==n&&(n=[]),n[d]||(n[d]=[]),n[d].push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}else if("status"===t){let e=r[o.dataField][t];null==e&&(e=[]),e[d]||(e[d]=[]),e[d].push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].status){const e=r[n.dataField].status;r[n.dataField].status=e}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType){if(o&&"string"==typeof o&&o.indexOf("[")>=0){const e=JSON.parse(o);if(r.formatString&&Smart.Utilities.DateTime){const t=Smart.Utilities.DateTime.ParseDate(e[0],r.formatString),a=Smart.Utilities.DateTime.ParseDate(e[1],r.formatString);e[0]=t,e[1]=a}else{const t=a.$document.deserialize(""+e[0],r.dataType,!0),n=a.$document.deserialize(""+e[1],r.dataType,!0);e[0]=t,e[1]=n}o=e,n[r.name]=o;continue}if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0)}else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o),o.indexOf("<br")>=0&&(o=o.replaceAll("<br/>","\n\r"),o=o.replaceAll("<br>","\n\r")))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];if(""!==t&&" "!==t){if("true"===t.trim()){i.push(!0);continue}if("false"===t.trim()){i.push(!1);continue}if(t.indexOf("or ")>=0||t.indexOf("and ")>=0||t.indexOf("1 ")>=0||t.indexOf("0 ")>=0||t.indexOf("| ")>=0||t.indexOf("& ")>=0){const e=t.trim().split(" ");if(e.length>1){const t=e[0].trim(),a=e[1].trim();"1"===t?i.push("or"):"0"===t?i.push("and"):i.push(t),i.push(a)}else i.push(t.trim())}else i.push(t.trim())}}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){const e=function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0};return e}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
|
|
102
102
|
|
|
103
103
|
/***/ }),
|
|
104
104
|
|
|
105
105
|
/***/ 2052:
|
|
106
106
|
/***/ (() => {
|
|
107
107
|
|
|
108
|
-
(()=>{const e=-1*(new Date).getTimezoneOffset(),t=[{id:"Local",offset:e,offsetHours:e/60,displayName:"",supportsDaylightSavingTime:!1},{id:"Dateline Standard Time",offset:-720,offsetHours:-12,displayName:"(UTC-12:00) International Date Line West",supportsDaylightSavingTime:!1},{id:"UTC-11",offset:-660,offsetHours:-11,displayName:"(UTC-11:00) Coordinated Universal Time-11",supportsDaylightSavingTime:!1},{id:"Hawaiteratoran Standard Time",offset:-600,offsetHours:-10,displayName:"(UTC-10:00) Hawaiterator",supportsDaylightSavingTime:!1},{id:"Alaskan Standard Time",offset:-540,offsetHours:-9,displayName:"(UTC-09:00) Alaska",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time (Mexico)",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Baja California",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Pacific Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Arizona",supportsDaylightSavingTime:!1},{id:"Mountain Standard Time (Mexico)",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",supportsDaylightSavingTime:!0},{id:"Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Mountain Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central America Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central America",supportsDaylightSavingTime:!1},{id:"Canada Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Saskatchewan",supportsDaylightSavingTime:!1},{id:"Central Standard Time (Mexico)",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",supportsDaylightSavingTime:!0},{id:"SA Pacific Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Bogota, Lima, Quito, Rio Branco",supportsDaylightSavingTime:!1},{id:"Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Eastern Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Indiana (East)",supportsDaylightSavingTime:!0},{id:"Venezuela Standard Time",offset:-270,offsetHours:-4.5,displayName:"(UTC-04:30) Caracas",supportsDaylightSavingTime:!1},{id:"Atlantic Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Atlantic Time (Canada)",supportsDaylightSavingTime:!0},{id:"Paraguay Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Asuncion",supportsDaylightSavingTime:!0},{id:"Central Brazilian Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Cuiaba",supportsDaylightSavingTime:!0},{id:"Pacific SA Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Santiago",supportsDaylightSavingTime:!0},{id:"SA Western Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",supportsDaylightSavingTime:!1},{id:"Newfoundland Standard Time",offset:-210,offsetHours:-3.5,displayName:"(UTC-03:30) Newfoundland",supportsDaylightSavingTime:!0},{id:"SA Eastern Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Cayenne, Fortaleza",supportsDaylightSavingTime:!1},{id:"Argentina Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Buenos Aires",supportsDaylightSavingTime:!0},{id:"E. South America Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Brasilia",supportsDaylightSavingTime:!0},{id:"Bahia Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Salvador",supportsDaylightSavingTime:!0},{id:"Montevideo Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Montevideo",supportsDaylightSavingTime:!0},{id:"Greenland Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Greenland",supportsDaylightSavingTime:!0},{id:"UTC-02",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Coordinated Universal Time-02",supportsDaylightSavingTime:!1},{id:"Mid-Atlantic Standard Time",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Mid-Atlantic - Old",supportsDaylightSavingTime:!0},{id:"Azores Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Azores",supportsDaylightSavingTime:!0},{id:"Cape Verde Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Cape Verde Is.",supportsDaylightSavingTime:!1},{id:"Morocco Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Casablanca",supportsDaylightSavingTime:!0},{id:"UTC",offset:0,offsetHours:0,displayName:"(UTC) Coordinated Universal Time",supportsDaylightSavingTime:!1},{id:"GMT Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Dublin, Edinburgh, Lisbon, London",supportsDaylightSavingTime:!0},{id:"Greenwich Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Monrovia, Reykjavik",supportsDaylightSavingTime:!1},{id:"Central European Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",supportsDaylightSavingTime:!0},{id:"Namibia Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Windhoek",supportsDaylightSavingTime:!0},{id:"W. Central Africa Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) West Central Africa",supportsDaylightSavingTime:!1},{id:"W. Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",supportsDaylightSavingTime:!0},{id:"Central Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",supportsDaylightSavingTime:!0},{id:"Romance Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",supportsDaylightSavingTime:!0},{id:"FLE Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",supportsDaylightSavingTime:!0},{id:"South Africa Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Harare, Pretoria",supportsDaylightSavingTime:!1},{id:"Turkey Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Istanbul",supportsDaylightSavingTime:!0},{id:"GTB Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Athens, Bucharest",supportsDaylightSavingTime:!0},{id:"Libya Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Tripoli",supportsDaylightSavingTime:!0},{id:"E. Europe Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) E. Europe",supportsDaylightSavingTime:!0},{id:"Jordan Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Amman",supportsDaylightSavingTime:!0},{id:"Middle East Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Beirut",supportsDaylightSavingTime:!0},{id:"Egypt Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Cairo",supportsDaylightSavingTime:!0},{id:"Syria Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Damascus",supportsDaylightSavingTime:!0},{id:"Israel Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Jerusalem",supportsDaylightSavingTime:!0},{id:"Arab Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kuwait, Riyadh",supportsDaylightSavingTime:!1},{id:"E. Africa Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Nairobi",supportsDaylightSavingTime:!1},{id:"Arabic Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Baghdad",supportsDaylightSavingTime:!0},{id:"Kaliningrad Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kaliningrad, Minsk",supportsDaylightSavingTime:!0},{id:"Iran Standard Time",offset:210,offsetHours:3.5,displayName:"(UTC+03:30) Tehran",supportsDaylightSavingTime:!0},{id:"Mauritius Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Port Louis",supportsDaylightSavingTime:!0},{id:"Georgian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Tbilisi",supportsDaylightSavingTime:!1},{id:"Caucasus Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Yerevan",supportsDaylightSavingTime:!0},{id:"Arabian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Abu Dhabi, Muscat",supportsDaylightSavingTime:!1},{id:"Azerbaijan Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Baku",supportsDaylightSavingTime:!0},{id:"Russian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Moscow, St. Petersburg, Volgograd",supportsDaylightSavingTime:!0},{id:"Afghanistan Standard Time",offset:270,offsetHours:4.5,displayName:"(UTC+04:30) Kabul",supportsDaylightSavingTime:!1},{id:"Pakistan Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Islamabad, Karachi",supportsDaylightSavingTime:!0},{id:"West Asia Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Ashgabat, Tashkent",supportsDaylightSavingTime:!1},{id:"India Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",supportsDaylightSavingTime:!1},{id:"Sri Lanka Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Sri Jayawardenepura",supportsDaylightSavingTime:!1},{id:"Nepal Standard Time",offset:345,offsetHours:5.75,displayName:"(UTC+05:45) Kathmandu",supportsDaylightSavingTime:!1},{id:"Central Asia Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Astana",supportsDaylightSavingTime:!1},{id:"Bangladesh Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Dhaka",supportsDaylightSavingTime:!0},{id:"Ekaterinburg Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Ekaterinburg",supportsDaylightSavingTime:!0},{id:"Myanmar Standard Time",offset:390,offsetHours:6.5,displayName:"(UTC+06:30) Yangon (Rangoon)",supportsDaylightSavingTime:!1},{id:"SE Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Bangkok, Hanoi, Jakarta",supportsDaylightSavingTime:!1},{id:"N. Central Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Novosibirsk",supportsDaylightSavingTime:!0},{id:"Ulaanbaatar Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Ulaanbaatar",supportsDaylightSavingTime:!1},{id:"China Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",supportsDaylightSavingTime:!1},{id:"Singapore Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Kuala Lumpur, Singapore",supportsDaylightSavingTime:!1},{id:"North Asia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Krasnoyarsk",supportsDaylightSavingTime:!0},{id:"Taipei Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Taipei",supportsDaylightSavingTime:!1},{id:"W. Australia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Perth",supportsDaylightSavingTime:!0},{id:"Korea Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Seoul",supportsDaylightSavingTime:!1},{id:"North Asia East Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Irkutsk",supportsDaylightSavingTime:!0},{id:"Tokyo Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Osaka, Sapporo, Tokyo",supportsDaylightSavingTime:!1},{id:"AUS Central Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Darwin",supportsDaylightSavingTime:!1},{id:"Cen. Australia Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Adelaide",supportsDaylightSavingTime:!0},{id:"West Pacific Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Guam, Port Moresby",supportsDaylightSavingTime:!1},{id:"Tasmania Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Hobart",supportsDaylightSavingTime:!0},{id:"E. Australia Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Brisbane",supportsDaylightSavingTime:!1},{id:"AUS Eastern Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Canberra, Melbourne, Sydney",supportsDaylightSavingTime:!0},{id:"Yakutsk Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Yakutsk",supportsDaylightSavingTime:!0},{id:"Vladivostok Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Vladivostok",supportsDaylightSavingTime:!0},{id:"Central Pacific Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Solomon Is., New Caledonia",supportsDaylightSavingTime:!1},{id:"Magadan Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Magadan",supportsDaylightSavingTime:!0},{id:"Kamchatka Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",supportsDaylightSavingTime:!0},{id:"Fiji Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Fiji",supportsDaylightSavingTime:!0},{id:"New Zealand Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Auckland, Wellington",supportsDaylightSavingTime:!0},{id:"UTC+12",offset:720,offsetHours:12,displayName:"(UTC+12:00) Coordinated Universal Time+12",supportsDaylightSavingTime:!1},{id:"Tonga Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Nuku'alofa",supportsDaylightSavingTime:!1},{id:"Samoa Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Samoa",supportsDaylightSavingTime:!0}],a=[0,31,59,90,120,151,181,212,243,273,304,334,365],s=[0,31,60,91,121,152,182,213,244,274,305,335,366];Smart.Utilities.Assign("TimeSpan",class{constructor(){const e=this;if(e.ticksPerMillisecond=1e4,e.millisecondsPerTick=1e-4,e.ticksPerSecond=1e7,e.secondsPerTick=1e-7,e.ticksPerMinute=6e8,e.minutesPerTick=1/6e8,e.ticksPerHour=36e9,e.hoursPerTick=1/36e9,e.ticksPerDay=864e9,e.daysPerTick=1/864e9,e.millisPerSecond=1e3,e.millisPerMinute=6e4,e.millisPerHour=36e5,e.millisPerDay=864e5,e._ticks=0,1===arguments.length){if(isNaN(arguments[0]))throw new Error("Argument must be a number.");e._ticks=arguments[0]}else if(3===arguments.length)e._ticks=e.timeToMS(arguments[0],arguments[1],arguments[2],0);else if(4===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+0;e._ticks=t*e.ticksPerMillisecond}else if(5===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+arguments[4];e._ticks=t*e.ticksPerMillisecond}}ticks(){return this._ticks}days(){return parseInt(this._ticks/this.ticksPerDay)}timeToMS(e,t,a,s){return parseInt((3600*e+60*t+a+s/1e3)*this.ticksPerSecond)}hours(){return parseInt(this._ticks/this.ticksPerHour)%24}milliseconds(){return parseInt(this._ticks/this.ticksPerMillisecond)%1e3}minutes(){return parseInt(this._ticks/this.ticksPerMinute)%60}seconds(){return parseInt(this._ticks/this.ticksPerSecond)%60}totalDays(){return parseInt(this._ticks*this.daysPerTick)}totalHours(){return parseInt(this._ticks*this.hoursPerTick)}totalMilliseconds(){const e=this._ticks*this.millisecondsPerTick;return parseInt(e)}totalMinutes(){return parseInt(this._ticks*this.minutesPerTick)}totalSeconds(){return parseInt(this._ticks*this.secondsPerTick)}add(e){const t=this._ticks+e._ticks;return new Smart.Utilities.TimeSpan(t)}subtract(e){const t=this._ticks-e._ticks;return new Smart.Utilities.TimeSpan(t)}duration(){const e=this;return e._ticks>=0?new Smart.Utilities.TimeSpan(e._ticks):new Smart.Utilities.TimeSpan(-e._ticks)}equals(e){return this._ticks===e._ticks}valueOf(){return this._ticks}compare(e,t){return e._ticks>t._ticks?1:e._ticks<t._ticks?-1:0}interval(e,t){const a=e*t+(e>=0?.5:-.5);return new Smart.Utilities.TimeSpan(a*this.ticksPerMillisecond)}fromDays(e){return this.interval(e,this.millisPerDay)}fromHours(e){return this.interval(e,this.millisPerHour)}fromMilliseconds(e){return this.interval(e,1)}fromMinutes(e){return this.interval(e,this.millisPerMinute)}fromSeconds(e){return this.interval(e,this.millisPerSecond)}fromTicks(e){return new Smart.Utilities.TimeSpan(e)}toString(){return this.totalMilliseconds().toString()}negate(){return new Smart.Utilities.TimeSpan(-this._ticks)}}),Smart.Utilities.Assign("DateTime",class{constructor(){function e(e){const t=i.regexISOString.exec(e);r=new Smart.Utilities.DateTime(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]),parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]),parseFloat(t[7]),0,0,0,0,0,0,0,"UTC")}const i=this;let r;if(i.ticksPerMillisecond=1e4,i.millisecondsPerTick=1e-4,i.ticksPerSecond=1e7,i.secondsPerTick=1e-7,i.ticksPerMinute=6e8,i.minutesPerTick=1/6e8,i.ticksPerHour=36e9,i.hoursPerTick=1/36e9,i.ticksPerDay=864e9,i.daysPerTick=1/864e9,i.millisPerSecond=1e3,i.millisPerMinute=6e4,i.millisPerHour=36e5,i.millisPerDay=864e5,i.daysPerYear=365,i.daysPer4Years=1461,i.daysPer100Years=36524,i.daysPer400Years=146097,i.daysTo1601=584388,i.daysTo1899=693593,i.daysTo10000=3652059,i.minTicks=0,i.maxTicks=3155378976e9,i.maxMillis=3155378976e5,i.datePartYear=0,i.datePartDayOfYear=1,i.datePartMonth=2,i.datePartDay=3,i.daysToMonth365=a,i.daysToMonth366=s,i.minValue=new Date(0),i.maxValue=new Date(3155378976e9),i.ticksMask=0x4000000000000000,i.flagsMask=0xc000000000000000,i.localMask=0x8000000000000000,i.ticksCeiling=0x4000000000000000,i.kindUnspecified=0,i.kindUtc=0x4000000000000000,i.kindLocal=0x8000000000000000,i.kindLocalAmbiguousDst=0xc000000000000000,i.kindShift=62,i.regexTrim=/^\s+|\s+$/g,i.regexInfinity=/^[+-]?infinity$/i,i.regexHex=/^0x[a-f0-9]+$/i,i.regexParseFloat=/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/,i.regexISOString=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})Z$/,i.calendar={"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",FP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",FPA:"yyyy/MM/dd HH:mm:ss:fffuunnppeeaaxxoo",FPA2:"yyyy-MM-dd HH:mm:ss:fffuunnppeeaaxxoo",FT:"HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",PP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp",PT:"HH:mm:ss:fff:uu:nn:pp"},percentsymbol:"%",currencysymbol:"$",currencysymbolposition:"before",decimalseparator:".",thousandsseparator:","},i.dateData=0,i.timeZone=null,i.timeZones=t,i._codeToUnit={u:"_microsecond",uu:"_microsecond",n:"_nanosecond",nn:"_nanosecond",p:"_picosecond",pp:"_picosecond",e:"_femtosecond",ee:"_femtosecond",a:"_attosecond",aa:"_attosecond",x:"_zeptosecond",xx:"_zeptosecond",o:"_yoctosecond",oo:"_yoctosecond"},i._smallUnits=["_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"],i._microsecond=0,i._nanosecond=0,i._picosecond=0,i._femtosecond=0,i._attosecond=0,i._zeptosecond=0,i._yoctosecond=0,0===arguments.length){const e=new Date;i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else if(1===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}}else if(2===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}i.validateTimeZone(arguments[1])}else if(arguments.length>2)if("string"==typeof arguments[0]){const e=i.tryparseDate(arguments[0],arguments[2],arguments[1]);i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else{const e=arguments[0],t=arguments[7]||0,a=arguments[8]||0,s=arguments[9]||0,r=arguments[10]||0,n=arguments[11]||0,o=arguments[12]||0,d=arguments[13]||0,l=new Date(e,arguments[1]-1,arguments[2],arguments[3]||0,arguments[4]||0,arguments[5]||0,arguments[6]||0);e<1970&&l.setFullYear(e),i.dateData=i.dateToMS(l.getFullYear(),l.getMonth()+1,l.getDate())+i.timeToMS(l.getHours(),l.getMinutes(),l.getSeconds(),l.getMilliseconds()),i._microsecond=t,i._nanosecond=a,i._picosecond=s,i._femtosecond=r,i._attosecond=n,i._zeptosecond=o,i._yoctosecond=d,arguments[14]&&i.validateTimeZone(arguments[14])}if(i.timeZone||i.validateTimeZone("Local"),r){const e=r.toTimeZone(i.timeZone);i.dateData=e.dateData}}static isValidDate(e){const t=this.validateDate(e);return!(!t||t&&!t.dateData)}static validateDate(e,t,a){if(e instanceof Smart.Utilities.DateTime)return e;if(e instanceof Date)return new Smart.Utilities.DateTime(e);try{if("string"==typeof e&&a)return this.parseDateString(e,t,a);if(new RegExp(/^\d{1,2}\/\d{1,2}\/\d{4}(, \d{1,2}:\d{2}:\d{1,2} [A|P]M)?$/).test(e)){const t=new Date(e);if(!isNaN(t.getTime()))return new Smart.Utilities.DateTime(t)}if("string"==typeof e)return this.parseDateString(e,t,a);if("number"==typeof e)return new Smart.Utilities.DateTime(new Date(e))}catch(e){}return t}static parseDateString(e,t,a){const s=new Date(e);if(!isNaN(s.getTime()))return e&&"string"==typeof e&&a?new Smart.Utilities.DateTime(e,a,null):new Smart.Utilities.DateTime(s);const i=e.indexOf("Date("),r=e.indexOf("DateTime("),n=e.lastIndexOf(")");let o=e;if(-1===i&&-1===r||-1===n){const t=new Smart.Utilities.DateTime,s=t.parseDate(e,a);if(s)return o=new Smart.Utilities.DateTime(s),t.copySmallTimePartValues(o),o}else{if(o=-1!==i?e.slice(i+5,n):e.slice(r+9,n),o=o.replace(/'/g,"").replace(/"/g,"").replace(/^\s+|\s+$|\s+(?=\s)/g,""),""===o.trim())return new Smart.Utilities.DateTime;if(new RegExp(/(^(\d+)(\s*,\s*\d+)+(\s*,\s*[a-zA-Z ]+)?$)/g).test(o))return o=o.split(","),o.map((function(e,t){isNaN(o[t])?o[t]=e.trim():o[t]=parseInt(e)})),-1!==i&&o[1]++,o.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,o)),o}if(""===o.trim())return t;if(!isNaN(o))return o=new Date(parseInt(o,10)),new Smart.Utilities.DateTime(o);try{const e=o.split(",");2===e.length?(e[1]=e[1].trim(),e.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,e))):o=new Smart.Utilities.DateTime(o)}catch(e){o=t}return o}static fromFullTimeStamp(e){e=e.toString();const t=new Smart.Utilities.DateTime(parseFloat(e.slice(0,e.length-21)));let a=e.slice(e.length-21),s=0;for(;a.length>0;)t[t._smallUnits[s]]=parseInt(a.slice(0,3),10),a=a.slice(3),s++;return t}static getConstructorParameters(e){return[e.year(),e.month(),e.day(),e.hour(),e.minute(),e.second(),e.millisecond(),e._microsecond,e._nanosecond,e._picosecond,e._femtosecond,e._attosecond,e._zeptosecond,e._yoctosecond,e.timeZone]}static detectDisplayMode(e,t,a){if(e.calendar.patterns[t])return-1!==["d","D","M","Y","d1","d2"].indexOf(t)?"calendar":-1!==["t","T","FT","PT"].indexOf(t)?"timePicker":"default";const s=["d","M","y"],i=["h","H","m","s","t","f","u","n","p","e","a","x","o"],r=a.groups;let n=!1,o=!1;for(let e=0;e<r.length;e++){const t=r[e].charAt(0);if(-1!==s.indexOf(t)?n=!0:-1!==i.indexOf(t)&&(o=!0),n&&o)break}return n===o?"default":n?"calendar":"timePicker"}static getLocalizedNames(e){const t={names:[],namesAbbr:[],namesShort:[]},a={names:[],namesAbbr:[]};if(this[e])return this[e];for(let a=23;a<30;a++){const s=new Date(2017,6,a),i=s.toLocaleString(e,{weekday:"long"});t.names.push(i),t.namesAbbr.push(s.toLocaleString(e,{weekday:"short"})),t.namesShort.push(i.substring(0,2))}for(let t=0;t<12;t++){const s=new Date(2017,t,1).toLocaleString(e,{month:"long"});a.names.push(s),a.namesAbbr.push(s.substring(0,3))}return a.names.push(""),a.namesAbbr.push(""),this[e]={days:t,months:a},this[e]}internalMS(){return this.dateData}getDatePart(e){const t=this,a=t.internalMS();let s=parseInt(a/t.millisPerDay);const i=parseInt(s/t.daysPer400Years);s-=i*t.daysPer400Years;let r=parseInt(s/t.daysPer100Years);4===r&&(r=3),s-=r*t.daysPer100Years;const n=parseInt(s/t.daysPer4Years);s-=n*t.daysPer4Years;let o=parseInt(s/t.daysPerYear);if(4===o&&(o=3),e===t.datePartYear)return parseInt(400*i+100*r+4*n+o+1);if(s-=o*t.daysPerYear,e===t.datePartDayOfYear)return parseInt(s+1);const d=3===o&&(24!==n||3===r)?t.daysToMonth366:t.daysToMonth365;let l=s>>6;for(;s>=d[l];)l++;return e===t.datePartMonth?parseInt(l):parseInt(s-d[l-1]+1)}dayOfWeek(){const e=this.dateData;return parseInt(e/this.millisPerDay+1)%7}dayOfYear(){return this.getDatePart(this.datePartDayOfYear)}weekOfYear(e){const t=this.toDate(),a=e||this.calendar.firstDay,s=new Date(t.getFullYear(),0,1),i=Math.floor((t.getTime()-s.getTime()-6e4*(t.getTimezoneOffset()-s.getTimezoneOffset()))/864e5)+1;let r,n=s.getDay()-a;if(n=n>=0?n:n+7,n<4){if(r=Math.floor((i+n-1)/7)+1,r>52){let e=new Date(t.getFullYear()+1,0,1).getDay()-a;e=e>=0?e:e+7,r=e<4?1:53}}else r=Math.floor((i+n-1)/7);return r}subtract(e){const t=this;return new Smart.Utilities.TimeSpan(t.dateData*t.ticksPerMillisecond-e.dateData*t.ticksPerMillisecond)}dateToMS(e,t,a){const s=this;if(e>=1&&e<=9999&&t>=1&&t<=12){e=parseInt(e);const i=s.isLeapYear(e)?s.daysToMonth366:s.daysToMonth365;if(a>=1&&a<=i[t]-i[t-1]){const r=e-1;return(365*r+parseInt(r/4)-parseInt(r/100)+parseInt(r/400)+i[t-1]+a-1)*s.millisPerDay}}}isLeapYear(e){if(e<1||e>9999)throw new Error("Year out of Range");return e%4==0&&(e%100!=0||e%400==0)}timeToMS(e,t,a,s){const i=this;if(e>=0&&e<24&&t>=0&&t<60&&a>=0&&a<60){const r=parseInt(3600*e+60*t+a);return s>0&&s<1e3?r*i.millisPerSecond+s:r*i.millisPerSecond}}daysInMonth(e,t){if(t<1||t>12)throw new Error("Month out of Range");const a=this,s=a.isLeapYear(e)?a.daysToMonth366:a.daysToMonth365;return s[t]-s[t-1]}arrayIndexOf(e,t){return e.indexOf(t)}startsWith(e,t){return 0===e.indexOf(t)}endsWith(e,t){return e.substr(e.length-t.length)===t}trim(e){return(e+"").replace(this.regexTrim,"")}expandFormat(e,t){t=t||"F";let a,s=e.patterns,i=t.length;if(s[t])return s[t];if(1===i){if(a=s[t],!a)throw"Invalid date format string '"+t+"'.";t=a}else 2===i&&"%"===t.charAt(0)&&(t=t.charAt(1));return t}getEra(e,t){if(!t)return 0;if("string"==typeof e)return 0;let a,s=e.getTime();for(let e=0,i=t.length;e<i;e++)if(a=t[e].start,null===a||s>=a)return e;return 0}toUpper(e){return e.split(" ").join(" ").toUpperCase()}toUpperArray(e){const t=[];for(let a=0,s=e.length;a<s;a++)t[a]=this.toUpper(e[a]);return t}getEraYear(e,t,a,s){let i=e.getFullYear();return!s&&t.eras&&(i-="number"==typeof a?a:t.eras[a].offset),i}getDayIndex(e,t,a){const s=this,i=e.days;let r,n=e._upperDays;return n||(e._upperDays=n=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr),s.toUpperArray(i.namesShort)]),t=t.toUpperCase(),a?(r=s.arrayIndexOf(n[1],t),-1===r&&(r=s.arrayIndexOf(n[2],t))):r=s.arrayIndexOf(n[0],t),r}getMonthIndex(e,t,a){const s=this;let i=e.months,r=e.monthsGenitive||e.months,n=e._upperMonths,o=e._upperMonthsGen;n||(e._upperMonths=n=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr)],e._upperMonthsGen=o=[s.toUpperArray(r.names),s.toUpperArray(r.namesAbbr)]),t=s.toUpper(t);let d=s.arrayIndexOf(a?n[1]:n[0],t);return d<0&&(d=s.arrayIndexOf(a?o[1]:o[0],t)),d}appendPreOrPostMatch(e,t){let a=0,s=!1;for(let i=0,r=e.length;i<r;i++){const r=e.charAt(i);switch(r){case"'":s?t.push("'"):a++,s=!1;break;case"\\":s&&t.push("\\"),s=!s;break;default:t.push(r),s=!1}}return a}getTokenRegExp(){return/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyyy|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|uu|u|nn|n|pp|p|ee|e|aa|a|xx|x|oo|o|i{1,24}|zzz|zz|z|gg|g/g}static ParseDate(e,t){return(new Smart.Utilities.DateTime).tryparseDate(e,null,t)}tryparseDate(e,t,a){const s=this;if(null==t&&(t=s.calendar),void 0!==a){if(Array.isArray(a))for(let i=0;i<a.length;i++){const r=s.parseDate(e,a[i],t);if(r)return r}const i=s.parseDate(e,a,t);if(i)return i}if(""===e)return null;if(null==e||e.substring||(e=e.toString()),null!=e&&"/Date("===e.substring(0,6)){const t=/^\/Date\((-?\d+)(\+|-)?(\d+)?\)\/$/;let a=new Date(+e.replace(/\/Date\((\d+)\)\//,"$1"));if("Invalid Date"===a){const t=e.match(/^\/Date\((\d+)([-+]\d\d)(\d\d)\)\/$/);a=null,t&&(a=new Date(1*t[1]+36e5*t[2]+6e4*t[3]))}if(null==a||"Invalid Date"===a||isNaN(a)){const a=t.exec(e);if(a){const e=new Date(parseInt(a[1]));if(a[2]){let t=parseInt(a[3]);"-"===a[2]&&(t=-t);const s=e.getUTCMinutes();e.setUTCMinutes(s-t)}if(!isNaN(e.valueOf()))return e}}return a}const i={smartdate:"yyyy-MM-dd HH:mm:ss",d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",d3:"MM-dd-yyyy",d4:"MM.dd.yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",custom3:"yyyy-MM-ddTHH:mm:ss.fff+HH:mm",custom4:"yyyy-MM-ddTHH:mm:ss.fff-HH:mm",custom5:"yyyy-MM-ddTHH:mm:ss.ffffff+HH:mm",custom6:"yyyy-MM-ddTHH:mm:ss.ffffff-HH:mm",iso:"yyyy-MM-ddTHH:mm:ssZ",iso2:"yyyy-MM-ddTHH:mm.fffZ",iso_date1:"yyyy-MM-dd",iso_date2:"yyyy-MM-dd",iso_date3:"yyyy-ddd",iso_date4:"yyyy-MM-dd HH:mm",iso_date5:"yyyy-MM-dd HH:mm Z",iso_date6:"yyyy-MMM-dd",iso_date7:"yyyy-MM",iso_date8:"yyyy-MMM",iso_date9:"yyyy-MMMM",iso_date10:"yyyy-MMMM-dd",iso_time1:"HH:mm:ss.tttt",iso_time2:"HH:mm:ss",iso_time3:"HH:mm",iso_time4:"HH",iso_time5:"yyyyyy-MM-dd",iso_time6:"yyyyyy-MM-dd",iso_time7:"dd/MM/yyyy HH:mm",iso_time8:"dd.MM.yyyy HH:mm",iso_time9:"dd-MM-yyyy HH:mm",iso_time10:"MM.dd.yyyy HH:mm",iso_time11:"MM-dd-yyyy HH:mm",iso_time12:"dd/MM/yyyy",iso_time13:"MM.dd.yyyy h:mm tt",iso_time14:"MM-dd-yyyy h:mm tt",iso_time15:"MM/dd/yyyy h:mm tt"};for(let a in i){const r=s.parseDate(e,i[a],t);if(r)return r}const r=t.patterns;for(let a in r){const i=s.parseDate(e,r[a],t);if(i){if("ISO"===a){const a=s.parseDate(e,r.ISO2,t);if(a)return a}return i}}let n;if("string"==typeof e){const a=[":","/","-"," ",","];let i="",r=e=function(e,t,a){return a.replace(new RegExp(e,"g"),t)}(", ",",",e=s.trim(e));e.indexOf(":")>=0?(i=e.substring(e.indexOf(":")-2),i=s.trim(i),r=e.substring(0,e.indexOf(":")-2)):e.toUpperCase().indexOf("AM")>=0?(i=e.substring(e.toUpperCase().indexOf("AM")-2),i=s.trim(i),r=e.substring(0,e.toUpperCase().indexOf("AM")-2)):e.toUpperCase().indexOf("PM")>=0&&(i=e.substring(e.toUpperCase().indexOf("PM")-2),i=s.trim(i),r=e.substring(0,e.toUpperCase().indexOf("PM")-2));let o=new Date,d=!1;if(r){for(let e=0;e<a.length;e++)if(r.indexOf(a[e])>=0){n=r.split(a[e]);break}if(!n)return null;let e=new Array,i=new Array,l=new Array,f=null,m=null;for(let a=0;a<n.length;a++){const i=n[a],r=s.parseDate(i,"d",t)||s.parseDate(i,"dd",t)||s.parseDate(i,"ddd",t)||s.parseDate(i,"dddd",t);if(r&&(e.push(r.getDate()),i.length>2)){f=a;break}}for(let e=0;e<n.length;e++){const a=n[e],r=s.parseDate(a,"M",t)||s.parseDate(a,"MM",t)||s.parseDate(a,"MMM",t)||s.parseDate(a,"MMMM",t);if(r){if(null!=f&&f===e)continue;if(i.push(r.getMonth()),a.length>2){m=e;break}}}for(let e=0;e<n.length;e++){const a=n[e],i=s.parseDate(a,"yyyy",t);if(i){if(null!=f&&f===e)continue;if(null!=m&&m===e)continue;l.push(i.getFullYear())}}const c=new Array;for(let t=e.length-1;t>=0;t--)for(let a=0;a<i.length;a++)for(let s=0;s<l.length;s++){const r=new Date(l[s],i[a],e[t]);l[s]<1970&&r.setFullYear(l[s]),isNaN(r.getTime())||c.push(r)}c.length>0&&(o=c[0],d=!0)}if(i){const e=i.indexOf(":")>=0?i.split(":"):i,a=s.parseDate(i,"h:mm tt",t)||s.parseDate(i,"HH:mm:ss.fff",t)||s.parseDate(i,"HH:mm:ss.ff",t)||s.parseDate(i,"h:mm:ss tt",t)||s.parseDate(i,"HH:mm:ss.tttt",t)||s.parseDate(i,"HH:mm:ss",t)||s.parseDate(i,"HH:mm",t)||s.parseDate(i,"HH",t);let r=0,n=0,l=0,f=0;a&&!isNaN(a.getTime())?(r=a.getHours(),n=a.getMinutes(),l=a.getSeconds(),f=a.getMilliseconds()):(1===e.length&&(r=parseInt(e[0])),2===e.length&&(r=parseInt(e[0]),n=parseInt(e[1])),3===e.length&&(r=parseInt(e[0]),n=parseInt(e[1]),e[2].indexOf(".")>=0?(l=parseInt(e[2].toString().split(".")[0]),f=parseInt(e[2].toString().split(".")[1])):l=parseInt(e[2])),4===e.length&&(r=parseInt(e[0]),n=parseInt(e[1]),l=parseInt(e[2]),f=parseInt(e[3]))),!o||isNaN(r)||isNaN(n)||isNaN(l)||isNaN(f)||(o.setHours(r,n,l,f),d=!0)}if(d)return o}if(null!=e){n=[":","/","-"];let t=!0;for(let a=0;a<n.length;a++)-1!==e.indexOf(n[a])&&(t=!1);if(t){const t=new Number(e);if(!isNaN(t))return new Date(t)}}return null}getParseRegExp(e,t){const a=this;let s=e._parseRegExp;if(s){const e=s[t];if(e)return e}else e._parseRegExp=s={};let i,r=a.expandFormat(e,t).replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1"),n=["^"],o=[],d=0,l=0,f=a.getTokenRegExp();for(;null!==(i=f.exec(r));){const e=r.slice(d,i.index);if(d=f.lastIndex,l+=a.appendPreOrPostMatch(e,n),l%2){n.push(i[0]);continue}let t,s=i[0],m=s.length;switch(s){case"dddd":case"ddd":case"MMMM":case"MMM":case"gg":case"g":t="(\\D+)";break;case"tt":case"t":t="(\\D*)";break;case"yyyyy":t="(\\d{1,4})";break;case"yyyy":t="(\\d{"+m+"})";break;case"fff":case"ff":case"f":t="(\\d{1,"+m+"})";break;case"dd":case"d":case"MM":case"M":case"yy":case"y":case"HH":case"H":case"hh":case"h":case"mm":case"m":case"ss":case"s":t="(\\d\\d?)";break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":t="(\\d{1,3})";break;case"zzz":t="([+-]?\\d\\d?:\\d{2})";break;case"zz":case"z":t="([+-]?\\d\\d?)";break;case"/":t="/";break;default:if(!/i{1,24}/.test(s))throw"Invalid date format pattern '"+s+"'.";t="(\\d{"+s.length+"})"}t&&n.push(t),"/"!==s&&o.push(i[0])}a.appendPreOrPostMatch(r.slice(d),n),n.push("$");const m={regExp:n.join("").replace(/\s+/g,"\\s+"),groups:o};return s[t]=m}outOfRange(e,t,a){return e<t||e>a}expandYear(e,t){const a=this,s=new Date,i=a.getEra(s);if(t<100){let r=e.twoDigitYearMax;r="string"==typeof r?(new Date).getFullYear()%100+parseInt(r,10):r;const n=a.getEraYear(s,e,i);(t+=n-n%100)>r&&(t-=100)}return t}padZeros(e,t){let a,s=e+"";return t>1&&s.length<t?(a=["0","00","000"][t-2]+s,a.substr(a.length-t,t)):(a=s,a)}parseDate(e,t,a){const s=this;null==a&&(a=s.calendar),e=s.trim(e);const i=a,r=s.getParseRegExp(i,t),n=new RegExp(r.regExp).exec(e);if(null===n)return null;let o,d=r.groups,l=null,f=null,m=null,c=null,u=null,p=0,y=0,g=0,h=0,T=null,M=!1;for(let e=0,t=d.length;e<t;e++){const t=n[e+1];if(t){const a=d[e],r=a.length,n=parseInt(t,10);switch(a){case"dd":case"d":if(c=n,s.outOfRange(c,1,31))return null;break;case"MMM":case"MMMM":case"MMMMM":case"MMMMMM":case"MMMMMMM":case"MMMMMMMM":if(m=s.getMonthIndex(i,t,3===r),s.outOfRange(m,0,11))return null;break;case"M":case"MM":if(m=n-1,s.outOfRange(m,0,11))return null;break;case"y":case"yy":case"yyyy":if(f=r<4?s.expandYear(i,n):n,s.outOfRange(f,0,9999))return null;break;case"h":case"hh":if(p=n,12===p&&(p=0),s.outOfRange(p,0,11))return null;break;case"H":case"HH":if(p=n,s.outOfRange(p,0,23))return null;break;case"m":case"mm":if(y=n,s.outOfRange(y,0,59))return null;break;case"s":case"ss":if(g=n,s.outOfRange(g,0,59))return null;break;case"tt":case"t":if(M=i.PM&&(t===i.PM[0]||t===i.PM[1]||t===i.PM[2]),!M&&(!i.AM||t!==i.AM[0]&&t!==i.AM[1]&&t!==i.AM[2]))return null;break;case"f":case"ff":case"fff":if(h=n*Math.pow(10,3-r),s.outOfRange(h,0,999))return null;break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":if(s.outOfRange(n,0,1e3))return null;s[s._codeToUnit[a]]=n;break;case"ddd":case"dddd":if(u=s.getDayIndex(i,t,3===r),s.outOfRange(u,0,6))return null;break;case"zzz":{const e=t.split(/:/);if(2!==e.length)return null;if(o=parseInt(e[0],10),s.outOfRange(o,-12,13))return null;const a=parseInt(e[1],10);if(s.outOfRange(a,0,59))return null;T=60*o+(s.startsWith(t,"-")?-a:a);break}case"z":case"zz":if(o=n,s.outOfRange(o,-12,13))return null;T=60*o;break;case"g":case"gg":{let e=t;if(!e||!i.eras)return null;e=this.trim(e.toLowerCase());for(let t=0,a=i.eras.length;t<a;t++)if(e===i.eras[t].nathat.toLowerCase()){l=t;break}if(null===l)return null;break}default:{let e=t;e.length%3==1?e+="00":e.length%3==2&&(e+="0"),h=parseInt(e.slice(0,3),10),e=e.slice(3);let a=0;for(;e.length>0;)s[s._smallUnits[a]]=parseInt(e.slice(0,3),10),e=e.slice(3),a++}}}}let S,D=new Date,H=i.convert;if(S=D.getFullYear(),null===f?f=S:i.eras&&(f+=i.eras[l||0].offset),null===m&&(m=0),null===c&&(c=1),H){if(D=H.toGregorian(f,m,c),null===D)return null}else{if(D.setFullYear(f,m,c),D.getDate()!==c)return null;if(null!==u&&D.getDay()!==u)return null}if(M&&p<12&&(p+=12),D.setHours(p,y,g,h),null!==T){const e=D.getMinutes()-(T+D.getTimezoneOffset());D.setHours(D.getHours()+parseInt(e/60,10),e%60)}return D}toString(e,t){const a=this;void 0===e&&(e="yyyy-MM-dd HH:mm:ss");const s=a.dateData.toString()+a.getFractionsOfSecondStamp()+e+(a.timeZone||"");if(Smart.Utilities.DateTime.cache&&Smart.Utilities.DateTime.cache[s]&&!1!==a.showTodayDateAsString)return Smart.Utilities.DateTime.cache[s];const i=a.toDate();if(null==t&&(t=a.calendar),"string"==typeof i)return i;if(!e||!e.length||"i"===e){let e;return e=a.formatDate(i,t.patterns.F,t),e}const r=t.eras,n="s"===e;e=a.expandFormat(t,e);const o=[];let d,l=0,f=a.getTokenRegExp();function m(e,t){if(void 0!==e.getMonth)switch(t){case 0:return e.getFullYear();case 1:return e.getMonth();case 2:return e.getDate()}}for(;;){const s=f.lastIndex,c=f.exec(e),u=e.slice(s,c?c.index:e.length);if(l+=a.appendPreOrPostMatch(u,o),!c)break;if(l%2){o.push(c[0]);continue}const p=c[0],y=p.length;let g;if(/i{1,24}/.test(p))o.push(a.getFirstNDigitsOfPrecision(p.length));else switch(p){case"ddd":case"dddd":{const e=3===y?t.days.namesAbbr:t.days.names;o.push(e[i.getDay()]);break}case"d":case"dd":o.push(a.padZeros(m(i,2),y));break;case"MMM":case"MMMM":g=m(i,1),o.push(t.months[3===y?"namesAbbr":"names"][g]);break;case"M":case"MM":o.push(a.padZeros(m(i,1)+1,y));break;case"y":case"yy":case"yyyy":g=a.getEraYear(i,t,a.getEra(i,r),n),y<4&&(g%=100),o.push(a.padZeros(g,y));break;case"h":case"hh":d=i.getHours()%12,0===d&&(d=12),o.push(a.padZeros(d,y));break;case"H":case"HH":o.push(a.padZeros(i.getHours(),y));break;case"m":case"mm":o.push(a.padZeros(i.getMinutes(),y));break;case"s":case"ss":o.push(a.padZeros(i.getSeconds(),y));break;case"t":case"tt":g=i.getHours()<12?t.AM?t.AM[0]:" ":t.PM?t.PM[0]:" ",o.push(1===y?g.charAt(0):g);break;case"f":case"ff":case"fff":o.push(a.padZeros(i.getMilliseconds(),3).substr(0,y));break;case"u":case"n":case"p":case"e":case"a":case"x":case"o":o.push(a[a._codeToUnit[p]]);break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":o.push(a.padZeros(a[a._codeToUnit[p]],3));break;case"z":case"zz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),y));break;case"zzz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),2)+":"+a.padZeros(60*Math.abs(a.timeZoneOffsetHours%1),2));break;case"g":case"gg":t.eras&&o.push(t.eras[a.getEra(i,r)].name);break;case"/":o.push(t["/"]);break;default:throw"Invalid date format pattern '"+p+"'."}}let c=o.join("");if(Smart.Utilities.DateTime.cache||(Smart.Utilities.DateTime.cache=new Array),a._today||(a._today=new Date),a.calendar&&a.calendar.today&&-1===e.indexOf(":")&&i.getFullYear()===a._today.getFullYear()&&i.getDate()===a._today.getDate()&&i.getMonth()===a._today.getMonth()){if(!1===a.showTodayDateAsString)return Smart.Utilities.DateTime.cache[s]=c,c;c=a.calendar.today}return Smart.Utilities.DateTime.cache[s]=c,c}getFractionsOfSecondStamp(){const e=this;return e._microsecond.toString()+e._nanosecond+e._picosecond+e._femtosecond+e._attosecond+e._zeptosecond+e._yoctosecond}getFirstNDigitsOfPrecision(e,t){const a=this;return(""+(!0!==t?a.padZeros(a.millisecond(),3):"")+a.padZeros(a._microsecond,3)+a.padZeros(a._nanosecond,3)+a.padZeros(a._picosecond,3)+a.padZeros(a._femtosecond,3)+a.padZeros(a._attosecond,3)+a.padZeros(a._zeptosecond,3)+a.padZeros(a._yoctosecond,3)).slice(0,e)}copySmallTimePartValues(e){const t=this;e._microsecond=t._microsecond,e._nanosecond=t._nanosecond,e._picosecond=t._picosecond,e._femtosecond=t._femtosecond,e._attosecond=t._attosecond,e._zeptosecond=t._zeptosecond,e._yoctosecond=t._yoctosecond}add(e,t,a){const s=this,i=s.internalMS();if(void 0===t){if(!1===a)return s.dateData=i+parseInt(e._ticks/s.ticksPerMillisecond),s;const t=new Smart.Utilities.DateTime(i+parseInt(e._ticks/s.ticksPerMillisecond));return s.copyTimeZone(t),s.copySmallTimePartValues(t),t}const r=e*t;if(r<=-s.maxMillis||r>=s.maxMillis)throw new Error("Out of Range");if(!1===a)return s.dateData=i+r,s;const n=new Smart.Utilities.DateTime(i+r);return s.copyTimeZone(n),s.copySmallTimePartValues(n),n}addDays(e,t){return this.add(e,this.millisPerDay,t)}clone(){const e=this,t=new Smart.Utilities.DateTime(e.dateData);return e.copyTimeZone(t),e.copySmallTimePartValues(t),t}clearTime(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s,0,0,0,0);return e.copyTimeZone(i),i}addHours(e,t){return this.add(e,this.millisPerHour,t)}addDeciseconds(e,t){return this.add(100*e,1,t)}addCentiseconds(e,t){return this.add(10*e,1,t)}addMilliseconds(e,t){return this.add(e,1,t)}addMinutes(e,t){return this.add(e,this.millisPerMinute,t)}addMonths(e,t){const a=this;if(e<-12e4||e>12e4)throw new Error("Invalid Months Value");let s=parseInt(a.getDatePart(a.datePartYear)),i=parseInt(a.getDatePart(a.datePartMonth)),r=parseInt(a.getDatePart(a.datePartDay));if(e%12==0)s+=e/12;else{const t=i-1+e;t>=0?(i=t%12+1,s+=t/12):(i=12+(t+1)%12,s+=(t-11)/12),s=parseInt(s)}if(s<1||s>9999)throw new Error("Year out of range");const n=a.daysInMonth(s,i);if(r>n&&(r=n),!1===t)return a.dateData=a.dateToMS(s,i,r)+a.internalMS()%a.millisPerDay,a;const o=new Smart.Utilities.DateTime(a.dateToMS(s,i,r)+a.internalMS()%a.millisPerDay);return a.copyTimeZone(o),a.copySmallTimePartValues(o),o}addSeconds(e,t){return this.add(e,this.millisPerSecond,t)}addYears(e,t){return this.addMonths(12*e,t)}addMicroseconds(e,t){if(0===e)return;const a=this;let s,i;e<0&&0===a.hour()&&0===a.minute()&&0===a.second()&&0===a.millisecond()&&0===a._microsecond&&(s=parseInt(e/1e3,10)-1,i=1e3+e%1e3);const r=1e3*a.timeToMS(a.hour(),a.minute(),a.second(),a.millisecond())+a._microsecond,n=r+e;let o;if(void 0===s&&(s=parseInt(n/1e3,10)-parseInt(r/1e3,10)),void 0===i&&(i=parseInt(n%1e3,10)),0!==s&&(o=a.addMilliseconds(s,t)),!1!==t)return o||(o=a.clone()),o._microsecond=i,o;a._microsecond=i}addFractionsOfSecond(e,t,a,s,i){if(0===e)return;const r=this,n=1e3*r[s]+r[a],o=e+n;let d,l=parseInt(o/1e3,10)-parseInt(n/1e3,10),f=parseInt(o%1e3,10);if(e<0&&o<0&&f<0&&(l--,f=1e3+f),0!==l&&(d=r[i](l,t)),!1!==t)return d||(d=r.clone()),d[a]=f,d;r[a]=f}addNanoseconds(e,t){return this.addFractionsOfSecond(e,t,"_nanosecond","_microsecond","addMicroseconds")}addPicoseconds(e,t){return this.addFractionsOfSecond(e,t,"_picosecond","_nanosecond","addNanoseconds")}addFemtoseconds(e,t){return this.addFractionsOfSecond(e,t,"_femtosecond","_picosecond","addPicoseconds")}addAttoseconds(e,t){return this.addFractionsOfSecond(e,t,"_attosecond","_femtosecond","addFemtoseconds")}addZeptoseconds(e,t){return this.addFractionsOfSecond(e,t,"_zeptosecond","_attosecond","addAttoseconds")}addYoctoseconds(e,t){return this.addFractionsOfSecond(e,t,"_yoctosecond","_zeptosecond","addZeptoseconds")}getTimeZoneOffset(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1),s=e.getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset());return{offset:-e.getTimezoneOffset()/60,dst:+s}}isInDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return this.date().getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset())}supportsDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return t.getTimezoneOffset()!==a.getTimezoneOffset()}date(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s);return e.copyTimeZone(i),i}isWeekend(){return 0===this.dayOfWeek()||6===this.dayOfWeek()}toDate(e){const t=this,a=t.month(),s=t.year(),i=t.day(),r=t.hour(),n=t.minute(),o=t.second(),d=t.millisecond();let l=new Date(s,a-1,i);if(s<1970&&l.setFullYear(s),l.setHours(r,n,o,d),e){const a=t.timeZones.filter((function(t){return t.id===e}));if(a.length){let e=a[0].offset;const s=l.getTime();let i=60*l.getTimezoneOffset()*1e3;if(t.timeZone){const e=t.timeZones.filter((function(e){return e.id===t.timeZone}));e.length&&(i=60*-e[0].offset*1e3)}l=new Date(s+i+6e4*e)}}return l}toTimeZone(e){const t=this;let a=e;if(null==a&&(a="Local"),t.timeZone===a)return t.clone();const s=t.timeZones.filter((function(e){return e.id===a}));if(0===s.length)return t.clone();const i=this.toDate(a),r=new Smart.Utilities.DateTime(i);return r.timeZone=a,r.timeZoneOffset=s[0].offset,r.timeZoneOffsetHours=s[0].offsetHours,t.copySmallTimePartValues(r),r}day(){return this.getDatePart(this.datePartDay)}month(){return this.getDatePart(this.datePartMonth)}year(){return this.getDatePart(this.datePartYear)}millisecond(){return parseInt(this.internalMS()%1e3)}hour(){return parseInt(Math.floor(this.internalMS()/this.millisPerHour)%24)}minute(){return parseInt(this.internalMS()/this.millisPerMinute%60)}second(){return parseInt(this.internalMS()/this.millisPerSecond%60)}microsecond(){return this._microsecond}nanosecond(){return this._nanosecond}picosecond(){return this._picosecond}femtosecond(){return this._femtosecond}attosecond(){return this._attosecond}zeptosecond(){return this._zeptosecond}yoctosecond(){return this._yoctosecond}valueOf(){return this.dateData}equals(e){const t=this;return t.dateData===e.dateData&&t._microsecond===e._microsecond&&t._nanosecond===e._nanosecond&&t._picosecond===e._picosecond&&t._femtosecond===e._femtosecond&&t._attosecond===e._attosecond&&t._zeptosecond===e._zeptosecond&&t._yoctosecond===e._yoctosecond}equalDateParts(e){const t=this;return t.year()===e.year()&&t.month()===e.month()&&t.day()===e.day()}compare(e){const t=this;if(t.equals(e))return 0;const a=["dateData","_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"];for(let s=0;s<a.length;s++){const i=a[s];if(t[i]>e[i])return 1;if(t[i]<e[i])return-1}return 0}toDateString(){return this.toDate().toDateString()}toLocaleDateString(){return this.toDate().toLocaleDateString(this.calendar.locale)}toLocaleString(){return this.toDate().toLocaleString(this.calendar.locale)}toLocaleTimeString(){return this.toDate().toLocaleTimeString(this.calendar.locale)}validateTimeZone(e){const t=this;if("string"!=typeof e)return;const a=t.timeZones.filter((function(t){return t.id===e}));0!==a.length&&(t.timeZone=e,t.timeZoneOffset=a[0].offset,t.timeZoneOffsetHours=a[0].offsetHours)}copyTimeZone(e){const t=this;e.timeZone=t.timeZone,e.timeZoneOffset=t.timeZoneOffset,e.timeZoneOffsetHours=t.timeZoneOffsetHours}getTimeStamp(){return new Smart.Utilities.BigNumber(this.dateData.toString()+this.getFirstNDigitsOfPrecision(void 0,!0))}})})();
|
|
108
|
+
(()=>{const e=-1*(new Date).getTimezoneOffset(),t=[{id:"Local",offset:e,offsetHours:e/60,displayName:"",supportsDaylightSavingTime:!1},{id:"Dateline Standard Time",offset:-720,offsetHours:-12,displayName:"(UTC-12:00) International Date Line West",supportsDaylightSavingTime:!1},{id:"UTC-11",offset:-660,offsetHours:-11,displayName:"(UTC-11:00) Coordinated Universal Time-11",supportsDaylightSavingTime:!1},{id:"Hawaiteratoran Standard Time",offset:-600,offsetHours:-10,displayName:"(UTC-10:00) Hawaiterator",supportsDaylightSavingTime:!1},{id:"Alaskan Standard Time",offset:-540,offsetHours:-9,displayName:"(UTC-09:00) Alaska",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time (Mexico)",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Baja California",supportsDaylightSavingTime:!0},{id:"Pacific Standard Time",offset:-480,offsetHours:-8,displayName:"(UTC-08:00) Pacific Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Arizona",supportsDaylightSavingTime:!1},{id:"Mountain Standard Time (Mexico)",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",supportsDaylightSavingTime:!0},{id:"Mountain Standard Time",offset:-420,offsetHours:-7,displayName:"(UTC-07:00) Mountain Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"Central America Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Central America",supportsDaylightSavingTime:!1},{id:"Canada Central Standard Time",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Saskatchewan",supportsDaylightSavingTime:!1},{id:"Central Standard Time (Mexico)",offset:-360,offsetHours:-6,displayName:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",supportsDaylightSavingTime:!0},{id:"SA Pacific Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Bogota, Lima, Quito, Rio Branco",supportsDaylightSavingTime:!1},{id:"Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Eastern Time (US & Canada)",supportsDaylightSavingTime:!0},{id:"US Eastern Standard Time",offset:-300,offsetHours:-5,displayName:"(UTC-05:00) Indiana (East)",supportsDaylightSavingTime:!0},{id:"Venezuela Standard Time",offset:-270,offsetHours:-4.5,displayName:"(UTC-04:30) Caracas",supportsDaylightSavingTime:!1},{id:"Atlantic Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Atlantic Time (Canada)",supportsDaylightSavingTime:!0},{id:"Paraguay Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Asuncion",supportsDaylightSavingTime:!0},{id:"Central Brazilian Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Cuiaba",supportsDaylightSavingTime:!0},{id:"Pacific SA Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Santiago",supportsDaylightSavingTime:!0},{id:"SA Western Standard Time",offset:-240,offsetHours:-4,displayName:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",supportsDaylightSavingTime:!1},{id:"Newfoundland Standard Time",offset:-210,offsetHours:-3.5,displayName:"(UTC-03:30) Newfoundland",supportsDaylightSavingTime:!0},{id:"SA Eastern Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Cayenne, Fortaleza",supportsDaylightSavingTime:!1},{id:"Argentina Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Buenos Aires",supportsDaylightSavingTime:!0},{id:"E. South America Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Brasilia",supportsDaylightSavingTime:!0},{id:"Bahia Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Salvador",supportsDaylightSavingTime:!0},{id:"Montevideo Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Montevideo",supportsDaylightSavingTime:!0},{id:"Greenland Standard Time",offset:-180,offsetHours:-3,displayName:"(UTC-03:00) Greenland",supportsDaylightSavingTime:!0},{id:"UTC-02",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Coordinated Universal Time-02",supportsDaylightSavingTime:!1},{id:"Mid-Atlantic Standard Time",offset:-120,offsetHours:-2,displayName:"(UTC-02:00) Mid-Atlantic - Old",supportsDaylightSavingTime:!0},{id:"Azores Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Azores",supportsDaylightSavingTime:!0},{id:"Cape Verde Standard Time",offset:-60,offsetHours:-1,displayName:"(UTC-01:00) Cape Verde Is.",supportsDaylightSavingTime:!1},{id:"Morocco Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Casablanca",supportsDaylightSavingTime:!0},{id:"UTC",offset:0,offsetHours:0,displayName:"(UTC) Coordinated Universal Time",supportsDaylightSavingTime:!1},{id:"GMT Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Dublin, Edinburgh, Lisbon, London",supportsDaylightSavingTime:!0},{id:"Greenwich Standard Time",offset:0,offsetHours:0,displayName:"(UTC) Monrovia, Reykjavik",supportsDaylightSavingTime:!1},{id:"Central European Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",supportsDaylightSavingTime:!0},{id:"Namibia Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Windhoek",supportsDaylightSavingTime:!0},{id:"W. Central Africa Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) West Central Africa",supportsDaylightSavingTime:!1},{id:"W. Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",supportsDaylightSavingTime:!0},{id:"Central Europe Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",supportsDaylightSavingTime:!0},{id:"Romance Standard Time",offset:60,offsetHours:1,displayName:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",supportsDaylightSavingTime:!0},{id:"FLE Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",supportsDaylightSavingTime:!0},{id:"South Africa Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Harare, Pretoria",supportsDaylightSavingTime:!1},{id:"Turkey Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Istanbul",supportsDaylightSavingTime:!0},{id:"GTB Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Athens, Bucharest",supportsDaylightSavingTime:!0},{id:"Libya Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Tripoli",supportsDaylightSavingTime:!0},{id:"E. Europe Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) E. Europe",supportsDaylightSavingTime:!0},{id:"Jordan Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Amman",supportsDaylightSavingTime:!0},{id:"Middle East Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Beirut",supportsDaylightSavingTime:!0},{id:"Egypt Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Cairo",supportsDaylightSavingTime:!0},{id:"Syria Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Damascus",supportsDaylightSavingTime:!0},{id:"Israel Standard Time",offset:120,offsetHours:2,displayName:"(UTC+02:00) Jerusalem",supportsDaylightSavingTime:!0},{id:"Arab Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kuwait, Riyadh",supportsDaylightSavingTime:!1},{id:"E. Africa Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Nairobi",supportsDaylightSavingTime:!1},{id:"Arabic Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Baghdad",supportsDaylightSavingTime:!0},{id:"Kaliningrad Standard Time",offset:180,offsetHours:3,displayName:"(UTC+03:00) Kaliningrad, Minsk",supportsDaylightSavingTime:!0},{id:"Iran Standard Time",offset:210,offsetHours:3.5,displayName:"(UTC+03:30) Tehran",supportsDaylightSavingTime:!0},{id:"Mauritius Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Port Louis",supportsDaylightSavingTime:!0},{id:"Georgian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Tbilisi",supportsDaylightSavingTime:!1},{id:"Caucasus Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Yerevan",supportsDaylightSavingTime:!0},{id:"Arabian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Abu Dhabi, Muscat",supportsDaylightSavingTime:!1},{id:"Azerbaijan Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Baku",supportsDaylightSavingTime:!0},{id:"Russian Standard Time",offset:240,offsetHours:4,displayName:"(UTC+04:00) Moscow, St. Petersburg, Volgograd",supportsDaylightSavingTime:!0},{id:"Afghanistan Standard Time",offset:270,offsetHours:4.5,displayName:"(UTC+04:30) Kabul",supportsDaylightSavingTime:!1},{id:"Pakistan Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Islamabad, Karachi",supportsDaylightSavingTime:!0},{id:"West Asia Standard Time",offset:300,offsetHours:5,displayName:"(UTC+05:00) Ashgabat, Tashkent",supportsDaylightSavingTime:!1},{id:"India Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",supportsDaylightSavingTime:!1},{id:"Sri Lanka Standard Time",offset:330,offsetHours:5.5,displayName:"(UTC+05:30) Sri Jayawardenepura",supportsDaylightSavingTime:!1},{id:"Nepal Standard Time",offset:345,offsetHours:5.75,displayName:"(UTC+05:45) Kathmandu",supportsDaylightSavingTime:!1},{id:"Central Asia Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Astana",supportsDaylightSavingTime:!1},{id:"Bangladesh Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Dhaka",supportsDaylightSavingTime:!0},{id:"Ekaterinburg Standard Time",offset:360,offsetHours:6,displayName:"(UTC+06:00) Ekaterinburg",supportsDaylightSavingTime:!0},{id:"Myanmar Standard Time",offset:390,offsetHours:6.5,displayName:"(UTC+06:30) Yangon (Rangoon)",supportsDaylightSavingTime:!1},{id:"SE Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Bangkok, Hanoi, Jakarta",supportsDaylightSavingTime:!1},{id:"N. Central Asia Standard Time",offset:420,offsetHours:7,displayName:"(UTC+07:00) Novosibirsk",supportsDaylightSavingTime:!0},{id:"Ulaanbaatar Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Ulaanbaatar",supportsDaylightSavingTime:!1},{id:"China Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",supportsDaylightSavingTime:!1},{id:"Singapore Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Kuala Lumpur, Singapore",supportsDaylightSavingTime:!1},{id:"North Asia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Krasnoyarsk",supportsDaylightSavingTime:!0},{id:"Taipei Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Taipei",supportsDaylightSavingTime:!1},{id:"W. Australia Standard Time",offset:480,offsetHours:8,displayName:"(UTC+08:00) Perth",supportsDaylightSavingTime:!0},{id:"Korea Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Seoul",supportsDaylightSavingTime:!1},{id:"North Asia East Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Irkutsk",supportsDaylightSavingTime:!0},{id:"Tokyo Standard Time",offset:540,offsetHours:9,displayName:"(UTC+09:00) Osaka, Sapporo, Tokyo",supportsDaylightSavingTime:!1},{id:"AUS Central Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Darwin",supportsDaylightSavingTime:!1},{id:"Cen. Australia Standard Time",offset:570,offsetHours:9.5,displayName:"(UTC+09:30) Adelaide",supportsDaylightSavingTime:!0},{id:"West Pacific Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Guam, Port Moresby",supportsDaylightSavingTime:!1},{id:"Tasmania Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Hobart",supportsDaylightSavingTime:!0},{id:"E. Australia Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Brisbane",supportsDaylightSavingTime:!1},{id:"AUS Eastern Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Canberra, Melbourne, Sydney",supportsDaylightSavingTime:!0},{id:"Yakutsk Standard Time",offset:600,offsetHours:10,displayName:"(UTC+10:00) Yakutsk",supportsDaylightSavingTime:!0},{id:"Vladivostok Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Vladivostok",supportsDaylightSavingTime:!0},{id:"Central Pacific Standard Time",offset:660,offsetHours:11,displayName:"(UTC+11:00) Solomon Is., New Caledonia",supportsDaylightSavingTime:!1},{id:"Magadan Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Magadan",supportsDaylightSavingTime:!0},{id:"Kamchatka Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",supportsDaylightSavingTime:!0},{id:"Fiji Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Fiji",supportsDaylightSavingTime:!0},{id:"New Zealand Standard Time",offset:720,offsetHours:12,displayName:"(UTC+12:00) Auckland, Wellington",supportsDaylightSavingTime:!0},{id:"UTC+12",offset:720,offsetHours:12,displayName:"(UTC+12:00) Coordinated Universal Time+12",supportsDaylightSavingTime:!1},{id:"Tonga Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Nuku'alofa",supportsDaylightSavingTime:!1},{id:"Samoa Standard Time",offset:780,offsetHours:13,displayName:"(UTC+13:00) Samoa",supportsDaylightSavingTime:!0}],a=[0,31,59,90,120,151,181,212,243,273,304,334,365],s=[0,31,60,91,121,152,182,213,244,274,305,335,366];Smart.Utilities.Assign("TimeSpan",class{constructor(){const e=this;if(e.ticksPerMillisecond=1e4,e.millisecondsPerTick=1e-4,e.ticksPerSecond=1e7,e.secondsPerTick=1e-7,e.ticksPerMinute=6e8,e.minutesPerTick=1/6e8,e.ticksPerHour=36e9,e.hoursPerTick=1/36e9,e.ticksPerDay=864e9,e.daysPerTick=1/864e9,e.millisPerSecond=1e3,e.millisPerMinute=6e4,e.millisPerHour=36e5,e.millisPerDay=864e5,e._ticks=0,1===arguments.length){if(isNaN(arguments[0]))throw new Error("Argument must be a number.");e._ticks=arguments[0]}else if(3===arguments.length)e._ticks=e.timeToMS(arguments[0],arguments[1],arguments[2],0);else if(4===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+0;e._ticks=t*e.ticksPerMillisecond}else if(5===arguments.length){const t=1e3*(3600*arguments[0]*24+3600*arguments[1]+60*arguments[2]+arguments[3])+arguments[4];e._ticks=t*e.ticksPerMillisecond}}ticks(){return this._ticks}days(){return parseInt(this._ticks/this.ticksPerDay)}timeToMS(e,t,a,s){return parseInt((3600*e+60*t+a+s/1e3)*this.ticksPerSecond)}hours(){return parseInt(this._ticks/this.ticksPerHour)%24}milliseconds(){return parseInt(this._ticks/this.ticksPerMillisecond)%1e3}minutes(){return parseInt(this._ticks/this.ticksPerMinute)%60}seconds(){return parseInt(this._ticks/this.ticksPerSecond)%60}totalDays(){return parseInt(this._ticks*this.daysPerTick)}totalHours(){return parseInt(this._ticks*this.hoursPerTick)}totalMilliseconds(){const e=this._ticks*this.millisecondsPerTick;return parseInt(e)}totalMinutes(){return parseInt(this._ticks*this.minutesPerTick)}totalSeconds(){return parseInt(this._ticks*this.secondsPerTick)}add(e){const t=this._ticks+e._ticks;return new Smart.Utilities.TimeSpan(t)}subtract(e){const t=this._ticks-e._ticks;return new Smart.Utilities.TimeSpan(t)}duration(){const e=this;return e._ticks>=0?new Smart.Utilities.TimeSpan(e._ticks):new Smart.Utilities.TimeSpan(-e._ticks)}equals(e){return this._ticks===e._ticks}valueOf(){return this._ticks}compare(e,t){return e._ticks>t._ticks?1:e._ticks<t._ticks?-1:0}interval(e,t){const a=e*t+(e>=0?.5:-.5);return new Smart.Utilities.TimeSpan(a*this.ticksPerMillisecond)}fromDays(e){return this.interval(e,this.millisPerDay)}fromHours(e){return this.interval(e,this.millisPerHour)}fromMilliseconds(e){return this.interval(e,1)}fromMinutes(e){return this.interval(e,this.millisPerMinute)}fromSeconds(e){return this.interval(e,this.millisPerSecond)}fromTicks(e){return new Smart.Utilities.TimeSpan(e)}toString(){return this.totalMilliseconds().toString()}negate(){return new Smart.Utilities.TimeSpan(-this._ticks)}}),Smart.Utilities.Assign("DateTime",class{constructor(){function e(e){const t=i.regexISOString.exec(e);r=new Smart.Utilities.DateTime(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]),parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]),parseFloat(t[7]),0,0,0,0,0,0,0,"UTC")}const i=this;let r;if(i.ticksPerMillisecond=1e4,i.millisecondsPerTick=1e-4,i.ticksPerSecond=1e7,i.secondsPerTick=1e-7,i.ticksPerMinute=6e8,i.minutesPerTick=1/6e8,i.ticksPerHour=36e9,i.hoursPerTick=1/36e9,i.ticksPerDay=864e9,i.daysPerTick=1/864e9,i.millisPerSecond=1e3,i.millisPerMinute=6e4,i.millisPerHour=36e5,i.millisPerDay=864e5,i.daysPerYear=365,i.daysPer4Years=1461,i.daysPer100Years=36524,i.daysPer400Years=146097,i.daysTo1601=584388,i.daysTo1899=693593,i.daysTo10000=3652059,i.minTicks=0,i.maxTicks=3155378976e9,i.maxMillis=3155378976e5,i.datePartYear=0,i.datePartDayOfYear=1,i.datePartMonth=2,i.datePartDay=3,i.daysToMonth365=a,i.daysToMonth366=s,i.minValue=new Date(0),i.maxValue=new Date(3155378976e9),i.ticksMask=0x4000000000000000,i.flagsMask=0xc000000000000000,i.localMask=0x8000000000000000,i.ticksCeiling=0x4000000000000000,i.kindUnspecified=0,i.kindUtc=0x4000000000000000,i.kindLocal=0x8000000000000000,i.kindLocalAmbiguousDst=0xc000000000000000,i.kindShift=62,i.regexTrim=/^\s+|\s+$/g,i.regexInfinity=/^[+-]?infinity$/i,i.regexHex=/^0x[a-f0-9]+$/i,i.regexParseFloat=/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/,i.regexISOString=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})Z$/,i.calendar={"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",FP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",FPA:"yyyy/MM/dd HH:mm:ss:fffuunnppeeaaxxoo",FPA2:"yyyy-MM-dd HH:mm:ss:fffuunnppeeaaxxoo",FT:"HH:mm:ss:fff:uu:nn:pp:ee:aa:xx:oo",PP:"yyyy-MM-dd HH:mm:ss:fff:uu:nn:pp",PT:"HH:mm:ss:fff:uu:nn:pp"},percentsymbol:"%",currencysymbol:"$",currencysymbolposition:"before",decimalseparator:".",thousandsseparator:","},i.dateData=0,i.timeZone=null,i.timeZones=t,i._codeToUnit={u:"_microsecond",uu:"_microsecond",n:"_nanosecond",nn:"_nanosecond",p:"_picosecond",pp:"_picosecond",e:"_femtosecond",ee:"_femtosecond",a:"_attosecond",aa:"_attosecond",x:"_zeptosecond",xx:"_zeptosecond",o:"_yoctosecond",oo:"_yoctosecond"},i._smallUnits=["_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"],i._microsecond=0,i._nanosecond=0,i._picosecond=0,i._femtosecond=0,i._attosecond=0,i._zeptosecond=0,i._yoctosecond=0,0===arguments.length){const e=new Date;i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else if(1===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}}else if(2===arguments.length){void 0===arguments[0]&&(arguments[0]="todayDate");if("number"==typeof arguments[0]&&isFinite(arguments[0])||"string"!=typeof arguments[0])if("number"==typeof arguments[0])i.dateData=arguments[0];else if(arguments[0]instanceof Date){const e=arguments[0];i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else i.dateData=arguments[0];else{let t;"today"===arguments[0]?t=new Date:"todayDate"===arguments[0]?(t=new Date,t.setHours(0,0,0,0)):i.regexISOString.test(arguments[0])?e(arguments[0]):t=i.tryparseDate(arguments[0]),t&&(i.dateData=i.dateToMS(t.getFullYear(),t.getMonth()+1,t.getDate())+i.timeToMS(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}i.validateTimeZone(arguments[1])}else if(arguments.length>2)if("string"==typeof arguments[0]){const e=i.tryparseDate(arguments[0],arguments[2],arguments[1]);i.dateData=i.dateToMS(e.getFullYear(),e.getMonth()+1,e.getDate())+i.timeToMS(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}else{let e=arguments[0],t=arguments[1]-1,a=arguments[2],s=arguments[3]||0,r=arguments[4]||0,n=arguments[5]||0,o=arguments[6]||0,d=arguments[7]||0,l=arguments[8]||0,f=arguments[9]||0,m=arguments[10]||0,c=arguments[11]||0,u=arguments[12]||0,y=arguments[13]||0;e>=2100&&(e=2100),t>=12?t=11:t<0&&(t=0),a>31?a=i.daysInMonth(e,1+t):a<0&&(a=0),s>23?s=23:s<0&&(s=0),r>59?r=59:r<0&&(r=0),n>59?n=59:n<0&&(n=0);const p=new Date(e,t,a,s,r,n,o);e<1970&&p.setFullYear(e),i.dateData=i.dateToMS(p.getFullYear(),p.getMonth()+1,p.getDate())+i.timeToMS(p.getHours(),p.getMinutes(),p.getSeconds(),p.getMilliseconds()),i._microsecond=d,i._nanosecond=l,i._picosecond=f,i._femtosecond=m,i._attosecond=c,i._zeptosecond=u,i._yoctosecond=y,arguments[14]&&i.validateTimeZone(arguments[14])}if(i.timeZone||i.validateTimeZone("Local"),r){const e=r.toTimeZone(i.timeZone);i.dateData=e.dateData}}static isValidDate(e){const t=this.validateDate(e);return!(!t||t&&!t.dateData)}static validateDate(e,t,a){if(e instanceof Smart.Utilities.DateTime)return e;if(e instanceof Date)return new Smart.Utilities.DateTime(e);try{if("string"==typeof e&&a)return this.parseDateString(e,t,a);if(new RegExp(/^\d{1,2}\/\d{1,2}\/\d{4}(, \d{1,2}:\d{2}:\d{1,2} [A|P]M)?$/).test(e)){const t=new Date(e);if(!isNaN(t.getTime()))return new Smart.Utilities.DateTime(t)}if("string"==typeof e)return this.parseDateString(e,t,a);if("number"==typeof e)return new Smart.Utilities.DateTime(new Date(e))}catch(e){}return t}static parseDateString(e,t,a){const s=new Date(e);if(!isNaN(s.getTime()))return e&&"string"==typeof e&&a?new Smart.Utilities.DateTime(e,a,null):new Smart.Utilities.DateTime(s);const i=e.indexOf("Date("),r=e.indexOf("DateTime("),n=e.lastIndexOf(")");let o=e;if(-1===i&&-1===r||-1===n){const t=new Smart.Utilities.DateTime,s=t.parseDate(e,a);if(s)return o=new Smart.Utilities.DateTime(s),t.copySmallTimePartValues(o),o}else{if(o=-1!==i?e.slice(i+5,n):e.slice(r+9,n),o=o.replace(/'/g,"").replace(/"/g,"").replace(/^\s+|\s+$|\s+(?=\s)/g,""),""===o.trim())return new Smart.Utilities.DateTime;if(new RegExp(/(^(\d+)(\s*,\s*\d+)+(\s*,\s*[a-zA-Z ]+)?$)/g).test(o))return o=o.split(","),o.map((function(e,t){isNaN(o[t])?o[t]=e.trim():o[t]=parseInt(e)})),-1!==i&&o[1]++,o.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,o)),o}if(""===o.trim())return t;if(!isNaN(o))return o=new Date(parseInt(o,10)),new Smart.Utilities.DateTime(o);try{const e=o.split(",");2===e.length?(e[1]=e[1].trim(),e.unshift(null),o=new(Function.prototype.bind.apply(Smart.Utilities.DateTime,e))):o=new Smart.Utilities.DateTime(o)}catch(e){o=t}return o}static fromFullTimeStamp(e){e=e.toString();const t=new Smart.Utilities.DateTime(parseFloat(e.slice(0,e.length-21)));let a=e.slice(e.length-21),s=0;for(;a.length>0;)t[t._smallUnits[s]]=parseInt(a.slice(0,3),10),a=a.slice(3),s++;return t}static getConstructorParameters(e){return[e.year(),e.month(),e.day(),e.hour(),e.minute(),e.second(),e.millisecond(),e._microsecond,e._nanosecond,e._picosecond,e._femtosecond,e._attosecond,e._zeptosecond,e._yoctosecond,e.timeZone]}static detectDisplayMode(e,t,a){if(e.calendar.patterns[t])return-1!==["d","D","M","Y","d1","d2"].indexOf(t)?"calendar":-1!==["t","T","FT","PT"].indexOf(t)?"timePicker":"default";const s=["d","M","y"],i=["h","H","m","s","t","f","u","n","p","e","a","x","o"],r=a.groups;let n=!1,o=!1;for(let e=0;e<r.length;e++){const t=r[e].charAt(0);if(-1!==s.indexOf(t)?n=!0:-1!==i.indexOf(t)&&(o=!0),n&&o)break}return n===o?"default":n?"calendar":"timePicker"}static getLocalizedNames(e){const t={names:[],namesAbbr:[],namesShort:[]},a={names:[],namesAbbr:[]};if(this[e])return this[e];for(let a=23;a<30;a++){const s=new Date(2017,6,a),i=s.toLocaleString(e,{weekday:"long"});t.names.push(i),t.namesAbbr.push(s.toLocaleString(e,{weekday:"short"})),t.namesShort.push(i.substring(0,2))}for(let t=0;t<12;t++){const s=new Date(2017,t,1).toLocaleString(e,{month:"long"});a.names.push(s),a.namesAbbr.push(s.substring(0,3))}return a.names.push(""),a.namesAbbr.push(""),this[e]={days:t,months:a},this[e]}internalMS(){return this.dateData}getDatePart(e){const t=this,a=t.internalMS();let s=parseInt(a/t.millisPerDay);const i=parseInt(s/t.daysPer400Years);s-=i*t.daysPer400Years;let r=parseInt(s/t.daysPer100Years);4===r&&(r=3),s-=r*t.daysPer100Years;const n=parseInt(s/t.daysPer4Years);s-=n*t.daysPer4Years;let o=parseInt(s/t.daysPerYear);if(4===o&&(o=3),e===t.datePartYear)return parseInt(400*i+100*r+4*n+o+1);if(s-=o*t.daysPerYear,e===t.datePartDayOfYear)return parseInt(s+1);const d=3===o&&(24!==n||3===r)?t.daysToMonth366:t.daysToMonth365;let l=s>>6;for(;s>=d[l];)l++;return e===t.datePartMonth?parseInt(l):parseInt(s-d[l-1]+1)}dayOfWeek(){const e=this.dateData;return parseInt(e/this.millisPerDay+1)%7}dayOfYear(){return this.getDatePart(this.datePartDayOfYear)}weekOfYear(e){const t=this.toDate(),a=e||this.calendar.firstDay,s=new Date(t.getFullYear(),0,1),i=Math.floor((t.getTime()-s.getTime()-6e4*(t.getTimezoneOffset()-s.getTimezoneOffset()))/864e5)+1;let r,n=s.getDay()-a;if(n=n>=0?n:n+7,n<4){if(r=Math.floor((i+n-1)/7)+1,r>52){let e=new Date(t.getFullYear()+1,0,1).getDay()-a;e=e>=0?e:e+7,r=e<4?1:53}}else r=Math.floor((i+n-1)/7);return r}subtract(e){const t=this;return new Smart.Utilities.TimeSpan(t.dateData*t.ticksPerMillisecond-e.dateData*t.ticksPerMillisecond)}dateToMS(e,t,a){const s=this;if(e>=1&&e<=9999&&t>=1&&t<=12){e=parseInt(e);const i=s.isLeapYear(e)?s.daysToMonth366:s.daysToMonth365;if(a>=1&&a<=i[t]-i[t-1]){const r=e-1;return(365*r+parseInt(r/4)-parseInt(r/100)+parseInt(r/400)+i[t-1]+a-1)*s.millisPerDay}}}isLeapYear(e){if(e<1||e>9999)throw new Error("Year out of Range");return e%4==0&&(e%100!=0||e%400==0)}timeToMS(e,t,a,s){const i=this;if(e>=0&&e<24&&t>=0&&t<60&&a>=0&&a<60){const r=parseInt(3600*e+60*t+a);return s>0&&s<1e3?r*i.millisPerSecond+s:r*i.millisPerSecond}}daysInMonth(e,t){if(t<1||t>12)throw new Error("Month out of Range");const a=this,s=a.isLeapYear(e)?a.daysToMonth366:a.daysToMonth365;return s[t]-s[t-1]}arrayIndexOf(e,t){return e.indexOf(t)}startsWith(e,t){return 0===e.indexOf(t)}endsWith(e,t){return e.substr(e.length-t.length)===t}trim(e){return(e+"").replace(this.regexTrim,"")}expandFormat(e,t){t=t||"F";let a,s=e.patterns,i=t.length;if(s[t])return s[t];if(1===i){if(a=s[t],!a)throw"Invalid date format string '"+t+"'.";t=a}else 2===i&&"%"===t.charAt(0)&&(t=t.charAt(1));return t}getEra(e,t){if(!t)return 0;if("string"==typeof e)return 0;let a,s=e.getTime();for(let e=0,i=t.length;e<i;e++)if(a=t[e].start,null===a||s>=a)return e;return 0}toUpper(e){return e.split(" ").join(" ").toUpperCase()}toUpperArray(e){const t=[];for(let a=0,s=e.length;a<s;a++)t[a]=this.toUpper(e[a]);return t}getEraYear(e,t,a,s){let i=e.getFullYear();return!s&&t.eras&&(i-="number"==typeof a?a:t.eras[a].offset),i}getDayIndex(e,t,a){const s=this,i=e.days;let r,n=e._upperDays;return n||(e._upperDays=n=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr),s.toUpperArray(i.namesShort)]),t=t.toUpperCase(),a?(r=s.arrayIndexOf(n[1],t),-1===r&&(r=s.arrayIndexOf(n[2],t))):r=s.arrayIndexOf(n[0],t),r}getMonthIndex(e,t,a){const s=this;let i=e.months,r=e.monthsGenitive||e.months,n=e._upperMonths,o=e._upperMonthsGen;n||(e._upperMonths=n=[s.toUpperArray(i.names),s.toUpperArray(i.namesAbbr)],e._upperMonthsGen=o=[s.toUpperArray(r.names),s.toUpperArray(r.namesAbbr)]),t=s.toUpper(t);let d=s.arrayIndexOf(a?n[1]:n[0],t);return d<0&&(d=s.arrayIndexOf(a?o[1]:o[0],t)),d}appendPreOrPostMatch(e,t){let a=0,s=!1;for(let i=0,r=e.length;i<r;i++){const r=e.charAt(i);switch(r){case"'":s?t.push("'"):a++,s=!1;break;case"\\":s&&t.push("\\"),s=!s;break;default:t.push(r),s=!1}}return a}getTokenRegExp(){return/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyyy|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|uu|u|nn|n|pp|p|ee|e|aa|a|xx|x|oo|o|i{1,24}|zzz|zz|z|gg|g/g}static ParseDate(e,t){return(new Smart.Utilities.DateTime).tryparseDate(e,null,t)}tryparseDate(e,t,a){const s=this;if(null==t&&(t=s.calendar),void 0!==a){if(Array.isArray(a))for(let i=0;i<a.length;i++){const r=s.parseDate(e,a[i],t);if(r)return r}const i=s.parseDate(e,a,t);if(i)return i}if(""===e)return null;if(null==e||e.substring||(e=e.toString()),null!=e&&"/Date("===e.substring(0,6)){const t=/^\/Date\((-?\d+)(\+|-)?(\d+)?\)\/$/;let a=new Date(+e.replace(/\/Date\((\d+)\)\//,"$1"));if("Invalid Date"===a){const t=e.match(/^\/Date\((\d+)([-+]\d\d)(\d\d)\)\/$/);a=null,t&&(a=new Date(1*t[1]+36e5*t[2]+6e4*t[3]))}if(null==a||"Invalid Date"===a||isNaN(a)){const a=t.exec(e);if(a){const e=new Date(parseInt(a[1]));if(a[2]){let t=parseInt(a[3]);"-"===a[2]&&(t=-t);const s=e.getUTCMinutes();e.setUTCMinutes(s-t)}if(!isNaN(e.valueOf()))return e}}return a}const i={smartdate:"yyyy-MM-dd HH:mm:ss",d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss",ISO:"yyyy-MM-dd hh:mm:ss",ISO2:"yyyy-MM-dd HH:mm:ss",ISO8601:"yyyy-MM-ddTHH:mm:ss.sssZ",d1:"dd.MM.yyyy",d2:"dd-MM-yyyy",d3:"MM-dd-yyyy",d4:"MM.dd.yyyy",zone1:"yyyy-MM-ddTHH:mm:ss-HH:mm",zone2:"yyyy-MM-ddTHH:mm:ss+HH:mm",custom:"yyyy-MM-ddTHH:mm:ss.fff",custom2:"yyyy-MM-dd HH:mm:ss.fff",custom3:"yyyy-MM-ddTHH:mm:ss.fff+HH:mm",custom4:"yyyy-MM-ddTHH:mm:ss.fff-HH:mm",custom5:"yyyy-MM-ddTHH:mm:ss.ffffff+HH:mm",custom6:"yyyy-MM-ddTHH:mm:ss.ffffff-HH:mm",iso:"yyyy-MM-ddTHH:mm:ssZ",iso2:"yyyy-MM-ddTHH:mm.fffZ",iso_date1:"yyyy-MM-dd",iso_date2:"yyyy-MM-dd",iso_date3:"yyyy-ddd",iso_date4:"yyyy-MM-dd HH:mm",iso_date5:"yyyy-MM-dd HH:mm Z",iso_date6:"yyyy-MMM-dd",iso_date7:"yyyy-MM",iso_date8:"yyyy-MMM",iso_date9:"yyyy-MMMM",iso_date10:"yyyy-MMMM-dd",iso_time1:"HH:mm:ss.tttt",iso_time2:"HH:mm:ss",iso_time3:"HH:mm",iso_time4:"HH",iso_time5:"yyyyyy-MM-dd",iso_time6:"yyyyyy-MM-dd",iso_time7:"dd/MM/yyyy HH:mm",iso_time8:"dd.MM.yyyy HH:mm",iso_time9:"dd-MM-yyyy HH:mm",iso_time10:"MM.dd.yyyy HH:mm",iso_time11:"MM-dd-yyyy HH:mm",iso_time12:"dd/MM/yyyy",iso_time13:"MM.dd.yyyy h:mm tt",iso_time14:"MM-dd-yyyy h:mm tt",iso_time15:"MM/dd/yyyy h:mm tt"};for(let a in i){const r=s.parseDate(e,i[a],t);if(r)return r}const r=t.patterns;for(let a in r){const i=s.parseDate(e,r[a],t);if(i){if("ISO"===a){const a=s.parseDate(e,r.ISO2,t);if(a)return a}return i}}let n;if("string"==typeof e){const a=[":","/","-"," ",","];let i="",r=e=function(e,t,a){return a.replace(new RegExp(e,"g"),t)}(", ",",",e=s.trim(e));e.indexOf(":")>=0?(i=e.substring(e.indexOf(":")-2),i=s.trim(i),r=e.substring(0,e.indexOf(":")-2)):e.toUpperCase().indexOf("AM")>=0?(i=e.substring(e.toUpperCase().indexOf("AM")-2),i=s.trim(i),r=e.substring(0,e.toUpperCase().indexOf("AM")-2)):e.toUpperCase().indexOf("PM")>=0&&(i=e.substring(e.toUpperCase().indexOf("PM")-2),i=s.trim(i),r=e.substring(0,e.toUpperCase().indexOf("PM")-2));let o=new Date,d=!1;if(r){for(let e=0;e<a.length;e++)if(r.indexOf(a[e])>=0){n=r.split(a[e]);break}if(!n)return null;let e=new Array,i=new Array,l=new Array,f=null,m=null;for(let a=0;a<n.length;a++){const i=n[a],r=s.parseDate(i,"d",t)||s.parseDate(i,"dd",t)||s.parseDate(i,"ddd",t)||s.parseDate(i,"dddd",t);if(r&&(e.push(r.getDate()),i.length>2)){f=a;break}}for(let e=0;e<n.length;e++){const a=n[e],r=s.parseDate(a,"M",t)||s.parseDate(a,"MM",t)||s.parseDate(a,"MMM",t)||s.parseDate(a,"MMMM",t);if(r){if(null!=f&&f===e)continue;if(i.push(r.getMonth()),a.length>2){m=e;break}}}for(let e=0;e<n.length;e++){const a=n[e],i=s.parseDate(a,"yyyy",t);if(i){if(null!=f&&f===e)continue;if(null!=m&&m===e)continue;l.push(i.getFullYear())}}const c=new Array;for(let t=e.length-1;t>=0;t--)for(let a=0;a<i.length;a++)for(let s=0;s<l.length;s++){const r=new Date(l[s],i[a],e[t]);l[s]<1970&&r.setFullYear(l[s]),isNaN(r.getTime())||c.push(r)}c.length>0&&(o=c[0],d=!0)}if(i){const e=i.indexOf(":")>=0?i.split(":"):i,a=s.parseDate(i,"h:mm tt",t)||s.parseDate(i,"HH:mm:ss.fff",t)||s.parseDate(i,"HH:mm:ss.ff",t)||s.parseDate(i,"h:mm:ss tt",t)||s.parseDate(i,"HH:mm:ss.tttt",t)||s.parseDate(i,"HH:mm:ss",t)||s.parseDate(i,"HH:mm",t)||s.parseDate(i,"HH",t);let r=0,n=0,l=0,f=0;a&&!isNaN(a.getTime())?(r=a.getHours(),n=a.getMinutes(),l=a.getSeconds(),f=a.getMilliseconds()):(1===e.length&&(r=parseInt(e[0])),2===e.length&&(r=parseInt(e[0]),n=parseInt(e[1])),3===e.length&&(r=parseInt(e[0]),n=parseInt(e[1]),e[2].indexOf(".")>=0?(l=parseInt(e[2].toString().split(".")[0]),f=parseInt(e[2].toString().split(".")[1])):l=parseInt(e[2])),4===e.length&&(r=parseInt(e[0]),n=parseInt(e[1]),l=parseInt(e[2]),f=parseInt(e[3]))),!o||isNaN(r)||isNaN(n)||isNaN(l)||isNaN(f)||(o.setHours(r,n,l,f),d=!0)}if(d)return o}if(null!=e){n=[":","/","-"];let t=!0;for(let a=0;a<n.length;a++)-1!==e.indexOf(n[a])&&(t=!1);if(t){const t=new Number(e);if(!isNaN(t))return new Date(t)}}return null}getParseRegExp(e,t){const a=this;let s=e._parseRegExp;if(s){const e=s[t];if(e)return e}else e._parseRegExp=s={};let i,r=a.expandFormat(e,t).replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1"),n=["^"],o=[],d=0,l=0,f=a.getTokenRegExp();for(;null!==(i=f.exec(r));){const e=r.slice(d,i.index);if(d=f.lastIndex,l+=a.appendPreOrPostMatch(e,n),l%2){n.push(i[0]);continue}let t,s=i[0],m=s.length;switch(s){case"dddd":case"ddd":case"MMMM":case"MMM":case"gg":case"g":t="(\\D+)";break;case"tt":case"t":t="(\\D*)";break;case"yyyyy":t="(\\d{1,4})";break;case"yyyy":t="(\\d{"+m+"})";break;case"fff":case"ff":case"f":t="(\\d{1,"+m+"})";break;case"dd":case"d":case"MM":case"M":case"yy":case"y":case"HH":case"H":case"hh":case"h":case"mm":case"m":case"ss":case"s":t="(\\d\\d?)";break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":t="(\\d{1,3})";break;case"zzz":t="([+-]?\\d\\d?:\\d{2})";break;case"zz":case"z":t="([+-]?\\d\\d?)";break;case"/":t="/";break;default:if(!/i{1,24}/.test(s))throw"Invalid date format pattern '"+s+"'.";t="(\\d{"+s.length+"})"}t&&n.push(t),"/"!==s&&o.push(i[0])}a.appendPreOrPostMatch(r.slice(d),n),n.push("$");const m={regExp:n.join("").replace(/\s+/g,"\\s+"),groups:o};return s[t]=m}outOfRange(e,t,a){return e<t||e>a}expandYear(e,t){const a=this,s=new Date,i=a.getEra(s);if(t<100){let r=e.twoDigitYearMax;r="string"==typeof r?(new Date).getFullYear()%100+parseInt(r,10):r;const n=a.getEraYear(s,e,i);(t+=n-n%100)>r&&(t-=100)}return t}padZeros(e,t){let a,s=e+"";return t>1&&s.length<t?(a=["0","00","000"][t-2]+s,a.substr(a.length-t,t)):(a=s,a)}parseDate(e,t,a){const s=this;null==a&&(a=s.calendar),e=s.trim(e);const i=a,r=s.getParseRegExp(i,t),n=new RegExp(r.regExp).exec(e);if(null===n)return null;let o,d=r.groups,l=null,f=null,m=null,c=null,u=null,y=0,p=0,g=0,h=0,T=null,M=!1;for(let e=0,t=d.length;e<t;e++){const t=n[e+1];if(t){const a=d[e],r=a.length,n=parseInt(t,10);switch(a){case"dd":case"d":if(c=n,s.outOfRange(c,1,31))return null;break;case"MMM":case"MMMM":case"MMMMM":case"MMMMMM":case"MMMMMMM":case"MMMMMMMM":if(m=s.getMonthIndex(i,t,3===r),s.outOfRange(m,0,11))return null;break;case"M":case"MM":if(m=n-1,s.outOfRange(m,0,11))return null;break;case"y":case"yy":case"yyyy":if(f=r<4?s.expandYear(i,n):n,s.outOfRange(f,0,9999))return null;break;case"h":case"hh":if(y=n,12===y&&(y=0),s.outOfRange(y,0,11))return null;break;case"H":case"HH":if(y=n,s.outOfRange(y,0,23))return null;break;case"m":case"mm":if(p=n,s.outOfRange(p,0,59))return null;break;case"s":case"ss":if(g=n,s.outOfRange(g,0,59))return null;break;case"tt":case"t":if(M=i.PM&&(t===i.PM[0]||t===i.PM[1]||t===i.PM[2]),!M&&(!i.AM||t!==i.AM[0]&&t!==i.AM[1]&&t!==i.AM[2]))return null;break;case"f":case"ff":case"fff":if(h=n*Math.pow(10,3-r),s.outOfRange(h,0,999))return null;break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":if(s.outOfRange(n,0,1e3))return null;s[s._codeToUnit[a]]=n;break;case"ddd":case"dddd":if(u=s.getDayIndex(i,t,3===r),s.outOfRange(u,0,6))return null;break;case"zzz":{const e=t.split(/:/);if(2!==e.length)return null;if(o=parseInt(e[0],10),s.outOfRange(o,-12,13))return null;const a=parseInt(e[1],10);if(s.outOfRange(a,0,59))return null;T=60*o+(s.startsWith(t,"-")?-a:a);break}case"z":case"zz":if(o=n,s.outOfRange(o,-12,13))return null;T=60*o;break;case"g":case"gg":{let e=t;if(!e||!i.eras)return null;e=this.trim(e.toLowerCase());for(let t=0,a=i.eras.length;t<a;t++)if(e===i.eras[t].nathat.toLowerCase()){l=t;break}if(null===l)return null;break}default:{let e=t;e.length%3==1?e+="00":e.length%3==2&&(e+="0"),h=parseInt(e.slice(0,3),10),e=e.slice(3);let a=0;for(;e.length>0;)s[s._smallUnits[a]]=parseInt(e.slice(0,3),10),e=e.slice(3),a++}}}}let S,D=new Date,H=i.convert;if(S=D.getFullYear(),null===f?f=S:i.eras&&(f+=i.eras[l||0].offset),null===m&&(m=0),null===c&&(c=1),H){if(D=H.toGregorian(f,m,c),null===D)return null}else{if(D.setFullYear(f,m,c),D.getDate()!==c)return null;if(null!==u&&D.getDay()!==u)return null}if(M&&y<12&&(y+=12),D.setHours(y,p,g,h),null!==T){const e=D.getMinutes()-(T+D.getTimezoneOffset());D.setHours(D.getHours()+parseInt(e/60,10),e%60)}return D}toString(e,t){const a=this;void 0===e&&(e="yyyy-MM-dd HH:mm:ss");const s=a.dateData.toString()+a.getFractionsOfSecondStamp()+e+(a.timeZone||"");if(Smart.Utilities.DateTime.cache&&Smart.Utilities.DateTime.cache[s]&&!1!==a.showTodayDateAsString)return Smart.Utilities.DateTime.cache[s];const i=a.toDate();if(null==t&&(t=a.calendar),"string"==typeof i)return i;if(!e||!e.length||"i"===e){let e;return e=a.formatDate(i,t.patterns.F,t),e}const r=t.eras,n="s"===e;e=a.expandFormat(t,e);const o=[];let d,l=0,f=a.getTokenRegExp();function m(e,t){if(void 0!==e.getMonth)switch(t){case 0:return e.getFullYear();case 1:return e.getMonth();case 2:return e.getDate()}}for(;;){const s=f.lastIndex,c=f.exec(e),u=e.slice(s,c?c.index:e.length);if(l+=a.appendPreOrPostMatch(u,o),!c)break;if(l%2){o.push(c[0]);continue}const y=c[0],p=y.length;let g;if(/i{1,24}/.test(y))o.push(a.getFirstNDigitsOfPrecision(y.length));else switch(y){case"ddd":case"dddd":{const e=3===p?t.days.namesAbbr:t.days.names;o.push(e[i.getDay()]);break}case"d":case"dd":o.push(a.padZeros(m(i,2),p));break;case"MMM":case"MMMM":g=m(i,1),o.push(t.months[3===p?"namesAbbr":"names"][g]);break;case"M":case"MM":o.push(a.padZeros(m(i,1)+1,p));break;case"y":case"yy":case"yyyy":g=a.getEraYear(i,t,a.getEra(i,r),n),p<4&&(g%=100),o.push(a.padZeros(g,p));break;case"h":case"hh":d=i.getHours()%12,0===d&&(d=12),o.push(a.padZeros(d,p));break;case"H":case"HH":o.push(a.padZeros(i.getHours(),p));break;case"m":case"mm":o.push(a.padZeros(i.getMinutes(),p));break;case"s":case"ss":o.push(a.padZeros(i.getSeconds(),p));break;case"t":case"tt":g=i.getHours()<12?t.AM?t.AM[0]:" ":t.PM?t.PM[0]:" ",o.push(1===p?g.charAt(0):g);break;case"f":case"ff":case"fff":o.push(a.padZeros(i.getMilliseconds(),3).substr(0,p));break;case"u":case"n":case"p":case"e":case"a":case"x":case"o":o.push(a[a._codeToUnit[y]]);break;case"uu":case"nn":case"pp":case"ee":case"aa":case"xx":case"oo":o.push(a.padZeros(a[a._codeToUnit[y]],3));break;case"z":case"zz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),p));break;case"zzz":o.push((a.timeZoneOffsetHours>=0?"+":"-")+a.padZeros(Math.floor(Math.abs(a.timeZoneOffsetHours)),2)+":"+a.padZeros(60*Math.abs(a.timeZoneOffsetHours%1),2));break;case"g":case"gg":t.eras&&o.push(t.eras[a.getEra(i,r)].name);break;case"/":o.push(t["/"]);break;default:throw"Invalid date format pattern '"+y+"'."}}let c=o.join("");if(Smart.Utilities.DateTime.cache||(Smart.Utilities.DateTime.cache=new Array),a._today||(a._today=new Date),a.calendar&&a.calendar.today&&-1===e.indexOf(":")&&i.getFullYear()===a._today.getFullYear()&&i.getDate()===a._today.getDate()&&i.getMonth()===a._today.getMonth()){if(!1===a.showTodayDateAsString)return Smart.Utilities.DateTime.cache[s]=c,c;c=a.calendar.today}return Smart.Utilities.DateTime.cache[s]=c,c}getFractionsOfSecondStamp(){const e=this;return e._microsecond.toString()+e._nanosecond+e._picosecond+e._femtosecond+e._attosecond+e._zeptosecond+e._yoctosecond}getFirstNDigitsOfPrecision(e,t){const a=this;return(""+(!0!==t?a.padZeros(a.millisecond(),3):"")+a.padZeros(a._microsecond,3)+a.padZeros(a._nanosecond,3)+a.padZeros(a._picosecond,3)+a.padZeros(a._femtosecond,3)+a.padZeros(a._attosecond,3)+a.padZeros(a._zeptosecond,3)+a.padZeros(a._yoctosecond,3)).slice(0,e)}copySmallTimePartValues(e){const t=this;e._microsecond=t._microsecond,e._nanosecond=t._nanosecond,e._picosecond=t._picosecond,e._femtosecond=t._femtosecond,e._attosecond=t._attosecond,e._zeptosecond=t._zeptosecond,e._yoctosecond=t._yoctosecond}add(e,t,a){const s=this,i=s.internalMS();if(void 0===t){if(!1===a)return s.dateData=i+parseInt(e._ticks/s.ticksPerMillisecond),s;const t=new Smart.Utilities.DateTime(i+parseInt(e._ticks/s.ticksPerMillisecond));return s.copyTimeZone(t),s.copySmallTimePartValues(t),t}const r=e*t;if(r<=-s.maxMillis||r>=s.maxMillis)throw new Error("Out of Range");if(!1===a)return s.dateData=i+r,s;const n=new Smart.Utilities.DateTime(i+r);return s.copyTimeZone(n),s.copySmallTimePartValues(n),n}addDays(e,t){return this.add(e,this.millisPerDay,t)}clone(){const e=this,t=new Smart.Utilities.DateTime(e.dateData);return e.copyTimeZone(t),e.copySmallTimePartValues(t),t}clearTime(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s,0,0,0,0);return e.copyTimeZone(i),i}addHours(e,t){return this.add(e,this.millisPerHour,t)}addDeciseconds(e,t){return this.add(100*e,1,t)}addCentiseconds(e,t){return this.add(10*e,1,t)}addMilliseconds(e,t){return this.add(e,1,t)}addMinutes(e,t){return this.add(e,this.millisPerMinute,t)}addMonths(e,t){const a=this;if(e<-12e4||e>12e4)throw new Error("Invalid Months Value");let s=parseInt(a.getDatePart(a.datePartYear)),i=parseInt(a.getDatePart(a.datePartMonth)),r=parseInt(a.getDatePart(a.datePartDay));if(e%12==0)s+=e/12;else{const t=i-1+e;t>=0?(i=t%12+1,s+=t/12):(i=12+(t+1)%12,s+=(t-11)/12),s=parseInt(s)}if(s<1||s>9999)throw new Error("Year out of range");const n=a.daysInMonth(s,i);if(r>n&&(r=n),!1===t)return a.dateData=a.dateToMS(s,i,r)+a.internalMS()%a.millisPerDay,a;const o=new Smart.Utilities.DateTime(a.dateToMS(s,i,r)+a.internalMS()%a.millisPerDay);return a.copyTimeZone(o),a.copySmallTimePartValues(o),o}addSeconds(e,t){return this.add(e,this.millisPerSecond,t)}addYears(e,t){return this.addMonths(12*e,t)}addMicroseconds(e,t){if(0===e)return;const a=this;let s,i;e<0&&0===a.hour()&&0===a.minute()&&0===a.second()&&0===a.millisecond()&&0===a._microsecond&&(s=parseInt(e/1e3,10)-1,i=1e3+e%1e3);const r=1e3*a.timeToMS(a.hour(),a.minute(),a.second(),a.millisecond())+a._microsecond,n=r+e;let o;if(void 0===s&&(s=parseInt(n/1e3,10)-parseInt(r/1e3,10)),void 0===i&&(i=parseInt(n%1e3,10)),0!==s&&(o=a.addMilliseconds(s,t)),!1!==t)return o||(o=a.clone()),o._microsecond=i,o;a._microsecond=i}addFractionsOfSecond(e,t,a,s,i){if(0===e)return;const r=this,n=1e3*r[s]+r[a],o=e+n;let d,l=parseInt(o/1e3,10)-parseInt(n/1e3,10),f=parseInt(o%1e3,10);if(e<0&&o<0&&f<0&&(l--,f=1e3+f),0!==l&&(d=r[i](l,t)),!1!==t)return d||(d=r.clone()),d[a]=f,d;r[a]=f}addNanoseconds(e,t){return this.addFractionsOfSecond(e,t,"_nanosecond","_microsecond","addMicroseconds")}addPicoseconds(e,t){return this.addFractionsOfSecond(e,t,"_picosecond","_nanosecond","addNanoseconds")}addFemtoseconds(e,t){return this.addFractionsOfSecond(e,t,"_femtosecond","_picosecond","addPicoseconds")}addAttoseconds(e,t){return this.addFractionsOfSecond(e,t,"_attosecond","_femtosecond","addFemtoseconds")}addZeptoseconds(e,t){return this.addFractionsOfSecond(e,t,"_zeptosecond","_attosecond","addAttoseconds")}addYoctoseconds(e,t){return this.addFractionsOfSecond(e,t,"_yoctosecond","_zeptosecond","addZeptoseconds")}getTimeZoneOffset(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1),s=e.getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset());return{offset:-e.getTimezoneOffset()/60,dst:+s}}isInDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return this.date().getTimezoneOffset()<Math.max(t.getTimezoneOffset(),a.getTimezoneOffset())}supportsDaylightSavingTime(){const e=new Date,t=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1);return t.getTimezoneOffset()!==a.getTimezoneOffset()}date(){const e=this,t=e.month(),a=e.year(),s=e.day(),i=new Smart.Utilities.DateTime(a,t,s);return e.copyTimeZone(i),i}isWeekend(){return 0===this.dayOfWeek()||6===this.dayOfWeek()}toDate(e){const t=this,a=t.month(),s=t.year(),i=t.day(),r=t.hour(),n=t.minute(),o=t.second(),d=t.millisecond();let l=new Date(s,a-1,i);if(s<1970&&l.setFullYear(s),l.setHours(r,n,o,d),e){const a=t.timeZones.filter((function(t){return t.id===e}));if(a.length){let e=a[0].offset;const s=l.getTime();let i=60*l.getTimezoneOffset()*1e3;if(t.timeZone){const e=t.timeZones.filter((function(e){return e.id===t.timeZone}));e.length&&(i=60*-e[0].offset*1e3)}l=new Date(s+i+6e4*e)}}return l}toTimeZone(e){const t=this;let a=e;if(null==a&&(a="Local"),t.timeZone===a)return t.clone();const s=t.timeZones.filter((function(e){return e.id===a}));if(0===s.length)return t.clone();const i=this.toDate(a),r=new Smart.Utilities.DateTime(i);return r.timeZone=a,r.timeZoneOffset=s[0].offset,r.timeZoneOffsetHours=s[0].offsetHours,t.copySmallTimePartValues(r),r}day(){return this.getDatePart(this.datePartDay)}month(){return this.getDatePart(this.datePartMonth)}year(){return this.getDatePart(this.datePartYear)}millisecond(){return parseInt(this.internalMS()%1e3)}hour(){return parseInt(Math.floor(this.internalMS()/this.millisPerHour)%24)}minute(){return parseInt(this.internalMS()/this.millisPerMinute%60)}second(){return parseInt(this.internalMS()/this.millisPerSecond%60)}microsecond(){return this._microsecond}nanosecond(){return this._nanosecond}picosecond(){return this._picosecond}femtosecond(){return this._femtosecond}attosecond(){return this._attosecond}zeptosecond(){return this._zeptosecond}yoctosecond(){return this._yoctosecond}valueOf(){return this.dateData}equals(e){const t=this;return t.dateData===e.dateData&&t._microsecond===e._microsecond&&t._nanosecond===e._nanosecond&&t._picosecond===e._picosecond&&t._femtosecond===e._femtosecond&&t._attosecond===e._attosecond&&t._zeptosecond===e._zeptosecond&&t._yoctosecond===e._yoctosecond}equalDateParts(e){const t=this;return t.year()===e.year()&&t.month()===e.month()&&t.day()===e.day()}compare(e){const t=this;if(t.equals(e))return 0;const a=["dateData","_microsecond","_nanosecond","_picosecond","_femtosecond","_attosecond","_zeptosecond","_yoctosecond"];for(let s=0;s<a.length;s++){const i=a[s];if(t[i]>e[i])return 1;if(t[i]<e[i])return-1}return 0}toDateString(){return this.toDate().toDateString()}toLocaleDateString(){return this.toDate().toLocaleDateString(this.calendar.locale)}toLocaleString(){return this.toDate().toLocaleString(this.calendar.locale)}toLocaleTimeString(){return this.toDate().toLocaleTimeString(this.calendar.locale)}validateTimeZone(e){const t=this;if("string"!=typeof e)return;const a=t.timeZones.filter((function(t){return t.id===e}));0!==a.length&&(t.timeZone=e,t.timeZoneOffset=a[0].offset,t.timeZoneOffsetHours=a[0].offsetHours)}copyTimeZone(e){const t=this;e.timeZone=t.timeZone,e.timeZoneOffset=t.timeZoneOffset,e.timeZoneOffsetHours=t.timeZoneOffsetHours}getTimeStamp(){return new Smart.Utilities.BigNumber(this.dateData.toString()+this.getFirstNDigitsOfPrecision(void 0,!0))}})})();
|
|
109
109
|
|
|
110
110
|
/***/ }),
|
|
111
111
|
|
|
112
112
|
/***/ 7054:
|
|
113
113
|
/***/ (() => {
|
|
114
114
|
|
|
115
|
-
Smart("smart-date-time-picker",class extends Smart.BaseElement{static get properties(){return{animationSettings:{value:null,type:"object"},autoClose:{value:!1,type:"boolean"},autoCloseDelay:{value:0,type:"number"},autoSwitchToMinutes:{value:!1,type:"boolean"},calendarButton:{value:!1,type:"boolean"},calendarButtonPosition:{value:"right",allowedValues:["left","right"],type:"string"},calendarMode:{value:"default",allowedValues:["default","classic"],type:"string"},dayNameFormat:{value:"firstTwoLetters",allowedValues:["narrow","firstTwoLetters","long","short"],type:"string"},disableAutoNavigation:{value:!1,type:"boolean"},displayKind:{value:"unspecified",allowedValues:["UTC","local","unspecified"],type:"string"},displayModeView:{value:"table",allowedValues:["table","list"],type:"string"},displayMode:{allowedValues:["outlined","filled","underlined"],value:"outlined",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownDisplayMode:{value:"default",allowedValues:["default","classic","calendar","timePicker","auto"],type:"string"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPosition:{value:"auto",allowedValues:["auto","bottom","overlay-top","overlay-center","overlay-bottom","top","center-bottom","center-top"],type:"string"},editMode:{value:"default",allowedValues:["default","full","partial"],type:"string"},enableMouseWheelAction:{value:!1,type:"boolean"},firstDayOfWeek:{value:0,type:"number"},footerTemplate:{value:null,type:"any"},footer:{value:!1,type:"boolean"},formatString:{value:"dd-MMM-yy HH:mm:ss.fff",type:"string"},headerTemplate:{value:null,type:"any"},hideDayNames:{value:!1,type:"boolean"},hideOtherMonthDays:{value:!1,type:"boolean"},hideTooltipArrow:{value:!1,type:"boolean"},hint:{value:"",type:"string"},importantDates:{value:[],type:"array"},importantDatesTemplate:{value:null,type:"any"},interval:{value:new Smart.Utilities.TimeSpan(0,0,1),type:"any"},label:{value:"",type:"string"},max:{value:new Smart.Utilities.DateTime(3001,1,1),type:"any"},messages:{value:{en:{now:"Now",dateTabLabel:"DATE",timeTabLabel:"TIME"}},type:"object",extend:!0},min:{value:new Smart.Utilities.DateTime(1600,1,1),type:"any"},name:{value:"",type:"string"},nullable:{value:!1,type:"boolean"},opened:{value:!1,type:"boolean"},placeholder:{value:"Enter date",type:"string"},restrictedDates:{value:[],type:"array"},spinButtons:{value:!1,type:"boolean"},spinButtonsDelay:{value:75,type:"number"},spinButtonsInitialDelay:{value:0,type:"number"},spinButtonsPosition:{value:"right",allowedValues:["left","right"],type:"string"},tooltip:{value:!1,type:"boolean"},tooltipDelay:{value:100,type:"number"},tooltipPosition:{value:"top",allowedValues:["bottom","top","left","right","absolute"],type:"string"},tooltipTemplate:{value:null,type:"any"},validation:{value:"strict",allowedValues:["strict","interaction"],type:"string"},value:{defaultReflectToAttribute:!0,value:new Smart.Utilities.DateTime,type:"any"},weekNumbers:{value:!1,type:"boolean"},weeks:{value:6,type:"number"},yearCutoff:{value:1926,type:"number"}}}static get listeners(){return{"container.mouseout":"_mouseoutHandler","container.mouseover":"_mouseoverHandler","calendarButton.click":"_calendarButtonClickHandler","calendarDropDown.change":"_calendarDropDownChangeHandler","calendarDropDown.click":"_calendarDropDownClickHandler","downButton.click":"_spinButtonsClickHandler","input.blur":"_inputBlurHandler","input.change":"_inputChangeHandler","input.dragstart":"_inputDragstartHandler","input.focus":"_inputFocusHandler","input.keydown":"_inputKeydownHandler","input.down":"_inputDownHandler","input.paste":"_inputPasteHandler","input.select":"_inputSelectHandler","input.up":"_inputUpHandler","input.wheel":"_inputWheelHandler","dropDownContainer.keydown":"_dropDownKeydownHandler","dropDownContainer.transitionend":"_dropDownTransitionendHandler","dropDownHeader.click":"_dropDownHeaderClickHandler","upButton.click":"_spinButtonsClickHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.Utilities.DateTime":"smart.date.js","Smart.Utilities.Draw":"smart.draw.js","Smart.Utilities.BigNumber":"smart.math.js","Smart.Utilities.NumericProcessor":"smart.numeric.js","Smart.RepeatButton":"smart.button.js","Smart.Calendar":"smart.calendar.js","Smart.TimePicker":"smart.timepicker.js"}}static get styleUrls(){return["smart.datetimepicker.css"]}template(){return'<div id="container" role="presentation">\n <span id="label" class="smart-label">[[label]]</span>\n <div id="content" class="smart-content">\n <input id="input" class="smart-input smart-date-time-input" type="text" readonly="[[readonly]]" disabled="[[disabled]]" placeholder="[[placeholder]]" name="[[name]]" aria-label="[[placeholder]]" />\n <div id="spinButtonsContainer" class="smart-spin-buttons-container" role="presentation">\n <smart-repeat-button initial-delay="[[spinButtonsInitialDelay]]" animation="[[animation]]" delay="[[spinButtonsDelay]]" readonly="[[readonly]]" unfocusable id="upButton" right-to-left="[[rightToLeft]]" class="smart-spin-button" aria-label="Increment">\n <div class="smart-arrow smart-arrow-up" aria-hidden="true"></div>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="[[spinButtonsInitialDelay]]" animation="[[animation]]" delay="[[spinButtonsDelay]]" readonly="[[readonly]]" unfocusable id="downButton" right-to-left="[[rightToLeft]]" class="smart-spin-button" aria-label="Decrement">\n <div class="smart-arrow smart-arrow-down" aria-hidden="true"></div>\n </smart-repeat-button>\n </div>\n <div id="calendarButton" class="smart-drop-down-button smart-calendar-button" role="button" aria-haspopup="dialog" aria-label="Toggle popup"></div>\n <div id="dropDownContainer" class="smart-drop-down smart-date-time-drop-down smart-drop-down-container smart-visibility-hidden" role="dialog">\n <div id="dropDownHeader" class="smart-drop-down-header smart-hidden" role="heading" aria-level="1">\n <div id="selectDate" class="smart-selected" role="button"></div>\n <div id="selectTime" role="button"></div>\n </div>\n <div id="dropDownContent" class="smart-drop-down-content" role="presentation">\n <smart-calendar id="calendarDropDown" class="smart-hidden"\n animation="[[animation]]"\n animation-settings="[[animationSettings]]"\n calendar-mode="[[calendarMode]]"\n day-name-format="[[dayNameFormat]]"\n disable-auto-navigation="[[disableAutoNavigation]]"\n display-mode-view="[[displayModeView]]"\n first-day-of-week="[[firstDayOfWeek]]"\n header-template="[[headerTemplate]]"\n hide-day-names="[[hideDayNames]]"\n hide-other-month-days="[[hideOtherMonthDays]]"\n hide-tooltip-arrow="[[hideTooltipArrow]]"\n important-dates="[[importantDates]]"\n important-dates-template="[[importantDatesTemplate]]"\n locale="[[locale]]"\n right-to-left="[[rightToLeft]]"\n selection-mode="one"\n spin-buttons-delay="[[spinButtonsDelay]]"\n spin-buttons-initial-delay="[[spinButtonsInitialDelay]]"\n theme="[[theme]]"\n tooltip="[[tooltip]]"\n tooltip-delay="[[tooltipDelay]]"\n tooltip-position="[[tooltipPosition]]"\n tooltip-template="[[tooltipTemplate]]"\n unfocusable="[[unfocusable]]"\n view-sections=\'["header", "footer"]\'\n week-numbers="[[weekNumbers]]"\n weeks="[[weeks]]"></smart-calendar>\n </div>\n </div>\n </div>\n <span id="hint" inner-h-t-m-l="[[hint]]" class="smart-hint smart-hidden"></span>\n </div>'}attached(){const e=this;super.attached(),e.isCompleted&&(e._defaultFooterTemplateApplied&&e._addCalendarFooterListeners(),e.$.timePickerDropDown&&e._addTimePickerListener(),e._positionDetection&&e._positionDetection.dropDownAttached())}detached(){const e=this;if(super.detached(),e.close(),e._defaultFooterTemplateApplied){const t=e.$.calendarDropDown.$footer;t.unlisten("change"),t.unlisten("click"),t.unlisten("wheel")}e.$.timePickerDropDown&&e.$.timePickerDropDown.$.unlisten("change"),e._positionDetection&&e._positionDetection.dropDownDetached()}ready(){super.ready();const e=this;e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._iOS=!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform),e._edgeMacFF&&e.$dropDownContainer.addClass("not-in-view"),e._defaultFooterTemplate=document.createElement("template"),e._defaultFooterTemplate.innerHTML='<div class="smart-date-time-picker-footer">\n <div class="smart-footer-component smart-footer-component-hour" role="presentation">\n <input type="text" class="smart-hour-element" aria-label="Hours" />\n <span role="presentation">\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Increment hours">\n <span class="smart-arrow smart-arrow-up" aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Decrement hours">\n <span class="smart-arrow smart-arrow-down" aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n <div class="smart-footer-component smart-footer-component-minute" role="presentation">\n <input class="smart-minute-element" aria-label="Minutes" />\n <span role="presentation">\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Increment minutes">\n <span class="smart-arrow smart-arrow-up" aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Decrement minutes">\n <span class="smart-arrow smart-arrow-down" aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n <div class="smart-footer-component smart-footer-component-ampm" role="presentation">\n <input type="text" class="smart-am-pm-element" aria-label="AM/PM" />\n </div>\n <div class="smart-footer-component smart-footer-component-today" role="presentation">\n <div tabindex="-1" class="smart-today-element" role="button" aria-label="Now"></div>\n </div>\n </div>',e._codeToMethod={y:"addYears",yy:"addYears",yyyy:"addYears",yyyyy:"addYears",M:"addMonths",MM:"addMonths",MMM:"addMonths",MMMM:"addMonths",d:"addDays",dd:"addDays",ddd:"addDays",dddd:"addDays",H:"addHours",HH:"addHours",h:"addHours",hh:"addHours",m:"addMinutes",mm:"addMinutes",s:"addSeconds",ss:"addSeconds",f:"addDeciseconds",ff:"addCentiseconds",fff:"addMilliseconds",u:"addMicroseconds",uu:"addMicroseconds",n:"addNanoseconds",nn:"addNanoseconds",p:"addPicoseconds",pp:"addPicoseconds",e:"addFemtoseconds",ee:"addFemtoseconds",a:"addAttoseconds",aa:"addAttoseconds",x:"addZeptoseconds",xx:"addZeptoseconds",o:"addYoctoseconds",oo:"addYoctoseconds"},e._codeToIndex={y:0,yy:0,yyyy:0,yyyyy:0,M:1,MM:1,MMM:1,MMMM:1,d:2,dd:2,ddd:2,dddd:2,H:3,HH:3,h:3,hh:3,m:4,mm:4,s:5,ss:5,f:6,ff:6,fff:6,u:7,uu:7,n:8,nn:8,p:9,pp:9,e:10,ee:10,a:11,aa:11,x:12,xx:12,o:13,oo:13},e._getLocalizedNames(),e.checkLicense()}render(){const e=this;e.rightToLeft&&(e.calendarButtonPosition="right"===e.calendarButtonPosition?"left":"right"),e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDownContainer,e.$.content,"close"),e._positionDetection.customPositionDropDown=e._positionExternalDropDown,e._positionDetection.getDropDownParent(!0),e._positionDetection.setDropDownPosition(),e.$.dropDownContainer.style.left=null,e._positionDetection.handleAutoPositioning(),e._setIds(),e._validateInitialPropertyValues(),e._setFocusable(),e.setAttribute("role","presentation"),e.$.input.setAttribute("aria-describedby",e.$.hint.id),e.$.input.setAttribute("aria-labelledby",e.$.label.id),e.$.calendarButton.setAttribute("aria-owns",e.$.dropDownContainer.id),e.$.dropDownContainer.setAttribute("animation",e.animation),e.$.dropDownContainer.setAttribute("drop-down-display-mode",e.dropDownDisplayMode),super.render(),e.isInitialized=!0}close(){this.opened&&this._close()}focus(){this.$.input.focus()}select(){this.$.input.select()}open(){this.opened||this._open()}_handleFooter(){const e=this;if(e.footer){e.$.dropDownContainer.setAttribute("footer","");const t=e.$.calendarDropDown;"default"===e._dropDownDisplayMode?t.viewSections=["title","header","footer"]:"classic"===e._dropDownDisplayMode?t.viewSections=["header","footer"]:"calendar"===e._dropDownDisplayMode&&(t.viewSections=["title","header","footer"])}else e.$.dropDownContainer.removeAttribute("footer")}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"animation":case"theme":n.$.timePickerDropDown&&(n.$.timePickerDropDown[e]=a),"animation"===e&&(n.$.dropDownContainer.setAttribute("animation",n.animation),n._defaultFooterTemplateApplied&&Array.from(n.$.calendarDropDown.$.footer.getElementsByTagName("smart-repeat-button")).forEach((function(e){e.animation=a})));break;case"calendarButton":n.$.dropDownContainer.style.transition="none",a||n.close();break;case"calendarButtonPosition":n.$.dropDownContainer.style.transition="none",n.close(),"left"===a?n.$.content.insertBefore(n.$.calendarButton,n.$.content.firstElementChild):null===n._dropDownParent?n.$.content.insertBefore(n.$.calendarButton,n.$.dropDownContainer):n.$.content.appendChild(n.$.calendarButton);break;case"disabled":a?(n.close(),n.$.upButton.disabled=!0,n.$.downButton.disabled=!0):n._disableSpinButtons(),n._setFocusable(),n._positionDetection.handleAutoPositioning();break;case"displayKind":{const e=n._outputTimeZone;switch(a){case"unspecified":n._outputTimeZone=n._inputTimeZone;break;case"UTC":n._outputTimeZone="UTC";break;case"local":n._outputTimeZone="Local"}if(n._outputTimeZone===e)return;null!==n._value&&(n.close(),n._toSync=!0,n._value=n._value.toTimeZone(n._outputTimeZone),n._applyFormatString()),n.min=n.min.toTimeZone(n._outputTimeZone),n.max=n.max.toTimeZone(n._outputTimeZone);for(let e=0;e<n.restrictedDates.length;e++){let t=n.restrictedDates[e];t=t.toTimeZone(n._outputTimeZone)}break}case"dropDownAppendTo":n._positionDetection.dropDownAppendToChangedHandler();break;case"dropDownDisplayMode":n._changeDropDownDisplayMode();break;case"dropDownOverlay":a||n._positionDetection.removeOverlay();break;case"dropDownPosition":n._positionDetection.dropDownPositionChangedHandler();break;case"footer":n._handleFooter();break;case"footerTemplate":if(null!==a){n._defaultFooterTemplateApplied=!1;const e=n.$.calendarDropDown.$footer;e.unlisten("change"),e.unlisten("click"),e.unlisten("wheel"),n.$.calendarDropDown.footerTemplate=a}else{n._setDefaultFooterTemplate();const e=n._value;n._hourElement.value=e.toString("hh"),n._minuteElement.value=e.toString("mm"),n._ampmElement.value=e.toString("tt")}n._handleFooter();break;case"formatString":""===a&&(n.formatString="dd-MMM-yy HH:mm:ss.fff"),n._getFormatStringRegExp(),n._applyFormatString(),"auto"===n.dropDownDisplayMode&&n._changeDropDownDisplayMode(),n._timePickerInitialized&&(n.$.timePickerDropDown.format=n._formatStringRegExp.groups.find((e=>-1!==e.indexOf("H")))?"24-hour":"12-hour");break;case"interval":n._validateInterval(t);break;case"locale":case"messages":if(n.$.selectDate.innerHTML=n.localize("dateTabLabel"),n.$.selectTime.innerHTML=n.localize("timeTabLabel"),n._defaultFooterTemplateApplied&&(n._todayElement.title=n.localize("now")),"messages"===e)return;n._getLocalizedNames(),n.min.calendar.days=n._localizedDays,n.min.calendar.months=n._localizedMonths,n.min.calendar.locale=n.locale,n.max.calendar.days=n._localizedDays,n.max.calendar.months=n._localizedMonths,n.max.calendar.locale=n.locale,null!==n.value&&(n._value.calendar.days=n._localizedDays,n._value.calendar.months=n._localizedMonths,n._value.calendar.locale=n.locale,n.value.calendar.days=n._localizedDays,n.value.calendar.months=n._localizedMonths,n.value.calendar.locale=n.locale),Smart.Utilities.DateTime.cache=[],n._applyFormatString();break;case"max":case"min":n._validateMinMax(e,t),"strict"===n.validation?n._validateValue():n._minMaxChanged=!0;break;case"nullable":!0===t&&null===n._value&&n._validateValue(n._now(),null);break;case"opened":a?n._open():n._close();break;case"readonly":case"unfocusable":a&&n.close(),"unfocusable"===e&&n._setFocusable();break;case"restrictedDates":n._validateRestrictedDates(),n._validateValue();break;case"spinButtonsPosition":"right"===a?n.$.content.insertBefore(n.$.spinButtonsContainer,n.$.input.nextElementSibling):n.$.content.insertBefore(n.$.spinButtonsContainer,n.$.input);break;case"validation":"strict"===a&&(delete n._minMaxChanged,n._validateValue());break;case"value":{let e;null!==a?(e=Smart.Utilities.DateTime.validateDate(a,n._now(),n.formatString),e=e.toTimeZone(n._outputTimeZone)):e=null,n._validateValue(e,n._value,void 0,!0);break}}}setDate(e){const t=this;let a;null!==e?(a=Smart.Utilities.DateTime.validateDate(e,t._now(),t.formatString),a=a.toTimeZone(t._outputTimeZone)):a=null,t._validateValue(a,t._value,void 0,!0)}getDate(){return this.value&&this.value.toDate?this.value.toDate():null}_addCalendarFooterListeners(){const e=this,t=e.$.calendarDropDown.$footer;t.listen("change",e._footerChangeHandler.bind(e)),t.listen("click",e._footerClickHandler.bind(e)),t.listen("wheel",e._footerWheelHandler.bind(e))}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const a=e.dataset.property,n=e.value;a&&void 0!==t[a]&&(t[a]=n)}}}_addTimePickerListener(){const e=this;e.$.timePickerDropDown.$.listen("change",(function(t){const a=e.context,n=t.detail.value,i=Smart.Utilities.DateTime.getConstructorParameters(null!==e._value?e._value:e._now());e.context=e,i[3]=n.getHours(),i[4]=n.getMinutes(),e._timePickerInitiatedChange=!0,i.unshift(null),e._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,i))),e._timePickerInitiatedChange=!1,e.context=a}))}_applyFormatString(){const e=this;null!==e.value&&(e.$.input.value=e._value.toString(e.formatString))}_calendarButtonClickHandler(e){const t=this;t._highlightedTimePart=void 0,t.disabled||t.readonly||(t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t.$.calendarButton,e.pageX,e.pageY),t.opened?t._close():t._open())}_calendarDropDownChangeHandler(e){const t=this;if(e.stopPropagation(),t._disregardCalendarChangeEvent)t._disregardCalendarChangeEvent=!1;else if(this.$.calendarDropDown.selectedDates.length>0){const a=e.detail.value[0],n=null!==t._value?t._value:t._now(),i=Smart.Utilities.DateTime.getConstructorParameters(n);if(i[0]=a.getFullYear(),i[1]=a.getMonth()+1,i[2]=a.getDate(),t._calendarInitiatedChange=!0,i.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,i))),t._defaultFooterTemplateApplied){const e=t._value;""===t._hourElement.value&&(t._hourElement.value=e.toString("hh")),""===t._ampmElement.value&&(t._ampmElement.value=e.toString("tt")),""===t._minuteElement.value&&(t._minuteElement.value=e.toString("mm"))}t._calendarInitiatedChange=!1}else t._setNullValue()}_calendarDropDownClickHandler(e){const t=this;t.autoClose&&e.target.closest(".smart-calendar-cell")&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay))}_changeDropDownDisplayMode(){function e(e,a,n,i){t.$dropDownHeader[e]("smart-hidden"),t.$calendarDropDown[a]("smart-hidden"),t._timePickerInitialized&&t.$.timePickerDropDown.$[n]("smart-hidden"),i&&(t.opened?t.$.calendarDropDown._refreshTitle():t._toSync=!0)}const t=this,a=t._dropDownDisplayMode;t._detectDisplayMode(),t._dropDownDisplayMode!==a&&("default"===t._dropDownDisplayMode?(t.calendarMode="default",t.$.calendarDropDown.viewSections=["title","header"],t.$selectDate.addClass("smart-selected"),t.$selectTime.removeClass("smart-selected"),e("removeClass","removeClass","addClass",!0)):"classic"===t._dropDownDisplayMode?(t.calendarMode="classic",t.$.calendarDropDown.viewSections=["header","footer"],e("addClass","removeClass","addClass")):"calendar"===t._dropDownDisplayMode?(t.calendarMode="default",t.$.calendarDropDown.viewSections=["title","header"],e("addClass","removeClass","addClass",!0)):(t.calendarMode="default",e("addClass","addClass","removeClass"),t._timePickerInitialized||t._initializeTimePicker()),t.$.dropDownContainer.setAttribute("drop-down-display-mode",t.dropDownDisplayMode))}_cloneValue(){const e=this;return null!==e._value?e._value.clone():null}_close(){const e=this;if(e.$.fireEvent("closing").defaultPrevented)e.opened=!0;else{e.$.calendarDropDown.disabled=!0,e.$calendarButton.removeClass("smart-calendar-button-pressed"),e.$.calendarButton.removeAttribute("active"),e.$dropDownContainer.addClass("smart-visibility-hidden");const t=e.$.calendarDropDown.$.container.querySelector(".smart-calendar-cell[hover]");t&&t.removeAttribute("hover"),e.opened=!1,e._positionDetection.removeOverlay(!0),e.$.fireEvent("close"),e._edgeMacFF&&!e.hasAnimation&&(e.$.dropDownContainer.style.top=null,e.$.dropDownContainer.style.left=null,e.$dropDownContainer.addClass("not-in-view")),e.$.input.focus()}e.$.calendarButton.setAttribute("aria-expanded",e.opened)}_detectDisplayMode(){const e=this;"auto"!==e.dropDownDisplayMode?e._dropDownDisplayMode=e.dropDownDisplayMode:e._dropDownDisplayMode=Smart.Utilities.DateTime.detectDisplayMode(e.value||e.min,e.formatString,e._formatStringRegExp),"timePicker"===e._dropDownDisplayMode?(e.$calendarButton.addClass("time"),"Enter date"===e.placeholder&&(e.placeholder="Enter time")):(e.$calendarButton.removeClass("time"),"Enter time"===e.placeholder&&(e.placeholder="Enter date")),"default"===e._dropDownDisplayMode?e.$dropDownContent.removeClass("partial"):e.$dropDownContent.addClass("partial")}_disableSpinButtons(){const e=this;if(e.disabled)return;const t=null===e._value;e.$.upButton.disabled=t,e.$.downButton.disabled=t}_documentUpHandler(e){const t=this,a=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement,n=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;Smart.Utilities.Core.isMobile||a!==t.$.input||"partial"!==t.editMode||null===t._value||n===t.$.input&&t.$.input.selectionStart!==t.$.input.selectionEnd?n===t.$.calendarButton||t.$.dropDownContainer.contains(n)||t.$.dropDownContainer.contains(t._getRootShadowHost(n))||(t.close(),a===t.$.input||t.contains(n)||(t._highlightedTimePart=void 0)):(t._highlightedTimePartEdit=!1,t._validateValue(t.$.input.value,t._cloneValue(),!1),t._highlightTimePartBasedOnCursor()),t._mouseFocus=!1}_getRootShadowHost(e){const t=this;if(!t.shadowRoot&&!t.isInShadowDOM)return;let a,n=e.getRootNode().host;for(;n&&n!==t&&n!==document;)a=n,n=n.getRootNode().host;return a}_dropDownHeaderClickHandler(e){const t=this;if(e.target===t.$.selectDate){if(t.$selectDate.hasClass("smart-selected"))return;t.$selectDate.addClass("smart-selected"),t.$selectTime.removeClass("smart-selected"),t.$.timePickerDropDown.$.addClass("smart-hidden"),t.$calendarDropDown.removeClass("smart-hidden")}else{if(t.$selectTime.hasClass("smart-selected"))return;t.$selectDate.removeClass("smart-selected"),t.$selectTime.addClass("smart-selected"),t.$calendarDropDown.addClass("smart-hidden"),t._timePickerInitialized?t.$.timePickerDropDown.$.removeClass("smart-hidden"):t._initializeTimePicker()}}_dropDownKeydownHandler(e){const t=this,a=e.key,n=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;!t.$.dropDownHeader.contains(n)||"Enter"!==a&&" "!==a?"Escape"===a||e.altKey&&"ArrowUp"===a?(e.preventDefault(),t.close(),t.$.input.focus()):"Enter"!==a&&" "!==a||!n.classList.contains("smart-footer-component-today")?"Enter"===a&&(n===t.$.calendarDropDown.$.body&&t.$.calendarDropDown.querySelectorAll(".smart-calendar-cell[selected][focus]").length>0||t._timePickerInitialized&&n===t.$.timePickerDropDown.$.picker)&&(e.preventDefault(),t.close()):(e.preventDefault(),t._validateValue(t._now()),t.close()):(e.preventDefault(),t._dropDownHeaderClickHandler({target:n}))}_dropDownTransitionendHandler(){const e=this;if(e.hasAnimation)return e.opened&&e._toFocus?(e._toFocus.focus(),delete e._toFocus,void(e._timePickerInitialized&&!e.$.timePickerDropDown.classList.contains("smart-hidden")&&requestAnimationFrame((()=>e.$.timePickerDropDown._highlightLabel())))):e._edgeMacFF&&!e.opened?(e.$.dropDownContainer.style.top=null,e.$.dropDownContainer.style.left=null,void e.$dropDownContainer.addClass("not-in-view")):void 0}_footerChangeHandler(e){const t=this,a=t.context,n=e.target,i=null!==t._value?t._value:t._now();let o,l=n.value;if(t.context=t,e.stopPropagation(),n.classList.contains("smart-hour-element")){if(l=parseInt(l,10),isNaN(l)||l<0||l>12)return void(n.value=i.toString("hh"));l>0&&l<12&&"PM"===i.toString("tt")&&(l+=12),o="hh"}else{if(!n.classList.contains("smart-minute-element")){if(null===t._value)return void(n.value="");const e=i.toString("tt");return l=l.toLowerCase(),void("PM"===e&&("a"===l||"am"===l)||"AM"===e&&("p"===l||"pm"===l)?(t._incrementDecrement(void 0,"tt"),n.value=t._value.toString("tt")):n.value=e)}if(l=parseInt(l,10),isNaN(l)||l<0||l>59)return void(n.value=i.toString("mm"));o="mm"}const r=Smart.Utilities.DateTime.getConstructorParameters(i);r[t._codeToIndex[o]]=l,r.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,r))),n.value=t._value.toString(o),t.context=a}_footerClickHandler(e){const t=this,a=t.context,n=e.target;if(t.context=t,n.classList.contains("smart-today-element"))t._validateValue(t._now()),t.autoClose&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay));else{const e=n.closest("smart-repeat-button");if(null!==e){const a=e===e.parentElement.children[1],n=e.closest(".smart-footer-component").classList.contains("smart-footer-component-hour")?"hh":"mm";t._incrementDecrement(a,n)}}t.context=a}_footerWheelHandler(e){const t=this,a=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;if(t.enableMouseWheelAction&&e.target instanceof HTMLInputElement&&a===e.target){const a=t.context,n=e.target;t.context=t,n.classList.contains("smart-hour-element")?t._incrementDecrement(e.deltaY>0,"hh"):n.classList.contains("smart-minute-element")?t._incrementDecrement(e.deltaY>0,"mm"):t._incrementDecrement(void 0,"tt"),t.context=a,e.stopPropagation()}}_getAndHighlightTimePart(e,t,a){const n=this;n._programmaticSelection=!0,n.$.input.selectionStart!==e||n.$.input.selectionEnd!==t?n.$.input.setSelectionRange(e,t):setTimeout((function(){n.$.input.setSelectionRange(e,t)}),200),n._highlightedTimePart={code:n._formatStringRegExp.groups[a],index:a,from:e,to:t}}_getFormatStringRegExp(){const e=this;e._formatStringRegExp=e.min.getParseRegExp(e.min.calendar,e.formatString.replace(/y+/g,"yyyyy")),e._formatStringRegExp.regExp=new RegExp(e._formatStringRegExp.regExp)}_getLocalizedNames(){const e=this,t=Smart.Utilities.DateTime.getLocalizedNames(e.locale);e._localizedDays=t.days,e._localizedMonths=t.months,e.$.selectDate.innerHTML=e.localize("dateTabLabel"),e.$.selectTime.innerHTML=e.localize("timeTabLabel")}_handleManualTimePartEdit(e){const t=this,a=Smart.Utilities.DateTime.getConstructorParameters(t._value);if(e=e[t._highlightedTimePart.index+1],isNaN(e)){if(1===t._codeToIndex[t._highlightedTimePart.code]){let n=-1;if(e.length>1&&t._localizedMonths.names.some((function(t,a){if(-1!==t.toLowerCase().indexOf(e.toLowerCase()))return n=a,!0})),-1===n)return void t._applyFormatString();a[1]=n+1}}else{if("f"===t._highlightedTimePart.code)e=100*parseInt(e,10);else if("ff"===t._highlightedTimePart.code)e=10*parseInt(e,10);else if(-1!==t._highlightedTimePart.code.indexOf("y")&&e.length<3){const a=t.yearCutoff.toString(),n=parseInt(a.slice(2),10);let i=parseInt(a.slice(0,2),10);(e=parseInt(e,10))<n&&i++,e=e.toString(),e=i+""+"0".repeat(2-e.length)+e}else if(-1!==t._highlightedTimePart.code.indexOf("h")){const a=t._value.hour();e=parseInt(e,10),a>11&&e<=11&&(e+=12)}a[t._codeToIndex[t._highlightedTimePart.code]]=parseInt(e,10)}try{a.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,a)))}catch(e){t._applyFormatString()}}_highlightTimePartBasedOnCursor(e){const t=this,a=t.$.input.value,n=t._formatStringRegExp.regExp.exec(a);function i(){return void 0===e?t.$.input.selectionStart:e}if(null===n)return void(t._highlightedTimePart=void 0);t._iOS||void 0!==e||(e=t.$.input.selectionStart);let o,l=n.index;for(let e=1;e<n.length;e++){const r=n[e];if(o=a.indexOf(r,l),l=o+r.length,1===e&&i()<o){t._getAndHighlightTimePart(o,l,0);break}if(i()>=o&&i()<=l){t._getAndHighlightTimePart(o,l,e-1);break}const s=n[e+1];if(!s){t._programmaticSelection=!0,t.$.input.setSelectionRange(o,l),t._highlightedTimePart={code:t._formatStringRegExp.groups[e-1],index:e-1,from:o,to:l};break}{const n=a.indexOf(s,l);if(i()>l&&i()<n){i()-l<=n-i()?t._getAndHighlightTimePart(o,l,e-1):(t._formatStringRegExp.groups[e],t._programmaticSelection=!0,t.$.input.setSelectionRange(n,n+s.length));break}}}}_highlightTimePartBasedOnIndex(e){const t=this,a=t.$.input.value,n=t._formatStringRegExp.regExp.exec(a);if(null===n)return t._validateValue(void 0,t._cloneValue(),!1),void t._highlightTimePartBasedOnIndex(e);let i,o=n.index;const l=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;if(!(e<0||e>=n.length)){t.$.input!==l&&t.$.input.focus();for(let l=1;l<n.length;l++){const r=n[l];if(i=a.indexOf(r,o),o=i+r.length,e===l-1){t._getAndHighlightTimePart(i,o,e);break}}}}_incrementDecrement(e,t){const a=this,n=a._cloneValue();if(a._minMaxChanged&&(a._value=a._rangeValidation(a._value),delete a._minMaxChanged),void 0===t&&a._highlightedTimePart&&(t=a._highlightedTimePart.code),void 0!==t){if("z"===t||"zz"===t||"zzz"===t)return void a._highlightTimePartBasedOnIndex(a._highlightedTimePart.index);a._value="t"===t||"tt"===t?a._value.addHours(a._value.hour()<12?12:-12,!0):a._value[a._codeToMethod[t]](e?-1:1,!0),a._validateValue(void 0,n,!1),a._highlightedTimePart&&a._highlightTimePartBasedOnIndex(a._highlightedTimePart.index)}else a._value=a._value.add(e?a.interval.negate():a.interval,void 0,!0),a._validateValue(void 0,n,!1);0!==n.compare(a._value)&&a.isInitialized&&(a.$.fireEvent("change",{oldValue:n.toTimeZone(a._inputTimeZone),value:a.value}),a._updateTargetValue())}_initializeTimePicker(){const e=this,t=document.createElement("smart-time-picker");t.rightToLeft=e.rightToLeft,t.animation=e.animation,t.autoSwitchToMinutes=e.autoSwitchToMinutes,t.format=e._formatStringRegExp.groups.find((e=>-1!==e.indexOf("H")))?"24-hour":"12-hour",t.theme=e.theme,t.value=null!==e._value?e._value.toDate():e._now(),e.$.timePickerDropDown=t,t.$=Smart.Utilities.Extend(t),e.$.dropDownContent.appendChild(t),e._timePickerInitialized=!0,e._addTimePickerListener()}_inputBlurHandler(){const e=this;e.removeAttribute("focus"),e._fullEdit=!1,e._highlightedTimePartEdit=!1,e.$.fireEvent("blur")}_inputChangeHandler(e){const t=this;if(e&&e.stopPropagation(),""!==t.$.input.value){if(t._fullEdit||null===t._value)t._fullEdit=!1,t._validateValue(t.$.input.value),t._highlightTimePartBasedOnCursor();else if(t._highlightedTimePartEdit){t._highlightedTimePartEdit=!1;let e=t._formatStringRegExp.regExp.exec(t.$.input.value);null!==e?t._handleManualTimePartEdit(e):t._applyFormatString()}}else t._setNullValue()}_inputDragstartHandler(e){e.preventDefault()}_inputFocusHandler(){const e=this;if(e.setAttribute("focus",""),"full"!==e.editMode){const t=Smart.Utilities.Core.isMobile?10:0;setTimeout((function(){e._iOS?e._highlightTimePartBasedOnCursor():!0!==e._mouseFocus&&(void 0===e._highlightedTimePart?e._highlightTimePartBasedOnCursor(e._iOS?void 0:0):e._highlightTimePartBasedOnIndex(e._highlightedTimePart.index))}),t)}e.$.fireEvent("focus")}_inputKeydownHandler(e){const t=this,a=t.editMode,n=e.key;if("Tab"!==n){if(e.altKey&&"ArrowDown"===n)return e.preventDefault(),void t.open();if("Escape"===n||e.altKey&&"ArrowUp"===n)return e.preventDefault(),void t.close();if("full"!==a){if("partial"===a){if("Delete"===n)return void(null!==t._value&&(t._setNullValue(),e.preventDefault()));if(null===t._value&&(t._validateValue(t._now(),null,!1),t._highlightTimePartBasedOnIndex(0)),-1!==["/",".","-",","," "].indexOf(n))return t._inputChangeHandler(),t._navigateToNextTimePart(),void e.preventDefault();if("Backspace"===n)return t._resetTimePart(),t._highlightedTimePart.index>0?t._navigateToPreviousTimePart():t._highlightTimePartBasedOnIndex(0),void e.preventDefault()}else if(t._fullEdit||t._highlightedTimePartEdit||t.readonly||-1!==["Alt","Control","Shift"].indexOf(n)||e.altKey||e.ctrlKey)return;if(-1!==["End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].indexOf(n)){if(e.preventDefault(),"partial"===a&&t._highlightedTimePartEdit&&t._inputChangeHandler(),null!==t._value)switch(n){case"End":t._highlightTimePartBasedOnIndex(t._formatStringRegExp.groups.length-1);break;case"Home":t._highlightTimePartBasedOnIndex(0);break;case"ArrowLeft":t._navigateToPreviousTimePart();break;case"ArrowUp":t._incrementDecrement();break;case"ArrowRight":t._navigateToNextTimePart();break;case"ArrowDown":t._incrementDecrement(!0)}}else if(t._highlightedTimePart){if("partial"!==a&&t._highlightedTimePart.to-t._highlightedTimePart.from!=t.$.input.selectionEnd-t.$.input.selectionStart)return void(t._fullEdit=!0);const i=t._highlightedTimePart.code;if("ddd"===i||"dddd"===i||"z"===i||"zz"===i||"zzz"===i||"t"===i||"tt"===i)return void e.preventDefault();if("partial"===a&&"MMM"!==i&&"MMMM"!==i&&!1===new RegExp(/^\d+$/).test(n))return void((n.length<2||"F"!==n.charAt(0))&&e.preventDefault());t._highlightedTimePartEdit=!0}}else t._fullEdit=!0}}_inputDownHandler(){const e=this;e._fullEdit||e._highlightedTimePartEdit||"full"===e.editMode||Smart.Utilities.Core.isMobile||setTimeout((function(){e._mouseFocus=!0,e._highlightTimePartBasedOnCursor()}),0)}_inputPasteHandler(e){"partial"===this.editMode?e.preventDefault():this._fullEdit=!0}_inputSelectHandler(){const e=this,t=e.shadowRoot?e.shadowRoot.activeElement:document.activeElement;"partial"===e.editMode&&t===e.$.input&&(!0===e._programmaticSelection?e._programmaticSelection=!1:e._highlightedTimePart?e._highlightTimePartBasedOnIndex(e._highlightedTimePart.index):e._highlightTimePartBasedOnIndex(0))}_inputUpHandler(){const e=this;Smart.Utilities.Core.isMobile&&(e._iOS?(e._mouseFocus=!0,setTimeout((function(){document.activeElement===e.$.input&&e._highlightTimePartBasedOnCursor()}),50)):setTimeout((function(){e._mouseFocus=!0,e._highlightTimePartBasedOnCursor()}),10))}_inputWheelHandler(e){const t=this;(t.shadowRoot?t.shadowRoot.activeElement:document.activeElement)!==t.$.input||!t.enableMouseWheelAction||t.disabled||t.readonly||(e.preventDefault(),t._incrementDecrement(e.deltaY>0))}_isRestricted(e){const t=this.restrictedDates;let a=!1;for(let n=0;n<t.length;n++)if(e.equalDateParts(t[n])){a=!0;break}return a}_mouseoutHandler(e){const t=this,a=e.target;t.disabled||a!==t.$.input&&a!==t.$.calendarButton||(a.removeAttribute("hover"),t.removeAttribute("hover"))}_mouseoverHandler(e){const t=this,a=e.target;t.disabled||a!==t.$.input&&a!==t.$.calendarButton||(a.setAttribute("hover",""),t.setAttribute("hover",""))}_navigateToNextTimePart(){this._highlightTimePartBasedOnIndex(this._highlightedTimePart.index+1)}_navigateToPreviousTimePart(){this._highlightTimePartBasedOnIndex(this._highlightedTimePart.index-1)}_now(){const e=this,t=new Smart.Utilities.DateTime("today","Local");return"Local"!==e._outputTimeZone?t.toTimeZone(e._outputTimeZone):t}_open(e){const t=this;if(t.disabled||t.readonly)return t.opened=!1,void t.$.calendarButton.setAttribute("aria-expanded",!1);if(t.$.fireEvent("opening").defaultPrevented)return t.opened=!1,void t.$.calendarButton.setAttribute("aria-expanded",!1);t._edgeMacFF&&t.$dropDownContainer.removeClass("not-in-view");const a=t.$.dropDownContainer;a.style.marginLeft=null,e||(a.style.transition=""),t.$.calendarDropDown.disabled=!1,t.$calendarButton.addClass("smart-calendar-button-pressed"),t.$.calendarButton.setAttribute("active",""),("default"!==t._dropDownDisplayMode&&"timePicker"!==t._dropDownDisplayMode||!t._timePickerInitialized||t._timePickerInitialized&&t.$.timePickerDropDown.$.hasClass("smart-hidden"))&&t.$calendarDropDown.removeClass("smart-hidden"),t.opened=!0,t.$.calendarButton.setAttribute("aria-expanded",!0),t._positionDetection.placeOverlay(),t._positionDetection.checkBrowserBounds("vertically"),t._positionDetection.positionDropDown(),t.$dropDownContainer.removeClass("smart-visibility-hidden");const n=1===window.devicePixelRatio?document.documentElement.clientWidth:window.innerWidth,i=a.getBoundingClientRect();if(i.left<0?a.style.marginLeft=-1*i.left+"px":i.right>n&&(a.style.marginLeft=n-i.right+"px"),t.$.fireEvent("open"),t._toSync){const e=t._value;if(null!==e)t._disregardCalendarChangeEvent=!0,t.$.calendarDropDown.selectedDates=[e.toDate()],t._defaultFooterTemplateApplied&&(t._hourElement.value=e.toString("hh"),t._minuteElement.value=e.toString("mm"),t._ampmElement.value=e.toString("tt")),t._timePickerInitialized&&(t.$.timePickerDropDown.value=e.toDate()),t._disregardCalendarChangeEvent=!1;else{const e=t.$.calendarDropDown.context;t.$.calendarDropDown.context=t.$.calendarDropDown,t.$.calendarDropDown._clearSelection(!0),t.$.calendarDropDown.context=e,t._defaultFooterTemplateApplied&&(t._hourElement.value="",t._minuteElement.value="",t._ampmElement.value="")}t._toSync=!1}let o;switch(t._dropDownDisplayMode){case"default":o=t.$selectDate.hasClass("smart-selected")?t.$.calendarDropDown:t.$.timePickerDropDown.$.picker;break;case"classic":case"calendar":o=t.$.calendarDropDown;break;case"timePicker":o=t.$.timePickerDropDown.$.picker}t.hasAnimation?(t._toFocus=o,function e(){t._toFocus&&(0===t.$.dropDownContainer.getBoundingClientRect().height?requestAnimationFrame(e):t._dropDownTransitionendHandler())}()):o.focus()}_positionExternalDropDown(e){const t=this.context,a=!t.calendarButton||"right"===t.calendarButtonPosition,n=t._dropDownListPosition,i=t.$.dropDownContainer;let o,l=a?e.right-i.offsetWidth:e.left;switch(n){case"bottom":o=e.bottom;break;case"overlay-top":o=e.bottom-i.offsetHeight;break;case"overlay-center":o=e.top+e.height/2-i.offsetHeight/2;break;case"overlay-bottom":o=e.top;break;case"top":o=e.top-i.offsetHeight;break;case"center-bottom":case"center-top":o="center-bottom"===n?e.bottom+5:e.top-5-i.offsetHeight,l=a?e.right-i.offsetWidth/2-t.$.calendarButton.offsetWidth/2:e.left-i.offsetWidth/2+t.$.calendarButton.offsetWidth/2}return{left:l,top:o}}_rangeValidation(e){const t=this;return-1===e.compare(t.min)?t.min.clone():1===e.compare(t.max)?t.max.clone():e}_resetTimePart(){const e=this,t=e._highlightedTimePart.code,a=e._codeToIndex[t],n=Smart.Utilities.DateTime.getConstructorParameters(e._value);let i;i=a>2?0:a>0?1:e.min.year(),n[a]=i,n.unshift(null),e._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,n)))}_setIds(){const e=this;e.$.label.id||(e.$.label.id=e.id+"Label"),e.$.input.id||(e.$.input.id=e.id+"Input"),e.$.calendarButton.id||(e.$.calendarButton.id=e.id+"CalendarButton"),e.$.dropDownContainer.id||(e.$.dropDownContainer.id=e.id+"DropDownContainer"),e.$.hint.id||(e.$.hint.id=e.id+"Hint")}_setDefaultFooterTemplate(e){const t=this;t.$.calendarDropDown.footerTemplate=t._defaultFooterTemplate,e&&t.$.calendarDropDown._handleLayoutTemplate(t.$.calendarDropDown.$.footer,t._defaultFooterTemplate),t._hourElement=t.$.calendarDropDown.getElementsByClassName("smart-hour-element")[0],t._minuteElement=t.$.calendarDropDown.getElementsByClassName("smart-minute-element")[0],t._ampmElement=t.$.calendarDropDown.getElementsByClassName("smart-am-pm-element")[0],t._todayElement=t.$.calendarDropDown.getElementsByClassName("smart-today-element")[0],t._todayElement.title=t.localize("now"),Array.from(t.$.calendarDropDown.$.footer.getElementsByTagName("smart-repeat-button")).forEach((function(e){e.animation=t.animation})),t._addCalendarFooterListeners(),t._defaultFooterTemplateApplied=!0}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.$.input.tabIndex=-1,e.$.selectDate.removeAttribute("tabindex"),e.$.selectTime.removeAttribute("tabindex"),void(e._defaultFooterTemplateApplied&&(e._hourElement.tabIndex=-1,e._ampmElement.tabIndex=-1,e._minuteElement.tabIndex=-1));const t=e.tabIndex>0?e.tabIndex:0;e.$.input.removeAttribute("tabindex"),e.$.selectDate.tabIndex=t,e.$.selectTime.tabIndex=t,e._defaultFooterTemplateApplied&&(e._hourElement.removeAttribute("tabindex"),e._ampmElement.removeAttribute("tabindex"),e._minuteElement.removeAttribute("tabindex"),e.$.calendarDropDown.getElementsByClassName("smart-footer-component-today")[0].tabIndex=t)}_setNullValue(e){const t=this;if(void 0===e&&(e=t._cloneValue()),t.nullable){if(t._value=null,t.value=null,t._highlightedTimePart=void 0,t.$.input.value="",null!==e){if(t.opened){if(!t._calendarInitiatedChange){const e=t.$.calendarDropDown.context;t.$.calendarDropDown.context=t.$.calendarDropDown,t.$.calendarDropDown._clearSelection(!0),t.$.calendarDropDown.context=e}t._defaultFooterTemplateApplied&&(t._hourElement.value="",t._ampmElement.value="",t._minuteElement.value=""),t._toSync=!1}else t._toSync=!0;t.isInitialized&&(t.$.fireEvent("change",{oldValue:e.toTimeZone(t._inputTimeZone),value:null}),t._updateTargetValue())}t._disableSpinButtons()}else t._validateValue(t._now(),e)}_spinButtonsClickHandler(e){const t=this;null===t._value||t.disabled||t.readonly||t._incrementDecrement(t.$.downButton.contains(e.target))}_validateInitialPropertyValues(){const e=this,t=e.$.calendarDropDown;"left"===e.calendarButtonPosition&&e.$.content.insertBefore(e.$.calendarButton,e.$.input),"left"===e.spinButtonsPosition&&e.$.content.insertBefore(e.$.spinButtonsContainer,e.$.input),e.disabled&&(e.$.upButton.disabled=!0,e.$.downButton.disabled=!0),e.opened&&(e.disabled||e.readonly?e.opened=!1:(e.$.dropDownContainer.style.transition="none",e._open(!0))),e.$.calendarButton.setAttribute("aria-expanded",e.opened),null===e.footerTemplate?e._setDefaultFooterTemplate(!0):(t.footerTemplate=e.footerTemplate,t._handleLayoutTemplate(t.$.footer,e.footerTemplate)),""===e.formatString&&(e.formatString="dd-MMM-yy HH:mm:ss.fff");const a=e.displayKind;let n;if("UTC"===a?e._outputTimeZone="UTC":"local"===a&&(e._outputTimeZone="Local"),null!==e.value?(n=Smart.Utilities.DateTime.validateDate(e.value,new Smart.Utilities.DateTime,e.formatString),e._inputTimeZone=n.timeZone,"unspecified"!==a&&e._inputTimeZone!==e._outputTimeZone?n=n.toTimeZone(e._outputTimeZone):"unspecified"===a&&(e._outputTimeZone=e._inputTimeZone)):(n=null,e._inputTimeZone="Local"),e._validateRestrictedDates(),e._validateMinMax("both"),e._validateValue(n,e._now(),!1,!0),e._validateInterval(new Smart.Utilities.TimeSpan(0,0,1)),e._getFormatStringRegExp(),e._defaultFooterTemplateApplied&&""===e._hourElement.value&&null!==e.value){const t=e.value;e._hourElement.value=t.toString("hh"),e._ampmElement.value=t.toString("tt"),e._minuteElement.value=t.toString("mm")}e._detectDisplayMode();const i=e._dropDownDisplayMode;"default"===i||"calendar"===i?(t.viewSections=["title","header"],t.$title.hasClass("smart-hidden")&&t.propertyChangedHandler("viewSections",["header","footer"],["title","header"]),"default"===i&&e.$dropDownHeader.removeClass("smart-hidden")):"timePicker"===i&&(e.$calendarDropDown.addClass("smart-hidden"),e._initializeTimePicker()),e.footer&&e._handleFooter()}_validateInterval(e){const t=this,a=t.interval;let n=a;if(a instanceof Smart.Utilities.TimeSpan)n=a;else if("string"==typeof a){const i=a.indexOf("TimeSpan("),o=a.indexOf(")");if(-1!==i&&-1!==o&&(n=a.slice(i+9,o),n=n.replace(/'/g,"").replace(/"/g,"").replace(/^\s+|\s+$|\s+(?=\s)/g,""),new RegExp(/(^(\d+)(,\s*\d+)*$)/g).test(n)&&(n=n.replace(/\s/g,""),n=n.split(","),n.map((function(e,t){n[t]=parseInt(e)})),n.unshift(null),n=new(Function.prototype.bind.apply(Smart.Utilities.TimeSpan,n)))),n instanceof Smart.Utilities.TimeSpan==0){if(""===n.trim())return void(t.interval=e);isNaN(n)||(n=1e4*parseInt(n,10));try{n=new Smart.Utilities.TimeSpan(n)}catch(a){return void(t.interval=e)}}}else{if("number"!=typeof a)return void(t.interval=e);n=new Smart.Utilities.TimeSpan(a)}0===n._ticks?t.interval=e:t.interval=n}_validateMinMax(e,t){const a=this;let n=!1;"max"!==e&&(a.min=Smart.Utilities.DateTime.validateDate(a.min,t||new Smart.Utilities.DateTime(1600,1,1),a.formatString),a.min=a.min.toTimeZone(a._outputTimeZone),n=!0),"min"!==e&&(a.max=Smart.Utilities.DateTime.validateDate(a.max,t||new Smart.Utilities.DateTime(3001,1,1),a.formatString),a.max=a.max.toTimeZone(a._outputTimeZone),a.max.calendar.days=a._localizedDays,a.max.calendar.months=a._localizedMonths,a.max.calendar.locale=a.locale,a.$.calendarDropDown.max=a.max.toDate()),a.min.compare(a.max)>0&&(a.min=a.max.clone(),n=!0),n&&(a.min.calendar.days=a._localizedDays,a.min.calendar.months=a._localizedMonths,a.min.calendar.locale=a.locale,a.$.calendarDropDown.min=a.min.toDate())}_validateRestrictedDates(){const e=this,t=[],a=[];for(let n=0;n<e.restrictedDates.length;n++){const i=e.restrictedDates[n];let o=Smart.Utilities.DateTime.validateDate(i,"invalid",e.formatString);"invalid"!==o&&(o=o.toTimeZone(e._outputTimeZone),t.push(o),a.push(o.toDate()))}e.restrictedDates=t,e.$.calendarDropDown.restrictedDates=a}_validateValue(e,t,a,n){const i=this,o=void 0!==t?t:i._cloneValue();if(null===e||""===e)return void i._setNullValue(o);if(e&&"string"==typeof e)if(-1===e.indexOf("-")&&-1===e.indexOf("/")&&-1===e.indexOf(".")){if(i.formatString){let t="",a=0;for(let n=0;n<i.formatString.length;n++)"-"===i.formatString[n]||"/"===i.formatString[n]||"."===i.formatString[n]?t+=i.formatString[n]:e[a]?(t+=e[a],a++):t+=i.formatString[n];if(t.indexOf("y")>=0){let e=t.substring(t.indexOf("y")-2);const a=i.yearCutoff.toString(),n=parseInt(a.slice(2),10);let o=parseInt(a.slice(0,2),10);e=parseInt(e,10),e<n&&o++,e=e.toString(),"NaN"!==e?(e=o+""+"0".repeat(2-e.length)+e,t=t.substring(0,t.indexOf("y")-2)+e):t=null}e=t}}else{let t=e.indexOf("-")>=0?"-":"";if(""===t&&(t=e.indexOf("/")>=0?"/":""),""===t&&(t=e.indexOf(".")>=0?".":""),t&&i.formatString.indexOf("yyyy")>=0){const a=e.split(t);let n=a[a.length-1];if(n.length<4){const o=i.yearCutoff.toString(),l=parseInt(o.slice(2),10);let r=parseInt(o.slice(0,2),10);n=parseInt(n,10),n<l&&r++,n=n.toString(),n=r+""+"0".repeat(2-n.length)+n,a[a.length-1]=n,e=a.join(t)}}}if(void 0!==e&&(i._value=Smart.Utilities.DateTime.validateDate(e,o,i.formatString)),null===i._value)return void i._setNullValue(o);let l=i._value;for(;!0===i._isRestricted(l);)l.addDays(1,!1);const r=i._rangeValidation(l);n&&"strict"!==i.validation?!1===l.equals(r)&&(i._minMaxChanged=!0):(i._value=r,delete i._minMaxChanged),i.value=i._value.toTimeZone(i._inputTimeZone);const s=i._value;if(s.calendar.days=i._localizedDays,s.calendar.months=i._localizedMonths,s.calendar.locale=i.locale,i._applyFormatString(),i._disableSpinButtons(),(null===o||null===s)&&o!==s||null!==o&&null!==s&&0!==o.compare(s)){if(!1!==a&&i.isInitialized&&!n&&(i.$.fireEvent("change",{oldValue:null!==o?o.toTimeZone(i._inputTimeZone):null,value:i.value}),i._updateTargetValue()),i._calendarInitiatedChange)return;i.opened?(null!==o&&0!==i.$.calendarDropDown.selectedDates.length&&o.year()===s.year()&&o.month()===s.month()&&o.day()===s.day()&&i.$.calendarDropDown._isDateInView(s.toDate())||(i._disregardCalendarChangeEvent=!0,i.$.calendarDropDown.selectedDates=[s.toDate()]),i._defaultFooterTemplateApplied&&(null!==o&&o.hour()===s.hour()||(i._hourElement.value=s.toString("hh"),i._ampmElement.value=s.toString("tt")),null!==o&&o.minute()===s.minute()||(i._minuteElement.value=s.toString("mm"))),i._timePickerInitialized&&!i._timePickerInitiatedChange&&(i.$.timePickerDropDown.value=s.toDate()),i._toSync=!1):i._toSync=!0}}});
|
|
115
|
+
Smart("smart-date-time-picker",class extends Smart.BaseElement{static get properties(){return{animationSettings:{value:null,type:"object"},autoClose:{value:!1,type:"boolean"},autoCloseDelay:{value:0,type:"number"},autoSwitchToMinutes:{value:!1,type:"boolean"},calendarButton:{value:!1,type:"boolean"},calendarButtonPosition:{value:"right",allowedValues:["left","right"],type:"string"},calendarMode:{value:"default",allowedValues:["default","classic"],type:"string"},dayNameFormat:{value:"firstTwoLetters",allowedValues:["narrow","firstTwoLetters","long","short"],type:"string"},disableAutoNavigation:{value:!1,type:"boolean"},displayKind:{value:"unspecified",allowedValues:["UTC","local","unspecified"],type:"string"},displayModeView:{value:"table",allowedValues:["table","list"],type:"string"},displayMode:{allowedValues:["outlined","filled","underlined"],value:"outlined",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownDisplayMode:{value:"default",allowedValues:["default","classic","calendar","timePicker","auto"],type:"string"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPosition:{value:"auto",allowedValues:["auto","bottom","overlay-top","overlay-center","overlay-bottom","top","center-bottom","center-top"],type:"string"},editMode:{value:"default",allowedValues:["default","full","partial"],type:"string"},enableMouseWheelAction:{value:!1,type:"boolean"},firstDayOfWeek:{value:0,type:"number"},footerTemplate:{value:null,type:"any"},footer:{value:!1,type:"boolean"},formatString:{value:"dd-MMM-yy HH:mm:ss.fff",type:"string"},headerTemplate:{value:null,type:"any"},hideDayNames:{value:!1,type:"boolean"},hideOtherMonthDays:{value:!1,type:"boolean"},hideTooltipArrow:{value:!1,type:"boolean"},hint:{value:"",type:"string"},importantDates:{value:[],type:"array"},importantDatesTemplate:{value:null,type:"any"},interval:{value:new Smart.Utilities.TimeSpan(0,0,1),type:"any"},label:{value:"",type:"string"},max:{value:new Smart.Utilities.DateTime(3001,1,1),type:"any"},messages:{value:{en:{now:"Now",dateTabLabel:"DATE",timeTabLabel:"TIME"}},type:"object",extend:!0},min:{value:new Smart.Utilities.DateTime(1600,1,1),type:"any"},name:{value:"",type:"string"},nullable:{value:!1,type:"boolean"},opened:{value:!1,type:"boolean"},placeholder:{value:"Enter date",type:"string"},restrictedDates:{value:[],type:"array"},spinButtons:{value:!1,type:"boolean"},spinButtonsDelay:{value:75,type:"number"},spinButtonsInitialDelay:{value:0,type:"number"},spinButtonsPosition:{value:"right",allowedValues:["left","right"],type:"string"},tooltip:{value:!1,type:"boolean"},tooltipDelay:{value:100,type:"number"},tooltipPosition:{value:"top",allowedValues:["bottom","top","left","right","absolute"],type:"string"},tooltipTemplate:{value:null,type:"any"},validation:{value:"strict",allowedValues:["strict","interaction"],type:"string"},value:{defaultReflectToAttribute:!0,value:new Smart.Utilities.DateTime,type:"any"},weekNumbers:{value:!1,type:"boolean"},weeks:{value:6,type:"number"},yearCutoff:{value:1926,type:"number"}}}static get listeners(){return{"container.mouseout":"_mouseoutHandler","container.mouseover":"_mouseoverHandler","calendarButton.click":"_calendarButtonClickHandler","calendarDropDown.change":"_calendarDropDownChangeHandler","calendarDropDown.click":"_calendarDropDownClickHandler","downButton.click":"_spinButtonsClickHandler","input.blur":"_inputBlurHandler","input.change":"_inputChangeHandler","input.dragstart":"_inputDragstartHandler","input.focus":"_inputFocusHandler","input.keydown":"_inputKeydownHandler","input.down":"_inputDownHandler","input.paste":"_inputPasteHandler","input.select":"_inputSelectHandler","input.up":"_inputUpHandler","input.wheel":"_inputWheelHandler","dropDownContainer.keydown":"_dropDownKeydownHandler","dropDownContainer.transitionend":"_dropDownTransitionendHandler","dropDownHeader.click":"_dropDownHeaderClickHandler","upButton.click":"_spinButtonsClickHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.Utilities.DateTime":"smart.date.js","Smart.Utilities.Draw":"smart.draw.js","Smart.Utilities.BigNumber":"smart.math.js","Smart.Utilities.NumericProcessor":"smart.numeric.js","Smart.RepeatButton":"smart.button.js","Smart.Calendar":"smart.calendar.js","Smart.TimePicker":"smart.timepicker.js"}}static get styleUrls(){return["smart.datetimepicker.css"]}template(){return'<div id="container" role="presentation">\n <span id="label" class="smart-label">[[label]]</span>\n <div id="content" class="smart-content">\n <input id="input" class="smart-input smart-date-time-input" type="text" readonly="[[readonly]]" disabled="[[disabled]]" placeholder="[[placeholder]]" name="[[name]]" aria-label="[[placeholder]]" />\n <div id="spinButtonsContainer" class="smart-spin-buttons-container" role="presentation">\n <smart-repeat-button initial-delay="[[spinButtonsInitialDelay]]" animation="[[animation]]" delay="[[spinButtonsDelay]]" readonly="[[readonly]]" unfocusable id="upButton" right-to-left="[[rightToLeft]]" class="smart-spin-button" aria-label="Increment">\n <div class="smart-arrow smart-arrow-up" aria-hidden="true"></div>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="[[spinButtonsInitialDelay]]" animation="[[animation]]" delay="[[spinButtonsDelay]]" readonly="[[readonly]]" unfocusable id="downButton" right-to-left="[[rightToLeft]]" class="smart-spin-button" aria-label="Decrement">\n <div class="smart-arrow smart-arrow-down" aria-hidden="true"></div>\n </smart-repeat-button>\n </div>\n <div id="calendarButton" class="smart-drop-down-button smart-calendar-button" role="button" aria-haspopup="dialog" aria-label="Toggle popup"></div>\n <div id="dropDownContainer" class="smart-drop-down smart-date-time-drop-down smart-drop-down-container smart-visibility-hidden" role="dialog">\n <div id="dropDownHeader" class="smart-drop-down-header smart-hidden" role="heading" aria-level="1">\n <div id="selectDate" class="smart-selected" role="button"></div>\n <div id="selectTime" role="button"></div>\n </div>\n <div id="dropDownContent" class="smart-drop-down-content" role="presentation">\n <smart-calendar id="calendarDropDown" class="smart-hidden"\n animation="[[animation]]"\n animation-settings="[[animationSettings]]"\n calendar-mode="[[calendarMode]]"\n day-name-format="[[dayNameFormat]]"\n disable-auto-navigation="[[disableAutoNavigation]]"\n display-mode-view="[[displayModeView]]"\n first-day-of-week="[[firstDayOfWeek]]"\n header-template="[[headerTemplate]]"\n hide-day-names="[[hideDayNames]]"\n hide-other-month-days="[[hideOtherMonthDays]]"\n hide-tooltip-arrow="[[hideTooltipArrow]]"\n important-dates="[[importantDates]]"\n important-dates-template="[[importantDatesTemplate]]"\n locale="[[locale]]"\n right-to-left="[[rightToLeft]]"\n selection-mode="one"\n spin-buttons-delay="[[spinButtonsDelay]]"\n spin-buttons-initial-delay="[[spinButtonsInitialDelay]]"\n theme="[[theme]]"\n tooltip="[[tooltip]]"\n tooltip-delay="[[tooltipDelay]]"\n tooltip-position="[[tooltipPosition]]"\n tooltip-template="[[tooltipTemplate]]"\n unfocusable="[[unfocusable]]"\n view-sections=\'["header", "footer"]\'\n week-numbers="[[weekNumbers]]"\n weeks="[[weeks]]"></smart-calendar>\n </div>\n </div>\n </div>\n <span id="hint" inner-h-t-m-l="[[hint]]" class="smart-hint smart-hidden"></span>\n </div>'}attached(){const e=this;super.attached(),e.isCompleted&&(e._defaultFooterTemplateApplied&&e._addCalendarFooterListeners(),e.$.timePickerDropDown&&e._addTimePickerListener(),e._positionDetection&&e._positionDetection.dropDownAttached())}detached(){const e=this;if(super.detached(),e.close(),e._defaultFooterTemplateApplied){const t=e.$.calendarDropDown.$footer;t.unlisten("change"),t.unlisten("click"),t.unlisten("wheel")}e.$.timePickerDropDown&&e.$.timePickerDropDown.$.unlisten("change"),e._positionDetection&&e._positionDetection.dropDownDetached()}ready(){super.ready();const e=this;e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._iOS=!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform),e._edgeMacFF&&e.$dropDownContainer.addClass("not-in-view"),e._defaultFooterTemplate=document.createElement("template"),e._defaultFooterTemplate.innerHTML='<div class="smart-date-time-picker-footer">\n <div class="smart-footer-component smart-footer-component-hour" role="presentation">\n <input type="text" class="smart-hour-element" aria-label="Hours" />\n <span role="presentation">\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Increment hours">\n <span class="smart-arrow smart-arrow-up" aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Decrement hours">\n <span class="smart-arrow smart-arrow-down" aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n <div class="smart-footer-component smart-footer-component-minute" role="presentation">\n <input class="smart-minute-element" aria-label="Minutes" />\n <span role="presentation">\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Increment minutes">\n <span class="smart-arrow smart-arrow-up" aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button initial-delay="0" delay="75" aria-label="Decrement minutes">\n <span class="smart-arrow smart-arrow-down" aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n <div class="smart-footer-component smart-footer-component-ampm" role="presentation">\n <input type="text" class="smart-am-pm-element" aria-label="AM/PM" />\n </div>\n <div class="smart-footer-component smart-footer-component-today" role="presentation">\n <div tabindex="-1" class="smart-today-element" role="button" aria-label="Now"></div>\n </div>\n </div>',e._codeToMethod={y:"addYears",yy:"addYears",yyyy:"addYears",yyyyy:"addYears",M:"addMonths",MM:"addMonths",MMM:"addMonths",MMMM:"addMonths",d:"addDays",dd:"addDays",ddd:"addDays",dddd:"addDays",H:"addHours",HH:"addHours",h:"addHours",hh:"addHours",m:"addMinutes",mm:"addMinutes",s:"addSeconds",ss:"addSeconds",f:"addDeciseconds",ff:"addCentiseconds",fff:"addMilliseconds",u:"addMicroseconds",uu:"addMicroseconds",n:"addNanoseconds",nn:"addNanoseconds",p:"addPicoseconds",pp:"addPicoseconds",e:"addFemtoseconds",ee:"addFemtoseconds",a:"addAttoseconds",aa:"addAttoseconds",x:"addZeptoseconds",xx:"addZeptoseconds",o:"addYoctoseconds",oo:"addYoctoseconds"},e._codeToIndex={y:0,yy:0,yyyy:0,yyyyy:0,M:1,MM:1,MMM:1,MMMM:1,d:2,dd:2,ddd:2,dddd:2,H:3,HH:3,h:3,hh:3,m:4,mm:4,s:5,ss:5,f:6,ff:6,fff:6,u:7,uu:7,n:8,nn:8,p:9,pp:9,e:10,ee:10,a:11,aa:11,x:12,xx:12,o:13,oo:13},e._getLocalizedNames(),e.checkLicense()}render(){const e=this;e.rightToLeft&&(e.calendarButtonPosition="right"===e.calendarButtonPosition?"left":"right"),e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDownContainer,e.$.content,"close"),e._positionDetection.customPositionDropDown=e._positionExternalDropDown,e._positionDetection.getDropDownParent(!0),e._positionDetection.setDropDownPosition(),e.$.dropDownContainer.style.left=null,e._positionDetection.handleAutoPositioning(),e._setIds(),e._validateInitialPropertyValues(),e._setFocusable(),e.setAttribute("role","presentation"),e.$.input.setAttribute("aria-describedby",e.$.hint.id),e.$.input.setAttribute("aria-labelledby",e.$.label.id),e.$.calendarButton.setAttribute("aria-owns",e.$.dropDownContainer.id),e.$.dropDownContainer.setAttribute("animation",e.animation),e.$.dropDownContainer.setAttribute("drop-down-display-mode",e.dropDownDisplayMode),super.render(),e.isInitialized=!0}close(){this.opened&&this._close()}focus(){this.$.input.focus()}select(){this.$.input.select()}open(){this.opened||this._open()}_handleFooter(){const e=this;if(e.footer){e.$.dropDownContainer.setAttribute("footer","");const t=e.$.calendarDropDown;"default"===e._dropDownDisplayMode?t.viewSections=["title","header","footer"]:"classic"===e._dropDownDisplayMode?t.viewSections=["header","footer"]:"calendar"===e._dropDownDisplayMode&&(t.viewSections=["title","header","footer"])}else e.$.dropDownContainer.removeAttribute("footer")}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"animation":case"theme":n.$.timePickerDropDown&&(n.$.timePickerDropDown[e]=a),"animation"===e&&(n.$.dropDownContainer.setAttribute("animation",n.animation),n._defaultFooterTemplateApplied&&Array.from(n.$.calendarDropDown.$.footer.getElementsByTagName("smart-repeat-button")).forEach((function(e){e.animation=a})));break;case"calendarButton":n.$.dropDownContainer.style.transition="none",a||n.close();break;case"calendarButtonPosition":n.$.dropDownContainer.style.transition="none",n.close(),"left"===a?n.$.content.insertBefore(n.$.calendarButton,n.$.content.firstElementChild):null===n._dropDownParent?n.$.content.insertBefore(n.$.calendarButton,n.$.dropDownContainer):n.$.content.appendChild(n.$.calendarButton);break;case"disabled":a?(n.close(),n.$.upButton.disabled=!0,n.$.downButton.disabled=!0):n._disableSpinButtons(),n._setFocusable(),n._positionDetection.handleAutoPositioning();break;case"displayKind":{const e=n._outputTimeZone;switch(a){case"unspecified":n._outputTimeZone=n._inputTimeZone;break;case"UTC":n._outputTimeZone="UTC";break;case"local":n._outputTimeZone="Local"}if(n._outputTimeZone===e)return;null!==n._value&&(n.close(),n._toSync=!0,n._value=n._value.toTimeZone(n._outputTimeZone),n._applyFormatString()),n.min=n.min.toTimeZone(n._outputTimeZone),n.max=n.max.toTimeZone(n._outputTimeZone);for(let e=0;e<n.restrictedDates.length;e++){let t=n.restrictedDates[e];t=t.toTimeZone(n._outputTimeZone)}break}case"dropDownAppendTo":n._positionDetection.dropDownAppendToChangedHandler();break;case"dropDownDisplayMode":n._changeDropDownDisplayMode();break;case"dropDownOverlay":a||n._positionDetection.removeOverlay();break;case"dropDownPosition":n._positionDetection.dropDownPositionChangedHandler();break;case"footer":n._handleFooter();break;case"footerTemplate":if(null!==a){n._defaultFooterTemplateApplied=!1;const e=n.$.calendarDropDown.$footer;e.unlisten("change"),e.unlisten("click"),e.unlisten("wheel"),n.$.calendarDropDown.footerTemplate=a}else{n._setDefaultFooterTemplate();const e=n._value;n._hourElement.value=e.toString("hh"),n._minuteElement.value=e.toString("mm"),n._ampmElement.value=e.toString("tt")}n._handleFooter();break;case"formatString":""===a&&(n.formatString="dd-MMM-yy HH:mm:ss.fff"),n._getFormatStringRegExp(),n._applyFormatString(),"auto"===n.dropDownDisplayMode&&n._changeDropDownDisplayMode(),n._timePickerInitialized&&(n.$.timePickerDropDown.format=n._formatStringRegExp.groups.find((e=>-1!==e.indexOf("H")))?"24-hour":"12-hour");break;case"interval":n._validateInterval(t);break;case"locale":case"messages":if(n.$.selectDate.innerHTML=n.localize("dateTabLabel"),n.$.selectTime.innerHTML=n.localize("timeTabLabel"),n._defaultFooterTemplateApplied&&(n._todayElement.title=n.localize("now")),"messages"===e)return;n._getLocalizedNames(),n.min.calendar.days=n._localizedDays,n.min.calendar.months=n._localizedMonths,n.min.calendar.locale=n.locale,n.max.calendar.days=n._localizedDays,n.max.calendar.months=n._localizedMonths,n.max.calendar.locale=n.locale,null!==n.value&&(n._value.calendar.days=n._localizedDays,n._value.calendar.months=n._localizedMonths,n._value.calendar.locale=n.locale,n.value.calendar.days=n._localizedDays,n.value.calendar.months=n._localizedMonths,n.value.calendar.locale=n.locale),Smart.Utilities.DateTime.cache=[],n._applyFormatString();break;case"max":case"min":n._validateMinMax(e,t),"strict"===n.validation?n._validateValue():n._minMaxChanged=!0;break;case"nullable":!0===t&&null===n._value&&n._validateValue(n._now(),null);break;case"opened":a?n._open():n._close();break;case"readonly":case"unfocusable":a&&n.close(),"unfocusable"===e&&n._setFocusable();break;case"restrictedDates":n._validateRestrictedDates(),n._validateValue();break;case"spinButtonsPosition":"right"===a?n.$.content.insertBefore(n.$.spinButtonsContainer,n.$.input.nextElementSibling):n.$.content.insertBefore(n.$.spinButtonsContainer,n.$.input);break;case"validation":"strict"===a&&(delete n._minMaxChanged,n._validateValue());break;case"value":{let e;null!==a?(e=Smart.Utilities.DateTime.validateDate(a,n._now(),n.formatString),e=e.toTimeZone(n._outputTimeZone)):e=null,n._validateValue(e,n._value,void 0,!0);break}}}setDate(e){const t=this;let a;null!==e?(a=Smart.Utilities.DateTime.validateDate(e,t._now(),t.formatString),a=a.toTimeZone(t._outputTimeZone)):a=null,t._validateValue(a,t._value,void 0,!0)}getDate(){return this.value&&this.value.toDate?this.value.toDate():null}_addCalendarFooterListeners(){const e=this,t=e.$.calendarDropDown.$footer;t.listen("change",e._footerChangeHandler.bind(e)),t.listen("click",e._footerClickHandler.bind(e)),t.listen("wheel",e._footerWheelHandler.bind(e))}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const a=e.dataset.property,n=e.value;a&&void 0!==t[a]&&(t[a]=n)}}}_addTimePickerListener(){const e=this;e.$.timePickerDropDown.$.listen("change",(function(t){const a=e.context,n=t.detail.value,i=Smart.Utilities.DateTime.getConstructorParameters(null!==e._value?e._value:e._now());e.context=e,i[3]=n.getHours(),i[4]=n.getMinutes(),e._timePickerInitiatedChange=!0,i.unshift(null),e._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,i))),e._timePickerInitiatedChange=!1,e.context=a}))}_applyFormatString(){const e=this;null!==e.value&&(e.$.input.value=e._value.toString(e.formatString))}_calendarButtonClickHandler(e){const t=this;t._highlightedTimePart=void 0,t.disabled||t.readonly||(t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t.$.calendarButton,e.pageX,e.pageY),t.opened?t._close():t._open())}_calendarDropDownChangeHandler(e){const t=this;if(e.stopPropagation(),t._disregardCalendarChangeEvent)t._disregardCalendarChangeEvent=!1;else if(this.$.calendarDropDown.selectedDates.length>0){const a=e.detail.value[0],n=null!==t._value?t._value:t._now(),i=Smart.Utilities.DateTime.getConstructorParameters(n);if(i[0]=a.getFullYear(),i[1]=a.getMonth()+1,i[2]=a.getDate(),t._calendarInitiatedChange=!0,i.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,i))),t._defaultFooterTemplateApplied){const e=t._value;""===t._hourElement.value&&(t._hourElement.value=e.toString("hh")),""===t._ampmElement.value&&(t._ampmElement.value=e.toString("tt")),""===t._minuteElement.value&&(t._minuteElement.value=e.toString("mm"))}t._calendarInitiatedChange=!1}else t._setNullValue()}_calendarDropDownClickHandler(e){const t=this;t.autoClose&&e.target.closest(".smart-calendar-cell")&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay))}_changeDropDownDisplayMode(){function e(e,a,n,i){t.$dropDownHeader[e]("smart-hidden"),t.$calendarDropDown[a]("smart-hidden"),t._timePickerInitialized&&t.$.timePickerDropDown.$[n]("smart-hidden"),i&&(t.opened?t.$.calendarDropDown._refreshTitle():t._toSync=!0)}const t=this,a=t._dropDownDisplayMode;t._detectDisplayMode(),t._dropDownDisplayMode!==a&&("default"===t._dropDownDisplayMode?(t.calendarMode="default",t.$.calendarDropDown.viewSections=["title","header"],t.$selectDate.addClass("smart-selected"),t.$selectTime.removeClass("smart-selected"),e("removeClass","removeClass","addClass",!0)):"classic"===t._dropDownDisplayMode?(t.calendarMode="classic",t.$.calendarDropDown.viewSections=["header","footer"],e("addClass","removeClass","addClass")):"calendar"===t._dropDownDisplayMode?(t.calendarMode="default",t.$.calendarDropDown.viewSections=["title","header"],e("addClass","removeClass","addClass",!0)):(t.calendarMode="default",e("addClass","addClass","removeClass"),t._timePickerInitialized||t._initializeTimePicker()),t.$.dropDownContainer.setAttribute("drop-down-display-mode",t.dropDownDisplayMode))}_cloneValue(){const e=this;return null!==e._value?e._value.clone():null}_close(){const e=this;if(e.$.fireEvent("closing").defaultPrevented)e.opened=!0;else{e.$.calendarDropDown.disabled=!0,e.$calendarButton.removeClass("smart-calendar-button-pressed"),e.$.calendarButton.removeAttribute("active"),e.$dropDownContainer.addClass("smart-visibility-hidden");const t=e.$.calendarDropDown.$.container.querySelector(".smart-calendar-cell[hover]");t&&t.removeAttribute("hover"),e.opened=!1,e._positionDetection.removeOverlay(!0),e.$.fireEvent("close"),e._edgeMacFF&&!e.hasAnimation&&(e.$.dropDownContainer.style.top=null,e.$.dropDownContainer.style.left=null,e.$dropDownContainer.addClass("not-in-view")),e.$.input.focus()}e.$.calendarButton.setAttribute("aria-expanded",e.opened)}_detectDisplayMode(){const e=this;"auto"!==e.dropDownDisplayMode?e._dropDownDisplayMode=e.dropDownDisplayMode:e._dropDownDisplayMode=Smart.Utilities.DateTime.detectDisplayMode(e.value||e.min,e.formatString,e._formatStringRegExp),"timePicker"===e._dropDownDisplayMode?(e.$calendarButton.addClass("time"),"Enter date"===e.placeholder&&(e.placeholder="Enter time")):(e.$calendarButton.removeClass("time"),"Enter time"===e.placeholder&&(e.placeholder="Enter date")),"default"===e._dropDownDisplayMode?e.$dropDownContent.removeClass("partial"):e.$dropDownContent.addClass("partial")}_disableSpinButtons(){const e=this;if(e.disabled)return;const t=null===e._value;e.$.upButton.disabled=t,e.$.downButton.disabled=t}_documentUpHandler(e){const t=this,a=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement,n=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;Smart.Utilities.Core.isMobile||a!==t.$.input||"partial"!==t.editMode||null===t._value||n===t.$.input&&t.$.input.selectionStart!==t.$.input.selectionEnd?n===t.$.calendarButton||t.$.dropDownContainer.contains(n)||t.$.dropDownContainer.contains(t._getRootShadowHost(n))||(t.close(),a===t.$.input||t.contains(n)||(t._highlightedTimePart=void 0)):(t._highlightedTimePartEdit=!1,t._validateValue(t.$.input.value,t._cloneValue(),!1),t._highlightTimePartBasedOnCursor()),t._mouseFocus=!1}_getRootShadowHost(e){const t=this;if(!t.shadowRoot&&!t.isInShadowDOM)return;let a,n=e.getRootNode().host;for(;n&&n!==t&&n!==document;)a=n,n=n.getRootNode().host;return a}_dropDownHeaderClickHandler(e){const t=this;if(e.target===t.$.selectDate){if(t.$selectDate.hasClass("smart-selected"))return;t.$selectDate.addClass("smart-selected"),t.$selectTime.removeClass("smart-selected"),t.$.timePickerDropDown.$.addClass("smart-hidden"),t.$calendarDropDown.removeClass("smart-hidden")}else{if(t.$selectTime.hasClass("smart-selected"))return;t.$selectDate.removeClass("smart-selected"),t.$selectTime.addClass("smart-selected"),t.$calendarDropDown.addClass("smart-hidden"),t._timePickerInitialized?t.$.timePickerDropDown.$.removeClass("smart-hidden"):t._initializeTimePicker()}}_dropDownKeydownHandler(e){const t=this,a=e.key,n=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;!t.$.dropDownHeader.contains(n)||"Enter"!==a&&" "!==a?"Escape"===a||e.altKey&&"ArrowUp"===a?(e.preventDefault(),t.close(),t.$.input.focus()):"Enter"!==a&&" "!==a||!n.classList.contains("smart-footer-component-today")?"Enter"===a&&(n===t.$.calendarDropDown.$.body&&t.$.calendarDropDown.querySelectorAll(".smart-calendar-cell[selected][focus]").length>0||t._timePickerInitialized&&n===t.$.timePickerDropDown.$.picker)&&(e.preventDefault(),t.close()):(e.preventDefault(),t._validateValue(t._now()),t.close()):(e.preventDefault(),t._dropDownHeaderClickHandler({target:n}))}_dropDownTransitionendHandler(){const e=this;if(e.hasAnimation)return e.opened&&e._toFocus?(e._toFocus.focus(),delete e._toFocus,void(e._timePickerInitialized&&!e.$.timePickerDropDown.classList.contains("smart-hidden")&&requestAnimationFrame((()=>e.$.timePickerDropDown._highlightLabel())))):e._edgeMacFF&&!e.opened?(e.$.dropDownContainer.style.top=null,e.$.dropDownContainer.style.left=null,void e.$dropDownContainer.addClass("not-in-view")):void 0}_footerChangeHandler(e){const t=this,a=t.context,n=e.target,i=null!==t._value?t._value:t._now();let o,l=n.value;if(t.context=t,e.stopPropagation(),n.classList.contains("smart-hour-element")){if(l=parseInt(l,10),isNaN(l)||l<0||l>12)return void(n.value=i.toString("hh"));l>0&&l<12&&"PM"===i.toString("tt")&&(l+=12),o="hh"}else{if(!n.classList.contains("smart-minute-element")){if(null===t._value)return void(n.value="");const e=i.toString("tt");return l=l.toLowerCase(),void("PM"===e&&("a"===l||"am"===l)||"AM"===e&&("p"===l||"pm"===l)?(t._incrementDecrement(void 0,"tt"),n.value=t._value.toString("tt")):n.value=e)}if(l=parseInt(l,10),isNaN(l)||l<0||l>59)return void(n.value=i.toString("mm"));o="mm"}const r=Smart.Utilities.DateTime.getConstructorParameters(i);r[t._codeToIndex[o]]=l,r.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,r))),n.value=t._value.toString(o),t.context=a}_footerClickHandler(e){const t=this,a=t.context,n=e.target;if(t.context=t,n.classList.contains("smart-today-element"))t._validateValue(t._now()),t.autoClose&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay));else{const e=n.closest("smart-repeat-button");if(null!==e){const a=e===e.parentElement.children[1],n=e.closest(".smart-footer-component").classList.contains("smart-footer-component-hour")?"hh":"mm";t._incrementDecrement(a,n)}}t.context=a}_footerWheelHandler(e){const t=this,a=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;if(t.enableMouseWheelAction&&e.target instanceof HTMLInputElement&&a===e.target){const a=t.context,n=e.target;t.context=t,n.classList.contains("smart-hour-element")?t._incrementDecrement(e.deltaY>0,"hh"):n.classList.contains("smart-minute-element")?t._incrementDecrement(e.deltaY>0,"mm"):t._incrementDecrement(void 0,"tt"),t.context=a,e.stopPropagation()}}_getAndHighlightTimePart(e,t,a){const n=this;n._programmaticSelection=!0,n.$.input.selectionStart!==e||n.$.input.selectionEnd!==t?n.$.input.setSelectionRange(e,t):setTimeout((function(){n.$.input.setSelectionRange(e,t)}),200),n._highlightedTimePart={code:n._formatStringRegExp.groups[a],index:a,from:e,to:t}}_getFormatStringRegExp(){const e=this;e._formatStringRegExp=e.min.getParseRegExp(e.min.calendar,e.formatString.replace(/y+/g,"yyyyy")),e._formatStringRegExp.regExp=new RegExp(e._formatStringRegExp.regExp)}_getLocalizedNames(){const e=this,t=Smart.Utilities.DateTime.getLocalizedNames(e.locale);e._localizedDays=t.days,e._localizedMonths=t.months,e.$.selectDate.innerHTML=e.localize("dateTabLabel"),e.$.selectTime.innerHTML=e.localize("timeTabLabel")}_handleManualTimePartEdit(e){const t=this,a=Smart.Utilities.DateTime.getConstructorParameters(t._value);if(e=e[t._highlightedTimePart.index+1],isNaN(e)){if(1===t._codeToIndex[t._highlightedTimePart.code]){let n=-1;if(e.length>1&&t._localizedMonths.names.some((function(t,a){if(-1!==t.toLowerCase().indexOf(e.toLowerCase()))return n=a,!0})),-1===n)return void t._applyFormatString();a[1]=n+1}}else{if("f"===t._highlightedTimePart.code)e=100*parseInt(e,10);else if("ff"===t._highlightedTimePart.code)e=10*parseInt(e,10);else if(-1!==t._highlightedTimePart.code.indexOf("y")&&e.length<3){const a=t.yearCutoff.toString(),n=parseInt(a.slice(2),10);let i=parseInt(a.slice(0,2),10);(e=parseInt(e,10))<n&&i++,e=e.toString(),e=i+""+"0".repeat(2-e.length)+e}else if(-1!==t._highlightedTimePart.code.indexOf("h")){const a=t._value.hour();e=parseInt(e,10),a>11&&e<=11&&(e+=12)}a[t._codeToIndex[t._highlightedTimePart.code]]=parseInt(e,10)}try{a.unshift(null),t._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,a)))}catch(e){t._applyFormatString()}}_highlightTimePartBasedOnCursor(e){const t=this,a=t.$.input.value,n=t._formatStringRegExp.regExp.exec(a);function i(){return void 0===e?t.$.input.selectionStart:e}if(null===n)return void(t._highlightedTimePart=void 0);t._iOS||void 0!==e||(e=t.$.input.selectionStart);let o,l=n.index;for(let e=1;e<n.length;e++){const r=n[e];if(o=a.indexOf(r,l),l=o+r.length,1===e&&i()<o){t._getAndHighlightTimePart(o,l,0);break}if(i()>=o&&i()<=l){t._getAndHighlightTimePart(o,l,e-1);break}const s=n[e+1];if(!s){t._programmaticSelection=!0,t.$.input.setSelectionRange(o,l),t._highlightedTimePart={code:t._formatStringRegExp.groups[e-1],index:e-1,from:o,to:l};break}{const n=a.indexOf(s,l);if(i()>l&&i()<n){i()-l<=n-i()?t._getAndHighlightTimePart(o,l,e-1):(t._formatStringRegExp.groups[e],t._programmaticSelection=!0,t.$.input.setSelectionRange(n,n+s.length));break}}}}_highlightTimePartBasedOnIndex(e){const t=this,a=t.$.input.value,n=t._formatStringRegExp.regExp.exec(a);if(null===n)return t._validateValue(void 0,t._cloneValue(),!1),void t._highlightTimePartBasedOnIndex(e);let i,o=n.index;const l=t.shadowRoot?t.shadowRoot.activeElement:document.activeElement;if(!(e<0||e>=n.length)){t.$.input!==l&&t.$.input.focus();for(let l=1;l<n.length;l++){const r=n[l];if(i=a.indexOf(r,o),o=i+r.length,e===l-1){t._getAndHighlightTimePart(i,o,e);break}}}}_incrementDecrement(e,t){const a=this,n=a._cloneValue();if(a._minMaxChanged&&(a._value=a._rangeValidation(a._value),delete a._minMaxChanged),void 0===t&&a._highlightedTimePart&&(t=a._highlightedTimePart.code),void 0!==t){if("z"===t||"zz"===t||"zzz"===t)return void a._highlightTimePartBasedOnIndex(a._highlightedTimePart.index);a._value="t"===t||"tt"===t?a._value.addHours(a._value.hour()<12?12:-12,!0):a._value[a._codeToMethod[t]](e?-1:1,!0),a._validateValue(void 0,n,!1),a._highlightedTimePart&&a._highlightTimePartBasedOnIndex(a._highlightedTimePart.index)}else a._value=a._value.add(e?a.interval.negate():a.interval,void 0,!0),a._validateValue(void 0,n,!1);0!==n.compare(a._value)&&a.isInitialized&&(a.$.fireEvent("change",{oldValue:n.toTimeZone(a._inputTimeZone),value:a.value}),a._updateTargetValue())}_initializeTimePicker(){const e=this,t=document.createElement("smart-time-picker");t.rightToLeft=e.rightToLeft,t.animation=e.animation,t.autoSwitchToMinutes=e.autoSwitchToMinutes,t.format=e._formatStringRegExp.groups.find((e=>-1!==e.indexOf("H")))?"24-hour":"12-hour",t.theme=e.theme,t.value=null!==e._value?e._value.toDate():e._now(),e.$.timePickerDropDown=t,t.$=Smart.Utilities.Extend(t),e.$.dropDownContent.appendChild(t),e._timePickerInitialized=!0,e._addTimePickerListener()}_inputBlurHandler(){const e=this;e.removeAttribute("focus"),e._fullEdit=!1,e._highlightedTimePartEdit=!1,e.$.fireEvent("blur")}_inputChangeHandler(e){const t=this;if(e&&e.stopPropagation(),""!==t.$.input.value){if(t._fullEdit||null===t._value)t._fullEdit=!1,t._validateValue(t.$.input.value),t._highlightTimePartBasedOnCursor();else if(t._highlightedTimePartEdit){t._highlightedTimePartEdit=!1;let e=t._formatStringRegExp.regExp.exec(t.$.input.value);null!==e?t._handleManualTimePartEdit(e):t._applyFormatString()}}else t._setNullValue()}_inputDragstartHandler(e){e.preventDefault()}_inputFocusHandler(){const e=this;if(e.setAttribute("focus",""),"full"!==e.editMode){const t=Smart.Utilities.Core.isMobile?10:0;setTimeout((function(){e._iOS?e._highlightTimePartBasedOnCursor():!0!==e._mouseFocus&&(void 0===e._highlightedTimePart?e._highlightTimePartBasedOnCursor(e._iOS?void 0:0):e._highlightTimePartBasedOnIndex(e._highlightedTimePart.index))}),t)}e.$.fireEvent("focus")}_inputKeydownHandler(e){const t=this,a=t.editMode,n=e.key;if("Tab"!==n){if(e.altKey&&"ArrowDown"===n)return e.preventDefault(),void t.open();if("Escape"===n||e.altKey&&"ArrowUp"===n)return e.preventDefault(),void t.close();if("full"!==a){if("partial"===a){if("Delete"===n)return void(null!==t._value&&(t._setNullValue(),e.preventDefault()));if(null===t._value&&(t._validateValue(t._now(),null,!1),t._highlightTimePartBasedOnIndex(0)),-1!==["/",".","-",","," "].indexOf(n))return t._inputChangeHandler(),t._navigateToNextTimePart(),void e.preventDefault();if("Backspace"===n)return t._resetTimePart(),t._highlightedTimePart.index>0?t._navigateToPreviousTimePart():t._highlightTimePartBasedOnIndex(0),void e.preventDefault()}else if(t._fullEdit||t._highlightedTimePartEdit||t.readonly||-1!==["Alt","Control","Shift"].indexOf(n)||e.altKey||e.ctrlKey)return void(-1!==["End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].indexOf(n)&&t._highlightedTimePartEdit&&t._inputChangeHandler());if(-1!==["End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].indexOf(n)){if(e.preventDefault(),"partial"===a&&t._highlightedTimePartEdit&&t._inputChangeHandler(),null!==t._value)switch(n){case"End":t._highlightTimePartBasedOnIndex(t._formatStringRegExp.groups.length-1);break;case"Home":t._highlightTimePartBasedOnIndex(0);break;case"ArrowLeft":t._navigateToPreviousTimePart();break;case"ArrowUp":t._incrementDecrement();break;case"ArrowRight":t._navigateToNextTimePart();break;case"ArrowDown":t._incrementDecrement(!0)}}else if(t._highlightedTimePart){if("partial"!==a&&t._highlightedTimePart.to-t._highlightedTimePart.from!=t.$.input.selectionEnd-t.$.input.selectionStart)return void(t._fullEdit=!0);const i=t._highlightedTimePart.code;if("ddd"===i||"dddd"===i||"z"===i||"zz"===i||"zzz"===i||"t"===i||"tt"===i)return void e.preventDefault();if("partial"===a&&"MMM"!==i&&"MMMM"!==i&&!1===new RegExp(/^\d+$/).test(n))return void((n.length<2||"F"!==n.charAt(0))&&e.preventDefault());t._highlightedTimePartEdit=!0}}else t._fullEdit=!0}}_inputDownHandler(){const e=this;e._fullEdit||e._highlightedTimePartEdit||"full"===e.editMode||Smart.Utilities.Core.isMobile||setTimeout((function(){e._mouseFocus=!0,e._highlightTimePartBasedOnCursor()}),0)}_inputPasteHandler(e){"partial"===this.editMode?e.preventDefault():this._fullEdit=!0}_inputSelectHandler(){const e=this,t=e.shadowRoot?e.shadowRoot.activeElement:document.activeElement;"partial"===e.editMode&&t===e.$.input&&(!0===e._programmaticSelection?e._programmaticSelection=!1:e._highlightedTimePart?e._highlightTimePartBasedOnIndex(e._highlightedTimePart.index):e._highlightTimePartBasedOnIndex(0))}_inputUpHandler(){const e=this;Smart.Utilities.Core.isMobile&&(e._iOS?(e._mouseFocus=!0,setTimeout((function(){document.activeElement===e.$.input&&e._highlightTimePartBasedOnCursor()}),50)):setTimeout((function(){e._mouseFocus=!0,e._highlightTimePartBasedOnCursor()}),10))}_inputWheelHandler(e){const t=this;(t.shadowRoot?t.shadowRoot.activeElement:document.activeElement)!==t.$.input||!t.enableMouseWheelAction||t.disabled||t.readonly||(e.preventDefault(),t._incrementDecrement(e.deltaY>0))}_isRestricted(e){const t=this.restrictedDates;let a=!1;for(let n=0;n<t.length;n++)if(e.equalDateParts(t[n])){a=!0;break}return a}_mouseoutHandler(e){const t=this,a=e.target;t.disabled||a!==t.$.input&&a!==t.$.calendarButton||(a.removeAttribute("hover"),t.removeAttribute("hover"))}_mouseoverHandler(e){const t=this,a=e.target;t.disabled||a!==t.$.input&&a!==t.$.calendarButton||(a.setAttribute("hover",""),t.setAttribute("hover",""))}_navigateToNextTimePart(){this._highlightTimePartBasedOnIndex(this._highlightedTimePart.index+1)}_navigateToPreviousTimePart(){this._highlightTimePartBasedOnIndex(this._highlightedTimePart.index-1)}_now(){const e=this,t=new Smart.Utilities.DateTime("today","Local");return"Local"!==e._outputTimeZone?t.toTimeZone(e._outputTimeZone):t}_open(e){const t=this;if(t.disabled||t.readonly)return t.opened=!1,void t.$.calendarButton.setAttribute("aria-expanded",!1);if(t.$.fireEvent("opening").defaultPrevented)return t.opened=!1,void t.$.calendarButton.setAttribute("aria-expanded",!1);t._edgeMacFF&&t.$dropDownContainer.removeClass("not-in-view");const a=t.$.dropDownContainer;a.style.marginLeft=null,e||(a.style.transition=""),t.$.calendarDropDown.disabled=!1,t.$calendarButton.addClass("smart-calendar-button-pressed"),t.$.calendarButton.setAttribute("active",""),("default"!==t._dropDownDisplayMode&&"timePicker"!==t._dropDownDisplayMode||!t._timePickerInitialized||t._timePickerInitialized&&t.$.timePickerDropDown.$.hasClass("smart-hidden"))&&t.$calendarDropDown.removeClass("smart-hidden"),t.opened=!0,t.$.calendarButton.setAttribute("aria-expanded",!0),t._positionDetection.placeOverlay(),t._positionDetection.checkBrowserBounds("vertically"),t._positionDetection.positionDropDown(),t.$dropDownContainer.removeClass("smart-visibility-hidden");const n=1===window.devicePixelRatio?document.documentElement.clientWidth:window.innerWidth,i=a.getBoundingClientRect();if(i.left<0?a.style.marginLeft=-1*i.left+"px":i.right>n&&(a.style.marginLeft=n-i.right+"px"),t.$.fireEvent("open"),t._toSync){const e=t._value;if(null!==e)t._disregardCalendarChangeEvent=!0,t.$.calendarDropDown.selectedDates=[e.toDate()],t._defaultFooterTemplateApplied&&(t._hourElement.value=e.toString("hh"),t._minuteElement.value=e.toString("mm"),t._ampmElement.value=e.toString("tt")),t._timePickerInitialized&&(t.$.timePickerDropDown.value=e.toDate()),t._disregardCalendarChangeEvent=!1;else{const e=t.$.calendarDropDown.context;t.$.calendarDropDown.context=t.$.calendarDropDown,t.$.calendarDropDown._clearSelection(!0),t.$.calendarDropDown.context=e,t._defaultFooterTemplateApplied&&(t._hourElement.value="",t._minuteElement.value="",t._ampmElement.value="")}t._toSync=!1}let o;switch(t._dropDownDisplayMode){case"default":o=t.$selectDate.hasClass("smart-selected")?t.$.calendarDropDown:t.$.timePickerDropDown.$.picker;break;case"classic":case"calendar":o=t.$.calendarDropDown;break;case"timePicker":o=t.$.timePickerDropDown.$.picker}t.hasAnimation?(t._toFocus=o,function e(){t._toFocus&&(0===t.$.dropDownContainer.getBoundingClientRect().height?requestAnimationFrame(e):t._dropDownTransitionendHandler())}()):o.focus()}_positionExternalDropDown(e){const t=this.context,a=!t.calendarButton||"right"===t.calendarButtonPosition,n=t._dropDownListPosition,i=t.$.dropDownContainer;let o,l=a?e.right-i.offsetWidth:e.left;switch(n){case"bottom":o=e.bottom;break;case"overlay-top":o=e.bottom-i.offsetHeight;break;case"overlay-center":o=e.top+e.height/2-i.offsetHeight/2;break;case"overlay-bottom":o=e.top;break;case"top":o=e.top-i.offsetHeight;break;case"center-bottom":case"center-top":o="center-bottom"===n?e.bottom+5:e.top-5-i.offsetHeight,l=a?e.right-i.offsetWidth/2-t.$.calendarButton.offsetWidth/2:e.left-i.offsetWidth/2+t.$.calendarButton.offsetWidth/2}return{left:l,top:o}}_rangeValidation(e){const t=this;return-1===e.compare(t.min)?t.min.clone():1===e.compare(t.max)?t.max.clone():e}_resetTimePart(){const e=this,t=e._highlightedTimePart.code,a=e._codeToIndex[t],n=Smart.Utilities.DateTime.getConstructorParameters(e._value);let i;i=a>2?0:a>0?1:e.min.year(),n[a]=i,n.unshift(null),e._validateValue(new(Function.prototype.bind.apply(Smart.Utilities.DateTime,n)))}_setIds(){const e=this;e.$.label.id||(e.$.label.id=e.id+"Label"),e.$.input.id||(e.$.input.id=e.id+"Input"),e.$.calendarButton.id||(e.$.calendarButton.id=e.id+"CalendarButton"),e.$.dropDownContainer.id||(e.$.dropDownContainer.id=e.id+"DropDownContainer"),e.$.hint.id||(e.$.hint.id=e.id+"Hint")}_setDefaultFooterTemplate(e){const t=this;t.$.calendarDropDown.footerTemplate=t._defaultFooterTemplate,e&&t.$.calendarDropDown._handleLayoutTemplate(t.$.calendarDropDown.$.footer,t._defaultFooterTemplate),t._hourElement=t.$.calendarDropDown.getElementsByClassName("smart-hour-element")[0],t._minuteElement=t.$.calendarDropDown.getElementsByClassName("smart-minute-element")[0],t._ampmElement=t.$.calendarDropDown.getElementsByClassName("smart-am-pm-element")[0],t._todayElement=t.$.calendarDropDown.getElementsByClassName("smart-today-element")[0],t._todayElement.title=t.localize("now"),Array.from(t.$.calendarDropDown.$.footer.getElementsByTagName("smart-repeat-button")).forEach((function(e){e.animation=t.animation})),t._addCalendarFooterListeners(),t._defaultFooterTemplateApplied=!0}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.$.input.tabIndex=-1,e.$.selectDate.removeAttribute("tabindex"),e.$.selectTime.removeAttribute("tabindex"),void(e._defaultFooterTemplateApplied&&(e._hourElement.tabIndex=-1,e._ampmElement.tabIndex=-1,e._minuteElement.tabIndex=-1));const t=e.tabIndex>0?e.tabIndex:0;e.$.input.removeAttribute("tabindex"),e.$.selectDate.tabIndex=t,e.$.selectTime.tabIndex=t,e._defaultFooterTemplateApplied&&(e._hourElement.removeAttribute("tabindex"),e._ampmElement.removeAttribute("tabindex"),e._minuteElement.removeAttribute("tabindex"),e.$.calendarDropDown.getElementsByClassName("smart-footer-component-today")[0].tabIndex=t)}_setNullValue(e){const t=this;if(void 0===e&&(e=t._cloneValue()),t.nullable){if(t._value=null,t.value=null,t._highlightedTimePart=void 0,t.$.input.value="",null!==e){if(t.opened){if(!t._calendarInitiatedChange){const e=t.$.calendarDropDown.context;t.$.calendarDropDown.context=t.$.calendarDropDown,t.$.calendarDropDown._clearSelection(!0),t.$.calendarDropDown.context=e}t._defaultFooterTemplateApplied&&(t._hourElement.value="",t._ampmElement.value="",t._minuteElement.value=""),t._toSync=!1}else t._toSync=!0;t.isInitialized&&(t.$.fireEvent("change",{oldValue:e.toTimeZone(t._inputTimeZone),value:null}),t._updateTargetValue())}t._disableSpinButtons()}else t._validateValue(t._now(),e)}_spinButtonsClickHandler(e){const t=this;null===t._value||t.disabled||t.readonly||t._incrementDecrement(t.$.downButton.contains(e.target))}_validateInitialPropertyValues(){const e=this,t=e.$.calendarDropDown;"left"===e.calendarButtonPosition&&e.$.content.insertBefore(e.$.calendarButton,e.$.input),"left"===e.spinButtonsPosition&&e.$.content.insertBefore(e.$.spinButtonsContainer,e.$.input),e.disabled&&(e.$.upButton.disabled=!0,e.$.downButton.disabled=!0),e.opened&&(e.disabled||e.readonly?e.opened=!1:(e.$.dropDownContainer.style.transition="none",e._open(!0))),e.$.calendarButton.setAttribute("aria-expanded",e.opened),null===e.footerTemplate?e._setDefaultFooterTemplate(!0):(t.footerTemplate=e.footerTemplate,t._handleLayoutTemplate(t.$.footer,e.footerTemplate)),""===e.formatString&&(e.formatString="dd-MMM-yy HH:mm:ss.fff");const a=e.displayKind;let n;if("UTC"===a?e._outputTimeZone="UTC":"local"===a&&(e._outputTimeZone="Local"),null!==e.value?(n=Smart.Utilities.DateTime.validateDate(e.value,new Smart.Utilities.DateTime,e.formatString),e._inputTimeZone=n.timeZone,"unspecified"!==a&&e._inputTimeZone!==e._outputTimeZone?n=n.toTimeZone(e._outputTimeZone):"unspecified"===a&&(e._outputTimeZone=e._inputTimeZone)):(n=null,e._inputTimeZone="Local"),e._validateRestrictedDates(),e._validateMinMax("both"),e._validateValue(n,e._now(),!1,!0),e._validateInterval(new Smart.Utilities.TimeSpan(0,0,1)),e._getFormatStringRegExp(),e._defaultFooterTemplateApplied&&""===e._hourElement.value&&null!==e.value){const t=e.value;e._hourElement.value=t.toString("hh"),e._ampmElement.value=t.toString("tt"),e._minuteElement.value=t.toString("mm")}e._detectDisplayMode();const i=e._dropDownDisplayMode;"default"===i||"calendar"===i?(t.viewSections=["title","header"],t.$title.hasClass("smart-hidden")&&t.propertyChangedHandler("viewSections",["header","footer"],["title","header"]),"default"===i&&e.$dropDownHeader.removeClass("smart-hidden")):"timePicker"===i&&(e.$calendarDropDown.addClass("smart-hidden"),e._initializeTimePicker()),e.footer&&e._handleFooter()}_validateInterval(e){const t=this,a=t.interval;let n=a;if(a instanceof Smart.Utilities.TimeSpan)n=a;else if("string"==typeof a){const i=a.indexOf("TimeSpan("),o=a.indexOf(")");if(-1!==i&&-1!==o&&(n=a.slice(i+9,o),n=n.replace(/'/g,"").replace(/"/g,"").replace(/^\s+|\s+$|\s+(?=\s)/g,""),new RegExp(/(^(\d+)(,\s*\d+)*$)/g).test(n)&&(n=n.replace(/\s/g,""),n=n.split(","),n.map((function(e,t){n[t]=parseInt(e)})),n.unshift(null),n=new(Function.prototype.bind.apply(Smart.Utilities.TimeSpan,n)))),n instanceof Smart.Utilities.TimeSpan==0){if(""===n.trim())return void(t.interval=e);isNaN(n)||(n=1e4*parseInt(n,10));try{n=new Smart.Utilities.TimeSpan(n)}catch(a){return void(t.interval=e)}}}else{if("number"!=typeof a)return void(t.interval=e);n=new Smart.Utilities.TimeSpan(a)}0===n._ticks?t.interval=e:t.interval=n}_validateMinMax(e,t){const a=this;let n=!1;"max"!==e&&(a.min=Smart.Utilities.DateTime.validateDate(a.min,t||new Smart.Utilities.DateTime(1600,1,1),a.formatString),a.min=a.min.toTimeZone(a._outputTimeZone),n=!0),"min"!==e&&(a.max=Smart.Utilities.DateTime.validateDate(a.max,t||new Smart.Utilities.DateTime(3001,1,1),a.formatString),a.max=a.max.toTimeZone(a._outputTimeZone),a.max.calendar.days=a._localizedDays,a.max.calendar.months=a._localizedMonths,a.max.calendar.locale=a.locale,a.$.calendarDropDown.max=a.max.toDate()),a.min.compare(a.max)>0&&(a.min=a.max.clone(),n=!0),n&&(a.min.calendar.days=a._localizedDays,a.min.calendar.months=a._localizedMonths,a.min.calendar.locale=a.locale,a.$.calendarDropDown.min=a.min.toDate())}_validateRestrictedDates(){const e=this,t=[],a=[];for(let n=0;n<e.restrictedDates.length;n++){const i=e.restrictedDates[n];let o=Smart.Utilities.DateTime.validateDate(i,"invalid",e.formatString);"invalid"!==o&&(o=o.toTimeZone(e._outputTimeZone),t.push(o),a.push(o.toDate()))}e.restrictedDates=t,e.$.calendarDropDown.restrictedDates=a}_validateValue(e,t,a,n){const i=this,o=void 0!==t?t:i._cloneValue();if(null===e||""===e)return void i._setNullValue(o);if(e&&"string"==typeof e)if(-1===e.indexOf("-")&&-1===e.indexOf("/")&&-1===e.indexOf(".")){if(i.formatString){let t="",a=0;for(let n=0;n<i.formatString.length;n++)"-"===i.formatString[n]||"/"===i.formatString[n]||"."===i.formatString[n]?t+=i.formatString[n]:e[a]?(t+=e[a],a++):t+=i.formatString[n];if(t.indexOf("y")>=0){let e=t.substring(t.indexOf("y")-2);const a=i.yearCutoff.toString(),n=parseInt(a.slice(2),10);let o=parseInt(a.slice(0,2),10);e=parseInt(e,10),e<n&&o++,e=e.toString(),"NaN"!==e?(e=o+""+"0".repeat(2-e.length)+e,t=t.substring(0,t.indexOf("y")-2)+e):t=null}e=t}}else{let t=e.indexOf("-")>=0?"-":"";if(""===t&&(t=e.indexOf("/")>=0?"/":""),""===t&&(t=e.indexOf(".")>=0?".":""),t&&i.formatString.indexOf("yyyy")>=0){const a=e.split(t);let n=a[a.length-1];if(n.length<4){const o=i.yearCutoff.toString(),l=parseInt(o.slice(2),10);let r=parseInt(o.slice(0,2),10);n=parseInt(n,10),n<l&&r++,n=n.toString(),n=r+""+"0".repeat(2-n.length)+n,a[a.length-1]=n,e=a.join(t)}}}if(void 0!==e&&(i._value=Smart.Utilities.DateTime.validateDate(e,o,i.formatString)),null===i._value)return void i._setNullValue(o);let l=i._value;for(;!0===i._isRestricted(l);)l.addDays(1,!1);const r=i._rangeValidation(l);n&&"strict"!==i.validation?!1===l.equals(r)&&(i._minMaxChanged=!0):(i._value=r,delete i._minMaxChanged),i.value=i._value.toTimeZone(i._inputTimeZone);const s=i._value;if(s.calendar.days=i._localizedDays,s.calendar.months=i._localizedMonths,s.calendar.locale=i.locale,i._applyFormatString(),i._disableSpinButtons(),(null===o||null===s)&&o!==s||null!==o&&null!==s&&0!==o.compare(s)){if(!1!==a&&i.isInitialized&&!n&&(i.$.fireEvent("change",{oldValue:null!==o?o.toTimeZone(i._inputTimeZone):null,value:i.value}),i._updateTargetValue()),i._calendarInitiatedChange)return;i.opened?(null!==o&&0!==i.$.calendarDropDown.selectedDates.length&&o.year()===s.year()&&o.month()===s.month()&&o.day()===s.day()&&i.$.calendarDropDown._isDateInView(s.toDate())||(i._disregardCalendarChangeEvent=!0,i.$.calendarDropDown.selectedDates=[s.toDate()]),i._defaultFooterTemplateApplied&&(null!==o&&o.hour()===s.hour()||(i._hourElement.value=s.toString("hh"),i._ampmElement.value=s.toString("tt")),null!==o&&o.minute()===s.minute()||(i._minuteElement.value=s.toString("mm"))),i._timePickerInitialized&&!i._timePickerInitiatedChange&&(i.$.timePickerDropDown.value=s.toDate()),i._toSync=!1):i._toSync=!0}}});
|
|
116
116
|
|
|
117
117
|
/***/ }),
|
|
118
118
|
|
|
@@ -126,7 +126,7 @@ Smart.Utilities.Assign("Draw",class{constructor(t,e){const i=this;i.host=t,i.ren
|
|
|
126
126
|
/***/ 7650:
|
|
127
127
|
/***/ (() => {
|
|
128
128
|
|
|
129
|
-
Smart("smart-drop-down-list",class extends Smart.ContentElement{static get properties(){return{autoCloseDelay:{value:100,type:"number"},dataSource:{value:null,type:"any",reflectToAttribute:!1},displayLoadingIndicator:{value:!1,type:"boolean"},displayMember:{value:"",type:"string"},displayMode:{allowedValues:["outlined","filled","underlined"],value:"outlined",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownButtonPosition:{allowedValues:["none","left","right","top","bottom"],value:"right",defaultReflectToAttribute:!0,type:"string"},dropDownMinHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownOpenMode:{allowedValues:["none","default","dropDownButton","auto"],value:"default",type:"string"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPlaceholder:{value:"No Items",type:"string"},dropDownPosition:{allowedValues:["auto","top","bottom","overlay-top","overlay-center","overlay-bottom","center-bottom","center-top"],value:"auto",type:"string"},dropDownMinWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxWidth:{value:"",type:"any",validator:"_propertyValidator"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterCallback:{value:null,type:"function?"},filterMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase","custom"],type:"string"},grouped:{value:!1,type:"boolean"},groupMember:{value:"",type:"string"},hint:{value:"",type:"string"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},incrementalSearchDelay:{value:700,type:"number?"},incrementalSearchMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},itemMeasureMode:{value:"auto",allowedValues:["auto","precise"],type:"string"},inputMember:{value:"label",type:"string"},itemTemplate:{value:null,type:"any"},itemHeight:{value:null,type:"number?"},label:{value:"",type:"string"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{extend:!0,value:{en:{invalidNode:'{{elementType}}: Invalid parameter "{{node}}" when calling {{method}}.'}},type:"object"},name:{value:"",type:"string"},opened:{value:!1,type:"boolean"},placeholder:{value:"",type:"string"},resizeMode:{value:"none",allowedValues:["none","horizontal","vertical","both"],type:"string"},resizeIndicator:{value:!1,type:"boolean"},selectionDisplayMode:{value:"plain",allowedValues:["plain","placeholder","tokens"],type:"string"},selectionMode:{value:"zeroAndOne",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectedIndexes:{value:[],type:"array"},selectedValues:{value:[],type:"array"},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},tokenTemplate:{value:null,type:"any"},type:{value:"list",type:"string",defaultReflectToAttribute:!0,readonly:!0},valueMember:{value:"",type:"string"},virtualized:{value:!1,type:"boolean"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]}}}static get listeners(){return{"actionButton.down":"_buttonsDownHandler","actionButton.mouseenter":"_buttonsMouseEventsHandler","actionButton.mouseleave":"_buttonsMouseEventsHandler","actionButton.focus":"_buttonsFocusHandler","actionButton.blur":"_buttonsFocusHandler","document.selectstart":"_selectStartHandler","document.dragstart":"_dragStartHandler","document.down":"_documentDownHandler","document.up":"_documentUpHandler","document.move":"_documentMoveHandler","dropDownButton.down":"_buttonsDownHandler","dropDownButton.mouseenter":"_buttonsMouseEventsHandler","dropDownButton.mouseleave":"_buttonsMouseEventsHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",focus:"_focusEventHandler",blur:"_blurEventHandler","dropDownButton.focus":"_buttonsFocusHandler","dropDownButton.blur":"_buttonsFocusHandler","dropDownContainer.transitionend":"_dropDownTransitionendHandler","listBox.change":"_listBoxChangeHandler","listBox.itemClick":"_listBoxItemClickHandler","listBox.keydown":"_listBoxKeyDownHandler","listBox.bindingComplete":"_bindingCompleteHandler",mouseenter:"_mouseEnterHandler",mouseleave:"_mouseLeaveHandler",resize:"_resizeHandler","resizeBar.move":"_resizeBarMoveHandler",styleChanged:"_styleChangedHandler",wheel:"_mouseWheelHandler"}}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 class="smart-buttons-container" id="buttonsContainer" role="presentation">\n <span id="actionButton" class ="smart-action-button" role="presentation">[[placeholder]]</span>\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-container smart-visibility-hidden" role="presentation">\n <smart-list-box id="listBox" unfocusable\n animation="[[animation]]"\n data-source="[[dataSource]]"\n disabled="[[disabled]]"\n display-loading-indicator="[[displayLoadingIndicator]]"\n display-member="[[displayMember]]"\n filterable="[[filterable]]"\n filter-callback="[[filterCallback]]"\n filter-mode="[[filterMode]]"\n filter-input-placeholder="[[filterInputPlaceholder]]"\n grouped="[[grouped]]"\n group-member="[[groupMember]]"\n item-height="[[itemHeight]]"\n item-measure-mode="[[itemMeasureMode]]"\n item-template="[[itemTemplate]]"\n incremental-search-delay="[[incrementalSearchDelay]]"\n incremental-search-mode="[[incrementalSearchMode]]"\n loading-indicator-placeholder="[[loadingIndicatorPlaceholder]]"\n loading-indicator-position="[[loadingIndicatorPosition]]"\n name="[[name]]"\n placeholder="[[dropDownPlaceholder]]"\n right-to-left="[[rightToLeft]]"\n readonly="[[readonly]]"\n selected-indexes="{{selectedIndexes}}"\n selection-mode="[[selectionMode]]"\n selected-values="{{selectedValues}}"\n sorted="[[sorted]]"\n sort-direction="[[sortDirection]]"\n theme="[[theme]]"\n value-member="[[valueMember]]"\n horizontal-scroll-bar-visibility="[[horizontalScrollBarVisibility]]"\n vertical-scroll-bar-visibility="[[verticalScrollBarVisibility]]"\n virtualized="[[virtualized]]">\n <content></content>\n </smart-list-box>\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-hint smart-hidden" id="hint">[[hint]]</span>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>'}static get styleUrls(){return["smart.dropdownlist.css","smart.dropdown.css"]}propertyChangedHandler(e,t,o){super.propertyChangedHandler(e,t,o);const n=this;switch(e){case"animation":n.$.dropDownContainer.setAttribute("animation",n.animation);break;case"disabled":n._setFocusable(),n.close(),n._positionDetection.handleAutoPositioning();break;case"dataSource":case"displayMember":case"inputMember":n.$.actionButton&&(n.$.actionButton.innerHTML=n.placeholder),n._setDropDownSize(),n._positionDetection.checkBrowserBounds("vertically"),n._positionDetection.positionDropDown(),n._positionDetection.checkBrowserBounds("horizontally");break;case"dropDownAppendTo":n._positionDetection.dropDownAppendToChangedHandler();break;case"dropDownOpenMode":n._setFocusable(),n.$dropDownContainer.addClass("smart-visibility-hidden"),n.$.dropDownContainer.setAttribute("drop-down-open-mode",o),n.$.dropDownButton.removeAttribute("selected"),n.removeAttribute("drop-down-button-focus"),n.removeAttribute("action-button-focus"),n.opened=!1,n._ariaButton&&n._ariaButton.setAttribute("aria-expanded",!1),n._setAriaRelations();break;case"dropDownOverlay":o||n._positionDetection.removeOverlay();break;case"dropDownPosition":n._positionDetection.dropDownPositionChangedHandler();break;case"dropDownMinWidth":case"dropDownWidth":case"dropDownMaxWidth":case"dropDownHeight":case"dropDownMinHeight":case"dropDownMaxHeight":n._setDropDownSize();break;case"filterable":n.$.listBox.filterable=o,n._dropDownSize&&"auto"===n._dropDownSize.height&&n._setDropDownSize();break;case"label":if(!n._ariaButton)return;o?n._ariaButton.setAttribute("aria-labelledby",n.$.label.id):"DropDownList"===n.elementName&&n._ariaButton.setAttribute("aria-labelledby",n.$.actionButton.id);break;case"opened":if(n.disabled||n.readonly)return;o?n.open():n.close();break;case"placeholder":case"selectionDisplayMode":n._applySelection();break;case"readonly":n.close();break;case"resizeIndicator":o?n.$.dropDownContainer.setAttribute("resize-indicator",""):n.$.dropDownContainer.removeAttribute("resize-indicator");break;case"resizeMode":n.$.dropDownContainer.setAttribute("resize-mode",n.resizeMode);break;case"selectedValues":case"selectedIndexes":0===o.length?n.$.actionButton.innerHTML=n.placeholder:n._applySelection(),n.$.hiddenInput.value=n.selectedValues.toString();break;case"selectionMode":n.$.listBox&&(n.$.listBox[e]=o,"checkBox"!==o&&"radioButton"!==o&&"checkBox"!==t&&"radioButton"!==t||n._setDropDownSize());break;case"tokenTemplate":n._tokenTemplate=n._validateTemplate(n.tokenTemplate),n._applySelection();break;case"unfocusable":n._setFocusable()}}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const o=e.dataset.property,n=e.value;o&&void 0!==t[o]&&(t[o]=n)}}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(t.$.listBox.appendChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}attached(){const e=this;super.attached(),e.isCompleted&&e.$.dropDownContainer&&(e._positionDetection.dropDownAttached("_setDropDownSize"),e._positionDetection.checkBrowserBounds(),e.selectedIndexes&&e._applySelection())}detached(){const e=this;super.detached(),e.$.dropDownContainer&&(e.close(),e._positionDetection&&e._positionDetection.dropDownDetached())}clearItems(){const e=this;e.$.listBox&&(e.$.listBox.clearItems(),e.$.actionButton.innerHTML=e.placeholder)}clearSelection(){const e=this;e.$.listBox&&(e.$.listBox.clearSelection(),e.$.actionButton.innerHTML=e.placeholder)}close(){const e=this;e.$dropDownContainer.hasClass("smart-visibility-hidden")||e.$.fireEvent("closing").defaultPrevented||(e.$dropDownContainer.addClass("smart-visibility-hidden"),e.$.fireEvent("close"),e.$.dropDownButton&&e.$.dropDownButton.removeAttribute("selected"),e.opened=!1,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!1),e._preventDropDownClose=!1,e._positionDetection.removeOverlay(!0),e.$.listBox.removeAttribute("focus"),e._edgeMacFF&&!e.hasAnimation&&e.$.dropDownContainer&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view")))}cloneNode(){const e=this;if(!e.$.listBox)return;let t=HTMLElement.prototype.cloneNode.apply(e,Array.prototype.slice.call(arguments,0,1));return t.dataSource=e.dataSource,t}ensureVisible(e){this.$.listBox&&this.$.listBox.ensureVisible(e)}getItem(e){if(this.$.listBox)return this.$.listBox.getItem(e)}get items(){const e=this;return e.$&&e.$.listBox?e.$.listBox.items:[]}get _focusedItem(){const e=this;return e.$&&e.$.listBox?e.$.listBox._focusedItem:null}insert(e,t){const o=this;o.$.listBox&&(o.$.listBox.insert(e,t),o._applySelection(),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize())}insertBefore(e,t){const o=this;if(!o.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(o,e.concat(Array.prototype.slice.call(arguments)))}e&&t?o.$.listBox&&(o.$.listBox.insertBefore(e,t),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize()):o.error(o.localize("invalidNode",{elementType:o.nodeName.toLowerCase(),method:"insertBefore",node:"newNode/referenceNode"}))}toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this,t=function(){for(let t=0;t<e.items.length;t++)if(!e.items[t].disabled)return e.items[t]};if(!e.disabled&&e.offsetHeight&&e.$dropDownContainer.hasClass("smart-visibility-hidden")){if(e.$dropDownContainer.hasClass("not-in-view")&&e.$dropDownContainer.removeClass("not-in-view"),e.$.dropDownContainer.style.transition=null,e.dropDownAppendTo){const t=e.getBoundingClientRect();if(e.$.container.contains(e.$.dropDownContainer)){let t=0;const o=setInterval((function(){const n=e.getBoundingClientRect();t++,n.top===e._positionTop&&t<10||(e.open(),clearInterval(o),e._positionTop=n.top)}),100);return}t.top!==e._positionTop&&(e._positionTop=t.top)}e.$.fireEvent("opening").defaultPrevented||(e._shadowDOMStylesDelay&&(e._setDropDownSize(),delete e._shadowDOMStylesDelay),e.opened=!0,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!0),e.$.listBox.setAttribute("focus",""),e._positionDetection.placeOverlay(),e._positionDetection.checkBrowserBounds("vertically"),e._positionDetection.positionDropDown(),e._positionDetection.checkBrowserBounds("horizontally"),e.$dropDownContainer.removeClass("smart-visibility-hidden"),e.$.fireEvent("open"),e.$.dropDownButton&&("dropDownButton"===e.dropDownOpenMode?e.$.dropDownButton.setAttribute("selected",""):e.$.dropDownButton.removeAttribute("selected")),(e.$.listBox&&!e._focusedItem||e._focusedItem&&!e._focusedItem._focused)&&(e.selectedIndexes.length>0?e._focus(e.items[e.selectedIndexes[0]]):e._focus(t)),e.$.input&&!Smart.Utilities.Core.isMobile&&e.$.input.focus())}}ready(){super.ready()}render(){const e=this;e.rightToLeft&&(e.dropDownButtonPosition="right"===e.dropDownButtonPosition?"left":"right"),e.classList.add("smart-drop-down-box"),e.$.dropDownContainer&&(e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDownContainer,e.$.container,"close"),e._positionDetection.getDropDownParent(!0),e._positionDetection.setDropDownPosition(),e._calculateDropDownSize(),e.$.dropDownContainer.setAttribute("resize-mode",e.resizeMode),e.$.dropDownContainer.setAttribute("drop-down-open-mode",e.dropDownOpenMode),e.resizeIndicator&&e.$.dropDownContainer.setAttribute("resize-indicator",""),e._positionDetection.handleAutoPositioning()),e.opened&&e.open(),e._positionTop=e.getBoundingClientRect().top,e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._edgeMacFF&&e.hasAnimation&&e.$.dropDownContainer&&e.$dropDownContainer.addClass("not-in-view"),e.$.label&&!e.$.label.id&&(e.$.label.id=e.id+"Label"),e.$.actionButton&&!e.$.actionButton.id&&(e.$.actionButton.id=e.id+"ActionButton"),e.$.hint&&!e.$.hint.id&&(e.$.hint.id=e.id+"Hint"),e._createElement(),super.render()}removeAt(e){const t=this;t.$.listBox&&(t.$.listBox.removeAt(e),t._applySelection(),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize())}removeChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e&&e instanceof Smart.ListItem?(t.$.listBox.removeChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}get value(){const e=this;return e.isRendered&&e.$.listBox?e.$.listBox.value:null}set value(e){const t=this;return t.isRendered&&t.$.listBox?void(t.$.listBox.value=e):null}select(e){this.$.listBox&&this.$.listBox.select(e)}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.removeAttribute("tabindex"),e.$.actionButton.removeAttribute("tabindex"),void e.$.dropDownButton.removeAttribute("tabindex");let t=e.tabIndex>0?e.tabIndex:0;e.tabIndex=t,"dropDownButton"===e.dropDownOpenMode?(e.removeAttribute("tabindex"),e.$.actionButton.setAttribute("tabindex",t),e.$.dropDownButton.setAttribute("tabindex",t)):(e.$.actionButton.removeAttribute("tabindex"),e.$.dropDownButton.removeAttribute("tabindex"))}static get requires(){return{"Smart.ListBox":"smart.listbox.js"}}unselect(e){this.$.listBox&&this.$.listBox.unselect(e)}update(e,t){const o=this;o.$.listBox&&(o.$.listBox.update(e,t),o._applySelection())}_resizeBarMoveHandler(e){"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_createToken(){const e=this;let t,o=!1;const n=document.createDocumentFragment(),i=e.selectedIndexes[e.selectedIndexes.length-1];"plain"!==e.selectionDisplayMode||"one"!==e.selectionMode&&"zeroAndOne"!==e.selectionMode&&"zeroOrOne"!==e.selectionMode&&"radioButton"!==e.selectionMode?"tokens"===e.selectionDisplayMode?1===e.selectedIndexes.length&&["oneOrManyExtended","oneOrMany","zeroAndOne","one","radioButton"].indexOf(e.selectionMode)>-1?t="":(t="✖",o=!0):t=1===e.selectedIndexes.length?"":",":t="";const r=e.selectedIndexes,a=e.$.listBox._items;for(let s=0;s<r.length;s++){const l=r[s];a[l]&&n.appendChild(e._applyTokenTemplate(a[l][e.inputMember],"tokens"!==e.selectionDisplayMode&&l===i?"":t,o))}return n}_applySelection(){const e=this;if("placeholder"!==e.selectionDisplayMode&&0!==e.selectedIndexes.length){if(e.$.listBox._items&&0!==e.$.listBox._items.length){if("plain"===e.selectionDisplayMode){const t=e.$.listBox.selectedIndexes,o=e.$.listBox._items;let n=[];for(let i=0;i<t.length;i++){const r=t[i];o[r]&&n.push(o[r][e.inputMember])}return e.$.actionButton.innerHTML=n.length?`<span class="smart-token">${n.join(", ").trim()}</span>`:"",void(e.$.hiddenInput.value=e.selectedValues.toString())}e.$.actionButton.innerHTML="",e.$.actionButton.appendChild(e._createToken()),e.$.hiddenInput.value=e.selectedValues.toString()}}else e.$.actionButton.innerHTML=e.placeholder}_applyTokenTemplate(e,t,o){const n=this,i=document.createElement("span"),r=function(){return"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+e+`</span><span class='smart-drop-down-list-unselect-button' role="button"${o?' aria-label="Unselect"':""}>${t}</span>`};if(i.classList.add("smart-token"),n._tokenTemplate){let e=document.importNode(n._tokenTemplate.content,!0);const t=e.childNodes.length,o=/{{\w+}}/g;let a;for(let n=0;n<t;n++)a=o.exec(e.childNodes[n].innerHTML),a&&(e.childNodes[n].innerHTML=e.childNodes[n].innerHTML.replace(a[0],r())),e.childNodes[n].outerHTML&&(i.innerHTML+=e.childNodes[n].outerHTML)}else"function"==typeof n.tokenTemplate?n.tokenTemplate(i,{label:e,iconSeparator:t}):i.innerHTML=r();return i}_bindingCompleteHandler(){const e=this;e.$.listBox&&requestAnimationFrame((()=>{e._setDropDownSize(),e._positionDetection.checkBrowserBounds()}))}_buttonsDownHandler(e){const t=this;if(!t.disabled){if(t.hasRippleAnimation)if(t.$.buttonsContainer&&"dropDownButton"!==t.dropDownOpenMode){const o=t.$.buttonsContainer;o.firstElementChild.noRipple=!0,Smart.Utilities.Animation.Ripple.animate(o,e.pageX,e.pageY),o.firstElementChild.noRipple=!1}else Smart.Utilities.Animation.Ripple.animate(e.target,e.pageX,e.pageY);t._preventsSelectStart=!0,t.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.actionButton&&t.$.actionButton.setAttribute("active",""),t.opened&&(t._preventDropDownClose=!0)}}_buttonsMouseEventsHandler(e){const t=this;t.disabled||("mouseenter"===e.type?(t.setAttribute("hover",""),e.target.setAttribute("hover",""),"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.dropDownButton&&t.setAttribute("drop-down-button-hover","")):(t.removeAttribute("hover"),t.removeAttribute("drop-down-button-hover"),e.target.removeAttribute("hover")))}_calculateDropDownSize(){const e=this;e._dropDownSize={};const t=window.getComputedStyle(e.$.dropDownContainer),o=parseFloat(t.getPropertyValue("border-top-width").trim()),n=parseFloat(t.getPropertyValue("border-bottom-width").trim()),i=parseFloat(t.getPropertyValue("margin-top").trim()),r=parseFloat(t.getPropertyValue("margin-bottom").trim()),a=parseFloat(t.getPropertyValue("padding-top").trim()),s=parseFloat(t.getPropertyValue("padding-bottom").trim());Smart.Utilities.Core.CSSVariablesSupport()&&(e._dropDownSize.width=t.getPropertyValue("--smart-drop-down-list-drop-down-width").trim(),e._dropDownSize.height=t.getPropertyValue("--smart-drop-down-list-drop-down-height").trim()),(!e._dropDownSize.width||e._dropDownSize.width.indexOf("initial")>-1)&&(e._dropDownSize.width=e.offsetWidth),e._dropDownSize.height||(e._dropDownSize.height="auto"),e._dropDownSize.minHeight=parseFloat(t.getPropertyValue("min-height").trim()),e._dropDownSize.maxHeight=parseFloat(t.getPropertyValue("max-height").trim()),e._dropDownSize.borderWidth=(isNaN(o)?0:o)+(isNaN(n)?0:n),e._dropDownSize.paddingWidth=(isNaN(a)?0:a)+(isNaN(s)?0:s),e._dropDownSize.marginWidth=(isNaN(i)?0:i)+(isNaN(r)?0:r)}_createElement(){const e=this;e._tokenTemplate=e._validateTemplate(e.tokenTemplate),e._applySelection(),e._setDropDownSize(),e._setFocusable(),e.$.arrow.noRipple=!0,e._shadowDOMStylesDelay=e.shadowRoot,e._setAriaRelations(!0)}_documentDownHandler(e){const t=this;if(t.disabled||t.readonly)return;let o=e.originalEvent.target;if(o===t._overlay&&(t._overlayDown=!0),t.shadowRoot){o=e.originalEvent.composedPath()[0];let n=o.getRootNode().host;for(;n;)n.closest(".smart-drop-down-container")===t.$.dropDownContainer&&(t._isDropDownClicked=!0),n=n.getRootNode().host}else t.isInShadowDOM&&(o=e.originalEvent.composedPath()[0]),t._isDropDownClicked=o.closest(".smart-drop-down-container")===t.$.dropDownContainer;if(t._buttonClicked=o.closest(".smart-action-button")||o.closest(".smart-drop-down-button"),t.$.listBox){let n=o.closest("smart-list-item");t.$.listBox.contains(n)||(n=void 0),t.hasRippleAnimation&&n&&Smart.Utilities.Animation.Ripple.animate(n,e.pageX,e.pageY),(n||o===t.$.listBox.$.filterInput||o.closest(".smart-token"))&&(t._preventDropDownClose=!0)}if(t._isDropDownClicked&&(t._preventDropDownClose=!0),o!==t.$.resizeBar||"none"===t.resizeMode)return;t._resizeDetails||(t._resizeDetails={});const n=t.$.dropDownContainer.getBoundingClientRect();t._resizeDetails.started=!0,t._resizeDetails.x=e.pageX,t._resizeDetails.y=e.pageY,t._resizeDetails.width=t.$.dropDownContainer.offsetWidth,t._resizeDetails.height=t.$.dropDownContainer.offsetHeight,t._resizeDetails.offsetXL=e.clientX-n.left,t._resizeDetails.offsetXR=n.left+t.$.dropDownContainer.offsetWidth-e.clientX,t._resizeDetails.offsetY=n.top+t.$.dropDownContainer.offsetHeight-e.clientY,t._resizeDetails.offsetYtop=e.clientY-n.top,t._preventDropDownClose=!0}_documentMoveHandler(e){const t=this,o=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if("auto"===t.dropDownOpenMode&&null!==t.dropDownAppendTo&&(t.contains(o)||t.$.dropDownContainer.contains(o)?t._isElementHovered=!0:(t._isElementHovered=!1,t._autoClose())),!t._resizeDetails||t._resizeDetails&&!t._resizeDetails.started)return;t.setAttribute("resizing",""),t._resizeDetails.resizeEventFired||(t.$.fireEvent("resizeStart",{position:{left:e.pageX,top:e.pageY}}),t._resizeDetails.resizeEventFired=!0);const n=document.documentElement,i=t.$.dropDownContainer.getBoundingClientRect(),r=t.getBoundingClientRect(),a=t.$.dropDownContainer.hasAttribute("top")?"top":"bottom";let s;function l(){if(s=e.pageY-t._resizeDetails.y,"bottom"===a)t._resizeDetails.height=Math.min(n.clientHeight-i.top-6,Math.max(0,t._resizeDetails.height+s)),t._resizeDetails.y=Math.max(i.top+n.scrollTop-t._resizeDetails.offsetY,Math.min(n.clientHeight+n.scrollTop-1.5*t._resizeDetails.offsetY,e.pageY));else{if(t._resizeDetails.height=Math.min(t._dropDownSize.maxHeight,Math.max(0,Math.min(r.top,t._resizeDetails.height-s))),s=Math.max(0,i.top+(i.height-Math.max(t._dropDownSize.minHeight,t._resizeDetails.height))),t.dropDownAppendTo){const e=Math.abs(parseFloat(getComputedStyle(t.$.dropDownContainer).getPropertyValue("margin-bottom")))||0;t.$.dropDownContainer.style.top=t.dropDownAppendTo?e+s+"px":""}const o=r.top+n.scrollTop+t._resizeDetails.offsetYtop;t._resizeDetails.y=Math.max(t._resizeDetails.offsetYtop,Math.min(o,Math.max(o-t._dropDownSize.maxHeight,e.pageY)))}t.$.dropDownContainer.style.height=t._resizeDetails.height+"px"}function d(){s=e.pageX-t._resizeDetails.x,t._resizeDetails.width=Math.min(n.clientWidth-i.left-6,Math.max(0,t._resizeDetails.width+s)),t.$.dropDownContainer.style.width=t._resizeDetails.width+"px",t._resizeDetails.x=Math.max(i.left+n.scrollLeft-t._resizeDetails.offsetXR,Math.min(n.clientWidth+n.scrollLeft-1.5*t._resizeDetails.offsetXR,e.pageX))}switch(t.resizeMode){case"vertical":l();break;case"horizontal":d();break;case"both":d(),l()}}_documentUpHandler(e){const t=this;if(t.$.actionButton.removeAttribute("active"),t._resizeDetails&&t._resizeDetails.started)return t._resizeDetails.started=t._resizeDetails.resizeEventFired=!1,t.removeAttribute("resizing"),t._preventDropDownClose=!1,t.focus(),void t.$.fireEvent("resizeEnd",{position:{left:e.pageX,top:e.pageY}});if(t.disabled||t._isDropDownClicked||t.readonly)return void delete t._isDropDownClicked;if(t._overlayDown)return t.close(),void delete t._overlayDown;let o=e.originalEvent.target,n=o.closest?o.closest("smart-drop-down-list"):void 0;if((t.enableShadowDOM||t.isInShadowDOM)&&(o=e.originalEvent.composedPath()[0],n=o.getRootNode().host),t._preventsSelectStart=!1,void 0===o||o===t.$.resizeBar)return;if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-selection-label")&&n===t){"none"!==t.dropDownOpenMode&&t.open();let e=t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.textContent))[0];return t.$.listBox._scrollView.scrollTop=e.offsetTop,void t._focus(e)}if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-unselect-button")&&n===t){if(1===t.selectedIndexes.length&&["zeroOrMany","zeroOrOne","checkBox"].indexOf(t.selectionMode)<0)return;return void t.unselect(t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.previousElementSibling.textContent))[0])}const i=!(!o||!o.closest)&&o.closest(".smart-action-button");let r;if(t._buttonClicked&&("dropDownButton"===t.dropDownOpenMode&&i&&t._buttonClicked===t.$.actionButton?t.$.fireEvent("actionButtonClick"):o.closest(".smart-drop-down-button")!==t._buttonClicked&&i!==t._buttonClicked||(r=!0,t.$.fireEvent("dropDownButtonClick"))),t._buttonClicked=void 0,i===t.$.actionButton||o&&o.closest&&o.closest(".smart-drop-down-button")===t.$.dropDownButton)return"dropDownButton"===t.dropDownOpenMode&&i===t.$.actionButton?void t.close():void(t.$dropDownContainer.hasClass("smart-visibility-hidden")&&"none"!==t.dropDownOpenMode&&r&&"pointercancel"!==e.originalEvent.type?t.open():t.close());o=t._getUpEventTarget(o),void 0!==o&&("dropDownContainer"!==o&&"item"!==o||"item"===o&&"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0)&&t.close()}_dragStartHandler(e){this._resizeDetails&&this._resizeDetails.started&&e.preventDefault()}_dropDownTransitionendHandler(){const e=this;e._edgeMacFF&&!e.opened&&e.hasAnimation&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view"))}_focus(e){this.$.listBox._focus(e)}_blurEventHandler(){const e=this;e.$.dropDownButton&&(e.removeAttribute("focus"),e.$.dropDownButton.removeAttribute("focus")),e.$.actionButton&&(e.removeAttribute("focus"),e.$.actionButton.removeAttribute("focus")),e.nodeName&&"smart-drop-down-list"===e.nodeName.toLowerCase()&&!e._preventDropDownClose&&e.close()}_focusEventHandler(){const e=this;e.$.dropDownButton&&(e.setAttribute("focus",""),e.$.dropDownButton.setAttribute("focus","")),e.$.actionButton&&(e.setAttribute("focus",""),e.$.actionButton.setAttribute("focus","")),e.removeAttribute("drop-down-button-focus"),e.removeAttribute("action-button-focus")}_buttonsFocusHandler(e){const t=this;e.target===t.$.dropDownButton?"focus"===e.type?t.setAttribute("drop-down-button-focus",""):(t.removeAttribute("drop-down-button-focus"),t.nodeName&&"smart-drop-down-list"===t.nodeName.toLowerCase()&&!t._preventDropDownClose&&t.close()):"focus"===e.type?t.setAttribute("action-button-focus",""):t.removeAttribute("action-button-focus")}_getUpEventTarget(e){const t=this;let o=e;for(o=void 0===o.parentElement?o.getRootNode().host:o.parentElement;o;){if(o===t.$.dropDownContainer){o="dropDownContainer";break}o=void 0===o.parentElement?o.getRootNode().host:o.parentElement}return o}_keyDownHandler(e){const t=this,o=t.enableShadowDOM&&t.shadowRoot.activeElement||document.activeElement,n=t.enableShadowDOM?e.composedPath()[0]:e.target;if(!(t.$.listBox&&n===t.$.listBox.$.filterInput||o!==t&&o!==t.$.dropDownButton&&o!==t.$.actionButton)||"Tab"===e.key)switch(e.key){case"Tab":if(t.filterable&&t.opened){const o=function(){for(let e=0;e<t.items.length;e++)if(!t.items[e].disabled)return t.items[e]};t.$.listBox.$.filterInput&&!Smart.Utilities.Core.isMobile&&document.activeElement!==t.$.listBox.$.filterInput?(t.$.listBox.$.filterInput.focus(),t._preventDropDownClose=!0):t.$.listBox&&(t.focus(),t.selectedIndexes.length>0?t._focus(t.items[t.selectedIndexes[0]]):t._focus(o),t._preventDropDownClose=!0),e.preventDefault()}break;case"Enter":case" ":e.preventDefault(),n!==t.$.actionButton&&(t._keyPressed=!0,t.opened?(t._focusedItem&&t.select(t._focusedItem),("Enter"===e.key&&["none"].indexOf(t.selectionMode)<0||" "===e.key&&["none","zeroAndOne","one","radioButton"].indexOf(t.selectionMode)>-1)&&t.close()):t.opened||t.readonly||"none"===t.dropDownOpenMode||t.open()),"dropDownButton"===t.dropDownOpenMode&&n.setAttribute("active","");break;case"End":case"Home":case"PageUp":case"PageDown":case"ArrowUp":case"ArrowDown":if(t.readonly)return;if(e.altKey)return t._keyPressed=!1,void(t.$dropDownContainer.hasClass("smart-visibility-hidden")?t.open():t.close());e.preventDefault(),t.$.listBox._handleKeyStrokes(e.key);break;case"Escape":e.preventDefault(),t.close();break;default:if(t.readonly)return;"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!0),t.$.listBox._applyIncrementalSearch(e.key)}}_keyUpHandler(e){const t=this,o=t.enableShadowDOM?e.composedPath()[0]:e.target;t.$.listBox&&o===t.$.listBox.$.filterInput||("Enter"!==e.key&&" "!==e.key||(o.removeAttribute("active"),t.$dropDownContainer.hasClass("smart-visibility-hidden")||(t._keyPressed=!1)),t.$.listBox&&"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!1))}_listBoxChangeHandler(e){const t=this;if(e.target===t.$.listBox){if((t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent("change",e.detail),"list"===t.autoComplete&&e.detail){const o=t.$.listBox._items[e.detail.index];t._lastSelectedItem=o&&o.selected?o:void 0}t._applySelection(t.selectionMode,e.detail),t._updateTargetValue()}else e.stopPropagation()}_listBoxItemClickHandler(e){const t=this;(t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent(e.type,e.detail),"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0&&t.close(),Smart.Utilities.Core.isMobile||t.focus(),delete t._isDropDownClicked}_listBoxKeyDownHandler(e){const t=this;if("Enter"===e.key)return t.close(),"dropDownButton"===t.dropDownOpenMode?t.$.dropDownButton.focus():t.focus(),void e.stopPropagation();"Escape"!==e.key||t.close()}_mouseEnterHandler(){const e=this;e._isElementHovered=!0,e.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"auto"===e.dropDownOpenMode&&!e.disabled&&!e.readonly&&e.open()}_mouseLeaveHandler(){const e=this;e.removeAttribute("hover"),e._isElementHovered=!1,"auto"!==e.dropDownOpenMode||e.disabled||e.readonly||e._autoClose()}_mouseWheelHandler(e){const t=this;t.disabled||t.readonly||t.items&&0===t.items.length||t.$dropDownContainer&&!t.$dropDownContainer.hasClass("smart-visibility-hidden")||t.$.listBox&&(e.preventDefault(),t.$.listBox._handleKeyStrokes(e.deltaY>0?"ArrowDown":"ArrowUp"))}_autoClose(){const e=this;e._autoCloseTimeout=setTimeout(function(){e._isElementHovered||e.close(),clearTimeout(e._autoCloseTimeout)}.bind(e),e.autoCloseDelay)}_propertyValidator(e,t){return"number"!=typeof t&&"string"!=typeof t?e:t}_resizeHandler(){this.refresh()}refresh(){const e=this;"none"===e.resizeMode&&(e._calculateDropDownSize(),e._setDropDownSize())}_selectStartHandler(e){this._preventsSelectStart&&e.preventDefault()}_setAriaRelations(e){const t=this;let o,n;"dropDownButton"!==t.dropDownOpenMode?(o=t.$.dropDownButton,o.setAttribute("aria-hidden",!0),n=t,t.$.actionButton.removeAttribute("role")):(o=t,n=t.$.dropDownButton,n.removeAttribute("aria-hidden"),t.$.actionButton.setAttribute("role","button")),t._ariaButton=n,n.setAttribute("role","button"),n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-owns",t.$.listBox.id),n.setAttribute("aria-describedby",t.$.hint.id),t.label?n.setAttribute("aria-labelledby",t.$.label.id):"DropDownList"===t.elementName&&n.setAttribute("aria-labelledby",t.$.actionButton.id),o.setAttribute("role","presentation"),o.removeAttribute("aria-owns"),e?n.setAttribute("aria-expanded",t.opened):(o.removeAttribute("aria-describedby"),o.removeAttribute("aria-expanded"),o.removeAttribute("aria-haspopup"),o.removeAttribute("aria-labelledby"))}_setDropDownSize(){const e=this,t=e.$.listBox;let o;if(e._dropDownSize||e._calculateDropDownSize(),["dropDownMinWidth","dropDownMaxWidth"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]="initial"===e[t]?e.offsetWidth+"px":e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),["dropDownMinHeight","dropDownMaxHeight"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]=e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),e.dropDownWidth?"auto"!==e.dropDownWidth?e.$.dropDownContainer.style.width=("initial"===e.dropDownWidth?e.offsetWidth:parseFloat(e.dropDownWidth))+"px":e.$.dropDownContainer.style.width="auto":e.$.dropDownContainer.style.width="auto"===e._dropDownSize.width?"auto":(parseFloat(e._dropDownSize.width)||0)+"px",e.dropDownHeight&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=parseFloat(e.dropDownHeight)+((e.dropDownHeight+"").indexOf("%")>-1?"%":"px");else if(!e.$.listBox||"auto"!==e._dropDownSize.height&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=e._dropDownSize.height;else{e.$.dropDownContainer.style.height="";let n=0;if(t.$.itemsContainer&&(n=2*parseInt(window.getComputedStyle(t.$.itemsContainer).getPropertyValue("--smart-list-item-vertical-offset"))),isNaN(n)&&(n=6),o=n,t.items&&t.items.length>0?t.items.map((e=>o+=e.height||e.offsetHeight)):o=t.$.placeholder?t.$.placeholder.offsetHeight:200,e.filterable){const e=t.$.filterInputContainer;o+=e.offsetHeight+e.offsetTop}o=o+e._dropDownSize.paddingWidth+e._dropDownSize.borderWidth,e.$.dropDownContainer.style.height=o+"px"}if(t){if(void 0===o||!t.$)return void t._refreshLayout();const n=t.$.horizontalScrollBar?t.$.horizontalScrollBar.offsetHeight:0,i=Math.max(0,e._dropDownSize.minHeight-(o-n));i&&(e.$.dropDownContainer.style.height=o+i+"px"),!e.opened&&e.virtualized&&t.refresh()}}_styleChangedHandler(e){const t=this;if(t.dropDownAppendTo){const o=e.detail.styleProperties,n=["font-size","font-family","font-style","font-weight"];for(let e=0;e<n.length;e++)o[n[e]]&&(t.$.dropDownContainer.style[n[e]]=o[n[e]].value)}"auto"===t._dropDownSize.height&&t._setDropDownSize()}_validateTemplate(e){const t=this;if(e&&"function"!=typeof e)if("content"in document.createElement("template")){if(e instanceof HTMLTemplateElement||(e=document.getElementById(e)),null!==e&&"content"in e)return e;t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:"tokenTemplate"}))}else t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()}))}});
|
|
129
|
+
Smart("smart-drop-down-list",class extends Smart.ContentElement{static get properties(){return{autoCloseDelay:{value:100,type:"number"},dataSource:{value:null,type:"any",reflectToAttribute:!1},displayLoadingIndicator:{value:!1,type:"boolean"},displayMember:{value:"",type:"string"},displayMode:{allowedValues:["outlined","filled","underlined"],value:"outlined",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownButtonPosition:{allowedValues:["none","left","right","top","bottom"],value:"right",defaultReflectToAttribute:!0,type:"string"},dropDownMinHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxHeight:{value:"",type:"any",validator:"_propertyValidator"},dropDownOpenMode:{allowedValues:["none","default","dropDownButton","auto"],value:"default",type:"string"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPlaceholder:{value:"No Items",type:"string"},dropDownPosition:{allowedValues:["auto","top","bottom","overlay-top","overlay-center","overlay-bottom","center-bottom","center-top"],value:"auto",type:"string"},dropDownMinWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownWidth:{value:"",type:"any",validator:"_propertyValidator"},dropDownMaxWidth:{value:"",type:"any",validator:"_propertyValidator"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterCallback:{value:null,type:"function?"},filterMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase","custom"],type:"string"},grouped:{value:!1,type:"boolean"},groupMember:{value:"",type:"string"},hint:{value:"",type:"string"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},incrementalSearchDelay:{value:700,type:"number?"},incrementalSearchMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},itemMeasureMode:{value:"auto",allowedValues:["auto","precise"],type:"string"},inputMember:{value:"label",type:"string"},itemTemplate:{value:null,type:"any"},itemHeight:{value:null,type:"number?"},label:{value:"",type:"string"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{extend:!0,value:{en:{invalidNode:'{{elementType}}: Invalid parameter "{{node}}" when calling {{method}}.'}},type:"object"},name:{value:"",type:"string"},opened:{value:!1,type:"boolean"},placeholder:{value:"",type:"string"},resizeMode:{value:"none",allowedValues:["none","horizontal","vertical","both"],type:"string"},resizeIndicator:{value:!1,type:"boolean"},selectionDisplayMode:{value:"plain",allowedValues:["plain","placeholder","tokens"],type:"string"},selectionMode:{value:"zeroAndOne",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectedIndexes:{value:[],type:"array"},selectedValues:{value:[],type:"array"},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},tokenTemplate:{value:null,type:"any"},type:{value:"list",type:"string",defaultReflectToAttribute:!0,readonly:!0},valueMember:{value:"",type:"string"},virtualized:{value:!1,type:"boolean"},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]}}}static get listeners(){return{"actionButton.down":"_buttonsDownHandler","actionButton.mouseenter":"_buttonsMouseEventsHandler","actionButton.mouseleave":"_buttonsMouseEventsHandler","actionButton.focus":"_buttonsFocusHandler","actionButton.blur":"_buttonsFocusHandler","document.selectstart":"_selectStartHandler","document.dragstart":"_dragStartHandler","document.down":"_documentDownHandler","document.up":"_documentUpHandler","document.move":"_documentMoveHandler","dropDownButton.down":"_buttonsDownHandler","dropDownButton.mouseenter":"_buttonsMouseEventsHandler","dropDownButton.mouseleave":"_buttonsMouseEventsHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",focus:"_focusEventHandler",blur:"_blurEventHandler","dropDownButton.focus":"_buttonsFocusHandler","dropDownButton.blur":"_buttonsFocusHandler","dropDownContainer.transitionend":"_dropDownTransitionendHandler","listBox.change":"_listBoxChangeHandler","listBox.itemClick":"_listBoxItemClickHandler","listBox.keydown":"_listBoxKeyDownHandler","listBox.bindingComplete":"_bindingCompleteHandler","listBox.scrollBottomReached":"_scrollBottomReachedHandler","listBox.scrollTopReached":"_scrollTopReachedHandler",mouseenter:"_mouseEnterHandler",mouseleave:"_mouseLeaveHandler",resize:"_resizeHandler","resizeBar.move":"_resizeBarMoveHandler",styleChanged:"_styleChangedHandler",wheel:"_mouseWheelHandler"}}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 class="smart-buttons-container" id="buttonsContainer" role="presentation">\n <span id="actionButton" class ="smart-action-button" role="presentation">[[placeholder]]</span>\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-container smart-visibility-hidden" role="presentation">\n <smart-list-box id="listBox" unfocusable\n animation="[[animation]]"\n data-source="[[dataSource]]"\n disabled="[[disabled]]"\n display-loading-indicator="[[displayLoadingIndicator]]"\n display-member="[[displayMember]]"\n filterable="[[filterable]]"\n filter-callback="[[filterCallback]]"\n filter-mode="[[filterMode]]"\n filter-input-placeholder="[[filterInputPlaceholder]]"\n grouped="[[grouped]]"\n group-member="[[groupMember]]"\n item-height="[[itemHeight]]"\n item-measure-mode="[[itemMeasureMode]]"\n item-template="[[itemTemplate]]"\n incremental-search-delay="[[incrementalSearchDelay]]"\n incremental-search-mode="[[incrementalSearchMode]]"\n loading-indicator-placeholder="[[loadingIndicatorPlaceholder]]"\n loading-indicator-position="[[loadingIndicatorPosition]]"\n name="[[name]]"\n placeholder="[[dropDownPlaceholder]]"\n right-to-left="[[rightToLeft]]"\n readonly="[[readonly]]"\n selected-indexes="{{selectedIndexes}}"\n selection-mode="[[selectionMode]]"\n selected-values="{{selectedValues}}"\n sorted="[[sorted]]"\n sort-direction="[[sortDirection]]"\n theme="[[theme]]"\n value-member="[[valueMember]]"\n horizontal-scroll-bar-visibility="[[horizontalScrollBarVisibility]]"\n vertical-scroll-bar-visibility="[[verticalScrollBarVisibility]]"\n virtualized="[[virtualized]]">\n <content></content>\n </smart-list-box>\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-hint smart-hidden" id="hint">[[hint]]</span>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>'}static get styleUrls(){return["smart.dropdownlist.css","smart.dropdown.css"]}propertyChangedHandler(e,t,o){super.propertyChangedHandler(e,t,o);const n=this;switch(e){case"animation":n.$.dropDownContainer.setAttribute("animation",n.animation);break;case"disabled":n._setFocusable(),n.close(),n._positionDetection.handleAutoPositioning();break;case"dataSource":case"displayMember":case"inputMember":n.$.actionButton&&(n.$.actionButton.innerHTML=n.placeholder),n._setDropDownSize(),n._positionDetection.checkBrowserBounds("vertically"),n._positionDetection.positionDropDown(),n._positionDetection.checkBrowserBounds("horizontally");break;case"dropDownAppendTo":n._positionDetection.dropDownAppendToChangedHandler();break;case"dropDownOpenMode":n._setFocusable(),n.$dropDownContainer.addClass("smart-visibility-hidden"),n.$.dropDownContainer.setAttribute("drop-down-open-mode",o),n.$.dropDownButton.removeAttribute("selected"),n.removeAttribute("drop-down-button-focus"),n.removeAttribute("action-button-focus"),n.opened=!1,n._ariaButton&&n._ariaButton.setAttribute("aria-expanded",!1),n._setAriaRelations();break;case"dropDownOverlay":o||n._positionDetection.removeOverlay();break;case"dropDownPosition":n._positionDetection.dropDownPositionChangedHandler();break;case"dropDownMinWidth":case"dropDownWidth":case"dropDownMaxWidth":case"dropDownHeight":case"dropDownMinHeight":case"dropDownMaxHeight":n._setDropDownSize();break;case"filterable":n.$.listBox.filterable=o,n._dropDownSize&&"auto"===n._dropDownSize.height&&n._setDropDownSize();break;case"label":if(!n._ariaButton)return;o?n._ariaButton.setAttribute("aria-labelledby",n.$.label.id):"DropDownList"===n.elementName&&n._ariaButton.setAttribute("aria-labelledby",n.$.actionButton.id);break;case"opened":if(n.disabled||n.readonly)return;o?n.open():n.close();break;case"placeholder":case"selectionDisplayMode":n._applySelection();break;case"readonly":n.close();break;case"resizeIndicator":o?n.$.dropDownContainer.setAttribute("resize-indicator",""):n.$.dropDownContainer.removeAttribute("resize-indicator");break;case"resizeMode":n.$.dropDownContainer.setAttribute("resize-mode",n.resizeMode);break;case"selectedValues":case"selectedIndexes":0===o.length?n.$.actionButton.innerHTML=n.placeholder:n._applySelection(),n.$.hiddenInput.value=n.selectedValues.toString();break;case"selectionMode":n.$.listBox&&(n.$.listBox[e]=o,"checkBox"!==o&&"radioButton"!==o&&"checkBox"!==t&&"radioButton"!==t||n._setDropDownSize());break;case"tokenTemplate":n._tokenTemplate=n._validateTemplate(n.tokenTemplate),n._applySelection();break;case"unfocusable":n._setFocusable()}}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const o=e.dataset.property,n=e.value;o&&void 0!==t[o]&&(t[o]=n)}}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e?(t.$.listBox.appendChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"appendChild",node:"node"}))}attached(){const e=this;super.attached(),e.isCompleted&&e.$.dropDownContainer&&(e._positionDetection.dropDownAttached("_setDropDownSize"),e._positionDetection.checkBrowserBounds(),e.selectedIndexes&&e._applySelection())}detached(){const e=this;super.detached(),e.$.dropDownContainer&&(e.close(),e._positionDetection&&e._positionDetection.dropDownDetached())}clearItems(){const e=this;e.$.listBox&&(e.$.listBox.clearItems(),e.$.actionButton.innerHTML=e.placeholder)}clearSelection(){const e=this;e.$.listBox&&(e.$.listBox.clearSelection(),e.$.actionButton.innerHTML=e.placeholder)}close(){const e=this;e.$dropDownContainer.hasClass("smart-visibility-hidden")||e.$.fireEvent("closing").defaultPrevented||(e.$dropDownContainer.addClass("smart-visibility-hidden"),e.$.fireEvent("close"),e.$.dropDownButton&&e.$.dropDownButton.removeAttribute("selected"),e.opened=!1,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!1),e._preventDropDownClose=!1,e._positionDetection.removeOverlay(!0),e.$.listBox.removeAttribute("focus"),e._edgeMacFF&&!e.hasAnimation&&e.$.dropDownContainer&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view")))}cloneNode(){const e=this;if(!e.$.listBox)return;let t=HTMLElement.prototype.cloneNode.apply(e,Array.prototype.slice.call(arguments,0,1));return t.dataSource=e.dataSource,t}ensureVisible(e){this.$.listBox&&this.$.listBox.ensureVisible(e)}getItem(e){if(this.$.listBox)return this.$.listBox.getItem(e)}get items(){const e=this;return e.$&&e.$.listBox?e.$.listBox.items:[]}get _focusedItem(){const e=this;return e.$&&e.$.listBox?e.$.listBox._focusedItem:null}insert(e,t){const o=this;o.$.listBox&&(o.$.listBox.insert(e,t),o._applySelection(),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize())}insertBefore(e,t){const o=this;if(!o.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(o,e.concat(Array.prototype.slice.call(arguments)))}e&&t?o.$.listBox&&(o.$.listBox.insertBefore(e,t),o._dropDownSize&&"auto"===o._dropDownSize.height&&o._setDropDownSize()):o.error(o.localize("invalidNode",{elementType:o.nodeName.toLowerCase(),method:"insertBefore",node:"newNode/referenceNode"}))}toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this,t=function(){for(let t=0;t<e.items.length;t++)if(!e.items[t].disabled)return e.items[t]};if(!e.disabled&&e.offsetHeight&&e.$dropDownContainer.hasClass("smart-visibility-hidden")){if(e.$dropDownContainer.hasClass("not-in-view")&&e.$dropDownContainer.removeClass("not-in-view"),e.$.dropDownContainer.style.transition=null,e.dropDownAppendTo){const t=e.getBoundingClientRect();if(e.$.container.contains(e.$.dropDownContainer)){let t=0;const o=setInterval((function(){const n=e.getBoundingClientRect();t++,n.top===e._positionTop&&t<10||(e.open(),clearInterval(o),e._positionTop=n.top)}),100);return}t.top!==e._positionTop&&(e._positionTop=t.top)}e.$.fireEvent("opening").defaultPrevented||(e._shadowDOMStylesDelay&&(e._setDropDownSize(),delete e._shadowDOMStylesDelay),e.opened=!0,e._ariaButton&&e._ariaButton.setAttribute("aria-expanded",!0),e.$.listBox.setAttribute("focus",""),e._positionDetection.placeOverlay(),e._positionDetection.checkBrowserBounds("vertically"),e._positionDetection.positionDropDown(),e._positionDetection.checkBrowserBounds("horizontally"),e.$dropDownContainer.removeClass("smart-visibility-hidden"),e.$.fireEvent("open"),e.$.dropDownButton&&("dropDownButton"===e.dropDownOpenMode?e.$.dropDownButton.setAttribute("selected",""):e.$.dropDownButton.removeAttribute("selected")),(e.$.listBox&&!e._focusedItem||e._focusedItem&&!e._focusedItem._focused)&&(e.selectedIndexes.length>0?e._focus(e.items[e.selectedIndexes[0]]):e._focus(t)),e.$.input&&!Smart.Utilities.Core.isMobile&&e.$.input.focus())}}ready(){super.ready()}render(){const e=this;e.rightToLeft&&(e.dropDownButtonPosition="right"===e.dropDownButtonPosition?"left":"right"),e.classList.add("smart-drop-down-box"),e.$.dropDownContainer&&(e._positionDetection=new Smart.Utilities.PositionDetection(e,e.$.dropDownContainer,e.$.container,"close"),e._positionDetection.getDropDownParent(!0),e._positionDetection.setDropDownPosition(),e._calculateDropDownSize(),e.$.dropDownContainer.setAttribute("resize-mode",e.resizeMode),e.$.dropDownContainer.setAttribute("drop-down-open-mode",e.dropDownOpenMode),e.resizeIndicator&&e.$.dropDownContainer.setAttribute("resize-indicator",""),e._positionDetection.handleAutoPositioning()),e.opened&&e.open(),e._positionTop=e.getBoundingClientRect().top,e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._edgeMacFF&&e.hasAnimation&&e.$.dropDownContainer&&e.$dropDownContainer.addClass("not-in-view"),e.$.label&&!e.$.label.id&&(e.$.label.id=e.id+"Label"),e.$.actionButton&&!e.$.actionButton.id&&(e.$.actionButton.id=e.id+"ActionButton"),e.$.hint&&!e.$.hint.id&&(e.$.hint.id=e.id+"Hint"),e._createElement(),super.render()}removeAt(e){const t=this;t.$.listBox&&(t.$.listBox.removeAt(e),t._applySelection(),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize())}removeChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&e.classList.contains("smart-resize-trigger-container")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e&&e instanceof Smart.ListItem?(t.$.listBox.removeChild(e),t._dropDownSize&&"auto"===t._dropDownSize.height&&t._setDropDownSize()):t.error(t.localize("invalidNode",{elementType:t.nodeName.toLowerCase(),method:"removeChild",node:"node"}))}get value(){const e=this;return e.isRendered&&e.$.listBox?e.$.listBox.value:null}set value(e){const t=this;return t.isRendered&&t.$.listBox?void(t.$.listBox.value=e):null}select(e){this.$.listBox&&this.$.listBox.select(e)}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.removeAttribute("tabindex"),e.$.actionButton.removeAttribute("tabindex"),void e.$.dropDownButton.removeAttribute("tabindex");let t=e.tabIndex>0?e.tabIndex:0;e.tabIndex=t,"dropDownButton"===e.dropDownOpenMode?(e.removeAttribute("tabindex"),e.$.actionButton.setAttribute("tabindex",t),e.$.dropDownButton.setAttribute("tabindex",t)):(e.$.actionButton.removeAttribute("tabindex"),e.$.dropDownButton.removeAttribute("tabindex"))}static get requires(){return{"Smart.ListBox":"smart.listbox.js"}}unselect(e){this.$.listBox&&this.$.listBox.unselect(e)}update(e,t){const o=this;o.$.listBox&&(o.$.listBox.update(e,t),o._applySelection())}_resizeBarMoveHandler(e){"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_createToken(){const e=this;let t,o=!1;const n=document.createDocumentFragment(),i=e.selectedIndexes[e.selectedIndexes.length-1];"plain"!==e.selectionDisplayMode||"one"!==e.selectionMode&&"zeroAndOne"!==e.selectionMode&&"zeroOrOne"!==e.selectionMode&&"radioButton"!==e.selectionMode?"tokens"===e.selectionDisplayMode?1===e.selectedIndexes.length&&["oneOrManyExtended","oneOrMany","zeroAndOne","one","radioButton"].indexOf(e.selectionMode)>-1?t="":(t="✖",o=!0):t=1===e.selectedIndexes.length?"":",":t="";const r=e.selectedIndexes,a=e.$.listBox._items;for(let s=0;s<r.length;s++){const l=r[s];a[l]&&n.appendChild(e._applyTokenTemplate(a[l][e.inputMember],"tokens"!==e.selectionDisplayMode&&l===i?"":t,o))}return n}_applySelection(){const e=this;if("placeholder"!==e.selectionDisplayMode&&0!==e.selectedIndexes.length){if(e.$.listBox._items&&0!==e.$.listBox._items.length){if("plain"===e.selectionDisplayMode){const t=e.$.listBox.selectedIndexes,o=e.$.listBox._items;let n=[];for(let i=0;i<t.length;i++){const r=t[i];o[r]&&n.push(o[r][e.inputMember])}return e.$.actionButton.innerHTML=n.length?`<span class="smart-token">${n.join(", ").trim()}</span>`:"",void(e.$.hiddenInput.value=e.selectedValues.toString())}e.$.actionButton.innerHTML="",e.$.actionButton.appendChild(e._createToken()),e.$.hiddenInput.value=e.selectedValues.toString()}}else e.$.actionButton.innerHTML=e.placeholder}_applyTokenTemplate(e,t,o){const n=this,i=document.createElement("span"),r=function(){return"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+e+`</span><span class='smart-drop-down-list-unselect-button' role="button"${o?' aria-label="Unselect"':""}>${t}</span>`};if(i.classList.add("smart-token"),n._tokenTemplate){let e=document.importNode(n._tokenTemplate.content,!0);const t=e.childNodes.length,o=/{{\w+}}/g;let a;for(let n=0;n<t;n++)a=o.exec(e.childNodes[n].innerHTML),a&&(e.childNodes[n].innerHTML=e.childNodes[n].innerHTML.replace(a[0],r())),e.childNodes[n].outerHTML&&(i.innerHTML+=e.childNodes[n].outerHTML)}else"function"==typeof n.tokenTemplate?n.tokenTemplate(i,{label:e,iconSeparator:t}):i.innerHTML=r();return i}_bindingCompleteHandler(){const e=this;e.$.listBox&&requestAnimationFrame((()=>{e._setDropDownSize(),e._positionDetection.checkBrowserBounds()}))}_buttonsDownHandler(e){const t=this;if(!t.disabled){if(t.hasRippleAnimation)if(t.$.buttonsContainer&&"dropDownButton"!==t.dropDownOpenMode){const o=t.$.buttonsContainer;o.firstElementChild.noRipple=!0,Smart.Utilities.Animation.Ripple.animate(o,e.pageX,e.pageY),o.firstElementChild.noRipple=!1}else Smart.Utilities.Animation.Ripple.animate(e.target,e.pageX,e.pageY);t._preventsSelectStart=!0,t.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.actionButton&&t.$.actionButton.setAttribute("active",""),t.opened&&(t._preventDropDownClose=!0)}}_buttonsMouseEventsHandler(e){const t=this;t.disabled||("mouseenter"===e.type?(t.setAttribute("hover",""),e.target.setAttribute("hover",""),"dropDownButton"===t.dropDownOpenMode&&e.target===t.$.dropDownButton&&t.setAttribute("drop-down-button-hover","")):(t.removeAttribute("hover"),t.removeAttribute("drop-down-button-hover"),e.target.removeAttribute("hover")))}_calculateDropDownSize(){const e=this;e._dropDownSize={};const t=window.getComputedStyle(e.$.dropDownContainer),o=parseFloat(t.getPropertyValue("border-top-width").trim()),n=parseFloat(t.getPropertyValue("border-bottom-width").trim()),i=parseFloat(t.getPropertyValue("margin-top").trim()),r=parseFloat(t.getPropertyValue("margin-bottom").trim()),a=parseFloat(t.getPropertyValue("padding-top").trim()),s=parseFloat(t.getPropertyValue("padding-bottom").trim());Smart.Utilities.Core.CSSVariablesSupport()&&(e._dropDownSize.width=t.getPropertyValue("--smart-drop-down-list-drop-down-width").trim(),e._dropDownSize.height=t.getPropertyValue("--smart-drop-down-list-drop-down-height").trim()),(!e._dropDownSize.width||e._dropDownSize.width.indexOf("initial")>-1)&&(e._dropDownSize.width=e.offsetWidth),e._dropDownSize.height||(e._dropDownSize.height="auto"),e._dropDownSize.minHeight=parseFloat(t.getPropertyValue("min-height").trim()),e._dropDownSize.maxHeight=parseFloat(t.getPropertyValue("max-height").trim()),e._dropDownSize.borderWidth=(isNaN(o)?0:o)+(isNaN(n)?0:n),e._dropDownSize.paddingWidth=(isNaN(a)?0:a)+(isNaN(s)?0:s),e._dropDownSize.marginWidth=(isNaN(i)?0:i)+(isNaN(r)?0:r)}_createElement(){const e=this;e._tokenTemplate=e._validateTemplate(e.tokenTemplate),e._applySelection(),e._setDropDownSize(),e._setFocusable(),e.$.arrow.noRipple=!0,e._shadowDOMStylesDelay=e.shadowRoot,e._setAriaRelations(!0)}_documentDownHandler(e){const t=this;if(t.disabled||t.readonly)return;let o=e.originalEvent.target;if(o===t._overlay&&(t._overlayDown=!0),t.shadowRoot){o=e.originalEvent.composedPath()[0];let n=o.getRootNode().host;for(;n;)n.closest(".smart-drop-down-container")===t.$.dropDownContainer&&(t._isDropDownClicked=!0),n=n.getRootNode().host}else t.isInShadowDOM&&(o=e.originalEvent.composedPath()[0]),t._isDropDownClicked=o.closest(".smart-drop-down-container")===t.$.dropDownContainer;if(t._buttonClicked=o.closest(".smart-action-button")||o.closest(".smart-drop-down-button"),t.$.listBox){let n=o.closest("smart-list-item");t.$.listBox.contains(n)||(n=void 0),t.hasRippleAnimation&&n&&Smart.Utilities.Animation.Ripple.animate(n,e.pageX,e.pageY),(n||o===t.$.listBox.$.filterInput||o.closest(".smart-token"))&&(t._preventDropDownClose=!0)}if(t._isDropDownClicked&&(t._preventDropDownClose=!0),o!==t.$.resizeBar||"none"===t.resizeMode)return;t._resizeDetails||(t._resizeDetails={});const n=t.$.dropDownContainer.getBoundingClientRect();t._resizeDetails.started=!0,t._resizeDetails.x=e.pageX,t._resizeDetails.y=e.pageY,t._resizeDetails.width=t.$.dropDownContainer.offsetWidth,t._resizeDetails.height=t.$.dropDownContainer.offsetHeight,t._resizeDetails.offsetXL=e.clientX-n.left,t._resizeDetails.offsetXR=n.left+t.$.dropDownContainer.offsetWidth-e.clientX,t._resizeDetails.offsetY=n.top+t.$.dropDownContainer.offsetHeight-e.clientY,t._resizeDetails.offsetYtop=e.clientY-n.top,t._preventDropDownClose=!0}_documentMoveHandler(e){const t=this,o=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if("auto"===t.dropDownOpenMode&&null!==t.dropDownAppendTo&&(t.contains(o)||t.$.dropDownContainer.contains(o)?t._isElementHovered=!0:(t._isElementHovered=!1,t._autoClose())),!t._resizeDetails||t._resizeDetails&&!t._resizeDetails.started)return;t.setAttribute("resizing",""),t._resizeDetails.resizeEventFired||(t.$.fireEvent("resizeStart",{position:{left:e.pageX,top:e.pageY}}),t._resizeDetails.resizeEventFired=!0);const n=document.documentElement,i=t.$.dropDownContainer.getBoundingClientRect(),r=t.getBoundingClientRect(),a=t.$.dropDownContainer.hasAttribute("top")?"top":"bottom";let s;function l(){if(s=e.pageY-t._resizeDetails.y,"bottom"===a)t._resizeDetails.height=Math.min(n.clientHeight-i.top-6,Math.max(0,t._resizeDetails.height+s)),t._resizeDetails.y=Math.max(i.top+n.scrollTop-t._resizeDetails.offsetY,Math.min(n.clientHeight+n.scrollTop-1.5*t._resizeDetails.offsetY,e.pageY));else{if(t._resizeDetails.height=Math.min(t._dropDownSize.maxHeight,Math.max(0,Math.min(r.top,t._resizeDetails.height-s))),s=Math.max(0,i.top+(i.height-Math.max(t._dropDownSize.minHeight,t._resizeDetails.height))),t.dropDownAppendTo){const e=Math.abs(parseFloat(getComputedStyle(t.$.dropDownContainer).getPropertyValue("margin-bottom")))||0;t.$.dropDownContainer.style.top=t.dropDownAppendTo?e+s+"px":""}const o=r.top+n.scrollTop+t._resizeDetails.offsetYtop;t._resizeDetails.y=Math.max(t._resizeDetails.offsetYtop,Math.min(o,Math.max(o-t._dropDownSize.maxHeight,e.pageY)))}t.$.dropDownContainer.style.height=t._resizeDetails.height+"px"}function d(){s=e.pageX-t._resizeDetails.x,t._resizeDetails.width=Math.min(n.clientWidth-i.left-6,Math.max(0,t._resizeDetails.width+s)),t.$.dropDownContainer.style.width=t._resizeDetails.width+"px",t._resizeDetails.x=Math.max(i.left+n.scrollLeft-t._resizeDetails.offsetXR,Math.min(n.clientWidth+n.scrollLeft-1.5*t._resizeDetails.offsetXR,e.pageX))}switch(t.resizeMode){case"vertical":l();break;case"horizontal":d();break;case"both":d(),l()}}_documentUpHandler(e){const t=this;if(t.$.actionButton.removeAttribute("active"),t._resizeDetails&&t._resizeDetails.started)return t._resizeDetails.started=t._resizeDetails.resizeEventFired=!1,t.removeAttribute("resizing"),t._preventDropDownClose=!1,t.focus(),void t.$.fireEvent("resizeEnd",{position:{left:e.pageX,top:e.pageY}});if(t.disabled||t._isDropDownClicked||t.readonly)return void delete t._isDropDownClicked;if(t._overlayDown)return t.close(),void delete t._overlayDown;let o=e.originalEvent.target,n=o.closest?o.closest("smart-drop-down-list"):void 0;if((t.enableShadowDOM||t.isInShadowDOM)&&(o=e.originalEvent.composedPath()[0],n=o.getRootNode().host),t._preventsSelectStart=!1,void 0===o||o===t.$.resizeBar)return;if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-selection-label")&&n===t){"none"!==t.dropDownOpenMode&&t.open();let e=t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.textContent))[0];return t.$.listBox._scrollView.scrollTop=e.offsetTop,void t._focus(e)}if("tokens"===t.selectionDisplayMode&&o.classList.contains("smart-drop-down-list-unselect-button")&&n===t){if(1===t.selectedIndexes.length&&["zeroOrMany","zeroOrOne","checkBox"].indexOf(t.selectionMode)<0)return;return void t.unselect(t.$.listBox._items.filter((e=>e[t.inputMember].toString()===o.previousElementSibling.textContent))[0])}const i=!(!o||!o.closest)&&o.closest(".smart-action-button");let r;if(t._buttonClicked&&("dropDownButton"===t.dropDownOpenMode&&i&&t._buttonClicked===t.$.actionButton?t.$.fireEvent("actionButtonClick"):o.closest(".smart-drop-down-button")!==t._buttonClicked&&i!==t._buttonClicked||(r=!0,t.$.fireEvent("dropDownButtonClick"))),t._buttonClicked=void 0,i===t.$.actionButton||o&&o.closest&&o.closest(".smart-drop-down-button")===t.$.dropDownButton)return"dropDownButton"===t.dropDownOpenMode&&i===t.$.actionButton?void t.close():void(t.$dropDownContainer.hasClass("smart-visibility-hidden")&&"none"!==t.dropDownOpenMode&&r&&"pointercancel"!==e.originalEvent.type?t.open():t.close());o=t._getUpEventTarget(o),void 0!==o&&("dropDownContainer"!==o&&"item"!==o||"item"===o&&"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0)&&t.close()}_dragStartHandler(e){this._resizeDetails&&this._resizeDetails.started&&e.preventDefault()}_dropDownTransitionendHandler(){const e=this;e._edgeMacFF&&!e.opened&&e.hasAnimation&&(e.$.dropDownContainer.style.top=e.$.dropDownContainer.style.left="",e.$dropDownContainer.addClass("not-in-view"))}_focus(e){this.$.listBox._focus(e)}_blurEventHandler(){const e=this;e.$.dropDownButton&&(e.removeAttribute("focus"),e.$.dropDownButton.removeAttribute("focus")),e.$.actionButton&&(e.removeAttribute("focus"),e.$.actionButton.removeAttribute("focus")),e.nodeName&&"smart-drop-down-list"===e.nodeName.toLowerCase()&&!e._preventDropDownClose&&e.close()}_focusEventHandler(){const e=this;e.$.dropDownButton&&(e.setAttribute("focus",""),e.$.dropDownButton.setAttribute("focus","")),e.$.actionButton&&(e.setAttribute("focus",""),e.$.actionButton.setAttribute("focus","")),e.removeAttribute("drop-down-button-focus"),e.removeAttribute("action-button-focus")}_buttonsFocusHandler(e){const t=this;e.target===t.$.dropDownButton?"focus"===e.type?t.setAttribute("drop-down-button-focus",""):(t.removeAttribute("drop-down-button-focus"),t.nodeName&&"smart-drop-down-list"===t.nodeName.toLowerCase()&&!t._preventDropDownClose&&t.close()):"focus"===e.type?t.setAttribute("action-button-focus",""):t.removeAttribute("action-button-focus")}_getUpEventTarget(e){const t=this;let o=e;for(o=void 0===o.parentElement?o.getRootNode().host:o.parentElement;o;){if(o===t.$.dropDownContainer){o="dropDownContainer";break}o=void 0===o.parentElement?o.getRootNode().host:o.parentElement}return o}_keyDownHandler(e){const t=this,o=t.enableShadowDOM&&t.shadowRoot.activeElement||document.activeElement,n=t.enableShadowDOM?e.composedPath()[0]:e.target;if(!(t.$.listBox&&n===t.$.listBox.$.filterInput||o!==t&&o!==t.$.dropDownButton&&o!==t.$.actionButton)||"Tab"===e.key)switch(e.key){case"Tab":if(t.filterable&&t.opened){const o=function(){for(let e=0;e<t.items.length;e++)if(!t.items[e].disabled)return t.items[e]};t.$.listBox.$.filterInput&&!Smart.Utilities.Core.isMobile&&document.activeElement!==t.$.listBox.$.filterInput?(t.$.listBox.$.filterInput.focus(),t._preventDropDownClose=!0):t.$.listBox&&(t.focus(),t.selectedIndexes.length>0?t._focus(t.items[t.selectedIndexes[0]]):t._focus(o),t._preventDropDownClose=!0),e.preventDefault()}break;case"Enter":case" ":e.preventDefault(),n!==t.$.actionButton&&(t._keyPressed=!0,t.opened?(t._focusedItem&&t.select(t._focusedItem),("Enter"===e.key&&["none"].indexOf(t.selectionMode)<0||" "===e.key&&["none","zeroAndOne","one","radioButton"].indexOf(t.selectionMode)>-1)&&t.close()):t.opened||t.readonly||"none"===t.dropDownOpenMode||t.open()),"dropDownButton"===t.dropDownOpenMode&&n.setAttribute("active","");break;case"End":case"Home":case"PageUp":case"PageDown":case"ArrowUp":case"ArrowDown":if(t.readonly)return;if(e.altKey)return t._keyPressed=!1,void(t.$dropDownContainer.hasClass("smart-visibility-hidden")?t.open():t.close());e.preventDefault(),t.$.listBox._handleKeyStrokes(e.key);break;case"Escape":e.preventDefault(),t.close();break;default:if(t.readonly)return;"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!0),t.$.listBox._applyIncrementalSearch(e.key)}}_keyUpHandler(e){const t=this,o=t.enableShadowDOM?e.composedPath()[0]:e.target;t.$.listBox&&o===t.$.listBox.$.filterInput||("Enter"!==e.key&&" "!==e.key||(o.removeAttribute("active"),t.$dropDownContainer.hasClass("smart-visibility-hidden")||(t._keyPressed=!1)),t.$.listBox&&"oneOrManyExtended"===t.selectionMode&&(t.$.listBox._keysPressed[e.key]=!1))}_listBoxChangeHandler(e){const t=this;if(e.target===t.$.listBox){if((t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent("change",e.detail),"list"===t.autoComplete&&e.detail){const o=t.$.listBox._items[e.detail.index];t._lastSelectedItem=o&&o.selected?o:void 0}t._applySelection(t.selectionMode,e.detail),t._updateTargetValue()}else e.stopPropagation()}_listBoxItemClickHandler(e){const t=this;(t.dropDownAppendTo||t.enableShadowDOM)&&t.$.fireEvent(e.type,e.detail),"checkBox"!==t.selectionMode&&t.selectionMode.indexOf("Many")<0&&t.close(),Smart.Utilities.Core.isMobile||t.focus(),delete t._isDropDownClicked}_listBoxKeyDownHandler(e){const t=this;if("Enter"===e.key)return t.close(),"dropDownButton"===t.dropDownOpenMode?t.$.dropDownButton.focus():t.focus(),void e.stopPropagation();"Escape"!==e.key||t.close()}_scrollBottomReachedHandler(e){const t=this,o="onScrollBottomReached";t[o]?t[o(e)]:t[o.toLowerCase()]?t[o.toLowerCase()](e):t.dropDownAppendTo&&t.$.fireEvent(o)}_scrollTopReachedHandler(e){const t=this,o="onScrollTopReached";t[o]?t[o(e)]:t[o.toLowerCase()]?t[o.toLowerCase()](e):t.dropDownAppendTo&&t.$.fireEvent(o)}_mouseEnterHandler(){const e=this;e._isElementHovered=!0,e.tagName.toLowerCase().indexOf("smart-drop-down-")>-1&&"auto"===e.dropDownOpenMode&&!e.disabled&&!e.readonly&&e.open()}_mouseLeaveHandler(){const e=this;e.removeAttribute("hover"),e._isElementHovered=!1,"auto"!==e.dropDownOpenMode||e.disabled||e.readonly||e._autoClose()}_mouseWheelHandler(e){const t=this;t.disabled||t.readonly||t.items&&0===t.items.length||t.$dropDownContainer&&!t.$dropDownContainer.hasClass("smart-visibility-hidden")||t.$.listBox&&(e.preventDefault(),t.$.listBox._handleKeyStrokes(e.deltaY>0?"ArrowDown":"ArrowUp"))}_autoClose(){const e=this;e._autoCloseTimeout=setTimeout(function(){e._isElementHovered||e.close(),clearTimeout(e._autoCloseTimeout)}.bind(e),e.autoCloseDelay)}_propertyValidator(e,t){return"number"!=typeof t&&"string"!=typeof t?e:t}_resizeHandler(){this.refresh()}refresh(){const e=this;"none"===e.resizeMode&&(e._calculateDropDownSize(),e._setDropDownSize())}_selectStartHandler(e){this._preventsSelectStart&&e.preventDefault()}_setAriaRelations(e){const t=this;let o,n;"dropDownButton"!==t.dropDownOpenMode?(o=t.$.dropDownButton,o.setAttribute("aria-hidden",!0),n=t,t.$.actionButton.removeAttribute("role")):(o=t,n=t.$.dropDownButton,n.removeAttribute("aria-hidden"),t.$.actionButton.setAttribute("role","button")),t._ariaButton=n,n.setAttribute("role","button"),n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-owns",t.$.listBox.id),n.setAttribute("aria-describedby",t.$.hint.id),t.label?n.setAttribute("aria-labelledby",t.$.label.id):"DropDownList"===t.elementName&&n.setAttribute("aria-labelledby",t.$.actionButton.id),o.setAttribute("role","presentation"),o.removeAttribute("aria-owns"),e?n.setAttribute("aria-expanded",t.opened):(o.removeAttribute("aria-describedby"),o.removeAttribute("aria-expanded"),o.removeAttribute("aria-haspopup"),o.removeAttribute("aria-labelledby"))}_setDropDownSize(){const e=this,t=e.$.listBox;let o;if(e._dropDownSize||e._calculateDropDownSize(),["dropDownMinWidth","dropDownMaxWidth"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]="initial"===e[t]?e.offsetWidth+"px":e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),["dropDownMinHeight","dropDownMaxHeight"].forEach((t=>{e.$.dropDownContainer.style[t.replace("dropDown","").replace(/^./,"m")]=e[t]?parseFloat(e[t])+(e[t].toString().endsWith("%")?"%":"px"):null})),e.dropDownWidth?"auto"!==e.dropDownWidth?e.$.dropDownContainer.style.width=("initial"===e.dropDownWidth?e.offsetWidth:parseFloat(e.dropDownWidth))+"px":e.$.dropDownContainer.style.width="auto":e.$.dropDownContainer.style.width="auto"===e._dropDownSize.width?"auto":(parseFloat(e._dropDownSize.width)||0)+"px",e.dropDownHeight&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=parseFloat(e.dropDownHeight)+((e.dropDownHeight+"").indexOf("%")>-1?"%":"px");else if(!e.$.listBox||"auto"!==e._dropDownSize.height&&"auto"!==e.dropDownHeight)e.$.dropDownContainer.style.height=e._dropDownSize.height;else{e.$.dropDownContainer.style.height="";let n=0;if(t.$.itemsContainer&&(n=2*parseInt(window.getComputedStyle(t.$.itemsContainer).getPropertyValue("--smart-list-item-vertical-offset"))),isNaN(n)&&(n=6),o=n,t.items&&t.items.length>0?t.items.map((e=>o+=e.height||e.offsetHeight)):o=t.$.placeholder?t.$.placeholder.offsetHeight:200,e.filterable){const e=t.$.filterInputContainer;o+=e.offsetHeight+e.offsetTop}o=o+e._dropDownSize.paddingWidth+e._dropDownSize.borderWidth,e.$.dropDownContainer.style.height=o+"px"}if(t){if(void 0===o||!t.$)return void t._refreshLayout();const n=t.$.horizontalScrollBar?t.$.horizontalScrollBar.offsetHeight:0,i=Math.max(0,e._dropDownSize.minHeight-(o-n));i&&(e.$.dropDownContainer.style.height=o+i+"px"),!e.opened&&e.virtualized&&t.refresh()}}_styleChangedHandler(e){const t=this;if(t.dropDownAppendTo){const o=e.detail.styleProperties,n=["font-size","font-family","font-style","font-weight"];for(let e=0;e<n.length;e++)o[n[e]]&&(t.$.dropDownContainer.style[n[e]]=o[n[e]].value)}"auto"===t._dropDownSize.height&&t._setDropDownSize()}_validateTemplate(e){const t=this;if(e&&"function"!=typeof e)if("content"in document.createElement("template")){if(e instanceof HTMLTemplateElement||(e=document.getElementById(e)),null!==e&&"content"in e)return e;t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:"tokenTemplate"}))}else t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()}))}});
|
|
130
130
|
|
|
131
131
|
/***/ }),
|
|
132
132
|
|
|
@@ -196,7 +196,7 @@ Smart("smart-radio-button",class extends Smart.ToggleButton{static get propertie
|
|
|
196
196
|
/***/ 6670:
|
|
197
197
|
/***/ (() => {
|
|
198
198
|
|
|
199
|
-
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"},currentTime:{value:null,type:"any",validator:"_dateValidator"},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":case"unfocusable":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":case"maxEventsPerCell":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"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":case"views":i._refreshViewSelector();break;case"timeZone":i._events.forEach((e=>i._setEventTimeZone(e,t))),i._createTimeline();break;case"timeZones":case"sortBy":case"sortOrder":case"sortFunction":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"undoRedoSteps":delete i._undoRedoHistory;break;case"view":i._handleViewSelection(),i._createTimeline(),i._refreshDateSelector(),i._scrollToView(),i.$.fireEvent("viewChange",{oldValue:t,value:n});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"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();if(0!==e.firstDayOfWeek&&t.indexOf("week")>-1&&e.dateCurrent&&e.dateCurrent.getDay()!==e.firstDayOfWeek){const t=e.dateCurrent.getDay()-e.firstDayOfWeek;e.dateCurrent=e.dateCurrent.setDate(e.dateCurrent.getDate()-e.dateCurrent.getDay()+e.firstDayOfWeek-(t>0?0:7))}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,e._rRule&&window.rrule.RRule.RRule&&(e._rRule=window.rrule.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;let t=e._events;return"local"!==e.timeZone&&(t=t.map((t=>e._cloneObject(t,!1))),t.forEach((t=>{t.dateStart=new Smart.Utilities.DateTime(t.dateStart,e.timeZone).toTimeZone("Local").toDate(),t.dateEnd=new Smart.Utilities.DateTime(t.dateEnd,e.timeZone).toTimeZone("Local").toDate()}))),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={},u={};if(l&&(u={dateStart:l.dateStart,dateEnd:l.dateEnd}),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}).defaultPrevented&&setTimeout((()=>{n.updateEvent(i.schedulerEventObj,u)})),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 h=n._handleEventFocus({type:"focusin",target:a});h&&h.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":default:return 1;case"halfHour":return 2;case"quarterHour":return 4;case"tenMinutes":return 6;case"fiveMinutes":return 12}}_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=n&&s||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=e.$.timelineCellsContainer,i=60/e._getCellsScaleCount(),r=t.toLowerCase().indexOf("month")>-1,a=n.querySelectorAll(".smart-scheduler-cell:not(.scale)");let l,o=[],s=e.currentTime||new Date;for(let e=0;e<a.length;e++){const t=a[e],n=new Date(t.$.cellObj.time);if(t.$&&s.getFullYear()===n.getFullYear()&&s.getMonth()===n.getMonth()&&s.getDate()===n.getDate()){if(!r&&n.getHours()!==s.getHours()||n.getMinutes()+i<s.getMinutes()||n.getMinutes()>s.getMinutes())continue;o.push(t)}}if(o.length){const e=o[0].$.cellObj,t=new Date(e.time),n=e.scaleIndex||0;let a,d;r?(d=60*s.getHours()+s.getMinutes(),a=1440):(d=s.getMinutes(),a=t.getMinutes()+i),l={cells:o,minutes:d,max:a,scaleIndex:n}}e._refreshCurrentTimeIndicator(l),e._refreshCurrentTimeShader(l)}_refreshCurrentTimeIndicatorHeader(){const e=this,t=e.currentTimeIndicator,n=e.timeZone,i=e.currentTime||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 i=a[e],r=u[e],d=i.closest(".smart-scheduler-cell-container");let h;t.rightToLeft?n.toLowerCase().indexOf("timeline")>-1?(h=parseFloat(d.style.width)/c*(s+1),r.style.width=i.style.width,r.style.height=i.style.height,r.style.right=parseFloat(d.style.right)+h*(l/o)+"px",r.style.top=i.style.top):(h=parseFloat(d.style.height)/c*(s+1),r.style.width=i.style.width,r.style.height=i.style.height,r.style.right=i.style.right,r.style.top=parseFloat(d.style.top)+h*(l/o)+"px"):n.toLowerCase().indexOf("timeline")>-1?(h=parseFloat(d.style.width)/c*(s+1),r.style.width=i.style.width,r.style.height=i.style.height,r.style.left=parseFloat(d.style.left)+h*(l/o)+"px",r.style.top=i.style.top):(h=parseFloat(d.style.height)/c*(s+1),r.style.width=i.style.width,r.style.height=i.style.height,r.style.left=i.style.left,r.style.top=parseFloat(d.style.top)+h*(l/o)+"px"),r.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];t.rightToLeft?(c.style.width=parseFloat(l.style.right)+parseFloat(l.style.width)-parseFloat(a.style.right)+"px",c.style.height=parseFloat(s.style.top)+parseFloat(s.style.height)-parseFloat(o.style.top)+"px",c.style.right=a.style.right,c.style.top=o.style.top):(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=n.rightToLeft?"right":"left",r=e.children,a=n.viewType,l=a.indexOf("month")>-1,o=n._getCellsScaleCount(),[s,d,c,u]=[t.cells,t.minutes,t.max,t.scaleIndex],h=s?s.length:1;n._recycleContainerCells({fragment:e,cellsNeeded:h,className:"smart-scheduler-shade"});for(let e=0;e<h;e++){const t=s[e],h=r[e],m=t.closest(".smart-scheduler-cell-container"),v=t.$.cellObj.horizontal,g=t.$.cellObj.vertical;let f;if(a.toLowerCase().indexOf("timeline")>-1){n._recycleContainerCells({fragment:h,cellsNeeded:1,className:"smart-scheduler-shade-section"});const e=h.children[0],r=n._getFirstShadeCell(v);f=parseFloat(m.style.width)/o*(u+1),e.style.width=parseFloat(m.style[i])-parseFloat(r.style[i])+f*(d/c)+"px",e.style.height=t.style.height,e.style[i]=r.style[i],e.style.top=t.style.top}else{n._recycleContainerCells({fragment:h,cellsNeeded:l?3:2,className:"smart-scheduler-shade-section"});const e=h.children[0],r=h.children[1],a=n._getFirstShadeCell(v),s=n._getFirstShadeCell(g,!0),p=n._getFirstShadeCell(g,!0,!0);if(f=parseFloat(m.style.height)/o*(u+1),e.style.top=s.style.top,e.style[i]=a.style[i],l){e.style.width=parseFloat(t.style[i])-parseFloat(a.style[i])+"px",e.style.height=parseFloat(m.style.top)-parseFloat(s.style.top)+parseFloat(m.style.height)+"px";const l=n._getFirstShadeCell(v,void 0,!0),o=h.children[2];r.style.width=parseFloat(l.style[i])+parseFloat(l.style.width)-parseFloat(a.style[i])-parseFloat(e.style.width)+"px",r.style.height=parseFloat(m.style.top)-parseFloat(s.style.top)+"px",r.style.top=s.style.top,r.style[i]=parseFloat(a.style[i])+parseFloat(e.style.width)+"px",o.style.top=parseFloat(r.style.top)+parseFloat(r.style.height)+"px",o.style[i]=r.style[i],o.style.width=t.style.width,o.style.height=f*(d/c)+"px"}else e.style.width=parseFloat(t.style[i])+parseFloat(t.style.width)-parseFloat(a.style[i])+"px",e.style.height=parseFloat(m.style.top)-parseFloat(s.style.top)+f*(d/c)+"px",r.style.top=parseFloat(e.style.top)+parseFloat(e.style.height)+"px",r.style[i]=a.style[i],r.style.width=parseFloat(t.style[i])-parseFloat(a.style[i])+"px",r.style.height=parseFloat(p.style.top)+parseFloat(p.style.height)-parseFloat(r.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=e.currentTime||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":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"}]}});
|
|
199
|
+
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"},currentTime:{value:null,type:"any",validator:"_dateValidator"},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":case"unfocusable":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":case"maxEventsPerCell":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(),i._refreshDateSelector();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":case"views":i._refreshViewSelector();break;case"timeZone":i._events.forEach((e=>i._setEventTimeZone(e,t))),i._createTimeline();break;case"timeZones":case"sortBy":case"sortOrder":case"sortFunction":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"undoRedoSteps":delete i._undoRedoHistory;break;case"view":i._handleViewSelection(),i._createTimeline(),i._refreshDateSelector(),i._scrollToView(),i.$.fireEvent("viewChange",{oldValue:t,value:n});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"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();if(0!==e.firstDayOfWeek&&t.indexOf("week")>-1&&e.dateCurrent&&e.dateCurrent.getDay()!==e.firstDayOfWeek){const t=e.dateCurrent.getDay()-e.firstDayOfWeek;e.dateCurrent=e.dateCurrent.setDate(e.dateCurrent.getDate()-e.dateCurrent.getDay()+e.firstDayOfWeek-(t>0?0:7))}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,e._rRule&&window.rrule.RRule.RRule&&(e._rRule=window.rrule.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;let t=e._events;return"local"!==e.timeZone&&(t=t.map((t=>e._cloneObject(t,!1))),t.forEach((t=>{t.dateStart=new Smart.Utilities.DateTime(t.dateStart,e.timeZone).toTimeZone("Local").toDate(),t.dateEnd=new Smart.Utilities.DateTime(t.dateEnd,e.timeZone).toTimeZone("Local").toDate()}))),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={},u={};if(l&&(u={dateStart:l.dateStart,dateEnd:l.dateEnd}),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}).defaultPrevented&&setTimeout((()=>{n.updateEvent(i.schedulerEventObj,u)})),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 h=n._handleEventFocus({type:"focusin",target:a});h&&h.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":default:return 1;case"halfHour":return 2;case"quarterHour":return 4;case"tenMinutes":return 6;case"fiveMinutes":return 12}}_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=n&&s||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=e.$.timelineCellsContainer,i=60/e._getCellsScaleCount(),r=t.toLowerCase().indexOf("month")>-1,a=n.querySelectorAll(".smart-scheduler-cell:not(.scale)");let l,o=[],s=e.currentTime||new Date;for(let e=0;e<a.length;e++){const t=a[e],n=new Date(t.$.cellObj.time);if(t.$&&s.getFullYear()===n.getFullYear()&&s.getMonth()===n.getMonth()&&s.getDate()===n.getDate()){if(!r&&n.getHours()!==s.getHours()||n.getMinutes()+i<s.getMinutes()||n.getMinutes()>s.getMinutes())continue;o.push(t)}}if(o.length){const e=o[0].$.cellObj,t=new Date(e.time),n=e.scaleIndex||0;let a,d;r?(d=60*s.getHours()+s.getMinutes(),a=1440):(d=s.getMinutes(),a=t.getMinutes()+i),l={cells:o,minutes:d,max:a,scaleIndex:n}}e._refreshCurrentTimeIndicator(l),e._refreshCurrentTimeShader(l)}_refreshCurrentTimeIndicatorHeader(){const e=this,t=e.currentTimeIndicator,n=e.timeZone,i=e.currentTime||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 i=a[e],r=u[e],d=i.closest(".smart-scheduler-cell-container");let h;t.rightToLeft?n.toLowerCase().indexOf("timeline")>-1?(h=parseFloat(d.style.width)/c*(s+1),r.style.width=i.style.width,r.style.height=i.style.height,r.style.right=parseFloat(d.style.right)+h*(l/o)+"px",r.style.top=i.style.top):(h=parseFloat(d.style.height)/c*(s+1),r.style.width=i.style.width,r.style.height=i.style.height,r.style.right=i.style.right,r.style.top=parseFloat(d.style.top)+h*(l/o)+"px"):n.toLowerCase().indexOf("timeline")>-1?(h=parseFloat(d.style.width)/c*(s+1),r.style.width=i.style.width,r.style.height=i.style.height,r.style.left=parseFloat(d.style.left)+h*(l/o)+"px",r.style.top=i.style.top):(h=parseFloat(d.style.height)/c*(s+1),r.style.width=i.style.width,r.style.height=i.style.height,r.style.left=i.style.left,r.style.top=parseFloat(d.style.top)+h*(l/o)+"px"),r.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];t.rightToLeft?(c.style.width=parseFloat(l.style.right)+parseFloat(l.style.width)-parseFloat(a.style.right)+"px",c.style.height=parseFloat(s.style.top)+parseFloat(s.style.height)-parseFloat(o.style.top)+"px",c.style.right=a.style.right,c.style.top=o.style.top):(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=n.rightToLeft?"right":"left",r=e.children,a=n.viewType,l=a.indexOf("month")>-1,o=n._getCellsScaleCount(),[s,d,c,u]=[t.cells,t.minutes,t.max,t.scaleIndex],h=s?s.length:1;n._recycleContainerCells({fragment:e,cellsNeeded:h,className:"smart-scheduler-shade"});for(let e=0;e<h;e++){const t=s[e],h=r[e],m=t.closest(".smart-scheduler-cell-container"),v=t.$.cellObj.horizontal,g=t.$.cellObj.vertical;let f;if(a.toLowerCase().indexOf("timeline")>-1){n._recycleContainerCells({fragment:h,cellsNeeded:1,className:"smart-scheduler-shade-section"});const e=h.children[0],r=n._getFirstShadeCell(v);f=parseFloat(m.style.width)/o*(u+1),e.style.width=parseFloat(m.style[i])-parseFloat(r.style[i])+f*(d/c)+"px",e.style.height=t.style.height,e.style[i]=r.style[i],e.style.top=t.style.top}else{n._recycleContainerCells({fragment:h,cellsNeeded:l?3:2,className:"smart-scheduler-shade-section"});const e=h.children[0],r=h.children[1],a=n._getFirstShadeCell(v),s=n._getFirstShadeCell(g,!0),p=n._getFirstShadeCell(g,!0,!0);if(f=parseFloat(m.style.height)/o*(u+1),e.style.top=s.style.top,e.style[i]=a.style[i],l){e.style.width=parseFloat(t.style[i])-parseFloat(a.style[i])+"px",e.style.height=parseFloat(m.style.top)-parseFloat(s.style.top)+parseFloat(m.style.height)+"px";const l=n._getFirstShadeCell(v,void 0,!0),o=h.children[2];r.style.width=parseFloat(l.style[i])+parseFloat(l.style.width)-parseFloat(a.style[i])-parseFloat(e.style.width)+"px",r.style.height=parseFloat(m.style.top)-parseFloat(s.style.top)+"px",r.style.top=s.style.top,r.style[i]=parseFloat(a.style[i])+parseFloat(e.style.width)+"px",o.style.top=parseFloat(r.style.top)+parseFloat(r.style.height)+"px",o.style[i]=r.style[i],o.style.width=t.style.width,o.style.height=f*(d/c)+"px"}else e.style.width=parseFloat(t.style[i])+parseFloat(t.style.width)-parseFloat(a.style[i])+"px",e.style.height=parseFloat(m.style.top)-parseFloat(s.style.top)+f*(d/c)+"px",r.style.top=parseFloat(e.style.top)+parseFloat(e.style.height)+"px",r.style[i]=a.style[i],r.style.width=parseFloat(t.style[i])-parseFloat(a.style[i])+"px",r.style.height=parseFloat(p.style.top)+parseFloat(p.style.height)-parseFloat(r.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=e.currentTime||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":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"}]}});
|
|
200
200
|
|
|
201
201
|
/***/ }),
|
|
202
202
|
|
|
@@ -379,7 +379,7 @@ var __webpack_exports__ = {};
|
|
|
379
379
|
/* harmony import */ var _scripts_rrule_min_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(5453);
|
|
380
380
|
/* harmony import */ var _scripts_rrule_min_js__WEBPACK_IMPORTED_MODULE_29___default = /*#__PURE__*/__webpack_require__.n(_scripts_rrule_min_js__WEBPACK_IMPORTED_MODULE_29__);
|
|
381
381
|
|
|
382
|
-
/* Smart UI v17.0.
|
|
382
|
+
/* Smart UI v17.0.17 (2023-11-08)
|
|
383
383
|
Copyright (c) 2011-2023 jQWidgets.
|
|
384
384
|
License: https://htmlelements.com/license/ */ //
|
|
385
385
|
|