// #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 { Disableable } from '../../../Behaviors/Disableable';
import { Themeable } from '../../../Behaviors/Themeable';
import { addInheritanceConsumerController } from '../../../Controllers/InheritanceConsumerController';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { SelectorItemElement } from '../Abstracts/Selector/SelectorItemElement';
import { StepperElement } from './StepperElement';
import { STEPPER_INHERITANCE_CONTEXT } from './StepperInheritanceContext';
import { stepperItemElementTemplate } from './StepperItemElementTemplate';
import { stepperItemElementCosmopolitanStyle } from './Themes/StepperItemElement.Cosmopolitan';
import { stepperItemElementJoyStyle } from './Themes/StepperItemElement.Joy';
import { stepperItemElementMemphisStyle } from './Themes/StepperItemElement.Memphis';
// #endregion
/**
 * Stepper Item - A single step panel within a Stepper workflow component.
 *
 * @description
 * The Stepper Item component represents an individual step within a multi-step workflow. It displays
 * the content for a specific step and includes properties for defining the step's header, description,
 * hint text, icon, and current state (pending, completed, error). The component supports animated
 * transitions when switching between steps and provides a footer slot for step-specific action buttons.
 * Each stepper item is managed by its parent stepper component for activation and navigation.
 *
 * @name Stepper Item
 * @element mosaik-stepper-item
 * @category Selectors
 *
 * @slot - The default slot for the main step content
 * @slot footer - Action buttons or navigation controls for this step
 *
 * @csspart content - The content area wrapper
 * @csspart footer - The footer container
 * @csspart panel - The main panel container
 *
 * @cssprop {String} --stepper-item-font-family - The font family for stepper item text
 * @cssprop {String} --stepper-item-font-letter-spacing - The item font letter spacing CSS custom property.
 * @cssprop {String} --stepper-item-font-line-height - The item font line height CSS custom property.
 * @cssprop {String} --stepper-item-font-size - The item font size CSS custom property.
 * @cssprop {String} --stepper-item-font-text-decoration - The item font text decoration CSS custom property.
 * @cssprop {String} --stepper-item-font-text-transform - The item font text transform CSS custom property.
 * @cssprop {String} --stepper-item-font-weight - The item font weight CSS custom property.
 * @cssprop {String} --stepper-item-gap - The spacing between content and footer
 * @cssprop {String} --stepper-item-padding-bottom - The item padding bottom CSS custom property.
 * @cssprop {String} --stepper-item-padding-left - The item padding left CSS custom property.
 * @cssprop {String} --stepper-item-padding-right - The item padding right CSS custom property.
 * @cssprop {String} --stepper-item-padding-top - The item padding top CSS custom property.
 * @cssprop {String} --stepper-item-panel-padding - The padding inside the panel
 * @cssprop {String} --stepper-item-panel-radius - The border radius of the panel
 * @cssprop {String} --stepper-item-panel-shadow - The drop shadow or elevation effect
 * @cssprop {String} --stepper-item-shadow - The item shadow CSS custom property.
 * @cssprop {String} --stepper-item-shadow-blur - The item shadow blur CSS custom property.
 * @cssprop {String} --stepper-item-shadow-color - The item shadow color CSS custom property.
 * @cssprop {String} --stepper-item-shadow-offset-x - The item shadow offset x CSS custom property.
 * @cssprop {String} --stepper-item-shadow-offset-y - The item shadow offset y CSS custom property.
 * @cssprop {String} --stepper-item-shadow-spread - The item shadow spread CSS custom property.
 * @cssprop {String} --stepper-item-transition-duration - The item transition duration CSS custom property.
 * @cssprop {String} --stepper-item-transition-mode - The item transition mode CSS custom property.
 * @cssprop {String} --stepper-item-transition-property - The item transition property CSS custom property.
 * @cssprop {String} --stepper-item-translate - The item translate CSS custom property.
 *
 * @fires connected {ConnectedEvent} - Fired when connected to the DOM
 * @fires changed {PropertyChangedEvent} - Fired when properties change
 *
 * @example
 * Basic stepper item:
 * ```html
 * <mosaik-stepper-item header="Personal Info">
 *   <mosaik-form>
 *     <mosaik-input label="Name"></mosaik-input>
 *     <mosaik-input label="Email"></mosaik-input>
 *   </mosaik-form>
 * </mosaik-stepper-item>
 * ```
 *
 * @example
 * Stepper item with description and footer:
 * ```html
 * <mosaik-stepper-item
 *   header="Review Details"
 *   description="Please review and confirm your information">
 *   <p>Your information will be saved.</p>
 *   <div slot="footer">
 *     <mosaik-button variant="default">Back</mosaik-button>
 *     <mosaik-button variant="primary">Confirm</mosaik-button>
 *   </div>
 * </mosaik-stepper-item>
 * ```
 *
 * @example
 * Stepper item with state and hint:
 * ```html
 * <mosaik-stepper-item
 *   header="Upload Files"
 *   state="completed"
 *   hint="Optional">
 *   <p>Files uploaded successfully.</p>
 * </mosaik-stepper-item>
 * ```
 *
 * @public
 */
