/**
 * DevExtreme (cjs/__internal/scheduler/appointments/rendering_strategies/m_appointments_positioning_strategy_base.js)
 * Version: 23.2.6 (build 24140-0112)
 * Build date: Sun May 19 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = void 0;
var _type = require("../../../../core/utils/type");
const COLLECTOR_DEFAULT_WIDTH = 24;
const COLLECTOR_DEFAULT_OFFSET = 3;
const COMPACT_THEME_APPOINTMENT_DEFAULT_OFFSET = 22;
const APPOINTMENT_MIN_COUNT = 1;
const APPOINTMENT_DEFAULT_WIDTH = 40;
const COLLECTOR_WIDTH_IN_PERCENTS = 75;
const APPOINTMENT_INCREASED_WIDTH = 50;
let AppointmentPositioningStrategy = function() {
    function AppointmentPositioningStrategy(renderingStrategy) {
        this._renderingStrategy = renderingStrategy
    }
    var _proto = AppointmentPositioningStrategy.prototype;
    _proto.getDropDownAppointmentWidth = function(intervalCount, isAllDay) {
        if (isAllDay || !(0, _type.isDefined)(isAllDay)) {
            return 75 * this._renderingStrategy.cellWidth / 100
        }
        return 24
    };
    _proto.getCollectorTopOffset = function(allDay) {
        return 3
    };
    _proto.getCollectorLeftOffset = function() {
        return 3
    };
    _proto.getAppointmentDefaultOffset = function() {
        if (this._renderingStrategy._isCompactTheme()) {
            return 22
        }
        return this._renderingStrategy.appointmentOffset
    };
    _proto.getDynamicAppointmentCountPerCell = function() {
        const renderingStrategy = this._renderingStrategy;
        const {
            cellHeight: cellHeight
        } = renderingStrategy;
        const allDayCount = Math.floor((cellHeight - renderingStrategy._getAppointmentDefaultOffset()) / renderingStrategy._getAppointmentDefaultHeight()) || this._getAppointmentMinCount();
        if (renderingStrategy.allDaySupported()) {
            return {
                allDay: "vertical" === renderingStrategy.groupOrientation ? allDayCount : this._renderingStrategy.appointmentCountPerCell,
                simple: this._calculateDynamicAppointmentCountPerCell() || this._getAppointmentMinCount()
            }
        }
        return allDayCount
    };
    _proto.getDropDownAppointmentHeight = function() {
        return
    };
    _proto._getAppointmentMinCount = function() {
        return 1
    };
    _proto._calculateDynamicAppointmentCountPerCell = function() {
        return Math.floor(this._renderingStrategy._getAppointmentMaxWidth() / 50)
    };
    _proto._getAppointmentDefaultWidth = function() {
        return 40
    };
    return AppointmentPositioningStrategy
}();
var _default = AppointmentPositioningStrategy;
exports.default = _default;
