// #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 { Themeable } from '../../../../Controls/Behaviors/Themeable';
import { DomServiceLocator } from '../../../../Dom/Dom';
import { Slottable } from '../../../Behaviors/Slottable';
import { TextFormattable } from '../../../Behaviors/TextFormattable';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { cardHeaderElementTemplate } from './CardHeaderElementTemplate';
import { CardSubTitleElement } from './CardSubTitleElement';
import { CardTitleElement } from './CardTitleElement';
import { cardHeaderElementJoyStyle } from './Themes/CardHeaderElement.Joy';
import { cardHeaderElementRetroStyle } from './Themes/CardHeaderElement.Retro';
import { cardHeaderElementCosmopolitanStyle } from './Themes/CardHeaderElement.Cosmopolitan';
// #endregion
/**
 * CardHeader - A component that represents the header section of a card.
 *
 * @description This component is used to display the header content of a card, typically containing the title and subtitle. It provides a structured layout for the main information presented in the card.
 *
 * @name CardHeader
 * @element mosaik-card-header
 * @category UI Components
 *
 * @slot prefix - The slot for placing prefix content (e.g., icons).
 * @slot header - The slot for placing the main header content.
 * @slot subHeader - The slot for placing sub-header content.
 * @slot - The default slot for placing additional content within the header.
 * @slot suffix - The slot for placing suffix content (e.g., buttons or icons).
 *
 * @csspart heading - The part representing the heading area of the card header.
 *
 * @cssprop {unknown} --card-header-padding-top - The padding-top property for the card header.
 * @cssprop {unknown} --card-header-padding-right - The padding-right property for the card header.
 * @cssprop {unknown} --card-header-padding-bottom - The padding-bottom property for the card header.
 * @cssprop {unknown} --card-header-padding-left - The padding-left property for the card header.
 * @cssprop {unknown} --card-header-gap - The gap property between elements in the card header.
 *
 * @dependency {CardTitleElement} - The Card Title element used within the header.
 * @dependency {CardSubTitleElement} - The Card Sub Title element used within the header.
 *
 * @example
 * ```html
 * <mosaik-card-header>
 *   <div slot="prefix"><mosaik-icon name="star"></mosaik-icon></div>
 *   <div slot="header">Card Title</div>
 *   <div slot="subHeader">Card Subtitle</div>
 *   <div slot="suffix"><mosaik-button>Action</mosaik-button></div>
 * </mosaik-card-header>
 * ```
 *
 * @public
 */
let CardHeaderElement = class CardHeaderElement extends Themeable(TextFormattable(Slottable(CustomElement))) {
    // #region Fields
    _text;
    _subText;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._text = '';
        this._subText = '';
    }
    // #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-card-header';
    }
    /**
     * Gets or sets the `text` property.
     *
     * @public
     */
    get text() {
        return this._text;
    }
    set text(value) {
        if (this._text !== value) {
            this._text = value;
            this.requestUpdate('text');
        }
    }
    /**
     * Gets or sets the `subText` property.
     *
     * @public
     */
    get subText() {
        return this._subText;
    }
    set subText(value) {
        if (this._subText !== value) {
            this._subText = value;
            this.requestUpdate('subText');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     * @override
     */
    onApplyTemplate() {
        super.onApplyTemplate();
        // TODO: create any kind of obsevation here
        const card = DomServiceLocator.current.findShadowDomHost(this, { strict: true });
        if (this._text === '' && card.header !== '') {
            this.text = card.header;
        }
        if (this._subText === '' && card.subHeader !== '') {
            this.subText = card.subHeader;
        }
        if (this.formatter === null && card.formatter !== null) {
            this.formatter = card.formatter;
        }
    }
};
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], CardHeaderElement.prototype, "text", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], CardHeaderElement.prototype, "subText", null);
CardHeaderElement = __decorate([
    Component({
        selector: 'mosaik-card-header',
        template: cardHeaderElementTemplate,
        themes: {
            joy: cardHeaderElementJoyStyle,
            retro: cardHeaderElementRetroStyle,
            cosmopolitan: cardHeaderElementCosmopolitanStyle
        },
        host: {
            slot: 'header'
        },
        imports: [
            CardTitleElement,
            CardSubTitleElement
        ]
    }),
    __metadata("design:paramtypes", [])
], CardHeaderElement);
export { CardHeaderElement };
//# sourceMappingURL=CardHeaderElement.js.map