import { ButtonComponent } from '@agorapulse/ui-components/button';
import { CloseButtonComponent } from '@agorapulse/ui-components/close-button';
import { UI_COMPONENTS_SYMBOLS } from '@agorapulse/ui-components/providers';
import { SymbolRegistry, apInfoFill, apErrorFill, apWarningFill, apTrash, apRoundedCheckFill, apClose, apFeatureLock, SymbolComponent } from '@agorapulse/ui-symbol';
import * as i0 from '@angular/core';
import { inject, ElementRef, input, EventEmitter, booleanAttribute, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';

// Increasing integer for generating unique ids for infobox components.
let nextUniqueId = 0;
class InfoboxComponent {
    symbolRegistry = inject(SymbolRegistry);
    elementRef = inject(ElementRef);
    buttonId = null;
    buttonLabel = undefined;
    buttonDataTrack = null;
    buttonSymbolId = input(...(ngDevMode ? [undefined, { debugName: "buttonSymbolId" }] : /* istanbul ignore next */ []));
    closable = false;
    title;
    type = 'info';
    buttonClicked = new EventEmitter();
    closed = new EventEmitter();
    displayDirection = 'horizontal';
    defaultButtonId = '';
    symbolIds = {
        info: 'info_fill',
        warning: 'warning_fill',
        error: 'error_fill',
        success: 'rounded-check_fill',
        'feature-lock': 'feature-lock',
    };
    constructor() {
        this.symbolRegistry.registerSymbols([
            apInfoFill,
            apErrorFill,
            apWarningFill,
            apTrash,
            apRoundedCheckFill,
            apClose,
            apFeatureLock,
        ]);
        this.symbolRegistry.withSymbols(...(inject(UI_COMPONENTS_SYMBOLS, { optional: true })?.flat() ?? []));
        this.defaultButtonId = `infobox-button-${++nextUniqueId}`;
    }
    onClickButton() {
        this.buttonClicked.emit();
    }
    onCloseInfobox() {
        this.elementRef.nativeElement.remove();
        this.closed.emit();
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: InfoboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: InfoboxComponent, isStandalone: true, selector: "ap-infobox", inputs: { buttonId: { classPropertyName: "buttonId", publicName: "buttonId", isSignal: false, isRequired: false, transformFunction: null }, buttonLabel: { classPropertyName: "buttonLabel", publicName: "buttonLabel", isSignal: false, isRequired: false, transformFunction: null }, buttonDataTrack: { classPropertyName: "buttonDataTrack", publicName: "buttonDataTrack", isSignal: false, isRequired: false, transformFunction: null }, buttonSymbolId: { classPropertyName: "buttonSymbolId", publicName: "buttonSymbolId", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, title: { classPropertyName: "title", publicName: "title", isSignal: false, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { buttonClicked: "buttonClicked", closed: "closed" }, ngImport: i0, template: "<div\n    class=\"main\"\n    [class.info]=\"type === 'info'\"\n    [class.warning]=\"type === 'warning'\"\n    [class.error]=\"type === 'error'\"\n    [class.success]=\"type === 'success'\"\n    [class.feature-lock]=\"type === 'feature-lock'\"\n    [class.has-title]=\"!!title\">\n    <div class=\"status-banner\"></div>\n    <div class=\"wrapper\">\n        <div class=\"symbol-content\">\n            <div class=\"symbol-wrapper\">\n                <ap-symbol\n                    class=\"status\"\n                    size=\"sm\"\n                    [symbolId]=\"symbolIds[type]\" />\n            </div>\n            <div class=\"content\">\n                <div class=\"texts\">\n                    @if (title) {\n                        <span class=\"title\">\n                            {{ title }}\n                        </span>\n                    }\n                    <span class=\"text\">\n                        <ng-content />\n                    </span>\n                </div>\n                @if (buttonLabel) {\n                    <ap-button\n                        name=\"infobox-button\"\n                        symbolPosition=\"left\"\n                        [symbolId]=\"buttonSymbolId()\"\n                        [id]=\"buttonId ?? defaultButtonId\"\n                        [attr.data-track]=\"buttonDataTrack\"\n                        [config]=\"{\n                            style: 'stroked',\n                            color: 'grey'\n                        }\"\n                        (click)=\"onClickButton()\">\n                        {{ buttonLabel }}\n                    </ap-button>\n                }\n            </div>\n        </div>\n        @if (closable) {\n            <ap-close-button (closed)=\"onCloseInfobox()\" />\n        }\n    </div>\n</div>\n", styles: ["ap-infobox{--comp-icon-size: 20px;container:infobox/inline-size;display:block;width:100%;max-width:100%}ap-infobox .main{display:flex;font-size:var(--ref-font-size-sm);line-height:var(--ref-font-line-height-sm);align-items:center;color:var(--ref-color-grey-100);padding:var(--comp-infobox-padding-top) var(--comp-infobox-padding-right) var(--comp-infobox-padding-bottom) var(--comp-infobox-padding-left);border-radius:var(--comp-infobox-border-radius);overflow:hidden;font-family:var(--comp-infobox-text-title-font-family);box-sizing:border-box;position:relative;gap:var(--comp-infobox-button-margin-left)}ap-infobox .main .status-banner{position:absolute;left:0;top:0;width:4px;height:100%}ap-infobox .main ap-symbol{align-self:center}ap-infobox .main .symbol-wrapper{margin-top:1px}ap-infobox .main.has-title .symbol-wrapper{margin-top:var(--ref-spacing-xxxs)}ap-infobox .main .wrapper{display:flex;justify-content:space-between;width:100%;align-items:flex-start;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content{display:flex;gap:var(--ref-spacing-xs);align-items:flex-start;flex:1}ap-infobox .main .wrapper .symbol-content .content{display:flex;flex-direction:column;align-items:flex-start;flex:1;justify-content:space-between;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content .content ap-button button{width:unset}ap-infobox .main .wrapper .symbol-content .content .texts{display:flex;flex-direction:column;overflow-wrap:anywhere}ap-infobox .main .wrapper .symbol-content .content .texts .title{font-weight:var(--comp-infobox-text-title-weight);font-family:var(--comp-infobox-text-title-font-family);font-size:var(--comp-infobox-text-title-size);line-height:var(--comp-infobox-text-title-line-height)}ap-infobox .main.info{background-color:var(--comp-infobox-info-background-color)}ap-infobox .main.info ap-symbol.status{align-self:baseline;color:var(--comp-infobox-info-icon-color)}ap-infobox .main.info .status-banner{background-color:var(--comp-infobox-info-border-left-color)}ap-infobox .main.warning{background-color:var(--comp-infobox-warning-background-color)}ap-infobox .main.warning ap-symbol.status{color:var(--comp-infobox-warning-icon-color)}ap-infobox .main.warning .status-banner{background-color:var(--comp-infobox-warning-border-left-color)}ap-infobox .main.error{background-color:var(--comp-infobox-error-background-color)}ap-infobox .main.error ap-symbol.status{color:var(--comp-infobox-error-icon-color)}ap-infobox .main.error .status-banner{background-color:var(--comp-infobox-error-border-left-color)}ap-infobox .main.success{background-color:var(--comp-infobox-success-background-color)}ap-infobox .main.success ap-symbol.status{color:var(--comp-infobox-success-icon-color)}ap-infobox .main.success .status-banner{background-color:var(--comp-infobox-success-border-left-color)}ap-infobox .main.feature-lock{background-color:var(--comp-infobox-feature-lock-background-color)}ap-infobox .main.feature-lock ap-symbol.status{color:var(--comp-infobox-feature-lock-icon-color)}ap-infobox .main.feature-lock .status-banner{background-color:var(--comp-infobox-feature-lock-border-left-color)}@container infobox (min-width: 588px){.main .wrapper{align-items:center!important}.main .wrapper .symbol-wrapper{margin-top:0!important}.main .wrapper .symbol-content{align-items:center!important}.main .wrapper .symbol-content .content{flex-direction:row!important;align-items:center!important}}\n"], dependencies: [{ kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }, { kind: "component", type: ButtonComponent, selector: "ap-button", inputs: ["ariaLabel", "disabled", "name", "form", "config", "loading", "locked", "menuTrigger", "symbolPosition", "symbolId"], outputs: ["menuOpened", "menuClosed", "click", "focus", "blur"] }, { kind: "component", type: CloseButtonComponent, selector: "ap-close-button", inputs: ["disabled", "ariaLabel", "dataTest"], outputs: ["closed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: InfoboxComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ap-infobox', imports: [SymbolComponent, ButtonComponent, CloseButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div\n    class=\"main\"\n    [class.info]=\"type === 'info'\"\n    [class.warning]=\"type === 'warning'\"\n    [class.error]=\"type === 'error'\"\n    [class.success]=\"type === 'success'\"\n    [class.feature-lock]=\"type === 'feature-lock'\"\n    [class.has-title]=\"!!title\">\n    <div class=\"status-banner\"></div>\n    <div class=\"wrapper\">\n        <div class=\"symbol-content\">\n            <div class=\"symbol-wrapper\">\n                <ap-symbol\n                    class=\"status\"\n                    size=\"sm\"\n                    [symbolId]=\"symbolIds[type]\" />\n            </div>\n            <div class=\"content\">\n                <div class=\"texts\">\n                    @if (title) {\n                        <span class=\"title\">\n                            {{ title }}\n                        </span>\n                    }\n                    <span class=\"text\">\n                        <ng-content />\n                    </span>\n                </div>\n                @if (buttonLabel) {\n                    <ap-button\n                        name=\"infobox-button\"\n                        symbolPosition=\"left\"\n                        [symbolId]=\"buttonSymbolId()\"\n                        [id]=\"buttonId ?? defaultButtonId\"\n                        [attr.data-track]=\"buttonDataTrack\"\n                        [config]=\"{\n                            style: 'stroked',\n                            color: 'grey'\n                        }\"\n                        (click)=\"onClickButton()\">\n                        {{ buttonLabel }}\n                    </ap-button>\n                }\n            </div>\n        </div>\n        @if (closable) {\n            <ap-close-button (closed)=\"onCloseInfobox()\" />\n        }\n    </div>\n</div>\n", styles: ["ap-infobox{--comp-icon-size: 20px;container:infobox/inline-size;display:block;width:100%;max-width:100%}ap-infobox .main{display:flex;font-size:var(--ref-font-size-sm);line-height:var(--ref-font-line-height-sm);align-items:center;color:var(--ref-color-grey-100);padding:var(--comp-infobox-padding-top) var(--comp-infobox-padding-right) var(--comp-infobox-padding-bottom) var(--comp-infobox-padding-left);border-radius:var(--comp-infobox-border-radius);overflow:hidden;font-family:var(--comp-infobox-text-title-font-family);box-sizing:border-box;position:relative;gap:var(--comp-infobox-button-margin-left)}ap-infobox .main .status-banner{position:absolute;left:0;top:0;width:4px;height:100%}ap-infobox .main ap-symbol{align-self:center}ap-infobox .main .symbol-wrapper{margin-top:1px}ap-infobox .main.has-title .symbol-wrapper{margin-top:var(--ref-spacing-xxxs)}ap-infobox .main .wrapper{display:flex;justify-content:space-between;width:100%;align-items:flex-start;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content{display:flex;gap:var(--ref-spacing-xs);align-items:flex-start;flex:1}ap-infobox .main .wrapper .symbol-content .content{display:flex;flex-direction:column;align-items:flex-start;flex:1;justify-content:space-between;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content .content ap-button button{width:unset}ap-infobox .main .wrapper .symbol-content .content .texts{display:flex;flex-direction:column;overflow-wrap:anywhere}ap-infobox .main .wrapper .symbol-content .content .texts .title{font-weight:var(--comp-infobox-text-title-weight);font-family:var(--comp-infobox-text-title-font-family);font-size:var(--comp-infobox-text-title-size);line-height:var(--comp-infobox-text-title-line-height)}ap-infobox .main.info{background-color:var(--comp-infobox-info-background-color)}ap-infobox .main.info ap-symbol.status{align-self:baseline;color:var(--comp-infobox-info-icon-color)}ap-infobox .main.info .status-banner{background-color:var(--comp-infobox-info-border-left-color)}ap-infobox .main.warning{background-color:var(--comp-infobox-warning-background-color)}ap-infobox .main.warning ap-symbol.status{color:var(--comp-infobox-warning-icon-color)}ap-infobox .main.warning .status-banner{background-color:var(--comp-infobox-warning-border-left-color)}ap-infobox .main.error{background-color:var(--comp-infobox-error-background-color)}ap-infobox .main.error ap-symbol.status{color:var(--comp-infobox-error-icon-color)}ap-infobox .main.error .status-banner{background-color:var(--comp-infobox-error-border-left-color)}ap-infobox .main.success{background-color:var(--comp-infobox-success-background-color)}ap-infobox .main.success ap-symbol.status{color:var(--comp-infobox-success-icon-color)}ap-infobox .main.success .status-banner{background-color:var(--comp-infobox-success-border-left-color)}ap-infobox .main.feature-lock{background-color:var(--comp-infobox-feature-lock-background-color)}ap-infobox .main.feature-lock ap-symbol.status{color:var(--comp-infobox-feature-lock-icon-color)}ap-infobox .main.feature-lock .status-banner{background-color:var(--comp-infobox-feature-lock-border-left-color)}@container infobox (min-width: 588px){.main .wrapper{align-items:center!important}.main .wrapper .symbol-wrapper{margin-top:0!important}.main .wrapper .symbol-content{align-items:center!important}.main .wrapper .symbol-content .content{flex-direction:row!important;align-items:center!important}}\n"] }]
        }], ctorParameters: () => [], propDecorators: { buttonId: [{
                type: Input
            }], buttonLabel: [{
                type: Input
            }], buttonDataTrack: [{
                type: Input
            }], buttonSymbolId: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonSymbolId", required: false }] }], closable: [{
                type: Input,
                args: [{
                        transform: booleanAttribute,
                    }]
            }], title: [{
                type: Input
            }], type: [{
                type: Input
            }], buttonClicked: [{
                type: Output
            }], closed: [{
                type: Output
            }] } });

/**
 * Generated bundle index. Do not edit.
 */

export { InfoboxComponent };
//# sourceMappingURL=agorapulse-ui-components-infobox.mjs.map
