// #region Imports
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Appearanceable } from '../../../../Behaviors/Appearanceable';
import { Variantable } from '../../../../Behaviors/Variantable';
import { Component } from '../../../../Decorators/ComponentDecorator';
import { CalendarView } from '../../../../Types/CalendarView';
import { ButtonElement } from '../../../Buttons/Button/ButtonElement';
import { TextElement } from '../../../Primitives/Text/TextElement';
import { CalendarItemElement } from '../CalendarItemElement';
import { isDateEqual, isDateInDates } from '../Utils';
import { CalendarViewBaseElement } from './Abstracts/CalendarViewBase';
import { calendarYearsViewElementTemplate } from './CalendarYearsViewElementTemplate';
import { calendarYearsViewElementJoyStyle } from './Themes/CalendarYearsViewElement.Joy';
import { calendarYearsViewElementMemphisStyle } from './Themes/CalendarYearsViewElement.Memphis';
import { calendarYearsViewElementCosmopolitanStyle } from './Themes/CalendarYearsViewElement.Cosmopolitan';
import { Themeable } from '../../../../Behaviors/Themeable';
// #endregion
/**
 * Calendar Years View - A component that displays a view of years in a calendar, allowing users to select a year.
 *
 * @description
 * The Calendar Years View component is used to display a list of years in a calendar format. This view allows users to
 * navigate and select a specific year. It is typically part of a larger calendar component or date picker, providing
 * a way to select years in the date selection process.
 *
 * @name CalendarYearsView
 * @element mosaik-calendar-years-view
 * @category Calendar
 *
 * @slot header - The header slot.
 *
 * @csspart heading - The heading part.
 * @csspart navigation - The navigation part.
 * @csspart yearView - The year view part.
 * @csspart item - The item part.
 *
 * @cssprop {String} --calendar-years-view-padding-top
 * @cssprop {String} --calendar-years-view-padding-right
 * @cssprop {String} --calendar-years-view-padding-bottom
 * @cssprop {String} --calendar-years-view-padding-left
 * @cssprop {String} --calendar-years-view-gap
 *
 * @example
 * ```html
 * <mosaik-calendar-years-view></mosaik-calendar-years-view>
 * ```
 *
 * @public
 */
let CalendarYearsViewElement = class CalendarYearsViewElement extends Themeable(Appearanceable(Variantable(CalendarViewBaseElement))) {
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-calendar-years-view';
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     * @template
     */
    selectYear(year) {
        this.displayDate?.setFullYear(year);
        this.value?.setFullYear(year);
        if (this.value === undefined) {
            console.error('[CalendarYearsViewElement] Value is not set.');
        }
        const date = this.value;
        this.onValueChanged({
            value: {
                date: date,
                isAdjacent: false, // TODO: isAdjacent
                isBlackout: isDateInDates(date, this.blackoutDates),
                isSpecial: isDateInDates(date, this.specialDates),
                isToday: isDateEqual(date, new Date()),
                isWeekend: date.getDay() === 0 || date.getDay() === 6
            },
            values: this.values?.map((date) => ({
                date: date,
                isAdjacent: false, // TODO: isAdjacent
                isBlackout: isDateInDates(date, this.blackoutDates),
                isSpecial: isDateInDates(date, this.specialDates),
                isToday: isDateEqual(date, new Date()),
                isWeekend: date.getDay() === 0 || date.getDay() === 6
            }))
        });
        this.setView(CalendarView.Month);
    }
    /**
     * @protected
     * @template
     */
    setView(view) {
        this.onViewChanged({ view: view });
    }
};
CalendarYearsViewElement = __decorate([
    Component({
        selector: 'mosaik-calendar-years-view',
        template: calendarYearsViewElementTemplate,
        themes: {
            joy: calendarYearsViewElementJoyStyle,
            memphis: calendarYearsViewElementMemphisStyle,
            cosmopolitan: calendarYearsViewElementCosmopolitanStyle
        },
        imports: [
            TextElement,
            ButtonElement,
            CalendarItemElement
        ]
    }),
    __metadata("design:paramtypes", [])
], CalendarYearsViewElement);
export { CalendarYearsViewElement };
//# sourceMappingURL=CalendarYearsViewElement.js.map