import * as i0 from '@angular/core';
import { EventEmitter, Output, ViewChild, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
import * as i1 from '@aztrix/environment';
import { filter, first } from 'rxjs';
import { CommonModule } from '@angular/common';
import { ButtonModule } from '@aztrix/components/button';
import { TranslatePipe } from '@aztrix/translate';
import { IconsModule } from '@aztrix/icons';

class PassbaseButtonComponent {
    constructor(_environment) {
        this._environment = _environment;
        this.verificationFinished = new EventEmitter();
    }
    ngAfterViewInit() {
        this._environment
            .string$('PASSBASE_API_KEY')
            .pipe(filter((value) => !!value), first())
            .subscribe((passbaseApiKey) => {
            // Passbase.default.renderButton(this.passbaseButton.nativeElement, passbaseApiKey, {
            //   onFinish: (identityAccessKey: string) => {
            //     this.verificationFinished.emit(identityAccessKey);
            //   },
            // });
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PassbaseButtonComponent, deps: [{ token: i1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PassbaseButtonComponent, selector: "ax-passbase-button", outputs: { verificationFinished: "verificationFinished" }, viewQueries: [{ propertyName: "passbaseButton", first: true, predicate: ["passbaseButton"], descendants: true }], ngImport: i0, template: "<div #passbaseButton></div>\n", styles: [":host{display:flex;align-items:center;justify-content:space-between}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PassbaseButtonComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-passbase-button', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #passbaseButton></div>\n", styles: [":host{display:flex;align-items:center;justify-content:space-between}\n"] }]
        }], ctorParameters: () => [{ type: i1.EnvironmentService }], propDecorators: { passbaseButton: [{
                type: ViewChild,
                args: ['passbaseButton']
            }], verificationFinished: [{
                type: Output
            }] } });

class PassbaseButtonModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PassbaseButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: PassbaseButtonModule, declarations: [PassbaseButtonComponent], imports: [CommonModule, IconsModule, ButtonModule, TranslatePipe], exports: [PassbaseButtonComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PassbaseButtonModule, imports: [CommonModule, IconsModule, ButtonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PassbaseButtonModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CommonModule, IconsModule, ButtonModule, TranslatePipe],
                    declarations: [PassbaseButtonComponent],
                    exports: [PassbaseButtonComponent],
                }]
        }] });

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

export { PassbaseButtonComponent, PassbaseButtonModule };
//# sourceMappingURL=aztrix-components-passbase-button.mjs.map