let StepperItemElement = class StepperItemElement extends Themeable(Animatable(Disableable(SelectorItemElement))) {
    // #region Fields
    _inheritance = addInheritanceConsumerController(this, {
        context: STEPPER_INHERITANCE_CONTEXT
    });
    _header;
    _description;
    _hint;
    _icon;
    _state;
    _isActive;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._header = '';
        this._description = '';
        this._hint = '';
        this._icon = '';
        this._state = 'pending';
        this._isActive = false;
        this.enter = fadeIn;
        this.exit = fadeOut;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     *
     * @public
     * @static
     * @override
     * @readonly
     */
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    static get is() {
        return 'mosaik-stepper-item';
    }
    /**
     * @inheritdoc
     * When used inside a Stepper, inherits the stepper's disabled state unless explicitly set.
     *
     * @public
     * @override
     */
    get disabled() {
        return this._inheritance.get('disabled', super.disabled);
    }
    set disabled(value) {
        this._inheritance.markExplicit('disabled');
        super.disabled = value;
    }
    /**
     * 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 `description` property.
     *
     * @public
     * @attr
     */
    get description() {
        return this._description;
    }
    set description(value) {
        if (this._description !== value) {
            this._description = value;
            this.requestUpdate('description');
        }
    }
    /**
     * Gets or sets the `hint` property.
     *
     * @public
     * @attr
     */
    get hint() {
        return this._hint;
    }
    set hint(value) {
        if (this._hint !== value) {
            this._hint = value;
            this.requestUpdate('hint');
        }
    }
    /**
     * Gets or sets the `icon` property.
     *
     * @public
     */
    get icon() {
        return this._icon;
    }
    set icon(value) {
        if (this._icon !== value) {
            this._icon = value;
            this.requestUpdate('icon');
        }
    }
    /**
     * Gets or sets the `state` property.
     *
     * @public
     * @attr
     */
    get state() {
        return this._state;
    }
    set state(value) {
        if (this._state !== value) {
            this._state = value;
            this.requestUpdate('state');
        }
    }
    /**
     * 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, StepperElement.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])
], StepperItemElement.prototype, "header", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], StepperItemElement.prototype, "description", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], StepperItemElement.prototype, "hint", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], StepperItemElement.prototype, "icon", null);
__decorate([
    Attribute({
        type: String,
        useDefault: true
    }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], StepperItemElement.prototype, "state", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], StepperItemElement.prototype, "isActive", null);
__decorate([
    Watch('isActive'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Boolean, Boolean]),
    __metadata("design:returntype", void 0)
], StepperItemElement.prototype, "onIsActivePropertyChanged", null);
StepperItemElement = __decorate([
    Component({
        selector: 'mosaik-stepper-item',
        template: stepperItemElementTemplate,
        themes: {
            joy: stepperItemElementJoyStyle,
            memphis: stepperItemElementMemphisStyle,
            cosmopolitan: stepperItemElementCosmopolitanStyle
        },
        host: {
            role: 'tabpanel',
            slot: 'steps'
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], StepperItemElement);
export { StepperItemElement };
//# sourceMappingURL=StepperItemElement.js.map