import * as i0 from '@angular/core';
import { Component, Input, HostBinding, NgModule } from '@angular/core';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import { Color } from '@mintplayer/ng-bootstrap';
import { Subject, BehaviorSubject, combineLatest, map, takeUntil } from 'rxjs';

class BsProgressComponent {
    constructor() {
        // @HostBinding('class.progress') private progressClass = true;
        this.height = null;
        this.isIndeterminate = false;
        this.progressClass = true;
    }
}
BsProgressComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsProgressComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
BsProgressComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BsProgressComponent, selector: "bs-progress", inputs: { height: "height", isIndeterminate: "isIndeterminate" }, host: { properties: { "style.height.px": "this.height", "class.d-block": "this.progressClass", "class.overflow-hidden": "this.progressClass" } }, ngImport: i0, template: "<div class=\"progress\">\n    <ng-content *ngIf=\"!isIndeterminate\"></ng-content>\n    <div *ngIf=\"isIndeterminate\" class=\"progress-bar progress-bar-infinite bg-primary\" role=\"progressbar\" aria-valuenow=\"infinite\"></div>\n</div>", styles: ["@keyframes progress-bar-stripes{0%{background-position-x:1rem}}:host .progress{--bs-progress-height: 1rem;--bs-progress-font-size: .75rem;--bs-progress-bg: #e9ecef;--bs-progress-border-radius: .375rem;--bs-progress-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .075);--bs-progress-bar-color: #fff;--bs-progress-bar-bg: #0d6efd;--bs-progress-bar-transition: width .6s ease;display:flex;height:var(--bs-progress-height);overflow:hidden;font-size:var(--bs-progress-font-size);background-color:var(--bs-progress-bg);border-radius:var(--bs-progress-border-radius)}:host .progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:var(--bs-progress-bar-color);text-align:center;white-space:nowrap;background-color:var(--bs-progress-bar-bg);transition:var(--bs-progress-bar-transition)}@media (prefers-reduced-motion: reduce){:host .progress-bar{transition:none}}:host .progress-bar-striped{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:var(--bs-progress-height) var(--bs-progress-height)}:host .progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media (prefers-reduced-motion: reduce){:host .progress-bar-animated{animation:none}}:host .progress-bar-infinite{animation:progress-infinite 1.5s infinite}@keyframes progress-infinite{0%{width:10%;margin-left:0%}25%{width:70%;margin-left:15%}50%{width:10%;margin-left:90%}75%{width:70%;margin-left:15%}to{width:10%;margin-left:0%}}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsProgressComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bs-progress', template: "<div class=\"progress\">\n    <ng-content *ngIf=\"!isIndeterminate\"></ng-content>\n    <div *ngIf=\"isIndeterminate\" class=\"progress-bar progress-bar-infinite bg-primary\" role=\"progressbar\" aria-valuenow=\"infinite\"></div>\n</div>", styles: ["@keyframes progress-bar-stripes{0%{background-position-x:1rem}}:host .progress{--bs-progress-height: 1rem;--bs-progress-font-size: .75rem;--bs-progress-bg: #e9ecef;--bs-progress-border-radius: .375rem;--bs-progress-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .075);--bs-progress-bar-color: #fff;--bs-progress-bar-bg: #0d6efd;--bs-progress-bar-transition: width .6s ease;display:flex;height:var(--bs-progress-height);overflow:hidden;font-size:var(--bs-progress-font-size);background-color:var(--bs-progress-bg);border-radius:var(--bs-progress-border-radius)}:host .progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:var(--bs-progress-bar-color);text-align:center;white-space:nowrap;background-color:var(--bs-progress-bar-bg);transition:var(--bs-progress-bar-transition)}@media (prefers-reduced-motion: reduce){:host .progress-bar{transition:none}}:host .progress-bar-striped{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:var(--bs-progress-height) var(--bs-progress-height)}:host .progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media (prefers-reduced-motion: reduce){:host .progress-bar-animated{animation:none}}:host .progress-bar-infinite{animation:progress-infinite 1.5s infinite}@keyframes progress-infinite{0%{width:10%;margin-left:0%}25%{width:70%;margin-left:15%}50%{width:10%;margin-left:90%}75%{width:70%;margin-left:15%}to{width:10%;margin-left:0%}}\n"] }]
        }], propDecorators: { height: [{
                type: Input
            }, {
                type: HostBinding,
                args: ['style.height.px']
            }], isIndeterminate: [{
                type: Input
            }], progressClass: [{
                type: HostBinding,
                args: ['class.d-block']
            }, {
                type: HostBinding,
                args: ['class.overflow-hidden']
            }] } });

