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;
};
import { MelodicComponent, html } from '@melodicdev/core';
import { alertTemplate } from './alert.template.js';
import { alertStyles } from './alert.styles.js';
/**
 * ml-alert - Alert/notification banner component
 *
 * @example
 * ```html
 * <ml-alert variant="info" title="Information">
 *   This is an informational message.
 * </ml-alert>
 *
 * <ml-alert variant="success" dismissible>
 *   Your changes have been saved.
 * </ml-alert>
 * ```
 *
 * @slot default - Alert message content
 * @slot icon - Custom icon (optional)
 * @fires ml:dismiss - Emitted when dismiss button is clicked
 */
let AlertComponent = class AlertComponent {
    constructor() {
        /** Alert variant/type */
        this.variant = 'info';
        /** Optional title */
        this.title = '';
        /** Show dismiss button */
        this.dismissible = false;
        this.handleDismiss = () => {
            this.elementRef.dispatchEvent(new CustomEvent('ml:dismiss', {
                bubbles: true,
                composed: true
            }));
            // Optionally hide the alert
            this.elementRef.setAttribute('hidden', '');
        };
        this.renderDefaultIcon = () => {
            const icons = {
                info: 'info',
                success: 'check-circle',
                warning: 'warning',
                error: 'x-circle'
            };
            return html `<ml-icon icon="${icons[this.variant]}"></ml-icon>`;
        };
    }
};
AlertComponent = __decorate([
    MelodicComponent({
        selector: 'ml-alert',
        template: alertTemplate,
        styles: alertStyles,
        attributes: ['variant', 'title', 'dismissible']
    })
], AlertComponent);
export { AlertComponent };
