import { MXBaseComponent, AXClosableComponent, AXComponent } from '@acorex/cdk/common';
import { AXButtonComponent } from '@acorex/components/button';
import { AXDecoratorCloseButtonComponent } from '@acorex/components/decorators';
import { AXLoadingComponent } from '@acorex/components/loading';
import { AXTranslationService, AXTranslatorPipe } from '@acorex/core/translation';
import { NgTemplateOutlet, NgComponentOutlet, AsyncPipe } from '@angular/common';
import * as i0 from '@angular/core';
import { InjectionToken, inject, signal, Injectable, input, computed, TemplateRef, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
import { AXOverlayService } from '@acorex/cdk/overlay';

const AX_NOTIFICATION_CONFIG = new InjectionToken('AX_NOTIFICATION_CONFIG', {
    providedIn: 'root',
    factory: () => AXNotificationDefaultConfig,
});
const AXNotificationDefaultConfig = {
    gap: 5,
    timeOut: 2500,
    timeOutProgress: true,
    closeButton: true,
    location: 'top-end',
    limit: 3,
    pauseOnHover: true,
};
function notificationConfig(config = {}) {
    const result = {
        ...AXNotificationDefaultConfig,
        ...config,
    };
    return result;
}

let notificationIdCounter = 0;
class AXNotificationService {
    constructor() {
        this.overlayService = inject(AXOverlayService);
        this.translationService = inject(AXTranslationService);
        this.defaultConfig = inject(AX_NOTIFICATION_CONFIG);
        this.activeNotifications = signal([], ...(ngDevMode ? [{ debugName: "activeNotifications" }] : []));
        this.reservedNotifications = signal([], ...(ngDevMode ? [{ debugName: "reservedNotifications" }] : []));
        this.notificationCounterRef = signal(null, ...(ngDevMode ? [{ debugName: "notificationCounterRef" }] : []));
        this.moreNotificationsColor = signal('primary', ...(ngDevMode ? [{ debugName: "moreNotificationsColor" }] : []));
        this.moreNotificationsLocation = signal('bottom-center', ...(ngDevMode ? [{ debugName: "moreNotificationsLocation" }] : []));
        this.reserveCounter = signal(0, ...(ngDevMode ? [{ debugName: "reserveCounter" }] : []));
    }
    show(config) {
        config = { ...this.defaultConfig, ...config };
        this.moreNotificationsColor.set(config.color);
        this.moreNotificationsLocation.set(config.location);
        if (this.defaultConfig.limit > 0 && this.activeNotifications().length >= this.defaultConfig.limit) {
            const reservedRef = {
                close: () => {
                    console.warn('Reserved notification cannot be closed until it is displayed.');
                },
            };
            this.reservedNotifications.update((prev) => [...prev, { config, reservedRef }]);
            this.handleReservedNotificationCounter();
            return reservedRef;
        }
        return this.displayNotification(config);
    }
    displayNotification(config) {
        const gap = this.defaultConfig.gap;
        const notificationData = {
            buttons: config.buttons,
            icon: config.icon,
            title: config.title,
            content: config.content,
            location: config.location,
            closeButton: config.closeButton ?? true,
            color: config.color,
            timeOut: config.timeOut,
            timeOutProgress: config.timeOutProgress ?? true,
            pauseOnHover: config.pauseOnHover,
        };
        const notificationId = `notification-${++notificationIdCounter}`;
        let internalRef;
        const closeNotification = () => {
            if (internalRef) {
                internalRef.overlayRef.dispose();
                this.activeNotifications.set(this.activeNotifications().filter((n) => n.id !== internalRef.id));
                this.handleShowReservedNotification();
                this.handleReservedNotificationCounter();
                setTimeout(() => {
                    this.reposition(config.location, gap);
                });
            }
        };
        this.overlayService
            .create(AXNotificationComponent, {
            inputs: {
                config: notificationData,
                onClose: closeNotification,
            },
            centered: false,
            panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],
            onDispose: () => {
                // Clean up when disposed externally
                const currentNotifications = this.activeNotifications();
                if (internalRef && currentNotifications.find((n) => n.id === internalRef.id)) {
                    this.activeNotifications.set(currentNotifications.filter((n) => n.id !== internalRef.id));
                    this.handleShowReservedNotification();
                    this.handleReservedNotificationCounter();
                }
            },
        })
            .then((overlayRef) => {
            internalRef = {
                id: notificationId,
                overlayRef,
                config: notificationData,
                close: closeNotification,
            };
            // Position the notification BEFORE adding to activeNotifications
            this.positionNotification(overlayRef.overlayElement, config.location, gap);
            this.activeNotifications.update((prev) => [...prev, internalRef]);
            this.handleReservedNotificationCounter();
        });
        return {
            close: () => {
                closeNotification();
            },
        };
    }
    hideAll() {
        this.reserveCounter.set(0);
        this.reservedNotifications.set([]);
        // Close all active notifications
        this.activeNotifications().forEach((notification) => {
            notification.overlayRef.dispose();
        });
        this.activeNotifications.set([]);
        // Close counter notification if exists
        const counterRef = this.notificationCounterRef();
        if (counterRef) {
            counterRef.overlayRef.dispose();
            this.notificationCounterRef.set(null);
        }
        this.handleReservedNotificationCounter();
    }
    handleShowReservedNotification() {
        if (this.activeNotifications().length > this.defaultConfig.limit - 1)
            return;
        if (!this.reservedNotifications().length)
            return;
        const reserved = this.reservedNotifications()[0];
        this.reservedNotifications.update((prev) => prev.slice(1));
        const displayedRef = this.displayNotification(reserved.config);
        this.handleReservedNotificationCounter();
        reserved.reservedRef.close = displayedRef.close;
    }
    handleReservedNotificationCounter() {
        const reservedCount = this.reservedNotifications().length;
        if (reservedCount === this.reserveCounter())
            return;
        this.reserveCounter.set(reservedCount);
        if (reservedCount === 0 && this.notificationCounterRef() !== null) {
            this.notificationCounterRef().close();
            this.notificationCounterRef.set(null);
            return;
        }
        if (reservedCount > 0) {
            if (this.notificationCounterRef() !== null) {
                this.notificationCounterRef().close();
                this.notificationCounterRef.set(null);
            }
            this.createReservedCounterNotification();
        }
    }
    async createReservedCounterNotification() {
        const gap = this.defaultConfig.gap;
        const opt = {
            closeButton: false,
            color: this.moreNotificationsColor(),
            location: this.moreNotificationsLocation(),
            title: await this.translationService.translateAsync('@acorex:common.notifications.more', {
                params: { number: this.reserveCounter() },
            }),
            timeOutProgress: false,
        };
        const notificationId = `notification-counter-${++notificationIdCounter}`;
        const overlayRef = await this.overlayService.create(AXNotificationComponent, {
            inputs: {
                config: opt,
                onClose: () => {
                    const currentCounterRef = this.notificationCounterRef();
                    if (currentCounterRef) {
                        currentCounterRef.overlayRef.dispose();
                        if (currentCounterRef.id === notificationId) {
                            this.notificationCounterRef.set(null);
                        }
                    }
                },
            },
            centered: false,
            panelClass: ['ax-animate-animated', 'ax-animate-fadeIn', 'ax-animate-faster'],
        });
        const counterInternalRef = {
            id: notificationId,
            overlayRef,
            config: opt,
            close: () => {
                counterInternalRef.overlayRef.dispose();
                if (this.notificationCounterRef()?.id === counterInternalRef.id) {
                    this.notificationCounterRef.set(null);
                }
            },
        };
        this.notificationCounterRef.set(counterInternalRef);
        // Position the counter notification
        this.positionNotification(overlayRef.overlayElement, opt.location, gap);
    }
    positionNotification(element, location, gap) {
        if (!element)
            return;
        const pos = this.getPosition(location) + gap;
        // Override the centered overlay container styles for notification positioning
        element.style.width = 'max-content';
        element.style.height = 'auto';
        element.style.display = 'block';
        element.style.alignItems = '';
        element.style.justifyContent = '';
        // Reset all positioning styles
        element.style.top = '';
        element.style.bottom = '';
        element.style.left = '';
        element.style.right = '';
        element.style.transform = '';
        // Apply position based on location
        switch (location) {
            case 'bottom-center':
                element.style.bottom = pos + 'px';
                element.style.left = '50%';
                element.style.transform = 'translateX(-50%)';
                break;
            case 'bottom-end':
                element.style.bottom = pos + 'px';
                element.style.right = gap + 'px';
                break;
            case 'bottom-start':
                element.style.bottom = pos + 'px';
                element.style.left = gap + 'px';
                break;
            case 'top-center':
                element.style.top = pos + 'px';
                element.style.left = '50%';
                element.style.transform = 'translateX(-50%)';
                break;
            case 'top-end':
                element.style.top = pos + 'px';
                element.style.right = gap + 'px';
                break;
            case 'top-start':
                element.style.top = pos + 'px';
                element.style.left = gap + 'px';
                break;
            case 'center-start':
                element.style.top = '50%';
                element.style.left = gap + 'px';
                element.style.transform = 'translateY(-50%)';
                break;
            case 'center-end':
                element.style.top = '50%';
                element.style.right = gap + 'px';
                element.style.transform = 'translateY(-50%)';
                break;
        }
    }
    reposition(notificationLocation, gap) {
        const list = this.activeNotifications().filter((n) => n.config?.location === notificationLocation);
        list.forEach((notification, index) => {
            const element = notification.overlayRef.overlayElement;
            if (!element)
                return;
            const pos = this.getRepositionPosition(index, gap, list, notificationLocation);
            this.applyRepositionPosition(element, notificationLocation, pos, gap);
        });
    }
    getRepositionPosition(index, gap, list, notificationLocation) {
        if (index === 0)
            return gap;
        const previousNotification = list[index - 1];
        const previousElement = previousNotification.overlayRef.overlayElement;
        if (!previousElement)
            return gap;
        if (notificationLocation.split('-')[0] === 'bottom') {
            return window.innerHeight - previousElement.offsetTop + gap;
        }
        return previousElement.offsetTop + previousElement.offsetHeight + gap;
    }
    applyRepositionPosition(element, location, pos, gap) {
        // Reset transform if needed, then apply position
        const isVerticalCenter = location === 'center-start' || location === 'center-end';
        const isHorizontalCenter = location === 'bottom-center' || location === 'top-center';
        if (location.startsWith('bottom')) {
            element.style.bottom = pos + 'px';
            element.style.top = '';
            if (isHorizontalCenter) {
                element.style.transform = 'translateX(-50%)';
            }
        }
        else if (location.startsWith('top')) {
            element.style.top = pos + 'px';
            element.style.bottom = '';
            if (isHorizontalCenter) {
                element.style.transform = 'translateX(-50%)';
            }
        }
        else if (isVerticalCenter) {
            element.style.top = pos + 'px';
            element.style.bottom = '';
            element.style.transform = '';
        }
    }
    getPosition(location) {
        const list = this.activeNotifications().filter((n) => n.config?.location === location);
        if (list.length === 0)
            return 0;
        const lastNotification = list[list.length - 1];
        const element = lastNotification.overlayRef.overlayElement;
        if (!element)
            return 0;
        if (location.split('-')[0] === 'bottom') {
            return window.innerHeight - element.offsetTop;
        }
        return element.offsetTop + element.offsetHeight;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }] });