class BsProgressBarComponent {
    constructor() {
        this.destroyed$ = new Subject();
        this.minimum$ = new BehaviorSubject(0);
        this.maximum$ = new BehaviorSubject(100);
        this.value$ = new BehaviorSubject(50);
        this.color$ = new BehaviorSubject(Color.primary);
        this.striped = false;
        this.animated = false;
        this.progressBar = true;
        this.colorClass = 'bg-primary';
        this.widthStyle = '0';
        this.role = 'progressbar';
        this.valueNow = 50;
        this.valueMin = 0;
        this.valueMax = 100;
        this.percentage$ = combineLatest([this.minimum$, this.maximum$, this.value$])
            .pipe(map(([minimum, maximum, value]) => {
            return (value - minimum) / (maximum - minimum) * 100;
        }));
        this.width$ = this.percentage$
            .pipe(map((width) => {
            return String(width) + '%';
        }));
        this.colorClass$ = this.color$
            .pipe(map((color) => {
            const name = Color[color];
            return `bg-${name}`;
        }));
        this.colorClass$
            .pipe(takeUntil(this.destroyed$))
            .subscribe((color) => {
            this.colorClass = color;
        });
        this.width$
            .pipe(takeUntil(this.destroyed$))
            .subscribe((width) => {
            this.widthStyle = width;
        });
        this.value$
            .pipe(takeUntil(this.destroyed$))
            .subscribe((value) => {
            this.valueNow = value;
        });
        this.minimum$
            .pipe(takeUntil(this.destroyed$))
            .subscribe((value) => {
            this.valueMin = value;
        });
        this.maximum$
            .pipe(takeUntil(this.destroyed$))
            .subscribe((value) => {
            this.valueMax = value;
        });
    }
    set minimum(value) {
        this.minimum$.next(value);
    }
    set maximum(value) {
        this.maximum$.next(value);
    }
    set value(value) {
        this.value$.next(value);
    }
    set color(value) {
        this.color$.next(value);
    }
    ngOnDestroy() {
        this.destroyed$.next(true);
    }
}
BsProgressBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsProgressBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
BsProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BsProgressBarComponent, selector: "bs-progress-bar", inputs: { minimum: "minimum", maximum: "maximum", value: "value", color: "color", striped: "striped", animated: "animated" }, host: { properties: { "class.progress-bar-striped": "this.striped", "class.progress-bar-animated": "this.animated", "class.progress-bar": "this.progressBar", "class": "this.colorClass", "style.width": "this.widthStyle", "attr.role": "this.role", "attr.aria-valuenow": "this.valueNow", "attr.aria-valuemin": "this.valueMin", "attr.aria-valuemax": "this.valueMax" } }, ngImport: i0, template: "", styles: ["@keyframes progress-bar-stripes{0%{background-position-x:1rem}}:host ::ng-deep .progress{--bs-progress-height: 1rem;--bs-progress-font-size: .75rem;--bs-progress-bg: #e9ecef;--bs-progress-border-radius: .375rem;--bs-progress-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .075);--bs-progress-bar-color: #fff;--bs-progress-bar-bg: #0d6efd;--bs-progress-bar-transition: width .6s ease;display:flex;height:var(--bs-progress-height);overflow:hidden;font-size:var(--bs-progress-font-size);background-color:var(--bs-progress-bg);border-radius:var(--bs-progress-border-radius)}:host ::ng-deep .progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:var(--bs-progress-bar-color);text-align:center;white-space:nowrap;background-color:var(--bs-progress-bar-bg);transition:var(--bs-progress-bar-transition)}@media (prefers-reduced-motion: reduce){:host ::ng-deep .progress-bar{transition:none}}:host ::ng-deep .progress-bar-striped{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:var(--bs-progress-height) var(--bs-progress-height)}:host ::ng-deep .progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media (prefers-reduced-motion: reduce){:host ::ng-deep .progress-bar-animated{animation:none}}\n"] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsProgressBarComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bs-progress-bar', template: "", styles: ["@keyframes progress-bar-stripes{0%{background-position-x:1rem}}:host ::ng-deep .progress{--bs-progress-height: 1rem;--bs-progress-font-size: .75rem;--bs-progress-bg: #e9ecef;--bs-progress-border-radius: .375rem;--bs-progress-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .075);--bs-progress-bar-color: #fff;--bs-progress-bar-bg: #0d6efd;--bs-progress-bar-transition: width .6s ease;display:flex;height:var(--bs-progress-height);overflow:hidden;font-size:var(--bs-progress-font-size);background-color:var(--bs-progress-bg);border-radius:var(--bs-progress-border-radius)}:host ::ng-deep .progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:var(--bs-progress-bar-color);text-align:center;white-space:nowrap;background-color:var(--bs-progress-bar-bg);transition:var(--bs-progress-bar-transition)}@media (prefers-reduced-motion: reduce){:host ::ng-deep .progress-bar{transition:none}}:host ::ng-deep .progress-bar-striped{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:var(--bs-progress-height) var(--bs-progress-height)}:host ::ng-deep .progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media (prefers-reduced-motion: reduce){:host ::ng-deep .progress-bar-animated{animation:none}}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { minimum: [{
                type: Input
            }], maximum: [{
                type: Input
            }], value: [{
                type: Input
            }], color: [{
                type: Input
            }], striped: [{
                type: Input
            }, {
                type: HostBinding,
                args: ['class.progress-bar-striped']
            }], animated: [{
                type: Input
            }, {
                type: HostBinding,
                args: ['class.progress-bar-animated']
            }], progressBar: [{
                type: HostBinding,
                args: ['class.progress-bar']
            }], colorClass: [{
                type: HostBinding,
                args: ['class']
            }], widthStyle: [{
                type: HostBinding,
                args: ['style.width']
            }], role: [{
                type: HostBinding,
                args: ['attr.role']
            }], valueNow: [{
                type: HostBinding,
                args: ['attr.aria-valuenow']
            }], valueMin: [{
                type: HostBinding,
                args: ['attr.aria-valuemin']
            }], valueMax: [{
                type: HostBinding,
                args: ['attr.aria-valuemax']
            }] } });

class BsProgressBarModule {
}
BsProgressBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
BsProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: BsProgressBarModule, declarations: [BsProgressBarComponent,
        BsProgressComponent], imports: [CommonModule], exports: [BsProgressBarComponent,
        BsProgressComponent] });
BsProgressBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsProgressBarModule, imports: [CommonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsProgressBarModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        BsProgressBarComponent,
                        BsProgressComponent
                    ],
                    imports: [
                        CommonModule
                    ],
                    exports: [
                        BsProgressBarComponent,
                        BsProgressComponent
                    ]
                }]
        }] });

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

export { BsProgressBarComponent, BsProgressBarModule, BsProgressComponent };
//# sourceMappingURL=mintplayer-ng-bootstrap-progress-bar.mjs.map
