import { Component, Inject, Input } from '@angular/core';
import { TranslateService } from '@aztrix/helpers';
import { BACKEND_URL, PropertyRepresentation } from '@aztrix/sdk';
import { BehaviorSubject, combineLatest, map } from 'rxjs';
import { AbstractRegisterStep } from '../abstract-register-step';
import * as i0 from "@angular/core";
import * as i1 from "@aztrix/helpers";
import * as i2 from "@angular/common";
import * as i3 from "@aztrix/components/password-edit";
import * as i4 from "@aztrix/components/property-edit";
import * as i5 from "@angular/forms";
import * as i6 from "@aztrix/components/button";
import * as i7 from "@angular/material/legacy-form-field";
import * as i8 from "@angular/material/legacy-checkbox";
import * as i9 from "@aztrix/icons";
import * as i10 from "../../step-switch/step-switch.component";
import * as i11 from "rxjs";
export class RegisterAuthenticationStepComponent extends AbstractRegisterStep {
    constructor(_translate, _backendUrl) {
        super();
        this._translate = _translate;
        this._backendUrl = _backendUrl;
        this.hasBackButton = true;
        this.termsUrl$ = combineLatest([this._backendUrl, this._translate.lang$]).pipe(map(([url, lang]) => url + `/policy?type=terms_conditions&lang=${lang}`));
        this.privacyUrl$ = combineLatest([this._backendUrl, this._translate.lang$]).pipe(map(([url, lang]) => url + `/policy?type=privacy_policy_preface&lang=${lang}`));
    }
    get emailForm() {
        return this.propertiesForm.get(PropertyRepresentation.TypeEnum.EMAIL);
    }
    get passwordForm() {
        return this.form.get('password');
    }
    get termsForm() {
        return this.legalForm.get('terms');
    }
    get privacyForm() {
        return this.legalForm.get('privacy');
    }
    get newsletterForm() {
        return this.legalForm.get('newsletter');
    }
}
RegisterAuthenticationStepComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: RegisterAuthenticationStepComponent, deps: [{ token: i1.TranslateService }, { token: BACKEND_URL }], target: i0.ɵɵFactoryTarget.Component });
RegisterAuthenticationStepComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", type: RegisterAuthenticationStepComponent, selector: "ax-register-authentication-step", inputs: { hasBackButton: "hasBackButton" }, usesInheritance: true, ngImport: i0, template: "<ax-property-edit\n  [form]=\"emailForm\"\n  name=\"register email\"\n  [required]=\"true\"\n  [hint]=\"'register.email.explanation' | translate\"\n></ax-property-edit>\n\n<ax-password-edit\n  [form]=\"passwordForm\"\n  [label]=\"'register.individual.credentials.password.title' | translate\"\n  [showToggle]=\"true\"\n  autocomplete=\"new-password\"\n></ax-password-edit>\n\n<mat-checkbox [formControl]=\"termsForm\">\n  <span>\n    {{ 'register.individual.credentials.agreements' | translate }}\n  </span>\n  <a class=\"legal green-text\" [attr.href]=\"termsUrl$ | async\" target=\"_blank\">\n    {{ 'label.terms' | translate }}\n    <ax-icon class=\"icon\" name=\"open-in-new\"></ax-icon>\n  </a>\n</mat-checkbox>\n\n<mat-checkbox [formControl]=\"privacyForm\">\n  <span>\n    {{ 'register.individual.credentials.agreements' | translate }}\n  </span>\n\n  <a class=\"legal green-text\" [attr.href]=\"privacyUrl$ | async\" target=\"_blank\">\n    {{ 'label.privacy.policy' | translate }}\n    <ax-icon class=\"icon\" name=\"open-in-new\"></ax-icon>\n  </a>\n</mat-checkbox>\n\n<mat-checkbox [formControl]=\"newsletterForm\">{{ 'register.newsletter' | translate }}</mat-checkbox>\n\n<mat-error class=\"error\">\n  <div\n    class=\"c-property-edit__error\"\n    *ngIf=\"termsForm?.touched && privacyForm?.touched && legalForm?.invalid\"\n  >\n    <ax-icon class=\"icon\" name=\"alert-circle\"></ax-icon>\n    <span>{{ 'document.confirmation.required' | translate }}</span>\n  </div>\n</mat-error>\n\n<ax-button\n  *ngIf=\"!hasBackButton\"\n  class=\"action\"\n  axButton\n  color=\"accent\"\n  filled\n  fullWidth\n  (click)=\"_continue()\"\n  >{{ 'login.create-account' | translate }}</ax-button\n>\n\n<ax-step-switch *ngIf=\"hasBackButton\" (continue)=\"_continue()\" (back)=\"_back()\"></ax-step-switch>\n", styles: ["a .icon{width:1rem;height:1rem}\n", ":host{display:flex;flex-direction:column;gap:.5rem}.form{margin-bottom:20px;background-color:#fff;border-radius:15px;padding:1.5rem 1.5rem 0}.value{display:flex;flex-direction:column;align-items:flex-end;margin-bottom:.5rem}.input{width:100%}.action{margin:1rem 1rem -20px}.action ::ng-deep .ax-button{font-size:1.2rem;text-transform:none;height:2.5rem}.back{margin:1rem auto -.5rem;width:auto}.back ::ng-deep .ax-button{font-size:small;height:2rem;width:auto;margin:0 auto}.back ::ng-deep .ax-button .icon{width:1rem;height:1rem}.verification ::ng-deep .verify{width:100%;display:block;position:relative;bottom:-20px}.verification ::ng-deep .verify .ax-button{font-size:1.2rem;text-transform:none;height:2.5rem;width:100%}.verification ::ng-deep .resend{height:0;position:relative;bottom:-30px}.verification ::ng-deep .error-message{height:0;position:relative;bottom:-30px;display:flex;text-align:center;flex-direction:column;gap:1rem}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.PasswordEditComponent, selector: "ax-password-edit", inputs: ["username", "showToggle", "forgotPasswordHint", "saveInPasswordManager", "minLength"] }, { kind: "component", type: i4.PropertyEditComponent, selector: "ax-property-edit", inputs: ["isIndividual", "isProposalSubscribeForm"] }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i6.ButtonDirective, selector: "[axButton]", inputs: ["color", "labelHideMobile", "smallButton", "bigButton", "fullWidth", "filled", "outline", "icon-button", "hoverLabel", "hover", "lowercase", "disabled"] }, { kind: "component", type: i6.ButtonComponent, selector: "ax-button", inputs: ["routerUrl", "ariaLabel"] }, { kind: "directive", type: i7.MatLegacyError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i8.MatLegacyCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i9.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "component", type: i10.StepSwitchComponent, selector: "ax-step-switch", inputs: ["loading$"], outputs: ["continue", "back"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: RegisterAuthenticationStepComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-register-authentication-step', template: "<ax-property-edit\n  [form]=\"emailForm\"\n  name=\"register email\"\n  [required]=\"true\"\n  [hint]=\"'register.email.explanation' | translate\"\n></ax-property-edit>\n\n<ax-password-edit\n  [form]=\"passwordForm\"\n  [label]=\"'register.individual.credentials.password.title' | translate\"\n  [showToggle]=\"true\"\n  autocomplete=\"new-password\"\n></ax-password-edit>\n\n<mat-checkbox [formControl]=\"termsForm\">\n  <span>\n    {{ 'register.individual.credentials.agreements' | translate }}\n  </span>\n  <a class=\"legal green-text\" [attr.href]=\"termsUrl$ | async\" target=\"_blank\">\n    {{ 'label.terms' | translate }}\n    <ax-icon class=\"icon\" name=\"open-in-new\"></ax-icon>\n  </a>\n</mat-checkbox>\n\n<mat-checkbox [formControl]=\"privacyForm\">\n  <span>\n    {{ 'register.individual.credentials.agreements' | translate }}\n  </span>\n\n  <a class=\"legal green-text\" [attr.href]=\"privacyUrl$ | async\" target=\"_blank\">\n    {{ 'label.privacy.policy' | translate }}\n    <ax-icon class=\"icon\" name=\"open-in-new\"></ax-icon>\n  </a>\n</mat-checkbox>\n\n<mat-checkbox [formControl]=\"newsletterForm\">{{ 'register.newsletter' | translate }}</mat-checkbox>\n\n<mat-error class=\"error\">\n  <div\n    class=\"c-property-edit__error\"\n    *ngIf=\"termsForm?.touched && privacyForm?.touched && legalForm?.invalid\"\n  >\n    <ax-icon class=\"icon\" name=\"alert-circle\"></ax-icon>\n    <span>{{ 'document.confirmation.required' | translate }}</span>\n  </div>\n</mat-error>\n\n<ax-button\n  *ngIf=\"!hasBackButton\"\n  class=\"action\"\n  axButton\n  color=\"accent\"\n  filled\n  fullWidth\n  (click)=\"_continue()\"\n  >{{ 'login.create-account' | translate }}</ax-button\n>\n\n<ax-step-switch *ngIf=\"hasBackButton\" (continue)=\"_continue()\" (back)=\"_back()\"></ax-step-switch>\n", styles: ["a .icon{width:1rem;height:1rem}\n", ":host{display:flex;flex-direction:column;gap:.5rem}.form{margin-bottom:20px;background-color:#fff;border-radius:15px;padding:1.5rem 1.5rem 0}.value{display:flex;flex-direction:column;align-items:flex-end;margin-bottom:.5rem}.input{width:100%}.action{margin:1rem 1rem -20px}.action ::ng-deep .ax-button{font-size:1.2rem;text-transform:none;height:2.5rem}.back{margin:1rem auto -.5rem;width:auto}.back ::ng-deep .ax-button{font-size:small;height:2rem;width:auto;margin:0 auto}.back ::ng-deep .ax-button .icon{width:1rem;height:1rem}.verification ::ng-deep .verify{width:100%;display:block;position:relative;bottom:-20px}.verification ::ng-deep .verify .ax-button{font-size:1.2rem;text-transform:none;height:2.5rem;width:100%}.verification ::ng-deep .resend{height:0;position:relative;bottom:-30px}.verification ::ng-deep .error-message{height:0;position:relative;bottom:-30px;display:flex;text-align:center;flex-direction:column;gap:1rem}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.TranslateService }, { type: i11.BehaviorSubject, decorators: [{
                    type: Inject,
                    args: [BACKEND_URL]
                }] }]; }, propDecorators: { hasBackButton: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 