import * as i0 from '@angular/core';
import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ViewChild, Injectable, Inject } from '@angular/core';
import * as i1 from '@angular/common';
import { CommonModule, DOCUMENT } from '@angular/common';
import { fromEvent } from 'rxjs';
import { take } from 'rxjs/operators';
import * as i2 from '@ironsource/fusion-ui/components/icon/v1';
import { IconModule } from '@ironsource/fusion-ui/components/icon/v1';
import { IconButtonComponent, ButtonComponent } from '@ironsource/fusion-ui/components/button/v4';

const SnackbarIconByType = {
    default: 'ph/fill/info',
    error: 'ph/fill/warning-octagon',
    success: 'ph/fill/check-circle',
    warning: 'ph/fill/warning'
};

const _c0 = ["snackbar"];
function SnackbarComponent_div_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 8);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(ctx_r1.message);
} }
function SnackbarComponent_fusion_button_9_Template(rf, ctx) { if (rf & 1) {
    const _r5 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "fusion-button", 9);
    i0.ɵɵlistener("click", function SnackbarComponent_fusion_button_9_Template_fusion_button_click_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r5); const button_r3 = restoredCtx.$implicit; const ctx_r4 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r4.actionButtonsClicked(button_r3)); });
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const button_r3 = ctx.$implicit;
    i0.ɵɵproperty("color", button_r3.color)("variant", button_r3.variant)("size", button_r3.size)("disabled", button_r3.disabled)("startIconName", button_r3.startIcon)("endIconName", button_r3.endIcon);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(button_r3.label);
} }
class SnackbarComponent {
    /** @internal */
    get statusIcon() {
        return SnackbarIconByType[this.type];
    }
    constructor(renderer) {
        this.renderer = renderer;
        this.type = 'default';
        this.duration = 3000;
        this.location = 'top-right';
        this.closed = new EventEmitter();
        /** @internal */
        this.shownByService = false; // util set from service
    }
    ngOnInit() {
        if (this.duration) {
            setTimeout(this.closeSnackbar.bind(this), this.duration);
        }
    }
    ngAfterViewInit() {
        this.renderer.addClass(this.snackbarView.nativeElement, this.getShownTransition());
    }
    /** @internal */
    onCloseClicked() {
        this.closeSnackbar();
    }
    actionButtonsClicked(button) {
        if (typeof button?.onClick === 'function') {
            button.onClick();
        }
    }
    closeSnackbar() {
        this.setCloseTransition();
        fromEvent(this.snackbarView.nativeElement, 'animationend')
            .pipe(take(1))
            .subscribe(data => {
            this.closed.emit();
        });
    }
    setCloseTransition() {
        let onCloseClass = 'fu-fadeout'; // default and center;
        if (this.location) {
            if (this.location.endsWith('-right')) {
                onCloseClass = 'fu-slide-out-right';
            }
            else if (this.location.endsWith('-left')) {
                onCloseClass = 'fu-slide-out-left';
            }
        }
        if (onCloseClass !== 'fu-fadeout' && this.shownByService) {
            // in case toast opened from service and has slide animation
            this.renderer.setStyle(this.snackbarView.nativeElement, 'position', 'relative');
        }
        // set on close class with animation
        this.renderer.addClass(this.snackbarView.nativeElement, onCloseClass);
    }
    getShownTransition() {
        return this.getShownTransitionByLocation(this.location);
    }
    getShownTransitionByLocation(location) {
        if (!!location && location.startsWith('top-')) {
            return 'fu-top-fadein';
        }
        else if (!!location && location.startsWith('bottom-')) {
            return 'fu-bottom-fadein';
        }
        else {
            return 'fu-fadein';
        }
    }
    static { this.ɵfac = function SnackbarComponent_Factory(t) { return new (t || SnackbarComponent)(i0.ɵɵdirectiveInject(i0.Renderer2)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SnackbarComponent, selectors: [["fusion-snackbar"]], viewQuery: function SnackbarComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, 5);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.snackbarView = _t.first);
        } }, inputs: { title: "title", message: "message", type: "type", duration: "duration", location: "location", actionButtons: "actionButtons" }, outputs: { closed: "closed" }, standalone: true, features: [i0.ɵɵStandaloneFeature], decls: 10, vars: 7, consts: [["snackbar", ""], [1, "fu-title"], [1, "fu-state-icon", 3, "name"], [1, "fu-title-text"], ["size", "small", "iconName", "ph/x", 1, "fu-close-button", 3, "click"], ["class", "fu-description", 4, "ngIf"], [1, "fu-content"], [3, "color", "variant", "size", "disabled", "startIconName", "endIconName", "click", 4, "ngFor", "ngForOf"], [1, "fu-description"], [3, "color", "variant", "size", "disabled", "startIconName", "endIconName", "click"]], template: function SnackbarComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", null, 0)(2, "div", 1);
            i0.ɵɵelement(3, "fusion-icon", 2);
            i0.ɵɵelementStart(4, "div", 3);
            i0.ɵɵtext(5);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(6, "fusion-icon-button", 4);
            i0.ɵɵlistener("click", function SnackbarComponent_Template_fusion_icon_button_click_6_listener() { return ctx.onCloseClicked(); });
            i0.ɵɵelementEnd()();
            i0.ɵɵtemplate(7, SnackbarComponent_div_7_Template, 2, 1, "div", 5);
            i0.ɵɵelementStart(8, "div", 6);
            i0.ɵɵtemplate(9, SnackbarComponent_fusion_button_9_Template, 2, 7, "fusion-button", 7);
            i0.ɵɵelementEnd()();
        } if (rf & 2) {
            i0.ɵɵclassMapInterpolate1("fu-snackbar-wrapper fu-state-", ctx.type, "");
            i0.ɵɵadvance(3);
            i0.ɵɵproperty("name", ctx.statusIcon);
            i0.ɵɵadvance(2);
            i0.ɵɵtextInterpolate(ctx.title);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngIf", ctx.message);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngForOf", ctx.actionButtons);
        } }, dependencies: [CommonModule, i1.NgForOf, i1.NgIf, IconModule, i2.IconComponent, IconButtonComponent, ButtonComponent], styles: ["@import\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap\";@keyframes _ngcontent-%COMP%_rotation{0%{transform:rotate(0)}to{transform:rotate(359deg)}}@keyframes _ngcontent-%COMP%_shineAnimation{0%{background-position:-750px 0}to{background-position:750px 0}}.fusion-v4[_ngcontent-%COMP%]{--background-default: #FFFFFF;--background-paper: hsl(0, 0%, 99%);--background-model-elevation: #FFFFFF;--background-backdrop: hsla(0, 0%, 0%, .11);--background-paper-elevation-0: hsl(0, 0%, 97.5%);--background-paper-elevation-1: hsl(0, 0%, 94.6%);--background-paper-elevation-2: hsl(0, 0%, 92%);--background-paper-elevation-3: hsl(0, 0%, 89.5%);--background-paper-elevation-4: hsl(0, 0%, 86.8%);--background-paper-elevation-5: hsl(0, 0%, 83%);--background-paper-elevation-6: hsl(0, 0%, 73.2%);--background-paper-elevation-7: hsl(0, 0%, 55.2%);--background-paper-elevation-8: hsl(0, 0%, 50.3%);--background-paper-elevation-9: hsl(0, 0%, 39.3%);--action-primary: hsl(0, 0%, 12.5%);--action-active: hsl(0, 0%, 50.3%);--action-hover: hsla(0, 0%, 0%, .05);--action-selected: hsl(0, 0%, 92%);--action-disabled: hsl(0, 0%, 87%);--action-disabled-background: hsl(0, 0%, 95%);--action-focus: hsl(0, 0%, 92%);--action-outlined-border: hsl(0, 0%, 73%);--default-light: hsl(0, 0%, 89.5%);--default-main: hsl(0, 0%, 94.51%);--default-dark: hsl(0, 0%, 92%);--default-outlined-border: hsl(0, 0%, 73.2%);--default-contrast-text: hsl(0, 0%, 12.5%);--default-button-contrast-text: hsl(0, 0%, 0%);--common-white: #FFFFFF;--common-black: #000000;--common-inverse-white: #FFFFFF;--common-inverse-black: #000000;--common-divider: hsl(0, 0%, 86.8%);--common-divider-elevation-0: hsl(0, 0%, 89%);--text-primary: hsl(0, 0%, 12.5%);--text-secondary: hsl(0, 0%, 39.3%);--text-disabled: hsl(0, 0%, 73.33%);--primary-lighter: hsl(209, 100%, 96.5%);--primary-light: hsl(209, 95%, 90.1%);--primary-main: hsl(206, 100%, 50%);--primary-main-8-p: hsla(206, 100%, 50%, .08);--primary-main-50-p: hsla(206, 100%, 50%, .5);--primary-dark: hsl(208, 93.5%, 47.4%);--primary-darker: hsl(211, 90%, 42%);--primary-outlined-border: hsl(206, 100%, 50%);--primary-contrast-text: hsl(216, 71%, 23%);--primary-button-contrast-text: hsl(0, 0%, 100%);--info-lighter: hsl(223, 98.4%, 97.1%);--info-light: hsl(224, 87.1%, 92%);--info-main: hsl(226, 70%, 55.5%);--info-main-8-p: hsla(226, 70%, 55.5%, .08);--info-main-50-p: hsla(226, 70%, 55.5%, .5);--info-dark: hsl(226, 58.6%, 51.3%);--info-darker: hsl(226, 55%, 45%);--info-outlined-border: hsl(226, 70%, 55.5%);--info-contrast-text: hsl(226, 50%, 24%);--info-button-contrast-text: hsl(0, 0%, 100%);--success-lighter: hsl(139, 55.2%, 94.5%);--success-light: hsl(141, 43.7%, 86%);--success-main: hsl(151, 55%, 41.5%);--success-main-8-p: hsla(151, 55%, 41.5%, .08);--success-main-50-p: hsla(151, 55%, 41.5%, .5);--success-dark: hsl(152, 57.5%, 37.6%);--success-darker: hsl(153, 67%, 28.5%);--success-outlined-border: hsl(151, 55%, 41.5%);--success-contrast-text: hsl(155, 40%, 16.5%);--success-button-contrast-text: hsl(0, 0%, 100%);--warning-lighter: hsl(45, 100%, 90.8%);--warning-light: hsl(40, 100%, 81.5%);--warning-main: hsl(42, 100%, 62%);--warning-main-8-p: hsla(42, 100%, 62%, .08);--warning-main-50-p: hsla(42, 100%, 62%, .5);--warning-dark: hsl(42, 100%, 55%);--warning-darker: hsl(25, 50%, 38%);--warning-outlined-border: hsl(42, 100%, 62%);--warning-contrast-text: hsl(25, 40%, 22%);--warning-button-contrast-text: hsl(24, 40%, 22%);--error-lighter: hsl(0, 100%, 96.8%);--error-light: hsl(0, 90.2%, 91.9%);--error-main: hsl(358, 75%, 59%);--error-main-8-p: hsla(358, 75%, 59%, .08);--error-main-50-p: hsla(358, 75%, 59%, .5);--error-dark: hsl(358, 67.4%, 54.6%);--error-darker: hsl(358, 65%, 47%);--error-outlined-border: hsl(358, 75%, 59%);--error-contrast-text: hsl(350, 63%, 24%);--error-button-contrast-text: hsl(0, 0%, 100%);--aba: #FFC134;--abb: #4F4FF5}.fusion-v4[_ngcontent-%COMP%]{--spacing-tockenset: 0px;--spacing-25: 2px;--spacing-50: 4px;--spacing-75: 6px;--spacing-100: 8px;--spacing-125: 10px;--spacing-150: 12px;--spacing-200: 16px;--spacing-250: 20px;--spacing-300: 24px;--spacing-400: 32px;--spacing-500: 40px;--spacing-600: 48px;--spacing-700: 56px;--spacing-800: 64px;--spacing-900: 72px;--spacing-1000: 80px}.fusion-v4[_ngcontent-%COMP%]{--box-shadow-xs: 0px 1px 2px 0px rgba(16, 24, 40, .05);--box-shadow-sm: 0px 1px 3px 0px rgba(16, 24, 40, .1), 0px 1px 2px 0px rgba(16, 24, 40, .06);--box-shadow-md: 0px 4px 8px -2px rgba(16, 24, 40, .1), 0px 2px 4px -2px rgba(16, 24, 40, .06);--box-shadow-lg: 0px 12px 16px -4px rgba(16, 24, 40, .08), 0px 4px 6px -2px rgba(16, 24, 40, .03);--box-shadow-xl: 0px 8px 8px -4px rgba(16, 24, 40, .03), 0px 20px 24px -6px rgba(16, 24, 40, .08);--box-shadow-xxl: 0px 24px 48px -12px rgba(16, 24, 40, .18);--box-shadow-xxxl: 0px 19px 32px 2px rgba(44, 45, 45, .14);--box-shadow-slg: 0px 27px 27px 2px rgba(44, 45, 45, .14)}.fusion-v4[_ngcontent-%COMP%]{--border-radius-xs: 2px;--border-radius-sm: 4px;--border-radius-md: 6px;--border-radius-lg: 8px;--border-radius-xl: 16px;--border-radius-full: 100px}.font-v4-bold[_ngcontent-%COMP%], .font-v4-tab-label-2[_ngcontent-%COMP%], .font-v4-chart-2[_ngcontent-%COMP%], .font-v4-chart-1[_ngcontent-%COMP%]{font-family:Inter,sans-serif;font-weight:700;-webkit-font-smoothing:antialiased}.font-v4-semibold[_ngcontent-%COMP%], .font-v4-chip-label[_ngcontent-%COMP%], .font-v4-table-label[_ngcontent-%COMP%], .font-v4-button[_ngcontent-%COMP%], .font-v4-heading-6[_ngcontent-%COMP%], .font-v4-heading-5[_ngcontent-%COMP%], [_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]   .fu-title[_ngcontent-%COMP%], .font-v4-heading-4[_ngcontent-%COMP%], .font-v4-heading-3[_ngcontent-%COMP%], .font-v4-heading-2[_ngcontent-%COMP%], .font-v4-heading-1[_ngcontent-%COMP%], .font-v4-title[_ngcontent-%COMP%]{font-family:Inter,sans-serif;font-weight:600;-webkit-font-smoothing:antialiased}.font-v4-medium[_ngcontent-%COMP%], .font-v4-tab-label-1[_ngcontent-%COMP%], .font-v4-input-label[_ngcontent-%COMP%], .font-v4-overline[_ngcontent-%COMP%], .font-v4-subtitle-2[_ngcontent-%COMP%], .font-v4-subtitle-1[_ngcontent-%COMP%]{font-family:Inter,sans-serif;font-weight:500;-webkit-font-smoothing:antialiased}.font-v4-regular[_ngcontent-%COMP%], .font-v4-caption[_ngcontent-%COMP%], [_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]   .fu-description[_ngcontent-%COMP%], .font-v4-body-2[_ngcontent-%COMP%], .font-v4-body-1[_ngcontent-%COMP%]{font-family:Inter,sans-serif;font-weight:400;-webkit-font-smoothing:antialiased}.font-v4-title[_ngcontent-%COMP%]{font-size:2.5rem;line-height:3rem;letter-spacing:-.055rem}.font-v4-heading-1[_ngcontent-%COMP%]{font-size:1.5rem;line-height:1.75rem;letter-spacing:-.0285rem}.font-v4-heading-2[_ngcontent-%COMP%]{font-size:1.125rem;line-height:1.75rem;letter-spacing:-.01575rem}.font-v4-heading-3[_ngcontent-%COMP%]{font-size:1rem;line-height:1.5rem;letter-spacing:-.011rem}[_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]   .fu-title[_ngcontent-%COMP%], .font-v4-heading-4[_ngcontent-%COMP%]{font-size:.875rem;line-height:1rem;letter-spacing:unset}.font-v4-heading-5[_ngcontent-%COMP%]{font-size:.8125rem;line-height:16px;letter-spacing:unset}.font-v4-heading-6[_ngcontent-%COMP%]{font-size:.75rem;line-height:.75rem;letter-spacing:0}.font-v4-body-1[_ngcontent-%COMP%]{font-size:.875rem;line-height:1.25rem;letter-spacing:-.00525rem}[_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]   .fu-description[_ngcontent-%COMP%], .font-v4-body-2[_ngcontent-%COMP%]{font-size:.8125rem;line-height:1.25rem;letter-spacing:-.00244rem}.font-v4-subtitle-1[_ngcontent-%COMP%]{font-size:.875rem;line-height:1.25rem;letter-spacing:-.00525rem}.font-v4-subtitle-2[_ngcontent-%COMP%]{font-size:.8125rem;line-height:1.25rem;letter-spacing:-.00244rem}.font-v4-chart-1[_ngcontent-%COMP%]{font-size:1.5rem;line-height:1.5rem;letter-spacing:-.015rem}.font-v4-chart-2[_ngcontent-%COMP%]{font-size:1.25rem;line-height:1.25rem;letter-spacing:-.0125rem}.font-v4-button[_ngcontent-%COMP%]{font-size:.875rem;line-height:1.25rem;letter-spacing:.00875rem}.font-v4-overline[_ngcontent-%COMP%]{font-size:.75rem;line-height:1rem;letter-spacing:.045rem;text-transform:uppercase}.font-v4-caption[_ngcontent-%COMP%]{font-size:.75rem;line-height:1rem}.font-v4-table-label[_ngcontent-%COMP%]{font-size:.8125rem;line-height:1.25rem;letter-spacing:.00813rem}.font-v4-input-label[_ngcontent-%COMP%]{font-size:.8125rem;line-height:1rem;letter-spacing:.00813rem}.font-v4-tab-label-1[_ngcontent-%COMP%], .font-v4-tab-label-2[_ngcontent-%COMP%]{font-size:.875rem;line-height:1rem}.font-v4-chip-label[_ngcontent-%COMP%]{font-size:.75rem;line-height:1rem}@keyframes _ngcontent-%COMP%_top-fadein{0%{top:-1rem;opacity:1}to{top:1rem;opacity:1}}@keyframes _ngcontent-%COMP%_bottom-fadein{0%{bottom:-1rem;opacity:0}to{bottom:1rem;opacity:1}}@keyframes _ngcontent-%COMP%_fadein{0%{opacity:0}to{opacity:1}}@keyframes _ngcontent-%COMP%_fadeout{0%{opacity:1}to{opacity:0;margin-top:-8px}}@keyframes _ngcontent-%COMP%_slide-out-right{0%{right:1rem;opacity:1}to{right:-360px;opacity:0}}@keyframes _ngcontent-%COMP%_slide-out-left{0%{left:1rem;opacity:1}to{left:-360px;opacity:0}}[_nghost-%COMP%]{padding:0;display:flex;margin:0 0 var(--snackbar-margin-bottom, 8px)}[_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none;width:360px;display:flex;flex-direction:column;align-items:flex-start;gap:14px;align-self:stretch;padding:var(--spacing-150, 12px) var(--spacing-200, 16px);background-color:var(--background-model-elevation, #FFFFFF);border-radius:12px;border:solid 1px var(--common-divider-elevation-0, hsl(0, 0%, 89%));box-shadow:var(--box-shadow-md, 0px 4px 8px -2px rgba(16, 24, 40, .1), 0px 2px 4px -2px rgba(16, 24, 40, .06))}[_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]   .fu-close-button[_ngcontent-%COMP%]{margin-left:auto}[_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]   .fu-state-icon[_ngcontent-%COMP%]{width:20px;height:20px;color:var(--action-active, hsl(0, 0%, 50.3%))}[_nghost-%COMP%]   .fu-snackbar-wrapper.fu-state-error[_ngcontent-%COMP%]   .fu-state-icon[_ngcontent-%COMP%]{color:var(--error-main, hsl(358, 75%, 59%))}[_nghost-%COMP%]   .fu-snackbar-wrapper.fu-state-success[_ngcontent-%COMP%]   .fu-state-icon[_ngcontent-%COMP%]{color:var(--success-main, hsl(151, 55%, 41.5%))}[_nghost-%COMP%]   .fu-snackbar-wrapper.fu-state-warning[_ngcontent-%COMP%]   .fu-state-icon[_ngcontent-%COMP%]{color:var(--warning-main, hsl(42, 100%, 62%))}[_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]   .fu-title[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:8px;color:var(--text-primary, hsl(0, 0%, 12.5%))}[_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]   .fu-description[_ngcontent-%COMP%]{color:var(--text-secondary, hsl(0, 0%, 39.3%));padding:0 28px}[_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]   .fu-content[_ngcontent-%COMP%]{padding:0 28px;display:flex;gap:8px}[_nghost-%COMP%]   .fu-snackbar-wrapper[_ngcontent-%COMP%]   .fu-content[_ngcontent-%COMP%]:empty{display:none}[_nghost-%COMP%]   .fu-fadein[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_fadein .5s}[_nghost-%COMP%]   .fu-top-fadein[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_top-fadein .5s}[_nghost-%COMP%]   .fu-bottom-fadein[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_bottom-fadein .5s}[_nghost-%COMP%]   .fu-fadeout[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_fadeout .5s}[_nghost-%COMP%]   .fu-slide-out-right[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_slide-out-right .8s}[_nghost-%COMP%]   .fu-slide-out-left[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_slide-out-left .8s}"], changeDetection: 0 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SnackbarComponent, [{
        type: Component,
        args: [{ selector: 'fusion-snackbar', standalone: true, imports: [CommonModule, IconModule, IconButtonComponent, ButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #snackbar class=\"fu-snackbar-wrapper fu-state-{{type}}\">\n    <div class=\"fu-title\">\n        <fusion-icon class=\"fu-state-icon\" [name]=\"statusIcon\"></fusion-icon>\n        <div class=\"fu-title-text\">{{title}}</div>\n        <fusion-icon-button class=\"fu-close-button\" size=\"small\" iconName=\"ph/x\" (click)=\"onCloseClicked()\"></fusion-icon-button>\n    </div>\n    <div *ngIf=\"message\" class=\"fu-description\">{{message}}</div>\n    <div class=\"fu-content\">\n        <fusion-button *ngFor=\"let button of actionButtons\"\n                       [color]=\"button.color\"\n                       [variant]=\"button.variant\"\n                       [size]=\"button.size\"\n                       [disabled]=\"button.disabled\"\n                       [startIconName]=\"button.startIcon\"\n                       [endIconName]=\"button.endIcon\"\n                       (click)=\"actionButtonsClicked(button)\"\n        >{{button.label}}</fusion-button>\n    </div>\n</div>\n", styles: ["@import\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap\";@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(359deg)}}@keyframes shineAnimation{0%{background-position:-750px 0}to{background-position:750px 0}}.fusion-v4{--background-default: #FFFFFF;--background-paper: hsl(0, 0%, 99%);--background-model-elevation: #FFFFFF;--background-backdrop: hsla(0, 0%, 0%, .11);--background-paper-elevation-0: hsl(0, 0%, 97.5%);--background-paper-elevation-1: hsl(0, 0%, 94.6%);--background-paper-elevation-2: hsl(0, 0%, 92%);--background-paper-elevation-3: hsl(0, 0%, 89.5%);--background-paper-elevation-4: hsl(0, 0%, 86.8%);--background-paper-elevation-5: hsl(0, 0%, 83%);--background-paper-elevation-6: hsl(0, 0%, 73.2%);--background-paper-elevation-7: hsl(0, 0%, 55.2%);--background-paper-elevation-8: hsl(0, 0%, 50.3%);--background-paper-elevation-9: hsl(0, 0%, 39.3%);--action-primary: hsl(0, 0%, 12.5%);--action-active: hsl(0, 0%, 50.3%);--action-hover: hsla(0, 0%, 0%, .05);--action-selected: hsl(0, 0%, 92%);--action-disabled: hsl(0, 0%, 87%);--action-disabled-background: hsl(0, 0%, 95%);--action-focus: hsl(0, 0%, 92%);--action-outlined-border: hsl(0, 0%, 73%);--default-light: hsl(0, 0%, 89.5%);--default-main: hsl(0, 0%, 94.51%);--default-dark: hsl(0, 0%, 92%);--default-outlined-border: hsl(0, 0%, 73.2%);--default-contrast-text: hsl(0, 0%, 12.5%);--default-button-contrast-text: hsl(0, 0%, 0%);--common-white: #FFFFFF;--common-black: #000000;--common-inverse-white: #FFFFFF;--common-inverse-black: #000000;--common-divider: hsl(0, 0%, 86.8%);--common-divider-elevation-0: hsl(0, 0%, 89%);--text-primary: hsl(0, 0%, 12.5%);--text-secondary: hsl(0, 0%, 39.3%);--text-disabled: hsl(0, 0%, 73.33%);--primary-lighter: hsl(209, 100%, 96.5%);--primary-light: hsl(209, 95%, 90.1%);--primary-main: hsl(206, 100%, 50%);--primary-main-8-p: hsla(206, 100%, 50%, .08);--primary-main-50-p: hsla(206, 100%, 50%, .5);--primary-dark: hsl(208, 93.5%, 47.4%);--primary-darker: hsl(211, 90%, 42%);--primary-outlined-border: hsl(206, 100%, 50%);--primary-contrast-text: hsl(216, 71%, 23%);--primary-button-contrast-text: hsl(0, 0%, 100%);--info-lighter: hsl(223, 98.4%, 97.1%);--info-light: hsl(224, 87.1%, 92%);--info-main: hsl(226, 70%, 55.5%);--info-main-8-p: hsla(226, 70%, 55.5%, .08);--info-main-50-p: hsla(226, 70%, 55.5%, .5);--info-dark: hsl(226, 58.6%, 51.3%);--info-darker: hsl(226, 55%, 45%);--info-outlined-border: hsl(226, 70%, 55.5%);--info-contrast-text: hsl(226, 50%, 24%);--info-button-contrast-text: hsl(0, 0%, 100%);--success-lighter: hsl(139, 55.2%, 94.5%);--success-light: hsl(141, 43.7%, 86%);--success-main: hsl(151, 55%, 41.5%);--success-main-8-p: hsla(151, 55%, 41.5%, .08);--success-main-50-p: hsla(151, 55%, 41.5%, .5);--success-dark: hsl(152, 57.5%, 37.6%);--success-darker: hsl(153, 67%, 28.5%);--success-outlined-border: hsl(151, 55%, 41.5%);--success-contrast-text: hsl(155, 40%, 16.5%);--success-button-contrast-text: hsl(0, 0%, 100%);--warning-lighter: hsl(45, 100%, 90.8%);--warning-light: hsl(40, 100%, 81.5%);--warning-main: hsl(42, 100%, 62%);--warning-main-8-p: hsla(42, 100%, 62%, .08);--warning-main-50-p: hsla(42, 100%, 62%, .5);--warning-dark: hsl(42, 100%, 55%);--warning-darker: hsl(25, 50%, 38%);--warning-outlined-border: hsl(42, 100%, 62%);--warning-contrast-text: hsl(25, 40%, 22%);--warning-button-contrast-text: hsl(24, 40%, 22%);--error-lighter: hsl(0, 100%, 96.8%);--error-light: hsl(0, 90.2%, 91.9%);--error-main: hsl(358, 75%, 59%);--error-main-8-p: hsla(358, 75%, 59%, .08);--error-main-50-p: hsla(358, 75%, 59%, .5);--error-dark: hsl(358, 67.4%, 54.6%);--error-darker: hsl(358, 65%, 47%);--error-outlined-border: hsl(358, 75%, 59%);--error-contrast-text: hsl(350, 63%, 24%);--error-button-contrast-text: hsl(0, 0%, 100%);--aba: #FFC134;--abb: #4F4FF5}.fusion-v4{--spacing-tockenset: 0px;--spacing-25: 2px;--spacing-50: 4px;--spacing-75: 6px;--spacing-100: 8px;--spacing-125: 10px;--spacing-150: 12px;--spacing-200: 16px;--spacing-250: 20px;--spacing-300: 24px;--spacing-400: 32px;--spacing-500: 40px;--spacing-600: 48px;--spacing-700: 56px;--spacing-800: 64px;--spacing-900: 72px;--spacing-1000: 80px}.fusion-v4{--box-shadow-xs: 0px 1px 2px 0px rgba(16, 24, 40, .05);--box-shadow-sm: 0px 1px 3px 0px rgba(16, 24, 40, .1), 0px 1px 2px 0px rgba(16, 24, 40, .06);--box-shadow-md: 0px 4px 8px -2px rgba(16, 24, 40, .1), 0px 2px 4px -2px rgba(16, 24, 40, .06);--box-shadow-lg: 0px 12px 16px -4px rgba(16, 24, 40, .08), 0px 4px 6px -2px rgba(16, 24, 40, .03);--box-shadow-xl: 0px 8px 8px -4px rgba(16, 24, 40, .03), 0px 20px 24px -6px rgba(16, 24, 40, .08);--box-shadow-xxl: 0px 24px 48px -12px rgba(16, 24, 40, .18);--box-shadow-xxxl: 0px 19px 32px 2px rgba(44, 45, 45, .14);--box-shadow-slg: 0px 27px 27px 2px rgba(44, 45, 45, .14)}.fusion-v4{--border-radius-xs: 2px;--border-radius-sm: 4px;--border-radius-md: 6px;--border-radius-lg: 8px;--border-radius-xl: 16px;--border-radius-full: 100px}.font-v4-bold,.font-v4-tab-label-2,.font-v4-chart-2,.font-v4-chart-1{font-family:Inter,sans-serif;font-weight:700;-webkit-font-smoothing:antialiased}.font-v4-semibold,.font-v4-chip-label,.font-v4-table-label,.font-v4-button,.font-v4-heading-6,.font-v4-heading-5,:host .fu-snackbar-wrapper .fu-title,.font-v4-heading-4,.font-v4-heading-3,.font-v4-heading-2,.font-v4-heading-1,.font-v4-title{font-family:Inter,sans-serif;font-weight:600;-webkit-font-smoothing:antialiased}.font-v4-medium,.font-v4-tab-label-1,.font-v4-input-label,.font-v4-overline,.font-v4-subtitle-2,.font-v4-subtitle-1{font-family:Inter,sans-serif;font-weight:500;-webkit-font-smoothing:antialiased}.font-v4-regular,.font-v4-caption,:host .fu-snackbar-wrapper .fu-description,.font-v4-body-2,.font-v4-body-1{font-family:Inter,sans-serif;font-weight:400;-webkit-font-smoothing:antialiased}.font-v4-title{font-size:2.5rem;line-height:3rem;letter-spacing:-.055rem}.font-v4-heading-1{font-size:1.5rem;line-height:1.75rem;letter-spacing:-.0285rem}.font-v4-heading-2{font-size:1.125rem;line-height:1.75rem;letter-spacing:-.01575rem}.font-v4-heading-3{font-size:1rem;line-height:1.5rem;letter-spacing:-.011rem}:host .fu-snackbar-wrapper .fu-title,.font-v4-heading-4{font-size:.875rem;line-height:1rem;letter-spacing:unset}.font-v4-heading-5{font-size:.8125rem;line-height:16px;letter-spacing:unset}.font-v4-heading-6{font-size:.75rem;line-height:.75rem;letter-spacing:0}.font-v4-body-1{font-size:.875rem;line-height:1.25rem;letter-spacing:-.00525rem}:host .fu-snackbar-wrapper .fu-description,.font-v4-body-2{font-size:.8125rem;line-height:1.25rem;letter-spacing:-.00244rem}.font-v4-subtitle-1{font-size:.875rem;line-height:1.25rem;letter-spacing:-.00525rem}.font-v4-subtitle-2{font-size:.8125rem;line-height:1.25rem;letter-spacing:-.00244rem}.font-v4-chart-1{font-size:1.5rem;line-height:1.5rem;letter-spacing:-.015rem}.font-v4-chart-2{font-size:1.25rem;line-height:1.25rem;letter-spacing:-.0125rem}.font-v4-button{font-size:.875rem;line-height:1.25rem;letter-spacing:.00875rem}.font-v4-overline{font-size:.75rem;line-height:1rem;letter-spacing:.045rem;text-transform:uppercase}.font-v4-caption{font-size:.75rem;line-height:1rem}.font-v4-table-label{font-size:.8125rem;line-height:1.25rem;letter-spacing:.00813rem}.font-v4-input-label{font-size:.8125rem;line-height:1rem;letter-spacing:.00813rem}.font-v4-tab-label-1,.font-v4-tab-label-2{font-size:.875rem;line-height:1rem}.font-v4-chip-label{font-size:.75rem;line-height:1rem}@keyframes top-fadein{0%{top:-1rem;opacity:1}to{top:1rem;opacity:1}}@keyframes bottom-fadein{0%{bottom:-1rem;opacity:0}to{bottom:1rem;opacity:1}}@keyframes fadein{0%{opacity:0}to{opacity:1}}@keyframes fadeout{0%{opacity:1}to{opacity:0;margin-top:-8px}}@keyframes slide-out-right{0%{right:1rem;opacity:1}to{right:-360px;opacity:0}}@keyframes slide-out-left{0%{left:1rem;opacity:1}to{left:-360px;opacity:0}}:host{padding:0;display:flex;margin:0 0 var(--snackbar-margin-bottom, 8px)}:host .fu-snackbar-wrapper{-webkit-user-select:none;user-select:none;width:360px;display:flex;flex-direction:column;align-items:flex-start;gap:14px;align-self:stretch;padding:var(--spacing-150, 12px) var(--spacing-200, 16px);background-color:var(--background-model-elevation, #FFFFFF);border-radius:12px;border:solid 1px var(--common-divider-elevation-0, hsl(0, 0%, 89%));box-shadow:var(--box-shadow-md, 0px 4px 8px -2px rgba(16, 24, 40, .1), 0px 2px 4px -2px rgba(16, 24, 40, .06))}:host .fu-snackbar-wrapper .fu-close-button{margin-left:auto}:host .fu-snackbar-wrapper .fu-state-icon{width:20px;height:20px;color:var(--action-active, hsl(0, 0%, 50.3%))}:host .fu-snackbar-wrapper.fu-state-error .fu-state-icon{color:var(--error-main, hsl(358, 75%, 59%))}:host .fu-snackbar-wrapper.fu-state-success .fu-state-icon{color:var(--success-main, hsl(151, 55%, 41.5%))}:host .fu-snackbar-wrapper.fu-state-warning .fu-state-icon{color:var(--warning-main, hsl(42, 100%, 62%))}:host .fu-snackbar-wrapper .fu-title{width:100%;display:flex;align-items:center;gap:8px;color:var(--text-primary, hsl(0, 0%, 12.5%))}:host .fu-snackbar-wrapper .fu-description{color:var(--text-secondary, hsl(0, 0%, 39.3%));padding:0 28px}:host .fu-snackbar-wrapper .fu-content{padding:0 28px;display:flex;gap:8px}:host .fu-snackbar-wrapper .fu-content:empty{display:none}:host .fu-fadein{animation:fadein .5s}:host .fu-top-fadein{animation:top-fadein .5s}:host .fu-bottom-fadein{animation:bottom-fadein .5s}:host .fu-fadeout{animation:fadeout .5s}:host .fu-slide-out-right{animation:slide-out-right .8s}:host .fu-slide-out-left{animation:slide-out-left .8s}\n"] }]
    }], () => [{ type: i0.Renderer2 }], { title: [{
            type: Input
        }], message: [{
            type: Input
        }], type: [{
            type: Input
        }], duration: [{
            type: Input
        }], location: [{
            type: Input
        }], actionButtons: [{
            type: Input
        }], closed: [{
            type: Output
        }], snackbarView: [{
            type: ViewChild,
            args: ['snackbar']
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SnackbarComponent, { className: "SnackbarComponent", filePath: "snackbar.component.ts", lineNumber: 28 }); })();

/*
 * Created on 2020.11.4 By Andy Kononenko (andyk@ironsrc.com)
 */
const SNACKBAR_HOLDER_CLASS_NAME = 'fu-snackbar-holder';
const SNACKBAR_LOCATION_STYLE_MAP = {
    common: {
        position: 'fixed',
        zIndex: '9999'
    },
    'top-right': {
        top: '1rem',
        right: '1rem'
    },
    'top-left': {
        top: '1rem',
        left: '1rem'
    },
    'top-center': {
        top: '1rem',
        left: '41%'
    },
    'bottom-right': {
        bottom: '1rem',
        right: '1rem'
    },
    'bottom-left': {
        bottom: '1rem',
        left: '1rem'
    },
    'bottom-center': {
        bottom: '1rem',
        left: '41%'
    }
};

class SnackbarService {
    constructor(renderer, appRef, vcr, document) {
        this.renderer = renderer;
        this.appRef = appRef;
        this.vcr = vcr;
        this.document = document;
    }
    show(configuration) {
        const snackbarLocation = configuration.location || 'top-right';
        const snackbarHostElement = this.ensureHostElement(snackbarLocation);
        const snackbarComponentRef = this.createToastComponentRef({ ...configuration, ...{ location: snackbarLocation } });
        this.appendElementLocation(snackbarLocation, snackbarHostElement, snackbarComponentRef.hostView.rootNodes[0]);
        this.removeOnClose(snackbarComponentRef);
    }
    ensureHostElement(location) {
        const selector = `.${SNACKBAR_HOLDER_CLASS_NAME}.${location}`;
        let snackbarHolderElement = this.document.body.querySelector(selector);
        let useLocation = location;
        if (!snackbarHolderElement) {
            snackbarHolderElement = this.renderer.createElement('div');
            if (!SNACKBAR_LOCATION_STYLE_MAP.hasOwnProperty(location)) {
                useLocation = 'top-right';
            }
            this.setStyleToElement(snackbarHolderElement, { ...SNACKBAR_LOCATION_STYLE_MAP.common, ...SNACKBAR_LOCATION_STYLE_MAP[useLocation] }, useLocation);
            this.renderer.appendChild(this.document.body, snackbarHolderElement);
        }
        return snackbarHolderElement;
    }
    setStyleToElement(element, snackbarHolderStyleMap, location) {
        Object.keys(snackbarHolderStyleMap).forEach(key => {
            this.renderer.setStyle(element, key, snackbarHolderStyleMap[key]);
        });
        this.renderer.addClass(element, SNACKBAR_HOLDER_CLASS_NAME);
        this.renderer.addClass(element, location);
    }
    createToastComponentRef(snackbarConfiguration) {
        const snackbarComponentRef = this.vcr.createComponent(SnackbarComponent);
        Object.keys(snackbarConfiguration).forEach(key => {
            snackbarComponentRef.instance[key] = snackbarConfiguration[key];
        });
        return snackbarComponentRef;
    }
    removeOnClose(componentRef) {
        componentRef.instance.closed.pipe(take(1)).subscribe(() => {
            this.appRef.detachView(componentRef.hostView);
            componentRef.destroy();
        });
    }
    appendElementLocation(location, snackbarHostElement, snackbarElement) {
        if (location.startsWith('top-')) {
            snackbarHostElement.prepend(snackbarElement);
        }
        else {
            snackbarHostElement.appendChild(snackbarElement);
        }
    }
    static { this.ɵfac = function SnackbarService_Factory(t) { return new (t || SnackbarService)(i0.ɵɵinject(i0.Renderer2), i0.ɵɵinject(i0.ApplicationRef), i0.ɵɵinject(i0.ViewContainerRef), i0.ɵɵinject(DOCUMENT)); }; }
    static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: SnackbarService, factory: SnackbarService.ɵfac, providedIn: 'root' }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SnackbarService, [{
        type: Injectable,
        args: [{
                providedIn: 'root'
            }]
    }], () => [{ type: i0.Renderer2 }, { type: i0.ApplicationRef }, { type: i0.ViewContainerRef }, { type: Document, decorators: [{
                type: Inject,
                args: [DOCUMENT]
            }] }], null); })();

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

export { SNACKBAR_HOLDER_CLASS_NAME, SNACKBAR_LOCATION_STYLE_MAP, SnackbarComponent, SnackbarIconByType, SnackbarService };
//# sourceMappingURL=ironsource-fusion-ui-components-snackbar-v4.mjs.map
