// #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 { fadeIn, fadeOut } from '../../../../Animations/Presets/Fade';
import { DomServiceLocator } from '../../../../Dom/Dom';
import { Animatable } from '../../../Behaviors/Animatable';
import { Insetable } from '../../../Behaviors/Insetable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { SelectorItemElement } from '../Abstracts/Selector/SelectorItemElement';
import { WizardElement } from './WizardElement';
import { wizardStepElementTemplate } from './WizardStepElementTemplate';
import { wizardStepElementJoyStyle } from './Themes/WizardStepElement.Joy';
import { wizardStepElementMemphisStyle } from './Themes/WizardStepElement.Memphis';
import { wizardStepElementCosmopolitanStyle } from './Themes/WizardStepElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * Wizard step - A component that allows users to navigate through steps to complete a task.
 *
 * @element mosaik-wizard-step
 * @category Selector
 *
 * @slot - The default slot.
 * @slot footer - The footer slot.
 *
 * @public
 */
let WizardStepElement = class WizardStepElement extends Themeable(Animatable(Insetable(SelectorItemElement))) {
    // #region Fields
    _header;
    _subHeader;
    _isActive;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._header = '';
        this._subHeader = '';
        this._isActive = false;
        this.enter = fadeIn;
        this.exit = fadeOut;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @override
     * @readonly
     */
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    static get is() {
        return 'mosaik-wizard-step';
    }
    /**
     * Gets or sets the `header` property.
     *
     * @public
     * @attr
     */
    get header() {
        return this._header;
    }
    set header(value) {
        if (this._header !== value) {
            this._header = value;
            this.requestUpdate('header');
        }
    }
    /**
     * Gets or sets the `subHeader` property.
     *
     * @public
     * @attr
     */
    get subHeader() {
        return this._subHeader;
    }
    set subHeader(value) {
        if (this._subHeader !== value) {
            this._subHeader = value;
            this.requestUpdate('subHeader');
        }
    }
    /**
     * Gets or sets the `isActive` property.
     *
     * @public
     * @attr
     */
    get isActive() {
        return this._isActive;
    }
    set isActive(value) {
        if (this._isActive !== value) {
            this._isActive = value;
            this.requestUpdate('isActive');
        }
    }
    /**
     * Get the item parent.
     *
     * @protected
     * @readonly
     */
    get parent() {
        return DomServiceLocator.current.findAncestor(this, WizardElement.is, { strict: true });
    }
    // #endregion
    // #region Methods
    /**
     * @public
     * @override
     */
    connectedCallback() {
        super.connectedCallback();
        void this.play(this.enter ?? { steps: [] });
    }
    /**
     * @public
     * @override
     */
    disconnectedCallback() {
        void this.play(this.exit ?? { steps: [] });
        super.disconnectedCallback();
    }
    /**
     * @protected
     */
    onIsActivePropertyChanged(_prev, next) {
        if (next) {
            void this.updateComplete.then(() => {
                const index = this.parent.items.indexOf(this);
                this.parent.select(index);
            });
        }
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], WizardStepElement.prototype, "header", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], WizardStepElement.prototype, "subHeader", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], WizardStepElement.prototype, "isActive", null);
__decorate([
    Watch('isActive'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Boolean, Boolean]),
    __metadata("design:returntype", void 0)
], WizardStepElement.prototype, "onIsActivePropertyChanged", null);
WizardStepElement = __decorate([
    Component({
        selector: 'mosaik-wizard-step',
        template: wizardStepElementTemplate,
        themes: {
            joy: wizardStepElementJoyStyle,
            memphis: wizardStepElementMemphisStyle,
            cosmopolitan: wizardStepElementCosmopolitanStyle
        },
        options: {
            mode: 'open',
            delegatesFocus: true
        },
        host: {
            role: 'tabpanel',
            slot: 'steps'
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], WizardStepElement);
export { WizardStepElement };
//# sourceMappingURL=WizardStepElement.js.map