UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

1,878 lines • 84 kB
/**
 * DevExtreme (esm/__internal/scheduler/scheduler.js)
 * Version: 26.1.6
 * Build date: Fri Oct 16 2026
 *
 * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
import {
    triggerResizeEvent
} from "../../common/core/events/visibility_change";
import dateLocalization from "../../common/core/localization/date";
import messageLocalization from "../../common/core/localization/message";
import registerComponent from "../../core/component_registrator";
import config from "../../core/config";
import {
    getPublicElement
} from "../../core/element";
import $ from "../../core/renderer";
import {
    BindableTemplate
} from "../../core/templates/bindable_template";
import {
    EmptyTemplate
} from "../../core/templates/empty_template";
import Callbacks from "../../core/utils/callbacks";
import {
    noop
} from "../../core/utils/common";
import {
    compileGetter
} from "../../core/utils/data";
import dateUtils from "../../core/utils/date";
import dateSerialization from "../../core/utils/date_serialization";
import {
    Deferred,
    fromPromise,
    when
} from "../../core/utils/deferred";
import {
    extend
} from "../../core/utils/extend";
import {
    getBoundingRect
} from "../../core/utils/position";
import {
    isDeferred,
    isDefined,
    isEmptyObject,
    isFunction,
    isObject,
    isPromise
} from "../../core/utils/type";
import {
    hasWindow
} from "../../core/utils/window";
import DataHelperMixin from "../../data_helper";
import {
    custom as customDialog
} from "../../ui/dialog";
import errors from "../../ui/widget/ui.errors";
import {
    dateUtilsTs
} from "../core/utils/date";
import {
    tabbable
} from "../core/utils/selectors";
import {
    focus
} from "../events/short";
import {
    createA11yStatusContainer
} from "./a11y_status/a11y_status_render";
import {
    getA11yStatusText
} from "./a11y_status/a11y_status_text";
import {
    AppointmentForm
} from "./appointment_popup/form";
import {
    AppointmentPopup
} from "./appointment_popup/popup";
import AppointmentCollection from "./appointments/m_appointment_collection";
import NotifyScheduler from "./base/widget_notify_scheduler";
import {
    SchedulerHeader
} from "./header/header";
import {
    hide as hideLoading,
    show as showLoading
} from "./loading";
import {
    CompactAppointmentsHelper
} from "./m_compact_appointments_helper";
import subscribes from "./m_subscribes";
import {
    combineRemoteFilter
} from "./r1/filterting/remote";
import {
    createTimeZoneCalculator
} from "./r1/timezone_calculator/index";
import {
    excludeFromRecurrence,
    getToday,
    isAppointmentTakesAllDay,
    isDateAndTimeView,
    isTimelineView
} from "./r1/utils/index";
import {
    validateRRule
} from "./recurrence/validate_rule";
import {
    SchedulerOptionsBaseWidget
} from "./scheduler_options_base_widget";
import {
    DesktopTooltipStrategy
} from "./tooltip_strategies/desktop_tooltip_strategy";
import {
    MobileTooltipStrategy
} from "./tooltip_strategies/mobile_tooltip_strategy";
import {
    AppointmentAdapter
} from "./utils/appointment_adapter/appointment_adapter";
import {
    AppointmentDataAccessor
} from "./utils/data_accessor/appointment_data_accessor";
import {
    getTargetedAppointment
} from "./utils/get_targeted_appointment";
import {
    macroTaskArray
} from "./utils/index";
import {
    isAgendaWorkspaceComponent
} from "./utils/is_agenda_workpace_component";
import {
    VIEWS
} from "./utils/options/constants_view";
import {
    getAppointmentGroupValues,
    setAppointmentGroupValues
} from "./utils/resource_manager/appointment_groups_utils";
import {
    ResourceManager
} from "./utils/resource_manager/resource_manager";
import timeZoneUtils from "./utils_time_zone";
import AppointmentLayoutManager from "./view_model/appointments_layout_manager";
import {
    AppointmentDataSource
} from "./view_model/m_appointment_data_source";
import SchedulerAgenda from "./workspaces/agenda";
import SchedulerTimelineDay from "./workspaces/timeline_day";
import SchedulerTimelineMonth from "./workspaces/timeline_month";
import SchedulerTimelineWeek from "./workspaces/timeline_week";
import SchedulerWorkSpaceDay from "./workspaces/work_space_day";
import SchedulerWorkSpaceMonth from "./workspaces/work_space_month";
import SchedulerWorkSpaceWeek from "./workspaces/work_space_week";
const toMs = dateUtils.dateToMilliseconds;
const WIDGET_CLASS = "dx-scheduler";
const WIDGET_SMALL_CLASS = `${WIDGET_CLASS}-small`;
const WIDGET_ADAPTIVE_CLASS = `${WIDGET_CLASS}-adaptive`;
const WIDGET_READONLY_CLASS = `${WIDGET_CLASS}-readonly`;
export const POPUP_DIALOG_CLASS = "dx-dialog";
const WIDGET_SMALL_WIDTH = 400;
const FULL_DATE_FORMAT = "yyyyMMddTHHmmss";
const UTC_FULL_DATE_FORMAT = `${FULL_DATE_FORMAT}Z`;
const VIEWS_CONFIG = {
    day: {
        workSpace: SchedulerWorkSpaceDay,
        renderingStrategy: "vertical"
    },
    week: {
        workSpace: SchedulerWorkSpaceWeek,
        renderingStrategy: "vertical"
    },
    workWeek: {
        workSpace: SchedulerWorkSpaceWeek,
        renderingStrategy: "vertical"
    },
    month: {
        workSpace: SchedulerWorkSpaceMonth,
        renderingStrategy: "horizontalMonth"
    },
    timelineDay: {
        workSpace: SchedulerTimelineDay,
        renderingStrategy: "horizontal"
    },
    timelineWeek: {
        workSpace: SchedulerTimelineWeek,
        renderingStrategy: "horizontal"
    },
    timelineWorkWeek: {
        workSpace: SchedulerTimelineWeek,
        renderingStrategy: "horizontal"
    },
    timelineMonth: {
        workSpace: SchedulerTimelineMonth,
        renderingStrategy: "horizontalMonthLine"
    },
    agenda: {
        workSpace: SchedulerAgenda,
        renderingStrategy: "agenda"
    }
};
const StoreEventNames = {
    ADDING: "onAppointmentAdding",
    ADDED: "onAppointmentAdded",
    DELETING: "onAppointmentDeleting",
    DELETED: "onAppointmentDeleted",
    UPDATING: "onAppointmentUpdating",
    UPDATED: "onAppointmentUpdated"
};
const RECURRENCE_EDITING_MODE = {
    SERIES: "editSeries",
    OCCURRENCE: "editOccurrence",
    CANCEL: "cancel"
};
class Scheduler extends SchedulerOptionsBaseWidget {
    constructor() {
        super(...arguments);
        this.timeZoneCalculatorInstance = null;
        this.asyncTemplatesTimers = [];
        this.updatingAppointments = new Set;
        this.subscribes = subscribes
    }
    get timeZoneCalculator() {
        if (!this.timeZoneCalculatorInstance) {
            this.timeZoneCalculatorInstance = createTimeZoneCalculator(this.option("timeZone"))
        }
        return this.timeZoneCalculatorInstance
    }
    postponeDataSourceLoading(promise) {
        this.postponedOperations.add("_reloadDataSource", this.reloadDataSource.bind(this), promise)
    }
    postponeResourceLoading() {
        let forceReload = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : false;
        const whenLoaded = this.postponedOperations.add("loadResources", () => {
            const groups = this.getViewOption("groups");
            return fromPromise(this.resourceManager.loadGroupResources(groups, forceReload))
        }, void 0);
        const resolveCallbacks = Deferred();
        whenLoaded.done(() => {
            resolveCallbacks.resolve()
        });
        this.postponeDataSourceLoading(whenLoaded);
        return resolveCallbacks
    }
    _optionChanged(args) {
        var _this$resourceManager;
        this.schedulerOptionChanged(args);
        const {
            value: value,
            name: name
        } = args;
        switch (args.name) {
            case "customizeDateNavigatorText":
                this.updateOption("header", name, value);
                break;
            case "firstDayOfWeek":
                this.updateOption("workSpace", name, value);
                this.updateOption("header", name, value);
                this.updateOption("header", "startViewDate", this.getStartViewDate());
                this.createAppointmentPopupForm();
                break;
            case "currentDate": {
                const dateValue = this.getViewOption("currentDate");
                this.option("selectedCellData", []);
                this.updateOption("workSpace", name, dateValue);
                this.updateOption("header", name, dateValue);
                this.updateOption("header", "startViewDate", this.getStartViewDate());
                this._appointments.option("items", []);
                this.setRemoteFilterIfNeeded();
                this.postponeDataSourceLoading();
                break
            }
            case "dataSource":
                this._initDataSource();
                this.postponeResourceLoading().done(() => {
                    if (this._dataSource) {
                        if (this.appointmentDataSource) {
                            this.appointmentDataSource.setDataSource(this._dataSource)
                        } else {
                            this.createAppointmentDataSource()
                        }
                    }
                    this.setRemoteFilterIfNeeded();
                    this.updateOption("workSpace", "showAllDayPanel", this.option("showAllDayPanel"))
                });
                break;
            case "min":
            case "max": {
                const viewValue = "min" === args.name ? this.getViewOption("min") : this.getViewOption("max");
                this.updateOption("header", args.name, viewValue);
                this.updateOption("workSpace", args.name, viewValue);
                break
            }
            case "views":
                if (this.currentView) {
                    this.repaint()
                } else {
                    this.updateOption("header", "views", this.views)
                }
                break;
            case "hiddenWeekDays":
                this.repaint();
                break;
            case "useDropDownViewSwitcher":
                this.updateOption("header", name, value);
                break;
            case "currentView":
                this._appointments.option({
                    items: [],
                    allowDrag: this.allowDragging(),
                    allowResize: this.allowResizing(),
                    itemTemplate: this.getAppointmentTemplate("appointmentTemplate")
                });
                this.postponeResourceLoading().done(() => {
                    var _this$header;
                    this.refreshWorkSpace();
                    null === (_this$header = this.header) || void 0 === _this$header || _this$header.option(this.headerConfig());
                    this.setRemoteFilterIfNeeded();
                    this._appointments.option("allowAllDayResize", "day" !== value)
                });
                this.postponedOperations.callPostponedOperations();
                break;
            case "appointmentTemplate":
                this._appointments.option("itemTemplate", value);
                break;
            case "dateCellTemplate":
            case "resourceCellTemplate":
            case "dataCellTemplate":
            case "timeCellTemplate":
                this.repaint();
                break;
            case "groups":
                this.postponeResourceLoading().done(() => {
                    this.refreshWorkSpace();
                    this.setRemoteFilterIfNeeded()
                });
                break;
            case "resources":
                null === (_this$resourceManager = this.resourceManager) || void 0 === _this$resourceManager || _this$resourceManager.dispose();
                this.resourceManager = new ResourceManager(this.option("resources"));
                this.updateAppointmentDataSource();
                this.createAppointmentPopupForm();
                this.postponeResourceLoading().done(() => {
                    this._appointments.option("items", []);
                    this.refreshWorkSpace();
                    this.setRemoteFilterIfNeeded()
                });
                break;
            case "startDayHour":
            case "endDayHour":
                this.updateAppointmentDataSource();
                this._appointments.option("items", []);
                this.updateOption("workSpace", name, value);
                this._appointments.repaint();
                this.setRemoteFilterIfNeeded();
                this.postponeDataSourceLoading();
                this.createAppointmentPopupForm();
                break;
            case "offset":
                this.updateAppointmentDataSource();
                this._appointments.option("items", []);
                this.updateOption("workSpace", "viewOffset", this.normalizeViewOffsetValue(value));
                this._appointments.repaint();
                this.setRemoteFilterIfNeeded();
                this.postponeDataSourceLoading();
                break;
            case StoreEventNames.ADDING:
            case StoreEventNames.ADDED:
            case StoreEventNames.UPDATING:
            case StoreEventNames.UPDATED:
            case StoreEventNames.DELETING:
            case StoreEventNames.DELETED:
            case "onAppointmentFormOpening":
            case "onAppointmentTooltipShowing":
            case "onSelectionEnd": {
                const schedulerAction = this.createSchedulerAction(name);
                this.actions[name] = schedulerAction;
                break
            }
            case "onAppointmentRendered":
                this._appointments.option("onItemRendered", this.getAppointmentRenderedAction());
                break;
            case "onAppointmentClick":
                this._appointments.option("onItemClick", this._createActionByOption("onAppointmentClick"));
                break;
            case "onAppointmentDblClick":
                this._appointments.option("onAppointmentDblClick", this._createActionByOption("onAppointmentDblClick"));
                break;
            case "onAppointmentContextMenu":
                this._appointments.option("onItemContextMenu", this._createActionByOption("onAppointmentContextMenu"));
                this.appointmentTooltip._options.onItemContextMenu = this._createActionByOption("onAppointmentContextMenu");
                break;
            case "noDataText":
            case "allowMultipleCellSelection":
            case "selectedCellData":
            case "accessKey":
            case "onCellClick":
            case "onCellContextMenu":
                this.updateOption("workSpace", name, value);
                break;
            case "crossScrollingEnabled":
                this.postponeResourceLoading().done(() => {
                    this._appointments.option("items", []);
                    this.refreshWorkSpace();
                    if (this.readyToRenderAppointments) {
                        this._appointments.option("items", this._layoutManager.generateViewModel())
                    }
                });
                break;
            case "cellDuration":
                this.updateOption("workSpace", name, value);
                this._appointments.option("items", []);
                if (this.readyToRenderAppointments) {
                    this.updateOption("workSpace", "hoursInterval", value / 60);
                    this._appointments.option("items", this._layoutManager.generateViewModel())
                }
                break;
            case "snapToCellsMode":
                this._appointments.option("items", []);
                if (this.readyToRenderAppointments) {
                    this._appointments.option("items", this._layoutManager.generateViewModel())
                }
                break;
            case "tabIndex":
            case "focusStateEnabled":
                this.updateOption("header", name, value);
                this.updateOption("workSpace", name, value);
                this._appointments.option(name, value);
                super._optionChanged(args);
                break;
            case "width":
                this.updateOption("header", name, value);
                if (this.option("crossScrollingEnabled")) {
                    this.updateOption("workSpace", "width", value)
                }
                this.updateOption("workSpace", "schedulerWidth", value);
                super._optionChanged(args);
                this._dimensionChanged(null, true);
                break;
            case "height":
                super._optionChanged(args);
                this._dimensionChanged(null, true);
                this.updateOption("workSpace", "schedulerHeight", value);
                break;
            case "editing": {
                this.initEditing();
                const {
                    editing: editing
                } = this;
                this.bringEditingModeToAppointments(editing);
                this.hideAppointmentTooltip();
                this.createAppointmentPopupForm();
                break
            }
            case "showAllDayPanel":
                this.updateAppointmentDataSource();
                this.repaint();
                break;
            case "showCurrentTimeIndicator":
            case "indicatorUpdateInterval":
            case "shadeUntilCurrentTime":
            case "groupByDate":
                this.updateOption("workSpace", name, value);
                this.repaint();
                break;
            case "skippedDays":
                break;
            case "indicatorTime":
                this.updateOption("workSpace", name, value);
                this.updateOption("header", name, value);
                this.repaint();
                break;
            case "appointmentDragging":
            case "appointmentTooltipTemplate":
            case "appointmentPopupTemplate":
            case "recurrenceEditMode":
            case "remoteFiltering":
            case "timeZone":
                this.updateAppointmentDataSource();
                this.repaint();
                break;
            case "appointmentCollectorTemplate":
            case "_appointmentTooltipOffset":
                this.repaint();
                break;
            case "dateSerializationFormat":
                break;
            case "maxAppointmentsPerCell":
                this.repaint();
                break;
            case "startDateExpr":
            case "endDateExpr":
            case "startDateTimeZoneExpr":
            case "endDateTimeZoneExpr":
            case "textExpr":
            case "descriptionExpr":
            case "allDayExpr":
            case "recurrenceRuleExpr":
            case "recurrenceExceptionExpr":
            case "disabledExpr":
            case "visibleExpr":
                this.updateExpression(name, value);
                this.initAppointmentTemplate();
                this.repaint();
                break;
            case "adaptivityEnabled":
                this.toggleAdaptiveClass();
                this.repaint();
                break;
            case "scrolling":
                this.option("crossScrollingEnabled", this.isHorizontalVirtualScrolling() || this.option("crossScrollingEnabled"));
                this.updateOption("workSpace", args.fullName, value);
                break;
            case "allDayPanelMode":
                this.updateAppointmentDataSource();
                this.updateOption("workSpace", args.fullName, value);
                break;
            case "_draggingMode":
                this.updateOption("workSpace", "draggingMode", value);
                break;
            case "toolbar":
                if (this.header) {
                    this.header.onToolbarOptionChanged(args.fullName, value)
                } else {
                    this.repaint()
                }
                break;
            default:
                super._optionChanged(args)
        }
    }
    bringEditingModeToAppointments(editing) {
        const editingConfig = {
            allowDelete: editing.allowUpdating && editing.allowDeleting
        };
        if (!this.isAgenda()) {
            editingConfig.allowDrag = editing.allowDragging;
            editingConfig.allowResize = editing.allowResizing;
            editingConfig.allowAllDayResize = editing.allowResizing && this.supportAllDayResizing()
        }
        this._appointments.option(editingConfig);
        this.repaint()
    }
    isAgenda() {
        return "agenda" === this.currentView.type
    }
    allowDragging() {
        return this.editing.allowDragging && !this.isAgenda()
    }
    canDragAppointment(appointmentData) {
        return this.allowDragging() && !this._isAppointmentBeingUpdated(appointmentData)
    }
    allowResizing() {
        return this.editing.allowResizing && !this.isAgenda()
    }
    allowAllDayResizing() {
        return this.editing.allowResizing && this.supportAllDayResizing()
    }
    supportAllDayResizing() {
        return "day" !== this.currentView.type || this.currentView.intervalCount > 1
    }
    isAllDayExpanded() {
        return this.option("showAllDayPanel") && this._layoutManager.hasAllDayAppointments()
    }
    setRemoteFilterIfNeeded() {
        const dataSource = this._dataSource;
        const remoteFiltering = this.option("remoteFiltering");
        if (!this._workSpace || !remoteFiltering || !dataSource) {
            return
        }
        const dateRange = this._workSpace.getDateRange();
        const startDate = this.timeZoneCalculator.createDate(dateRange[0], "fromGrid");
        const endDate = this.timeZoneCalculator.createDate(dateRange[1], "fromGrid");
        const dateSerializationFormat = this.option("dateSerializationFormat");
        const dataSourceFilter = dataSource.filter();
        const filter = combineRemoteFilter({
            dataSourceFilter: dataSourceFilter,
            dataAccessors: this._dataAccessors,
            min: startDate,
            max: endDate,
            dateSerializationFormat: dateSerializationFormat,
            forceIsoDateParsing: config().forceIsoDateParsing
        });
        dataSource.filter(filter)
    }
    reloadDataSource() {
        const result = Deferred();
        if (this._dataSource) {
            when(fromPromise(this._dataSource.load())).done(() => {
                hideLoading().catch(noop);
                this._fireContentReadyAction(result)
            }).fail(() => {
                hideLoading().catch(noop);
                result.reject()
            });
            if (this._dataSource.isLoading()) {
                showLoading({
                    container: this.$element().get(0),
                    position: {
                        of: this.$element()
                    }
                }).catch(noop)
            }
        } else {
            this._fireContentReadyAction(result)
        }
        return result.promise()
    }
    _fireContentReadyAction(result) {
        const contentReadyBase = super._fireContentReadyAction.bind(this);
        const fireContentReady = () => {
            contentReadyBase();
            null === result || void 0 === result || result.resolve()
        };
        if (isDeferred(this.workSpaceRecalculation)) {
            this.workSpaceRecalculation.done(() => {
                fireContentReady()
            })
        } else {
            fireContentReady()
        }
    }
    _dimensionChanged(value) {
        let isForce = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : false;
        const isFixedHeight = "number" === typeof this.option("height");
        const isFixedWidth = "number" === typeof this.option("width");
        if (!this._isVisible()) {
            return
        }
        this.toggleSmallClass();
        const workspace = this.getWorkSpace();
        if (!this.isAgenda() && this._layoutManager && workspace && !isAgendaWorkspaceComponent(workspace)) {
            if (isForce || !isFixedHeight || !isFixedWidth) {
                workspace.option("allDayExpanded", this.isAllDayExpanded());
                workspace._dimensionChanged();
                const appointments = this._layoutManager.generateViewModel();
                this._appointments.option("items", appointments)
            }
        }
        this.hideAppointmentTooltip();
        this.appointmentPopup.triggerResize();
        this.appointmentPopup.updatePopupFullScreenMode()
    }
    _clean() {
        this.cleanPopup();
        super._clean()
    }
    toggleSmallClass() {
        const element = this.$element().get(0);
        const {
            width: width
        } = getBoundingRect(element);
        this.$element().toggleClass(WIDGET_SMALL_CLASS, width < 400)
    }
    toggleAdaptiveClass() {
        this.$element().toggleClass(WIDGET_ADAPTIVE_CLASS, this.option("adaptivityEnabled"))
    }
    _visibilityChanged(visible) {
        if (visible) {
            this._dimensionChanged(null, true)
        }
    }
    _dataSourceOptions() {
        return {
            paginate: false
        }
    }
    initAllDayPanel() {
        if ("hidden" === this.option("allDayPanelMode")) {
            this.option("showAllDayPanel", false)
        }
    }
    _init() {
        this.timeZonesPromise = timeZoneUtils.cacheTimeZones();
        this.initExpressions({
            startDateExpr: this.option("startDateExpr"),
            endDateExpr: this.option("endDateExpr"),
            startDateTimeZoneExpr: this.option("startDateTimeZoneExpr"),
            endDateTimeZoneExpr: this.option("endDateTimeZoneExpr"),
            allDayExpr: this.option("allDayExpr"),
            textExpr: this.option("textExpr"),
            descriptionExpr: this.option("descriptionExpr"),
            recurrenceRuleExpr: this.option("recurrenceRuleExpr"),
            recurrenceExceptionExpr: this.option("recurrenceExceptionExpr"),
            disabledExpr: this.option("disabledExpr"),
            visibleExpr: this.option("visibleExpr")
        });
        super._init();
        this.initAllDayPanel();
        this._initDataSource();
        this.customizeDataSourceLoadOptions();
        this.$element().addClass(WIDGET_CLASS);
        this.initEditing();
        this.updateAppointmentDataSource();
        this.initActions();
        this._compactAppointmentsHelper = new CompactAppointmentsHelper(this);
        this.asyncTemplatesTimers = [];
        this.dataSourceLoadedCallback = Callbacks();
        this.subscribes = subscribes;
        this.resourceManager = new ResourceManager(this.option("resources"));
        this.notifyScheduler = new NotifyScheduler({
            scheduler: this
        })
    }
    createAppointmentDataSource() {
        var _this$appointmentData;
        null === (_this$appointmentData = this.appointmentDataSource) || void 0 === _this$appointmentData || _this$appointmentData.destroy();
        if (!this._dataSource) {
            return
        }
        this.appointmentDataSource = new AppointmentDataSource(this._dataSource)
    }
    updateAppointmentDataSource() {
        this.timeZoneCalculatorInstance = null;
        if (this.getWorkSpace()) {
            this.createAppointmentDataSource()
        }
    }
    customizeDataSourceLoadOptions() {
        var _this$_dataSource;
        null === (_this$_dataSource = this._dataSource) || void 0 === _this$_dataSource || _this$_dataSource.on("customizeStoreLoadOptions", _ref => {
            let {
                storeLoadOptions: storeLoadOptions
            } = _ref;
            storeLoadOptions.startDate = this.getStartViewDate();
            storeLoadOptions.endDate = this.getEndViewDate()
        })
    }
    _initTemplates() {
        this.initAppointmentTemplate();
        this._templateManager.addDefaultTemplates({
            appointmentTooltip: new EmptyTemplate,
            dropDownAppointment: new EmptyTemplate
        });
        super._initTemplates()
    }
    initAppointmentTemplate() {
        const {
            expr: expr
        } = this._dataAccessors;
        const createGetter = property => compileGetter(`appointmentData.${property}`);
        const getDate = getter => data => {
            const value = getter(data);
            if (value instanceof Date) {
                return value.valueOf()
            }
            return value
        };
        this._templateManager.addDefaultTemplates({
            item: new BindableTemplate(($container, data, model) => this.getAppointmentsInstance()._renderAppointmentTemplate($container, data, model), ["html", "text", "startDate", "endDate", "allDay", "description", "recurrenceRule", "recurrenceException", "startDateTimeZone", "endDateTimeZone"], this.option("integrationOptions.watchMethod"), {
                text: createGetter(expr.textExpr),
                startDate: getDate(createGetter(expr.startDateExpr)),
                endDate: getDate(createGetter(expr.endDateExpr)),
                startDateTimeZone: createGetter(expr.startDateTimeZoneExpr),
                endDateTimeZone: createGetter(expr.endDateTimeZoneExpr),
                allDay: createGetter(expr.allDayExpr),
                recurrenceRule: createGetter(expr.recurrenceRuleExpr)
            })
        })
    }
    _renderContent() {
        this._renderContentImpl()
    }
    _dataSourceChangedHandler(result) {
        if (this.readyToRenderAppointments) {
            this.workSpaceRecalculation.done(() => {
                this._layoutManager.prepareAppointments(result);
                this.renderAppointments();
                this.updateA11yStatus()
            })
        }
    }
    isVirtualScrolling() {
        const workspace = this.getWorkSpace();
        if (workspace) {
            return workspace.isVirtualScrolling()
        }
        const scrolling = this.getViewOption("scrolling");
        return "virtual" === (null === scrolling || void 0 === scrolling ? void 0 : scrolling.mode)
    }
    renderAppointments() {
        var _this$appointmentData2;
        const workspace = this.getWorkSpace();
        this._layoutManager.filterAppointments();
        null === workspace || void 0 === workspace || workspace.option("allDayExpanded", this.isAllDayExpanded());
        const viewModel = this._isVisible() ? this._layoutManager.generateViewModel() : [];
        this._appointments.option("items", viewModel);
        null === (_this$appointmentData2 = this.appointmentDataSource) || void 0 === _this$appointmentData2 || _this$appointmentData2.cleanState();
        if (this.isAgenda()) {
            var _this$_workSpace$rend, _this$_workSpace;
            null === (_this$_workSpace$rend = (_this$_workSpace = this._workSpace).renderAgendaLayout) || void 0 === _this$_workSpace$rend || _this$_workSpace$rend.call(_this$_workSpace, viewModel)
        }
    }
    initExpressions(fields) {
        this._dataAccessors = new AppointmentDataAccessor(fields, Boolean(config().forceIsoDateParsing), this.option("dateSerializationFormat"))
    }
    updateExpression(name, value) {
        this._dataAccessors.updateExpression(name, value)
    }
    initEditing() {
        const editing = this.option("editing");
        this.editing = {
            allowAdding: Boolean(editing),
            allowUpdating: Boolean(editing),
            allowDeleting: Boolean(editing),
            allowResizing: Boolean(editing),
            allowDragging: Boolean(editing)
        };
        if (isObject(editing)) {
            this.editing = extend(this.editing, editing)
        }
        this.editing.allowDragging = this.editing.allowDragging && this.editing.allowUpdating;
        this.editing.allowResizing = this.editing.allowResizing && this.editing.allowUpdating;
        const isReadOnly = Object.values(Object.assign({}, this.editing, {
            form: void 0,
            popup: void 0
        })).every(value => !value);
        this.$element().toggleClass(WIDGET_READONLY_CLASS, isReadOnly)
    }
    _dispose() {
        var _this$resourceManager2, _this$appointmentTool, _this$recurrenceDialo;
        null === (_this$resourceManager2 = this.resourceManager) || void 0 === _this$resourceManager2 || _this$resourceManager2.dispose();
        null === (_this$appointmentTool = this.appointmentTooltip) || void 0 === _this$appointmentTool || _this$appointmentTool.dispose();
        null === (_this$recurrenceDialo = this.recurrenceDialog) || void 0 === _this$recurrenceDialo || _this$recurrenceDialo.hide(RECURRENCE_EDITING_MODE.CANCEL);
        this.hideAppointmentPopup();
        this.hideAppointmentTooltip();
        this.asyncTemplatesTimers.forEach(clearTimeout);
        this.asyncTemplatesTimers = [];
        macroTaskArray.dispose();
        super._dispose()
    }
    createSchedulerAction(optionName, actionConfig) {
        return this._createActionByOption(optionName, actionConfig)
    }
    initActions() {
        this.actions = {
            onAppointmentAdding: this.createSchedulerAction(StoreEventNames.ADDING),
            onAppointmentAdded: this.createSchedulerAction(StoreEventNames.ADDED),
            onAppointmentUpdating: this.createSchedulerAction(StoreEventNames.UPDATING),
            onAppointmentUpdated: this.createSchedulerAction(StoreEventNames.UPDATED),
            onAppointmentDeleting: this.createSchedulerAction(StoreEventNames.DELETING),
            onAppointmentDeleted: this.createSchedulerAction(StoreEventNames.DELETED),
            onAppointmentFormOpening: this.createSchedulerAction("onAppointmentFormOpening"),
            onAppointmentTooltipShowing: this.createSchedulerAction("onAppointmentTooltipShowing"),
            onSelectionEnd: this.createSchedulerAction("onSelectionEnd"),
            onAppointmentRendered: this.createSchedulerAction("onAppointmentRendered"),
            onAppointmentClick: this.createSchedulerAction("onAppointmentClick"),
            onAppointmentDblClick: this.createSchedulerAction("onAppointmentDblClick"),
            onAppointmentContextMenu: this.createSchedulerAction("onAppointmentContextMenu")
        }
    }
    getAppointmentRenderedAction() {
        return this.createSchedulerAction("onAppointmentRendered", {
            excludeValidators: ["disabled", "readOnly"]
        })
    }
    _renderFocusTarget() {
        return noop()
    }
    updateA11yStatus() {
        const dateRange = this._workSpace.getDateRange();
        const indicatorTime = this.option("showCurrentTimeIndicator") ? getToday(this.option("indicatorTime"), this.timeZoneCalculator) : void 0;
        const label = getA11yStatusText(this.currentView, dateRange[0], dateRange[1], this._layoutManager.filteredItems.length, indicatorTime);
        this.setAria({
            label: label
        });
        this.a11yStatus.text(label)
    }
    renderA11yStatus() {
        this.a11yStatus = createA11yStatusContainer();
        this.a11yStatus.prependTo(this.$element());
        this.setAria({
            role: "application"
        })
    }
    initMarkupOnResourceLoaded() {
        if (!this._disposed) {
            this.initMarkupCore();
            this.reloadDataSource().catch(noop)
        }
    }
    _initMarkup() {
        super._initMarkup();
        this.renderA11yStatus();
        this.renderMainContainer();
        this.renderHeader();
        this.toggleAdaptiveClass();
        this._layoutManager = new AppointmentLayoutManager(this);
        this.appointmentTooltip = new(this.option("adaptivityEnabled") ? MobileTooltipStrategy : DesktopTooltipStrategy)(this.getAppointmentTooltipOptions());
        this._appointments = this._createComponent("<div>", AppointmentCollection, this.appointmentsConfig());
        this._appointments.option("itemTemplate", this.getAppointmentTemplate("appointmentTemplate"));
        this.createAppointmentPopupForm();
        if (this.isDataSourceLoaded() || this._isDataSourceLoading()) {
            var _this$_dataSource2;
            this.initMarkupCore();
            this._dataSourceChangedHandler((null === (_this$_dataSource2 = this._dataSource) || void 0 === _this$_dataSource2 ? void 0 : _this$_dataSource2.items()) ?? []);
            this._fireContentReadyAction()
        } else {
            const groups = this.getViewOption("groups");
            if (null !== groups && void 0 !== groups && groups.length) {
                this.resourceManager.loadGroupResources(groups, true).then(() => this.initMarkupOnResourceLoaded()).catch(noop)
            } else {
                this.initMarkupOnResourceLoaded()
            }
        }
    }
    createAppointmentPopupForm() {
        var _this$appointmentPopu;
        if (this.appointmentForm) {
            this.appointmentForm.dispose()
        }
        this.appointmentForm = this.createAppointmentForm();
        null === (_this$appointmentPopu = this.appointmentPopup) || void 0 === _this$appointmentPopu || _this$appointmentPopu.dispose();
        this.appointmentPopup = this.createAppointmentPopup(this.appointmentForm)
    }
    renderMainContainer() {
        this.mainContainer = $("<div>").addClass("dx-scheduler-container");
        this.$draggableContainer = $("<div>").addClass("dx-scheduler-draggable-container").appendTo(this.mainContainer);
        this.$element().append(this.mainContainer)
    }
    createAppointmentForm() {
        const appointmentFormConfig = {
            dataAccessors: this._dataAccessors,
            editing: this.editing,
            resourceManager: this.resourceManager,
            firstDayOfWeek: this.getFirstDayOfWeek(),
            startDayHour: this.option("startDayHour") ?? 0,
            createComponent: this._createComponent.bind(this),
            getCalculatedEndDate: startDateWithStartHour => this._workSpace.calculateEndDate(startDateWithStartHour)
        };
        return new AppointmentForm(appointmentFormConfig)
    }
    createAppointmentPopup(form) {
        const scheduler = {
            getElement: () => this.$element(),
            createComponent: this._createComponent.bind(this),
            focus: () => {
                this.focus()
            },
            getResourceManager: () => this.resourceManager,
            getEditingConfig: () => this.editing,
            getTimeZoneCalculator: () => this.timeZoneCalculator,
            getDataAccessors: () => this._dataAccessors,
            getAppointmentFormOpening: () => this.actions.onAppointmentFormOpening,
            processActionResult: (arg, canceled) => this.processActionResult(arg, canceled),
            addAppointment: appointment => this.addAppointment(appointment),
            updateAppointment: (sourceAppointment, updatedAppointment) => this.updateAppointment(sourceAppointment, updatedAppointment)
        };
        return new AppointmentPopup(scheduler, form)
    }
    scrollToAppointment(appointment) {
        const adapter = new AppointmentAdapter(appointment, this._dataAccessors);
        const {
            startDate: startDate,
            endDate: endDate,
            allDay: allDay
        } = adapter;
        if (!startDate) {
            return
        }
        const startTime = startDate.getTime();
        const endTime = endDate ? endDate.getTime() : startTime;
        const dayInMs = toMs("day");
        const inAllDayRow = allDay || endTime - startTime >= dayInMs;
        const appointmentGroupValues = getAppointmentGroupValues(appointment, this.resourceManager.resources);
        this._workSpace.updateScrollPosition(startDate, appointmentGroupValues, inAllDayRow)
    }
    saveAppointmentAndScroll(saveAction, appointment) {
        return when(saveAction()).done(() => {
            this.scrollToAppointment(appointment)
        }).promise()
    }
    getAppointmentTooltipOptions() {
        return {
            createComponent: this._createComponent.bind(this),
            container: this.$element(),
            getScrollableContainer: this.getWorkSpaceScrollableContainer.bind(this),
            addDefaultTemplates: this._templateManager.addDefaultTemplates.bind(this._templateManager),
            getAppointmentTemplate: this.getAppointmentTemplate.bind(this),
            showAppointmentPopup: this.showAppointmentPopup.bind(this),
            checkAndDeleteAppointment: this.checkAndDeleteAppointment.bind(this),
            isAppointmentInAllDayPanel: this.isAppointmentInAllDayPanel.bind(this),
            createFormattedDateText: (appointment, targetedAppointment, format) => this.fire("createFormattedDateText", appointment, targetedAppointment ?? appointment, format),
            getAppointmentDisabled: appointment => this._dataAccessors.get("disabled", appointment),
            onItemContextMenu: this._createActionByOption("onAppointmentContextMenu"),
            createEventArgs: this._createEventArgs.bind(this)
        }
    }
    _createEventArgs(e) {
        var _e$itemData, _e$itemData2;
        const itemData = null === (_e$itemData = e.itemData) || void 0 === _e$itemData ? void 0 : _e$itemData.appointment;
        if (!itemData) {
            throw errors.Error("E0001")
        }
        const eventConfig = {
            itemData: itemData,
            itemElement: $(e.itemElement),
            targetedAppointment: null === (_e$itemData2 = e.itemData) || void 0 === _e$itemData2 ? void 0 : _e$itemData2.targetedAppointment
        };
        const mappedFields = this.fire("mapAppointmentFields", eventConfig);
        return extend({}, mappedFields, {
            component: e.component,
            element: e.element,
            event: e.event,
            model: e.model
        })
    }
    focusFallbackAfterDelete() {
        var _this$header2, _this$_workSpace2;
        const $headerFocusable = null === (_this$header2 = this.header) || void 0 === _this$header2 ? void 0 : _this$header2.$element().find("*").not(".dx-state-invisible, .dx-state-invisible *").filter(tabbable).first();
        if (null !== $headerFocusable && void 0 !== $headerFocusable && $headerFocusable.length) {
            focus.trigger($headerFocusable);
            return
        }
        null === (_this$_workSpace2 = this._workSpace) || void 0 === _this$_workSpace2 || _this$_workSpace2.focus()
    }
    checkAndDeleteAppointment(appointment, targetedAppointment) {
        const targetedData = targetedAppointment ?? appointment;
        const targetedAdapter = new AppointmentAdapter(targetedData, this._dataAccessors);
        const deletingOptions = this.fireOnAppointmentDeleting(appointment, targetedAdapter);
        this.checkRecurringAppointment(appointment, targetedData, targetedAdapter.startDate, () => {
            this.processDeleteAppointment(appointment, deletingOptions)
        }, true)
    }
    getExtraAppointmentTooltipOptions() {
        return {
            rtlEnabled: this.option("rtlEnabled"),
            focusStateEnabled: this.option("focusStateEnabled"),
            editing: this.option("editing"),
            offset: this.option("_appointmentTooltipOffset")
        }
    }
    isAppointmentInAllDayPanel(appointmentData) {
        const workSpace = this._workSpace;
        const itTakesAllDay = this.appointmentTakesAllDay(appointmentData);
        return itTakesAllDay && workSpace.supportAllDayRow() && Boolean(workSpace.option("showAllDayPanel"))
    }
    initMarkupCore() {
        this.readyToRenderAppointments = hasWindow();
        if (this._workSpace) {
            this.cleanWorkspace()
        }
        this.renderWorkSpace();
        this._appointments.option({
            fixedContainer: this._workSpace.getFixedContainer(),
            allDayContainer: this._workSpace.getAllDayContainer()
        });
        this.waitAsyncTemplate(() => {
            var _this$workSpaceRecalc;
            null === (_this$workSpaceRecalc = this.workSpaceRecalculation) || void 0 === _this$workSpaceRecalc || _this$workSpaceRecalc.resolve()
        });
        this.createAppointmentDataSource();
        this.setRemoteFilterIfNeeded();
        this.validateKeyFieldIfAgendaExist();
        this.updateA11yStatus()
    }
    isDataSourceLoaded() {
        var _this$_dataSource3;
        return Boolean(null === (_this$_dataSource3 = this._dataSource) || void 0 === _this$_dataSource3 ? void 0 : _this$_dataSource3.isLoaded())
    }
    _render() {
        var _this$getWorkSpace;
        null === (_this$getWorkSpace = this.getWorkSpace()) || void 0 === _this$getWorkSpace || _this$getWorkSpace.updateHeaderEmptyCellWidth();
        super._render()
    }
    renderHeader() {
        var _toolbarOptions$items;
        const toolbarOptions = this.option("toolbar");
        const isHeaderShown = Boolean(toolbarOptions.visible ?? (null === (_toolbarOptions$items = toolbarOptions.items) || void 0 === _toolbarOptions$items ? void 0 : _toolbarOptions$items.length));
        if (isHeaderShown) {
            const $header = $("<div>").appendTo(this.mainContainer);
            const headerOptions = this.headerConfig();
            this.header = this._createComponent($header, SchedulerHeader, headerOptions)
        }
    }
    headerConfig() {
        return {
            currentView: this.currentView,
            skippedDays: this.getViewOption("hiddenWeekDays"),
            views: this.views,
            currentDate: this.getViewOption("currentDate"),
            min: this.getViewOption("min"),
            max: this.getViewOption("max"),
            indicatorTime: this.option("indicatorTime"),
            startViewDate: this.getStartViewDate() ?? this.getViewOption("currentDate"),
            tabIndex: this.option("tabIndex"),
            focusStateEnabled: this.option("focusStateEnabled"),
            useDropDownViewSwitcher: this.option("useDropDownViewSwitcher"),
            firstDayOfWeek: this.getFirstDayOfWeek(),
            toolbar: this.option("toolbar"),
            customizeDateNavigatorText: this.option("customizeDateNavigatorText"),
            onCurrentViewChange: name => {
                this.option("currentView", name)
            },
            onCurrentDateChange: date => {
                this.option("currentDate", date)
            }
        }
    }
    appointmentsConfig() {
        const collectionConfig = {
            getResourceManager: () => this.resourceManager,
            getAppointmentDataSource: () => this.appointmentDataSource,
            getSortedAppointments: () => this._layoutManager.sortedItems,
            scrollTo: this.scrollTo.bind(this),
            appointmentTooltip: this.appointmentTooltip,
            dataAccessors: this._dataAccessors,
            notifyScheduler: this.notifyScheduler,
            onItemRendered: this.getAppointmentRenderedAction(),
            onItemClick: this.createSchedulerAction("onAppointmentClick"),
            onItemContextMenu: this.createSchedulerAction("onAppointmentContextMenu"),
            onAppointmentDblClick: this.createSchedulerAction("onAppointmentDblClick"),
            tabIndex: this.option("tabIndex") ?? 0,
            focusStateEnabled: Boolean(this.option("focusStateEnabled")),
            allowDrag: this.allowDragging(),
            allowDelete: this.editing.allowUpdating && this.editing.allowDeleting,
            allowResize: this.allowResizing(),
            allowAllDayResize: this.allowAllDayResizing(),
            rtlEnabled: Boolean(this.option("rtlEnabled")),
            groups: this.getViewOption("groups"),
            groupByDate: Boolean(this.getViewOption("groupByDate")),
            timeZoneCalculator: this.timeZoneCalculator,
            getResizableStep: () => this._workSpace ? this._workSpace.positionHelper.getResizableStep() : 0,
            getDOMElementsMetaData: () => {
                var _this$_workSpace3;
                return null === (_this$_workSpace3 = this._workSpace) || void 0 === _this$_workSpace3 ? void 0 : _this$_workSpace3.getDOMElementsMetaData()
            },
            getViewDataProvider: () => {
                var _this$_workSpace4;
                return null === (_this$_workSpace4 = this._workSpace) || void 0 === _this$_workSpace4 ? void 0 : _this$_workSpace4.viewDataProvider
            },
            isVerticalGroupedWorkSpace: () => this._workSpace.isVerticalGroupedWorkSpace(),
            isDateAndTimeView: () => isDateAndTimeView(this._workSpace.type),
            onContentReady: () => {
                var _this$_workSpace5;
                null === (_this$_workSpace5 = this._workSpace) || void 0 === _this$_workSpace5 || _this$_workSpace5.option("allDayExpanded", this.isAllDayExpanded())
            }
        };
        return collectionConfig
    }
    renderWorkSpace() {
        const currentViewOptions = this.currentView;
        if (!currentViewOptions) {
            return
        }
        if (this.isAgenda()) {
            this.renderAgendaWorkspace()
        } else {
            this.renderGridWorkspace()
        }
        this.recalculateWorkspace();
        if (this.header) {
            const startViewDate = this.getStartViewDate();
            if (startViewDate) {
                this.updateOption("header", "startViewDate", startViewDate)
            }
        }
        if (currentViewOptions.startDate) {
            this.updateOption("header", "currentDate", this._workSpace.getHeaderDate())
        }
    }
    renderGridWorkspace() {
        if (this.readyToRenderAppointments) {
            this.toggleSmallClass();
            Promise.resolve().then(() => {
                var _this$_workSpace6;
                this.toggleSmallClass();
                null === (_this$_workSpace6 = this._workSpace) || void 0 === _this$_workSpace6 || _this$_workSpace6.updateHeaderEmptyCellWidth()
            }).catch(noop)
        }
        const $workSpace = $("<div>").appendTo(this.mainContainer);
        const currentViewType = this.currentView.type;
        const workSpaceComponent = VIEWS_CONFIG[currentViewType].workSpace;
        const workSpaceConfig = this.workSpaceConfig(this.currentView);
        this._workSpace = this._createComponent($workSpace, workSpaceComponent, workSpaceConfig);
        if (this.allowDragging()) {
            this._workSpace.initDragBehavior(this)
        }
        this._workSpace.attachTablesEvents();
        this._workSpace.getWorkArea().append(this._appointments.$element())
    }
    renderAgendaWorkspace() {
        const $workSpace = $("<div>").appendTo(this.mainContainer);
        const workSpaceConfig = this.workSpaceConfig(this.currentView);
        const workSpaceComponent = VIEWS_CONFIG.agenda.workSpace;
        this._workSpace = this._createComponent($workSpace, workSpaceComponent, workSpaceConfig);
        this._workSpace.getWorkArea().append(this._appointments.$element())
    }
    recalculateWorkspace() {
        this.workSpaceRecalculation = new Deferred;
        triggerResizeEvent(this._workSpace.$element());
        this.waitAsyncTemplate(() => {
            this._workSpace.renderCurrentDateTimeLineAndShader()
        })
    }
    workSpaceConfig(currentViewOptions) {
        const scrolling = this.getViewOption("scrolling");
        const isVirtualScrolling = "virtual" === scrolling.mode;
        const horizontalVirtualScrollingAllowed = isVirtualScrolling && (!isDefined(scrolling.orientation) || ["horizontal", "both"].includes(scrolling.orientation));
        const crossScrollingEnabled = this.option("crossScrollingEnabled") || horizontalVirtualScrollingAllowed || isTimelineView(currentViewOptions.type);
        const mergedOptions = extend({
            resources: this.option("resources"),
            getResourceManager: () => this.resourceManager,
            getFilteredItems: () => this._layoutManager.filteredItems,
            noDataText: this.option("noDataText") || messageLocalization.format("dxCollectionWidget-noDataText"),
            firstDayOfWeek: this.option("firstDayOfWeek"),
            startDayHour: this.option("startDayHour"),
            endDayHour: this.option("endDayHour"),
            viewOffset: this.getViewOffsetMs(),
            tabIndex: this.option("tabIndex") ?? 0,
            accessKey: this.option("accessKey") ?? "",
            focusStateEnabled: Boolean(this.option("focusStateEnabled")),
            showAllDayPanel: this.option("showAllDayPanel"),
            showCurrentTimeIndicator: this.option("showCurrentTimeIndicator"),
            indicatorTime: this.option("indicatorTime"),
            indicatorUpdateInterval: this.option("indicatorUpdateInterval"),
            shadeUntilCurrentTime: this.option("shadeUntilCurrentTime"),
            crossScrollingEnabled: crossScrollingEnabled,
            dataCellTemplate: this.option("dataCellTemplate"),
            timeCellTemplate: this.option("timeCellTemplate"),
            resourceCellTemplate: this.option("resourceCellTemplate"),
            dateCellTemplate: this.option("dateCellTemplate"),
            allowMultipleCellSelection: this.option("allowMultipleCellSelection"),
            selectedCellData: this.option("selectedCellData"),
            onSelectionChanged: args => {
                this.option("selectedCellData", args.selectedCellData)
            },
            onSelectionEnd: args => {
                this.actions.onSelectionEnd({
                    selectedCellData: args.selectedCellData
                })
            },
            groupByDate: Boolean(this.getViewOption("groupByDate")),
            skippedDays: this.getViewOption("hiddenWeekDays"),
            scrolling: scrolling,
            draggingMode: this.option("_draggingMode"),
            timeZoneCalculator: this.timeZoneCalculator,
            schedulerHeight: this.option("height"),
            schedulerWidth: this.option("width"),
            allDayPanelMode: this.option("allDayPanelMode"),
            renderAppointments: () => {
                this.renderAppointments()
            },
            onShowAllDayPanel: value => this.option("showAllDayPanel", value),
            getHeaderHeight: () => {
                var _this$header3;
                return (null === (_this$header3 = this.header) || void 0 === _this$header3 ? void 0 : _this$header3.getHeight()) ?? 0
            },
            onScrollEnd: () => {
                this._appointments.updateResizableArea()
            },
            rtlEnabled: Boolean(this.option("rtlEnabled")),
            cellDuration: this.option("cellDuration"),
            allDayExpanded: false,
            currentDate: this.getViewOption("currentDate")
        }, currentViewOptions);
        const onSelectedCellsClick = this.showAddAppointmentPopup.bind(this);
        const workSpaceOptions = Object.assign({}, mergedOptions, {
            scrolling: scrolling,
            onSelectedCellsClick: onSelectedCellsClick,
            hoursInterval: mergedOptions.cellDuration / 60,
            notifyScheduler: this.notifyScheduler,
            groups: this.resourceManager.groupResources(),
            onCellClick: this.createSchedulerAction("onCellClick"),
            onCellContextMenu: this.createSchedulerAction("onCellContextMenu"),
            skippedDays: this.getViewOption("hiddenWeekDays"),
            dataCellTemplate: mergedOptions.dataCellTemplate ? this._getTemplate(mergedOptions.dataCellTemplate) : null,
            timeCellTemplate: mergedOptions.timeCellTemplate ? this._getTemplate(mergedOptions.timeCellTemplate) : null,
            resourceCellTemplate: mergedOptions.resourceCellTemplate ? this._getTemplate(mergedOptions.resourceCellTemplate) : null,
            dateCellTemplate: mergedOptions.dateCellTemplate ? this._getTemplate(mergedOptions.dateCellTemplate) : null
        });
        return workSpaceOptions
    }
    waitAsyncTemplate(callback) {
        if (this._options.silent("templatesRenderAsynchronously")) {
            const timer = setTimeout(() => {
                callback();
                clearTimeout(timer)
            });
            this.asyncTemplatesTimers.push(timer)
        } else {
            callback()
        }
    }
    getAppointmentTemplate(optionName) {
        var _this$currentView;
        if (null !== (_this$currentView = this.currentView) && void 0 !== _this$currentView && _this$currentView[optionName]) {
            return this._getTemplate(this.currentView[optionName])
        }
        return this._getTemplateByOption(optionName)
    }
    updateOption(viewName, optionName, value) {
        if ("header" === viewName) {
            var _this$header4;
            null === (_this$header4 = this.header) || void 0 === _this$header4 || _this$header4.option(optionName, value)
        } else {
            var _this$_workSpace7;
            null === (_this$_workSpace7 = this._workSpace) || void 0 === _this$_workSpace7 || _this$_workSpace7.option(optionName, value)
        }
    }
    refreshWorkSpace() {
        if (this._disposed) {
            return
        }
        this.cleanWorkspace();
        this._workSpace = void 0;
        this.renderWorkSpace();
        if (this.readyToRenderAppointments) {
            this._appointments.option({
                fixedContainer: this._workSpace.getFixedContainer(),
                allDayContainer: this._workSpace.getAllDayContainer()
            });
            this.waitAsyncTemplate(() => {
                this.workSpaceRecalculation.resolve()
            })
        }
    }
    cleanWorkspace() {
        this._appointments.$element().detach();
        this._workSpace._dispose();
        this._workSpace.$element().remove();
        this.option("selectedCellData", [])
    }
    getWorkSpaceScrollable() {
        return this._workSpace.getScrollable()
    }
    getWorkSpaceScrollableContainer() {
        return this._workSpace.getScrollableContainer()
    }
    getWorkSpace() {
        return this._workSpace
    }
    getHeader() {
        return this.header
    }
    cleanPopup() {
        var _this$appointmentPopu2;
        null === (_this$appointmentPopu2 = this.appointmentPopup) || void 0 === _this$appointmentPopu2 || _this$appointmentPopu2.dispose()
    }
    checkRecurringAppointment(rawAppointment, singleAppointment, exceptionDate, callback, isDeleted, isPopupEditing, dragEvent, recurrenceEditMode) {
        const recurrenceRule = this._dataAccessors.get("recurrenceRule", rawAppointment);
        if (!validateRRule(recurrenceRule) || !this.editing.allowUpdating) {
            callback();
            return
        }
        const editMode = recurrenceEditMode || this.option("recurrenceEditMode");
        switch (editMode) {
            case "series":
                callback();
                break;
            case "occurrence":
                this.excludeAppointmentFromSeries(rawAppointment, singleAppointment, exceptionDate, isDeleted, Boolean(isPopupEditing), dragEvent);
                break;
            default:
                if (dragEvent) {
                    dragEvent.cancel = new Deferred
                }
                this.showRecurrenceChangeConfirm(isDeleted).done(editingMode => {
                    if (editingMode === RECURRENCE_EDITING_MODE.SERIES) {
                        callback()
                    }
                    if (editingMode === RECURRENCE_EDITING_MODE.OCCURRENCE) {
                        this.excludeAppointmentFromSeries(rawAppointment, singleAppointment, exceptionDate, isDeleted, Boolean(isPopupEditing), dragEvent)
                    }
                }).fail(() => {
                    this._appointments.moveAppointmentBack(dragEvent)
                })
        }
    }
    excludeAppointmentFromSeries(rawAppointment, newRawAppointment, exceptionDate, isDeleted, isPopupEditing, dragEvent) {
        const appointment = excludeFromRecurrence(rawAppointment, exceptionDate, this._dataAccessors);
        const singleRawAppointment = Object.assign({}, newRawAppointment);
        delete singleRawAppointment[this._dataAccessors.expr.recurrenceExceptionExpr];
        delete singleRawAppointment[this._dataAccessors.expr.recurrenceRuleExpr];
        const keyPropertyName = this.appointmentDataSource.keyName;
        delete singleRawAppointment[keyPropertyName];
        const canCreateNewAppointment = !isDeleted && !isPopupEditing;
        if (canCreateNewAppointment) {
            this.addAppointment(singleRawAppointment).catch(noop)
        }
        if (isPopupEditing) {
            this.appointmentPopup.show(singleRawAppointment, {
                onSave: newAppointment => {
                    this.updateAppointment(rawAppointment, appointment.source).catch(noop);
                    return this.saveAppointmentAndScroll(() => this.addAppointment(newAppointment), newAppointment)
                },
                title: messageLocalization.format("dxScheduler-editPopupTitle"),
                readOnly: Boolean(appointment.source) && appointment.disabled
            });
            this.editAppointmentData = rawAppointment
        } else {
            this.updateAppointmentCore(rawAppointment, appointment.source, () => {
                this._appointments.moveAppointmentBack(dragEvent)
            }, dragEvent).catch(noop)
        }
    }
    createRecurrenceException(appointment, exceptionDate) {
        const result = [];
        if (appointment.recurrenceException) {
            result.push(appointment.recurrenceException)
        }
        const adapter = new AppointmentAdapter(appointment, this._dataAccessors);
        result.push(this.getSerializedDate(exceptionDate, adapter.startDate, Boolean(adapter.allDay)));
        return result.join()
    }
    getSerializedDate(date, startDate, isAllDay) {
        if (isAllDay) {
            date.setHours(startDate.getHours(), startDate.getMinutes(), startDate.getSeconds(), startDate.getMilliseconds())
        }
        return dateSerialization.serializeDate(date, UTC_FULL_DATE_FORMAT)
    }
    showRecurrenceChangeConfirm(isDeleted) {
        const title = messageLocalization.format(isDeleted ? "dxScheduler-confirmRecurrenceDeleteTitle" : "dxScheduler-confirmRecurrenceEditTitle");
        const message = messageLocalization.format(isDeleted ? "dxScheduler-confirmRecurrenceDeleteMessage" : "dxScheduler-confirmRecurrenceEditMessage");
        const seriesText = messageLocalization.format(isDeleted ? "dxScheduler-confirmRecurrenceDeleteSeries" : "dxScheduler-confirmRecurrenceEditSeries");
        const occurrenceText = messageLocalization.format(isDeleted ? "dxScheduler-confirmRecurrenceDeleteOccurrence" : "dxScheduler-confirmRecurrenceEditOccurrence");
        this.recurrenceDialog = customDialog({
            title: title,
            messageHtml: message,
            showCloseButton: true,
            showTitle: true,
            buttons: [{
                text: seriesText,
                onClick: () => RECURRENCE_EDITING_MODE.SERIES
            }, {
                text: occurrenceText,
                onClick: () => RECURRENCE_EDITING_MODE.OCCURRENCE
            }],
            popupOptions: {
                wrapperAttr: {
                    class: "dx-dialog"
                },
                onHidden: () => {
                    var _this$_appointments;
                    null === (_this$_appointments = this._appointments) || void 0 === _this$_appointments || _this$_appointments.focus()
                }
            }
        });
        return this.recurrenceDialog.show()
    }
    getUpdatedData(rawAppointment, $cell) {
        const viewOffset = this.getViewOffsetMs();
        const getConvertedFromGrid = date => {
            if (!date) {
                return
            }
            const result = this.timeZoneCalculator.createDate(date, "fromGrid");
            return dateUtilsTs.addOffsets(result, -viewOffset)
        };
        const targetCell = $cell ? this._workSpace.getCellData($cell) : this.getTargetCellData();
        const appointment = new AppointmentAdapter(rawAppointment, this._dataAccessors);
        const cellStartDate = getConvertedFromGrid(targetCell.startDate);
        const cellEndDate = getConvertedFromGrid(targetCell.endDate);
        let appointmentStartDate = new Date(appointment.startDate);
        appointmentStartDate = dateUtilsTs.addOffsets(appointmentStartDate, -viewOffset);
        let appointmentEndDate = new Date(appointment.endDate);
        appointmentEndDate = dateUtilsTs.addOffsets(appointmentEndDate, -viewOffset);
        let resultedStartDate = cellStartDate ?? appointmentStartDate;
        if (!dateUtilsTs.isValidDate(appointmentStartDate)) {
            appointmentStartDate = resultedStartDate
        }
        if (!dateUtilsTs.isValidDate(appointmentEndDate) && cellEndDate) {
            appointmentEndDate = cellEndDate
        }
        const duration = appointmentEndDate.getTime() - appointmentStartDate.getTime();
        const isKeepAppointmentHours = this._workSpace.keepOriginalHours() && dateUtilsTs.isValidDate(appointment.startDate) && dateUtilsTs.isValidDate(cellStartDate);
        if (isKeepAppointmentHours) {
            const startDate = this.timeZoneCalculator.createDate(appointmentStartDate, "toGrid");
            const timeInMs = startDate.getTime() - dateUtils.trimTime(startDate).getTime();
            const targetCellStartDate = dateUtilsTs.addOffsets(targetCell.startDate, -viewOffset);
            resultedStartDate = new Date(dateUtils.trimTime(targetCellStartDate).getTime() + timeInMs);
            resultedStartDate = this.timeZoneCalculator.createDate(resultedStartDate, "fromGrid")
        }
        const result = new AppointmentAdapter({}, this._dataAccessors);
        if (void 0 !== targetCell.allDay) {
            result.allDay = targetCell.allDay
        }
        result.startDate = resultedStartDate;
        let resultedEndDate = new Date(resultedStartDate.getTime() + duration);
        if (this.appointmentTakesAllDay(rawAppointment) && !result.allDay && this._workSpace.supportAllDayRow()) {
            resultedEndDate = this._workSpace.calculateEndDate(resultedStartDate)
        }
        if (appointment.allDay && !this._workSpace.supportAllDayRow() && !this._workSpace.keepOriginalHours()) {
            const dateCopy = new Date(resultedStartDate);
            dateCopy.setHours(0);
            resultedEndDate = new Date(dateCopy.getTime() + duration);
            if (0 !== resultedEndDate.getHours()) {
                resultedEndDate.setHours(this.getViewOption("endDayHour"))
            }
        }
        result.startDate = dateUtilsTs.addOffsets(result.startDate, viewOffset);
        result.endDate = dateUtilsTs.addOffsets(resultedEndDate, viewOffset);
        const rawResult = result.source;
        setAppointmentGroupValues(rawResult, this.resourceManager.resourceById, targetCell.groups);
        return rawResult
    }
    getTargetedAppointment(appointment, element) {
        const settings = this._appointments.getAppointmentSettings(element);
        if (!settings) {
            throw errors.Error("E0001")
        }
        return getTargetedAppointment(appointment, settings, this._dataAccessors, this.resourceManager)
    }
    subscribe(subject, action) {
        this.subscribes[subject] = action;
        subscribes[subject] = action
    }
    fire(subject) {
        const callback = this.subscribes[subject];
        if (!isFunction(callback)) {
            throw errors.Error("E1031", subject)
        }
        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            args[_key - 1] = arguments[_key]
        }
        return callback.apply(this, args)
    }
    getTargetCellData() {
        return this._workSpace.getDataByDroppableCell()
    }
    updateAppointmentCore(target, rawAppointment, onUpdatePrevented, dragEvent) {
        const updatingOptions = {
            newData: rawAppointment,
            oldData: extend({}, target),
            cancel: false
        };
        const performFailAction = function(err) {
            if (onUpdatePrevented) {
                onUpdatePrevented.call(this)
            }
            if ("Error" === (null === err || void 0 === err ? void 0 : err.name)) {
                throw err
            }
        }.bind(this);
        this.actions[StoreEventNames.UPDATING](updatingOptions);
        if (dragEvent && !isDeferred(dragEvent.cancel)) {
            dragEvent.cancel = Deferred()
        }
        if (isPromise(updatingOptions.cancel) && dragEvent) {
            this.updatingAppointments.add(target)
        }
        return this.processActionResult(updatingOptions, function(canceled) {
            let deferred = Deferred();
            if (!canceled) {
                this.expandAllDayPanel(rawAppointment);
                try {
                    deferred = this.appointmentDataSource.update(target, rawAppointment).done(() => {
                        var _dragEvent$cancel;
                        null === dragEvent || void 0 === dragEvent || null === (_dragEvent$cancel = dragEvent.cancel) || void 0 === _dragEvent$cancel || _dragEvent$cancel.resolve(false)
                    }).always(storeAppointment => {
                        this.updatingAppointments.delete(target);
                        this.onDataPromiseCompleted(StoreEventNames.UPDATED, storeAppointment)
                    }).fail(() => performFailAction())
                } catch (err) {
                    performFailAction(err instanceof Error ? err : void 0);
                    this.updatingAppointments.delete(target);
                    deferred.resolve()
                }
            } else {
                performFailAction();
                this.updatingAppointments.delete(target);
                deferred.resolve()
            }
            return deferred.promise()
        })
    }
    processActionResult(actionOptions, callback) {
        const deferred = Deferred();
        const resolveCallback = callbackResult => {
            when(fromPromise(callbackResult)).always(() => {
                deferred.resolve()
            })
        };
        if (isPromise(actionOptions.cancel)) {
            when(fromPromise(actionOptions.cancel)).always(cancel => {
                let isCanceled = cancel;
                if (!isDefined(isCanceled)) {
                    isCanceled = "rejected" === actionOptions.cancel.state()
                }
                resolveCallback(callback.call(this, isCanceled))
            })
        } else {
            resolveCallback(callback.call(this, actionOptions.cancel))
        }
        return deferred.promise()
    }
    expandAllDayPanel(appointment) {
        if (!this.isAllDayExpanded() && this.appointmentTakesAllDay(appointment)) {
            this.updateOption("workSpace", "allDayExpanded", true)
        }
    }
    onDataPromiseCompleted(handlerName, storeAppointment, appointment) {
        const args = {
            appointmentData: appointment ?? storeAppointment
        };
        if (storeAppointment instanceof Error) {
            args.error = storeAppointment
        } else if (this.appointmentPopup.visible) {
            this.appointmentPopup.hide()
        }
        const handler = this.actions[handlerName];
        handler(args);
        this._fireContentReadyAction()
    }
    getAppointmentsInstance() {
        return this._appointments
    }
    getLayoutManager() {
        return this._layoutManager
    }
    getActions() {
        return this.actions
    }
    appointmentTakesAllDay(rawAppointment) {
        const appointment = new AppointmentAdapter(rawAppointment, this._dataAccessors);
        return isAppointmentTakesAllDay(appointment, this.getViewOption("allDayPanelMode"))
    }
    dayHasAppointment(day, rawAppointment, trimTime) {
        const getConvertedToTimeZone = date => this.timeZoneCalculator.createDate(date, "toGrid");
        const appointment = new AppointmentAdapter(rawAppointment, this._dataAccessors);
        let startDate = new Date(appointment.startDate);
        let endDate = new Date(appointment.endDate);
        startDate = getConvertedToTimeZone(startDate);
        endDate = getConvertedToTimeZone(endDate);
        if (day.getTime() === endDate.getTime()) {
            return startDate.getTime() === endDate.getTime()
        }
        let dayStart = day;
        let startDateStart = startDate;
        let endDateEnd = endDate;
        if (trimTime) {
            dayStart = dateUtils.trimTime(day);
            startDateStart = dateUtils.trimTime(startDate);
            endDateEnd = dateUtils.trimTime(endDate)
        }
        const dayTimeStamp = dayStart.getTime();
        const startDateTimeStamp = startDateStart.getTime();
        const endDateTimeStamp = endDateEnd.getTime();
        return startDateTimeStamp <= dayTimeStamp && dayTimeStamp <= endDateTimeStamp
    }
    getStartViewDate() {
        var _this$_workSpace8;
        return null === (_this$_workSpace8 = this._workSpace) || void 0 === _this$_workSpace8 ? void 0 : _this$_workSpace8.getStartViewDate()
    }
    getEndViewDate() {
        return this._workSpace.getEndViewDate()
    }
    showAddAppointmentPopup(cellData, cellGroups) {
        const appointmentAdapter = new AppointmentAdapter({}, this._dataAccessors);
        appointmentAdapter.allDay = Boolean(cellData.allDay);
        appointmentAdapter.startDate = new Date(cellData.startDateUTC);
        appointmentAdapter.endDate = new Date(cellData.endDateUTC);
        const resultAppointment = extend(appointmentAdapter.source, cellGroups);
        this.showAppointmentPopup(resultAppointment, true)
    }
    showAppointmentPopup(rawAppointment, createNewAppointment, rawTargetedAppointment) {
        const newRawTargetedAppointment = rawTargetedAppointment ? Object.assign({}, rawTargetedAppointment) : {};
        if (rawTargetedAppointment) {
            delete newRawTargetedAppointment.displayStartDate;
            delete newRawTargetedAppointment.displayEndDate
        }
        const newTargetedAppointment = extend({}, rawAppointment, newRawTargetedAppointment);
        const isCreateAppointment = createNewAppointment ?? isEmptyObject(rawAppointment);
        let appointment = rawAppointment ?? {};
        if (isEmptyObject(appointment)) {
            appointment = this.createPopupAppointment()
        }
        if (isCreateAppointment) {
            delete this.editAppointmentData;
            if (this.editing.allowAdding) {
                this.appointmentPopup.show(appointment, {
                    onSave: appointmentData => this.saveAppointmentAndScroll(() => this.addAppointment(appointmentData), appointmentData),
                    title: messageLocalization.format("dxScheduler-newPopupTitle"),
                    readOnly: false
                })
            }
        } else {
            const startDate = this._dataAccessors.get("startDate", Object.keys(newRawTargetedAppointment).length ? newRawTargetedAppointment : appointment);
            this.checkRecurringAppointment(appointment, newTargetedAppointment, startDate, () => {
                this.editAppointmentData = appointment;
                const adapter = new AppointmentAdapter(appointment, this._dataAccessors);
                const isDisabled = Boolean(adapter.source) && adapter.disabled;
                const readOnly = isDisabled || !this.editing.allowUpdating;
                this.appointmentPopup.show(appointment, {
                    onSave: appointmentData => this.saveAppointmentAndScroll(() => this.updateAppointment(appointment, appointmentData), appointmentData),
                    title: messageLocalization.format("dxScheduler-editPopupTitle"),
                    readOnly: readOnly
                })
            }, false, true)
        }
    }
    createPopupAppointment() {
        const result = {};
        const msPerMinute = dateUtils.dateToMilliseconds("minute");
        const startDate = new Date(this.option("currentDate"));
        const endDate = new Date(startDate.getTime() + this.option("cellDuration") * msPerMinute);
        this._dataAccessors.set("startDate", result, startDate);
        this._dataAccessors.set("endDate", result, endDate);
        return result
    }
    hideAppointmentPopup(saveChanges) {
        var _this$appointmentPopu3;
        if (null !== (_this$appointmentPopu3 = this.appointmentPopup) && void 0 !== _this$appointmentPopu3 && _this$appointmentPopu3.visible) {
            if (saveChanges) {
                this.appointmentPopup.saveChangesAsync().catch(noop)
            }
            this.appointmentPopup.hide()
        }
    }
    showAppointmentTooltip(appointment, element, targetedAppointment) {
        if (appointment) {
            const settings = this._appointments.getAppointmentSettings(element);
            const appointmentConfig = {
                itemData: targetedAppointment ?? appointment,
                groupIndex: (null === settings || void 0 === settings ? void 0 : settings.groupIndex) ?? 0
            };
            const info = {
                appointment: appointment,
                targetedAppointment: targetedAppointment,
                color: this.resourceManager.getAppointmentColor(appointmentConfig),
                settings: settings
            };
            this.showAppointmentTooltipCore(element, [info])
        }
    }
    showAppointmentTooltipCore(target, data, options) {
        const arg = {
            cancel: false,
            appointments: data.map(item => ({
                appointmentData: item.appointment,
                currentAppointmentData: Object.assign({}, item.targetedAppointment),
                color: item.color
            })),
            targetElement: getPublicElement(target)
        };
        this.actions.onAppointmentTooltipShowing(arg);
        if (this.appointmentTooltip.isShownForTarget(target)) {
            this.hideAppointmentTooltip()
        } else {
            this.processActionResult(arg, canceled => {
                if (!canceled) {
                    this.appointmentTooltip.show(target, data, Object.assign({}, this.getExtraAppointmentTooltipOptions(), options))
                }
            })
        }
    }
    hideAppointmentTooltip() {
        var _this$appointmentTool2;
        null === (_this$appointmentTool2 = this.appointmentTooltip) || void 0 === _this$appointmentTool2 || _this$appointmentTool2.hide()
    }
    scrollTo(date, groupValuesOrOptions, allDay) {
        if (this.isScrollOptionsObject(groupValuesOrOptions)) {
            this._workSpace.scrollTo(date, groupValuesOrOptions.group, groupValuesOrOptions.allDay, true, groupValuesOrOptions.alignInView ?? "center");
            return
        }
        if (isDefined(groupValuesOrOptions) || isDefined(allDay)) {
            errors.log("W0002", "dxScheduler", "scrollTo(date, group, allDay)", "26.1", "Use scrollTo(date, { group, allDay, alignInView }) instead.")
        }
        this._workSpace.scrollTo(date, groupValuesOrOptions, allDay, true, "center")
    }
    isScrollOptionsObject(options) {
        return Boolean(options) && "object" === typeof options && ("alignInView" in options || "allDay" in options || "group" in options)
    }
    isHorizontalVirtualScrolling() {
        const scrolling = this.option("scrolling");
        const {
            orientation: orientation,
            mode: mode
        } = scrolling;
        const isVirtualScrolling = "virtual" === mode;
        return isVirtualScrolling && ("horizontal" === orientation || "both" === orientation)
    }
    addAppointment(rawAppointment) {
        const appointment = new AppointmentAdapter(rawAppointment, this._dataAccessors);
        appointment.text = appointment.text || "";
        const serializedAppointment = appointment.serialize().source;
        const addingOptions = {
            appointmentData: serializedAppointment,
            cancel: false
        };
        this.actions[StoreEventNames.ADDING](addingOptions);
        return this.processActionResult(addingOptions, canceled => {
            if (canceled) {
                return Deferred().resolve().promise()
            }
            this.expandAllDayPanel(serializedAppointment);
            return this.appointmentDataSource.add(serializedAppointment).always(storeAppointment => {
                this.onDataPromiseCompleted(StoreEventNames.ADDED, storeAppointment)
            })
        })
    }
    updateAppointment(target, appointment) {
        return this.updateAppointmentCore(target, appointment)
    }
    deleteAppointment(rawAppointment) {
        const deletingOptions = this.fireOnAppointmentDeleting(rawAppointment);
        this.processDeleteAppointment(rawAppointment, deletingOptions)
    }
    fireOnAppointmentDeleting(rawAppointment, targetedAppointmentData) {
        const deletingOptions = {
            appointmentData: rawAppointment,
            targetedAppointmentData: targetedAppointmentData,
            cancel: false
        };
        this.actions[StoreEventNames.DELETING](deletingOptions);
        return deletingOptions
    }
    processDeleteAppointment(rawAppointment, deletingOptions) {
        this.processActionResult(deletingOptions, canceled => {
            if (!canceled) {
                this.appointmentDataSource.remove(rawAppointment).always(storeAppointment => {
                    if (isDefined(storeAppointment)) {
                        this.onDataPromiseCompleted(StoreEventNames.DELETED, storeAppointment, rawAppointment)
                    }
                })
            }
        }).catch(noop)
    }
    deleteRecurrence(appointment, date, recurrenceEditMode) {
        const dateValue = "string" === typeof date ? new Date(date) : date;
        this.checkRecurringAppointment(appointment, {}, dateValue, () => {
            this.processDeleteAppointment(appointment, {
                appointmentData: appointment,
                cancel: false
            })
        }, true, false, void 0, recurrenceEditMode)
    }
    focus() {
        if (this.editAppointmentData) {
            var _this$_appointments2;
            null === (_this$_appointments2 = this._appointments) || void 0 === _this$_appointments2 || _this$_appointments2.focus()
        } else {
            var _this$_workSpace9;
            null === (_this$_workSpace9 = this._workSpace) || void 0 === _this$_workSpace9 || _this$_workSpace9.focus()
        }
    }
    getOccurrences(startDate, endDate, rawAppointments) {
        return this._layoutManager.getOccurrences(startDate, endDate, rawAppointments)
    }
    getFirstDayOfWeek() {
        return isDefined(this.getViewOption("firstDayOfWeek")) ? this.getViewOption("firstDayOfWeek") : dateLocalization.firstDayOfWeekIndex()
    }
    validateKeyFieldIfAgendaExist() {
        var _this$appointmentData3;
        if (!(null !== (_this$appointmentData3 = this.appointmentDataSource) && void 0 !== _this$appointmentData3 && _this$appointmentData3.isDataSourceInit)) {
            return
        }
        const hasAgendaView = this.hasAgendaView();
        const isKeyNotExist = !this.appointmentDataSource.keyName;
        if (hasAgendaView && isKeyNotExist) {
            errors.log("W1023")
        }
    }
    _getDragBehavior() {
        return this._workSpace.dragBehavior
    }
    _isAppointmentBeingUpdated(appointmentData) {
        return this.updatingAppointments.has(appointmentData)
    }
    getViewOffsetMs() {
        const offsetFromOptions = this.getViewOption("offset");
        return this.normalizeViewOffsetValue(offsetFromOptions)
    }
    normalizeViewOffsetValue(viewOffset) {
        var _this$currentView2;
        if (!isDefined(viewOffset) || (null === (_this$currentView2 = this.currentView) || void 0 === _this$currentView2 ? void 0 : _this$currentView2.type) === VIEWS.AGENDA) {
            return 0
        }
        return viewOffset * toMs("minute")
    }
}
Scheduler.include(DataHelperMixin);
registerComponent("dxScheduler", Scheduler);
export default Scheduler;