"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "useMonths", {
    enumerable: true,
    get: function() {
        return useMonths;
    }
});
var _react = require("react");
var _utils = require("../utils");
var _types = require("../store/types");
var useMonths = function useMonths(param) {
    var date = param.date, value = param.value, eventList = param.eventList, disabledList = param.disabledList, min = param.min, max = param.max, _param_locale = param.locale, locale = _param_locale === void 0 ? 'ru' : _param_locale, includeEdgeDates = param.includeEdgeDates;
    return (0, _react.useMemo)(function() {
        var months = _utils.SHORT_MONTH_NAME[locale].map(function(monthName, monthIndex) {
            return {
                monthName: monthName,
                monthIndex: monthIndex,
                isCurrent: (0, _utils.isCurrentMonth)(date, monthIndex),
                isSelected: Array.isArray(value) ? Boolean(value.find(function(v) {
                    return (0, _utils.isSelectedMonth)(date, monthIndex, v);
                })) : (0, _utils.isSelectedMonth)(date, monthIndex, value),
                inRange: Array.isArray(value) ? (0, _utils.isDateInRange)(date.year, monthIndex, 1, value) : false,
                monthFullName: _utils.MONTH_NAMES[locale][monthIndex],
                date: {
                    year: date.year,
                    monthIndex: monthIndex,
                    day: 1
                }
            };
        });
        if ((eventList === null || eventList === void 0 ? void 0 : eventList.length) || (disabledList === null || disabledList === void 0 ? void 0 : disabledList.length) || max || min) {
            var modifiedMonths = (0, _utils.getDatesWithModifications)({
                dates: months,
                type: _types.CalendarState.Months,
                min: min,
                max: max,
                includeEdgeDates: includeEdgeDates,
                eventList: eventList,
                disabledList: disabledList
            });
            return (0, _utils.getMatrix)(modifiedMonths, 3);
        }
        return (0, _utils.getMatrix)(months, 3);
    }, [
        date,
        value,
        eventList,
        disabledList,
        max,
        min,
        locale
    ]);
};