/**
 * The Button is a component which detects user interaction and triggers a corresponding event
 *
 * @category Components
 */
class AXNotificationComponent extends MXBaseComponent {
    constructor() {
        super(...arguments);
        /** Notification configuration data */
        this.config = input.required(...(ngDevMode ? [{ debugName: "config" }] : []));
        /** @internal Callback function to close the notification */
        this.onClose = input(...(ngDevMode ? [undefined, { debugName: "onClose" }] : []));
        this.notificationService = inject(AXNotificationService);
        this.isPaused = signal(false, ...(ngDevMode ? [{ debugName: "isPaused" }] : []));
        this.remainingTime = signal(0, ...(ngDevMode ? [{ debugName: "remainingTime" }] : []));
        this.transitionDuration = signal(150, ...(ngDevMode ? [{ debugName: "transitionDuration" }] : []));
        /** Template content if config.content is a TemplateRef */
        this.templateContent = computed(() => {
            const content = this.config().content;
            return content instanceof TemplateRef ? content : null;
        }, ...(ngDevMode ? [{ debugName: "templateContent" }] : []));
        /** Component content if config.content is a component Type */
        this.componentContent = computed(() => {
            const content = this.config().content;
            return typeof content === 'function' ? content : null;
        }, ...(ngDevMode ? [{ debugName: "componentContent" }] : []));
        /** String content if config.content is a string */
        this.stringContent = computed(() => {
            const content = this.config().content;
            return typeof content === 'string' ? content : '';
        }, ...(ngDevMode ? [{ debugName: "stringContent" }] : []));
    }
    ngOnInit() {
        super.ngOnInit();
        this._initIcon();
        this.remainingTime.set(this.config().timeOut);
        this._handleTimeOut();
        this.getHostElement().addEventListener('pointerenter', () => {
            if (!this.config().pauseOnHover)
                return;
            if (this.isPaused())
                return;
            // Only pause if not already paused
            this.isPaused.set(true);
            this.pauseAnimation();
        });
        this.getHostElement().addEventListener('pointerleave', () => {
            if (!this.config().pauseOnHover)
                return;
            if (!this.isPaused())
                return;
            // Only resume if paused
            this.isPaused.set(false);
            this._handleTimeOut();
        });
    }
    pauseAnimation() {
        clearInterval(this.intervalId);
    }
    _handleTimeOut() {
        if (this.config().timeOut) {
            this.intervalId = setInterval(() => {
                this.remainingTime.update((prev) => prev - this.transitionDuration());
                if (this.remainingTime() <= 0) {
                    clearInterval(this.intervalId);
                    this.close();
                }
            }, this.transitionDuration());
        }
    }
    /** @ignore */
    _initIcon() {
        if (!this.config().icon) {
            switch (this.config().color) {
                case 'success':
                    this._icon = 'ax-icon ax-icon-check-circle';
                    break;
                case 'danger':
                    this._icon = 'ax-icon ax-icon-error';
                    break;
                case 'warning':
                    this._icon = 'ax-icon ax-icon-warning';
                    break;
                default:
                    this._icon = this.config().icon || 'ax-icon ax-icon-info';
                    break;
            }
        }
        else {
            this._icon = this.config().icon;
        }
    }
    /** @ignore */
    _handleButtonClick(button) {
        if (button.onClick) {
            button.onClick({ source: button });
        }
    }
    /**
     * Closes the notification.
     */
    close() {
        const closeCallback = this.onClose();
        if (closeCallback) {
            closeCallback();
        }
    }
    /**
     * Closes all notifications.
     */
    closeAll() {
        this.notificationService.hideAll();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: AXNotificationComponent, isStandalone: true, selector: "ax-notification", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, onClose: { classPropertyName: "onClose", publicName: "onClose", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "\"ax-\" + config().color" } }, providers: [
            { provide: AXClosableComponent, useExisting: AXNotificationComponent },
            { provide: AXComponent, useExisting: AXNotificationComponent },
        ], usesInheritance: true, ngImport: i0, template: "<span class=\"ax-notification-icon ax-icon-solid {{ _icon }}\"></span>\n<div class=\"ax-notification-content\">\n  <div class=\"ax-notification-title\">{{ config().title | translate | async }}</div>\n  @if (templateContent()) {\n    <ng-container *ngTemplateOutlet=\"templateContent()\"></ng-container>\n  } @else if (componentContent()) {\n    <ng-container *ngComponentOutlet=\"componentContent()\"></ng-container>\n  } @else {\n    <div>{{ stringContent() | translate | async }}</div>\n  }\n\n  @if (config().buttons?.length) {\n    <div class=\"ax-notification-buttons\">\n      @for (button of config().buttons; track $index) {\n        <ax-button\n          class=\"ax-xs\"\n          [text]=\"button.text | translate | async\"\n          [color]=\"button.color\"\n          [look]=\"button.look\"\n          [disabled]=\"button.disabled\"\n          (onClick)=\"_handleButtonClick(button)\"\n        >\n          @if (button.loading) {\n            <ax-loading></ax-loading>\n          }\n        </ax-button>\n      }\n    </div>\n  }\n</div>\n@if (config().closeButton) {\n  <ax-close-button></ax-close-button>\n}\n@if (config().timeOutProgress && config().timeOut && remainingTime()) {\n  <div\n    class=\"ax-notification-progress\"\n    [style.transition-duration]=\"transitionDuration()\"\n    [style.width]=\"(remainingTime() * 100) / config().timeOut + '%'\"\n  ></div>\n}\n", styles: ["ax-notification.ax-default{--ax-comp-notification-icon-text-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-surface)}.ax-dark ax-notification.ax-default{--ax-comp-notification-icon-text-color: var(--ax-sys-color-on-darkest-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-lightest-surface)}ax-notification.ax-primary{--ax-comp-notification-icon-text-color: var(--ax-sys-color-primary-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-primary-surface)}ax-notification.ax-secondary{--ax-comp-notification-icon-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-secondary-surface)}ax-notification.ax-success{--ax-comp-notification-icon-text-color: var(--ax-sys-color-success-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-success-surface)}ax-notification.ax-warning{--ax-comp-notification-icon-text-color: var(--ax-sys-color-warning-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-warning-surface)}ax-notification.ax-danger{--ax-comp-notification-icon-text-color: var(--ax-sys-color-danger-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-danger-surface)}ax-notification.ax-accent1{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent1-surface)}ax-notification.ax-accent2{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent2-surface)}ax-notification.ax-accent3{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent3-surface)}ax-notification.ax-accent4{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent4-surface)}ax-notification.ax-accent5{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent5-surface)}ax-notification.ax-accent6{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent6-surface)}ax-notification.ax-accent7{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent7-surface)}ax-notification{position:relative;display:flex;width:98vw;overflow:hidden;padding:1rem;--ax-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--ax-shadow-colored: 0 10px 15px -3px var(--ax-shadow-color), 0 4px 6px -4px var(--ax-shadow-color);box-shadow:var(--ax-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-shadow);background-color:rgba(var(--ax-comp-notification-bg-color, var(--ax-sys-color-lightest-surface)));font-size:var(--ax-comp-notification-font-size, .875rem);line-height:var(--ax-comp-notification-line-height, 1.25rem);border-width:var(--ax-comp-notification-border-width, 1px);border-color:rgba(var(--ax-comp-notification-border-color, var(--ax-sys-color-border-lightest-surface)));border-radius:var(--ax-comp-notification-border-radius, var(--ax-sys-border-radius))}@media (min-width: 768px){ax-notification{width:24rem}}ax-notification .ax-notification-icon,ax-notification .ax-icon-close{font-size:1.25rem;line-height:1.75rem;max-width:fit-content;align-items:flex-start}ax-notification .ax-notification-icon{color:rgba(var(--ax-comp-notification-icon-text-color));padding-inline-end:.75rem}ax-notification .ax-notification-content{display:flex;flex:1 1 0%;flex-direction:column;font-weight:400;justify-content:center;color:rgba(var(--ax-comp-notification-text-color, var(--ax-sys-color-on-surface)))}ax-notification .ax-notification-content .ax-notification-title{font-weight:500;line-height:1.5}ax-notification .ax-notification-content .ax-notification-buttons{margin-top:.75rem;display:flex;gap:.75rem}ax-notification .ax-notification-progress{width:100%;bottom:0;height:.25rem;position:absolute;inset-inline-end:0px;inset-inline-start:0px;transition-property:width;transition-timing-function:linear;transition-duration:var(--ax-sys-transition-duration);background-color:rgba(var(--ax-comp-notification-progress-bg-color, 255, 255, 255, .46))}.ax-dark ax-notification{--ax-comp-notification-bg-color: var(--ax-sys-color-darkest-surface);--ax-comp-notification-border-color: var(--ax-sys-color-border-darkest-surface)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "component", type: AXDecoratorCloseButtonComponent, selector: "ax-close-button", inputs: ["closeAll", "icon"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-notification', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        '[class]': '"ax-" + config().color',
                    }, providers: [
                        { provide: AXClosableComponent, useExisting: AXNotificationComponent },
                        { provide: AXComponent, useExisting: AXNotificationComponent },
                    ], imports: [
                        NgTemplateOutlet,
                        NgComponentOutlet,
                        AXButtonComponent,
                        AXLoadingComponent,
                        AXDecoratorCloseButtonComponent,
                        AsyncPipe,
                        AXTranslatorPipe,
                    ], template: "<span class=\"ax-notification-icon ax-icon-solid {{ _icon }}\"></span>\n<div class=\"ax-notification-content\">\n  <div class=\"ax-notification-title\">{{ config().title | translate | async }}</div>\n  @if (templateContent()) {\n    <ng-container *ngTemplateOutlet=\"templateContent()\"></ng-container>\n  } @else if (componentContent()) {\n    <ng-container *ngComponentOutlet=\"componentContent()\"></ng-container>\n  } @else {\n    <div>{{ stringContent() | translate | async }}</div>\n  }\n\n  @if (config().buttons?.length) {\n    <div class=\"ax-notification-buttons\">\n      @for (button of config().buttons; track $index) {\n        <ax-button\n          class=\"ax-xs\"\n          [text]=\"button.text | translate | async\"\n          [color]=\"button.color\"\n          [look]=\"button.look\"\n          [disabled]=\"button.disabled\"\n          (onClick)=\"_handleButtonClick(button)\"\n        >\n          @if (button.loading) {\n            <ax-loading></ax-loading>\n          }\n        </ax-button>\n      }\n    </div>\n  }\n</div>\n@if (config().closeButton) {\n  <ax-close-button></ax-close-button>\n}\n@if (config().timeOutProgress && config().timeOut && remainingTime()) {\n  <div\n    class=\"ax-notification-progress\"\n    [style.transition-duration]=\"transitionDuration()\"\n    [style.width]=\"(remainingTime() * 100) / config().timeOut + '%'\"\n  ></div>\n}\n", styles: ["ax-notification.ax-default{--ax-comp-notification-icon-text-color: var(--ax-sys-color-on-lightest-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-surface)}.ax-dark ax-notification.ax-default{--ax-comp-notification-icon-text-color: var(--ax-sys-color-on-darkest-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-lightest-surface)}ax-notification.ax-primary{--ax-comp-notification-icon-text-color: var(--ax-sys-color-primary-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-primary-surface)}ax-notification.ax-secondary{--ax-comp-notification-icon-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-secondary-surface)}ax-notification.ax-success{--ax-comp-notification-icon-text-color: var(--ax-sys-color-success-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-success-surface)}ax-notification.ax-warning{--ax-comp-notification-icon-text-color: var(--ax-sys-color-warning-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-warning-surface)}ax-notification.ax-danger{--ax-comp-notification-icon-text-color: var(--ax-sys-color-danger-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-danger-surface)}ax-notification.ax-accent1{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent1-surface)}ax-notification.ax-accent2{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent2-surface)}ax-notification.ax-accent3{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent3-surface)}ax-notification.ax-accent4{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent4-surface)}ax-notification.ax-accent5{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent5-surface)}ax-notification.ax-accent6{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent6-surface)}ax-notification.ax-accent7{--ax-comp-notification-icon-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-notification-progress-bg-color: var(--ax-sys-color-accent7-surface)}ax-notification{position:relative;display:flex;width:98vw;overflow:hidden;padding:1rem;--ax-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--ax-shadow-colored: 0 10px 15px -3px var(--ax-shadow-color), 0 4px 6px -4px var(--ax-shadow-color);box-shadow:var(--ax-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-shadow);background-color:rgba(var(--ax-comp-notification-bg-color, var(--ax-sys-color-lightest-surface)));font-size:var(--ax-comp-notification-font-size, .875rem);line-height:var(--ax-comp-notification-line-height, 1.25rem);border-width:var(--ax-comp-notification-border-width, 1px);border-color:rgba(var(--ax-comp-notification-border-color, var(--ax-sys-color-border-lightest-surface)));border-radius:var(--ax-comp-notification-border-radius, var(--ax-sys-border-radius))}@media (min-width: 768px){ax-notification{width:24rem}}ax-notification .ax-notification-icon,ax-notification .ax-icon-close{font-size:1.25rem;line-height:1.75rem;max-width:fit-content;align-items:flex-start}ax-notification .ax-notification-icon{color:rgba(var(--ax-comp-notification-icon-text-color));padding-inline-end:.75rem}ax-notification .ax-notification-content{display:flex;flex:1 1 0%;flex-direction:column;font-weight:400;justify-content:center;color:rgba(var(--ax-comp-notification-text-color, var(--ax-sys-color-on-surface)))}ax-notification .ax-notification-content .ax-notification-title{font-weight:500;line-height:1.5}ax-notification .ax-notification-content .ax-notification-buttons{margin-top:.75rem;display:flex;gap:.75rem}ax-notification .ax-notification-progress{width:100%;bottom:0;height:.25rem;position:absolute;inset-inline-end:0px;inset-inline-start:0px;transition-property:width;transition-timing-function:linear;transition-duration:var(--ax-sys-transition-duration);background-color:rgba(var(--ax-comp-notification-progress-bg-color, 255, 255, 255, .46))}.ax-dark ax-notification{--ax-comp-notification-bg-color: var(--ax-sys-color-darkest-surface);--ax-comp-notification-border-color: var(--ax-sys-color-border-darkest-surface)}\n"] }]
        }], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], onClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "onClose", required: false }] }] } });

class AXNotificationModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationModule, imports: [AXNotificationComponent], exports: [AXNotificationComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationModule, imports: [AXNotificationComponent] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXNotificationModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [AXNotificationComponent],
                    exports: [AXNotificationComponent],
                }]
        }] });

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

export { AXNotificationComponent, AXNotificationDefaultConfig, AXNotificationModule, AXNotificationService, AX_NOTIFICATION_CONFIG, notificationConfig };
//# sourceMappingURL=acorex-components-notification.mjs.map
