UNPKG

@infordata-web/portal-common-component-lib

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.14.

7,640 lines 534 kB
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('@angular/material/dialog'), require('@angular/platform-browser'), require('@angular/platform-browser/animations'), require('@angular/localize/init'), require('@angular/forms'), require('@angular/material/table'), require('@angular/cdk/collections'), require('portal-i18n-lib'), require('@angular/material/select'), require('@angular/material/core'), require('@angular/material/button'), require('@angular/material/card'), require('@angular/material/input'), require('@angular/material/form-field'), require('@angular/material/paginator'), require('@angular/material/icon'), require('@angular/material/progress-bar'), require('@angular/material/expansion'), require('@angular/material/radio'), require('@angular/material/checkbox'), require('moment'), require('angular-portal-shell-app'), require('@angular/material/datepicker'), require('@ng-bootstrap/ng-bootstrap'), require('@angular/material/list'), require('file-saver'), require('ngx-json-viewer'), require('@angular/material/sort'), require('@angular/material/tooltip'), require('@angular/material-moment-adapter'), require('ngx-iban'), require('@ngxs/form-plugin')) :
    typeof define === 'function' && define.amd ? define('@infordata-web/portal-common-component-lib', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', '@angular/material/dialog', '@angular/platform-browser', '@angular/platform-browser/animations', '@angular/localize/init', '@angular/forms', '@angular/material/table', '@angular/cdk/collections', 'portal-i18n-lib', '@angular/material/select', '@angular/material/core', '@angular/material/button', '@angular/material/card', '@angular/material/input', '@angular/material/form-field', '@angular/material/paginator', '@angular/material/icon', '@angular/material/progress-bar', '@angular/material/expansion', '@angular/material/radio', '@angular/material/checkbox', 'moment', 'angular-portal-shell-app', '@angular/material/datepicker', '@ng-bootstrap/ng-bootstrap', '@angular/material/list', 'file-saver', 'ngx-json-viewer', '@angular/material/sort', '@angular/material/tooltip', '@angular/material-moment-adapter', 'ngx-iban', '@ngxs/form-plugin'], factory) :
    (global = global || self, factory((global['infordata-web'] = global['infordata-web'] || {}, global['infordata-web']['portal-common-component-lib'] = {}), global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.ng.material.dialog, global.ng.platformBrowser, global.ng.platformBrowser.animations, global.ng.localize.init, global.ng.forms, global.ng.material.table, global.ng.cdk.collections, global.i1$2, global.ng.material.select, global.ng.material.core, global.ng.material.button, global.ng.material.card, global.ng.material.input, global.ng.material.formField, global.ng.material.paginator, global.ng.material.icon, global.ng.material.progressBar, global.ng.material.expansion, global.ng.material.radio, global.ng.material.checkbox, global.moment, global.angularPortalShellApp, global.ng.material.datepicker, global.ngBootstrap, global.ng.material.list, global.fileSaver, global.ngxJsonViewer, global.ng.material.sort, global.ng.material.tooltip, global.ng.materialMomentAdapter, global.ngxIban, global.formPlugin));
}(this, (function (exports, i0, common, i1, rxjs, operators, i1$1, platformBrowser, animations, init, forms, table, collections, i1$2, select, core, button, card, input, formField, paginator, icon, progressBar, expansion, radio, checkbox, moment, angularPortalShellApp, datepicker, ngBootstrap, list, fileSaver, ngxJsonViewer, sort, tooltip, materialMomentAdapter, ngxIban, formPlugin) { 'use strict';

    var ConfigurationService = /** @class */ (function () {
        function ConfigurationService(configurazioneModulo) {
            this.nameApp = configurazioneModulo.nameApp;
            this.lingua$ = configurazioneModulo.lingua$;
            this.servicePaths = configurazioneModulo.servicePaths;
            this.userProfile = configurazioneModulo.userProfile;
            this.appPath = configurazioneModulo.appPath;
        }
        return ConfigurationService;
    }());
    ConfigurationService.decorators = [
        { type: i0.Injectable }
    ];
    ConfigurationService.ctorParameters = function () { return [
        { type: undefined }
    ]; };

    var TranslateService = /** @class */ (function () {
        function TranslateService(http, appRef, configurationService) {
            var _this = this;
            this.http = http;
            this.appRef = appRef;
            this.configurationService = configurationService;
            this.traduzioniLib$ = new rxjs.Observable();
            this.communicatoreConEsterno$ = new rxjs.Subject();
            this.i18nApiUrl = this.configurationService.servicePaths.get("I18N_MS_API_URL");
            console.log('[DAG_I18N_MS_URL]', this.i18nApiUrl);
            this.traduzioniLib$ = this.configurationService.lingua$.pipe(operators.switchMap(function (language) { return _this.getBundleTraduzioni$(language); }), operators.tap(function (_) { return setTimeout(function () { return _this.appRef.tick(); }, 0); }), operators.shareReplay());
        }
        TranslateService.prototype.getTraduzione$ = function (codice) {
            var _this = this;
            return rxjs.defer(function () { return _this.traduzioniLib$.pipe(operators.map(function (bundle) { return bundle.get(codice) || codice; })); });
        };
        TranslateService.prototype.getBundleTraduzioni$ = function (language) {
            var _this = this;
            var url = this.i18nApiUrl + '/v1/labels/' + this.configurationService.nameApp + '/' + language;
            return this.http.get(url).pipe(operators.map(this.reduceLabels), operators.tap(function (_) { return _this.communicatoreConEsterno$.next(true); }));
        };
        TranslateService.prototype.reduceLabels = function (labels) {
            var reduced = labels.reduce(function (acc, label) {
                return acc.set(label["codiceLabel"], label["label"]);
            }, new Map());
            return reduced;
        };
        return TranslateService;
    }());
    TranslateService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TranslateService_Factory() { return new TranslateService(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(i0.ApplicationRef), i0.ɵɵinject(ConfigurationService)); }, token: TranslateService, providedIn: "root" });
    TranslateService.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    TranslateService.ctorParameters = function () { return [
        { type: i1.HttpClient },
        { type: i0.ApplicationRef },
        { type: ConfigurationService }
    ]; };

    var TranslatePipe = /** @class */ (function () {
        function TranslatePipe(translate, injector) {
            this.translate = translate;
            this.injector = injector;
            this.asyncPipe = new common.AsyncPipe(injector.get(i0.ChangeDetectorRef));
        }
        TranslatePipe.prototype.transform = function (key) {
            return this.asyncPipe.transform(this.translate.getTraduzione$(key));
        };
        TranslatePipe.prototype.ngOnDestroy = function () {
            this.asyncPipe.ngOnDestroy();
        };
        return TranslatePipe;
    }());
    TranslatePipe.decorators = [
        { type: i0.Pipe, args: [{
                    name: 'traduzione'
                },] }
    ];
    TranslatePipe.ctorParameters = function () { return [
        { type: TranslateService },
        { type: i0.Injector }
    ]; };

    var TranslateModule = /** @class */ (function () {
        function TranslateModule() {
        }
        return TranslateModule;
    }());
    TranslateModule.decorators = [
        { type: i0.NgModule, args: [{
                    declarations: [TranslatePipe],
                    imports: [
                        i1.HttpClientModule,
                        common.CommonModule,
                        i1$1.MatDialogModule,
                        platformBrowser.BrowserModule,
                        animations.BrowserAnimationsModule,
                    ],
                    providers: [TranslatePipe],
                    exports: [TranslatePipe]
                },] }
    ];
    TranslateModule.ctorParameters = function () { return []; };

    var ComponentOutputStatus = /** @class */ (function () {
        function ComponentOutputStatus() {
        }
        ComponentOutputStatus.of = function (status, output) {
            var componentStatus = new ComponentOutputStatus();
            componentStatus.status = status;
            componentStatus.output = output;
            return componentStatus;
        };
        ComponentOutputStatus.prototype.ifValid = function (effect) {
            if (status) {
                effect(this.output);
            }
        };
        ComponentOutputStatus.prototype.each = function (effect) {
            effect(this.output);
        };
        ComponentOutputStatus.prototype.mapValue = function (mapper) {
            return ComponentOutputStatus.of(this.status, mapper(this.output));
        };
        return ComponentOutputStatus;
    }());

    var ContattoDTO = /** @class */ (function () {
        function ContattoDTO() {
        }
        return ContattoDTO;
    }());

    var MessageService = /** @class */ (function () {
        function MessageService() {
            this.defaultMessage = "required";
            this.messages = {
                maxlength: "validation-maxlength",
                requiredInfoDecreto: "validation-requiredInfoDecreto",
                requiredMail: "validation-requiredMail",
                cfInvalidoFormalmente: "validation-cfInvalidoFormalmente",
                invalidCF: "validation-invalidCF",
                nSentenza: "validation-nSentenza",
                required: "validation-required",
                email: "validation-email",
                tel: "validation-tel",
                iban: "validation-iban",
                partitaIVAInvalida: "validation-partitaIVAInvalida",
                partitaIVAMaxLen2: "validation-partitaIVAMaxLen2",
                money: "validation-money",
                invalidName: "validation-invalidName",
                invalidDate: "validation-invalidDate",
                pattern: "validation-pattern",
                invalidDateFormat: "validation-invalidDateFormat",
                requiredDefinizione: "validation-requiredDefinizione",
                validationServiceFailed: "validation-validationServiceFailed",
                cfValidationPG: "validation-cfValidationPG",
                cfDifferentRichiedente: "validation-cfDifferentRichiedente",
                requiredDomicilio: "validation-requiredDomicilio",
                requiredSede: "validation-requiredSede"
            };
        }
        MessageService.prototype.produceMessage = function (errorType, control) {
            if (Object.keys(control.errors)[0]) {
                return this.getMessage(Object.keys(control.errors)[0]);
            }
            else {
                return this.getMessage(this.defaultMessage);
            }
        };
        MessageService.prototype.getMessage = function (messageKey) {
            var message = this.messages[messageKey];
            if (message) {
                return message;
            }
            else {
                return messageKey;
            }
        };
        MessageService.prototype.produceCFMessage = function (control) {
            var message = this.getMessage(this.defaultMessage);
            if (control.hasError("cfInvalidoFormalmente")) {
                message = this.messages["cfInvalidoFormalmente"];
            }
            else if (control.hasError("invalidCF")) {
                message = this.messages["invalidCF"];
            }
            else if (control.hasError("cfDifferentRichiedente")) {
                message = this.messages["cfDifferentRichiedente"];
            }
            return message;
        };
        MessageService.prototype.getErrorData = function (control) {
            var message = this.getMessage(this.defaultMessage);
            if (control.hasError("required") && !control.errors.matDatepickerParse) {
                message = this.messages["required"];
            }
            else if (control.hasError("invalidDate")) {
                message = this.messages["invalidDate"];
            }
            else if (control.errors.matDatepickerParse) {
                message = this.messages["invalidDateFormat"];
            }
            return message;
        };
        return MessageService;
    }());
    MessageService.ɵprov = i0.ɵɵdefineInjectable({ factory: function MessageService_Factory() { return new MessageService(); }, token: MessageService, providedIn: "root" });
    MessageService.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: "root",
                },] }
    ];
    MessageService.ctorParameters = function () { return []; };

    var ContattiComponent = /** @class */ (function () {
        function ContattiComponent(msg) {
            this.msg = msg;
            this.done = new i0.EventEmitter();
        }
        ContattiComponent.prototype.ngOnInit = function () {
            var _this = this;
            // console.log('[ContattoDTO]', this.contatti);
            this.form = new forms.FormGroup({});
            if (this.recapiti$) {
                this.initContatto();
            }
            var email = new forms.FormControl({ value: this.contatti.email, disabled: false });
            this.form.addControl('email', email);
            var pec = new forms.FormControl({ value: this.contatti.pec, disabled: false });
            this.form.addControl('pec', pec);
            var telefono = new forms.FormControl({ value: this.contatti.telefono, disabled: false });
            this.form.addControl('telefono', telefono);
            var changes$ = this.form.valueChanges.pipe(operators.map(function (_) {
                var contattoNew = new ContattoDTO();
                contattoNew.email = email.value;
                contattoNew.pec = pec.value;
                contattoNew.telefono = telefono.value;
                return ComponentOutputStatus.of(_this.form.valid, contattoNew);
            }));
            this.form.setValidators(function (form) {
                return (!form.get('pec').value && !form.get('email').value) ?
                    { requiredMail: true } : null;
            });
            this.subscription = changes$.subscribe(function (newContact) { return _this.done.emit(newContact); });
        };
        ContattiComponent.prototype.initContatto = function () {
            this.listaEmail$ = this.recapiti$.pipe(operators.map(function (r) { return r.filter(function (t) { return t.tipoRecapito.codice == "EMAIL"; }); }));
            this.listaPec$ = this.recapiti$.pipe(operators.map(function (r) { return r.filter(function (t) { return t.tipoRecapito.codice == "PEC"; }); }));
            this.listaTelefono$ = this.recapiti$.pipe(operators.map(function (r) { return r.filter(function (t) { return t.tipoRecapito.codice == "PHONE" ||
                t.tipoRecapito.codice == "CELL"; }); }));
            // console.log('[listaTelefono]', this.listaTelefono);
        };
        ContattiComponent.prototype.ngOnDestroy = function () {
            this.subscription.unsubscribe();
        };
        ContattiComponent.prototype.ngAfterContentInit = function () {
            this.form.updateValueAndValidity({ emitEvent: true });
        };
        return ContattiComponent;
    }());
    ContattiComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-contatti',
                    template: "\t<form [formGroup]=\"form\">\r\n\t\t<div class=\"collapse-body mt-2\">\r\n\t\t\t<div class=\"row\">\r\n\t\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{'required' | traduzione}}{{'email-recapito' | traduzione}}</mat-label>\r\n\t\t\t\t\t\t<mat-select formControlName=\"email\">\r\n\t\t\t\t\t\t\t<mat-option [value]=\"null\">{{ 'seleziona' | traduzione }}</mat-option>\r\n\t\t\t\t\t\t\t<mat-option *ngFor=\"let item of listaEmail$ | async\" [value]=\"item.id\">\r\n\t\t\t\t\t\t\t\t{{ item.recapito}}\r\n\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"form.controls['email'].invalid\">\r\n\t\t\t\t\t\t\t{{msg.produceMessage('email', form.controls['email']) | traduzione}}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t<mat-hint *infoTip=\"'email-recapito'\"></mat-hint>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{'required' | traduzione}}{{'pec-recapito' | traduzione}}</mat-label>\r\n\t\t\t\t\t\t<mat-select formControlName=\"pec\">\r\n\t\t\t\t\t\t\t<mat-option [value]=\"null\"> {{ 'seleziona' | traduzione }} </mat-option>\r\n\t\t\t\t\t\t\t<mat-option *ngFor=\"let item of listaPec$ | async\" [value]=\"item.id\">\r\n\t\t\t\t\t\t\t\t{{ item.recapito}}\r\n\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"form.controls['pec'].invalid\">\r\n\t\t\t\t\t\t\t{{msg.produceMessage('email', form.controls['pec']) | traduzione }}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t<mat-hint *infoTip=\"'pec-recapito'\"></mat-hint>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{'telefono-recapito' | traduzione}}</mat-label>\r\n\t\t\t\t\t\t<mat-select formControlName=\"telefono\">\r\n\t\t\t\t\t\t\t<mat-option [value]=\"null\"> {{ 'seleziona' | traduzione }} </mat-option>\r\n\t\t\t\t\t\t\t<mat-option *ngFor=\"let item of listaTelefono$ | async\" [value]=\"item.id\">\r\n\t\t\t\t\t\t\t\t{{ item.recapito}}\r\n\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"form.controls['telefono'].invalid\">\r\n\t\t\t\t\t\t\t{{msg.produceMessage('tel', form.controls['telefono']) | traduzione }}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t<mat-hint *infoTip=\"'telefono-recapito'\"></mat-hint>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<br><br>\r\n\t\t<div class=\"col-md-12\">\r\n\t\t\t<mat-error *ngIf=\"form.getError('requiredMail')\">\r\n\t\t\t\t{{msg.produceMessage('requiredMail', form) | traduzione }}\r\n\t\t\t</mat-error>\r\n\t\t</div>\r\n\t</form>\r\n",
                    styles: [""]
                },] }
    ];
    ContattiComponent.ctorParameters = function () { return [
        { type: MessageService }
    ]; };
    ContattiComponent.propDecorators = {
        recapiti$: [{ type: i0.Input }],
        contatti: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var DatiAnagraficiComponent = /** @class */ (function () {
        function DatiAnagraficiComponent() {
        }
        DatiAnagraficiComponent.prototype.ngOnChanges = function (changes) { };
        DatiAnagraficiComponent.prototype.ngOnInit = function () {
            this.form = new forms.FormGroup({});
        };
        return DatiAnagraficiComponent;
    }());
    DatiAnagraficiComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-dati-anagrafici',
                    template: "<div form [formGroup]=\"form\" *ngIf=\"datiPersonaFisica$ | async as datiPersonaFisica\">\r\n\t<!-- <h2 class=\"border-bottom font-weight-bold h3\">{{'dati-anagrafici' | traduzione}}</h2> -->\r\n\t<h3 class=\"border-bottom font-weight-bold h5\"><info-tip-label label=\"dati-anagrafici\"></info-tip-label></h3>\r\n\t<div class=\"row mt-3\">\r\n\t\t<div class=\"col-md-3\">\r\n\t\t\t<p class=\"mb-0 font-weight-bold\">{{'codice-fiscale' | traduzione}}:</p>\r\n\t\t\t<p>{{datiPersonaFisica.codiceFiscale}}</p>\r\n\t\t\t<mat-hint *infoTip=\"'codice-fiscale'\"></mat-hint>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"col-md-3\">\r\n\t\t\t<p class=\"mb-0 font-weight-bold\">{{'nome' | traduzione}}:</p>\r\n\t\t\t<p>{{datiPersonaFisica.nome}}</p>\r\n\t\t\t<mat-hint *infoTip=\"'nome'\"></mat-hint>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"col-md-3\">\r\n\t\t\t<p class=\"mb-0 font-weight-bold\">{{'cognome' | traduzione}}:</p>\r\n\t\t\t<p>{{datiPersonaFisica.cognome}}</p>\r\n\t\t\t<mat-hint *infoTip=\"'cognome'\"></mat-hint>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"col-md-3\">\r\n\t\t\t<p class=\"mb-0 font-weight-bold\">{{'data-nascita' | traduzione}}:</p>\r\n\t\t\t<p>{{datiPersonaFisica.dataNascita}}</p>\r\n\t\t\t<mat-hint *infoTip=\"'data-nascita'\"></mat-hint>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div class=\"row mt-4\">\r\n\t\t<div class=\"col-md-3\">\r\n\t\t\t<p class=\"mb-0 font-weight-bold\">{{'stato-nascita' | traduzione}}:</p>\r\n\t\t\t<p>{{datiPersonaFisica.nazioneNascita.denominazione}}</p>\r\n\t\t\t<mat-hint *infoTip=\"'stato-nascita'\"></mat-hint>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"col-md-3\">\r\n\t\t\t<p class=\"mb-0 font-weight-bold\">{{'sesso' | traduzione}}:</p>\r\n\t\t\t<p>{{datiPersonaFisica.tipoSesso.codice}}</p>\r\n\t\t\t<mat-hint *infoTip=\"'sesso'\"></mat-hint>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n",
                    styles: [""]
                },] }
    ];
    DatiAnagraficiComponent.ctorParameters = function () { return []; };
    DatiAnagraficiComponent.propDecorators = {
        datiPersonaFisica$: [{ type: i0.Input }]
    };

    var DatiResidenzaComponent = /** @class */ (function () {
        function DatiResidenzaComponent() {
            this.indirizzoToltip = "INDIRIZZO";
            this.civicoToltip = "civico";
            this.nazioneToltip = "nazione";
            this.provinciaToltip = "provincia";
            this.regioneToltip = "regione";
            this.comuneToltip = "comune";
            this.capToltip = "cap";
        }
        DatiResidenzaComponent.prototype.ngOnChanges = function (changes) { };
        DatiResidenzaComponent.prototype.ngOnInit = function () {
            this.form = new forms.FormGroup({});
        };
        return DatiResidenzaComponent;
    }());
    DatiResidenzaComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-dati-residenza',
                    template: "<!-- <p>Dati Residenza works!</p> -->\r\n<mat-expansion-panel class=\"panel\" [expanded]=\"true\">\r\n\t<mat-expansion-panel-header [collapsedHeight]=\"'48px'\" [expandedHeight]=\"'48px'\" class=\"custom-header\">\r\n\t\t<mat-panel-title>\r\n\t\t\t<!-- <h3>{{'dati-residenza' | traduzione}}</h3> -->\r\n\t\t\t<h3 class=\"mb-0 h5\"><info-tip-label label=\"dati-residenza\"></info-tip-label></h3>\r\n\t\t</mat-panel-title>\r\n\t</mat-expansion-panel-header>\r\n\t<div form [formGroup]=\"form\" class=\"collapse-body mt-2\">\r\n\t\t<ng-container *ngIf=\"residenza$ | async as residenza\">\r\n\t\t\t<div class=\"row\">\r\n\t\t\t\t<div class=\"col-md-10\">\r\n\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'indirizzo' | traduzione }}:</p>\r\n\t\t\t\t\t<p>{{residenza?.indirizzo}}</p>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"indirizzoToltip\"></mat-hint> -->\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-2\">\r\n\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'civico' | traduzione }}:</p>\r\n\t\t\t\t\t<p>{{residenza?.civico}}</p>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"civicoToltip\"></mat-hint> -->\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"row\">\r\n\t\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'nazione' | traduzione }}:</p>\r\n\t\t\t\t\t<p>{{residenza?.nazione?.denominazione}}</p>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"nazioneToltip\"></mat-hint> -->\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-8\">\r\n\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'regione' | traduzione }}:</p>\r\n\t\t\t\t\t<p>{{residenza?.regione?.denominazione}}</p>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"regioneToltip\"></mat-hint> -->\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"row\">\r\n\t\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'provincia' | traduzione }}:</p>\r\n\t\t\t\t\t<p>{{residenza?.provincia?.denominazione}}</p>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"provinciaToltip\"></mat-hint> -->\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'comune' | traduzione }}:</p>\r\n\t\t\t\t\t<p>{{residenza?.comune?.denominazione}}</p>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"comuneToltip\"></mat-hint> -->\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'cap' | traduzione }}:</p>\r\n\t\t\t\t\t<p>{{residenza?.cap}}</p>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"capToltip\"></mat-hint> -->\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</ng-container>\r\n\t</div>\r\n</mat-expansion-panel>\r\n",
                    styles: [""]
                },] }
    ];
    DatiResidenzaComponent.ctorParameters = function () { return []; };
    DatiResidenzaComponent.propDecorators = {
        residenza$: [{ type: i0.Input }]
    };

    var DomicilioDTO = /** @class */ (function () {
        function DomicilioDTO() {
        }
        return DomicilioDTO;
    }());

    var Tuple = /** @class */ (function () {
        function Tuple() {
        }
        Tuple.of = function (_1, _2) {
            var tuple = new Tuple();
            tuple._1 = _1;
            tuple._2 = _2;
            return tuple;
        };
        return Tuple;
    }());

    // @dynamic
    var ComponentReducer = /** @class */ (function () {
        function ComponentReducer() {
        }
        ComponentReducer.reducer2 = function (m1, m2, isComplete, startValue) {
            var cardinality = 2;
            var merged = rxjs.merge(ComponentReducer.ordinal(m1, 1), ComponentReducer.ordinal(m2, 2));
            return ComponentReducer.reducerInternal(merged, startValue, cardinality, isComplete);
        };
        ComponentReducer.reducer3 = function (m1, m2, m3, isComplete, startValue) {
            var cardinality = 3;
            var merged = rxjs.merge(ComponentReducer.ordinal(m1, 1), ComponentReducer.ordinal(m2, 2), ComponentReducer.ordinal(m3, 3));
            return ComponentReducer.reducerInternal(merged, startValue, cardinality, isComplete);
        };
        ComponentReducer.reducer4 = function (m1, m2, m3, m4, isComplete, startValue) {
            var cardinality = 4;
            //TODO
            // m3.subscribe(_ => console.log("m3", _))
            var merged = rxjs.merge(ComponentReducer.ordinal(m1, 1), ComponentReducer.ordinal(m2, 2), ComponentReducer.ordinal(m3, 3), ComponentReducer.ordinal(m4, 4));
            // merged.subscribe(_ => console.log("merged", _));
            return ComponentReducer.reducerInternal(merged, startValue, cardinality, isComplete);
        };
        ComponentReducer.reducer5 = function (m1, m2, m3, m4, m5, isComplete, startValue) {
            var cardinality = 5;
            var merged = rxjs.merge(ComponentReducer.ordinal(m1, 1), ComponentReducer.ordinal(m2, 2), ComponentReducer.ordinal(m3, 3), ComponentReducer.ordinal(m4, 4), ComponentReducer.ordinal(m5, 5));
            return ComponentReducer.reducerInternal(merged, startValue, cardinality, isComplete);
        };
        ComponentReducer.reducer6 = function (m1, m2, m3, m4, m5, m6, isComplete, startValue) {
            var cardinality = 6;
            var merged = rxjs.merge(ComponentReducer.ordinal(m1, 1), ComponentReducer.ordinal(m2, 2), ComponentReducer.ordinal(m3, 3), ComponentReducer.ordinal(m4, 4), ComponentReducer.ordinal(m5, 5), ComponentReducer.ordinal(m6, 6));
            return ComponentReducer.reducerInternal(merged, startValue, cardinality, isComplete);
        };
        ComponentReducer.reducer7 = function (m1, m2, m3, m4, m5, m6, m7, isComplete, startValue) {
            var cardinality = 7;
            var merged = rxjs.merge(ComponentReducer.ordinal(m1, 1), ComponentReducer.ordinal(m2, 2), ComponentReducer.ordinal(m3, 3), ComponentReducer.ordinal(m4, 4), ComponentReducer.ordinal(m5, 5), ComponentReducer.ordinal(m6, 6), ComponentReducer.ordinal(m7, 7));
            return ComponentReducer.reducerInternal(merged, startValue, cardinality, isComplete);
        };
        ComponentReducer.reducer8 = function (m1, m2, m3, m4, m5, m6, m7, m8, isComplete, startValue) {
            var cardinality = 8;
            var merged = rxjs.merge(ComponentReducer.ordinal(m1, 1), ComponentReducer.ordinal(m2, 2), ComponentReducer.ordinal(m3, 3), ComponentReducer.ordinal(m4, 4), ComponentReducer.ordinal(m5, 5), ComponentReducer.ordinal(m6, 6), ComponentReducer.ordinal(m7, 7), ComponentReducer.ordinal(m8, 8));
            return ComponentReducer.reducerInternal(merged, startValue, cardinality, isComplete);
        };
        ComponentReducer.reducer9 = function (m1, m2, m3, m4, m5, m6, m7, m8, m9, isComplete, startValue) {
            var cardinality = 9;
            var merged = rxjs.merge(ComponentReducer.ordinal(m1, 1), ComponentReducer.ordinal(m2, 2), ComponentReducer.ordinal(m3, 3), ComponentReducer.ordinal(m4, 4), ComponentReducer.ordinal(m5, 5), ComponentReducer.ordinal(m6, 6), ComponentReducer.ordinal(m7, 7), ComponentReducer.ordinal(m8, 8), ComponentReducer.ordinal(m9, 9));
            return ComponentReducer.reducerInternal(merged, startValue, cardinality, isComplete);
        };
        ComponentReducer.reducerInternal = function (mergedMutators, startValue, cardinality, isComplete) {
            var accumulatorAndValidity = Tuple.of([], startValue); // startValue è un valore normalizzato
            return mergedMutators.pipe(
            //TODO
            // tap(_ => console.log("mergedMutators", _)),
            operators.scan(function (accumulator, mutator) {
                accumulator._2.mapValue(mutator._2.output);
                accumulator._1[mutator._1] = mutator._2.status;
                //TODO
                // console.log("muttator", accumulator._2.mapValue(mutator._2.output));
                // console.log("accumulator", accumulator);
                return accumulator;
            }, accumulatorAndValidity //valore iniziale
            ), operators.map(function (accumulator) {
                var validities = accumulator._1;
                var isValid = isComplete(accumulator._2.output) &&
                    validities.reduce(function (acc, x) { return acc && (x == null || x); }, true);
                return ComponentOutputStatus.of(isValid, accumulator._2.output);
            }), operators.delay(0), operators.startWith(startValue));
        };
        ComponentReducer.ordinal = function (mutator, order) {
            return mutator.pipe(operators.map(function (x) { return Tuple.of(order, x); }));
        };
        return ComponentReducer;
    }());

    var DatiDomicilioComponent = /** @class */ (function () {
        function DatiDomicilioComponent(msg) {
            this.msg = msg;
            this.done = new i0.EventEmitter();
            this.displayedColumns = ['tipo', 'presso', 'indirizzo', 'preferito', 'seleziona'];
            this.changesRecapito$ = new rxjs.Subject();
            this.validazioneDomicilio = false;
            this.tipoToltip = "tipo";
            this.pressoToltip = "presso";
            this.indirizzoToltip = "indirizzo";
            this.selezionaToltip = "seleziona";
            this.preferitoToltip = "preferito";
        }
        DatiDomicilioComponent.prototype.ngOnInit = function () {
            var _this = this;
            // console.log('[domicilio]', this.domicilio);
            console.log('[domicili]', this.domicili);
            this.form = new forms.FormGroup({});
            var valid = true;
            if (!this.domicilio) {
                this.initDomicilio();
                valid = false;
            }
            this.dataSource = new table.MatTableDataSource(this.domicili);
            this.selection = new collections.SelectionModel(false, []);
            this.initialSelection();
            var domicilio = new forms.FormControl({ value: this.domicilio.hasSelezionatoDomicilio, disabled: false });
            this.form.addControl('domicilio', domicilio);
            var selected = new forms.FormControl({ value: '', disabled: false });
            this.form.addControl('selected', selected);
            this.checkDomicilio$ = domicilio.valueChanges.pipe(operators.shareReplay())
                .pipe(operators.tap(function (checkDomicilio) {
                if (checkDomicilio == false) {
                    _this.selection.clear();
                }
            }), operators.startWith(this.domicilio.idDomicilioSelezionato != null));
            var changesCheckDomicilio$ = this.checkDomicilio$.pipe(operators.map(function (checkDomicilio) { return ComponentOutputStatus.of(true, function (domicilio) {
                domicilio.hasSelezionatoDomicilio = checkDomicilio;
                if (checkDomicilio == false) {
                    domicilio.contatto.email = null;
                    domicilio.contatto.pec = null;
                    domicilio.contatto.telefono = null;
                    _this.form.get('selected').setValue('');
                }
            }); }));
            var changesDomicilio$ = this.selection.changed.pipe(operators.tap(function (value) {
                // console.log("changesDomicilio$", value);
                _this.validazioneDomicilio = value.added.length > 0 ? false : true;
            }), operators.map(function (change) { return ComponentOutputStatus.of(true, function (domicilio) {
                domicilio.idDomicilioSelezionato = change.added.length > 0 ? change.added[0].id : null;
            }); }));
            this.subscription = ComponentReducer.reducer3(changesCheckDomicilio$, changesDomicilio$, this.changesRecapito$, function (domicilio) {
                return domicilio.hasSelezionatoDomicilio ?
                    domicilio.idDomicilioSelezionato != null : true;
            }, ComponentOutputStatus.of(true, this.domicilio))
                .subscribe(function (domicilio) {
                // console.log('[DatiDomicilioComponent] status', status);
                _this.done.emit(domicilio);
            });
            this.form.setValidators(function (form) {
                if (form.get('domicilio').value && !form.get('selected').value) {
                    _this.validazioneDomicilio = true;
                    return { requiredDomicilio: true };
                }
                else {
                    return null;
                }
                //TODO
                // return form.get('domicilio').value &&
                // 	!form.get('selected').value ?
                // 	// this.selection.isEmpty() ?
                // 	// this.selection.selected.length === 1 ?
                // 	{ requiredDomicilio: true } : null;
            });
        };
        DatiDomicilioComponent.prototype.initialSelection = function () {
            var _this = this;
            if (this.domicilio.idDomicilioSelezionato) {
                setTimeout(function () {
                    _this.dataSource.data
                        .forEach(function (row) {
                        if (row.id == _this.domicilio.idDomicilioSelezionato) {
                            _this.selection.select(row);
                            _this.validazioneDomicilio = false;
                        }
                    });
                }, 0);
            }
        };
        DatiDomicilioComponent.prototype.initDomicilio = function () {
            this.domicilio = new DomicilioDTO();
            this.domicilio.contatto = new ContattoDTO();
        };
        DatiDomicilioComponent.prototype.recapitiReady = function (recapitiStatus) {
            // console.log('[recapitiReady]', recapitiStatus);
            this.changesRecapito$.next(recapitiStatus.mapValue(function (contatto) { return function (dich) { return (dich.contatto = contatto); }; }));
        };
        DatiDomicilioComponent.prototype.ngOnDestroy = function () {
            if (this.subscription != null) {
                this.subscription.unsubscribe();
            }
        };
        return DatiDomicilioComponent;
    }());
    DatiDomicilioComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-dati-domicilio',
                    template: "<mat-expansion-panel class=\"panel\" [expanded]=\"domicilio.hasSelezionatoDomicilio\">\r\n\t<mat-expansion-panel-header [collapsedHeight]=\"'48px'\" [expandedHeight]=\"'48px'\" class=\"custom-header\">\r\n\t\t<mat-panel-title>\r\n\t\t\t<!-- <h3>{{'domicilio' | traduzione}}</h3> -->\r\n\t\t\t<h3 class=\"mb-0 h5\"><info-tip-label label=\"domicilio\"></info-tip-label></h3>\r\n\t\t</mat-panel-title>\r\n\t</mat-expansion-panel-header>\r\n\t<form [formGroup]=\"form\">\r\n\t\t<div class=\"collapse-body mt-2\">\r\n\t\t\t<div class=\"row\">\r\n\t\t\t\t<section class=\"example-section col-md-2\">\r\n\t\t\t\t\t<mat-checkbox\r\n\t\t\t\t\t\tformControlName=\"domicilio\"\r\n\t\t\t\t\t\tclass=\"example-margin\">\r\n\t\t\t\t\t\t<!-- {{'seleziona-domicilio' | traduzione}} -->\r\n\t\t\t\t\t\t<info-tip-label label=\"seleziona-domicilio\"></info-tip-label>\r\n\t\t\t\t\t</mat-checkbox>\r\n\t\t\t\t</section>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<ng-container *ngIf=\"checkDomicilio$ | async\">\r\n\r\n\t\t<h4 class=\"border-bottom font-weight-bold mt-4 h5\"><info-tip-label label=\"domicili-inseriti\"></info-tip-label></h4>\r\n    <ng-container *ngIf=\"domicili?.length > 0; else noDomicili\">\r\n\t\t\t<mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 mt-3 border\">\r\n\r\n\t\t\t\t<!-- Tipo Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"tipo\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'tipo' | traduzione}} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\"> {{element.tipoDomicilio.descrizione}} </mat-cell>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"tipoToltip\"></mat-hint> -->\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!-- Presso Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"presso\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'presso' | traduzione}} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\"> {{element.indirizzo.presso}} </mat-cell>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"pressoToltip\"></mat-hint> -->\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!-- Indirizzo Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"indirizzo\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'indirizzo' | traduzione}} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\">\r\n\t\t\t\t\t\t<span *ngIf=\"!element.indirizzo.estero\"> {{element.indirizzo.indirizzo}}\r\n\t\t\t\t\t\t\t{{element.indirizzo.civico}} {{element.indirizzo.cap}} -\r\n\t\t\t\t\t\t\t{{element.indirizzo.comune.denominazione}} {{element.indirizzo.provinciaLabel}}</span>\r\n\t\t\t\t\t\t<span *ngIf=\"element.indirizzo.estero\"> {{element.indirizzo.nazione.denominazione}} -\r\n\t\t\t\t\t\t\t{{element.indirizzo.indirizzo}} </span>\r\n\t\t\t\t\t</mat-cell>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"indirizzoToltip\"></mat-hint> -->\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!-- Preferito Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"preferito\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'preferito' | traduzione}} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\">\r\n\t\t\t\t\t\t<!-- <mat-checkbox class=\"example-margin\" [disabled]=\"true\">\r\n\t\t\t\t\t\t</mat-checkbox> -->\r\n\t\t\t\t\t\t<!-- <mat-checkbox *ngIf=\"!element.preferito\" class=\"example-margin\" [disabled]=\"true\">\r\n\t\t\t\t\t\t</mat-checkbox> -->\r\n\t\t\t\t\t\t<mat-checkbox *ngIf=\"element.preferito\" class=\"example-margin\" [checked]=\"true\"\r\n\t\t\t\t\t\t\t[disabled]=\"true\"></mat-checkbox>\r\n\t\t\t\t\t</mat-cell>\r\n\t\t\t\t\t<!-- <mat-hint *infoTip=\"preferitoToltip\"></mat-hint> -->\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!-- Selezione Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"seleziona\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'seleziona' | traduzione}}\r\n\t\t\t\t\t \t<!-- <mat-checkbox (change)=\"$event ? masterToggle() : null\"\r\n\t\t\t\t\t\t\t\t\t[checked]=\"selection.hasValue() && isAllSelected()\"\r\n\t\t\t\t\t\t\t\t\t[indeterminate]=\"selection.hasValue() && !isAllSelected()\"\r\n\t\t\t\t\t\t\t\t\tformControlName=\"selected2\">\r\n\t\t\t\t\t\t</mat-checkbox> -->\r\n\t\t\t\t\t\t<!-- <mat-hint *infoTip=\"selezionaToltip\"></mat-hint> -->\r\n\t\t\t\t\t</mat-header-cell>\r\n\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let row\">\r\n\t\t\t\t\t\t<mat-checkbox\r\n\t\t\t\t\t\t\t(click)=\"$event.stopPropagation()\"\r\n\t\t\t\t\t\t\t(change)=\"$event ? selection.toggle(row) : null\"\r\n\t\t\t\t\t\t\t[checked]=\"selection.isSelected(row)\"\r\n\t\t\t\t\t\t\tformControlName=\"selected\">\r\n\t\t\t\t\t\t</mat-checkbox>\r\n\t\t\t\t\t</mat-cell>\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\r\n\t\t\t\t<mat-row *matRowDef=\"let row; columns: displayedColumns;\"></mat-row>\r\n\r\n\t\t\t</mat-table>\r\n\t\t\t<div class=\"collapse-body mt-2\">\r\n\t\t\t\t<div class=\"col-md-12\">\r\n\t\t\t\t\t<mat-error *ngIf=\"validazioneDomicilio\">\r\n\t\t\t\t\t\t{{'validation-requiredDomicilio' | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</ng-container>\r\n\t\t<ng-template #noDomicili>\r\n\t\t\t<div class=\"collapse-body mt-2\">\r\n\t\t\t\t<div class=\"col-md-12\">\r\n\t\t\t\t\t<mat-error >\r\n\t\t\t\t\t\t{{'no-domicili' | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</ng-template>\r\n\r\n\t\t\t<div class=\"collapse-body mt-2\" *ngIf=\"(recapiti$ | async)\">\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<div class=\"col-12\">\r\n\t\t\t\t\t\t<mat-card>\r\n\t\t\t\t\t\t\t<lib-contatti\r\n\t\t\t\t\t\t\t\t[contatti]=\"domicilio.contatto\"\r\n\t\t\t\t\t\t\t\t[recapiti$]=\"recapiti$\"\r\n\t\t\t\t\t\t\t\t(done)=\"recapitiReady($event)\"\r\n\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t</lib-contatti>\r\n\t\t\t\t\t\t</mat-card>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\r\n\t\t</ng-container>\r\n\t</form>\r\n</mat-expansion-panel>\r\n",
                    styles: [""]
                },] }
    ];
    DatiDomicilioComponent.ctorParameters = function () { return [
        { type: MessageService }
    ]; };
    DatiDomicilioComponent.propDecorators = {
        domicili: [{ type: i0.Input }],
        recapiti$: [{ type: i0.Input }],
        domicilio: [{ type: i0.Input }],
        done: [{ type: i0.Output }],
        formGroupDirective: [{ type: i0.ViewChild, args: [forms.FormGroupDirective,] }]
    };

    var DatiRichiedenteDTO = /** @class */ (function () {
        function DatiRichiedenteDTO() {
        }
        return DatiRichiedenteDTO;
    }());

    var RichiedenteComponent = /** @class */ (function () {
        function RichiedenteComponent() {
            this.nextStep = new i0.EventEmitter();
            this.salvaBozza = new i0.EventEmitter();
            this.changesPersonaFisica$ = new rxjs.Subject();
            this.changesResidenza$ = new rxjs.Subject();
            this.changesRecapito$ = new rxjs.Subject();
            this.changesDomicilio$ = new rxjs.Subject();
            //isFormValid: boolean;
            this.direction = "only-forward";
            this.isFinal = false;
            this.isDomicilioElettoValid = false;
        }
        RichiedenteComponent.prototype.ngOnInit = function () {
            var _this = this;
            //console.log('[DatiRichiedenteDTO]', this.datiRichiedente);
            this.form = new forms.FormGroup({});
            var valid = true;
            if (!this.datiRichiedente) {
                this.initRichiedente();
                valid = false;
            }
            var dichiarante$ = ComponentReducer.reducer4(this.changesPersonaFisica$, this.changesResidenza$, this.changesRecapito$, this.changesDomicilio$, function (dich) {
                // console.log("[dich]", dich);
                // console.log("[hasSelezionatoDomicilio]", dich.domicilio.hasSelezionatoDomicilio);
                var isValid;
                if (!dich.domicilio.hasSelezionatoDomicilio && dich.domicilio.hasSelezionatoDomicilio != undefined) {
                    isValid = dich.contatto != null;
                }
                else {
                    isValid = dich.domicilio != null;
                }
                //TODO
                // this.isDomicilioElettoValid
                // 	? dich.domicilio != null // se il domicilio non è validato controlla se diverso da null se lo è torna false altrimenti true.
                // 	: true // se già è validato torna true.
                // return (
                // 	dich.contatto != null ||  // basterebbe uno dei due diverso da null per tronare false
                // 	this.isDomicilioElettoValid
                // );
                valid = isValid;
                return isValid;
            }, ComponentOutputStatus.of(valid, this.datiRichiedente) // normalizzazione componente dichiarante
            );
            dichiarante$.subscribe(function (dichiarante) {
                console.log("[RichiedenteComponent] datiRichiedente", dichiarante);
                //TODO
                //this.isFormValid = dichiarante.status;
                if (dichiarante.output.domicilio.hasSelezionatoDomicilio == false) {
                    //TODO
                    // this.isDichiaranteValid = dichiarante.output.infoContatto.email != null || dichiarante.output.infoContatto.pec != null;
                    _this.isDichiaranteValid = _this.hasSelecteDichiarante(dichiarante);
                }
                else {
                    //TODO
                    // this.isDichiaranteValid = (dichiarante.output.infoContatto.email != null || dichiarante.output.infoContatto.pec != null) &&
                    // 	(dichiarante.output.domicilio.idDomicilioSelezionato != null) &&
                    // 	(dichiarante.output.domicilio.contatto.email != null || dichiarante.output.domicilio.contatto.pec != null);
                    _this.isDichiaranteValid = _this.hasSelecteDichiaranteAnd(dichiarante);
                }
            });
            //TODO
            //--------viene passato dall'input--------//
            // this.personaFisica$ = this.personaFisicaService.getPersonaFisicaUtente$()
            //   .pipe(shareReplay());
            this.datiPersonaFisica$ = this.personaFisica$
                .pipe(operators.pluck("datiPersonaFisica"));
            this.residenza$ = this.personaFisica$
                .pipe(operators.pluck("residenza"));
            this.recapiti$ = this.personaFisica$
                .pipe(operators.pluck("recapiti"), operators.map(function (recapiti) { return recapiti || []; }));
            this.domicili$ = this.personaFisica$
                .pipe(operators.pluck("domicili"));
        };
        RichiedenteComponent.prototype.recapitiReady = function (recapitiStatus) {
            // console.log('[racapitiStatus]', recapitiStatus);
            this.changesRecapito$.next(recapitiStatus.mapValue(function (contatto) { return function (dich) {
                return dich.contatto = contatto;
            }; }));
        };
        RichiedenteComponent.prototype.domiciliReady = function (domiciliStatus) {
            // console.log('[domiciliStatus]', domiciliStatus);
            this.changesDomicilio$.next(domiciliStatus.mapValue(function (domicilio) { return function (dich) {
                dich.domicilio = domicilio;
                //TODO: fix
                // (this.isDomicilioElettoValid = domicilio.idDomicilioSelezionato != null);
            }; }));
        };
        RichiedenteComponent.prototype.initRichiedente = function () {
            this.datiRichiedente = new DatiRichiedenteDTO();
            this.datiRichiedente.contatto = new ContattoDTO();
            //TODO
            this.datiRichiedente.domicilio = new DomicilioDTO();
            this.datiRichiedente.domicilio.contatto = new ContattoDTO();
            this.datiRichiedente.domicilio.idDomicilioSelezionato = null;
        };
        RichiedenteComponent.prototype.forward = function (_) {
            this.nextStep.emit(this.datiRichiedente);
        };
        RichiedenteComponent.prototype.complete = function (_) { };
        RichiedenteComponent.prototype.onSalvaBozza = function (_) {
            this.salvaBozza.emit(this.datiRichiedente);
        };
        RichiedenteComponent.prototype.ngOnDestroy = function () {
            if (this.domicilioElettoSub) {
                this.domicilioElettoSub.unsubscribe();
            }
        };
        RichiedenteComponent.prototype.hasSelecteDichiarante = function (dichiarante) {
            return dichiarante.output.contatto.email != null || dichiarante.output.contatto.pec != null;
            ;
        };
        RichiedenteComponent.prototype.hasSelecteDichiaranteAnd = function (dichiarante) {
            return this.hasSelecteDichiarante(dichiarante) &&
                (dichiarante.output.domicilio.idDomicilioSelezionato != null) &&
                (dichiarante.output.domicilio.contatto.email != null || dichiarante.output.domicilio.contatto.pec != null);
        };
        return RichiedenteComponent;
    }());
    RichiedenteComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-richiedente',
                    template: "<div class=\"mt-3 mb-5\" [formGroup]=\"form\">\r\n\t\t<lib-dati-anagrafici\r\n\t\t\t[datiPersonaFisica$]=\"datiPersonaFisica$\"\r\n\t\t>\r\n\t\t</lib-dati-anagrafici>\r\n\t<div class=\"mt-4\"></div>\r\n\t<lib-dati-residenza\r\n\t\t[residenza$]=\"residenza$\"\r\n\t>\r\n\t</lib-dati-residenza>\r\n\r\n\t<mat-expansion-panel class=\"panel mt-4\" [expanded]=\"true\">\r\n\t\t<mat-expansion-panel-header [collapsedHeight]=\"'48px'\" [expandedHeight]=\"'48px'\" class=\"custom-header\">\r\n\t\t\t<mat-panel-title>\r\n\t\t\t\t<!-- <h3>{{'recapiti' | traduzione}}</h3> -->\r\n\t\t\t\t<h3 class=\"mb-0 h5\"><info-tip-label label=\"recapiti\"></info-tip-label></h3>\r\n\t\t\t</mat-panel-title>\r\n\t\t</mat-expansion-panel-header>\r\n\t\t<lib-contatti\r\n\t\t\t[contatti]=\"datiRichiedente.contatto\"\r\n\t\t\t[recapiti$]=\"recapiti$\"\r\n\t\t\t(done)=\"recapitiReady($event)\"\r\n\t\t>\r\n\t\t</lib-contatti>\r\n\t</mat-expansion-panel>\r\n\t<div class=\"mt-4\"></div>\r\n\t<div *ngIf=\"(personaFisica$ | async)\">\r\n\t\t<lib-dati-domicilio\r\n\t\t\t[domicilio]=\"datiRichiedente.domicilio\"\r\n\t\t\t[domicili]=\"domicili$ | async\"\r\n\t\t\t[recapiti$]=\"recapiti$\"\r\n\t\t\t(done)=\"domiciliReady($event)\"\r\n\t\t>\r\n\t\t</lib-dati-domicilio>\r\n\t</div>\r\n\t<lib-stepper-navigator\r\n\t\t[form]=\"form\"\r\n\t\t[direction]=\"direction\"\r\n\t\t[isFinal]=\"isFinal\"\r\n\t\t[isContainerValid]=\"isDichiaranteValid\"\r\n\t\t(goForward)=\"forward($event)\"\r\n\t\t(salvaBozza)=\"onSalvaBozza($event)\"\r\n\t\t(complete)=\"complete($event)\"\r\n\t>\r\n\t</lib-stepper-navigator>\r\n</div>\r\n",
                    styles: [".mat-card{border-radius:0!important;border-top:5px solid #0a2644}.divider{background-color:#737373;height:1px;width:100%}.mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fff!important}.mat-select-value{max-width:100%;width:100%!important}"]
                },] }
    ];
    RichiedenteComponent.ctorParameters = function () { return []; };
    RichiedenteComponent.propDecorators = {
        datiRichiedente: [{ type: i0.Input }],
        personaFisica$: [{ type: i0.Input }],
        nextStep: [{ type: i0.Output }],
        salvaBozza: [{ type: i0.Output }]
    };

    /*! *****************************************************************************
    Copyright (c) Microsoft Corporation.

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    ***************************************************************************** */
    /* global Reflect, Promise */
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b)
                if (Object.prototype.hasOwnProperty.call(b, p))
                    d[p] = b[p]; };
        return extendStatics(d, b);
    };
    function __extends(d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    }
    var __assign = function () {
        __assign = Object.assign || function __assign(t) {
            for (var s, i = 1, n = arguments.length; i < n; i++) {
                s = arguments[i];
                for (var p in s)
                    if (Object.prototype.hasOwnProperty.call(s, p))
                        t[p] = s[p];
            }
            return t;
        };
        return __assign.apply(this, arguments);
    };
    function __rest(s, e) {
        var t = {};
        for (var p in s)
            if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
                t[p] = s[p];
        if (s != null && typeof Object.getOwnPropertySymbols === "function")
            for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
                if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                    t[p[i]] = s[p[i]];
            }
        return t;
    }
    function __decorate(decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
            r = Reflect.decorate(decorators, target, key, desc);
        else
            for (var i = decorators.length - 1; i >= 0; i--)
                if (d = decorators[i])
                    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    }
    function __param(paramIndex, decorator) {
        return function (target, key) { decorator(target, key, paramIndex); };
    }
    function __metadata(metadataKey, metadataValue) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
            return Reflect.metadata(metadataKey, metadataValue);
    }
    function __awaiter(thisArg, _arguments, P, generator) {
        function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
        return new (P || (P = Promise))(function (resolve, reject) {
            function fulfilled(value) { try {
                step(generator.next(value));
            }
            catch (e) {
                reject(e);
            } }
            function rejected(value) { try {
                step(generator["throw"](value));
            }
            catch (e) {
                reject(e);
            } }
            function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
            step((generator = generator.apply(thisArg, _arguments || [])).next());
        });
    }
    function __generator(thisArg, body) {
        var _ = { label: 0, sent: function () { if (t[0] & 1)
                throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
        return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
        function verb(n) { return function (v) { return step([n, v]); }; }
        function step(op) {
            if (f)
                throw new TypeError("Generator is already executing.");
            while (_)
                try {
                    if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
                        return t;
                    if (y = 0, t)
                        op = [op[0] & 2, t.value];
                    switch (op[0]) {
                        case 0:
                        case 1:
                            t = op;
                            break;
                        case 4:
                            _.label++;
                            return { value: op[1], done: false };
                        case 5:
                            _.label++;
                            y = op[1];
                            op = [0];
                            continue;
                        case 7:
                            op = _.ops.pop();
                            _.trys.pop();
                            continue;
                        default:
                            if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                                _ = 0;
                                continue;
                            }
                            if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
                                _.label = op[1];
                                break;
                            }
                            if (op[0] === 6 && _.label < t[1]) {
                                _.label = t[1];
                                t = op;
                                break;
                            }
                            if (t && _.label < t[2]) {
                                _.label = t[2];
                                _.ops.push(op);
                                break;
                            }
                            if (t[2])
                                _.ops.pop();
                            _.trys.pop();
                            continue;
                    }
                    op = body.call(thisArg, _);
                }
                catch (e) {
                    op = [6, e];
                    y = 0;
                }
                finally {
                    f = t = 0;
                }
            if (op[0] & 5)
                throw op[1];
            return { value: op[0] ? op[1] : void 0, done: true };
        }
    }
    var __createBinding = Object.create ? (function (o, m, k, k2) {
        if (k2 === undefined)
            k2 = k;
        Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
    }) : (function (o, m, k, k2) {
        if (k2 === undefined)
            k2 = k;
        o[k2] = m[k];
    });
    function __exportStar(m, o) {
        for (var p in m)
            if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
                __createBinding(o, m, p);
    }
    function __values(o) {
        var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
        if (m)
            return m.call(o);
        if (o && typeof o.length === "number")
            return {
                next: function () {
                    if (o && i >= o.length)
                        o = void 0;
                    return { value: o && o[i++], done: !o };
                }
            };
        throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
    }
    function __read(o, n) {
        var m = typeof Symbol === "function" && o[Symbol.iterator];
        if (!m)
            return o;
        var i = m.call(o), r, ar = [], e;
        try {
            while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
                ar.push(r.value);
        }
        catch (error) {
            e = { error: error };
        }
        finally {
            try {
                if (r && !r.done && (m = i["return"]))
                    m.call(i);
            }
            finally {
                if (e)
                    throw e.error;
            }
        }
        return ar;
    }
    /** @deprecated */
    function __spread() {
        for (var ar = [], i = 0; i < arguments.length; i++)
            ar = ar.concat(__read(arguments[i]));
        return ar;
    }
    /** @deprecated */
    function __spreadArrays() {
        for (var s = 0, i = 0, il = arguments.length; i < il; i++)
            s += arguments[i].length;
        for (var r = Array(s), k = 0, i = 0; i < il; i++)
            for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
                r[k] = a[j];
        return r;
    }
    function __spreadArray(to, from, pack) {
        if (pack || arguments.length === 2)
            for (var i = 0, l = from.length, ar; i < l; i++) {
                if (ar || !(i in from)) {
                    if (!ar)
                        ar = Array.prototype.slice.call(from, 0, i);
                    ar[i] = from[i];
                }
            }
        return to.concat(ar || Array.prototype.slice.call(from));
    }
    function __await(v) {
        return this instanceof __await ? (this.v = v, this) : new __await(v);
    }
    function __asyncGenerator(thisArg, _arguments, generator) {
        if (!Symbol.asyncIterator)
            throw new TypeError("Symbol.asyncIterator is not defined.");
        var g = generator.apply(thisArg, _arguments || []), i, q = [];
        return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
        function verb(n) { if (g[n])
            i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
        function resume(n, v) { try {
            step(g[n](v));
        }
        catch (e) {
            settle(q[0][3], e);
        } }
        function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
        function fulfill(value) { resume("next", value); }
        function reject(value) { resume("throw", value); }
        function settle(f, v) { if (f(v), q.shift(), q.length)
            resume(q[0][0], q[0][1]); }
    }
    function __asyncDelegator(o) {
        var i, p;
        return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
        function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
    }
    function __asyncValues(o) {
        if (!Symbol.asyncIterator)
            throw new TypeError("Symbol.asyncIterator is not defined.");
        var m = o[Symbol.asyncIterator], i;
        return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
        function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
        function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
    }
    function __makeTemplateObject(cooked, raw) {
        if (Object.defineProperty) {
            Object.defineProperty(cooked, "raw", { value: raw });
        }
        else {
            cooked.raw = raw;
        }
        return cooked;
    }
    ;
    var __setModuleDefault = Object.create ? (function (o, v) {
        Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function (o, v) {
        o["default"] = v;
    };
    function __importStar(mod) {
        if (mod && mod.__esModule)
            return mod;
        var result = {};
        if (mod != null)
            for (var k in mod)
                if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
                    __createBinding(result, mod, k);
        __setModuleDefault(result, mod);
        return result;
    }
    function __importDefault(mod) {
        return (mod && mod.__esModule) ? mod : { default: mod };
    }
    function __classPrivateFieldGet(receiver, state, kind, f) {
        if (kind === "a" && !f)
            throw new TypeError("Private accessor was defined without a getter");
        if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
            throw new TypeError("Cannot read private member from an object whose class did not declare it");
        return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
    }
    function __classPrivateFieldSet(receiver, state, value, kind, f) {
        if (kind === "m")
            throw new TypeError("Private method is not writable");
        if (kind === "a" && !f)
            throw new TypeError("Private accessor was defined without a setter");
        if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
            throw new TypeError("Cannot write private member to an object whose class did not declare it");
        return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
    }

    var TipiRichiedente = {
        RICORRENTE: 'Ricorrente',
        EREDE_RICORRENTE: 'Erede del Ricorrente',
        PERSONA_GIURIDICA_RAPPRESENTANTE_LEGALE: 'Persona Giuridica/Legale rappresentante di Società/Ditta/Ente',
        PROCURATORE_ANTISTATARIO: 'Procuratore Antistatario',
        EREDE_PROCURATORE_ANTISTATARIO: 'Erede del procuratore antistatario',
        TUTORE_PROCURATORE_LEGALE: 'Tutore/Procuratore legale',
        CURATORE_FALLIMENTARE: 'Curatore Fallimentare',
        ME_MEDESIMO: "Me medesimo"
    };
    var CodiceTipiRichiedente = {
        CODICE_RICORRENTE: 'RICORRENTE',
        CODICE_PROCURATORE_ANTISTATARIO: 'ANTISTATARIO',
        CODICE_EREDE_RICORRENTE: 'EREDE_RICORRENTE',
        CODICE_PERSONA_GIURIDICA_RAPPRESENTANTE_LEGALE: 'RAPPR_LEG',
        CODICE_EREDE_PROCURATORE_ANTISTATARIO: 'EREDE_ANTISTATARIO',
        CODICE_TUTORE_PROCURATORE_LEGALE: 'TUT',
        CODICE_CURATORE_FALLIMENTARE: 'CURATORE_FALLIMENTARE',
        CODICE_ME_MEDESIMO: 'ME_MEDESIMO'
    };

    var InfoAnagrafichePFDTO = /** @class */ (function () {
        function InfoAnagrafichePFDTO() {
        }
        return InfoAnagrafichePFDTO;
    }());

    var InfoNascitaPFDTO = /** @class */ (function () {
        function InfoNascitaPFDTO() {
        }
        return InfoNascitaPFDTO;
    }());

    var NaturaRichiedenteDTO = /** @class */ (function () {
        function NaturaRichiedenteDTO() {
        }
        return NaturaRichiedenteDTO;
    }());

    var PersonaFisicaBaseDTO = /** @class */ (function () {
        function PersonaFisicaBaseDTO() {
        }
        return PersonaFisicaBaseDTO;
    }());
    function nuovaPFBase() {
        var newPF = new PersonaFisicaBaseDTO();
        newPF.cognome = 'nuova-persona-fisica';
        newPF.nome = '';
        newPF.idPersona = 'nuovo';
        newPF.codTipoDelega = '';
        return newPF;
    }

    var PersonaFisicaDTO = /** @class */ (function () {
        function PersonaFisicaDTO() {
        }
        return PersonaFisicaDTO;
    }());

    var PersonaGiuridicaBaseDTO = /** @class */ (function () {
        function PersonaGiuridicaBaseDTO() {
        }
        return PersonaGiuridicaBaseDTO;
    }());
    function nuovaPGBase() {
        var newPG = new PersonaGiuridicaBaseDTO();
        newPG.ragioneSociale = 'nuova-persona-giuridica';
        newPG.idPersona = 'nuovo';
        newPG.codTipoDelega = '';
        return newPG;
    }

    var PersonaGiuridicaDTO = /** @class */ (function () {
        function PersonaGiuridicaDTO() {
        }
        return PersonaGiuridicaDTO;
    }());

    var RappresentanteDTO = /** @class */ (function () {
        function RappresentanteDTO() {
        }
        return RappresentanteDTO;
    }());

    var MieDelegheDTO = /** @class */ (function () {
        function MieDelegheDTO() {
        }
        return MieDelegheDTO;
    }());

    var DelegheService = /** @class */ (function () {
        function DelegheService(http, configurationService) {
            this.http = http;
            this.configurationService = configurationService;
            this.DELEGA_VALIDATA = 'TRUE';
            this.urlAnagrafe = this.configurationService.servicePaths.get("ANAGRAFE_MS_API_URL") + "/v1";
            this.urlAnagrafe2 = this.configurationService.servicePaths.get("ANAGRAFE_MS_API_URL") + "/v2";
            this.urlDeleghe = this.configurationService.servicePaths.get("DELEGHE_MS_API_URL") + "/v1";
            this.urlDeposito = configurationService.servicePaths.get("DEPOSITO_MS_API_URL") + "/v1";
        }
        DelegheService.prototype.getDatiSocieta = function (id) {
            // console.log('[getDatiSocieta - lib]', id);
            return this.http.put(this.urlDeposito + "/supporto/personagiuridica/delega", id);
        };
        DelegheService.prototype.getPersona = function (id) {
            // console.log('[getPersona - lib]', id);
            return this.http.get(this.urlAnagrafe + ("/personaFisica/" + id));
            // return this.http.get<PersonaFisica>(this.urlAnagrafe + "/personaFisica/" + "{id}");
        };
        DelegheService.prototype.getMieDeleghe = function () {
            var _this = this;
            return this.http.get(this.urlDeleghe + "/deleghe/mie")
                .pipe(operators.map(function (deleghe) {
                var deleghePF = deleghe.personeFisiche ?
                    deleghe.personeFisiche.filter(function (d) { return _this.DELEGA_VALIDATA == d.validata; })
                    : [];
                var deleghePG = deleghe.personeGiuridiche ?
                    deleghe.personeGiuridiche.filter(function (d) { return _this.DELEGA_VALIDATA == d.validata; })
                    : [];
                var delegheValidate = new MieDelegheDTO();
                delegheValidate.personeFisiche = deleghePF;
                delegheValidate.personeGiuridiche = deleghePG;
                return delegheValidate;
            }));
        };
        DelegheService.prototype.getListaPfPaged = function (pageSize, pageNumber, data) {
            // return this.http.post(this.urlAnagrafe + `/personeFisiche?offset=0&pageNumber=${pageNumber}&pageSize=${pageSize}&paged=false&sort.sorted=false&sort.unsorted=false&unpaged=false`, data);
            return this.http.post(this.urlAnagrafe + ("/personeFisiche?offset=0&pageNumber=" + pageNumber + "&pageSize=" + pageSize + "&paged=false&sort.sorted=false&sort.unsorted=false&unpaged=false"), data);
        };
        //TODO
        DelegheService.prototype.getListaPg = function (paginationData, filtroRicercaPersonaPG) {
            return this.http.post(this.urlAnagrafe + "/personeGiuridiche", filtroRicercaPersonaPG, { params: paginationData });
        };
        DelegheService.prototype.getListaPgPaged = function (pageSize, pageNumber, data) {
            return this.http.post(this.urlAnagrafe + ("/personeGiuridiche?offset=0&pageNumber=" + pageNumber + "&pageSize=" + pageSize + "&paged=false&sort.sorted=false&sort.unsorted=false&unpaged=false"), data);
        };
        DelegheService.prototype.getPersonaGiuridicaCodiceFiscale = function (codiceFiscale) {
            // console.log('[getPersonaGiuridicaCodiceFiscale] - codiceFiscale', codiceFiscale);
            //TODO
            // const url: string = this.urlAnagrafe2 + `/personaGiuridica/codiceFiscale`;
            // SE_SI_TRATTA_DI_UNA_NUOVA_PG => SI_DEVE_CHIAMARE_LA_SEGUENTE_SERVIZIO
            var url = this.urlDeposito + "/supporto/personagiuridica";
            // console.log('[getPersonaGiuridicaCodiceFiscale] - url', url);
            return this.http.put(url, codiceFiscale);
        };
        DelegheService.prototype.getPersonaFiscaleCodiceFiscale = function (codiceFiscale) {
            // console.log('[getPersonaFiscaleCodiceFiscale] - codiceFiscale', codiceFiscale);
            var url = this.urlAnagrafe2 + "/personaFisica/codiceFiscale";
            // console.log('[getPersonaFiscaleCodiceFiscale] - url', url);
            return this.http.put(url, codiceFiscale);
        };
        DelegheService.prototype.getListRtsCodiceRegione = function (listaCodiceRegione) {
            // console.log('[getListRtsCodiceRegione] - listaCodiceRegione', listaCodiceRegione);
            var url = this.urlDeposito + "/rtsdto";
            // console.log('[getListRtsCodiceRegione] - url', url);
            return this.http.put(url, listaCodiceRegione);
        };
        DelegheService.prototype.naturaRichiedente = function (request) {
            var url = this.urlDeposito + "/naturarichiedente";
            // console.log('[naturaRichiedente] - url', url);
            // console.log('[naturaRichiedente] - request', request);
            return this.http.put(url, request);
        };
        DelegheService.prototype.getValidaPersonaFisica = function (request) {
            console.log('[getValidaPersonaFisica] - request', request);
            var url = this.urlDeposito + "/supporto";
            console.log('[getValidaPersonaFisica] - url', url);
            return this.http.put(url, request);
        };
        DelegheService.prototype.getAllProvince = function () {
            var url = this.urlAnagrafe + "/province/mappa/";
            console.log('[MappaProvince] - url', url);
            return this.http.get(url).pipe(operators.shareReplay());
        };
        return DelegheService;
    }());
    DelegheService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DelegheService_Factory() { return new DelegheService(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(ConfigurationService)); }, token: DelegheService, providedIn: "root" });
    DelegheService.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    DelegheService.ctorParameters = function () { return [
        { type: i1.HttpClient },
        { type: ConfigurationService }
    ]; };

    var Utente = /** @class */ (function () {
        function Utente(codiceFiscale, nome, cognome, dataDiNascita, email, pec, denominazione, partitaIVA, idPersonaFisica) {
            this.codiceFiscale = codiceFiscale;
            this.nome = nome;
            this.cognome = cognome;
            this.dataDiNascita = dataDiNascita;
            this.email = email;
            this.pec = pec;
            this.denominazione = denominazione;
            this.partitaIVA = partitaIVA;
            this.idPersonaFisica = idPersonaFisica;
        }
        Utente.prototype.hasPartitaIva = function () {
            return this.partitaIVA != null && this.partitaIVA.length == 11;
        };
        return Utente;
    }());

    var UtenteService = /** @class */ (function () {
        function UtenteService(configurationService) {
            this.configurationService = configurationService;
            console.log('[UtenteService]');
            // console.log('[userProfile]', configurationService.userProfile);
            var utenteDTO = new angularPortalShellApp.UtenteDTO();
            utenteDTO = configurationService.userProfile;
            if (utenteDTO) {
                this.userDetails = utenteDTO.spidUserDetails;
                this.utente = new Utente(this.userDetails.fiscalNumber, this.userDetails.name, this.userDetails.familyName, this.userDetails.dateOfBirth, this.userDetails.email, this.userDetails.digitalAddress, this.userDetails.companyName, this.userDetails.ivaCode, utenteDTO.idPersonaFisica
                //TODO
                // utenteDTO.idPersonaFisica = "df2a6439-1439-4273-b1ec-2a3d8245faa5"
                // utenteDTO.idPersonaFisica = "978089b2-d63c-4274-8cee-de843110749a"
                );
            }
        }
        UtenteService.prototype.getSpidUserDetails = function () {
            return this.userDetails;
        };
        UtenteService.prototype.getUtente = function () {
            return this.utente;
        };
        return UtenteService;
    }());
    UtenteService.ɵprov = i0.ɵɵdefineInjectable({ factory: function UtenteService_Factory() { return new UtenteService(i0.ɵɵinject(ConfigurationService)); }, token: UtenteService, providedIn: "root" });
    UtenteService.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    UtenteService.ctorParameters = function () { return [
        { type: ConfigurationService }
    ]; };

    var _a;
    var isDefined = function (x) { return x !== undefined; };
    var ɵ0 = isDefined;
    var isUndefined = function (x) { return x === undefined; };
    var ɵ1 = isUndefined;
    var isNotUndefined = function (x) { return not(isUndefined(x)); };
    var ɵ2 = isNotUndefined;
    var isNull = function (x) { return x === null; };
    var ɵ3 = isNull;
    var isNullOrUndefined = function (x) { return isNull(x) || isUndefined(x); };
    var ɵ4 = isNullOrUndefined;
    var isNotNull = function (x) { return x !== null; };
    var ɵ5 = isNotNull;
    var isNotNullOrUndefined = function (x) { return not(isNullOrUndefined(x)); };
    var ɵ6 = isNotNullOrUndefined;
    var isString = function (x) { return typeof x == "string"; };
    var ɵ7 = isString;
    var self = function (x) { return x; };
    var ɵ8 = self;
    var curry = function (v) { return function () { return v; }; };
    var ɵ9 = curry;
    var bind = function (f) { return function (thisArg) { return f.bind(thisArg); }; };
    var ɵ10 = bind;
    var partial1 = function (f) { return function (a1) { return function (args) { return f.apply(void 0, __spread([a1], args)); }; }; };
    var ɵ11 = partial1;
    var lazyApply1 = function (f) { return function (a1) { return f(a1); }; };
    var ɵ12 = lazyApply1;
    var is = function (a) { return function (b) { return a === b; }; };
    var ɵ13 = is;
    var isGreaterThan = function (a) { return function (b) { return b > a; }; };
    var ɵ14 = isGreaterThan;
    var isLessThan = function (a) { return function (b) { return b < a; }; };
    var ɵ15 = isLessThan;
    var isGreaterOrEqualTo = function (a) { return function (b) { return b >= a; }; };
    var ɵ16 = isGreaterOrEqualTo;
    var isLessOrEqualTo = function (a) { return function (b) { return b <= a; }; };
    var ɵ17 = isLessOrEqualTo;
    var not = function (a) { return !a; };
    var ɵ18 = not;
    var coalesce = function (obj, orValue) { return (function (v) { return (v.valueOf = function () { return isDefined(obj) ? obj : orValue; }, v); })(function (prop) { return coalesce((obj || {})[prop], orValue); }); };
    var ɵ19 = coalesce;
    var givenMap = (_a = {},
        _a[true] = function () { return givenFound; },
        _a[false] = function () { return givenNotFound; },
        _a);
    var givenFound = function (x, newVal) { return ({
        when: function () { return givenFound(x, newVal); },
        otherwise: function () { return givenFound(x, newVal); },
        valueOf: curry(newVal)
    }); };
    var ɵ20 = givenFound;
    var givenNotFound = function (x, newVal) { return ({
        when: function (condition, newVal) { return givenMap[condition(x)]()(x, newVal); },
        otherwise: function (val) { return givenNotFound(x, val); },
        valueOf: curry(newVal)
    }); };
    var ɵ21 = givenNotFound;
    var given = function (x) { return ({
        when: function (condition, newVal) { return givenMap[condition(x)]()(x, newVal); },
        otherwise: curry,
        valueOf: curry(x)
    }); };
    var ɵ22 = given;
    var ftor = function (x) { return ({ map: function (f) { return ftor(f(x)); }, valueOf: curry(x) }); };
    var ɵ23 = ftor;
    var protoOf = function (x) { return given(x)
        .when(isNull, curry(null))
        .when(isUndefined, curry(undefined))
        .otherwise(function () { return Object.getPrototypeOf(x); })
        .valueOf()(); };
    var ɵ24 = protoOf;
    var constructorOf = function (x) { return protoOf(x).constructor; };
    var ɵ25 = constructorOf;
    var annotationsOf = function (x) { return constructorOf(x)['__annotations__']; };
    var ɵ26 = annotationsOf;
    var constructorNameOf = function (x) { return constructorOf(x).name; };
    var ɵ27 = constructorNameOf;

    var GenericModalData = /** @class */ (function () {
        function GenericModalData() {
        }
        return GenericModalData;
    }());
    var Azione = /** @class */ (function () {
        function Azione(testo, effetto) {
            if (effetto === void 0) { effetto = function () { }; }
            this.testo = testo;
            this.effetto = effetto;
        }
        return Azione;
    }());

    var GenericModalComponent = /** @class */ (function () {
        function GenericModalComponent(modalData, dialogRef) {
            this.modalData = modalData;
            this.dialogRef = dialogRef;
        }
        GenericModalComponent.prototype.eseguiAzione = function (azione) {
            if (azione.effetto) {
                azione.effetto();
            }
        };
        return GenericModalComponent;
    }());
    GenericModalComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-generic-modal',
                    template: "<!-- <p>generic-modal works!</p> -->\r\n<h1 mat-dialog-title>\r\n\t{{ modalData.title | traduzione }}\r\n</h1>\r\n<div mat-dialog-content>\r\n\t<p *ngFor=\"let paragrafo of modalData.paragrafi\">\r\n\t\t{{paragrafo | traduzione}}\r\n\t</p>\r\n</div>\r\n<div mat-dialog-actions class=\"d-flex flex-row-reverse mb-0\">\r\n\r\n\t<button *ngFor=\"let azione of modalData.azioni\" mat-raised-button color=\"primary\" [mat-dialog-close]=\"\"\r\n\t\t(click)=\"eseguiAzione(azione)\" cdkFocusInitial>\r\n\t\t{{azione.testo | traduzione}}\r\n\t</button>\r\n\r\n</div>",
                    styles: [""]
                },] }
    ];
    GenericModalComponent.ctorParameters = function () { return [
        { type: GenericModalData, decorators: [{ type: i0.Inject, args: [i1$1.MAT_DIALOG_DATA,] }] },
        { type: i1$1.MatDialogRef }
    ]; };

    var Modals = /** @class */ (function () {
        function Modals(dialog) {
            this.dialog = dialog;
            this.AZIONE_DEFAULT = [new Azione("ok")];
        }
        Modals.prototype.success = function (paragrafi, azioni) {
            if (azioni === void 0) { azioni = this.AZIONE_DEFAULT; }
            var modalData = this.buildModalData("modal-ok", paragrafi, azioni);
            this.openConfirm(modalData);
        };
        Modals.prototype.failure = function (paragrafi, azioni) {
            if (azioni === void 0) { azioni = this.AZIONE_DEFAULT; }
            var modalData = this.buildModalData("modal-ko", paragrafi, azioni);
            this.openConfirm(modalData);
        };
        Modals.prototype.buildModalData = function (title, paragrafi, azioni) {
            var data = new GenericModalData();
            data.title = title;
            data.paragrafi = paragrafi;
            data.azioni = azioni;
            return data;
        };
        Modals.prototype.openConfirm = function (modalData) {
            this.dialog.open(GenericModalComponent, {
                data: modalData,
                panelClass: modalData.title === "modal-ok" ? 'custom-modalbox-ok' : 'custom-modalbox-ko'
            });
        };
        return Modals;
    }());
    Modals.ɵprov = i0.ɵɵdefineInjectable({ factory: function Modals_Factory() { return new Modals(i0.ɵɵinject(i1$1.MatDialog)); }, token: Modals, providedIn: "root" });
    Modals.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    Modals.ctorParameters = function () { return [
        { type: i1$1.MatDialog }
    ]; };

    function log(text, value) {
        console.log(text, value);
    }
    var DelegheComponent = /** @class */ (function () {
        function DelegheComponent(delegheService, modals, msg, utenteService, ref) {
            this.delegheService = delegheService;
            this.modals = modals;
            this.msg = msg;
            this.utenteService = utenteService;
            this.ref = ref;
            this.nextStep = new i0.EventEmitter();
            this.previousStep = new i0.EventEmitter();
            this.salvaBozza = new i0.EventEmitter();
            this.isGeneralContractor = new i0.EventEmitter();
            this.displayedColumns = ['tipo', 'indirizzo', 'seleziona'];
            this.CODICE_LEGALE = "LEGALE";
            this.direction = "both-ways";
            this.isFinal = false;
            this.defaultDeleghe = false;
            this.showComponentPF = false;
            this.showComponentPG = false;
            this.isSearching = false;
            this.formControlGeneralContractor = false;
            this.flagDelegaSeStesso = false;
            this.changesPersonaFisica$ = new rxjs.Subject();
            this.changesPersonaGiuridica$ = new rxjs.Subject();
            this.validazioneeSede = false;
            this.couldBeDittaIndividuale = true;
        }
        DelegheComponent.prototype.ngOnInit = function () {
            var _this = this;
            var _a;
            this.utente = this.utenteService.getUtente();
            console.log('[DelegheComponent] - Utente', this.utente);
            this.tipologiaDeposito$
                .subscribe(function (deposito) {
                console.log('[tipologiaDeposito$]', deposito);
                //TODO
                if (deposito.codice == "CDE") {
                    _this.formControlGeneralContractor = true;
                }
                _this.codiceTipoDeposito = deposito.codice;
            });
            //TODO
            var richiedenteSubscription = this.tipologieRichiedenti$
                // .pipe(
                // 	pluck("residenza"))
                .subscribe(function (richiedente) {
                console.log('[NaturaRichiedenteDTO]', richiedente);
                if (_this.rappresentanza) {
                    var selectedItem = richiedente.find(function (r) { return r.codice == _this.rappresentanza.codiceDelega; });
                    if (selectedItem) {
                        _this.couldBeDittaIndividuale = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.dittaIndividuale;
                    }
                }
            }, function (_) {
                // this.modals.failure([
                // 	"recupero.natura.failure"
                // ], []);
            });
            this.form = new forms.FormGroup({});
            var valid = true;
            if (!this.rappresentanza) {
                this.initRappresentante();
                valid = false;
            }
            else {
                this.idSedeSelezionata = this.rappresentanza.idSedeSelezionata;
                if (this.rappresentanza.nuovaPersona) {
                    this.isNew = true;
                    this.delega = 'nuovo';
                    if (this.rappresentanza.tipoRappresentante == "PF") {
                        this.listaDelegheDefault = [nuovaPFBase()];
                        this.showComponentPF = true;
                        log("showComponentPF", this.showComponentPF);
                    }
                    else {
                        this.listaDelegheDefault = [nuovaPGBase()];
                        this.showComponentPG = true;
                    }
                    this.defaultDeleghe = true;
                    this.listaDeleghe = [];
                    var richiedenteSubscription_1 = this.tipologieRichiedenti$.pipe(operators.map(function (r) { return r.filter(function (t) { return t.codice == _this.rappresentanza.codiceDelega; }); })).subscribe(function (richiedente) {
                        var filterByTipoRichiedente = function (tipiRichiedente) { return tipiRichiedente.filter(function (tr) { return tr.codTipoDelega == richiedente[0].codice; }); };
                        if (_this.isPersonaFisica(richiedente[0].tipoPersona)) {
                            _this.deleghe$.pipe(operators.pluck("personeFisiche"), operators.map(filterByTipoRichiedente)).
                                subscribe(function (res) {
                                if (res.length > 0) {
                                    _this.listaDeleghe = __spread(res, _this.listaDeleghe);
                                }
                                // console.log('[ListaDeleghe - personeFisiche ]', this.listaDeleghe);
                            });
                        }
                        if (_this.isPersonaGiuridica(richiedente[0].tipoPersona)) {
                            _this.deleghe$.pipe(operators.pluck("personeGiuridiche"), operators.map(filterByTipoRichiedente)).
                                subscribe(function (res) {
                                if (res.length > 0) {
                                    if (_this.listaDeleghe.length > 0) {
                                        _this.listaDeleghe = __spread(res, _this.listaDeleghe);
                                    }
                                    else {
                                        _this.listaDeleghe = __spread(res);
                                    }
                                }
                            });
                        }
                        if (richiedente[0].tipoPersona.length > 1) {
                            if (_this.rappresentanza.tipoRappresentante == "PF") {
                                _this.listaDeleghe = __spread(_this.listaDeleghe, [nuovaPFBase(), nuovaPGBase()]);
                            }
                            else {
                                _this.listaDeleghe = __spread(_this.listaDeleghe, [nuovaPGBase(), nuovaPFBase()]);
                            }
                        }
                        else {
                            if (richiedente[0].tipoPersona.find(function (element) { return element == "PF"; })) {
                                _this.listaDeleghe = __spread(_this.listaDeleghe, [nuovaPFBase()]);
                            }
                            else {
                                _this.listaDeleghe = __spread(_this.listaDeleghe, [nuovaPGBase()]);
                            }
                        }
                        _this.listaDelegheDefault = [_this.listaDeleghe.find(function (el) { return el.idPersona == "nuovo"; })];
                        _this.deleghe.setValue(_this.listaDelegheDefault[0]);
                        richiedenteSubscription_1.unsubscribe();
                    }, function (_) {
                    });
                }
            }
            this.nsDanteCausa = "nsRapprDc";
            this.nsTutore = "nsRapprTut";
            this.nsLegale = "nsRapprLeg";
            this.namespaceInfoPf = this.nsTutore + "PFinfoPF";
            this.nspg = this.nsLegale + "pg";
            if ((_a = this === null || this === void 0 ? void 0 : this.rappresentanza) === null || _a === void 0 ? void 0 : _a.codiceDelega) {
                var initalTipoRichiedente = this.fromIdAndTipo(this.rappresentanza.codiceDelega, this.rappresentanza.tipoRappresentante);
                this.tipoRichiedente = new forms.FormControl({ value: initalTipoRichiedente, disabled: false }, [forms.Validators.required]);
            }
            else {
                this.tipoRichiedente = new forms.FormControl({ value: null, disabled: false }, [forms.Validators.required]);
            }
            this.form.addControl("tipoRichiedente", this.tipoRichiedente);
            this.deleghe = new forms.FormControl({ value: '', disabled: false }, 
            // { value: this.defaultDeleghe ? this.listaDelegheDefault[0] : '', disabled: false },
            [forms.Validators.required]);
            this.form.addControl("deleghe", this.deleghe);
            this.generalContractor = new forms.FormControl({ value: this.generalContractorValue, disabled: false });
            this.form.addControl('generalContractor', this.generalContractor);
            this.selection = new collections.SelectionModel(false, []);
            var selected = new forms.FormControl({ value: '', disabled: false });
            this.form.addControl('selected', selected);
            if (this.tipoRichiedente.value != undefined &&
                !this.rappresentanza.nuovaPersona &&
                this.tipoRichiedente.value != CodiceTipiRichiedente.CODICE_ME_MEDESIMO) {
                var richiedenteSubscription_2 = this.tipologieRichiedenti$.pipe(operators.map(function (r) { return r.filter(function (t) { return t.codice == _this.rappresentanza.codiceDelega; }); }), operators.tap(function (tipo) {
                    console.log('initDeleghe:', tipo[0]);
                    _this.initDeleghe(tipo[0]);
                })).subscribe(function (richiedente) {
                    if (_this.isPersonaFisica(richiedente[0].tipoPersona)) {
                        _this.personaFisicaBase = _this.initPersonaFisica(_this.rappresentanza.idPersona);
                    }
                    if (_this.isPersonaGiuridica(richiedente[0].tipoPersona)) {
                        _this.personaGiuridicaBase = _this.initPersonaGiuridica(_this.rappresentanza.idPersona);
                    }
                    richiedenteSubscription_2.unsubscribe();
                }, function (_) {
                });
            }
            this.tipoRichiedente$ = this.tipoRichiedente.valueChanges.pipe(operators.tap(function (_) {
                _this.deleghe.setValue(null);
                _this.resetValidation();
                _this.flagDelegaSeStesso = false;
                _this.ref.detectChanges();
            }), operators.tap(function (tipo) {
                var _a;
                if (tipo.codice != CodiceTipiRichiedente.CODICE_ME_MEDESIMO) {
                    _this.initDeleghe(tipo);
                    _this.rappresentanza.idSedeSelezionata = null;
                }
                else {
                    _this.resetDeleghe();
                    _this.rappresentanza.idPersona = (_a = _this.utente) === null || _a === void 0 ? void 0 : _a.idPersonaFisica;
                    _this.rappresentanza.tipoRappresentante = "PF";
                }
            }), operators.shareReplay());
            var changesDelega$ = this.deleghe.valueChanges.pipe(operators.map(function (delega) {
                return ComponentOutputStatus.of(true, function (rappresentanza) {
                    if (delega != undefined && delega != null) {
                        _this.delega = delega.idPersona;
                        if (!_this.defaultDeleghe) {
                            _this.setDelega(delega);
                        }
                        else {
                            _this.defaultDeleghe = false;
                        }
                        _this.flagDelegaSeStesso = false;
                        _this.ref.detectChanges();
                        rappresentanza.idPersona = delega.idPersona != 'nuovo' ? delega.idPersona : null;
                    }
                });
            }));
            var tipoRichiedenteChanges$ = this.tipoRichiedente$.pipe(operators.map(function (tipoRichiedente) {
                return ComponentOutputStatus.of(_this.tipoRichiedente.valid, function (rap) {
                    // rap.tipoRappresentante = tipoRichiedente.descrizione;
                    rap.codiceDelega = tipoRichiedente.codice;
                });
            }));
            var rappresentante$ = ComponentReducer.reducer4(tipoRichiedenteChanges$, changesDelega$, this.changesPersonaFisica$, this.changesPersonaGiuridica$, function (richiedente) {
                var isValid;
                if (coalesce(richiedente, '')('codiceDelega').valueOf() != CodiceTipiRichiedente.CODICE_ME_MEDESIMO) {
                    if (_this.delega == 'nuovo') {
                        isValid = (_this.rappresentanza.personaFisica != null ||
                            _this.rappresentanza.personaGiuridica != null) &&
                            _this.deleghe.value && !_this.flagDelegaSeStesso;
                    }
                    else {
                        // isValid = this.rappresentanza.idPersona != null && this.deleghe.value;
                        isValid =
                            richiedente.idPersona != null &&
                                _this.deleghe.value &&
                                !_this.flagDelegaSeStesso;
                    }
                }
                else {
                    isValid = true;
                }
                _this.ref.detectChanges();
                return isValid;
            }, ComponentOutputStatus.of(valid, this.rappresentanza));
            rappresentante$.subscribe(function (delegante) {
                console.log("[DelegheComponent] rappresentanza", delegante);
                _this.isFormValid = delegante.status;
            });
        };
        DelegheComponent.prototype.resetValidation = function () {
            this.changesPersonaFisica$.next(ComponentOutputStatus.of(true, function (personaFisica) { return function (rap) { }; }));
            this.changesPersonaGiuridica$.next(ComponentOutputStatus.of(true, function (personaGiuridica) { return function (rap) { }; }));
        };
        DelegheComponent.prototype.forward = function (_) {
            this.nextStep.emit(this.rappresentanza);
        };
        DelegheComponent.prototype.onSalvaBozza = function ($event) {
            this.salvaBozza.emit(this.rappresentanza);
        };
        DelegheComponent.prototype.backward = function ($event) {
            this.previousStep.emit(this.rappresentanza);
        };
        DelegheComponent.prototype.complete = function ($event) { };
        DelegheComponent.prototype.initRappresentante = function () {
            this.rappresentanza = new RappresentanteDTO();
        };
        DelegheComponent.prototype.ngOnDestroy = function () {
            if (this.tipoRichiedenteSub) {
                this.tipoRichiedenteSub.unsubscribe();
            }
            if (this.$selected) {
                this.$selected.unsubscribe();
            }
        };
        DelegheComponent.prototype.setDelega = function (persona) {
            var _this = this;
            this.delega = persona.idPersona;
            this.resetDeleghe();
            this.showComponentPF = false;
            this.showComponentPG = false;
            if (persona.cognome) {
                if (persona.idPersona != "nuovo") {
                    this.getPersonaFisica(persona.idPersona);
                }
                else {
                    this.mapperPersonaFisica(null);
                    setTimeout(function () { return _this.showComponentPF = true; }, 0);
                }
            }
            if (persona.ragioneSociale) {
                if (persona.idPersona != "nuovo") {
                    this.getPersonaGiuridica(persona.idPersona);
                }
                else {
                    this.mapperPersonaGiuridica(null);
                    setTimeout(function () { return _this.showComponentPG = true; }, 0);
                }
            }
        };
        DelegheComponent.prototype.hasSelecteDelegante = function () {
            return this.deleghe.value;
        };
        DelegheComponent.prototype.viewDeleghe = function () {
            return (coalesce(this.tipoRichiedente.value, '')('codice').valueOf() === "" ||
                coalesce(this.tipoRichiedente.value, '')('codice').valueOf() === CodiceTipiRichiedente.CODICE_ME_MEDESIMO);
        };
        DelegheComponent.prototype.getPersonaFisica = function (id) {
            var _this = this;
            this.resetValidation();
            this.rappresentanza.idSedeSelezionata = null;
            this.showComponentPF = false;
            this.personaFisica$ = this.delegheService.getPersona(id)
                .pipe(operators.shareReplay());
            this.pfSubscription = this.personaFisica$.pipe().subscribe(function (pf) {
                var _a, _b;
                _this.mapperPersonaFisica(pf.datiPersonaFisica);
                _this.personaFisica = pf.datiPersonaFisica;
                _this.rappresentanza.idPersona = id;
                _this.rappresentanza.tipoRappresentante = "PF";
                _this.rappresentanza.codiceRegione = (_b = (_a = pf === null || pf === void 0 ? void 0 : pf.residenza) === null || _a === void 0 ? void 0 : _a.regione) === null || _b === void 0 ? void 0 : _b.sigla;
                _this.showComponentPF = true;
                _this.showComponentPG = false;
            }, function (_) {
            });
        };
        DelegheComponent.prototype.getPersonaGiuridica = function (id) {
            var _this = this;
            this.resetValidation();
            this.rappresentanza.idSedeSelezionata = null;
            this.showComponentPG = false;
            this.personaGiuridica$ = this.delegheService.getDatiSocieta(id)
                .pipe(operators.shareReplay());
            this.pgSubscription = this.personaGiuridica$.pipe().subscribe(function (pg) {
                var _a, _b, _c;
                _this.form.get('selected').setValue('');
                _this.mapperPersonaGiuridica(pg);
                _this.personaGiuridica = pg;
                _this.rappresentanza.idPersona = id;
                _this.rappresentanza.tipoRappresentante = "PG";
                _this.showComponentPG = true;
                _this.showComponentPF = false;
                if ((pg === null || pg === void 0 ? void 0 : pg.sedi) != undefined) {
                    var sede = pg.sedi.filter(function (sedeLegale) { return sedeLegale.tipoSede.codice === "LEGALE"; });
                    _this.rappresentanza.codiceRegione = (_c = (_b = (_a = sede[0]) === null || _a === void 0 ? void 0 : _a.indirizzo) === null || _b === void 0 ? void 0 : _b.regione) === null || _c === void 0 ? void 0 : _c.sigla;
                }
                _this.ref.detectChanges();
            }, function (_) {
            });
        };
        DelegheComponent.prototype.isPersonaFisica = function (tipoPersona) {
            var isValid;
            if (tipoPersona.find(function (element) { return element == "PF"; })) {
                isValid = true;
            }
            else {
                isValid = false;
            }
            return isValid;
        };
        DelegheComponent.prototype.isPersonaGiuridica = function (tipoPersona) {
            var isValid;
            if (tipoPersona.find(function (element) { return element == "PG"; })) {
                isValid = true;
            }
            else {
                isValid = false;
            }
            return isValid;
        };
        DelegheComponent.prototype.initDeleghe = function (tipoRichiedente) {
            var _this = this;
            this.listaDeleghe = [];
            console.log('tipoRichiedente:', tipoRichiedente);
            this.couldBeDittaIndividuale = tipoRichiedente === null || tipoRichiedente === void 0 ? void 0 : tipoRichiedente.dittaIndividuale;
            var filterByTipoRichiedente = function (tipiRichiedente) { return tipiRichiedente.filter(function (tr) { return tr.codTipoDelega == tipoRichiedente.codice; }); };
            if (this.isPersonaFisica(tipoRichiedente.tipoPersona)) {
                this.deleghe$.pipe(operators.pluck("personeFisiche"), operators.map(filterByTipoRichiedente)).
                    subscribe(function (res) {
                    _this.listaDeleghe = __spread(res, [nuovaPFBase()]);
                    _this.deleghe.setValue(_this.listaDeleghe.find(function (el) { return el.idPersona == _this.rappresentanza.idPersona; }));
                });
            }
            if (this.isPersonaGiuridica(tipoRichiedente.tipoPersona)) {
                this.deleghe$.pipe(operators.pluck("personeGiuridiche"), operators.map(filterByTipoRichiedente)).
                    subscribe(function (res) {
                    if (_this.listaDeleghe.length > 0) {
                        _this.listaDeleghe = _this.listaDeleghe.reduce(function (acc, currentValue, index) {
                            if (_this.listaDeleghe.length - 1 == index) {
                                acc.push.apply(acc, __spread(res, [nuovaPGBase()]));
                            }
                            return acc;
                        }, _this.listaDeleghe);
                    }
                    else {
                        _this.listaDeleghe = __spread(res, [nuovaPGBase()]);
                    }
                    _this.deleghe.setValue(_this.listaDeleghe.find(function (el) { return el.idPersona == _this.rappresentanza.idPersona; }));
                });
            }
        };
        DelegheComponent.prototype.resetDeleghe = function () {
            this.rappresentanza.idPersona = null;
            this.rappresentanza.nuovaPersona = false;
            this.rappresentanza.personaFisica = null;
            this.rappresentanza.personaGiuridica = null;
            this.rappresentanza.tipoRappresentante = null;
            this.personaGiuridica = null;
            this.personaGiuridica$ = null;
            this.personaFisica = null;
        };
        DelegheComponent.prototype.mapperPersonaFisica = function (datiPersona) {
            var _a, _b;
            var personaFisica = new PersonaFisicaDTO();
            var infoAnagrafiche = new InfoAnagrafichePFDTO();
            personaFisica.infoAnagrafiche = infoAnagrafiche;
            var infoNascita = new InfoNascitaPFDTO();
            personaFisica.infoNascita = infoNascita;
            if (datiPersona) {
                infoAnagrafiche.codFiscale = datiPersona.codiceFiscale;
                infoAnagrafiche.cognome = datiPersona.cognome;
                infoAnagrafiche.nome = datiPersona.nome;
                personaFisica.infoAnagrafiche = infoAnagrafiche;
                infoNascita.comuneNascita = (_a = datiPersona.comuneNascita) === null || _a === void 0 ? void 0 : _a.codiceCatastale;
                infoNascita.provinciaNascita = (_b = datiPersona.provinciaNascita) === null || _b === void 0 ? void 0 : _b.sigla;
                infoNascita.dataNascita = moment(datiPersona.dataNascita, "DD/MM/YYYY").toDate();
                personaFisica.infoNascita = infoNascita;
            }
            this.rappresentanza.personaFisica = personaFisica;
        };
        DelegheComponent.prototype.initPersonaFisica = function (id) {
            var _this = this;
            var personaFisica = new PersonaFisicaBaseDTO();
            this.showComponentPF = false;
            this.personaFisica$ = this.delegheService.getPersona(id)
                .pipe(operators.shareReplay());
            this.pfSubscription = this.personaFisica$.pipe(operators.pluck("datiPersonaFisica")).subscribe(function (pf) {
                _this.mapperPersonaFisica(pf);
                _this.rappresentanza.idPersona = id;
                personaFisica.codTipoDelega = _this.rappresentanza.codiceDelega;
                personaFisica.codiceFiscale = pf.codiceFiscale;
                personaFisica.cognome = pf.cognome;
                personaFisica.nome = pf.nome;
                personaFisica.idPersona = pf.id;
                _this.showComponentPF = true;
                _this.showComponentPG = false;
            }, function (_) {
            });
            return personaFisica;
        };
        DelegheComponent.prototype.initPersonaGiuridica = function (id) {
            var _this = this;
            var personaGiuridica = new PersonaGiuridicaBaseDTO();
            this.showComponentPG = false;
            this.personaGiuridica$ = this.delegheService.getDatiSocieta(id)
                .pipe(operators.shareReplay());
            this.pgSubscription = this.personaGiuridica$.pipe().subscribe(function (pg) {
                _this.mapperPersonaGiuridica(pg);
                personaGiuridica.codTipoDelega = _this.rappresentanza.codiceDelega;
                personaGiuridica.codiceFiscale = pg.datiPersonaGiuridica.codiceFiscale;
                personaGiuridica.ragioneSociale = pg.datiPersonaGiuridica.ragioneSociale;
                personaGiuridica.pIva = pg.datiPersonaGiuridica.partitaIVA;
                personaGiuridica.idPersona = pg.datiPersonaGiuridica.id;
                _this.rappresentanza.idPersona = id;
                _this.showComponentPG = true;
                _this.showComponentPF = false;
                _this.deleghe.setValue(_this.listaDeleghe.find(function (el) { return el.idPersona == personaGiuridica.idPersona; }));
            }, function (_) {
            });
            return personaGiuridica;
        };
        DelegheComponent.prototype.mapperPersonaGiuridica = function (datiPersona) {
            // console.log('[mapperPersonaGiuridica]', datiPersona);
            var personaGiuridica = new PersonaGiuridicaDTO();
            if (datiPersona) {
                personaGiuridica.codiceFiscale = datiPersona.datiPersonaGiuridica.codiceFiscale;
                personaGiuridica.ragioneSociale = datiPersona.datiPersonaGiuridica.ragioneSociale;
                personaGiuridica.partitaIVA = datiPersona.datiPersonaGiuridica.partitaIVA;
                personaGiuridica.idPersonaGiuridica = datiPersona.datiPersonaGiuridica.id;
                personaGiuridica.sedi = datiPersona.sedi;
            }
            this.rappresentanza.personaGiuridica = personaGiuridica;
        };
        DelegheComponent.prototype.personaFisicaReady = function (personaFisicaStatus) {
            var _this = this;
            console.log('[personaFisicaReady]', personaFisicaStatus);
            this.resetValidation();
            this.rappresentanza.idSedeSelezionata = null;
            this.changesPersonaFisica$.next(personaFisicaStatus.mapValue(function (personaFisica) { return function (rap) {
                var _a, _b, _c;
                _this.rappresentanza.idPersona = personaFisica.id;
                rap.personaFisica = personaFisica;
                if (_this.delega == "nuovo") {
                    rap.codiceRegione = personaFisica.infoAnagrafiche.codiceRegione;
                    rap.nuovaPersona = true;
                }
                (rap.tipoRappresentante = "PF");
                if (((_a = _this.utente) === null || _a === void 0 ? void 0 : _a.codiceFiscale) === ((_c = (_b = personaFisica === null || personaFisica === void 0 ? void 0 : personaFisica.infoAnagrafiche) === null || _b === void 0 ? void 0 : _b.codFiscale) === null || _c === void 0 ? void 0 : _c.toUpperCase())) {
                    _this.flagDelegaSeStesso = true;
                }
                else {
                    _this.flagDelegaSeStesso = false;
                }
                _this.ref.detectChanges();
            }; }));
        };
        DelegheComponent.prototype.personaGiuridicaReady = function (personaGiuridicaStatus) {
            var _this = this;
            console.log("[personaGiuridicaReady]", personaGiuridicaStatus);
            this.resetValidation();
            this.flagDelegaSeStesso = false;
            this.changesPersonaGiuridica$.next(personaGiuridicaStatus.mapValue(function (personaGiuridica) { return function (rap) {
                var _a;
                rap.personaGiuridica = personaGiuridica;
                rap.tipoRappresentante = "PG";
                _this.rappresentanza.idSedeSelezionata = null;
                _this.rappresentanza.idPersona = personaGiuridica.idPersonaGiuridica;
                if (((_a = personaGiuridica === null || personaGiuridica === void 0 ? void 0 : personaGiuridica.sedi) === null || _a === void 0 ? void 0 : _a.length) > 0) {
                    _this.rappresentanza.idSedeSelezionata = personaGiuridica.sedi[0].id;
                }
                if (_this.delega == "nuovo") {
                    _this.isValidSedi = personaGiuridicaStatus.status;
                    rap.nuovaPersona = true;
                    rap.codiceRegione = personaGiuridica.codiceRegione;
                }
                _this.ref.detectChanges();
            }; }));
        };
        DelegheComponent.prototype.richiedenteComparator = function (m1, m2) {
            return (m1 || {}).codice == (m2 || {}).codice;
        };
        DelegheComponent.prototype.delegheComparator = function (m1, m2) {
            return (m1 || {}).codTipoDelega == (m2 || {}).codTipoDelega;
        };
        DelegheComponent.prototype.fromIdAndTipo = function (codice, tipoNaturaRichiedente) {
            var naturaRichiedente = new NaturaRichiedenteDTO();
            naturaRichiedente.codice = codice;
            naturaRichiedente.descrizione = tipoNaturaRichiedente;
            return naturaRichiedente;
        };
        DelegheComponent.prototype.onChangeGeneralContractor = function (event) {
            this.isGeneralContractor.emit(event.checked);
        };
        return DelegheComponent;
    }());
    DelegheComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-deleghe',
                    template: "<div class=\"mt-3 mb-5\" [formGroup]=\"form\">\r\n\t<mat-card>\r\n\t\t<h3 class=\"h5 mb-0\">\r\n\t\t\t<info-tip-label label=\"tipo-richiedente\"></info-tip-label>\r\n\t\t</h3>\r\n\t\t<div class=\"row\">\r\n\r\n\t\t\t<div class=\"col-md-8\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<mat-label>{{'required' | traduzione}}{{'tipo-soggetto' | traduzione}}</mat-label>\r\n\t\t\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"tipoRichiedente\"\r\n\t\t\t\t\t\t\t\t\t\t\t[compareWith]=\"richiedenteComparator\">\r\n\t\t\t\t\t\t<mat-option *ngFor=\"let tipoRichiedenteTipo of tipologieRichiedenti$ | async\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t[value]=\"tipoRichiedenteTipo\">\r\n\t\t\t\t\t\t\t{{ tipoRichiedenteTipo.descrizione }}\r\n\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls[ 'tipoRichiedente'].invalid\">\r\n\t\t\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['tipoRichiedente']) | traduzione}}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t<mat-hint *infoTip=\"'tipo-soggetto'\"></mat-hint>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div class=\"row\" *ngIf=\"!viewDeleghe()\">\r\n\t\t\t<div class=\"col-md-8\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<mat-label>{{'required' | traduzione}}{{'deleghe-rappresentante' | traduzione }}</mat-label>\r\n\t\t\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"deleghe\"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<mat-option *ngFor=\"let item of listaDeleghe\" [value]=\"item\">\r\n\t\t\t\t\t\t\t<ng-container *ngIf=\"item.ragioneSociale else templatePersonaFisica\">\r\n\t\t\t\t\t\t\t\t{{item.idPersona === 'nuovo' ? (item.ragioneSociale | traduzione) : item.ragioneSociale}}\r\n\t\t\t\t\t\t\t</ng-container>\r\n\t\t\t\t\t\t\t<ng-template #templatePersonaFisica>\r\n\t\t\t\t\t\t\t\t{{(item.idPersona === 'nuovo' ? (item.nome + ' ' + (item.cognome | traduzione)) : (item.nome + ' ' + item.cognome))}}\r\n\t\t\t\t\t\t\t</ng-template>\r\n\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t<mat-error *ngIf=\"form.controls['deleghe'].invalid\">\r\n\t\t\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['deleghe']) | traduzione}}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t<mat-hint *infoTip=\"'deleghe-rappresentante'\"></mat-hint>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<br>\r\n\t</mat-card>\r\n\t<div class=\"mt-4\"></div>\r\n\t<mat-expansion-panel class=\"panel\" *ngIf=\"hasSelecteDelegante() && !viewDeleghe()\" [expanded]=\"true\">\r\n\t\t<mat-expansion-panel-header [collapsedHeight]=\"'48px'\" [expandedHeight]=\"'48px'\" class=\"custom-header\">\r\n\t\t\t<mat-panel-title>\r\n\t\t\t\t<h3 class=\"h5 mb-0\">\r\n\t\t\t\t\t<info-tip-label label=\"tipologia-rappresentante-{{codiceTipoDeposito}}\"></info-tip-label>\r\n\t\t\t\t</h3>\r\n\t\t\t</mat-panel-title>\r\n\t\t</mat-expansion-panel-header>\r\n\t\t<div class=\"mt-4\"></div>\r\n\t\t<div *ngIf=\"formControlGeneralContractor\" class=\"col-md-4\">\r\n\t\t\t<div class=\"row\">\r\n\t\t\t\t<mat-checkbox formControlName=\"generalContractor\" (change)=\"onChangeGeneralContractor($event)\">\r\n\t\t\t\t\t<info-tip-label label=\"general-contractor\"></info-tip-label>\r\n\t\t\t\t</mat-checkbox>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\r\n\t\t<lib-persona-fisica\r\n\t\t\t*ngIf=\"showComponentPF\"\r\n\t\t\t(done)=\"personaFisicaReady($event)\"\r\n\t\t\t[nazioni]=\"nazioni\"\r\n\t\t\t[province]=\"province\"\r\n\t\t\t[namespace]=\"namespaceInfoPf\"\r\n\t\t\t[infoPersonaFisica]=\"rappresentanza?.personaFisica\"\r\n\t\t\t[idDelega]=\"rappresentanza?.idPersona\"\r\n\t\t\t[validatorFormControl]=\"true\"\r\n\t\t\t[nuovaPersona]=\"isNew\"\r\n\t\t>\r\n\t\t</lib-persona-fisica>\r\n\r\n\t\t<lib-persona-giuridica\r\n\t\t\t*ngIf=\"showComponentPG\"\r\n\t\t\t(done)=\"personaGiuridicaReady($event)\"\r\n\t\t\t[namespace]=\"nspg\"\r\n\t\t\t[datisocieta]=\"rappresentanza?.personaGiuridica\"\r\n\t\t\t[validatorFormControl]=\"true\"\r\n\t\t\t[gestioneSedi]=\"true\"\r\n\t\t\t[idSedeSelezionata]=\"idSedeSelezionata\"\r\n\t\t\t[personaGiuridicaFromDeleghe$]=\"personaGiuridica$\"\r\n\t\t\t[couldBeDittaIndividuale]=\"couldBeDittaIndividuale\"\r\n\t\t>\r\n\t\t</lib-persona-giuridica>\r\n\t</mat-expansion-panel>\r\n\t<div class=\"collapse-body mt-2\">\r\n\t\t<div class=\"col-md-12\">\r\n\t\t\t<mat-error *ngIf=\"flagDelegaSeStesso\">\r\n\t\t\t\t{{'validation-tipo-ricorrente' | traduzione }}\r\n\t\t\t</mat-error>\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"mt-4\"></div>\r\n\t<lib-stepper-navigator\r\n\t\t[form]=\"form\"\r\n\t\t[direction]=\"direction\"\r\n\t\t[isFinal]=\"isFinal\"\r\n\t\t[isContainerValid]=\"isFormValid\"\r\n\t\t(goForward)=\"forward($event)\"\r\n\t\t(goBackward)=\"backward($event)\"\r\n\t\t(salvaBozza)=\"onSalvaBozza($event)\"\r\n\t\t(complete)=\"complete($event)\"\r\n\t>\r\n\t</lib-stepper-navigator>\r\n</div>\r\n",
                    styles: [".mat-card{border-radius:0!important;border-top:5px solid #0a2644}.divider{background-color:#737373;height:1px;width:100%}.mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fff!important}.mat-select-value{max-width:100%;width:100%!important}"]
                },] }
    ];
    DelegheComponent.ctorParameters = function () { return [
        { type: DelegheService },
        { type: Modals },
        { type: MessageService },
        { type: UtenteService },
        { type: i0.ChangeDetectorRef }
    ]; };
    DelegheComponent.propDecorators = {
        rappresentanza: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        nazioni: [{ type: i0.Input }],
        tipologieRichiedenti$: [{ type: i0.Input }],
        deleghe$: [{ type: i0.Input }],
        tipologiaDeposito$: [{ type: i0.Input }],
        generalContractorValue: [{ type: i0.Input }],
        nextStep: [{ type: i0.Output }],
        previousStep: [{ type: i0.Output }],
        salvaBozza: [{ type: i0.Output }],
        isGeneralContractor: [{ type: i0.Output }]
    };

    var SAMPLE_TIME = 1000;
    var EMPTY_PF = {
        id: null,
        infoAnagrafiche: {
            codFiscale: null,
            codiceRegione: null,
            cognome: null,
            nome: null
        },
        infoNascita: {
            comuneNascita: null,
            dataNascita: null,
            provinciaNascita: null,
            nazioneNascita: null,
            isNatoEstero: null,
            codCatNazioneNascita: null
        }
    };
    var PersonaFisicaComponent = /** @class */ (function () {
        function PersonaFisicaComponent(delegheService) {
            this.delegheService = delegheService;
            this.done = new i0.EventEmitter();
            this.changesPF$ = new rxjs.ReplaySubject(1);
            this.changesNascita$ = new rxjs.ReplaySubject(1);
            this.readOnly = false;
            this.isPersonaFisicaValid = new rxjs.BehaviorSubject(false);
            this.datiVerifica = {};
        }
        PersonaFisicaComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.form = new forms.FormGroup({});
            var valid = false;
            if (!this.infoPersonaFisica) {
                this.initPersonaFisica();
                valid = false;
            }
            else {
                this.readOnly = true;
            }
            if (this.idDelega == null || this.nuovaPersona) {
                this.readOnly = false;
            }
            this.namespaceInfoPf = this.namespace + "infoPF";
            this.namespaceInfoNascita = this.namespace + "infoNascita";
            var mappaProvince$ = this.delegheService.getAllProvince();
            this.personaFisicaChangedSub = rxjs.combineLatest([this.changesPF$, this.changesNascita$, mappaProvince$])
                .pipe(operators.map(function (_c) {
                var _d = __read(_c, 3), validPF = _d[0], changesNascita = _d[1], allProvince = _d[2];
                var _a;
                var provincia = allProvince[(_a = changesNascita === null || changesNascita === void 0 ? void 0 : changesNascita.output) === null || _a === void 0 ? void 0 : _a.provinciaNascita];
                return [validPF, changesNascita, provincia];
            }), operators.auditTime(SAMPLE_TIME), operators.concatMap(function (_c) {
                var _d = __read(_c, 3), infoAnagrafiche = _d[0], infoNascita = _d[1], provincia = _d[2];
                return _this.getPersonaFisicaValid(infoAnagrafiche, infoNascita, provincia);
            }), operators.startWith(ComponentOutputStatus.of(valid, this.infoPersonaFisica)), operators.tap(function (pf) { return _this.done.emit(pf); }))
                .subscribe();
        };
        PersonaFisicaComponent.prototype.getPersonaFisicaValid = function (infoAnagrafiche, infoNascita, provincia) {
            var _this = this;
            console.log("FORM VALIDITY", infoNascita.status);
            if (!infoNascita.status || !infoAnagrafiche.status) {
                this.isPersonaFisicaValid.next(false);
                return rxjs.of(ComponentOutputStatus.of(false, EMPTY_PF));
            }
            return this.validatePersonaFisica(infoAnagrafiche.output, infoNascita.output)
                .pipe(operators.tap(function () { return _this.isPersonaFisicaValid.next(true); }), operators.map(function (response) {
                var isPersonaFisicaValid = isNotNull(response);
                return _this.toValidPf(isPersonaFisicaValid, response, infoAnagrafiche.output, provincia, infoNascita);
            }), operators.tap(function (_c) {
                var isValid = _c.isValid;
                return _this.isPersonaFisicaValid.next(isValid);
            }), operators.tap(function (_c) {
                var persona = _c.persona;
                return _this.infoPersonaFisica = persona;
            }), operators.map(function (v) { return ComponentOutputStatus.of(v.isValid, v.persona); }), operators.catchError(function (_) { return rxjs.of(ComponentOutputStatus.of(false, EMPTY_PF)); }));
        };
        PersonaFisicaComponent.prototype.toValidPf = function (isPersonaFisicaValid, response, infoAnagrafiche, provincia, infoNascita) {
            var _a, _b;
            return {
                isValid: isPersonaFisicaValid,
                persona: {
                    id: response === null || response === void 0 ? void 0 : response.id,
                    infoAnagrafiche: {
                        codFiscale: String(infoAnagrafiche.codFiscale),
                        codiceRegione: String(provincia === null || provincia === void 0 ? void 0 : provincia.siglaReg),
                        cognome: String(infoAnagrafiche.cognome),
                        nome: String(infoAnagrafiche.nome)
                    },
                    infoNascita: {
                        comuneNascita: ((_a = infoNascita === null || infoNascita === void 0 ? void 0 : infoNascita.output) === null || _a === void 0 ? void 0 : _a.comuneNascita) ? String(infoNascita.output.comuneNascita) : null,
                        dataNascita: infoNascita.output.dataNascita,
                        provinciaNascita: String(infoNascita.output.provinciaNascita),
                        nazioneNascita: String(infoNascita.output.nazioneNascita),
                        codCatNazioneNascita: String(infoNascita.output.codCatNazioneNascita),
                        isNatoEstero: ((_b = infoNascita.output) === null || _b === void 0 ? void 0 : _b.isNatoEstero) ? infoNascita.output.isNatoEstero : false
                    }
                }
            };
        };
        PersonaFisicaComponent.prototype.validatePersonaFisica = function (infoAnagrafiche, infoNascita) {
            // var d = new Date(infoNascita.dataNascita);
            // d.toLocaleString('it-IT', { timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone })
            return this.delegheService.getValidaPersonaFisica({
                codiceFiscale: infoAnagrafiche.codFiscale,
                cognome: infoAnagrafiche.cognome,
                comune: (infoNascita === null || infoNascita === void 0 ? void 0 : infoNascita.isNatoEstero) ? null : infoNascita === null || infoNascita === void 0 ? void 0 : infoNascita.comuneNascita
                // , dataNascita: new Date(moment(infoNascita.dataNascita, 'DD/MM/YYYY').add(23, 'hour').add(59, 'minute').add(59, 'second').toDate())
                ,
                dataNascita: new Date(infoNascita.dataNascita).toISOString(),
                nome: infoAnagrafiche.nome,
                provinciaNascita: infoNascita.provinciaNascita,
                siglaNazione: infoNascita.nazioneNascita,
                codCatNazioneNascita: infoNascita === null || infoNascita === void 0 ? void 0 : infoNascita.codCatNazioneNascita
            });
        };
        PersonaFisicaComponent.prototype.initPersonaFisica = function () {
            this.infoPersonaFisica = new PersonaFisicaDTO();
        };
        PersonaFisicaComponent.prototype.infoPfReady = function (inFoPfStatus) {
            // console.log("[infoPfReady]", inFoPfStatus);
            this.changesPF$.next(inFoPfStatus);
        };
        PersonaFisicaComponent.prototype.infoNascitaReady = function (infoNascitaPf) {
            // console.log("[infoNascitaReady]", infoNascitaPf);
            this.changesNascita$.next(infoNascitaPf);
        };
        PersonaFisicaComponent.prototype.ngOnDestroy = function () {
            this.personaFisicaChangedSub.unsubscribe();
        };
        PersonaFisicaComponent.prototype.resetForm = function () {
            this.infoPF._resetForm();
            this.infoNascita._resetForm();
        };
        return PersonaFisicaComponent;
    }());
    PersonaFisicaComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: "lib-persona-fisica",
                    template: "<form [formGroup]=\"form\">\r\n\t<lib-info-pf\r\n\t\t[cfDifferentFrom]=\"cfDifferentFrom\"\r\n\t\t[namespace]=\"namespaceInfoPf\"\r\n\t\t(done)=\"infoPfReady($event)\"\r\n\t\t[infopf]=\"infoPersonaFisica?.infoAnagrafiche\"\r\n\t\t[readOnly]=\"readOnly\"\r\n\t\t[validatorFormControl]=\"true\"\r\n\t\t#infoPF\r\n\t>\r\n\t</lib-info-pf>\r\n\t<lib-info-nascita\r\n\t\t[province]=\"province\"\r\n\t\t(done)=\"infoNascitaReady($event)\"\r\n\t\t[infonascita]=\"infoPersonaFisica?.infoNascita\"\r\n\t\t[readOnly]=\"readOnly\"\r\n\t\t#infoNascita\r\n\t>\r\n\t</lib-info-nascita>\r\n\t<div class=\"collapse-body mt-2\">\r\n\t\t<div class=\"col-md-12\">\r\n\t\t\t<mat-error *ngIf=\"!(isPersonaFisicaValid | async)\">\r\n\t\t\t\t{{'validationPF' | traduzione }}\r\n\t\t\t</mat-error>\r\n\t\t</div>\r\n\t</div>\r\n</form>\r\n",
                    styles: [""]
                },] }
    ];
    PersonaFisicaComponent.ctorParameters = function () { return [
        { type: DelegheService }
    ]; };
    PersonaFisicaComponent.propDecorators = {
        infoPersonaFisica: [{ type: i0.Input }],
        cfDifferentFrom: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        nazioni: [{ type: i0.Input }],
        namespace: [{ type: i0.Input }],
        idDelega: [{ type: i0.Input }],
        nuovaPersona: [{ type: i0.Input }],
        done: [{ type: i0.Output }],
        infoPF: [{ type: i0.ViewChild, args: ['infoPF',] }],
        infoNascita: [{ type: i0.ViewChild, args: ['infoNascita',] }]
    };

    var CodiceFiscaleService = /** @class */ (function () {
        function CodiceFiscaleService() {
        }
        return CodiceFiscaleService;
    }());

    // @Injectable()
    // @dynamic
    var ValidationService = /** @class */ (function () {
        function ValidationService(checkCFService) {
            this.checkCFService = checkCFService;
        }
        ValidationService.ValidateMail = function (control) {
            if (ValidationService.formatoEmail.test(control.value)) {
                return null;
            }
            return { invalidMail: true };
        };
        ValidationService.ValidateDate = function (control) {
            if (new Date().getTime() < control.value) {
                return { invalidDate: true };
            }
            return null;
        };
        ValidationService.ValidateName = function (control) {
            if (ValidationService.formatoName.test(control.value)) {
                return null;
            }
            return { invalidName: true };
        };
        ValidationService.ValidatePassword = function (control) {
            if (ValidationService.passwordPattern.test(control.value)) {
                return null;
            }
            return { invalidPassword: true };
        };
        ValidationService.ValidateIban = function (control) {
            if (ValidationService.iban.test(control.value)) {
                return null;
            }
            return { invalidIban: true };
        };
        ValidationService.ValidateCodiceFiscale = function (control) {
            if (ValidationService.codiceFiscale.test(control.value)) {
                return null;
            }
            return { codiceFiscaleInvalido: true };
        };
        ValidationService.ValidatePartitaIva = function (control) {
            if (ValidationService.partitaIva.test(control.value)) {
                return null;
            }
            return { invalidPartitaIva: true };
        };
        ValidationService.pattern = function (pattern, error) {
            return function (c) {
                var _a;
                return forms.Validators.pattern(pattern)(c) ? (_a = {}, _a[error] = true, _a) : null;
            };
        };
        ValidationService.trigger = function (dependentControl, predicate) {
            if (predicate === void 0) { predicate = function (_) { return _; }; }
            var originalValidator = dependentControl.validator;
            return function (dependentValidators) {
                return function (control) {
                    var e_1, _a;
                    if (predicate(control.value)) {
                        try {
                            for (var dependentValidators_1 = __values(dependentValidators), dependentValidators_1_1 = dependentValidators_1.next(); !dependentValidators_1_1.done; dependentValidators_1_1 = dependentValidators_1.next()) {
                                var validator = dependentValidators_1_1.value;
                                var newError = validator(dependentControl);
                                if (newError) {
                                    dependentControl.setErrors(newError);
                                    break;
                                }
                            }
                        }
                        catch (e_1_1) { e_1 = { error: e_1_1 }; }
                        finally {
                            try {
                                if (dependentValidators_1_1 && !dependentValidators_1_1.done && (_a = dependentValidators_1.return)) _a.call(dependentValidators_1);
                            }
                            finally { if (e_1) throw e_1.error; }
                        }
                        dependentControl.setValidators(dependentValidators);
                    }
                    else {
                        dependentControl.setValidators(originalValidator);
                        dependentControl.setErrors(null);
                    }
                    return null;
                };
            };
        };
        ValidationService.NotEquals = function (value, message) {
            return function (control) {
                var _a;
                return value != control.value
                    ? null
                    : (_a = {},
                        _a[message] = true,
                        _a);
            };
        };
        ValidationService.prototype.userValidator = function (tipoPersona) {
            var _this = this;
            return function (control) {
                return _this.checkCFService
                    .validaCodiceFiscale$(control.value, tipoPersona)
                    .pipe(operators.map(function (outcome) { return (!outcome.valid ? { invalidCF: true } : null); }), operators.catchError(function (error) {
                    return rxjs.of({ validationServiceFailed: true });
                }));
            };
        };
        return ValidationService;
    }());
    ValidationService.capPattern = "[0-9][0-9][0-9][0-9][0-9]";
    ValidationService.passwordPattern = /^(?:(?=.*\d)(?=.*[A-Z]).{8,})/;
    ValidationService.zeroCentoPattern = "^([0-9]|[1-9][0-9]|100)$";
    // tslint:disable-next-line:max-line-length
    ValidationService.formatoData = /^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/;
    ValidationService.importoPattern = "^[0-9]+(,[0-9]{1,2}){0,1}$";
    // tslint:disable-next-line:max-line-length
    ValidationService.formatoEmail = /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/;
    // tslint:disable-next-line:max-line-length
    ValidationService.iban = /^(?:(?:IT|SM)\d{2}[A-Z]\d{22}|CY\d{2}[A-Z]\d{23}|NL\d{2}[A-Z]{4}\d{10}|LV\d{2}[A-Z]{4}\d{13}|(?:BG|BH|GB|IE)\d{2}[A-Z]{4}\d{14}|GI\d{2}[A-Z]{4}\d{15}|RO\d{2}[A-Z]{4}\d{16}|KW\d{2}[A-Z]{4}\d{22}|MT\d{2}[A-Z]{4}\d{23}|NO\d{13}|(?:DK|FI|GL|FO)\d{16}|MK\d{17}|(?:AT|EE|KZ|LU|XK)\d{18}|(?:BA|HR|LI|CH|CR)\d{19}|(?:GE|DE|LT|ME|RS)\d{20}|IL\d{21}|(?:AD|CZ|ES|MD|SA)\d{22}|PT\d{23}|(?:BE|IS)\d{24}|(?:FR|MR|MC)\d{25}|(?:AL|DO|LB|PL)\d{26}|(?:AZ|HU)\d{27}|(?:GR|MU)\d{28})$/;
    // /^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$/
    ValidationService.codiceFiscale = /([a-z]{6}|[A-Z]{6})(l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|\d{1})(l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|\d{1})(a|b|c|d|e|h|l|m|p|r|s|t|A|B|C|D|E|H|L|M|P|R|S|T)((((l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|0|1|2|3|4|5|6)(l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|\d{1}))|71|70|TM|Tm|tM|tm|TL|tl|Tl|tL))([a-z]{1}|[A-Z]{1})(L|M|N|P|Q|R|S|T|U|V|\d{1})(l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|\d{1})(l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|\d{1})([a-z]{1}|[A-Z]{1})/;
    ValidationService.partitaIva = /^[0-9]{11}$/;
    ValidationService.partitaIvaMaxLen2 = /^[0-9]{2,11}$/;
    ValidationService.codiceFiscalePiva = "^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$|^[0-9]{11}$";
    ValidationService._codiceFiscalePiva = /^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$|^[0-9]{11}$/;
    ValidationService.anno = /^[1-2][0-9]{3}$/;
    ValidationService.nSentenza = /^[0-9]*\/[1-2][0-9]{3}$/;
    ValidationService.numberPattern = /^[0-9]*$/;
    ValidationService.phoneNumberPattern = /^\+{0,1}[0-9]*$/;
    ValidationService.moneyPattern = /^([0-9]+)|((([1-9][0-9]*)|([0-9]))([,])[0-9]{2})$/;
    ValidationService.moneyCommaSeparated = /^\d+,\d{2}$/;
    ValidationService.numbers = /^\d+/;
    ValidationService.formatoName = /^[a-zA-Zàèìòùé ']+$/;

    var InfoPfComponent = /** @class */ (function () {
        function InfoPfComponent(msg, validationService, cfService, delegheService) {
            this.msg = msg;
            this.validationService = validationService;
            this.cfService = cfService;
            this.delegheService = delegheService;
            this.readOnly = false;
            this.validatorFormControl = false;
            this.done = new i0.EventEmitter();
            this.codiceRegione = "";
        }
        InfoPfComponent.prototype.ngOnInit = function () {
            var _this = this;
            // console.log('[InfoAnagrafichePFDTO]', this.infopf);
            this.form = new forms.FormGroup({});
            if (this.resetForm) {
                this.subscription = this.resetForm.subscribe(function (val) { return val ? _this.pulisciForm() : ""; });
            }
            if (!this.infopf) {
                this.initInfoPf();
            }
            var cfValidators = [
                forms.Validators.required,
                ValidationService.pattern(ValidationService.codiceFiscale, "cfInvalidoFormalmente"),
            ];
            if (this.cfDifferentFrom != null) {
                cfValidators.push(ValidationService.NotEquals(this.cfDifferentFrom, "cfDifferentRichiedente"));
            }
            var codiceFiscale = new forms.FormControl({ value: this.infopf.codFiscale, disabled: false }, 
            // cfValidators
            // this.validatorFormControl ? cfValidators: Validators.nullValidator,
            [
                this.validatorFormControl ? forms.Validators.required : forms.Validators.nullValidator,
                ValidationService.pattern(ValidationService.codiceFiscale, "cfInvalidoFormalmente"),
            ]
            //TODO
            // [this.validationService.userValidator(TipiPersona.PERSONA_FISICA)]
            );
            this.form.addControl("codiceFiscale", codiceFiscale);
            var nome = new forms.FormControl({ value: this.infopf.nome, disabled: false }, [
                // Validators.required,
                //	ValidationService.ValidateName,
                this.validatorFormControl ? forms.Validators.required : forms.Validators.nullValidator,
                ValidationService.pattern(ValidationService.formatoName, "formatoName")
            ]);
            this.form.addControl("nome", nome);
            var cognome = new forms.FormControl({ value: this.infopf.cognome, disabled: false }, [
                //Validators.required,
                //ValidationService.ValidateName
                this.validatorFormControl ? forms.Validators.required : forms.Validators.nullValidator,
                ValidationService.pattern(ValidationService.formatoName, "formatoName")
            ]);
            this.form.addControl("cognome", cognome);
            // TODO
            // this.validationSub = codiceFiscale.valueChanges.pipe(
            // 	filter(val => val.length == 16),
            // 	auditTime(500)
            // )
            // 	.pipe(
            // 		tap((_) => {
            // 			if (codiceFiscale.errors) {
            // 				delete codiceFiscale.errors["invalidCF"];
            // 			}
            // 		}),
            // 		filter((cf) => codiceFiscale.valid),
            // 		switchMap((cf) =>
            // 			//TODO
            // 			// this.cfService
            // 			// 	.validaCodiceFiscale$(cf, "F")
            // 			// 	.pipe(catchError((err) => empty()))
            // 			this.delegheService.getPersonaFiscaleCodiceFiscale(cf)
            // 				.pipe(
            // 					//TODO
            // 					// catchError((err) => empty())
            // 					catchError(err => {
            // 						codiceFiscale.setErrors({ invalidCF: true });
            // 						return EMPTY;
            // 					})
            // 				)
            // 		),
            // 		tap((validationResult) => {
            // 			console.log('[validationResult]', validationResult);
            // 			// if (!validationResult.valid) {
            // 			if (validationResult == null) {
            // 				codiceFiscale.setErrors({ invalidCF: true });
            // 			} else {
            // 				if (validationResult.residenza != undefined) {
            // 					this.codiceRegione = validationResult?.residenza?.regione?.sigla;
            // 				}
            // 			}
            // 			this.form.updateValueAndValidity();
            // 		})
            // 	)
            // 	.subscribe();
            var changes$ = this.form.valueChanges.pipe(operators.map(function (_) {
                _this.removeSpace(_this.form.controls["codiceFiscale"].value);
                var pf = new InfoAnagrafichePFDTO();
                pf.codFiscale = _this.form.controls["codiceFiscale"].value;
                pf.nome = _this.form.controls["nome"].value;
                pf.cognome = _this.form.controls["cognome"].value;
                pf.codiceRegione = _this.codiceRegione;
                return pf;
            }), operators.startWith(this.infopf), operators.map(function (pf) {
                // console.log(
                // 	"pf form valid",
                // 	FormUtils.getFormValidationErrors(this.form)
                // );
                var status = ComponentOutputStatus.of(!_this.form.invalid || _this.readOnly == true, pf);
                // console.log("status", status);
                return status;
            }));
            this.pfSub = changes$.subscribe(function (_) { return _this.done.emit(_); });
            if (this.readOnly) {
                this.form.disable();
            }
        };
        InfoPfComponent.prototype.removeSpace = function (value) {
            var reWhiteSpace = /\s/g;
            if (reWhiteSpace.test(value)) {
                this.form.get('codiceFiscale').setValue(value.replace(reWhiteSpace, ''));
            }
        };
        InfoPfComponent.prototype.ngOnDestroy = function () {
            if (this.pfSub) {
                this.pfSub.unsubscribe();
            }
            if (this.validationSub) {
                this.validationSub.unsubscribe();
            }
            if (this.subscription) {
                this.subscription.unsubscribe();
            }
        };
        InfoPfComponent.prototype.initInfoPf = function () {
            var infoPfNew = new InfoAnagrafichePFDTO();
            //TODO
            // if (this.userDetail) {
            // 	infoPfNew.codFiscale = this.userDetail["fiscalNumber"];
            // 	infoPfNew.cognome = this.userDetail["familyName"];
            // 	infoPfNew.nome = this.userDetail["name"];
            // }
            this.infopf = infoPfNew;
        };
        InfoPfComponent.prototype.pulisciForm = function () {
            var _this = this;
            var keys = Object.keys(this.form.value);
            keys.forEach(function (key) {
                var control = _this.form.get(key);
                control.setValue("");
            });
        };
        InfoPfComponent.prototype._resetForm = function () {
            var _a;
            (_a = this.form) === null || _a === void 0 ? void 0 : _a.reset();
        };
        return InfoPfComponent;
    }());
    InfoPfComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: "lib-info-pf",
                    template: "<form [formGroup]=\"form\">\r\n\t<div class=\"row my-2\">\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}}{{'codice-fiscale' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{validatorFormControl ? ('required' | traduzione): ''}} {{'codice-fiscale' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"codiceFiscale\" uppercase style=\"text-transform: uppercase\" maxlength=\"16\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['codiceFiscale'].invalid\">\r\n\t\t\t\t\t{{msg.produceCFMessage(form.controls['codiceFiscale']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'codice-fiscale'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}}{{'nome' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{validatorFormControl ? ('required' | traduzione): ''}} {{'nome' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"nome\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['nome'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('obbligatorio',form.controls['nome']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'nome'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}}{{'cognome' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{validatorFormControl ? ('required' | traduzione): ''}} {{'cognome' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"cognome\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['cognome'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('obbligatorio',form.controls['cognome']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'cognome'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n</form>",
                    styles: [""]
                },] }
    ];
    InfoPfComponent.ctorParameters = function () { return [
        { type: MessageService },
        { type: ValidationService },
        { type: CodiceFiscaleService },
        { type: DelegheService }
    ]; };
    InfoPfComponent.propDecorators = {
        infopf: [{ type: i0.Input }],
        namespace: [{ type: i0.Input }],
        cfDifferentFrom: [{ type: i0.Input }],
        readOnly: [{ type: i0.Input }],
        resetForm: [{ type: i0.Input }],
        validatorFormControl: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var TerritorioService = /** @class */ (function () {
        function TerritorioService(http, configurationService, appRef) {
            var _this = this;
            this.http = http;
            this.configurationService = configurationService;
            this.appRef = appRef;
            console.log('[TerritorioService]');
            this.urlAnagrafe = configurationService.servicePaths.get("ANAGRAFE_MS_API_URL") + "/v1";
            console.log('[urlAnagrafe - lib]', this.urlAnagrafe);
            var lingua$ = configurationService.lingua$;
            // console.log('[lingua]', configurationService.servicePaths.get("I18N_MS_API_URL"));
            //TODO
            // const urlNazioni: string = this.paths.get_V1Nazioni();
            var urlNazioni = this.urlAnagrafe + "/nazioni";
            // console.log('[urlNazioni]', urlNazioni);
            this.nazioni$ = lingua$.pipe(operators.switchMap(function (lingua) { return _this.http.get(urlNazioni, { headers: new i1.HttpHeaders({ 'i18n_language': lingua }) }); }), operators.tap(function (_) { return appRef.tick(); }), operators.shareReplay());
            //TODO
            // const urlProvince: string = this.paths.get_V1Province();
            var urlProvince = this.urlAnagrafe + '/province';
            // console.log('[urlProvince]', urlProvince);
            // TODO
            // const urlRegioni: string = this.urlAnagrafe + '/regioni';
            var urlRegioni = this.urlAnagrafe + '/regioni/nonSoppresse/';
            //TODO
            // this.province$ = this.http.get<Array<Localita>>(urlProvince);
            this.province$ = lingua$.pipe(operators.switchMap(function (lingua) { return _this.http.get(urlProvince, { headers: new i1.HttpHeaders({ 'i18n_language': lingua }) }); }), operators.tap(function (_) { return appRef.tick(); }), operators.shareReplay());
            this.regioni$ = lingua$.pipe(operators.switchMap(function (lingua) { return _this.http.get(urlRegioni, { headers: new i1.HttpHeaders({ 'i18n_language': lingua }) }); }), operators.tap(function (_) { return appRef.tick(); }), operators.shareReplay());
        }
        TerritorioService.prototype.getProvince$ = function () {
            return this.province$;
        };
        TerritorioService.prototype.getProvincePerRegione$ = function (regione) {
            var _this = this;
            //TODO
            // return this.configurationService.lingua$
            // 	.pipe(switchMap(lingua => this.http.get<Array<Localita>>(
            // 		this.urlAnagrafe + `/regione/${regione.sigla}/province`,
            // 		{ headers: new HttpHeaders({ 'i18n_language': lingua }) }
            // 	)));
            var url = this.urlAnagrafe + "/regione/" + regione.sigla + "/province/nonSoppresse/?codiceRegione=" + regione.sigla;
            return this.configurationService.lingua$.pipe(operators.switchMap(function (lingua) { return _this.http.get(url, { headers: new i1.HttpHeaders({ 'i18n_language': lingua }) }); }), operators.tap(function (_) { return _this.appRef.tick(); }), operators.shareReplay());
        };
        TerritorioService.prototype.getComuni$ = function (siglaProvincia) {
            //TODO
            // const url: string = this.paths.get_V1ComuniByProvincia(siglaProvincia);
            // const url: string = `${this.urlAnagrafe}/provincia/${siglaProvincia}/comuni`
            var url = this.urlAnagrafe + "/provincia/" + siglaProvincia + "/comuni/nonSoppressi";
            return this.http.get(url).pipe(operators.shareReplay());
        };
        TerritorioService.prototype.getComune$ = function (codiceCatastale) {
            var url = this.urlAnagrafe + "/comune/codiceCatastale/" + codiceCatastale;
            return this.http.get(url).pipe(operators.shareReplay());
        };
        TerritorioService.prototype.getNazioni$ = function () {
            return this.nazioni$;
        };
        TerritorioService.prototype.getCap$ = function (idComune) {
            //TODO
            // const url: string = this.paths.get_V1CapByIdComune(idComune);
            var url = this.urlAnagrafe + "/comuni/" + idComune + "/cap";
            return this.http.get(url);
        };
        TerritorioService.prototype.getRegioni$ = function () {
            return this.regioni$;
        };
        return TerritorioService;
    }());
    TerritorioService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TerritorioService_Factory() { return new TerritorioService(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(ConfigurationService), i0.ɵɵinject(i0.ApplicationRef)); }, token: TerritorioService, providedIn: "root" });
    TerritorioService.decorators = [
        { type: i0.Injectable, args: [{ providedIn: 'root'
                },] }
    ];
    TerritorioService.ctorParameters = function () { return [
        { type: i1.HttpClient },
        { type: ConfigurationService },
        { type: i0.ApplicationRef }
    ]; };

    var InfoNascitaComponent = /** @class */ (function () {
        function InfoNascitaComponent(msg, territorio, validationService, territorioService) {
            var _this = this;
            this.msg = msg;
            this.territorio = territorio;
            this.validationService = validationService;
            this.territorioService = territorioService;
            this.maxDate = new Date();
            this.readOnly = false;
            this.done = new i0.EventEmitter();
            this.ITALIA = 'IT';
            this.ITALIACodCat = 'Z000';
            this.nazioni$ = territorioService.getNazioni$();
            this.nazioni$.subscribe(function (nazioni) {
                _this.nazioni = nazioni;
            });
        }
        InfoNascitaComponent.prototype.ngOnChanges = function (changes) {
            this.initialize();
        };
        InfoNascitaComponent.prototype.ngOnInit = function () {
            var _this = this;
            var _a, _b, _c;
            // console.log('[InfoNascitaComponent] infonascita', this.infonascita);
            this.form = new forms.FormGroup({});
            this.initialize();
            // const isNatoEstero =
            // 	this.infonascita.comuneNascita != null &&
            // 	this.infonascita.comuneNascita.startsWith("Z");
            var isNatoEstero = ((_a = this.infonascita) === null || _a === void 0 ? void 0 : _a.isNatoEstero) ? this.infonascita.isNatoEstero : false;
            if (!isNatoEstero) {
                this.infonascita.nazioneNascita = this.ITALIA;
                this.infonascita.codCatNazioneNascita = this.ITALIACodCat;
            }
            var isNatoEsteroCheck = new forms.FormControl({ value: isNatoEstero, disabled: false }, [forms.Validators.required]);
            this.form.addControl("isNatoEstero", isNatoEsteroCheck);
            var provinciaNascita = new forms.FormControl({ value: this.infonascita.provinciaNascita, disabled: false }, [forms.Validators.required]);
            this.form.addControl("provinciaNascita", provinciaNascita);
            var comuneNascita = new forms.FormControl({ value: ((_b = this.infonascita) === null || _b === void 0 ? void 0 : _b.comuneNascita) ? (_c = this.infonascita) === null || _c === void 0 ? void 0 : _c.comuneNascita : this.ITALIACodCat, disabled: false }, [forms.Validators.required]);
            this.form.addControl("comuneNascita", comuneNascita);
            var dataNascita = new forms.FormControl({ value: this.infonascita.dataNascita, disabled: false }, [forms.Validators.required, ValidationService.ValidateDate]);
            this.form.addControl("dataNascita", dataNascita);
            var codCatNazioneNascita = new forms.FormControl({ value: this.infonascita.codCatNazioneNascita, disabled: false }, [forms.Validators.required]);
            this.form.addControl("codCatNazioneNascita", codCatNazioneNascita);
            if (this.readOnly) {
                this.form.disable();
                this.isNatoEstero$ = isNatoEsteroCheck.valueChanges.pipe(operators.startWith(isNatoEstero));
            }
            else {
                this.isNatoEstero$ = isNatoEsteroCheck.valueChanges.pipe(operators.tap(function (isEstero) { return isEstero
                    ? codCatNazioneNascita.setValue(null)
                    : (provinciaNascita.setValue(null), comuneNascita.setValue(null)); }), operators.startWith(isNatoEstero), operators.tap(function (isEstero) {
                    if (isEstero) {
                        codCatNazioneNascita.enable();
                        comuneNascita.disable();
                        provinciaNascita.disable();
                    }
                    else {
                        codCatNazioneNascita.disable();
                        comuneNascita.enable();
                        provinciaNascita.enable();
                    }
                }));
            }
            var changes$ = this.form.valueChanges.pipe(operators.map(function (_) {
                var _a, _b;
                var infonascita = new InfoNascitaPFDTO();
                infonascita.dataNascita = moment(_this.form.controls["dataNascita"].value).toDate();
                if ((_a = _this.form.controls["isNatoEstero"]) === null || _a === void 0 ? void 0 : _a.value) {
                    infonascita.isNatoEstero = _this.form.controls["isNatoEstero"].value;
                    //infonascita.comuneNascita = null;
                    if ((_b = _this.form.controls["codCatNazioneNascita"]) === null || _b === void 0 ? void 0 : _b.value) {
                        var nazioneSelected = _this.nazioni.find(function (nazione) { var _a; return nazione.codiceCatastale == ((_a = _this.form.controls["codCatNazioneNascita"]) === null || _a === void 0 ? void 0 : _a.value); });
                        if (nazioneSelected) {
                            infonascita.codCatNazioneNascita = nazioneSelected.codiceCatastale;
                            infonascita.nazioneNascita = nazioneSelected.sigla;
                            infonascita.comuneNascita = nazioneSelected.codiceCatastale;
                        }
                    }
                    infonascita.provinciaNascita = "EE";
                }
                else {
                    infonascita.isNatoEstero = null;
                    infonascita.comuneNascita = _this.form.controls["comuneNascita"].value;
                    infonascita.provinciaNascita = _this.form.controls["provinciaNascita"].value;
                    infonascita.codCatNazioneNascita = _this.ITALIACodCat;
                    infonascita.nazioneNascita = _this.ITALIA;
                }
                return infonascita;
            }), operators.startWith(this.infonascita), operators.map(function (infonascita) { return ComponentOutputStatus.of(_this.form.valid || _this.readOnly, infonascita); }));
            this.subscription = changes$.subscribe(function (_) { return _this.done.emit(_); });
            this.comuni$ = provinciaNascita.valueChanges.pipe(operators.tap(function (_) { return comuneNascita.setValue(null); }), operators.startWith(this.infonascita.provinciaNascita), operators.filter(function (x) { return x; }), operators.switchMap(function (value) { return _this.territorio.getComuni$(value); }));
        };
        InfoNascitaComponent.prototype.initialize = function () {
            if (!this.infonascita) {
                this.infonascita = this.initInfoNascita();
            }
        };
        InfoNascitaComponent.prototype.initInfoNascita = function () {
            var initInfoNascitaNew = new InfoNascitaPFDTO();
            return initInfoNascitaNew;
        };
        InfoNascitaComponent.prototype.ngOnDestroy = function () {
            this.subscription.unsubscribe();
        };
        InfoNascitaComponent.prototype.compareComuni = function (c1, c2) {
            return c1 && c2 ? c1.codiceCatastale === c2.codiceCatastale : c1 === c2;
        };
        InfoNascitaComponent.prototype._resetForm = function () {
            var _a;
            (_a = this.form) === null || _a === void 0 ? void 0 : _a.reset();
        };
        return InfoNascitaComponent;
    }());
    InfoNascitaComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: "lib-info-nascita",
                    template: "<div [formGroup]=\"form\">\r\n\t<mat-checkbox formControlName=\"isNatoEstero\" *ngIf=\"!readOnly\">\r\n\t\t<!-- {{'localita-nascita-estera' | traduzione}} -->\r\n\t\t<info-tip-label label=\"localita-nascita-estera\"></info-tip-label>\r\n\t</mat-checkbox>\r\n\r\n\t<div class=\"row my-2\">\r\n\t\t<div class=\"col-md-4\" *ngIf=\"!(isNatoEstero$ | async)\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<mat-label>{{'required' | traduzione}}{{'provincia-nascita' | traduzione}}</mat-label>\r\n\t\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"provinciaNascita\">\r\n\t\t\t\t\t<mat-option *ngFor=\"let provincia of province | async\" [value]=\"provincia.sigla\">\r\n\t\t\t\t\t\t{{ provincia.denominazione }}\r\n\t\t\t\t\t</mat-option>\r\n\t\t\t\t</mat-select>\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['provinciaNascita'].invalid\">\r\n\t\t\t\t\t{{\r\n\t\t\t\t\tmsg.produceMessage(\r\n\t\t\t\t\t\"obbligatorio\",\r\n\t\t\t\t\tform.controls[\"provinciaNascita\"]\r\n\t\t\t\t\t) | traduzione\r\n\t\t\t\t\t}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'provincia-nascita'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"col-md-4\" *ngIf=\"!(isNatoEstero$ | async)\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<mat-label>{{'required' | traduzione}}{{'comune-nascita' | traduzione}}</mat-label>\r\n\t\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"comuneNascita\">\r\n\t\t\t\t\t<mat-option *ngFor=\"let comune of comuni$ | async\" [value]=\"comune.codiceCatastale\">\r\n\t\t\t\t\t\t{{ comune.denominazione }}\r\n\t\t\t\t\t</mat-option>\r\n\t\t\t\t</mat-select>\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['comuneNascita'].invalid\">\r\n\t\t\t\t\t{{\r\n\t\t\t\t\tmsg.produceMessage(\"obbligatorio\", form.controls[\"comuneNascita\"]) | traduzione\r\n\t\t\t\t\t}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'comune-nascita'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"col-md-4\" *ngIf=\"isNatoEstero$ | async\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<mat-label>{{'required' | traduzione}}{{'nazione-nascita' | traduzione}}</mat-label>\r\n\t\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"codCatNazioneNascita\">\r\n\t\t\t\t\t<mat-option *ngFor=\"let nazione of nazioni$ | async\" [value]=\"nazione.codiceCatastale\">\r\n\t\t\t\t\t\t{{ nazione.denominazione }}\r\n\t\t\t\t\t</mat-option>\r\n\t\t\t\t</mat-select>\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['codCatNazioneNascita'].invalid\">\r\n\t\t\t\t\t{{\r\n\t\t\t\t\tmsg.produceMessage(\"obbligatorio\", form.controls[\"codCatNazioneNascita\"]) | traduzione\r\n\t\t\t\t\t}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'nazione-nascita'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input [max]=\"maxDate\" matInput [matDatepicker]=\"dataNascita\"\r\n\t\t\t\t\tplaceholder=\"{{'required' | traduzione}}{{'data-nascita' | traduzione}}\" formControlName=\"dataNascita\" />\r\n\t\t\t\t<mat-datepicker-toggle matSuffix [for]=\"dataNascita\"></mat-datepicker-toggle>\r\n\t\t\t\t<mat-datepicker #dataNascita></mat-datepicker>\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['dataNascita'].invalid\">\r\n\t\t\t\t\t{{ msg.getErrorData(form.controls[\"dataNascita\"]) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'data-nascita'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n",
                    styles: [""]
                },] }
    ];
    InfoNascitaComponent.ctorParameters = function () { return [
        { type: MessageService },
        { type: TerritorioService },
        { type: ValidationService },
        { type: TerritorioService }
    ]; };
    InfoNascitaComponent.propDecorators = {
        infonascita: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        namespace: [{ type: i0.Input }],
        readOnly: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var CodiceFiscaleServiceImpl = /** @class */ (function (_super) {
        __extends(CodiceFiscaleServiceImpl, _super);
        function CodiceFiscaleServiceImpl(http, configurationService) {
            var _this = _super.call(this) || this;
            _this.http = http;
            _this.configurationService = configurationService;
            console.log('[CodiceFiscaleService]');
            //TODO
            // this.urlArgo = configurationService.servicePaths.get("ARGO_INTEGRATION_MS_API_URL") + "/v1";
            _this.urlArgo = configurationService.servicePaths.get("ARGO_INTEGRATION_MS_API_URL") + "/v2";
            console.log('[urlArgo - lib]', _this.urlArgo);
            return _this;
        }
        CodiceFiscaleServiceImpl.prototype.validaCodiceFiscale$ = function (codiceFiscale, tipoPersona) {
            var url = this.urlArgo + '/checkfs/cf';
            return this.http.put(url, { codiceFiscale: codiceFiscale, tipoPersona: tipoPersona });
            //TODO
            // const url: string = this.paths.get_V1CheckFC();
            // const url: string = this.urlArgo + '/checkfs/cf';
            // return this.http.get<ValidationOutcomeDTO>(url, {
            // 	params: {
            // 		codicefiscale: codiceFiscale,
            // 		tipopersona: tipoPersona
            // 	}
            // });
        };
        return CodiceFiscaleServiceImpl;
    }(CodiceFiscaleService));
    CodiceFiscaleServiceImpl.ɵprov = i0.ɵɵdefineInjectable({ factory: function CodiceFiscaleServiceImpl_Factory() { return new CodiceFiscaleServiceImpl(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(ConfigurationService)); }, token: CodiceFiscaleServiceImpl, providedIn: "root" });
    CodiceFiscaleServiceImpl.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    CodiceFiscaleServiceImpl.ctorParameters = function () { return [
        { type: i1.HttpClient },
        { type: ConfigurationService }
    ]; };

    var PgValidation = /** @class */ (function () {
        function PgValidation(valid, pg) {
            this.valid = valid;
            this.pg = pg;
        }
        return PgValidation;
    }());
    var PersonaGiuridicaComponent = /** @class */ (function () {
        function PersonaGiuridicaComponent(msg, delegheService, dialog) {
            this.msg = msg;
            this.delegheService = delegheService;
            this.dialog = dialog;
            this.validatorFormControl = false;
            this.couldBeDittaIndividuale = true;
            this.done = new i0.EventEmitter();
            this.changeSedi$ = new rxjs.ReplaySubject(1);
            this.changePG$ = new rxjs.ReplaySubject(1);
            this.personaSelected$ = new rxjs.BehaviorSubject(null);
            this.CODICE_LEGALE = "LEGALE";
            this.errorSedi$ = new rxjs.Subject();
        }
        PersonaGiuridicaComponent.prototype.ngOnDestroy = function () {
            var _a, _b, _c, _d;
            (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
            (_b = this.subValidation) === null || _b === void 0 ? void 0 : _b.unsubscribe();
            (_c = this.subCF) === null || _c === void 0 ? void 0 : _c.unsubscribe();
            (_d = this.invalidPgsSubscriptions) === null || _d === void 0 ? void 0 : _d.unsubscribe();
        };
        PersonaGiuridicaComponent.prototype.ngOnInit = function () {
            var _this = this;
            var _a, _b, _c;
            //GESTIONE_SEDI
            this.streamListaSedi$ = new rxjs.ReplaySubject();
            this.changeSedi$.next(ComponentOutputStatus.of(!this.gestioneSedi, function (pg) { return pg; }));
            //SE_INPUT_DATI_SOSCIETA_ESISTE => RECUPERO LE SEDI
            ((_a = this.datisocieta) === null || _a === void 0 ? void 0 : _a.sedi) ?
                this.streamListaSedi$.next((_b = this.datisocieta) === null || _b === void 0 ? void 0 : _b.sedi) :
                null;
            //VALIDAZIONE_INIZIALE
            var valid = false;
            this.form = new forms.FormGroup({});
            if (this.resetForm) {
                this.subscription = this.resetForm.subscribe(function (val) { return val ? _this.pulisciForm() : ""; });
            }
            if (!this.datisocieta) {
                this.initDatiSocieta();
            }
            var codiceFiscale = new forms.FormControl({ value: this.datisocieta.codiceFiscale, disabled: this.personaGiuridicaFromDeleghe$ == null ? false : true }, [
                this.validatorFormControl ? forms.Validators.required : forms.Validators.nullValidator,
                ValidationService.pattern(this.couldBeDittaIndividuale ? ValidationService._codiceFiscalePiva : ValidationService.partitaIva, "cfInvalidoFormalmente"),
            ]);
            this.form.addControl("codiceFiscale", codiceFiscale);
            var ragioneSociale = new forms.FormControl({ value: this.datisocieta.ragioneSociale, disabled: true }, [
            // this.validatorFormControl ? Validators.required : Validators.nullValidator
            ]);
            this.form.addControl("ragioneSociale", ragioneSociale);
            var partitaIVA = new forms.FormControl({ value: this.datisocieta.partitaIVA, disabled: true }, [
            // this.validatorFormControl ? Validators.required : Validators.nullValidator,
            // ValidationService.pattern(
            // 	ValidationService.partitaIva,
            // 	"partitaIVAInvalida"
            // ),
            ]);
            this.form.addControl("partitaIVA", partitaIVA);
            if (this.personaGiuridicaFromDeleghe$) {
                this.personaGiuridica$ = this.personaGiuridicaFromDeleghe$
                    .pipe(operators.map(function (pg) { return new PgValidation(true, pg); }), operators.catchError(function (_) { return rxjs.of(new PgValidation(false, null)); }), operators.shareReplay());
            }
            else {
                this.personaGiuridica$ = this.form.get('codiceFiscale').valueChanges
                    .pipe(operators.auditTime(1000), operators.switchMap(function (value) {
                    return ((_this.couldBeDittaIndividuale && ((value === null || value === void 0 ? void 0 : value.length) == 11 || (value === null || value === void 0 ? void 0 : value.length) == 16))
                        ||
                            (!_this.couldBeDittaIndividuale && (value === null || value === void 0 ? void 0 : value.length) == 11))
                        ?
                            _this.delegheService.getPersonaGiuridicaCodiceFiscale(value)
                                .pipe(operators.map(function (pg) { return new PgValidation(true, pg); }), operators.catchError(function (_) { return _this.catchPersonaGiuridicaError(); })) :
                        rxjs.of(new PgValidation(false, null));
                }), operators.shareReplay(), operators.tap(function (validationResult) {
                    console.log('[validationResult]', validationResult);
                }), operators.shareReplay());
            }
            var validPgs$ = this.personaGiuridica$.pipe(operators.filter(function (v) { return v.valid; }), operators.map(function (v) { return v.pg; }));
            var invalidPgs$ = this.personaGiuridica$.pipe(operators.filter(function (pg) { return !pg.valid; }));
            //EVOLUZIONE_PG
            var pg$ = this.buildStreamChangePG$(validPgs$);
            var pgChange$ = pg$.pipe(operators.tap(function (pg) { return _this.setSedi(pg['sedi']); }), operators.tap(function (pg) { return _this.controlloSedeLegale(pg); }), operators.map(function (pg) {
                var _a;
                var validity = ((_a = pg['sedi']) === null || _a === void 0 ? void 0 : _a.find(function (sede) { return sede.tipoSede['codice'] == _this.CODICE_LEGALE; })) ?
                    !_this.form.invalid
                    : false;
                return ComponentOutputStatus.of(validity, function (personaGiuridica) { return Object.keys(pg)
                    .forEach(function (key) { return personaGiuridica[key] = pg[key]; }); });
            }));
            //___Validazione___
            var changes$ = ComponentReducer
                .reducer2(pgChange$, this.changeSedi$, function (_) { return true; }, ComponentOutputStatus.of(valid, this.datisocieta));
            //____OUTPUT_COMPONENT____
            this.subscription = changes$.subscribe(function (_) { return _this.done.emit(_); });
            this.invalidPgsSubscriptions = invalidPgs$.subscribe(function (_) {
                _this.form.get('partitaIVA').setValue("");
                _this.form.get('ragioneSociale').setValue("");
                _this.personaSelected$.next(null);
                _this.done.emit(ComponentOutputStatus.of(false, new PersonaGiuridicaDTO()));
            });
            if (this.datisocieta) {
                codiceFiscale.setValue((_c = this.datisocieta) === null || _c === void 0 ? void 0 : _c.codiceFiscale);
            }
            //CF_DALL'ESTERNO
            if (this.cf$) {
                this.subCF = this.cf$
                    .pipe(operators.tap(function (cf) { return codiceFiscale.setValue(cf); }))
                    .subscribe();
            }
        };
        PersonaGiuridicaComponent.prototype.ngOnChanges = function (changes) {
            var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
            console.log('ngOnChanges:', changes);
            if ((_b = (_a = this.form) === null || _a === void 0 ? void 0 : _a.controls) === null || _b === void 0 ? void 0 : _b.codiceFiscale) {
                (_d = (_c = this.form) === null || _c === void 0 ? void 0 : _c.controls) === null || _d === void 0 ? void 0 : _d.codiceFiscale.setValidators(null);
                (_f = (_e = this.form) === null || _e === void 0 ? void 0 : _e.controls) === null || _f === void 0 ? void 0 : _f.codiceFiscale.setValidators([
                    this.validatorFormControl ? forms.Validators.required : forms.Validators.nullValidator,
                    ValidationService.pattern(this.couldBeDittaIndividuale ? ValidationService._codiceFiscalePiva : ValidationService.partitaIva, "cfInvalidoFormalmente"),
                ]);
                if (((_g = changes === null || changes === void 0 ? void 0 : changes.couldBeDittaIndividuale) === null || _g === void 0 ? void 0 : _g.currentValue) == true || ((_h = changes === null || changes === void 0 ? void 0 : changes.couldBeDittaIndividuale) === null || _h === void 0 ? void 0 : _h.currentValue) == false) {
                    if ((((_j = changes === null || changes === void 0 ? void 0 : changes.couldBeDittaIndividuale) === null || _j === void 0 ? void 0 : _j.currentValue) != ((_k = changes === null || changes === void 0 ? void 0 : changes.couldBeDittaIndividuale) === null || _k === void 0 ? void 0 : _k.previousValue)) || ((_l = changes === null || changes === void 0 ? void 0 : changes.couldBeDittaIndividuale) === null || _l === void 0 ? void 0 : _l.previousValue) === undefined) {
                        (_p = (_o = (_m = this.form) === null || _m === void 0 ? void 0 : _m.controls) === null || _o === void 0 ? void 0 : _o.codiceFiscale) === null || _p === void 0 ? void 0 : _p.patchValue(null);
                    }
                }
                //this.form?.controls?.codiceFiscale?.updateValueAndValidity();
            }
        };
        PersonaGiuridicaComponent.prototype.catchPersonaGiuridicaError = function () {
            this.dialog.open(GenericModalComponent, { data: { title: 'persona-giuridica-by-cf-error-titolo',
                    azioni: [new Azione('ok')],
                    paragrafi: ['modalita-pagamento-dialog-testo']
                }, panelClass: 'custom-modalbox-ko' });
            return rxjs.of(new PgValidation(false, null));
        };
        PersonaGiuridicaComponent.prototype.controlloSedeLegale = function (pg) {
            var _this = this;
            var _a, _b;
            var sedeLegale = (_a = pg['sedi']) === null || _a === void 0 ? void 0 : _a.find(function (sede) { return sede.tipoSede['codice'] == _this.CODICE_LEGALE; });
            var error;
            if (((_b = pg['sedi']) === null || _b === void 0 ? void 0 : _b.length) == 0 || !pg['sedi']) {
                error = "nessunaSede";
            }
            else if (!sedeLegale) {
                error = "nessunaSedeLegale";
            }
            this.errorSedi$.next(error);
        };
        PersonaGiuridicaComponent.prototype.buildStreamChangePG$ = function (personaGiuridica$) {
            var _this = this;
            return personaGiuridica$
                .pipe(operators.tap(function (pg) { return _this.personaSelected$.next(pg); }), operators.map(function (pg) {
                var _a, _b, _c, _d;
                return {
                    codiceFiscale: pg.datiPersonaGiuridica.codiceFiscale,
                    partitaIVA: pg.datiPersonaGiuridica.partitaIVA,
                    ragioneSociale: pg.datiPersonaGiuridica.ragioneSociale,
                    idPersonaGiuridica: pg.datiPersonaGiuridica.id,
                    codiceRegione: (_d = (_c = (_b = (_a = pg === null || pg === void 0 ? void 0 : pg.sedi) === null || _a === void 0 ? void 0 : _a.filter(function (sedeLegale) { var _a; return ((_a = sedeLegale === null || sedeLegale === void 0 ? void 0 : sedeLegale.tipoSede) === null || _a === void 0 ? void 0 : _a.codice) === "LEGALE"; })[0]) === null || _b === void 0 ? void 0 : _b.indirizzo) === null || _c === void 0 ? void 0 : _c.regione) === null || _d === void 0 ? void 0 : _d.sigla,
                    sedi: pg.sedi,
                    hasAmmUtenze: pg.hasAmmUtenze
                };
            }), operators.tap(function (pg) {
                _this.form.get('partitaIVA').setValue(pg['partitaIVA']);
                _this.form.get('ragioneSociale').setValue(pg['ragioneSociale']);
            }), operators.startWith(ComponentOutputStatus.of(false, function (pg) { return pg; })));
        };
        PersonaGiuridicaComponent.prototype.setSedi = function (sedi) {
            var _this = this;
            given(sedi)
                .when(is(null), function () { return _this.streamListaSedi$.next([]); })
                .otherwise(function () { return _this.streamListaSedi$.next(sedi); })
                .valueOf()();
        };
        PersonaGiuridicaComponent.prototype.sediReady = function (sedeSelectedStatus) {
            // console.log("[sedeSelectedStatus]", sedeSelectedStatus);
            this.changeSedi$.next(sedeSelectedStatus.mapValue(function (sede) { return function (pg) { return pg.sedi = sede; }; }));
        };
        PersonaGiuridicaComponent.prototype.initDatiSocieta = function () {
            this.datisocieta = new PersonaGiuridicaDTO();
        };
        PersonaGiuridicaComponent.prototype.pulisciForm = function () {
            var _this = this;
            var keys = Object.keys(this.form.value);
            keys.forEach(function (key) {
                var control = _this.form.get(key);
                control.setValue("");
            });
        };
        return PersonaGiuridicaComponent;
    }());
    PersonaGiuridicaComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: "lib-persona-giuridica",
                    template: "<div [formGroup]=\"form\">\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}} {{'codice-fiscale' | traduzione}}\" -->\r\n\t\t\t\t<input matInput\r\n\t\t\t\t\tplaceholder=\"{{validatorFormControl ? ('required' | traduzione): ''}} {{'codice-fiscale' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"codiceFiscale\" uppercase style=\"text-transform: uppercase\" maxlength=\"16\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['codiceFiscale'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('codiceFiscaleInvalido', form.controls[ 'codiceFiscale']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'codice-fiscale'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<!-- <div class=\"col-md-4\" [hidden]= \"!editingDisabled\"> -->\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}}{{'ragione-sociale' | traduzione}}\" -->\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{validatorFormControl ? ('required' | traduzione): ''}} {{'ragione-sociale' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{'ragione-sociale' | traduzione}}\" formControlName=\"ragioneSociale\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['ragioneSociale'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['ragioneSociale']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'ragione-sociale'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<!-- <div class=\"col-md-4\" [hidden]= \"!editingDisabled\"> -->\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}}{{'partita-iva' | traduzione}}\" -->\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{validatorFormControl ? ('required' | traduzione): ''}} {{'partita-iva' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{'partita-iva' | traduzione}}\" formControlName=\"partitaIVA\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['partitaIVA'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('partitaIVAInvalida', form.controls['partitaIVA']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'partita-iva'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n\t<ng-container *ngIf=\"gestioneSedi; else noGestioneSedi\">\r\n\t\t<ng-container *ngIf=\"personaSelected$ | async\">\r\n\t\t\t<ng-container *ngIf=\"(personaGiuridicaFromDeleghe$ == null) && (personaSelected$ | async).hasAmmUtenze;\r\n\t\t\t\telse visualizzaSedi\">\r\n\t\t\t\t<mat-error>\r\n\t\t\t\t\t{{'contattare-amministratore' | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</ng-container>\r\n\t\t\t<ng-template #visualizzaSedi>\r\n\t\t\t\t<lib-tabella-sedi [sedi$]=\"streamListaSedi$\" (done)=\"sediReady($event)\"\r\n\t\t\t\t\t[idSedeSelezionata]=\"idSedeSelezionata\">\r\n\t\t\t\t</lib-tabella-sedi>\r\n\t\t\t</ng-template>\r\n\t\t</ng-container>\r\n\t</ng-container>\r\n\r\n\t<ng-template #noGestioneSedi>\r\n\t\t<div *ngIf=\" errorSedi$ | async as errorSedi\">\r\n\t\t\t<ng-container *ngIf=\"errorSedi=='nessunaSede'\">\r\n\t\t\t\t<mat-error>\r\n\t\t\t\t\t{{'nessunaSede' | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</ng-container>\r\n\t\t\t<ng-container *ngIf=\"errorSedi=='nessunaSedeLegale'\">\r\n\t\t\t\t<mat-error>\r\n\t\t\t\t\t{{'nessunaSedeLegale' | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</ng-container>\r\n\t\t</div>\r\n\t</ng-template>\r\n</div>",
                    styles: [""]
                },] }
    ];
    PersonaGiuridicaComponent.ctorParameters = function () { return [
        { type: MessageService },
        { type: DelegheService },
        { type: i1$1.MatDialog }
    ]; };
    PersonaGiuridicaComponent.propDecorators = {
        cf$: [{ type: i0.Input }],
        datisocieta: [{ type: i0.Input }],
        idSedeSelezionata: [{ type: i0.Input }],
        namespace: [{ type: i0.Input }],
        resetForm: [{ type: i0.Input }],
        validatorFormControl: [{ type: i0.Input }],
        gestioneSedi: [{ type: i0.Input }],
        couldBeDittaIndividuale: [{ type: i0.Input }],
        personaGiuridicaFromDeleghe$: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var IndirizzoComponent = /** @class */ (function () {
        function IndirizzoComponent() {
            this.done = new i0.EventEmitter();
        }
        IndirizzoComponent.prototype.ngOnInit = function () {
            var _this = this;
            console.log('[IndirizzoDTO]', this.indirizzo);
            this.form = new forms.FormGroup({});
            var isIndirizzoEstero = this.indirizzo != null &&
                this.indirizzo.localita != null &&
                this.indirizzo.localita.comune != null &&
                this.indirizzo.localita.comune.startsWith('Z');
            var indirizzoEstero = new forms.FormControl({ value: isIndirizzoEstero, disabled: false }, [forms.Validators.required]);
            this.form.addControl('indirizzoEstero', indirizzoEstero);
            this.isIndirizzoEstero$ = indirizzoEstero.valueChanges.pipe(operators.tap(function (_) {
                _this.done.emit(ComponentOutputStatus.of(false, null));
            }), operators.shareReplay(), operators.startWith(isIndirizzoEstero));
        };
        IndirizzoComponent.prototype.indirizzoReady = function (indirizzoStatus) {
            this.done.emit(indirizzoStatus);
        };
        return IndirizzoComponent;
    }());
    IndirizzoComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-indirizzo',
                    template: "<div [formGroup]=\"form\">\r\n\t<mat-checkbox formControlName=\"indirizzoEstero\" [disabled]=\"viewOnly\">\r\n\t\t{{'indirizzo-estero' | traduzione}}\r\n\t</mat-checkbox>\r\n\r\n\t<lib-indirizzo-italiano\r\n\t\t*ngIf=\"!(isIndirizzoEstero$ | async)\"\r\n\t\t(done)=\"indirizzoReady($event)\"\r\n\t\t[indirizzo]=\"indirizzo\"\r\n\t\t[province]=\"province\"\r\n\t\t[viewOnly]=\"viewOnly\"\r\n\t>\r\n\t</lib-indirizzo-italiano>\r\n\r\n\t<lib-indirizzo-estero\r\n\t\t*ngIf=\"isIndirizzoEstero$ | async\"\r\n\t\t(done)=\"indirizzoReady($event)\"\r\n\t\t[indirizzo]=\"indirizzo\"\r\n\t\t[viewOnly]=\"viewOnly\"\r\n\t>\r\n\t</lib-indirizzo-estero>\r\n</div>",
                    styles: [""]
                },] }
    ];
    IndirizzoComponent.ctorParameters = function () { return []; };
    IndirizzoComponent.propDecorators = {
        indirizzo: [{ type: i0.Input }],
        viewOnly: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        descrizioneLocalia: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var IndirizzoDTO = /** @class */ (function () {
        function IndirizzoDTO() {
        }
        return IndirizzoDTO;
    }());

    var IndirizzoItalianoComponent = /** @class */ (function () {
        function IndirizzoItalianoComponent(msg) {
            this.msg = msg;
            this.done = new i0.EventEmitter();
            this.changesStrada$ = new rxjs.Subject();
            this.changesLocalita$ = new rxjs.Subject();
        }
        IndirizzoItalianoComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.form = new forms.FormGroup({});
            var valid = true;
            if (!this.indirizzo) {
                this.indirizzo = new IndirizzoDTO();
                valid = false;
            }
            this.namespaceStrada = this.namespace + 'strada';
            this.namespaceLoc = this.namespace + 'loc';
            var indirizzoChanged$ = ComponentReducer.reducer2(this.changesStrada$, this.changesLocalita$, function (ind) { return ind.localita != null && ind.strada != null; }, ComponentOutputStatus.of(valid, this.indirizzo));
            this.indirizzoChangedSub = indirizzoChanged$.
                subscribe(function (newIndirizzo) {
                _this.done.emit(newIndirizzo);
            });
        };
        IndirizzoItalianoComponent.prototype.localitaReady = function (localitaStatus) {
            this.changesLocalita$.next(localitaStatus.mapValue(function (localita) { return function (ind) { return ind.localita = localita; }; }));
        };
        IndirizzoItalianoComponent.prototype.stradaReady = function (stradaStatus) {
            this.changesStrada$.next(stradaStatus.mapValue(function (strada) { return function (ind) { return ind.strada = strada; }; }));
        };
        return IndirizzoItalianoComponent;
    }());
    IndirizzoItalianoComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-indirizzo-italiano',
                    template: "<div [formGroup]=\"form\">\r\n\t<lib-strada\r\n\t\t(done)=\"stradaReady($event)\"\r\n\t\t[strada]=\"indirizzo.strada\"\r\n\t\t[viewOnly]=\"viewOnly\"\r\n\t>\r\n\t</lib-strada>\r\n\t<lib-localita\r\n\t\t(done)=\"localitaReady($event)\"\r\n\t\t[localita]=\"indirizzo.localita\"\r\n\t\t[province$]=\"province\"\r\n\t\t[viewOnly]=\"viewOnly\"\r\n\t>\r\n\t</lib-localita>\r\n</div>",
                    styles: [""]
                },] }
    ];
    IndirizzoItalianoComponent.ctorParameters = function () { return [
        { type: MessageService }
    ]; };
    IndirizzoItalianoComponent.propDecorators = {
        indirizzo: [{ type: i0.Input }],
        viewOnly: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        done: [{ type: i0.Output }],
        namespace: [{ type: i0.Input }]
    };

    var LocalitaDTO = /** @class */ (function () {
        function LocalitaDTO() {
        }
        return LocalitaDTO;
    }());

    var StradaDTO = /** @class */ (function () {
        function StradaDTO() {
        }
        return StradaDTO;
    }());

    var IndirizzoEsteroComponent = /** @class */ (function () {
        function IndirizzoEsteroComponent(msg, territorioService) {
            this.msg = msg;
            this.territorioService = territorioService;
            this.done = new i0.EventEmitter();
            this.nazioni = territorioService.getNazioni$();
        }
        IndirizzoEsteroComponent.prototype.ngOnDestroy = function () {
            if (this.subscription) {
                this.subscription.unsubscribe();
            }
        };
        IndirizzoEsteroComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.form = new forms.FormGroup({});
            var valid = true;
            if (!this.indirizzo) {
                this.indirizzo = new IndirizzoDTO();
                this.indirizzo.localita = new LocalitaDTO();
                this.indirizzo.strada = new StradaDTO();
                valid = false;
            }
            var indirizzo = new forms.FormControl({ value: this.indirizzo.strada.inidirizzo, disabled: false }, [forms.Validators.required, forms.Validators.maxLength(50)]);
            this.form.addControl("indirizzo", indirizzo);
            // const zip = new FormControl(
            //   {value: this.indirizzo.localita.cap, disabled: false}, [Validators.required]
            // );
            // this.form.addControl('zip', zip);
            var nazioni = new forms.FormControl({ value: this.indirizzo.localita.comune, disabled: false }, [forms.Validators.required]);
            this.form.addControl("nazioni", nazioni);
            var changes$ = this.form.valueChanges.pipe(operators.map(function (_) {
                var localita = new LocalitaDTO();
                // localita.cap = zip.value;
                localita.provincia = "EE";
                localita.comune = nazioni.value;
                var strada = new StradaDTO();
                strada.inidirizzo = indirizzo.value;
                var indirizzoMapped = new IndirizzoDTO();
                indirizzoMapped.localita = localita;
                indirizzoMapped.strada = strada;
                return ComponentOutputStatus.of(_this.form.valid, indirizzoMapped);
            }));
            this.subscription = changes$.subscribe(function (_) { return _this.done.emit(_); });
        };
        return IndirizzoEsteroComponent;
    }());
    IndirizzoEsteroComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: "lib-indirizzo-estero",
                    template: "<form [formGroup]=\"form\">\r\n\t<div class=\"row my-2\">\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<mat-label>{{'required' | traduzione}}{{'nazione' | traduzione}}</mat-label>\r\n\t\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"{{ 'nazioni' }}\">\r\n\t\t\t\t\t<mat-option *ngFor=\"let nazione of nazioni | async\" [value]=\"nazione.codiceCatastale\">\r\n\t\t\t\t\t\t{{ nazione.denominazione }}\r\n\t\t\t\t\t</mat-option>\r\n\t\t\t\t</mat-select>\r\n\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls['nazioni'].invalid\">\r\n\t\t\t\t\t{{ msg.produceMessage(\"obbligatorio\", form.controls[\"nazioni\"]) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"row my-2\">\r\n\t\t<div class=\"col-md-12\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input matInput placeholder=\"{{'required' | traduzione}}{{'indirizzo' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"{{ 'indirizzo' }}\" />\r\n\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls['indirizzo'].invalid\">\r\n\t\t\t\t\t{{ msg.produceMessage(\"obbligatorio\", form.controls[\"indirizzo\"]) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n</form>",
                    styles: [""]
                },] }
    ];
    IndirizzoEsteroComponent.ctorParameters = function () { return [
        { type: MessageService },
        { type: TerritorioService }
    ]; };
    IndirizzoEsteroComponent.propDecorators = {
        indirizzo: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var StradaComponent = /** @class */ (function () {
        function StradaComponent(msg, territorio) {
            this.msg = msg;
            this.territorio = territorio;
            this.done = new i0.EventEmitter();
        }
        StradaComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.form = new forms.FormGroup({});
            if (!this.strada) {
                this.initStrada();
            }
            var stradaIndirizzo = new forms.FormControl({ value: this.strada.inidirizzo, disabled: this.viewOnly }, function (c) {
                if (_this.viewOnly)
                    return {};
                return String(c.value).trim().length > 0
                    ? {}
                    : { required: true };
            });
            this.form.addControl('stradaIndirizzo', stradaIndirizzo);
            var stradaCivico = new forms.FormControl({ value: this.strada.civico, disabled: this.viewOnly }, function (c) {
                if (_this.viewOnly)
                    return {};
                return String(c.value).trim().length > 0
                    ? {}
                    : { required: true };
            });
            this.form.addControl('stradaCivico', stradaCivico);
            var stradaOut = new StradaDTO;
            stradaOut.inidirizzo = stradaIndirizzo.value;
            stradaOut.civico = stradaCivico.value;
            this.changes$ = new rxjs.BehaviorSubject(ComponentOutputStatus.of(false, stradaOut));
            this.subScriptionChange = this.form.valueChanges.pipe(operators.tap(function (valueChange) {
                var stradaOut = new StradaDTO();
                stradaOut.inidirizzo = valueChange.stradaIndirizzo;
                stradaOut.civico = valueChange.stradaCivico;
                return _this.changes$.next(ComponentOutputStatus.of(
                /* 	this.form.valid  && */
                stradaOut.inidirizzo != null
                    //    &&  stradaOut.tipoToponimo != null
                    && stradaOut.civico != null, stradaOut));
            })).subscribe();
            this.subscription = this.changes$.subscribe(function (x) {
                _this.done.emit(x);
                console.log("changes$", x);
            });
            this.changes$.next(ComponentOutputStatus.of(
            /* 	this.form.valid  && */
            stradaOut.inidirizzo != null
                //    &&  stradaOut.tipoToponimo != null
                && stradaOut.civico != null, stradaOut));
        };
        StradaComponent.prototype.initStrada = function () {
            this.strada = new StradaDTO();
        };
        StradaComponent.prototype.ngOnDestroy = function () {
            this.subscription.unsubscribe();
            this.subScriptionChange.unsubscribe();
        };
        StradaComponent.prototype.ngAfterContentInit = function () {
            if (this.strada.inidirizzo != null && this.strada.tipoToponimo != null && this.strada.civico != null) {
                this.form.updateValueAndValidity({ emitEvent: true });
            }
        };
        return StradaComponent;
    }());
    StradaComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-strada',
                    template: "<form [formGroup]=\"form\">\r\n\t<div class=\"row my-2\">\r\n\t\t<div class=\"col-md-8\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input matInput placeholder=\"{{'required' | traduzione}}{{'indirizzo' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"stradaIndirizzo\">\r\n\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls['stradaIndirizzo'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls[ 'stradaIndirizzo']) | traduzione}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input matInput placeholder=\"{{'required' | traduzione}}{{'civico' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"stradaCivico\">\r\n\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls['stradaCivico'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['stradaCivico']) | traduzione}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n</form>",
                    styles: [""]
                },] }
    ];
    StradaComponent.ctorParameters = function () { return [
        { type: MessageService },
        { type: TerritorioService }
    ]; };
    StradaComponent.propDecorators = {
        viewOnly: [{ type: i0.Input }],
        strada: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var LocalitaComponent = /** @class */ (function () {
        function LocalitaComponent(msg, territorio) {
            this.msg = msg;
            this.territorio = territorio;
            this.done = new i0.EventEmitter();
        }
        LocalitaComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.form = new forms.FormGroup({});
            if (!this.localita) {
                this.initLocalita();
            }
            var localitaProvincia = new forms.FormControl({ value: this.localita.provincia, disabled: this.viewOnly }, function (c) {
                if (_this.viewOnly)
                    return {};
                return String(c.value).trim().length > 0
                    ? {}
                    : { required: true };
            });
            this.form.addControl("localitaProvincia", localitaProvincia);
            var localitaComune = new forms.FormControl({ value: this.localita.comune, disabled: this.viewOnly }, function (c) {
                if (_this.viewOnly)
                    return {};
                return String(c.value).trim().length > 0
                    ? {}
                    : { required: true };
            });
            this.form.addControl("localitaComune", localitaComune);
            // if(this.viewCap) {
            var localitaCap = new forms.FormControl({ value: this.localita.cap, disabled: this.viewOnly }, function (c) {
                if (_this.viewOnly)
                    return {};
                return String(c.value).trim().length > 0
                    ? {}
                    : { required: true };
            });
            this.form.addControl("localitaCap", localitaCap);
            // }
            this.comuni$ = localitaProvincia.valueChanges.pipe(operators.startWith(this.localita.provincia), operators.filter(function (x) { return x; }), operators.switchMap(function (value) { return _this.territorio.getComuni$(value); }), operators.shareReplay());
            this.cap$ = localitaComune.valueChanges.pipe(operators.startWith(this.localita.comune), operators.filter(function (comune) { return comune != null; }), operators.switchMap(function (codiceCatastale) {
                return _this.comuni$.pipe(operators.map(function (comuni) { return comuni.filter(function (comune) { return comune.codiceCatastale === codiceCatastale; }); }), operators.filter(function (comuni) { return comuni.length > 0; }), operators.map(function (comuni) { return comuni[0]; }), operators.switchMap(function (comune) { return _this.territorio.getCap$(comune.codiceIstat); }));
            }));
            var changes$ = this.form.valueChanges.pipe(operators.map(function (_) {
                var localita = new LocalitaDTO();
                // if(this.viewCap) {
                localita.cap = _this.form.controls["localitaCap"].value;
                // }
                localita.provincia = _this.form.controls["localitaProvincia"].value;
                localita.comune = _this.form.controls["localitaComune"].value;
                return ComponentOutputStatus.of(_this.form.valid, localita);
            }));
            this.subscription = changes$.subscribe(function (_) { return _this.done.emit(_); });
        };
        LocalitaComponent.prototype.initLocalita = function () {
            this.localita = new LocalitaDTO();
        };
        LocalitaComponent.prototype.compareComuni = function (c1, c2) {
            return c1 && c2 ? c1.cop === c2.cop : c1 === c2;
        };
        LocalitaComponent.prototype.ngOnDestroy = function () {
            this.subscription.unsubscribe();
        };
        return LocalitaComponent;
    }());
    LocalitaComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: "lib-localita",
                    template: "<div [formGroup]=\"form\">\r\n\t<div class=\"row my-2\">\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<mat-label>{{'required' | traduzione}}{{'provincia' | traduzione}}</mat-label>\r\n\t\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"localitaProvincia\">\r\n\t\t\t\t\t<mat-option *ngFor=\"let provincia of province$ | async\" [value]=\"provincia.sigla\">\r\n\t\t\t\t\t\t{{provincia.denominazione}}\r\n\t\t\t\t\t</mat-option>\r\n\t\t\t\t</mat-select>\r\n\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls['localitaProvincia'].invalid\">\r\n\t\t\t\t\t{{\r\n\t\t\t\t\tmsg.produceMessage(\r\n\t\t\t\t\t\"obbligatorio\",\r\n\t\t\t\t\tform.controls[\"localitaProvincia\"]\r\n\t\t\t\t\t) | traduzione\r\n\t\t\t\t\t}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<mat-label>{{'required' | traduzione}}{{'comune' | traduzione}}</mat-label>\r\n\t\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"localitaComune\">\r\n\t\t\t\t\t<mat-option *ngFor=\"let comune of comuni$ | async\" [value]=\"comune.codiceCatastale\">\r\n\t\t\t\t\t\t{{ comune.denominazione }}\r\n\t\t\t\t\t</mat-option>\r\n\t\t\t\t</mat-select>\r\n\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls['localitaComune'].invalid\">\r\n\t\t\t\t\t{{\r\n\t\t\t\t\tmsg.produceMessage(\"obbligatorio\", form.controls[\"localitaComune\"]) | traduzione\r\n\t\t\t\t\t}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<mat-select placeholder=\"{{'required' | traduzione}}{{'cap' | traduzione}}\" formControlName=\"localitaCap\">\r\n\t\t\t\t\t<mat-option *ngFor=\"let cap of cap$ | async\" [value]=\"cap\">\r\n\t\t\t\t\t\t{{ cap }}\r\n\t\t\t\t\t</mat-option>\r\n\t\t\t\t</mat-select>\r\n\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls['localitaCap'].invalid\">\r\n\t\t\t\t\t{{ msg.produceMessage(\"obbligatorio\", form.controls[\"localitaCap\"]) | traduzione}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n</div>",
                    styles: [""]
                },] }
    ];
    LocalitaComponent.ctorParameters = function () { return [
        { type: MessageService },
        { type: TerritorioService }
    ]; };
    LocalitaComponent.propDecorators = {
        viewOnly: [{ type: i0.Input }],
        localita: [{ type: i0.Input }],
        province$: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var DichiarazioneDTO = /** @class */ (function () {
        function DichiarazioneDTO() {
        }
        return DichiarazioneDTO;
    }());

    var AccettazioneComponent = /** @class */ (function () {
        function AccettazioneComponent() {
            this.completeProcess = new i0.EventEmitter();
            this.salvaBozza = new i0.EventEmitter();
            this.previousStep = new i0.EventEmitter();
            this.direction = 'only-backward';
            this.isFinal = true;
        }
        AccettazioneComponent.prototype.ngOnInit = function () {
            this.form = new forms.FormGroup({});
            var chk1 = new forms.FormControl({ value: false, disabled: false }, [forms.Validators.required]);
            this.form.addControl('chk1', chk1);
            var chk2 = new forms.FormControl({ value: false, disabled: false }, [forms.Validators.required]);
            this.form.addControl('chk2', chk2);
            var chk3 = new forms.FormControl({ value: false, disabled: false }, [forms.Validators.required]);
            this.form.addControl('chk3', chk3);
            var chk4 = new forms.FormControl({ value: false, disabled: false }, [forms.Validators.required]);
            this.form.addControl('chk4', chk4);
            var chk5 = new forms.FormControl({ value: false, disabled: false }, [forms.Validators.required]);
            this.form.addControl('chk5', chk5);
            var chk6 = new forms.FormControl({ value: false, disabled: false }, [forms.Validators.required]);
            this.form.addControl('chk6', chk6);
            if (!this.dichiarazioni) {
                this.initDichiarazione();
            }
        };
        AccettazioneComponent.prototype.forward = function ($event) { };
        AccettazioneComponent.prototype.backward = function ($event) {
            this.previousStep.emit(this.dichiarazioni);
        };
        AccettazioneComponent.prototype.complete = function ($event) {
            this.setFormFieldControls();
            this.completeProcess.emit(this.dichiarazioni);
        };
        AccettazioneComponent.prototype.onSalvaBozza = function ($event) {
            this.setFormFieldControls();
            this.salvaBozza.emit(this.dichiarazioni);
        };
        AccettazioneComponent.prototype.isFormValid = function () {
            return this.form.valid &&
                this.form.controls['chk1'].value &&
                this.form.controls['chk2'].value &&
                this.form.controls['chk3'].value &&
                this.form.controls['chk4'].value &&
                this.form.controls['chk5'].value &&
                ((this.isPersonaGiuridica && this.form.controls['chk6'].value) || !this.isPersonaGiuridica);
        };
        AccettazioneComponent.prototype.initDichiarazione = function () {
            this.dichiarazioni = new Array();
        };
        AccettazioneComponent.prototype.setFormFieldControls = function () {
            this.initDichiarazione();
            var dati1 = new DichiarazioneDTO();
            dati1.isChecked = this.form.controls['chk1'].value;
            dati1.dichiarazione = "1";
            this.dichiarazioni.push(dati1);
            var dati2 = new DichiarazioneDTO();
            dati2.isChecked = this.form.controls['chk2'].value;
            dati2.dichiarazione = "2";
            this.dichiarazioni.push(dati2);
            var dati3 = new DichiarazioneDTO();
            dati3.isChecked = this.form.controls['chk3'].value;
            dati3.dichiarazione = "3";
            this.dichiarazioni.push(dati3);
            var dati4 = new DichiarazioneDTO();
            dati4.isChecked = this.form.controls['chk4'].value;
            dati4.dichiarazione = "4";
            this.dichiarazioni.push(dati4);
            var dati5 = new DichiarazioneDTO();
            dati5.isChecked = this.form.controls['chk5'].value;
            dati5.dichiarazione = "5";
            this.dichiarazioni.push(dati5);
            var dati6 = new DichiarazioneDTO();
            dati6.isChecked = this.form.controls['chk6'].value;
            dati6.dichiarazione = "6";
            this.dichiarazioni.push(dati6);
        };
        return AccettazioneComponent;
    }());
    AccettazioneComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-accettazione',
                    template: "<div class=\"mt-3 mb-5\" [formGroup]=\"form\">\r\n\t<mat-expansion-panel class=\"panel\" [expanded]=\"true\" >\r\n    <mat-expansion-panel-header\r\n      [collapsedHeight]=\"'48px'\"\r\n      [expandedHeight]=\"'48px'\"\r\n      class=\"custom-header\"\r\n    >\r\n      <mat-panel-title>\r\n        <h3 class=\"h5 mb-0\"><info-tip-label label=\"dichiarazioni-richiedente\"></info-tip-label></h3>\r\n      </mat-panel-title>\r\n    </mat-expansion-panel-header>\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-12 mb-3\">\r\n\t\t\t<h3 class=\"h5 mb-0\">\r\n\t\t\t\t<!-- <info-tip-label label=\"dichiarazioni-header\"></info-tip-label> -->\r\n\t\t\t\t<h3 class=\"h5 mb-0\"> <info-tip-label label=\"dichiarazioni-header\"></info-tip-label> </h3>\r\n\t\t\t\t<div class=\"divider\"></div>\r\n\t\t\t</h3>\r\n\t\t</div>\r\n\t\t<div class=\"col-12\">\r\n\t\t\t<mat-checkbox formControlName=\"chk1\">\r\n\t\t\t\t{{ 'dichiarazioni-row-1' | traduzione }}\r\n\t\t\t</mat-checkbox>\r\n\t\t\t<mat-checkbox formControlName=\"chk2\">\r\n\t\t\t\t{{ 'dichiarazioni-row-2' | traduzione }}\r\n\t\t\t</mat-checkbox>\r\n\t\t\t<mat-checkbox formControlName=\"chk3\">\r\n\t\t\t\t{{ 'dichiarazioni-row-3' | traduzione }}\r\n\t\t\t</mat-checkbox>\r\n\t\t\t<mat-checkbox formControlName=\"chk4\">\r\n\t\t\t\t{{ 'dichiarazioni-row-4' | traduzione }}\r\n\t\t\t</mat-checkbox>\r\n\t\t\t<mat-checkbox formControlName=\"chk5\">\r\n\t\t\t\t{{ 'dichiarazioni-row-5' | traduzione }}\r\n\t\t\t</mat-checkbox>\r\n\t\t\t<mat-checkbox formControlName=\"chk6\" *ngIf=\"isPersonaGiuridica\">\r\n\t\t\t\t{{ 'dichiarazioni-row-6' | traduzione }}\r\n\t\t\t</mat-checkbox>\r\n\t\t</div>\r\n\t</div>\r\n\t</mat-expansion-panel>\r\n\t<lib-stepper-navigator\r\n\t\t[form]=\"form\"\r\n\t\t[direction]=\"direction\"\r\n\t\t[isFinal]=\"isFinal\"\r\n\t\t[isContainerValid]=\"isFormValid()\"\r\n\t\t(goForward)=\"forward($event)\"\r\n\t\t(goBackward)=\"backward($event)\"\r\n\t\t(complete)=\"complete($event)\"\r\n\t\t(salvaBozza)=\"onSalvaBozza($event)\"\r\n\t>\r\n\t</lib-stepper-navigator>\r\n</div>\r\n",
                    styles: [""]
                },] }
    ];
    AccettazioneComponent.ctorParameters = function () { return []; };
    AccettazioneComponent.propDecorators = {
        dichiarazioni: [{ type: i0.Input }],
        isPersonaGiuridica: [{ type: i0.Input }],
        tipologiaDichiarazioni: [{ type: i0.Input }],
        completeProcess: [{ type: i0.Output }],
        salvaBozza: [{ type: i0.Output }],
        previousStep: [{ type: i0.Output }]
    };

    var TipiDocumento = {
        DSAN_EREDI: "DSAN_EREDI",
        ATTO_COSTITUTIVO: "ATTO_COSTITUTIVO",
        PROCURA: "PROCURA",
        PROVVEDIMENTO_FALLIMENTO: "PROVVEDIMENTO_FALLIMENTO",
        PROVVEDIMENTO_DEL_GIUDICE_TUTELARE: "PROVVEDIMENTO_DEL_GIUDICE_TUTELARE",
        PROVVEDIMENTO_DI_INCASSO_SOMME: "PROVVEDIMENTO_DI_INCASSO_SOMME",
        ALTRO: "ALTRO"
    };

    var DocumentazioneComponent = /** @class */ (function () {
        function DocumentazioneComponent(modals) {
            this.modals = modals;
            //TODO
            this.allegatiMock = [{
                    chiaveCollegamento: "7afe2d6c-5757-4684-91fc-387c7c15dbf6",
                    dataCreazione: "2021-01-08",
                    dataInizioStaging: "2021-01-08",
                    dataStaging: "2021-01-08",
                    dataValidazione: null,
                    descrizione: "Test request10",
                    idCreatore: "1",
                    idDocumento: "ad397ac0-f017-48e1-98fb-3e4c514adbdb",
                    idIstanza: "2380b34a-4b2d-4a9b-896b-ba4a27cdbf7f",
                    jsonMetadati: "",
                    nome: "fileditest10.txt",
                    proprietario: { tipoProprietario: "PF", idProprietario: "1", idSottoProprietario: null },
                    statiDocumento: [{ idDocumento: "ad397ac0-f017-48e1-98fb-3e4c514adbdb", stato: "DOC_VALID", dataCambiamentoStato: "2021-01-08", nota: null, lastState: true }],
                    tipoDocumento: { id: "e617df75-0c3b-41a6-b7a0-c514ede2e9ee", codice: "CU", descrizione: "Certifcazione Unica" },
                    tipoServizio: { id: "f2c7415f-5a20-4f14-a379-d07d0d1cbd9a", codice: "CU", descrizione: "Certificazione Unica" },
                    url: "/v1/documento/ad397ac0-f017-48e1-98fb-3e4c514adbdb/download"
                }];
            this.nextStep = new i0.EventEmitter();
            this.salvaBozza = new i0.EventEmitter();
            this.previousStep = new i0.EventEmitter();
            this.direction = "both-ways";
            this.isFinal = false;
            this.avantiClicks$ = new rxjs.Subject();
            this.indietroClicks$ = new rxjs.Subject();
        }
        DocumentazioneComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.form = new forms.FormGroup({});
            if (!this.documenti) {
                this.initDocumnetazione();
            }
            this.addFiles$ = new rxjs.Subject();
            this.removeFile$ = new rxjs.Subject();
            this.removeFile$.subscribe(console.log);
            //------Si accumulano i documenti validi da inviare-------
            var adds$ = this.addFiles$.pipe(operators.map(function (file) { return function (acc) {
                if (file.file != null) {
                    if (!file.file.name.toLowerCase().endsWith(".pdf")) {
                        // this.modals.failure(["Si prega di inserire solamente file in formato pdf"]);
                        _this.modals.openConfirm(_this.buildErrore("Si prega di inserire solamente file in formato pdf"));
                        return acc;
                    }
                    if (file.file.size == 0) {
                        // this.modals.failure(["Si prega di non inserire file vuoti"]);
                        _this.modals.openConfirm(_this.buildErrore("zero-file-size"));
                        return acc;
                    }
                    var fileExists = acc.find(function (loaded) { return loaded.file.name === file.file.name; }) != null;
                    if (fileExists) {
                        // this.modals.failure(["Si prega di inserire un file diverso da quelli che sono stati inserti"]);
                        _this.modals.openConfirm(_this.buildErrore("Si prega di inserire un file diverso da quelli che sono stati inseriti"));
                        return acc;
                    }
                    _this.caricaDocumenti.resetForm();
                }
                //console.log("[file]", [...acc, file]);
                return __spread(acc, [file]);
            }; }));
            this.nomeColonne$ =
                new rxjs.Observable(function (ob) { return ob.next(["nr._Documento", "tipo_Documento", "data_Documento", "tipologia_emittente", "organo_emittente", "obbligatorio"]); });
            this.mappatura$ = this.addFiles$.pipe(operators.map(function (file) { return Object.keys(file[0]); }));
            var removals$ = this.removeFile$.pipe(operators.map(function (index) { return function (acc) {
                return acc.filter(function (_, i) { return index !== i; });
            }; }));
            this.files$ = rxjs.merge(adds$, removals$).pipe(operators.scan(function (acc, op) { return op(acc); }, []), operators.startWith([]), operators.tap(function (_) { return console.log("[DocumentazioneComponent] - metadatiDocumenti", _); }), operators.shareReplay());
            this.viewList$ = this.files$.pipe(operators.map(function (files) { return files.length > 0; }));
            var presentAndMissing$ = rxjs.combineLatest([this.files$, this.tipologieDocumento$])
                .pipe(operators.map(function (_a) {
                var _b = __read(_a, 2), files = _b[0], tipologieDocumento = _b[1];
                var tipiDoc = tipologieDocumento
                    ? tipologieDocumento.filter(function (t) { return t.codice != TipiDocumento.ALTRO; })
                    : [];
                var missing = tipiDoc.filter(function (tipoDoc) {
                    var typeFound = files.find(function (file) { return file.tipoDocumento.codice == tipoDoc.codice; });
                    return typeFound ? false : true;
                });
                return Tuple.of(files, missing);
            }), operators.shareReplay());
            //scrivere l'errore
            this.hasMissingFileTypes$ = presentAndMissing$.pipe(operators.map(function (t) { return t._2.length > 0; }), operators.startWith(false));
            // //scrivere l'errore
            this.missingFileTypes$ = presentAndMissing$.pipe(operators.map(function (t) { return t._2; }));
            //emettere lista dei file caricati
            var present$ = presentAndMissing$.pipe(operators.map(function (t) { return t._1; }));
            this.subscription = this.avantiClicks$
                .pipe(operators.debounceTime(250), operators.withLatestFrom(present$), 
            // tap(([_, present]) => console.log("[present]", present)),
            operators.tap(function (_a) {
                var _b = __read(_a, 2), _ = _b[0], present = _b[1];
                return _this.nextStep.emit(present);
            }))
                .subscribe();
            this.tipologieDocumentoAll$ = this.tipologieDocumento$;
        };
        DocumentazioneComponent.prototype.ngOnDestroy = function () {
            if (this.subscription) {
                this.subscription.unsubscribe();
            }
        };
        DocumentazioneComponent.prototype.forward = function ($event) {
            this.avantiClicks$.next($event);
        };
        DocumentazioneComponent.prototype.backward = function (_) {
            this.previousStep.emit([]);
        };
        DocumentazioneComponent.prototype.complete = function (_) { };
        DocumentazioneComponent.prototype.onSalvaBozza = function (_) {
            this.salvaBozza.emit([]);
        };
        DocumentazioneComponent.prototype.initDocumnetazione = function () {
            this.documenti = new Array();
        };
        DocumentazioneComponent.prototype.buildErrore = function (msg) {
            var data = new GenericModalData();
            data.title = 'dialogTitleError';
            data.paragrafi =
                [msg
                ];
            var noOp = new Azione('ko');
            noOp.testo = 'KO';
            data.azioni = [noOp];
            return data;
        };
        return DocumentazioneComponent;
    }());
    DocumentazioneComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-documentazione',
                    template: "<div class=\"row\" class=\"mt-3 mb-5\">\r\n\t<mat-expansion-panel class=\"panel\" [expanded]=\"true\" [formGroup]=\"form\">\r\n    <mat-expansion-panel-header\r\n      [collapsedHeight]=\"'48px'\"\r\n      [expandedHeight]=\"'48px'\"\r\n      class=\"custom-header\"\r\n    >\r\n      <mat-panel-title>\r\n        <h3 class=\"h5 mb-0\"><info-tip-label label=\"documentazione\"></info-tip-label></h3>\r\n      </mat-panel-title>\r\n    </mat-expansion-panel-header>\r\n\t<div class=\"col-12\">\r\n\t\t<br>\r\n\t\t<div class=\"row\">\r\n\t\t\t<div class=\"col-12 mb-3\">\r\n\t\t\t\t<h3 class=\"h5 mb-0\"><info-tip-label label=\"documentazione-da-allegare\"></info-tip-label></h3>\r\n\t\t\t\t<div class=\"divider\"></div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<lib-carica-documenti\r\n\t\t\t[tipologieDocumento]=\"tipologieDocumentoAll$ | async\"\r\n\t\t\t[tipologieTipiEmittenti$]=\"tipologieTipiEmittenti$\"\r\n\t\t\t(onFileAdded)=\"addFiles$.next($event)\"\r\n\t\t\t#caricaDocumenti\r\n\t\t>\r\n\t\t</lib-carica-documenti>\r\n\t</div>\r\n\t<div class=\"col-12\" *ngIf=\"viewList$ | async\">\r\n\t\t<div class=\"d-flex border-bottom align-items-baseline mb-3\">\r\n\t\t\t<h3 class=\"h5 mb-0\">{{'documentazione-inserita' | traduzione}}</h3>\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"col-12\" *ngIf=\"viewList$ | async\">\r\n\t\t<lib-tabella-documenti [files$]=\"files$\" (indiceSelezionato)=\"removeFile$.next($event)\">\r\n\t\t</lib-tabella-documenti>\r\n\t</div>\r\n\t<div class=\"col-md-12\">\r\n\t\t<mat-error *ngIf=\"hasMissingFileTypes$ | async\">\r\n\t\t\t<p class=\"h6 mt-4\">{{'documenti-mancanti' | traduzione}}</p>\r\n\t\t\t<p *ngFor=\"let missing of missingFileTypes$ | async\">\r\n\t\t\t\t{{ missing.descrizione }}\r\n\t\t\t</p>\r\n\t\t</mat-error>\r\n\t</div>\r\n\t</mat-expansion-panel>\r\n\t<div class=\"mt-4\"></div>\r\n\t<lib-stepper-navigator\r\n\t\t[form]=\"form\"\r\n\t\t[direction]=\"direction\"\r\n\t\t[isFinal]=\"isFinal\"\r\n\t\t(goForward)=\"forward($event)\"\r\n\t\t(goBackward)=\"backward($event)\"\r\n\t\t(goBackward)=\"complete($event)\"\r\n\t\t(salvaBozza)=\"onSalvaBozza($event)\"\r\n\t\t[isContainerValid]=\"!(hasMissingFileTypes$ | async)\"\r\n\t>\r\n\t</lib-stepper-navigator>\r\n</div>\r\n",
                    styles: [""]
                },] }
    ];
    DocumentazioneComponent.ctorParameters = function () { return [
        { type: Modals }
    ]; };
    DocumentazioneComponent.propDecorators = {
        documenti: [{ type: i0.Input }],
        tipologieDocumento$: [{ type: i0.Input }],
        tipologieTipiEmittenti$: [{ type: i0.Input }],
        nextStep: [{ type: i0.Output }],
        salvaBozza: [{ type: i0.Output }],
        previousStep: [{ type: i0.Output }],
        caricaDocumenti: [{ type: i0.ViewChild, args: ['caricaDocumenti',] }]
    };

    var NewFile = /** @class */ (function () {
        function NewFile(tempId, file, tipoDocumento, soggettoEmittente, dataDocumento, numeroDocumento, codiceTipoEmittente, nota) {
            this.tempId = tempId;
            this.file = file;
            this.tipoDocumento = tipoDocumento;
            this.soggettoEmittente = soggettoEmittente;
            this.dataDocumento = dataDocumento;
            this.numeroDocumento = numeroDocumento;
            this.codiceTipoEmittente = codiceTipoEmittente;
            this.nota = nota;
        }
        return NewFile;
    }());

    var InfoTipService = /** @class */ (function () {
        function InfoTipService(
        // @Host() @Inject(I18NService) private readonly i18nService: I18NService
        i18nService) {
            this.i18nService = i18nService;
            this.i18n$ = this.i18nService
                .model$
                .pipe(operators.catchError(function (err) {
                console.error(err);
                return rxjs.of([]);
            }))
                .pipe(operators.shareReplay(1));
        }
        InfoTipService.prototype.getInfo$ = function (label) {
            return this.i18n$
                // .pipe(tap(_ => console.log("getInfo$", label, _)))
                .pipe(operators.map(function (t) { return t.find(function (model) { return model.codiceLabel == label; }); }));
        };
        return InfoTipService;
    }());
    InfoTipService.ɵprov = i0.ɵɵdefineInjectable({ factory: function InfoTipService_Factory() { return new InfoTipService(i0.ɵɵinject(i1$2.I18NService)); }, token: InfoTipService, providedIn: "root" });
    InfoTipService.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: 'root'
                    // , deps: [ I18NService ]
                },] }
    ];
    InfoTipService.ctorParameters = function () { return [
        { type: i1$2.I18NService }
    ]; };

    var CaricaDocumentiComponent = /** @class */ (function () {
        function CaricaDocumentiComponent(msg, infoTipService) {
            this.msg = msg;
            this.infoTipService = infoTipService;
            this.onFileAdded = new i0.EventEmitter();
            this.maxDate = new Date();
            this.validitaForm$ = new rxjs.Subject();
            /* Stream files caricati */
            this.files$ = new rxjs.BehaviorSubject(null);
        }
        CaricaDocumentiComponent.prototype.ngOnInit = function () {
            var _this = this;
            // //TODO
            // if (!this.tipologieEmittente) {
            // 	this.tipologieEmittente = [{ codice: "TIPOLOGIE_EMITTENTE_1", descrizione: "tipologieEmittente1", id: "1", codiceLingua: "it_IT" }]
            // }
            this.form = new forms.FormGroup({});
            var tipoDocumento = new forms.FormControl({ value: null, disabled: false }, [forms.Validators.required]);
            var soggettoEmittente = new forms.FormControl({ value: "", disabled: false }, [forms.Validators.required]);
            var dataDocumento = new forms.FormControl({ value: "", disabled: false }, [forms.Validators.required, ValidationService.ValidateDate]);
            var numeroDocumento = new forms.FormControl({ value: "", disabled: false }, [forms.Validators.required]);
            var tipologiaEmittente = new forms.FormControl({ value: null, disabled: false }, []);
            var note = new forms.FormControl({ value: "", disabled: false }, []);
            this.form.addControl('tipoDocumento', tipoDocumento);
            this.form.addControl('soggettoEmittente', soggettoEmittente);
            this.form.addControl('dataDocumento', dataDocumento);
            this.form.addControl('numeroDocumento', numeroDocumento);
            this.form.addControl('tipologiaEmittente', tipologiaEmittente);
            this.form.addControl('note', note);
            this.tipoDocumento$ = tipoDocumento.valueChanges.pipe(operators.shareReplay());
            this.soggettoEmittente$ = soggettoEmittente.valueChanges.pipe(operators.shareReplay());
            this.dataDocumento$ = dataDocumento.valueChanges.pipe(operators.shareReplay());
            this.numeroDocumento$ = numeroDocumento.valueChanges
                .pipe(operators.debounceTime(800), operators.shareReplay());
            this.addFiles$ = new rxjs.Subject();
            this.note$ = new rxjs.Subject();
            this.tipologieEmittente$ = new rxjs.Subject();
            var dtos$ = rxjs.combineLatest([this.tipoDocumento$, this.files$, this.soggettoEmittente$, this.dataDocumento$, this.numeroDocumento$, this.tipologieEmittente$, this.note$])
                .pipe(operators.map(function (_a) {
                var _b = __read(_a, 7), tipDocumento = _b[0], file = _b[1], soggettoEmittente = _b[2], dataDocumento = _b[3], numeroDocumento = _b[4], codiceTipoEmittente = _b[5], nota = _b[6];
                return new NewFile(new Date().getTime().toString(), file, tipDocumento, soggettoEmittente, dataDocumento, numeroDocumento, codiceTipoEmittente, nota);
            }));
            this.addFiles$.pipe(operators.debounceTime(300), operators.withLatestFrom(dtos$), operators.tap(function (_a) {
                var _b = __read(_a, 2), _ = _b[0], dto = _b[1];
                _this.onFileAdded.emit(dto);
                _this.validitaForm$.next(true);
                _this.pulisciForm();
            })).subscribe();
            this.infoTipService.getInfo$('numero-documento').subscribe(function (info) {
                _this.numeroDocumentoCaption = info.tooltip;
            });
        };
        CaricaDocumentiComponent.prototype.sfoglia = function (_) {
            if (this.fileInput.nativeElement) {
                this.fileInput.nativeElement.click();
            }
        };
        CaricaDocumentiComponent.prototype.filesChanged = function () {
            var file = this.fileInput.nativeElement.files[0];
            this.files$.next(file);
            this.nameFileTruncated = this.formatFunction(file.name);
        };
        CaricaDocumentiComponent.prototype.aggiungiFile = function (event) {
            this.tipologieEmittente$.next(this.form.value["tipologiaEmittente"]);
            this.note$.next(this.form.value["note"]);
            this.addFiles$.next(event);
            this.fileInput.nativeElement.value = '';
            //this.form.reset();
        };
        CaricaDocumentiComponent.prototype.resetForm = function () {
            this.form.reset();
        };
        CaricaDocumentiComponent.prototype.ngOnDistory = function () {
            this.subscription.unsubscribe();
        };
        CaricaDocumentiComponent.prototype.formatFunction = function (nomeFile) {
            return nomeFile.length > 18 ? nomeFile.substring(0, 18) + '...' + nomeFile.substring(nomeFile.length, nomeFile.length - 4) : nomeFile;
        };
        CaricaDocumentiComponent.prototype.pulisciForm = function () {
            var _this = this;
            Object.keys(this.form.value)
                .forEach(function (campo) {
                _this.form.get(campo).setValue('');
            });
            this.files$.next(null);
        };
        return CaricaDocumentiComponent;
    }());
    CaricaDocumentiComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-carica-documenti',
                    template: "<div class=\"row d-flex align-items-center\" [formGroup]=\"form\">\r\n\t<div class=\"col-12 col-md-6 my-2\">\r\n\t\t<mat-form-field>\r\n\t\t\t<mat-label>{{'tipo-documento' | traduzione}} {{' *'}}</mat-label>\r\n\t\t\t<mat-select formControlName=\"tipoDocumento\">\r\n\t\t\t\t<mat-option *ngFor=\"let tipoDocumento of tipologieDocumento\" [value]=\"tipoDocumento\">\r\n\t\t\t\t\t{{tipoDocumento.descrizione}}\r\n\t\t\t\t</mat-option>\r\n\t\t\t</mat-select>\r\n\t\t\t<mat-error *ngIf=\"form.controls['tipoDocumento'].invalid\">\r\n\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['tipoDocumento']) | traduzione}}\r\n\t\t\t</mat-error>\r\n\t\t\t<mat-hint *infoTip=\"'tipo-documento'\"></mat-hint>\r\n\t\t</mat-form-field>\r\n\t</div>\r\n\t<div class=\"col-12 col-md-6 my-2\">\r\n\t\t<mat-form-field>\r\n\t\t\t<mat-label>{{'soggetto-emittente' | traduzione}}{{' *'}}</mat-label>\r\n\t\t\t<input matInput formControlName=\"soggettoEmittente\">\r\n\t\t\t<mat-error *ngIf=\"form.controls['soggettoEmittente'].invalid\">\r\n\t\t\t\t{{ msg.produceMessage('obbligatorio', form.controls['soggettoEmittente']) | traduzione}}\r\n\t\t\t</mat-error>\r\n\t\t\t<mat-hint *infoTip=\"'soggetto-emittente'\"></mat-hint>\r\n\t\t</mat-form-field>\r\n\t</div>\r\n\r\n\t<div class=\"col-12 col-md-6 col-lg-3 my-2\">\r\n\t\t<mat-form-field>\r\n\t\t\t<mat-label>{{'data-documento' | traduzione}}{{' *'}}</mat-label>\r\n\t\t\t<input matInput [matDatepicker]=\"picker\" formControlName=\"dataDocumento\" [max]=\"maxDate\">\r\n\t\t\t<mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n\t\t\t<mat-datepicker #picker></mat-datepicker>\r\n\t\t\t<mat-error *ngIf=\"form.controls['dataDocumento'].invalid\">\r\n\t\t\t\t{{ msg.getErrorData(form.controls[\"dataDocumento\"]) | traduzione }}\r\n\t\t\t</mat-error>\r\n\t\t\t<mat-hint *infoTip=\"'data-documento'\"></mat-hint>\r\n\t\t</mat-form-field>\r\n\r\n\t</div>\r\n\t<div class=\"col-12 col-md-6  col-lg-3 my-2\">\r\n\t\t<mat-form-field appearance=\"\"> \r\n\t\t\t<mat-label>{{'numero-documento' | traduzione}}{{'*'}}</mat-label>\r\n\t\t\t<input matInput formControlName=\"numeroDocumento\" #numeroDoc maxlength=\"49\">\r\n\t\t\t<mat-error *ngIf=\"form.controls['numeroDocumento'].invalid\">\r\n\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['numeroDocumento']) | traduzione}}\r\n\t\t\t</mat-error>\r\n\t\t\t<mat-hint align=\"start\" style=\"max-width: 70%!important;color: black!important;\">{{numeroDocumentoCaption}}</mat-hint>\r\n\t\t\t<mat-hint align=\"end\">{{numeroDoc.value.length}} / 49</mat-hint>\r\n\t\t</mat-form-field>\r\n\t</div>\r\n\r\n\r\n\t<div class=\"col-12 col-md-9 col-lg-3 my-2\">\r\n\t\t<mat-form-field>\r\n\t\t\t<mat-label>{{'tipologia-emittente' | traduzione}}</mat-label>\r\n\t\t\t<!-- TODO -->\r\n\t\t\t<!-- <mat-select formControlName=\"tipologiaEmittente\">\r\n\t\t\t\t<mat-option [value]=\"null\">-- {{ 'placeholder' | traduzione }} --</mat-option>\r\n\t\t\t\t<mat-option *ngFor=\"let tipologiaEmittente of tipologieEmittente\" [value]=\"tipologiaEmittente\">\r\n\t\t\t\t\t{{tipologiaEmittente.descrizione}}\r\n\t\t\t\t</mat-option>\r\n\t\t\t</mat-select> -->\r\n\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"tipologiaEmittente\">\r\n\t\t\t\t<mat-option \r\n\t\t\t\t\t*ngFor=\"let tipoEmittente of tipologieTipiEmittenti$ | async\"\r\n\t\t\t\t\t[value]=\"tipoEmittente.codice\"\r\n\t\t\t\t>\r\n\t\t\t\t{{ tipoEmittente.descrizione }}\r\n\t\t\t\t</mat-option>\r\n\t\t\t</mat-select>\r\n\t\t\t<mat-hint *infoTip=\"'tipologia-emittente'\"></mat-hint>\r\n\t\t</mat-form-field>\r\n\t</div>\r\n\t<div class=\"col-12 col-md-3 col-lg-3 my-2\">\r\n\t\t<button mat-stroked-button color=\"primary\" class=\"text-uppercase mb-2\" (click)=\"sfoglia($event)\">\r\n\t\t\t<i class=\"fas fa-upload\"></i> {{'upload-file' | traduzione}}\r\n\t\t</button>\r\n\r\n\t\t<p *ngIf=\"files$ | async as files\" class=\"position-absolute mb-0 mt-2 text-muted file-upl\">\r\n\t\t\t<i class=\"far fa-file-alt text-primary mr-1\" aria-hidden=\"true\"></i>\r\n\t\t\t{{nameFileTruncated}}\r\n\t\t\t<!-- <a href=\"#\" (click)=\"files$.next(null)\"><span class=\" ml-1 sr-only\">{{'scarta_il_file' |\r\n\t\t\t\t\ttraduzione}}</span><i class=\"fas fa-times-circle ml-2 text-danger\"></i></a> -->\r\n\t\t</p>\r\n\t</div>\r\n\t<div class=\"col-12 my-2\">\r\n\t\t<mat-form-field class=\"example-full-width\">\r\n\t\t\t<mat-label>{{'note' | traduzione}}</mat-label>\r\n\t\t\t<textarea matInput \r\n\t\t\tplaceholder=\"Lorem ipsum...\" \r\n\t\t\tformControlName=\"note\"\r\n\t\t\tmaxlength=\"511\"\r\n\t\t\t#testo\r\n\t\t\t></textarea>\r\n\t\t\t<mat-hint *infoTip=\"'note'\"></mat-hint>\r\n\t\t\t<mat-hint align=\"end\">{{testo.value.length}} / 511</mat-hint>\r\n\t\t</mat-form-field>\r\n\r\n\t</div>\r\n\t<div class=\"col-12 text-right my-2\">\r\n\t\t<button type=\"button\" mat-flat-button color=\"primary\" class=\"text-uppercase mb-2\" (click)=\"aggiungiFile($event)\"\r\n\t\t\t[disabled]=\"form.invalid || (files$ | async) == null\">\r\n\t\t\t{{'aggiungi' | traduzione}}\r\n\t\t</button>\r\n\t</div>\r\n\t<input #fileInput *ngIf=\"(tipoDocumento$ | async) != null\" type=\"file\" class=\"hidden\"\r\n\t\t(change)=\"filesChanged($event)\" accept=\".pdf\">\r\n</div>",
                    styles: ["button#buttoneCarica{display:none}.file-upl{white-space:nowrap}"]
                },] }
    ];
    CaricaDocumentiComponent.ctorParameters = function () { return [
        { type: MessageService },
        { type: InfoTipService }
    ]; };
    CaricaDocumentiComponent.propDecorators = {
        tipologieDocumento: [{ type: i0.Input }],
        tipologieEmittente: [{ type: i0.Input }],
        tipologieTipiEmittenti$: [{ type: i0.Input }],
        onFileAdded: [{ type: i0.Output }],
        fileInput: [{ type: i0.ViewChild, args: ['fileInput',] }]
    };

    var TipologiaDepositoComponent = /** @class */ (function () {
        function TipologiaDepositoComponent(msg) {
            this.msg = msg;
            this.tipologiaDepositoReady = new i0.EventEmitter();
            this.dateRichiesta = new Date();
        }
        TipologiaDepositoComponent.prototype.ngOnInit = function () {
            this.form = new forms.FormGroup({});
            this.tipologiaDeposito = new forms.FormControl({ value: null, disabled: false }, [forms.Validators.required]);
            this.form.addControl('tipologiaDeposito', this.tipologiaDeposito);
            this.dataRichiesta = new forms.FormControl({ value: new Date(Date.now()), disabled: true }, [forms.Validators.required, ValidationService.ValidateDate]);
            this.form.addControl("dataRichiesta", this.dataRichiesta);
        };
        TipologiaDepositoComponent.prototype.compilaRichiesta = function () {
            this.selectedTipoDeposito = this.depositoReady();
            // console.log('[selectedTipoDeposito]', this.selectedTipoDeposito);
            var depToEmit = ComponentOutputStatus.of(true, this.selectedTipoDeposito);
            this.tipologiaDepositoReady.emit(depToEmit);
        };
        TipologiaDepositoComponent.prototype.depositoReady = function () {
            return ({
                tipologiaDeposito: this.form.value['tipologiaDeposito'],
                dataRichiesta: new Date(moment(this.dataRichiesta.value, 'DD/MM/YYYY').toDate())
                //TODO
                // , dataRichiesta: new Date(moment(this.form.value['dataRichiesta'], 'DD/MM/YYYY').toDate())
            });
        };
        return TipologiaDepositoComponent;
    }());
    TipologiaDepositoComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-tipologia-deposito',
                    template: "<div class=\"row\">\r\n\t<div class=\"col-12\">\r\n\t\t<!-- <h2 class=\"h2\">{{'tipologia-deposito' | traduzione}}</h2> -->\r\n\t\t<h2><info-tip-label label=\"tipologia-deposito\"></info-tip-label></h2>\r\n\t</div>\r\n\t<div class=\"col-12\">\r\n\t\t<p>I depositi definitivi sono somme di denaro che devono essere versate da parte di soggetti pubblici o privati\r\n\t\t\t(persone fisiche o giuridiche) in base a legge o per disposizione delle Pubbliche Amministrazioni e che\r\n\t\t\tvengono poi custodite dal Ministero dell\u2019Economia e delle Finanze che cura anche la loro restituzione ai\r\n\t\t\tsoggetti che ne hanno diritto.</p>\r\n\t\t<p>\r\n\t\t\tSi classificano in depositi definitivi obbligatori e volontari:\r\n\t\t</p>\r\n\t\t<ul>\r\n\t\t\t<li>\r\n\t\t\t\t<p><b>Obbligatori:</b> sono quelli prescritti da Leggi o Regolamenti ovvero dall\u2019Autorit\u00E0 giudiziaria o\r\n\t\t\t\t\tamministrativa. Inoltre, sono obbligatori i depositi definitivi eseguiti in dipendenza di un vincolo\r\n\t\t\t\t\tlegale o sono ammessi dalla legge per conseguire un determinato effetto giuridico. Possono essere\r\n\t\t\t\t\teffettuati sia da soggetti privati che da soggetti pubblici.\r\n\t\t\t\t\tSi suddividono in:</p>\r\n\t\t\t\t<ul>\r\n\t\t\t\t\t<li>\r\n\t\t\t\t\t\t<p><b>amministrativi:</b> sono i depositi di somme relative alle procedure di esproprio ovvero\r\n\t\t\t\t\t\t\tquelli eseguiti o ordinati da una Pubblica Amministrazione (o soggetto delegato) o, infine,\r\n\t\t\t\t\t\t\tquelli che non possono essere restituiti senza il consenso di una Pubblica Amministrazione\r\n\t\t\t\t\t\t\t(o soggetto delegato). La pi\u00F9 rilevante figura di depositi definitivi amministrativi \u00E8\r\n\t\t\t\t\t\t\tquella per espropri</p>\r\n\t\t\t\t\t</li>\r\n\t\t\t\t\t<li>\r\n\t\t\t\t\t\t<p><b>cauzionali:</b> effettuati a garanzia di Pubbliche Amministrazioni in forza di leggi o\r\n\t\t\t\t\t\t\tregolamenti;\r\n\t\t\t\t\t</li>\r\n\t\t\t\t\t<li>\r\n\t\t\t\t\t\t<p><b>giudiziari:</b> ordinati dall\u2019Autorit\u00E0 giudiziaria o la cui propriet\u00E0 sia contestata\r\n\t\t\t\t\t\t\tgiudizialmente ovvero sia in attesa di definizione giudiziale;</p>\r\n\t\t\t\t\t</li>\r\n\t\t\t\t</ul>\r\n\t\t\t</li>\r\n\t\t\t<li>\r\n\t\t\t\t<p><b>Volontari:</b> possono essere effettuati depositi definitivi volontari allo scopo di impiego di\r\n\t\t\t\t\tcapitali esclusivamente da Enti ed Amministrazioni statali, Regioni, Enti locali e altri Enti\r\n\t\t\t\t\tpubblici ai sensi dell\u2019art. 1, comma1, lett.a) del D.Lgs. 30 luglio 1999 n. 284</p>\r\n\t\t\t</li>\r\n\t\t</ul>\r\n\r\n\t\t<p>\r\n\t\t\tIl servizio depositi definitivi \u00E8 gestito su tutto il territorio nazionale dalle Ragionerie territoriali\r\n\t\t\tdello Stato, il cui coordinamento giuridico, amministrativo e contabile \u00E8 affidato all\u2019Ufficio VI Direzione\r\n\t\t\tdei Servizi erogati alle Amministrazioni e ai terzi (DST).\r\n\t\t</p>\r\n\t</div>\r\n</div>\r\n<div class=\"d-flex border-bottom align-items-baseline mb-3\">\r\n\t<!-- <h3 class=\"mr-auto font-weight-bold mt-4 mb-0\">{{'seleziona-tipo-deposito' | traduzione}}</h3> -->\r\n\t<h3 class=\"mr-auto font-weight-bold mt-4 mb-0\"><info-tip-label label=\"seleziona-tipo-deposito\"></info-tip-label></h3>\r\n</div>\r\n<div class=\"row d-flex align-items-center\" [formGroup]=\"form\">\r\n\t<div class=\"col-12\">\r\n\t\t<div class=\"alert alert-info\" role=\"alert\">\r\n\t\t\t<span class=\"fas fa-info mr-2 info-icon\" aria-hidden=\"ture\"></span> {{'campi-obbligatori' | i18n }}\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"col-12 col-md-6 col-lg-6\">\r\n\t\t<mat-form-field>\r\n\t\t\t<mat-label>{{'required'| traduzione}}{{'tipologia-deposito' | traduzione }}</mat-label>\r\n\t\t\t<mat-select formControlName=\"tipologiaDeposito\">\r\n\t\t\t\t<mat-option *ngFor=\"let deposito of tipologieDeposito$ | async\" [value]=\"deposito\">\r\n\t\t\t\t\t{{deposito.descrizione}}\r\n\t\t\t\t</mat-option>\r\n\t\t\t</mat-select>\r\n\t\t\t<mat-error *ngIf=\"form.controls['tipologiaDeposito'].invalid\">\r\n\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['tipologiaDeposito']) | traduzione}}\r\n\t\t\t</mat-error>\r\n\t\t\t<mat-hint *infoTip=\"'tipologia-deposito'\"></mat-hint>\r\n\t\t</mat-form-field>\r\n\t</div>\r\n\r\n\t<div class=\"col-12 col-md-3 col-lg-4\">\r\n\t\t<mat-form-field>\r\n\t\t\t<input [max]=\"dateRichiesta\" matInput [matDatepicker]=\"dataRichiesta\"\r\n\t\t\t\tplaceholder=\"{{'required' | traduzione}}{{'data-richiesta' | traduzione}}\"\r\n\t\t\t\tformControlName=\"dataRichiesta\" />\r\n\t\t\t<mat-datepicker-toggle matSuffix [for]=\"dataRichiesta\"></mat-datepicker-toggle>\r\n\t\t\t<mat-datepicker #dataRichiesta></mat-datepicker>\r\n\t\t\t<mat-error *ngIf=\"form.controls['dataRichiesta'].invalid\">\r\n\t\t\t\t{{ msg.getErrorData(form.controls[\"dataRichiesta\"]) | traduzione }}\r\n\t\t\t</mat-error>\r\n\t\t\t<mat-hint *infoTip=\"'data-richiesta'\"></mat-hint>\r\n\t\t</mat-form-field>\r\n\t</div>\r\n\r\n\t<div class=\"col-12 col-md-3 col-lg-2 text-right\">\r\n\t\t<button mat-flat-button color=\"primary\" class=\"text-uppercase mb-2\" \r\n\t\t\t[disabled]=\"form.invalid\"\r\n\t\t\t(click)=\"compilaRichiesta()\">\r\n\t\t\t{{'compila-richiesta' | traduzione}}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\n",
                    styles: [".mat-form-field-appearance-legacy .mat-form-field-wrapper{padding-bottom:1.34375em}"]
                },] }
    ];
    TipologiaDepositoComponent.ctorParameters = function () { return [
        { type: MessageService }
    ]; };
    TipologiaDepositoComponent.propDecorators = {
        tipologieDeposito$: [{ type: i0.Input }],
        tipologiaDepositoReady: [{ type: i0.Output }]
    };

    var AllegatiComponent = /** @class */ (function () {
        function AllegatiComponent(translateService, translatePipe, http, configurationService) {
            this.translateService = translateService;
            this.translatePipe = translatePipe;
            this.http = http;
            this.configurationService = configurationService;
            this.documentoDownload$ = new rxjs.Subject();
            this.allegati = [];
            this.colonne = [];
            this.dettaglioDoc = new i0.EventEmitter();
            this.cl1 = false;
            this.cl2 = false;
            this.cl3 = false;
            this.cl4 = false;
            this.cl5 = false;
            this.cl6 = false;
            this.cl7 = false;
            this.cl8 = false;
        }
        AllegatiComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.documentaleServiceUrl = this.configurationService.servicePaths.get('DOCUMENTALE_MS_API_URL');
            this.translatePipe.transform('');
            this.translateService.traduzioniLib$
                .pipe(operators.tap(function (_) { return _ ? _this.loadingLinguage = true : null; }))
                .subscribe();
            // console.log('[colonne]', this.colonne);
            this.cl1 = this.colonne.find(function (tipoServizio) { return tipoServizio.chiave == "colonna_allegati_1"; }).visibile;
            this.cl2 = this.colonne.find(function (tipoServizio) { return tipoServizio.chiave == "colonna_allegati_2"; }).visibile;
            this.cl3 = this.colonne.find(function (tipoServizio) { return tipoServizio.chiave == "colonna_allegati_3"; }).visibile;
            this.cl4 = this.colonne.find(function (tipoServizio) { return tipoServizio.chiave == "colonna_allegati_4"; }).visibile;
            this.cl5 = this.colonne.find(function (tipoServizio) { return tipoServizio.chiave == "colonna_allegati_5"; }).visibile;
            this.cl6 = this.colonne.find(function (tipoServizio) { return tipoServizio.chiave == "colonna_allegati_6"; }).visibile;
            this.cl7 = this.colonne.find(function (tipoServizio) { return tipoServizio.chiave == "colonna_allegati_7"; }).visibile;
            this.cl8 = this.colonne.find(function (tipoServizio) { return tipoServizio.chiave == "colonna_allegati_8"; }).visibile;
            // console.log('[colonne] - cl1', this.cl1);
            // console.log('[colonne] - cl2', this.cl2);
            // console.log('[colonne] - cl3', this.cl3);
            // console.log('[colonne] - cl4', this.cl4);
            // console.log('[colonne] - cl5', this.cl5);
            // console.log('[colonne] - cl6', this.cl6);
            // console.log('[colonne] - cl7', this.cl7);
            // console.log('[colonne] - cl8', this.cl8);
        };
        AllegatiComponent.prototype.downloadFile = function (documento) {
            var _this = this;
            var url = this.documentaleServiceUrl + documento.url;
            console.log('[url]', url);
            var headers = new i1.HttpHeaders();
            headers.append('Accept', 'text/plain');
            this.http.get(url, { headers: headers, responseType: 'blob' }).subscribe(function (response) { return _this.saveFile(response, documento.nome); });
        };
        AllegatiComponent.prototype.saveFile = function (response, nomeFile) {
            var blob = new Blob([response], { type: 'text/plain' });
            fileSaver.saveAs(blob, nomeFile);
        };
        AllegatiComponent.prototype.isValid = function (stato) {
            if (stato.filter(function (s) { return s.lastState == true; })) {
                return true;
            }
            else {
                return false;
            }
        };
        AllegatiComponent.prototype.visualizzaDettaglio = function (allegato) {
            this.visualizzaDettagli = true;
            try {
                this.dataJson = JSON.parse(allegato.jsonMetadati);
            }
            catch (e) {
                this.dataJson = null;
                console.log('[error occored while you were typing the JSON]');
            }
            ;
            this.documentoSelezionato = allegato;
            this.dettaglioDoc.emit(this.visualizzaDettagli);
        };
        return AllegatiComponent;
    }());
    AllegatiComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-allegati',
                    template: "<!-- <p>allegati works!</p> -->\r\n<div *ngIf=\"loadingLinguage\" class=\"row\">\r\n\t<div *ngIf=\"!visualizzaDettagli\" class=\"col-12\">\r\n\t\t<div class=\"table-responsive\">\r\n\t\t\t<table class=\"table border\">\r\n\t\t\t\t<thead>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th *ngIf=\"cl1\" scope=\"col\">{{'colonna_allegati_1' | traduzione}}</th>\r\n\t\t\t\t\t\t<th *ngIf=\"cl2\" scope=\"col\">{{'colonna_allegati_2' | traduzione}}</th>\r\n\t\t\t\t\t\t<th *ngIf=\"cl3\" scope=\"col\">{{'colonna_allegati_3' | traduzione}}</th>\r\n\t\t\t\t\t\t<th *ngIf=\"cl4\" scope=\"col\">{{'colonna_allegati_4' | traduzione}}</th>\r\n\t\t\t\t\t\t<th *ngIf=\"cl5\" scope=\"col\">{{'colonna_allegati_5' | traduzione}}</th>\r\n\t\t\t\t\t\t<th *ngIf=\"cl6\" scope=\"col\">{{'colonna_allegati_6' | traduzione}}</th>\r\n\t\t\t\t\t\t<th *ngIf=\"cl7\" scope=\"col\">{{'colonna_allegati_7' | traduzione}}</th>\r\n\t\t\t\t\t\t<th *ngIf=\"cl8\" scope=\"col\">{{'colonna_allegati_8' | traduzione}}</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</thead>\r\n\t\t\t\t<tbody>\r\n\t\t\t\t\t<tr *ngFor=\"let allegato of allegati let i = index\">\r\n\t\t\t\t\t\t<td *ngIf=\"cl1\">{{allegato?.dataDocumento | date:'dd/MM/yyyy'}}</td>\r\n\t\t\t\t\t\t<td *ngIf=\"cl2\">{{allegato?.dataCreazione | date:'dd/MM/yyyy'}}</td>\r\n\t\t\t\t\t\t<td *ngIf=\"cl3\">{{allegato?.tipoServizio?.descrizione}}</td>\r\n\t\t\t\t\t\t<td *ngIf=\"cl4\">{{allegato.descrizione}}</td>\r\n\t\t\t\t\t\t<td *ngIf=\"cl5\">{{allegato.nome}}</td>\r\n\t\t\t\t\t\t<td *ngIf=\"cl6\">{{allegato?.tipoDocumento?.descrizione}}</td>\r\n\t\t\t\t\t\t<td *ngIf=\"cl7\">\r\n\t\t\t\t\t\t\t<button mat-flat-button color=\"\" class=\"btn btn-link\"\r\n\t\t\t\t\t\t\t\t[disabled]=\"!isValid(allegato.statiDocumento)\"\r\n\t\t\t\t\t\t\t\t(click)=\"downloadFile(allegato)\"\r\n\t\t\t\t\t\t\t\t[attr.aria-label]=\"'bt-download-doc' | traduzione\"\r\n\t\t\t\t\t\t\t\ttitle=\"{{'bt-download-doc' | traduzione}}\">\r\n\t\t\t\t\t\t\t\t<span class=\"fas fa-download\" aria-hidden=\"true\"></span>\r\n\t\t\t\t\t\t\t\t<p class=\"sr-only\">{{'bt-download-doc' | traduzione}}</p>\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td *ngIf=\"allegato.jsonMetadati && cl8\">\r\n\t\t\t\t\t\t\t<button mat-flat-button color=\"\" class=\"btn btn-link\"\r\n\t\t\t\t\t\t\t\t(click)=\"visualizzaDettaglio(allegato)\"\r\n\t\t\t\t\t\t\t\t[attr.aria-label]=\"'bt-visualizza-dettaglio' | traduzione\"\r\n\t\t\t\t\t\t\t\ttitle=\"{{'bt-visualizza-dettaglio' | traduzione}}\">\r\n\t\t\t\t\t\t\t\t<span class=\"fas fa-eye ml-2\" aria-hidden=\"true\"></span>\r\n\t\t\t\t\t\t\t\t<p class=\"sr-only\">{{'bt-visualizza-dettaglio' | traduzione}}</p>\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<!-- TODO -->\r\n\t\t\t\t\t<!-- <tr *ngIf=\"allegato.jsonMetadati\">\r\n\t\t\t\t\t\t<button mat-flat-button color=\"link\" class=\"btn btn-link\"\r\n\t\t\t\t\t\t\t(click)=\"visualizzaDettaglio(allegato)\">\r\n\t\t\t\t\t\t\t{{'colonna_allegati_8' | traduzione}}\r\n\t\t\t\t\t\t\t{{'Visualizza dettaglio' | traduzione}}\r\n\t\t\t\t\t\t\t<i class=\"fas fa-arrow-right ml-2\"></i>\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t<a (click)=\"visualizzaDettaglio(allegato)\" class=\"float\"\r\n\t\t\t\t\t\t\t>{{'Visualizza dettaglio' | traduzione}}\r\n\t\t\t\t\t\t\t<i class=\"bg-primary text-white fas fa-arrow-right ml-1 p-2 rounded \"></i>\r\n\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t<lib-visualizza-dettagli\r\n\t\t\t\t\t\t\t\t[documentoSelezionato]=\"allegato\"\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t</lib-visualizza-dettagli>\r\n\t\t\t\t\t</tr> -->\r\n\t\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t\t<div class=\"col-12\">\r\n\t\t\t<div *ngIf=\"visualizzaDettagli\" class=\"card card-primary shadow\">\r\n\t\t\t\t<div class=\"card-header px-3 py-2\">\r\n\t\t\t\t\t<h4 class=\"card-title mb-0 font-weight-bold d-inline text-uppercase h5\">\r\n\t\t\t\t\t\t{{documentoSelezionato?.tipoServizio?.descrizione}}</h4>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"card-body px-3 py-2\">\r\n\t\t\t\t\t<div class=\"row mt-2 mb-3\">\r\n\t\t\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">\r\n\t\t\t\t\t\t\t\t{{'colonna_allegati_1' | traduzione }}:\r\n\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t<p >{{documentoSelezionato?.dataDocumento | date:'dd/MM/yyyy'}}</p>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">\r\n\t\t\t\t\t\t\t\t{{'colonna_allegati_2' | traduzione }}:\r\n\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t<p>{{documentoSelezionato?.dataCreazione | date:'dd/MM/yyyy'}}</p>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">\r\n\t\t\t\t\t\t\t\t{{'colonna_allegati_3' | traduzione }}:\r\n\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t<p >{{documentoSelezionato?.tipoServizio?.descrizione}}</p>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">\r\n\t\t\t\t\t\t\t\t{{'colonna_allegati_5' | traduzione }}:\r\n\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t<p>{{documentoSelezionato?.nome}}</p>\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">\r\n\t\t\t\t\t\t\t\t{{'colonna_allegati_4' | traduzione }}:\r\n\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t<p>{{documentoSelezionato?.descrizione}}</p>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">\r\n\t\t\t\t\t\t\t\t{{'colonna_allegati_6' | traduzione }}:\r\n\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t<p >{{documentoSelezionato?.tipoDocumento?.descrizione}}</p>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12 mb-3\">\r\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\"><strong>{{'colonna_allegati_7' | traduzione }}</strong></p>\r\n\t\t\t\t\t\t\t<button mat-flat-button color=\"link\" class=\"btn btn-primary\"\r\n\t\t\t\t\t\t\t\t[disabled]=\"!isValid(documentoSelezionato.statiDocumento)\"\r\n\t\t\t\t\t\t\t\t(click)=\"downloadFile(documentoSelezionato)\" aria-label=\"scarica il documento\">\r\n\t\t\t\t\t\t\t\tDownload <span class=\"fas fa-download fa-lg ml-2\" aria-hidden=\"true\"></span>\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"col-12\">\r\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\" aria-labelledby=\"ulteriori_documento\">{{'Ulteriori Dettagli' | traduzione }}:</p>\r\n\t\t\t\t\t\t\t<ngx-json-viewer *ngIf=\"dataJson\"\r\n\t\t\t\t\t\t\t\t[json]=\"dataJson\"\r\n\t\t\t\t\t\t\t\t[expanded]=\"true\"\r\n\t\t\t\t\t\t\t\tid=\"ulteriori_documento\"\r\n\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t</ngx-json-viewer>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n",
                    styles: [".card-primary>.card-header{background-color:#d3deea}.table>thead{background-color:#0a2644;color:#fff}.table td,.table th{border-top:0;padding:.75rem;vertical-align:top}.table tr{border-bottom:1px solid #dee2e6}.table tbody tr:hover{background-color:#dee2e6}.btn-link{color:#0061c2}.btn-link:hover{color:#053a9a}.btn-primary{background-color:#0061c2}.btn-primary:hover{background-color:#053a9a}"]
                },] }
    ];
    AllegatiComponent.ctorParameters = function () { return [
        { type: TranslateService },
        { type: TranslatePipe },
        { type: i1.HttpClient },
        { type: ConfigurationService }
    ]; };
    AllegatiComponent.propDecorators = {
        allegati: [{ type: i0.Input }],
        visualizzaDettagli: [{ type: i0.Input }],
        colonne: [{ type: i0.Input }],
        dettaglioDoc: [{ type: i0.Output }]
    };

    var VisualizzaDettagliComponent = /** @class */ (function () {
        function VisualizzaDettagliComponent(traduzione, http, configurationService) {
            this.traduzione = traduzione;
            this.http = http;
            this.configurationService = configurationService;
        }
        VisualizzaDettagliComponent.prototype.ngOnInit = function () {
            console.log('[Documentale]', this.documentoSelezionato);
            this.documentaleServiceUrl = this.configurationService.servicePaths.get('DOCUMENTALE_MS_API_URL');
            this.dettagli = this.traduzione.transform('visualizzaDettagli');
            try {
                this.dataJson = JSON.parse(this.documentoSelezionato.jsonMetadati);
            }
            catch (e) {
                this.dataJson = null;
                console.log('[error occored while you were typing the JSON]');
            }
            ;
            // this.data = this.pagamento.dataValuta != null ?
            //   moment(new Date(this.pagamento.dataValuta)).format("DD/MM/YYYY") : '';
            // this.contaRighe();
        };
        VisualizzaDettagliComponent.prototype.accordionOpened = function () {
            this.dettagli = this.traduzione.transform('nascondiDettagli');
        };
        VisualizzaDettagliComponent.prototype.accordionClosed = function () {
            this.dettagli = this.traduzione.transform('visualizzaDettagli');
        };
        VisualizzaDettagliComponent.prototype.contaRighe = function () {
            // if (this.pagamento.motivoScarto) {
            // 	let par = this.pagamento.motivoScarto;
            // 	par = par.replace(/(^\s*)|(\s*$)/gi, "");
            // 	par = par.replace(/[ ]{2,}/gi, " ");
            // 	par = par.replace(/\n /, "\n");
            // 	let numeroRighe = par.split('').length / 180;
            // 	this.numeroRighe = Math.ceil(numeroRighe).toString()
            // }
        };
        VisualizzaDettagliComponent.prototype.downloadFile = function (documento) {
            var _this = this;
            var url = this.documentaleServiceUrl + documento.url;
            console.log('[url]', url);
            var headers = new i1.HttpHeaders();
            headers.append('Accept', 'text/plain');
            this.http.get(url, { headers: headers, responseType: 'blob' }).subscribe(function (response) { return _this.saveFile(response, documento.nome); });
        };
        VisualizzaDettagliComponent.prototype.isValid = function (stato) {
            if (stato.filter(function (s) { return s.lastState == true; })) {
                return true;
            }
            else {
                return false;
            }
        };
        VisualizzaDettagliComponent.prototype.saveFile = function (response, nomeFile) {
            var blob = new Blob([response], { type: 'text/plain' });
            fileSaver.saveAs(blob, nomeFile);
        };
        return VisualizzaDettagliComponent;
    }());
    VisualizzaDettagliComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-visualizza-dettagli',
                    template: "<!-- <p>visualizza-dettagli works!</p> -->\r\n<mat-accordion class=\"example-headers-align\" multi>\r\n\t<mat-expansion-panel class=\"panel-dettagli\" (opened)=\"accordionOpened()\" (closed)=\"accordionClosed()\">\r\n\t\t<mat-expansion-panel-header class=\"detail-pagamenti\">\r\n\t\t\t<mat-panel-title class=\"text-white\">\r\n\t\t\t\t{{dettagli}}\r\n\t\t\t</mat-panel-title>\r\n\t\t</mat-expansion-panel-header>\r\n\t\t<div class=\"row mt-2\">\r\n\t\t\t<!-- <div class=\"col-4\">\r\n            <p class=\"mb-0\"><b>{{'beneficiario' | traduzione}}</b></p>\r\n            <p>{{pagamento?.denominazione}}</p>\r\n        </div>\r\n        <div class=\"col-4\">\r\n            <p class=\"mb-0\"><b>{{'dataValuta' | traduzione}}</b></p>\r\n            <p>{{data}}</p>\r\n        </div>\r\n        <div class=\"col-4\">\r\n            <p class=\"mb-0\"><b>{{'cro' | traduzione}}</b></p>\r\n            <p>{{pagamento?.cro}}</p>\r\n        </div>\r\n        <div class=\"col-12\">\r\n            <p class=\"mb-0\"><b>{{'modalitaPagamaneto' | traduzione}}</b></p>\r\n            <p>{{pagamento.modalitaPagamento?.descrizione}}</p>\r\n        </div>\r\n        <div *ngIf=\"pagamento.motivoScarto\" class=\"col-12 col-md-12\">\r\n            <p class=\"mb-0\"><b>{{'motivoScarto' | traduzione}}</b></p>\r\n            <textarea disabled=\"true\" matInput value={{pagamento.motivoScarto}} rows={{numeroRighe}}></textarea>\r\n        </div> -->\r\n\r\n\t\t</div>\r\n\t\t<div class=\"card-header px-3 py-2\">\r\n\t\t\t<h3 class=\"card-title mb-0 font-weight-bold d-inline text-uppercase !important\">\r\n\t\t\t\t{{documentoSelezionato.tipoServizio.descrizione}}</h3>\r\n\t\t</div>\r\n\t\t<div class=\"card-body px-3 py-2\">\r\n\t\t\t<div class=\"row mt-2 mb-3\">\r\n\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t<p class=\"mb-0\">\r\n\t\t\t\t\t\t<!-- <b>{{'colonna_allegati_1' | traduzione }}</b> -->\r\n\t\t\t\t\t\t<b>{{'Data Documento' | traduzione }}</b>\r\n\t\t\t\t\t</p>\r\n\t\t\t\t\t<p>{{documentoSelezionato.dataCreazione | date:'dd/MM/yyyy'}}</p>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t<p class=\"mb-0\">\r\n\t\t\t\t\t\t<!-- <b>{{'colonna_allegati_2' | traduzione }}</b> -->\r\n\t\t\t\t\t\t<b>{{'Data Caricamento' | traduzione }}</b>\r\n\t\t\t\t\t</p>\r\n\t\t\t\t\t<p>{{documentoSelezionato.dataCreazione | date:'dd/MM/yyyy'}}</p>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t<p class=\"mb-0\">\r\n\t\t\t\t\t\t<!-- <b>{{'colonna_allegati_3' | traduzione }}</b> -->\r\n\t\t\t\t\t\t<b>{{'Servizio' | traduzione }}</b>\r\n\t\t\t\t\t</p>\r\n\t\t\t\t\t<p>{{documentoSelezionato.tipoServizio.descrizione}}</p>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t<p class=\"mb-0\">\r\n\t\t\t\t\t\t<!-- <b>{{'colonna_allegati_5' | traduzione }}</b> -->\r\n\t\t\t\t\t\t<b>{{'Nome Documento' | traduzione }}</b>\r\n\t\t\t\t\t</p>\r\n\t\t\t\t\t<p>{{documentoSelezionato.nome}}</p>\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t<p class=\"mb-0\">\r\n\t\t\t\t\t\t<!-- <b>{{'colonna_allegati_4' | traduzione }}</b> -->\r\n\t\t\t\t\t\t<b>{{'Descrizione' | traduzione }}</b>\r\n\t\t\t\t\t</p>\r\n\t\t\t\t\t<p>{{documentoSelezionato.descrizione}}</p>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t<p class=\"mb-0\">\r\n\t\t\t\t\t\t<!-- <b>{{'colonna_allegati_6' | traduzione }}</b> -->\r\n\t\t\t\t\t\t<b>{{'Tipo Documento' | traduzione }}</b>\r\n\t\t\t\t\t</p>\r\n\t\t\t\t\t<p>{{documentoSelezionato.tipoDocumento.descrizione}}</p>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-4 col-sm-6 col-xs-12\">\r\n\t\t\t\t\t<!-- <p class=\"mb-0\"><b>{{'colonna_allegati_7' | traduzione }}</b></p> -->\r\n\t\t\t\t\t<p class=\"mb-0\"><b>{{'Scarica' | traduzione }}</b></p>\r\n\t\t\t\t\t<button mat-flat-button color=\"link\" class=\"btn btn-link\"\r\n\t\t\t\t\t\t[disabled]=\"!isValid(documentoSelezionato.statiDocumento)\"\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t<i class=\"fas fa-download text-subtitle\"></i>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-12\">\r\n\t\t\t\t\t<!-- <p class=\"mb-0\"><b>{{'colonna_allegati_8' | traduzione }}</b></p> -->\r\n\t\t\t\t\t<p class=\"mb-0\"><b>{{'Visualizza dettaglio' | traduzione }}</b></p>\r\n\t\t\t\t\t<ngx-json-viewer *ngIf=\"dataJson\"\r\n\t\t\t\t\t\t[json]=\"dataJson\"\r\n\t\t\t\t\t\t[expanded]=\"true\"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t</ngx-json-viewer>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</mat-expansion-panel>\r\n</mat-accordion>\r\n",
                    styles: [".mat-flat-button{line-height:25px;padding:0 12px}.mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:0 3px 1px -2px transparent,0 0 0 0 transparent,0 0 0 0 transparent}.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled=true]):hover{background:#1d65da}.mat-expansion-panel-header.mat-expanded:focus{background:#1953b0}.mat-expansion-indicator:after{color:#fff!important;margin-top:-3px}.mat-expansion-panel-header{background-color:#1953b0!important;display:inline-flex;height:25px;padding:0 12px}.mat-expansion-panel-header.mat-expanded:hover{background:#1d65da!important}.mat-expansion-panel-body{padding:0 3px 16px}.mat-input-element:disabled{color:#000}"]
                },] }
    ];
    VisualizzaDettagliComponent.ctorParameters = function () { return [
        { type: TranslatePipe },
        { type: i1.HttpClient },
        { type: ConfigurationService }
    ]; };
    VisualizzaDettagliComponent.propDecorators = {
        documentoSelezionato: [{ type: i0.Input }]
    };

    var AllegatiModule = /** @class */ (function () {
        function AllegatiModule() {
        }
        return AllegatiModule;
    }());
    AllegatiModule.decorators = [
        { type: i0.NgModule, args: [{
                    declarations: [
                        AllegatiComponent,
                        VisualizzaDettagliComponent
                    ],
                    imports: [
                        common.CommonModule,
                        i1.HttpClientModule,
                        table.MatTableModule,
                        TranslateModule,
                        expansion.MatExpansionModule,
                        ngxJsonViewer.NgxJsonViewerModule
                    ],
                    exports: [AllegatiComponent],
                    providers: [],
                },] }
    ];

    var ORGANO_CORTE_DI_APPELLO = 'CA';
    var ORGANO_TAR = 'TA';
    var TRIBUNALE = 'T';
    var TipologicheService = /** @class */ (function () {
        function TipologicheService(http, configurationService, appRef) {
            var _a;
            var _this = this;
            this.http = http;
            this.configurationService = configurationService;
            this.appRef = appRef;
            this.documentiObbligatoriByTipoRichiedente = (_a = {},
                _a[(CodiceTipiRichiedente.CODICE_RICORRENTE)] = [TipiDocumento.ALTRO],
                _a[(CodiceTipiRichiedente.CODICE_EREDE_RICORRENTE)] = [TipiDocumento.DSAN_EREDI, TipiDocumento.ALTRO],
                _a[(CodiceTipiRichiedente.CODICE_PERSONA_GIURIDICA_RAPPRESENTANTE_LEGALE)] = [TipiDocumento.ATTO_COSTITUTIVO,
                    TipiDocumento.ALTRO],
                _a[(CodiceTipiRichiedente.CODICE_PROCURATORE_ANTISTATARIO)] = [TipiDocumento.ALTRO],
                _a[(CodiceTipiRichiedente.CODICE_EREDE_PROCURATORE_ANTISTATARIO)] = [TipiDocumento.DSAN_EREDI, TipiDocumento.ALTRO],
                _a[(CodiceTipiRichiedente.CODICE_TUTORE_PROCURATORE_LEGALE)] = [TipiDocumento.PROCURA,
                    TipiDocumento.PROVVEDIMENTO_DI_INCASSO_SOMME,
                    TipiDocumento.PROVVEDIMENTO_DEL_GIUDICE_TUTELARE, TipiDocumento.ALTRO],
                _a[(CodiceTipiRichiedente.CODICE_CURATORE_FALLIMENTARE)] = [TipiDocumento.ATTO_COSTITUTIVO,
                    TipiDocumento.PROVVEDIMENTO_FALLIMENTO, TipiDocumento.ALTRO],
                _a);
            console.log('[TipologicheService]');
            // console.log('[configurationService]', configurationService);
            // this.urlArgo = configurationService.servicePaths.get("ARGO_INTEGRATION_MS_API_URL") + "/v1";
            // console.log('[urlArgo - lib]', this.urlArgo);
            var lingua$ = configurationService.lingua$;
            // console.log('[lingua]', configurationService.servicePaths.get("I18N_MS_API_URL")); 
            this.urlAnagrafe = this.configurationService.servicePaths.get("ANAGRAFE_MS_API_URL") + "/api/v1";
            this.urlDeposito = configurationService.servicePaths.get("DEPOSITO_MS_API_URL") + "/v1";
            console.log('[urlDeposito - lib]', this.urlDeposito);
            //TODO
            // const url: string = this.paths.get_V1Tipologiche();
            // const url: string = this.urlArgo + '/tipologiche';
            var url = this.urlDeposito + '/tipologiche';
            this.tipologiche = lingua$.pipe(operators.switchMap(function (lingua) { return _this.http.get(url, { headers: new i1.HttpHeaders({ 'i18n_language': lingua }) }); }), operators.tap(function (_) { return appRef.tick(); }), operators.shareReplay());
            //TODO
            // this.tipologiche = this.http.get<TipologicheDTO>(url).pipe(shareReplay());
            //TODO
            // const sscription = this.tipologiche
            // 	.pipe(
            // 		pluck("tipiDocumento"))
            // 	.subscribe(
            // 		t => {
            // 			console.log('[tipologiche]', t);
            // 		},
            // 		_ => {
            // 			// this.modals.failure([
            // 			// 	"recupero.tipologiche.failure"
            // 			// ], []);
            // 		}
            // 	);
            //TODO
            // this.V1_ORGANI_GIURISDIZIONALI = this.urlArgo + '/organiGiurisdizionali?tipo={tipoorgano}';
            this.V1_ORGANI_GIURISDIZIONALI = this.urlDeposito + '/organiGiurisdizionali?tipo={tipoorgano}';
            this.V1_TRIBUNALI = this.V1_ORGANI_GIURISDIZIONALI + '&provincia={provincia}';
        }
        TipologicheService.prototype.getTipiDocumento$ = function () {
            return this.tipologiche.pipe(operators.map(function (tipogiche) { return tipogiche.tipiDocumento; }), operators.shareReplay());
        };
        TipologicheService.prototype.getTipiDomicilio$ = function () {
            return this.tipologiche.pipe(operators.map(function (tipogiche) { return tipogiche.tipiDomicilio; }), operators.shareReplay());
        };
        TipologicheService.prototype.getTipoEmittente$ = function () {
            return this.tipologiche.pipe(operators.map(function (tipogiche) { return tipogiche.tipiEmittente; }), operators.shareReplay());
        };
        TipologicheService.prototype.getRts$ = function () {
            return this.tipologiche.pipe(operators.map(function (tipogiche) { return tipogiche.rts; }), operators.shareReplay());
        };
        TipologicheService.prototype.getTipoContenzioso$ = function () {
            return rxjs.of(this.getTipoContenzioso()).pipe(operators.shareReplay());
        };
        TipologicheService.prototype.getTipiRuoloAltriSoggetti$ = function () {
            return this.tipologiche.pipe(operators.map(function (tipogiche) { return tipogiche.tipiRuoloAltriSoggetti; }), operators.shareReplay());
        };
        TipologicheService.prototype.getTipiDeposito$ = function () {
            return this.tipologiche.pipe(operators.map(function (tipogiche) { return tipogiche.tipoDeposito; }), operators.shareReplay());
        };
        TipologicheService.prototype.getTipiCatasto$ = function () {
            return this.tipologiche.pipe(operators.map(function (tipologiche) { return tipologiche.tipoCatasto; }), operators.shareReplay());
        };
        TipologicheService.prototype.filterTipiPagamentoByTipoRichiedente = function (tipiPagamento, tipoRichiedente) {
            // console.log('[tipoRichiedente]', tipoRichiedente);
            var isPG = tipoRichiedente == CodiceTipiRichiedente.CODICE_PERSONA_GIURIDICA_RAPPRESENTANTE_LEGALE ||
                tipoRichiedente == CodiceTipiRichiedente.CODICE_CURATORE_FALLIMENTARE;
            return isPG ?
                tipiPagamento :
                tipiPagamento.filter(function (tipoPagamento) { return tipoPagamento.codice != 'C'; });
        };
        TipologicheService.prototype.getTipoPagamentoByTipoRichiedente$ = function (tipoRichiedente) {
            var _this = this;
            return this.getTipiModalitaDiPagamento$().pipe(operators.map(function (tipiPagamento) { return _this.filterTipiPagamentoByTipoRichiedente(tipiPagamento, tipoRichiedente); }));
        };
        TipologicheService.prototype.getCortiAppello$ = function () {
            return;
            //TODO
            // const url: string = this.paths.get_V1Organo(ORGANO_CORTE_DI_APPELLO);
            // return this.http.get<Array<TipologicaDTO>>(url);
        };
        TipologicheService.prototype.getTar$ = function () {
            return;
            //TODO
            // const url: string = this.paths.get_V1Organo(ORGANO_TAR);
            // return this.http.get<Array<TipologicaDTO>>(url);
        };
        TipologicheService.prototype.getTribunali$ = function (siglaProvincia) {
            return this.http.get(this.urlAnagrafe + ("/tribunale/provincia/" + siglaProvincia + "/")).pipe(operators.shareReplay());
        };
        TipologicheService.prototype.get_V1Tribunale = function (tribunale, siglaProvincia) {
            var regexTipoOrgano = new RegExp('{tipoorgano}', 'gi');
            var regexProvincia = new RegExp('{provincia}', 'gi');
            return this.V1_TRIBUNALI
                .replace(regexTipoOrgano, tribunale)
                .replace(regexProvincia, siglaProvincia);
        };
        TipologicheService.prototype.getTipoContenzioso = function () {
            return [
                { codice: '1', descrizione: 'Contenziosi giustizia amministrativa e Corte dei Conti', id: '1', codiceLingua: 'it_IT' },
            ];
        };
        TipologicheService.prototype.getTipiModalitaDiPagamento$ = function () {
            return this.tipologiche.pipe(operators.pluck('tipiModalitaDiPagamento'));
        };
        TipologicheService.prototype.getTipoDescrizioneCausale$ = function () {
            return this.tipologiche.pipe(operators.map(function (tipogiche) { return tipogiche.tipoDescrizioneCausale; }), operators.shareReplay());
        };
        return TipologicheService;
    }());
    TipologicheService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TipologicheService_Factory() { return new TipologicheService(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(ConfigurationService), i0.ɵɵinject(i0.ApplicationRef)); }, token: TipologicheService, providedIn: "root" });
    TipologicheService.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    TipologicheService.ctorParameters = function () { return [
        { type: i1.HttpClient },
        { type: ConfigurationService },
        { type: i0.ApplicationRef }
    ]; };

    var DatiTribunaleComponent = /** @class */ (function () {
        function DatiTribunaleComponent(msg, tipologiche, appRef) {
            this.msg = msg;
            this.tipologiche = tipologiche;
            this.appRef = appRef;
            this.form = new forms.FormGroup({});
            this.done = new i0.EventEmitter();
        }
        DatiTribunaleComponent.prototype.ngOnDestroy = function () {
            if (this.$valuechangeTrib) {
                this.$valuechangeTrib.unsubscribe();
            }
            if (this.$changeTribunale) {
                this.$changeTribunale.unsubscribe();
            }
        };
        DatiTribunaleComponent.prototype.ngOnInit = function () {
            var _this = this;
            var _a, _b;
            var localitaProvinciaAC = new forms.FormControl({ value: (_a = this === null || this === void 0 ? void 0 : this.autoritaOrdinante) === null || _a === void 0 ? void 0 : _a.codiceProvincia, disabled: false }, [forms.Validators.required]);
            this.form.addControl("localitaProvinciaAC", localitaProvinciaAC);
            var tribunaleAC = new forms.FormControl({ value: '', disabled: false }, function (c) {
                return String(c.value || '').length > 0
                    ? {}
                    : { 'required': 'Il campo è obbligatorio.' };
            });
            this.form.addControl("tribunaleAC", tribunaleAC);
            /* const tribunaleCF = new FormControl(
                { value: "", disabled: true }
            );
            this.form.addControl("tribunaleCF", tribunaleCF); */
            //reccupero_tribunali
            this.tribunali$ = localitaProvinciaAC.valueChanges
                .pipe(operators.startWith((_b = this.autoritaOrdinante) === null || _b === void 0 ? void 0 : _b.codiceProvincia), operators.switchMap(function (value) { return _this.tipologiche.getTribunali$(value)
                .pipe(operators.withLatestFrom(rxjs.of(value))); }), 
            // tap(_ => console.log("outMergeMap", _)),
            //SE SI PROVIENE DALLE BOZZE => SI RESETTA IL TRIBUNALE
            operators.tap(function (_c) {
                var _d = __read(_c, 2), tribunali = _d[0], value = _d[1];
                var _a;
                if (value == ((_a = _this.autoritaOrdinante) === null || _a === void 0 ? void 0 : _a.codiceProvincia)) {
                    tribunaleAC.setValue(_this.autoritaOrdinante.idTribunale);
                }
                else {
                    tribunaleAC.setValue(null);
                }
            }), operators.map(function (_c) {
                var _d = __read(_c, 2), tribunali = _d[0], value = _d[1];
                return tribunali;
            }), operators.shareReplay()
            // catchError(error=> )
            );
            //Build_output_steam
            var changeTribinali$ = rxjs.defer(function () { return _this.tribunali$; });
            var streamOutput$ = rxjs.combineLatest([
                changeTribinali$,
                tribunaleAC.valueChanges
            ])
                .pipe(operators.map(function (_c) {
                var _d = __read(_c, 2), listaTribunali = _d[0], tribunaleSelected = _d[1];
                return listaTribunali.find(function (tribunale) { return tribunale.id == tribunaleSelected; });
            }), operators.map(function (tribunale) { return ComponentOutputStatus.of(_this.form.valid, tribunale); }));
            /* this.cf$ = tribunaleAC.valueChanges
                .pipe(
                    tap(_ => console.log("cf$", _)),
                    switchMap(value => this.tribunali$.pipe(
                        map(trib => trib.find(
                            tribunale => tribunale.codiceistat == value)?.codiceFiscale
                        ))
                    )
                ) */
            //OUTPUT_COMPONENT
            this.$valuechangeTrib = streamOutput$.pipe().subscribe(function (out) { return _this.done.emit(out); });
        };
        DatiTribunaleComponent.prototype.resetTribunale = function () { };
        return DatiTribunaleComponent;
    }());
    DatiTribunaleComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-dati-tribunale',
                    template: "<div class=\"row\" [formGroup]=\"form\">\r\n\t<div class=\"col-12\">\r\n\t\t<!-- <h4 class=\"h5\">{{'inserisci-dati-tribunale' | traduzione}}</h4> -->\r\n\t\t<h3 class=\"h5 mb-0\"><info-tip-label label=\"inserisci-dati-tribunale\"></info-tip-label></h3>\r\n\t</div>\r\n\t<div class=\"col-md-6\">\r\n\t\t<mat-form-field>\r\n\t\t\t<mat-label>{{'required' | traduzione}}{{'provincia' | traduzione}}</mat-label>\r\n\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"localitaProvinciaAC\">\r\n\t\t\t\t<mat-option *ngFor=\"let provincia of province | async\" [value]=\"provincia.sigla\">\r\n\t\t\t\t\t{{provincia.denominazione}}\r\n\t\t\t\t</mat-option>\r\n\t\t\t</mat-select>\r\n\t\t\t<mat-error *ngIf=\"form.touched && form.controls[ 'localitaProvinciaAC'].invalid\">\r\n\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls[ 'localitaProvinciaAC']) | traduzione}}\r\n\t\t\t</mat-error>\r\n\t\t\t<mat-hint *infoTip=\"'provincia'\"></mat-hint>\r\n\t\t</mat-form-field>\r\n\t</div>\r\n\t<div class=\"col-md-6\">\r\n\t\t<mat-form-field>\r\n\t\t\t<mat-label>{{'required' | traduzione}}{{'tribunale' | traduzione}}</mat-label>\r\n\t\t\t<mat-select formControlName=\"tribunaleAC\">\r\n\t\t\t\t<mat-option *ngFor=\"let tribunale of tribunali$ | async\" [value]=\"tribunale.id\">\r\n\t\t\t\t\t{{tribunale.nomeUfficio}}\r\n\t\t\t\t</mat-option>\r\n\t\t\t</mat-select>\r\n\t\t\t<mat-error *ngIf=\"form.controls[ 'tribunaleAC'].invalid\">\r\n\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls[ 'tribunaleAC']) | traduzione}}\r\n\t\t\t</mat-error>\r\n\t\t\t<mat-hint *infoTip=\"'tribunale'\"></mat-hint>\r\n\t\t</mat-form-field>\r\n\t</div>\r\n\t<!-- <div class=\"col-md-4\" *ngIf=\"cf$ | async\">\r\n\t\t<mat-form-field>\r\n\t\t\t<mat-label>{{'codice-fiscale' | traduzione}}</mat-label>\r\n\t\t\t<input matInput formControlName=\"tribunaleCF\" [value]=\"cf$ | async\">\r\n\t\t</mat-form-field>\r\n\t</div> -->\r\n</div>\r\n",
                    styles: [""]
                },] }
    ];
    DatiTribunaleComponent.ctorParameters = function () { return [
        { type: MessageService },
        { type: TipologicheService },
        { type: i0.ApplicationRef }
    ]; };
    DatiTribunaleComponent.propDecorators = {
        province: [{ type: i0.Input }],
        autoritaOrdinante: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var CodiceTipoPagamento = {
        CODICE_BONIFICO_SEPA: 'A',
        CODICE_BONIFICO_EXTRA_SEPA: 'B',
        CODICE_TESORERIA: 'C',
        CODICE_VAGLIA: 'D'
    };

    var ModalitaPagamentoDTO = /** @class */ (function () {
        function ModalitaPagamentoDTO() {
        }
        return ModalitaPagamentoDTO;
    }());
    function fromIdAndTipo(idModalitaPagamento, tipoModalitaPagamento) {
        var modalitaPagamento = new ModalitaPagamentoDTO();
        modalitaPagamento.idModalitaPagamento = idModalitaPagamento;
        modalitaPagamento.tipologiaPagamento = {
            codice: tipoModalitaPagamento,
            id: "",
            descrizione: "",
            codiceLingua: ""
        };
        return modalitaPagamento;
    }

    var PagamentoDTO = /** @class */ (function () {
        function PagamentoDTO() {
        }
        return PagamentoDTO;
    }());

    var BonificoDTO = /** @class */ (function () {
        function BonificoDTO() {
        }
        return BonificoDTO;
    }());

    var BonificoExtraSepaDTO = /** @class */ (function () {
        function BonificoExtraSepaDTO() {
        }
        return BonificoExtraSepaDTO;
    }());

    var TesoreriaDTO = /** @class */ (function () {
        function TesoreriaDTO() {
        }
        return TesoreriaDTO;
    }());

    var VagliaBdiDTO = /** @class */ (function () {
        function VagliaBdiDTO() {
        }
        return VagliaBdiDTO;
    }());

    function toBonificoSepa(modalitaPagamento) {
        var bonificoSepa = new BonificoDTO();
        bonificoSepa.iban = modalitaPagamento.conto;
        return bonificoSepa;
    }
    function toTesoreria(modalitaPagamento) {
        var tesoreria = new TesoreriaDTO();
        tesoreria.numeroConto = modalitaPagamento.conto;
        tesoreria.tesoreria = modalitaPagamento.tesoreria.codice;
        return tesoreria;
    }
    function toBonificoExtraSepa(modalitaPagamento) {
        console.log('[toBonificoExtraSepa]', modalitaPagamento);
        var bonificoExtraSepa = new BonificoExtraSepaDTO();
        bonificoExtraSepa.indirizzo = modalitaPagamento.indirizzo;
        bonificoExtraSepa.istitutoBancario = modalitaPagamento.denominazione;
        //TODO
        // bonificoExtraSepa.localita = modalitaPagamento.
        // bonificoExtraSepa.nazione = (modalitaPagamento.nazione || {}).codiceCatastale;
        bonificoExtraSepa.nazione = modalitaPagamento.nazione;
        bonificoExtraSepa.numeroConto = modalitaPagamento.conto + " " + modalitaPagamento.swiftBic;
        return bonificoExtraSepa;
    }
    function toVagliaBdi(modalitaPagamento) {
        var vaglia = new VagliaBdiDTO();
        vaglia.meMedesimo = true;
        vaglia.studioLegale = false;
        return vaglia;
    }

    var PagamentoComponent = /** @class */ (function () {
        function PagamentoComponent(msg) {
            this.msg = msg;
            this.nextStep = new i0.EventEmitter();
            this.salvaBozza = new i0.EventEmitter();
            this.previousStep = new i0.EventEmitter();
            this.direction = 'both-ways';
            this.isFinal = false;
            this.changesVagliaBdi$ = new rxjs.Subject();
            this.changesAttoPignoramento$ = new rxjs.Subject();
        }
        PagamentoComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.form = new forms.FormGroup({});
            var valid = true;
            if (!this.pagamento) {
                this.initPagamento();
                valid = false;
            }
            // console.log('[PagamentoComponent] onInit', this.pagamento);
            this.tipoModalitaPagamento = new forms.FormControl({ value: this.pagamento.tipoPagamento, disabled: false }, [forms.Validators.required]);
            this.form.addControl('tipoModalitaPagamento', this.tipoModalitaPagamento);
            var initalModalitaPagamento = fromIdAndTipo(this.pagamento.idModalitaPagamento, this.pagamento.tipoPagamento);
            this.modalitaPagamento = new forms.FormControl({ value: initalModalitaPagamento, disabled: false }, [forms.Validators.required]);
            this.form.addControl('modalitaPagamento', this.modalitaPagamento);
            var changesTipoModalitaPagamento$ = this.tipoModalitaPagamento.valueChanges
                .pipe(operators.shareReplay());
            this.modalitaPagamentoPerTipoSelezionato$ = changesTipoModalitaPagamento$
                .pipe(operators.tap(function (_) { return _this.modalitaPagamento.setValue(null); }), operators.tap(function (_) { return _this.resetPagamenti(); }), operators.startWith(this.pagamento.tipoPagamento), operators.switchMap(function (tipoModalitaPagamento) { return _this.modalitaPagamento$.pipe(operators.map(function (modalitaPagamentoPF) {
                var modalitaPagamentoPerTipo = modalitaPagamentoPF.filter(function (mod) { return tipoModalitaPagamento == mod.tipologiaPagamento.codice; });
                return modalitaPagamentoPerTipo;
            })); }));
            var changesTipoRimborso$ = changesTipoModalitaPagamento$.pipe(operators.map(function (tipoRimborso) {
                return ComponentOutputStatus.of(tipoRimborso != null, function (pagamento) { return pagamento.tipoPagamento = tipoRimborso; });
            }));
            var changesModalitaRimborso$ = this.modalitaPagamento.valueChanges.pipe(operators.map(function (rimborso) {
                return ComponentOutputStatus.of(true, function (_) {
                    // console.log('[PagamentoComponent] rimborso', rimborso);
                    if (rimborso != undefined && rimborso != '') {
                        _this.setRimborso(rimborso);
                    }
                });
            }));
            var pagamentoChanges$ = ComponentReducer.reducer4(changesTipoRimborso$, changesModalitaRimborso$, this.changesVagliaBdi$, 
            //TODO
            this.changesAttoPignoramento$, this.pagamentoValid(), ComponentOutputStatus.of(valid, this.pagamento))
                .pipe(operators.shareReplay());
            this.isFormValid$ = pagamentoChanges$.pipe(operators.map(function (_) { return _.status; }), operators.startWith(valid));
            pagamentoChanges$.subscribe(function (pagStatus) {
                console.log("[PagamentoComponent] status", pagStatus);
            });
        };
        PagamentoComponent.prototype.pagamentoValid = function () {
            return function (pagamento) {
                var pagamentoValid;
                if (pagamento.tipoPagamento) {
                    switch (pagamento.tipoPagamento) {
                        case (CodiceTipoPagamento.CODICE_BONIFICO_SEPA):
                            pagamentoValid = pagamento.bonifico != null;
                            break;
                        case (CodiceTipoPagamento.CODICE_BONIFICO_EXTRA_SEPA):
                            pagamentoValid = pagamento.bonificoExtraSepa != null;
                            break;
                        case (CodiceTipoPagamento.CODICE_TESORERIA):
                            pagamentoValid = pagamento.tesoreria != null;
                            break;
                        case (CodiceTipoPagamento.CODICE_VAGLIA):
                            pagamentoValid = pagamento.vagliaBDI != null;
                            break;
                        default:
                            pagamentoValid = false;
                    }
                }
                else {
                    pagamentoValid = false;
                }
                return pagamentoValid;
            };
        };
        PagamentoComponent.prototype.modalitaComparator = function (m1, m2) {
            return (m1 || {}).idModalitaPagamento == (m2 || {}).idModalitaPagamento;
        };
        PagamentoComponent.prototype.resetPagamenti = function () {
            this.changesVagliaBdi$.next(ComponentOutputStatus.of(true, function (p) { return p.vagliaBDI = null; }));
        };
        PagamentoComponent.prototype.setRimborso = function (rimborso) {
            // console.log('[setRimborso]', rimborso);
            this.resetModalitaPagamento();
            this.pagamento.idModalitaPagamento = rimborso.idModalitaPagamento;
            switch (rimborso.tipologiaPagamento.codice) {
                case (CodiceTipoPagamento.CODICE_BONIFICO_SEPA):
                    this.pagamento.bonifico = toBonificoSepa(rimborso);
                    break;
                case (CodiceTipoPagamento.CODICE_BONIFICO_EXTRA_SEPA):
                    this.pagamento.bonificoExtraSepa = toBonificoExtraSepa(rimborso);
                    break;
                case (CodiceTipoPagamento.CODICE_TESORERIA):
                    this.pagamento.tesoreria = toTesoreria(rimborso);
                    break;
                case (CodiceTipoPagamento.CODICE_VAGLIA):
                    this.pagamento.vagliaBDI = toVagliaBdi(rimborso);
                    break;
                default:
            }
        };
        PagamentoComponent.prototype.resetModalitaPagamento = function () {
            this.pagamento.idModalitaPagamento = null;
            this.pagamento.vagliaBDI = null;
            this.pagamento.tesoreria = null;
            this.pagamento.bonificoExtraSepa = null;
            this.pagamento.bonifico = null;
        };
        PagamentoComponent.prototype.hasSelectedModalitaDiPagamentoAnd = function (v) {
            return this.hasSelectedModalitaDiPagamento() && v;
        };
        PagamentoComponent.prototype.hasSelectedModalitaDiPagamento = function () {
            return this.modalitaPagamento.value;
        };
        //TODO
        PagamentoComponent.prototype.isAutoritaGiudiziaria = function () {
            return this.hasSelectedModalitaDiPagamentoAnd(CodiceTipoPagamento.CODICE_BONIFICO_SEPA == this.tipoModalitaPagamento.value);
        };
        PagamentoComponent.prototype.forward = function (_) {
            this.nextStep.emit(this.pagamento);
        };
        PagamentoComponent.prototype.onSalvaBozza = function (_) {
            this.salvaBozza.emit(this.pagamento);
        };
        PagamentoComponent.prototype.backward = function (_) {
            this.previousStep.emit(this.pagamento);
        };
        PagamentoComponent.prototype.complete = function (_) { };
        PagamentoComponent.prototype.initPagamento = function () {
            this.pagamento = new PagamentoDTO();
        };
        //TODO
        PagamentoComponent.prototype.attoPignoramentoReady = function (attoPignoramnetoStatus) {
            // console.log('[attoPignoramentoReady]', attoPignoramnetoStatus);
            this.changesAttoPignoramento$.next(attoPignoramnetoStatus.mapValue(function (pign) { return function (at) { return at.tribunale = pign; }; }));
        };
        return PagamentoComponent;
    }());
    PagamentoComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-pagamento',
                    template: "<mat-expansion-panel class=\"panel\" [expanded]=\"true\">\r\n\t<mat-expansion-panel-header [collapsedHeight]=\"'48px'\" [expandedHeight]=\"'48px'\" class=\"custom-header\">\r\n\t\t<mat-panel-title>\r\n\t\t\t<h3>{{'modalita-pagamento' | traduzione}}</h3>\r\n\t\t</mat-panel-title>\r\n\t</mat-expansion-panel-header>\r\n\t<form [formGroup]=\"form\">\r\n\t\t<div class=\"collapse-body mt-2\">\r\n\t\t\t<div class=\"row\">\r\n\t\t\t\t<div class=\"col-md-6\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{'required'| traduzione}}{{'tipologia-pagamento' | traduzione }}</mat-label>\r\n\t\t\t\t\t\t<mat-select formControlName=\"tipoModalitaPagamento\">\r\n\t\t\t\t\t\t\t<mat-option *ngFor=\"let pagamento of tipologiePagamento$ | async\"\r\n\t\t\t\t\t\t\t\t[value]=\"pagamento.codice\">\r\n\t\t\t\t\t\t\t\t{{pagamento.descrizione}}\r\n\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"form.controls['tipoModalitaPagamento'].invalid\">\r\n\t\t\t\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['tipoModalitaPagamento']) | traduzione}}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-6\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{'required'| traduzione}}{{'modalita-pagamento' | traduzione }}</mat-label>\r\n\t\t\t\t\t\t<mat-select formControlName=\"modalitaPagamento\" [compareWith]=\"modalitaComparator\">\r\n\t\t\t\t\t\t\t<mat-option *ngFor=\"let modalita of modalitaPagamentoPerTipoSelezionato$ | async\"\r\n\t\t\t\t\t\t\t\t[value]=\"modalita\">\r\n\t\t\t\t\t\t\t\t{{modalita.conto || modalita.tipologiaPagamento.descrizione}}\r\n\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"form.controls['modalitaPagamento'].invalid\">\r\n\t\t\t\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['modalitaPagamento']) | traduzione}}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<lib-dati-tribunale *ngIf=\"isAutoritaGiudiziaria()\"\r\n\t\t\t\t(attoPignoramentoReady)=\"attoPignoramentoReady($event)\"\r\n\t\t\t\t[attoPignoramento]=\"attoPignoramento\"\r\n\t\t\t\t[province]=\"province\"\r\n\t\t\t>\r\n\t\t\t</lib-dati-tribunale>\r\n\t\t</div>\r\n\t</form>\r\n</mat-expansion-panel>\r\n<!-- TODO -->\r\n<!-- <div class=\"mt-4\"></div>\r\n<lp-stepper-navigator-rx\r\n\t\t[form]=\"form\"\r\n\t\t[direction]=\"direction\"\r\n\t\t[isFinal]=\"isFinal\"\r\n\t\t[isContainerValid]=\"isFormValid$\"\r\n\t\t(goForward)=\"forward($event)\"\r\n\t\t(goBackward)=\"backward($event)\"\r\n\t\t(complete)=\"complete($event)\"\r\n\t\t(salvaBozza)=\"onSalvaBozza($event)\"\r\n>\r\n</lp-stepper-navigator-rx> -->\r\n",
                    styles: [".mat-card{border-radius:0!important;border-top:5px solid #0a2644}.divider{background-color:#737373;height:1px;width:100%}.mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fff!important}.mat-select-value{max-width:100%;width:100%!important}"]
                },] }
    ];
    PagamentoComponent.ctorParameters = function () { return [
        { type: MessageService }
    ]; };
    PagamentoComponent.propDecorators = {
        pagamento: [{ type: i0.Input }],
        tipologiePagamento$: [{ type: i0.Input }],
        modalitaPagamento$: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        attoPignoramento: [{ type: i0.Input }],
        nextStep: [{ type: i0.Output }],
        salvaBozza: [{ type: i0.Output }],
        previousStep: [{ type: i0.Output }]
    };

    var DatiDepositoDTO = /** @class */ (function () {
        function DatiDepositoDTO() {
        }
        return DatiDepositoDTO;
    }());

    var DatiDepositoGiudiziarioDTO = /** @class */ (function (_super) {
        __extends(DatiDepositoGiudiziarioDTO, _super);
        function DatiDepositoGiudiziarioDTO() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        return DatiDepositoGiudiziarioDTO;
    }(DatiDepositoDTO));

    var DatiDeposito = /** @class */ (function () {
        function DatiDeposito(msg, _ref, delegheService) {
            this.msg = msg;
            this._ref = _ref;
            this.delegheService = delegheService;
            //TODO
            // DatiDepositoDTO
            // DatiDepositoGiudiziarioDTO
            // DatiDepositoNoEsproprioDTO
            this.datiDeposito = {};
            this.visibilityMask = {};
            this.nextStep = new i0.EventEmitter();
            this.previousStep = new i0.EventEmitter();
            this.salvaBozza = new i0.EventEmitter();
            this.direction = "both-ways";
            this.isFinal = false;
        }
        DatiDeposito.prototype.isImportoFormatoValidoOLD = function (valoreImporto) {
            return /^(?:[0-9]+|(?:[0-9]{1,3}\.?)+)(?:,[0-9]{1,2})?€?$/
                .test(valoreImporto);
            42;
        };
        DatiDeposito.prototype.currencyToNumber = function (s) {
            return Number(s.replace(/\./g, '').replace(',', '.') || undefined);
        };
        DatiDeposito.prototype.isImportoFormatoValido = function (valoreImporto) {
            return /^(?:0|[1-9](?:[0-9]{0,2}\.[0-9]{3}(?:\.[0-9]{3})*|[0-9]*))(?:,[0-9]{2,2})€?$/
                .test(valoreImporto);
        };
        DatiDeposito.prototype.ngAfterViewInit = function () {
            this._ref.detectChanges();
        };
        DatiDeposito.prototype.ngOnInit = function () {
            var _this = this;
            this.form = new forms.FormGroup({
                'causale': new forms.FormControl({ value: '', disabled: !this.visibilityMask.causale }, function (c) {
                    if (!_this.visibilityMask.causale)
                        return {};
                    return String(c.value || '').length > 0
                        ? {}
                        : { 'required': 'Il campo è obbligatorio.' };
                }),
                'importo': new forms.FormControl({ value: '', disabled: !this.visibilityMask.importo }, function (c) {
                    if (!_this.visibilityMask.importo)
                        return {};
                    // return this.isImportoFormatoValido(c.value)
                    return _this.isImportoFormatoValido(c.value)
                        ? {}
                        : { 'pattern': 'Formato non valido' };
                }),
                'rts-inoltro': new forms.FormControl({ value: '', disabled: !this.visibilityMask.codiceRtsInoltro }, function (c) {
                    if (!_this.visibilityMask.codiceRtsInoltro)
                        return {};
                    return String(c.value || '').length > 0
                        ? {}
                        : { 'required': 'Il campo è obbligatorio.' };
                }),
                'nota': new forms.FormControl({ value: '', disabled: !this.visibilityMask.nota }, function (c) {
                    if (!_this.visibilityMask.nota)
                        return {};
                    // return String(c.value).trim().length > 0
                    // 	? {}
                    // 	: { 'required': 'Il campo è obbligatorio.' };
                })
            });
            var valid = true;
            if (!this.datiDeposito) {
                this.initDatiDeposito();
                valid = false;
            }
            this.listaRts$.subscribe(function (rts) {
                console.log('[listaRts$]', rts);
                if (rts != null) {
                    _this.rts$ = _this.delegheService.getListRtsCodiceRegione(rts);
                    _this.rts$.subscribe(function (_rts) {
                        _this._rts = _rts;
                        //console.log("_rts" + JSON.stringify(this._rts))
                    });
                }
            });
            this.form.controls['causale'].setValue(this.datiDeposito.causale);
            this.form.controls['importo'].setValue(this.datiDeposito.importo);
            this.form.controls['rts-inoltro'].setValue(this.datiDeposito.codiceRtsInoltro);
            this.form.controls['nota'].setValue(this.datiDeposito.nota);
            var changes$ = this.form.valueChanges.pipe(operators.map(function (_) {
                var _a;
                var dati = new DatiDepositoGiudiziarioDTO();
                dati.causale = _this.form.controls['causale'].value;
                if (_this.form.controls['importo'].value != undefined) {
                    dati.importo = _this.currencyToNumber(_this.form.controls['importo'].value);
                }
                dati.codiceRtsInoltro = _this.form.controls['rts-inoltro'].value;
                if ((dati === null || dati === void 0 ? void 0 : dati.codiceRtsInoltro) && (_this === null || _this === void 0 ? void 0 : _this._rts)) {
                    dati.denominazioneRTS = (_a = _this._rts.find(function (x) { return x.codiceFiscale == (dati === null || dati === void 0 ? void 0 : dati.codiceRtsInoltro); })) === null || _a === void 0 ? void 0 : _a.denominazioneRTS;
                }
                dati.nota = _this.form.controls['nota'].value;
                _this.datiDeposito = dati;
                // console.log("[dati]", this.form);
                return ComponentOutputStatus.of(_this.form.valid, _this.datiDeposito);
            }), operators.startWith(ComponentOutputStatus.of(valid, this.datiDeposito)));
            this.subscription = changes$.subscribe(function (newDati) { return console.log('[DatiDepositoComponent] datiSpecificiDeposito', newDati); });
        };
        DatiDeposito.prototype.forward = function ($event) {
            this.nextStep.emit(this.datiDeposito);
        };
        DatiDeposito.prototype.backward = function ($event) {
            this.previousStep.emit(this.datiDeposito);
        };
        DatiDeposito.prototype.onSalvaBozza = function ($event) {
            this.salvaBozza.emit(this.datiDeposito);
        };
        DatiDeposito.prototype.complete = function ($event) { };
        DatiDeposito.prototype.isFormValid = function () {
            return this.form.valid;
        };
        DatiDeposito.prototype.initDatiDeposito = function () {
            //TODO
            //this.datiDeposito = new DatiDepositoDTO() as T;
            this.datiDeposito = new DatiDepositoGiudiziarioDTO();
        };
        DatiDeposito.prototype.ngOnDestroy = function () {
            if (this.subscription) {
                this.subscription.unsubscribe();
            }
        };
        return DatiDeposito;
    }());
    DatiDeposito.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-dati-deposito',
                    template: "<div class=\"mt-3 mb-5\">\r\n\t\t<mat-expansion-panel class=\"panel\" [expanded]=\"true\">\r\n\t\t\t<mat-expansion-panel-header [collapsedHeight]=\"'48px'\" [expandedHeight]=\"'48px'\" class=\"custom-header\">\r\n\t\t\t\t<mat-panel-title>\r\n\t\t\t\t\t<h3 class=\"h5 mb-0\"><info-tip-label label=\"dati-deposito\"></info-tip-label></h3>\r\n\t\t\t\t</mat-panel-title>\r\n\t\t\t</mat-expansion-panel-header>\r\n\t\t\t<form [formGroup]=\"form\">\r\n\t\t\t\t<div class=\"collapse-body mt-2\">\r\n\t\t\t\t\t<div class=\"row\" *ngIf=\"visibilityMask.causale\">\r\n\t\t\t\t\t\t<div class=\"col-md-12\">\r\n\t\t\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t\t\t<input matInput\r\n\t\t\t\t\t\t\t\t\tplaceholder=\"{{ 'required' | traduzione }}{{ 'dati-deposito-causale' | traduzione }}\"\r\n\t\t\t\t\t\t\t\t\tformControlName=\"causale\"\r\n\t\t\t\t\t\t\t\t\tmaxlength=\"127\"\r\n\t\t\t\t\t\t\t\t\t#testoCausale>\r\n\t\t\t\t\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls['causale'].invalid\">\r\n\t\t\t\t\t\t\t\t\t{{ msg.produceMessage('required', form.controls['causale']) | traduzione }}\r\n\t\t\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t\t\t<mat-hint *infoTip=\"'dati-deposito-causale'\"></mat-hint>\r\n\t\t\t\t\t\t\t\t<mat-hint align=\"end\">{{testoCausale.value.length}} / 127</mat-hint>\r\n\t\t\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t<div class=\"col-md-4\" *ngIf=\"visibilityMask.importo\">\r\n\t\t\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t\t\t<input matInput\r\n\t\t\t\t\t\t\t\t\tplaceholder=\"{{'required' | traduzione }}{{'inserire-importo' | traduzione}}\"\r\n\t\t\t\t\t\t\t\t\tformControlName=\"importo\">\r\n\t\t\t\t\t\t\t\t\t<span matPrefix>&euro;</span>\r\n\t\t\t\t\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls['importo'].invalid\">\r\n\t\t\t\t\t\t\t\t\t{{ msg.produceMessage('required', form.controls['importo']) | traduzione }}\r\n\t\t\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t\t\t<mat-hint *infoTip=\"'inserire-importo'\"></mat-hint>\r\n\t\t\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"col-md-4\" *ngIf=\"visibilityMask.codiceRtsInoltro\">\r\n\t\t\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{ 'dati-deposito-rts-inoltro' | traduzione }}</mat-label>\r\n\t\t\t\t\t\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"rts-inoltro\">\r\n\t\t\t\t\t\t\t\t\t<mat-option\r\n\t\t\t\t\t\t\t\t\t\t*ngFor=\"let rts of rts$ | async\"\r\n\t\t\t\t\t\t\t\t\t\t[value]=\"rts.codiceFiscale\"\r\n\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t{{ rts.denominazioneRTS }}\r\n\t\t\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t\t\t\t<!-- <mat-option\r\n\t\t\t\t\t\t\t\t\t\t*ngFor=\"let rts of listaRts\"\r\n\t\t\t\t\t\t\t\t\t\t[value]=\"rts.codiceFiscale\"\r\n\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t{{ rts.codiceFiscale }}\r\n\t\t\t\t\t\t\t\t</mat-option> -->\r\n\t\t\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t\t\t<mat-error *ngIf=\"form.controls['rts-inoltro'].invalid\">\r\n\t\t\t\t\t\t\t\t\t{{ msg.produceMessage('required', form.controls['rts-inoltro']) | traduzione }}\r\n\t\t\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t\t\t<mat-hint *infoTip=\"'dati-deposito-rts-inoltro'\"></mat-hint>\r\n\t\t\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"row\" *ngIf=\"visibilityMask.nota\">\r\n\t\t\t\t\t\t<div class=\"col-md-12\">\r\n\t\t\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t\t\t<textarea \r\n\t\t\t\t\t\t\t\t    matInput\r\n\t\t\t\t\t\t\t\t\tplaceholder=\"{{ 'dati-deposito-nota' | traduzione }}\"\r\n\t\t\t\t\t\t\t\t\tformControlName=\"nota\"\r\n\t\t\t\t\t\t\t\t\tmaxlength=\"511\"\r\n\t\t\t\t\t\t\t\t\t#testo>\r\n\t\t\t\t\t\t\t\t</textarea>\r\n\t\t\t\t\t\t\t\t<mat-error *ngIf=\"form.touched && form.controls['nota'].invalid\">\r\n\t\t\t\t\t\t\t\t\t{{ msg.produceMessage('required', form.controls['nota']) | traduzione }}\r\n\t\t\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t\t\t<mat-hint *infoTip=\"'dati-deposito-nota'\"></mat-hint>\r\n\t\t\t\t\t\t\t\t<mat-hint align=\"end\">{{testo.value.length}} / 511</mat-hint>\r\n\t\t\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</form>\r\n\t\t</mat-expansion-panel>\r\n\t<lib-stepper-navigator\r\n\t\t[form]=\"form\"\r\n\t\t[direction]=\"direction\"\r\n\t\t[isFinal]=\"isFinal\"\r\n\t\t[isContainerValid]=\"isFormValid()\"\r\n\t\t(goForward)=\"forward($event)\"\r\n\t\t(goBackward)=\"backward($event)\"\r\n\t\t(salvaBozza)=\"onSalvaBozza($event)\"\r\n\t\t(complete)=\"complete($event)\"\r\n\t>\r\n\t</lib-stepper-navigator>\r\n</div>\r\n",
                    styles: [".mat-card{border-radius:0!important;border-top:5px solid #0a2644}.divider{background-color:#737373;height:1px;width:100%}.mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fff!important}.mat-select-value{max-width:100%;width:100%!important}"]
                },] }
    ];
    DatiDeposito.ctorParameters = function () { return [
        { type: MessageService },
        { type: i0.ChangeDetectorRef },
        { type: DelegheService }
    ]; };
    DatiDeposito.propDecorators = {
        datiDeposito: [{ type: i0.Input }],
        visibilityMask: [{ type: i0.Input }],
        listaRts$: [{ type: i0.Input }],
        nextStep: [{ type: i0.Output }],
        previousStep: [{ type: i0.Output }],
        salvaBozza: [{ type: i0.Output }]
    };

    var TabellaDocumentiComponent = /** @class */ (function () {
        function TabellaDocumentiComponent() {
            this.indiceSelezionato = new i0.EventEmitter();
        }
        TabellaDocumentiComponent.prototype.ngOnInit = function () { };
        return TabellaDocumentiComponent;
    }());
    TabellaDocumentiComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-tabella-documenti',
                    template: "<mat-accordion displayMode=\"flat\" multi class=\"mat-table\">\r\n\t<section matSort class=\"mat-elevation-z2 mat-header-row\">\r\n\t\t<div class=\"mat-header-cell\" mat-sort-header=\"nrDocumento\">{{'nr-Documento' | traduzione}}</div>\r\n\t\t<div class=\"mat-header-cell\" mat-sort-header=\"tipoDocumento\"> {{'tipo-documento' | traduzione}}</div>\r\n\t\t<div class=\"mat-header-cell\" mat-sort-header=\"dataDocumento\">{{'data-documento' | traduzione}}</div>\r\n\t\t<div class=\"mat-header-cell\" mat-sort-header=\"fileName\">{{'file-name' | traduzione}}</div>\r\n\t\t<div class=\"mat-header-cell\" mat-sort-header=\"elimina\"></div>\r\n\t</section>\r\n\r\n\t<mat-expansion-panel *ngFor=\"let file of files$ | async; let i=index\">\r\n\t\t<mat-expansion-panel-header class=\"mat-row\">\r\n\t\t\t<div class=\"mat-cell\">{{file.numeroDocumento}}</div>\r\n\t\t\t<div class=\"mat-cell\">{{file.tipoDocumento.descrizione}}</div>\r\n\t\t\t<div class=\"mat-cell\">{{file.dataDocumento | date:'dd/MM/yyyy'}}</div>\r\n\t\t\t<div class=\"mat-cell\">{{file.file.name}}</div>\r\n\t\t\t<div class=\"mat-cell\">\r\n\t\t\t\t<button mat-flat-button\r\n\t\t\t\t\t\t\t\t(click)=\"indiceSelezionato.emit(i)\"\r\n\t\t\t\t\t\t\t\t[attr.aria-label]=\"'bt-elimina-documento' | traduzione\"\r\n\t\t\t\t\t\t\t\ttitle=\"{{'bt-elimina-documento' | traduzione}}\">\r\n\t\t\t\t\t<span class=\"fas fa-trash-alt icon-color-primary font-weight-bold\" aria-hidden=\"true\"></span>\r\n\t\t\t\t\t<p class=\"sr-only\">{{'bt-elimina-documento' | traduzione}}</p>\r\n\t\t\t\t</button>\r\n\t\t\t</div>\r\n\t\t</mat-expansion-panel-header>\r\n\r\n\t\t<div class=\"mt-2\">\r\n\t\t\t<span class=\"font-weight-bold\">\r\n\t\t\t\t{{'obbligatori' | traduzione}}:\r\n\t\t\t</span>\r\n\t\t\t<mat-checkbox [checked]=\"file.tipoDocumento.codice != 'ALTRO'\" [disabled]=\"true\"\r\n\t\t\t\t\t\t\t\t\t\tname=\"obbligatorio\">\r\n\t\t\t</mat-checkbox>\r\n\t\t</div>\r\n\r\n\t\t<div>\r\n\t\t\t<span class=\"font-weight-bold\">\r\n\t\t\t\t{{'tipologia-emittente' | traduzione}}:\r\n\t\t\t</span>\r\n\t\t\t<span class=\"ml-2\">{{file.codiceTipoEmittente || '' | titlecase }}</span>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"mt-2\">\r\n\t\t\t<span class=\"font-weight-bold\">\r\n\t\t\t\t{{'organo-emittente' | traduzione}}:\r\n\t\t\t</span>\r\n\t\t\t<span class=\"ml-2\">{{file.soggettoEmittente}}</span>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"mt-2\">\r\n\t\t\t<span class=\"font-weight-bold\">\r\n\t\t\t\t{{'nota' | traduzione}}:\r\n\t\t\t</span>\r\n\t\t\t<span class=\"ml-2\">{{file.nota}}</span>\r\n\t\t</div>\r\n\r\n\t</mat-expansion-panel>\r\n</mat-accordion>\r\n",
                    encapsulation: i0.ViewEncapsulation.None,
                    styles: ["lib-tabella-documenti .mat-accordion .mat-header-row{background-color:#0a2644!important;border-bottom:none;padding-left:1.5rem;padding-right:2rem}lib-tabella-documenti .mat-expansion-panel-header.mat-row{border-bottom:none;margin-top:2px}lib-tabella-documenti .mat-table{display:block}lib-tabella-documenti .mat-header-row{min-height:56px}lib-tabella-documenti .mat-row{min-height:48px}lib-tabella-documenti .mat-header-row,lib-tabella-documenti .mat-row{align-items:center;border-bottom-style:solid;border-bottom-width:1px;box-sizing:border-box;display:flex;padding:0 24px}lib-tabella-documenti .mat-header-row:after,lib-tabella-documenti .mat-row:after{content:\"\";display:inline-block;min-height:inherit}lib-tabella-documenti .mat-cell,lib-tabella-documenti .mat-header-cell{flex:1;overflow:hidden;word-wrap:break-word}lib-tabella-documenti .mat-row{min-height:120px}lib-tabella-documenti mat-checkbox label{margin-bottom:.25rem!important}"]
                },] }
    ];
    TabellaDocumentiComponent.ctorParameters = function () { return []; };
    TabellaDocumentiComponent.propDecorators = {
        files$: [{ type: i0.Input }],
        indiceSelezionato: [{ type: i0.Output }]
    };

    var AltriSoggettiGiudiziarioDTO = /** @class */ (function () {
        function AltriSoggettiGiudiziarioDTO() {
        }
        return AltriSoggettiGiudiziarioDTO;
    }());

    var AltriSoggettiNoEsproprioDTO = /** @class */ (function () {
        function AltriSoggettiNoEsproprioDTO() {
        }
        return AltriSoggettiNoEsproprioDTO;
    }());

    var AltriSoggettiComponent = /** @class */ (function () {
        function AltriSoggettiComponent(delegheService, modals, msg) {
            this.delegheService = delegheService;
            this.modals = modals;
            this.msg = msg;
            this.nextStep = new i0.EventEmitter();
            this.salvaBozza = new i0.EventEmitter();
            this.previousStep = new i0.EventEmitter();
            //TODO
            // changesPF$ = new Subject<
            // 	ComponentOutputStatus<(value: AltriSoggettiGiudiziarioDTO) => void>
            // >();
            //TODO
            // changesPF2$ = new Subject<
            // 	ComponentOutputStatus<(value: AltriSoggettiNoEsproprioDTO) => void>
            // >();
            this.changesRicercaPG$ = new rxjs.Subject();
            this.changesRicercaPF$ = new rxjs.Subject();
            this.changesPersonaGiuridica$ = new rxjs.Subject();
            this.changesPersonaFisica$ = new rxjs.Subject();
            this.direction = "both-ways";
            this.isFinal = false;
            this.showComponentRicercaPF = false;
            this.showComponentRicercaPG = false;
            this.isSearching = false;
        }
        AltriSoggettiComponent.prototype.ngOnInit = function () {
            var _this = this;
            //console.log('[AltriSoggettiGiudiziarioDTO - AltriSoggettiNoEsproprioDTO]', this.altriSoggetti);
            this.form = new forms.FormGroup({});
            var valid = true;
            this.nspg = "nsRapprLegpg";
            if (!this.altriSoggetti) {
                this.initAltriSoggetti();
                valid = false;
            }
            else {
                if (this.formControlSoggetto) {
                    this.personaGiuridica = this.altriSoggetti.personaGiuridica;
                    if (this.personaGiuridica) {
                        this.showComponentRicercaPG = true;
                    }
                    this.personaFisica = this.altriSoggetti.personaFisica;
                    if (this.personaFisica) {
                        this.showComponentRicercaPF = true;
                    }
                    if (this.altriSoggetti.codiceTipoAltroSoggetto === 'SOGGETTO_DA_IDENTIFICARE') {
                        this.altriSoggetti.codiceRegione = '';
                    }
                }
                else {
                    if (!(this.altriSoggetti.soggettoNonIdentificato)) {
                        this.personaFisica = this.mapperPersonaFisica(this.altriSoggetti);
                    }
                }
            }
            this.tipoSoggetto = new forms.FormControl({ value: this.altriSoggetti.codiceTipoAltroSoggetto, disabled: false }, [forms.Validators.required]);
            this.form.addControl('tipoSoggetto', this.tipoSoggetto);
            this.soggettoNonIdentificato = new forms.FormControl({ value: this.altriSoggetti.soggettoNonIdentificato, disabled: false });
            this.form.addControl('soggettoNonIdentificato', this.soggettoNonIdentificato);
            this.namespaceInfoPf = this.namespace + "infoPF";
            if (!this.formControlSoggetto) {
                if (this.altriSoggetti.soggettoNonIdentificato) {
                    this.showComponentRicercaPF = false;
                }
                else {
                    this.showComponentRicercaPF = true;
                }
            }
            this.checkSoggetto$ = this.soggettoNonIdentificato.valueChanges.pipe(
            // tap(checkSoggetto => console.log('[checkSoggetto$] - soggettoNonIdentificato:', checkSoggetto)),
            operators.tap(function (checkSoggetto) {
                if (!checkSoggetto) {
                    _this.showComponentRicercaPF = true;
                    _this.isSearching = false;
                }
                else {
                    _this.resetSoggetti();
                    _this.showComponentRicercaPF = false;
                    _this.isSearching = false;
                }
            }), operators.shareReplay());
            var changesCheckSoggetto$ = this.checkSoggetto$.pipe(
            // tap(checkSoggetto => console.log('[changesCheckSoggetto$] - soggettoNonIdentificato:', checkSoggetto)),
            operators.map(function (checkSoggetto) {
                _this.changesPersonaFisica$.next(ComponentOutputStatus.of(true, function (personaFisica) { return function (sogg) { }; }));
                return ComponentOutputStatus.of(true, function (soggetto) { return (soggetto.soggettoNonIdentificato = checkSoggetto); });
            }));
            this.tipoSoggetto$ = this.tipoSoggetto.valueChanges.pipe(
            // tap(tipo => console.log('[tipoSoggetto$] - codiceSoggetto:', tipo)),
            operators.tap(function (tipo) {
                if (tipo != 'SOGGETTO_DA_IDENTIFICARE') {
                    _this.setSoggetto(tipo);
                    _this.isSearching = false;
                }
                else {
                    _this.resetSoggetti();
                    _this.showComponentRicercaPF = false;
                    _this.showComponentRicercaPG = false;
                    _this.isSearching = false;
                    _this.resetValidation();
                }
            }), operators.shareReplay());
            var tipoSoggettoChanges$ = this.tipoSoggetto$.pipe(
            // tap(tipoSoggettoChanges => console.log('[tipoSoggettoChanges$] - codiceTipoAltroSoggetto:', tipoSoggettoChanges)),
            operators.map(function (tipo) {
                return ComponentOutputStatus.of(_this.tipoSoggetto.valid, function (sog) { return (sog.codiceTipoAltroSoggetto = tipo); });
            }));
            var altriSoggetti$ = ComponentReducer.reducer4(tipoSoggettoChanges$, changesCheckSoggetto$, 
            // TODO
            // this.changesRicercaPF$,
            this.changesPersonaFisica$, 
            // this.changesRicercaPG$,
            // TODO
            this.changesPersonaGiuridica$, function (soggetto) {
                var isValid;
                // console.log('[codiceTipoAltroSoggetto]', (<AltriSoggettiNoEsproprioDTO>soggetto).codiceTipoAltroSoggetto);
                // console.log('[soggettoNonIdentificato]', (<AltriSoggettiGiudiziarioDTO>soggetto).soggettoNonIdentificato);
                if (_this.formControlSoggetto) {
                    switch (soggetto.codiceTipoAltroSoggetto) {
                        case 'PRESUNTO_BENEFICIARIO':
                            // isValid = (<AltriSoggettiNoEsproprioDTO>soggetto).idPersona != null && this.tipoSoggetto.value;
                            isValid = soggetto.idPersona != null && _this.tipoSoggetto.value;
                            break;
                        case 'AUTORITA_ORDINANTE':
                            // isValid = (<AltriSoggettiNoEsproprioDTO>soggetto).idPersona != null && this.tipoSoggetto.value;
                            isValid = soggetto.idPersona != null && _this.tipoSoggetto.value;
                            break;
                        default:
                            isValid = true;
                    }
                }
                else {
                    soggetto.soggettoNonIdentificato ?
                        // isValid = true : isValid = (<AltriSoggettiGiudiziarioDTO>soggetto).idPersona != null
                        isValid = true : isValid = soggetto.idPersona != null;
                }
                // console.log('[idPersona]', (<AltriSoggettiNoEsproprioDTO>soggetto).idPersona)
                // console.log('[idPersona]', (<AltriSoggettiGiudiziarioDTO>soggetto).idPersona)
                return isValid;
            }, ComponentOutputStatus.of(valid, this.altriSoggetti));
            altriSoggetti$.subscribe(function (soggetto) {
                // console.log('[AltriSoggettiComponent] altriSoggetti', soggetto);
                _this.altriSoggetti = soggetto.output;
                _this.altriSoggetti.idPersona = soggetto.output.idPersona;
                _this.isFormValid = soggetto.status;
            });
        };
        AltriSoggettiComponent.prototype.resetValidation = function () {
            this.changesPersonaFisica$.next(ComponentOutputStatus.of(true, function (personaFisica) { return function (sogg) { }; }));
            this.changesPersonaGiuridica$.next(ComponentOutputStatus.of(true, function (personaGiuridica) { return function (sogg) { }; }));
        };
        AltriSoggettiComponent.prototype.initAltriSoggetti = function () {
            if (this.formControlSoggetto) {
                this.altriSoggetti = new AltriSoggettiNoEsproprioDTO();
            }
            else {
                this.altriSoggetti = new AltriSoggettiGiudiziarioDTO();
            }
        };
        // TODO
        AltriSoggettiComponent.prototype.viewPersona = function () {
            if (this.formControlSoggetto) {
                return !this.tipoSoggetto.value ||
                    this.tipoSoggetto.value === "SOGGETTO_DA_IDENTIFICARE";
            }
            else {
                var showComponent_1;
                this.checkSoggetto$.subscribe(function (_) {
                    // console.log('[checkSoggetto]', _);
                    showComponent_1 = _.valueOf();
                });
                return showComponent_1;
            }
        };
        AltriSoggettiComponent.prototype.setSoggetto = function (tipo) {
            // console.log('[setDelega]', delega);
            // console.log('[isPersonaFisica]', this.isPersonaFisica(this.rappresentanza.codiceDelega))
            // console.log('[isPersonaGiuridica]', this.isPersonaGiuridica(this.rappresentanza.codiceDelega))
            // console.log('[codiceDelega]', this.rappresentanza.codiceDelega);
            this.resetSoggetti();
            if (this.isPersonaFisica(tipo)) {
                this.showComponentRicercaPF = true;
                this.showComponentRicercaPG = false;
            }
            if (this.isPersonaGiuridica(tipo)) {
                this.showComponentRicercaPF = false;
                this.showComponentRicercaPG = true;
            }
        };
        AltriSoggettiComponent.prototype.resetSoggetti = function () {
            if (!this.altriSoggetti) {
                this.initAltriSoggetti();
            }
            if (this.formControlSoggetto) {
                this.altriSoggetti.personaGiuridica = null;
                this.personaGiuridica = null;
                this.altriSoggetti.codiceRegione = '';
            }
            else {
                this.altriSoggetti.soggettoNonIdentificato = this.soggettoNonIdentificato.value;
                this.altriSoggetti.cognome = null;
                this.altriSoggetti.nome = null;
                this.altriSoggetti.codFiscale = null;
                this.altriSoggetti.comuneNascita = null;
                this.altriSoggetti.provinciaNascita = null;
                this.altriSoggetti.dataNascita = null;
            }
            this.altriSoggetti.idPersona = null;
            this.altriSoggetti.personaFisica = null;
            this.personaFisica = null;
        };
        AltriSoggettiComponent.prototype.isPersonaFisica = function (codiceSoggetto) {
            return (codiceSoggetto === "PRESUNTO_BENEFICIARIO");
        };
        AltriSoggettiComponent.prototype.isPersonaGiuridica = function (codiceSoggetto) {
            return (codiceSoggetto === 'AUTORITA_ORDINANTE');
        };
        AltriSoggettiComponent.prototype.ricercaPFReady = function (ricercaPFStatus) {
            var _this = this;
            // console.log('[ricercaPFReady]', ricercaPFStatus);
            this.changesRicercaPF$.next(ricercaPFStatus.mapValue(function (infoPF) { return function (sogg) {
                _this.getPersonaFisica(infoPF.id);
                if (!_this.formControlSoggetto) {
                    sogg.soggettoNonIdentificato = false;
                }
                sogg.idPersona = infoPF.id;
            }; }));
        };
        AltriSoggettiComponent.prototype.personaFisicaReady = function (personaFisicaStatus) {
            var _this = this;
            //console.log('[personaFisicaReady]', personaFisicaStatus);
            this.changesPersonaFisica$.next(personaFisicaStatus.mapValue(function (personaFisica) { return function (sogg) {
                var _a, _b, _c, _d, _e, _f;
                var pf = new PersonaFisicaDTO();
                pf.infoAnagrafiche = personaFisica.infoAnagrafiche;
                pf.infoNascita = personaFisica.infoNascita;
                pf.id = personaFisica.id;
                if (personaFisica.id) {
                    sogg.idPersona = personaFisica.id;
                }
                sogg.personaFisica = pf;
                if (!_this.formControlSoggetto) {
                    _this.soggettoNonIdentificato.value ?
                        sogg.soggettoNonIdentificato = _this.soggettoNonIdentificato.value :
                        sogg.soggettoNonIdentificato = false;
                    sogg.cognome = (_a = personaFisica === null || personaFisica === void 0 ? void 0 : personaFisica.infoAnagrafiche) === null || _a === void 0 ? void 0 : _a.cognome;
                    sogg.nome = (_b = personaFisica === null || personaFisica === void 0 ? void 0 : personaFisica.infoAnagrafiche) === null || _b === void 0 ? void 0 : _b.nome;
                    sogg.codFiscale = (_c = personaFisica === null || personaFisica === void 0 ? void 0 : personaFisica.infoAnagrafiche) === null || _c === void 0 ? void 0 : _c.codFiscale;
                    sogg.comuneNascita = (_d = personaFisica === null || personaFisica === void 0 ? void 0 : personaFisica.infoNascita) === null || _d === void 0 ? void 0 : _d.comuneNascita;
                    sogg.provinciaNascita = (_e = personaFisica === null || personaFisica === void 0 ? void 0 : personaFisica.infoNascita) === null || _e === void 0 ? void 0 : _e.provinciaNascita;
                    //TODO
                    // (<AltriSoggettiGiudiziarioDTO>sogg).dataNascita = new Date(moment(personaFisica?.infoNascita?.dataNascita, "DD/MM/YYYY").toDate());
                    // (<AltriSoggettiGiudiziarioDTO>sogg).dataNascita = moment(personaFisica?.infoNascita?.dataNascita, "DD/MM/YYYY").toDate();
                    sogg.dataNascita = (_f = personaFisica === null || personaFisica === void 0 ? void 0 : personaFisica.infoNascita) === null || _f === void 0 ? void 0 : _f.dataNascita;
                }
            }; }));
        };
        AltriSoggettiComponent.prototype.ricercaPGReady = function (ricercaPGStatus) {
            var _this = this;
            // console.log('[ricercaPGReady]', ricercaPGStatus);
            this.changesRicercaPG$.next(ricercaPGStatus.mapValue(function (infoPG) { return function (sogg) {
                _this.getPersonaGiuridica(infoPG.datiPersonaGiuridica.id);
                sogg.idPersona = infoPG.datiPersonaGiuridica.id;
            }; }));
        };
        AltriSoggettiComponent.prototype.personaGiuridicaReady = function (personaGiuridicaStatus) {
            // console.log("[personaGiuridicaReady]", personaGiuridicaStatus);
            this.changesPersonaGiuridica$.next(personaGiuridicaStatus.mapValue(function (personaGiuridica) { return function (sogg) {
                var _a, _b, _c;
                var pg = new PersonaGiuridicaDTO();
                pg.codiceFiscale = personaGiuridica.codiceFiscale;
                pg.ragioneSociale = personaGiuridica.ragioneSociale;
                pg.partitaIVA = personaGiuridica.partitaIVA;
                pg.idPersonaGiuridica = personaGiuridica.idPersonaGiuridica;
                sogg.idPersona = personaGiuridica.idPersonaGiuridica;
                sogg.personaGiuridica = pg;
                if (personaGiuridica.sedi != undefined) {
                    sogg.codiceRegione = (_c = (_b = (_a = personaGiuridica === null || personaGiuridica === void 0 ? void 0 : personaGiuridica.sedi[0]) === null || _a === void 0 ? void 0 : _a.indirizzo) === null || _b === void 0 ? void 0 : _b.regione) === null || _c === void 0 ? void 0 : _c.sigla;
                }
            }; }));
        };
        AltriSoggettiComponent.prototype.getPersonaFisica = function (id) {
            var _this = this;
            this.showComponentRicercaPF = false;
            //debugger
            this.personaFisica$ = this.delegheService.getPersona(id)
                .pipe(operators.shareReplay());
            this.pfSubscription = this.personaFisica$.pipe(
            // pluck("datiPersonaFisica")
            ).subscribe(
            // (pf: DatiPersonaFisica) => {
            function (pf) {
                var _a, _b;
                //console.log('[pf]', pf);
                _this.personaFisica = _this.mapperPersonaFisica(pf.datiPersonaFisica);
                // this.personaFisica = pf;
                _this.altriSoggetti.codiceRegione = (_b = (_a = pf === null || pf === void 0 ? void 0 : pf.residenza) === null || _a === void 0 ? void 0 : _a.regione) === null || _b === void 0 ? void 0 : _b.sigla;
                //(<AltriSoggettiGiudiziarioDTO>this.altriSoggetti).personaFisica = this.personaFisica;
                _this.altriSoggetti.idPersona = id;
                // this.showComponentRicercaPF = true;
                if (_this.personaFisica) {
                    setTimeout(function () { return _this.showComponentRicercaPF = true; }, 0);
                }
                _this.isSearching = true;
            }, function (_) {
                _this.modals.failure([
                    "recupero.datipersonafisica.failure"
                ], []);
            });
        };
        AltriSoggettiComponent.prototype.getPersonaGiuridica = function (id) {
            var _this = this;
            this.personaGiuridica$ = this.delegheService.getDatiSocieta(id)
                .pipe(operators.shareReplay());
            this.pgSubscription = this.personaGiuridica$.pipe(
            // pluck("datiPersonaGiuridica")
            ).subscribe(function (pg) {
                // console.log('[pg]', pg);
                _this.mapperPersonaGiuridica(pg);
                _this.personaGiuridica = pg;
                // (<AltriSoggettiNoEsproprioDTO>this.altriSoggetti).idPersona = id;
                _this.altriSoggetti.idPersona = id;
                _this.showComponentRicercaPG = false;
                _this.isSearching = true;
                if (pg.sedi != undefined) {
                    var sede = pg.sedi.filter(function (sedeLegale) { return sedeLegale.tipoSede.codice === "LEGALE"; });
                    _this.altriSoggetti.codiceRegione = sede[0].indirizzo.regione.sigla;
                }
            }, function (_) {
                _this.modals.failure([
                    "recupero.datipersonagiuridica.failure"
                ], []);
            });
        };
        AltriSoggettiComponent.prototype.mapperPersonaFisica = function (datiPersona) {
            var _this = this;
            //console.log('[mapperPersonaFisica]- datiPersona', datiPersona);
            var personaFisica = new PersonaFisicaDTO();
            var infoAnagrafiche = new InfoAnagrafichePFDTO();
            infoAnagrafiche.codFiscale = datiPersona.codFiscale;
            infoAnagrafiche.cognome = datiPersona.cognome;
            infoAnagrafiche.nome = datiPersona.nome;
            personaFisica.infoAnagrafiche = infoAnagrafiche;
            personaFisica.id = datiPersona.idPersona;
            var infoNascita = new InfoNascitaPFDTO();
            infoNascita.comuneNascita = datiPersona.comuneNascita;
            infoNascita.provinciaNascita = datiPersona.provinciaNascita;
            infoNascita.dataNascita = datiPersona.dataNascita;
            personaFisica.infoNascita = infoNascita;
            this.altriSoggetti.personaFisica = personaFisica;
            //console.log('[mapperPersonaFisica]- personaFisica', personaFisica);
            //console.log('[mapperPersonaFisica]- altriSoggetti', this.altriSoggetti.personaFisica);
            setTimeout(function () { return _this.showComponentRicercaPF = true; }, 0);
            return personaFisica;
        };
        AltriSoggettiComponent.prototype.mapperPersonaGiuridica = function (datiPersona) {
            // console.log('[mapperPersonaGiuridica]', datiPersona);
            if (!this.altriSoggetti) {
                this.initAltriSoggetti();
            }
            var personaGiuridica = new PersonaGiuridicaDTO();
            personaGiuridica.codiceFiscale = datiPersona.datiPersonaGiuridica.codiceFiscale;
            personaGiuridica.ragioneSociale = datiPersona.datiPersonaGiuridica.ragioneSociale;
            personaGiuridica.partitaIVA = datiPersona.datiPersonaGiuridica.partitaIVA;
            this.altriSoggetti.personaGiuridica = personaGiuridica;
        };
        AltriSoggettiComponent.prototype.enableSearch = function () {
            var _this = this;
            this.resetSoggetti();
            // console.log('[enableSearch] - codiceSoggetto:', (<AltriSoggettiNoEsproprioDTO>this.altriSoggetti).codiceTipoAltroSoggetto);
            // console.log('[enableSearch] - soggettoNonIdentificato:', (<AltriSoggettiGiudiziarioDTO>this.altriSoggetti).soggettoNonIdentificato);
            if (this.altriSoggetti.codiceTipoAltroSoggetto) {
                this.tipoSoggetto.setValue(this.altriSoggetti.codiceTipoAltroSoggetto);
                if (this.isPersonaFisica(this.altriSoggetti.codiceTipoAltroSoggetto)) {
                    setTimeout(function () { return _this.showComponentRicercaPF = true; }, 0);
                }
                if (this.isPersonaGiuridica(this.altriSoggetti.codiceTipoAltroSoggetto)) {
                    setTimeout(function () { return _this.showComponentRicercaPG = true; }, 0);
                }
            }
            else {
                this.soggettoNonIdentificato.setValue(this.altriSoggetti.soggettoNonIdentificato);
                setTimeout(function () { return _this.showComponentRicercaPF = true; }, 0);
            }
        };
        AltriSoggettiComponent.prototype.forward = function (_) {
            this.nextStep.emit(this.altriSoggetti);
        };
        AltriSoggettiComponent.prototype.backward = function ($event) {
            this.previousStep.emit(this.altriSoggetti);
        };
        AltriSoggettiComponent.prototype.complete = function ($event) { };
        AltriSoggettiComponent.prototype.onSalvaBozza = function ($event) {
            this.salvaBozza.emit(this.altriSoggetti);
        };
        AltriSoggettiComponent.prototype.ngOnDestroy = function () {
            if (this.altriSoggettiChangedSub) {
                this.altriSoggettiChangedSub.unsubscribe();
            }
        };
        return AltriSoggettiComponent;
    }());
    AltriSoggettiComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-altri-soggetti',
                    template: "<!-- <p>altri-soggetti works!</p> -->\r\n<div class=\"mt-3 mb-5\">\r\n\t<mat-expansion-panel class=\"panel\" [expanded]=\"true\">\r\n\t\t<mat-expansion-panel-header [collapsedHeight]=\"'48px'\" [expandedHeight]=\"'48px'\" class=\"custom-header\">\r\n\t\t\t<mat-panel-title>\r\n\t\t\t\t<!-- <h3>{{'altri-soggetti' | traduzione}}</h3> -->\r\n\r\n\t\t\t\t<div *ngIf=\"!formControlSoggetto\">\r\n\t\t\t\t\t<h3 class=\"h5 mb-0\"><info-tip-label label=\"altri-soggetti\"></info-tip-label></h3>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div *ngIf=\"formControlSoggetto\">\r\n\t\t\t\t\t<h3 class=\"h5 mb-0\"><info-tip-label label=\"altri-soggetti-interessati\"></info-tip-label></h3>\r\n\t\t\t\t</div>\r\n\t\t\t</mat-panel-title>\r\n\t\t</mat-expansion-panel-header>\r\n\t\t<form [formGroup]=\"form\">\r\n\t\t\t<div class=\"collapse-body mt-2\">\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<div *ngIf=\"formControlSoggetto\" class=\"col-md-4\">\r\n\t\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t\t<mat-label>{{'required'| traduzione}}{{'soggetto' | traduzione }}</mat-label>\r\n\t\t\t\t\t\t\t<mat-select placeholder=\"{{'seleziona' | traduzione}}\" formControlName=\"tipoSoggetto\">\r\n\t\t\t\t\t\t\t\t<mat-option *ngFor=\"let soggetto of tipologieSoggetto$ | async\"\r\n\t\t\t\t\t\t\t\t\t[value]=\"soggetto.codice\">\r\n\t\t\t\t\t\t\t\t\t{{soggetto.descrizione}}\r\n\t\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t\t<mat-error *ngIf=\"form.controls['tipoSoggetto'].invalid\">\r\n\t\t\t\t\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['tipoSoggetto']) | traduzione}}\r\n\t\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t\t<mat-hint *infoTip=\"'soggetto'\"></mat-hint>\r\n\t\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div *ngIf=\"!formControlSoggetto\" class=\"col-md-4\">\r\n\t\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t\t<mat-checkbox\r\n\t\t\t\t\t\t\t\tformControlName=\"soggettoNonIdentificato\">\r\n\t\t\t\t\t\t\t\t{{'soggetto-non-identificato' | traduzione }}\r\n\t\t\t\t\t\t\t</mat-checkbox>\r\n\t\t\t\t\t\t\t<mat-hint *infoTip=\"'soggetto-non-identificato'\"></mat-hint>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"col-md-8\">\r\n\t\t\t\t\t\t<button\r\n\t\t\t\t\t\t\t*ngIf=\"isSearching && !showComponentRicercaPF && !showComponentRicercaPG\"\r\n\t\t\t\t\t\t\tmat-flat-button color=\"primary\"\r\n\t\t\t\t\t\t\tclass=\"text-uppercase mb-2\"\r\n\t\t\t\t\t\t\t(click)=\"enableSearch()\"\r\n\t\t\t\t\t\t\t> {{'ricerca' | traduzione}}\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<!-- TODO -->\r\n\t\t\t\t<!-- <lib-info-pf *ngIf=\"!viewPersona() \" -->\r\n\t\t\t\t<!-- <lib-info-pf *ngIf=\"!(checkSoggetto$ | async)\" -->\r\n\t\t\t\t<!-- <lib-info-pf *ngIf=\"!viewPersona()\"\r\n\t\t\t\t\t[cfDifferentFrom]=\"cfDifferentFrom\"\r\n\t\t\t\t\t[namespace]=\"namespaceInfoPf\"\r\n\t\t\t\t\t(done)=\"infoPfReady2($event)\"\r\n\t\t\t\t\t[infopf]=\"altriSoggetti\"\r\n\t\t\t\t\t[readOnly]=\"false\"\r\n\t\t\t\t>\r\n\t\t\t\t</lib-info-pf> -->\r\n\t\t\t\t<div class=\"mt-4\"></div>\r\n\t\t\t\t<!-- <lib-ricerca-pf\r\n\t\t\t\t\t*ngIf=\"showComponentRicercaPF\"\r\n\t\t\t\t\t[namespace]=\"namespaceInfoPf\"\r\n\t\t\t\t\t[readOnly]=\"false\"\r\n\t\t\t\t\t(done)=\"ricercaPFReady($event)\"\r\n\t\t\t\t>\r\n\t\t\t\t</lib-ricerca-pf>\r\n\t\t\t\t<lib-info-pf\r\n\t\t\t\t\t*ngIf=\"personaFisica\"\r\n\t\t\t\t\t[cfDifferentFrom]=\"cfDifferentFrom\"\r\n\t\t\t\t\t[namespace]=\"namespaceInfoPf\"\r\n\t\t\t\t\t[infopf]=\"altriSoggetti?.personaFisica?.infoAnagrafiche\"\r\n\t\t\t\t\t[readOnly]=\"true\"\r\n\t\t\t\t\t[validatorFormControl]=\"false\"\r\n\t\t\t\t>\r\n\t\t\t\t</lib-info-pf> -->\r\n\t\t\t\t<lib-persona-fisica\r\n\t\t\t\t\t*ngIf=\"showComponentRicercaPF\"\r\n\t\t\t\t\t(done)=\"personaFisicaReady($event)\"\r\n\t\t\t\t\t[nazioni]=\"nazioni\"\r\n\t\t\t\t\t[province]=\"province\"\r\n\t\t\t\t\t[namespace]=\"namespaceInfoPf\"\r\n\t\t\t\t\t[infoPersonaFisica]=\"altriSoggetti?.personaFisica\"\r\n\t\t\t\t\t[idDelega]=\"null\"\r\n\t\t\t\t\t[validatorFormControl]=\"true\"\r\n\t\t\t\t>\r\n\t\t\t\t</lib-persona-fisica>\r\n\t\t\t\t<!-- <lib-ricerca-pg\r\n\t\t\t\t\t*ngIf=\"showComponentRicercaPG\"\r\n\t\t\t\t\t[namespace]=\"nspg\"\r\n\t\t\t\t\t[readOnly]=\"false\"\r\n\t\t\t\t\t(done)=\"ricercaPGReady($event)\"\r\n\t\t\t\t>\r\n\t\t\t\t</lib-ricerca-pg>\r\n\t\t\t\t<lib-persona-giuridica\r\n\t\t\t\t\t*ngIf=\"personaGiuridica\"\r\n\t\t\t\t\t[namespace]=\"nspg\"\r\n\t\t\t\t\t[datisocieta]=\"altriSoggetti?.personaGiuridica\"\r\n\t\t\t\t\t[idDelega]=\"altriSoggetti.idPersona\"\r\n\t\t\t\t\t[validatorFormControl]=\"false\"\r\n\t\t\t\t>\r\n\t\t\t\t</lib-persona-giuridica> -->\r\n\t\t\t\t<!-- TODO -->\r\n\t\t\t\t<lib-persona-giuridica\r\n\t\t\t\t\t*ngIf=\"showComponentRicercaPG\"\r\n\t\t\t\t\t(done)=\"personaGiuridicaReady($event)\"\r\n\t\t\t\t\t[namespace]=\"nspg\"\r\n\t\t\t\t\t[datisocieta]=\"altriSoggetti?.personaGiuridica\"\r\n\t\t\t\t\t[idDelega]=\"null\"\r\n\t\t\t\t\t[validatorFormControl]=\"false\"\r\n\t\t\t\t\t[gestioneSedi]=\"false\"\r\n\t\t\t\t\t[couldBeDittaIndividuale]=\"false\"\r\n\t\t\t\t>\r\n\t\t\t\t</lib-persona-giuridica>\r\n\t\t\t</div>\r\n\t\t</form>\r\n\t</mat-expansion-panel>\r\n\t<div class=\"mt-4\"></div>\r\n\t<lib-stepper-navigator\r\n\t\t[form]=\"form\"\r\n\t\t[direction]=\"direction\"\r\n\t\t[isFinal]=\"isFinal\"\r\n\t\t[isContainerValid]=\"isFormValid\"\r\n\t\t(goForward)=\"forward($event)\"\r\n\t\t(goBackward)=\"backward($event)\"\r\n\t\t(salvaBozza)=\"onSalvaBozza($event)\"\r\n\t\t(complete)=\"complete($event)\"\r\n\t>\r\n\t</lib-stepper-navigator>\r\n</div>\r\n",
                    styles: [""]
                },] }
    ];
    AltriSoggettiComponent.ctorParameters = function () { return [
        { type: DelegheService },
        { type: Modals },
        { type: MessageService }
    ]; };
    AltriSoggettiComponent.propDecorators = {
        altriSoggetti: [{ type: i0.Input }],
        tipologieSoggetto$: [{ type: i0.Input }],
        cfDifferentFrom: [{ type: i0.Input }],
        namespace: [{ type: i0.Input }],
        formControlSoggetto: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        nazioni: [{ type: i0.Input }],
        nextStep: [{ type: i0.Output }],
        salvaBozza: [{ type: i0.Output }],
        previousStep: [{ type: i0.Output }]
    };

    var StepperNavigatorComponent = /** @class */ (function () {
        function StepperNavigatorComponent() {
            this.complete = new i0.EventEmitter();
            this.goBackward = new i0.EventEmitter();
            this.goForward = new i0.EventEmitter();
            this.salvaBozza = new i0.EventEmitter();
        }
        StepperNavigatorComponent.prototype.ngOnInit = function () {
            // console.log("isContainerValid", this.isContainerValid);
        };
        StepperNavigatorComponent.prototype.canGoForWard = function () {
            var forward = false;
            if (this.direction === 'only-forward' || this.direction === 'both-ways') {
                forward = true;
                ;
            }
            return forward;
        };
        StepperNavigatorComponent.prototype.canGoBackWard = function () {
            var backWard = false;
            if (this.direction === 'only-backward' || this.direction === 'both-ways') {
                backWard = true;
                ;
            }
            return backWard;
        };
        StepperNavigatorComponent.prototype.canComplete = function () {
            var complete = false;
            if (this.isFinal && this.isContainerValid) {
                complete = true;
            }
            return complete;
        };
        StepperNavigatorComponent.prototype.onComplete = function () {
            this.complete.emit();
        };
        StepperNavigatorComponent.prototype.onForward = function () {
            this.goForward.emit();
        };
        StepperNavigatorComponent.prototype.onBackward = function () {
            this.goBackward.emit();
        };
        StepperNavigatorComponent.prototype.onSalvaBozza = function () {
            this.salvaBozza.emit();
        };
        return StepperNavigatorComponent;
    }());
    StepperNavigatorComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-stepper-navigator',
                    template: "<div class=\"row mt-4\">\r\n<div class=\"col-6\">\r\n\t<button *ngIf=\"canGoBackWard()\" mat-stroked-button (click)=\"onBackward()\" color=\"primary\">\r\n\t\t{{'indietro' | traduzione }}\r\n\t</button>\r\n</div>\r\n<div class=\"col-6 text-right\">\r\n\t<button class=\"ml-2\" *ngIf=\"isContainerValid\" mat-raised-button (click)=\"onSalvaBozza()\" color=\"primary\">\r\n\t\t{{ 'salva-bozza' | traduzione }}\r\n\t</button>\r\n\t<button class=\"ml-2\" *ngIf=\"canGoForWard() && isContainerValid\" mat-raised-button (click)=\"onForward()\"\r\n\t\tcolor=\"primary\">\r\n\t\t{{'avanti' | traduzione }}\r\n\t</button>\r\n\t<button class=\"ml-2\" *ngIf=\"canComplete()\" mat-raised-button color=\"primary\" (click)=\"onComplete()\">\r\n\t\t{{'invia' | traduzione }}\r\n\t</button>\r\n\t</div>\r\n</div>",
                    styles: [""]
                },] }
    ];
    StepperNavigatorComponent.ctorParameters = function () { return []; };
    StepperNavigatorComponent.propDecorators = {
        direction: [{ type: i0.Input }],
        isFinal: [{ type: i0.Input }],
        form: [{ type: i0.Input }],
        isContainerValid: [{ type: i0.Input }],
        complete: [{ type: i0.Output }],
        goBackward: [{ type: i0.Output }],
        goForward: [{ type: i0.Output }],
        salvaBozza: [{ type: i0.Output }]
    };

    var RicercaPfComponent = /** @class */ (function () {
        function RicercaPfComponent(delegheService) {
            this.delegheService = delegheService;
            this.done = new i0.EventEmitter();
            this.resetForm = new rxjs.Subject();
            this.codiceFiscale = "";
            this.cognome = "";
            this.nome = "";
            this.offset = 0;
            this.pageNumber = 0;
            this.pageSize = 5;
            this.paged = true;
            this.viewIntPf = false;
            this.viewResultTable = false;
            this.resLenPf = 0;
            this.validationFormPF = false;
            this.displayedColumns = [
                'codiceFiscale',
                'nome',
                'cognome',
                'seleziona'
            ];
        }
        RicercaPfComponent.prototype.ngOnInit = function () {
        };
        RicercaPfComponent.prototype.infoPfReady = function (inFoPfStatus) {
            // console.log('[infoPfReady]', inFoPfStatus);
            this.validationFormPF = inFoPfStatus.status;
            if (inFoPfStatus.output.codFiscale != undefined) {
                this.codiceFiscale = inFoPfStatus === null || inFoPfStatus === void 0 ? void 0 : inFoPfStatus.output.codFiscale.toUpperCase().trim();
            }
            if (inFoPfStatus.output.cognome != undefined) {
                this.cognome = inFoPfStatus === null || inFoPfStatus === void 0 ? void 0 : inFoPfStatus.output.cognome.toUpperCase().trim();
            }
            if (inFoPfStatus.output.nome != undefined) {
                this.nome = inFoPfStatus === null || inFoPfStatus === void 0 ? void 0 : inFoPfStatus.output.nome.toUpperCase().trim();
            }
        };
        RicercaPfComponent.prototype.getListaPf = function () {
            var _this = this;
            this.listaPf = '';
            this.dataSource = new table.MatTableDataSource(this.listaPf);
            var pf = new PersonaFisicaBaseDTO();
            pf.codiceFiscale = this.codiceFiscale;
            pf.cognome = this.cognome;
            pf.nome = this.nome;
            // this.delegheService.getListaPfPaged(this.pageSize, this.pageNumber, pf);
            if (pf.codiceFiscale != "" && pf.cognome == "" && pf.nome == "") {
                console.log("[Ricerca Anagrafe Tributaria]");
                this.delegheService.getPersonaFiscaleCodiceFiscale(pf.codiceFiscale).pipe(
                // pluck("datiPersonaFisica")
                )
                    .subscribe(function (res) {
                    console.log('[pg]', res);
                    _this.listaPf = res;
                    console.log('[listaPf]', _this.listaPf);
                    if (_this.listaPf) {
                        _this.showNoResults = false;
                        _this.viewIntPf = true;
                        _this.viewResultTable = true;
                        // this.dataSource = new MatTableDataSource(this.listaPg['content']);
                        _this.dataSource = new table.MatTableDataSource([_this.listaPf]);
                        // this.dataSource = new MatTableDataSource([res]);
                        // this.dataSource.paginator = this.paginator;
                        // this.resLenPg = res['content'].length;
                        _this.resLenPf = 1;
                    }
                    else {
                        _this.showNoResults = true;
                        _this.viewIntPf = false;
                        _this.viewResultTable = false;
                        _this.resLenPf = 0;
                    }
                }, function (err) {
                    // console.log('[errore - getListaPfPaged]', err);
                    _this.showNoResults = true;
                    _this.viewIntPf = false;
                    _this.viewResultTable = false;
                    _this.resLenPf = 0;
                });
            }
            else {
                console.log("[Ricerca Sul Portale]");
                this.personaFisica$ = this.delegheService.getListaPfPaged(this.pageSize, this.pageNumber, pf)
                    .pipe(operators.shareReplay());
                this.pfSubscription = this.personaFisica$.pipe(
                // pluck("datiPersonaFisica")
                ).subscribe(function (res) {
                    console.log('[pf]', res);
                    _this.listaPf = res;
                    if (_this.listaPf) {
                        _this.showNoResults = false;
                        _this.viewIntPf = true;
                        _this.viewResultTable = true;
                        _this.dataSource = new table.MatTableDataSource(_this.listaPf['content']);
                        _this.dataSource.paginator = _this.paginator;
                        _this.resLenPf = res['content'].length;
                    }
                    else {
                        _this.viewIntPf = false;
                        _this.viewResultTable = false;
                        _this.showNoResults = true;
                        _this.resLenPf = 0;
                    }
                }, function (err) {
                    // console.log('[errore - getListaPfPaged]', err);
                    _this.viewIntPf = false;
                    _this.viewResultTable = false;
                    _this.showNoResults = true;
                    _this.resLenPf = 0;
                });
            }
        };
        RicercaPfComponent.prototype.pulisciForm = function () {
            this.resetForm.next(true);
            this.viewResultTable = false;
            this.dataSource = new table.MatTableDataSource(null);
            this.viewIntPf = false;
            // console.log('[pulisciForm - resetForm]', this.resetForm);
        };
        RicercaPfComponent.prototype.areSearchParameterValid = function () {
            return (this.validationFormPF &&
                (this.codiceFiscale != "" ||
                    this.cognome != "" ||
                    this.nome != ""));
        };
        RicercaPfComponent.prototype.personaFisicaSelected = function (row) {
            // console.log('[PersonaFisica]', row);
            this.done.emit(ComponentOutputStatus.of(true, row.datiPersonaFisica));
        };
        return RicercaPfComponent;
    }());
    RicercaPfComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-ricerca-pf',
                    template: "<!-- <p>ricerca-pf works!</p> -->\r\n<!-- <div class=\"row\">\r\n\t<div class=\"col-12\">\r\n\t\t<p class=\"h6\"> {{'ricerca-nel-portale-dag' | traduzione}} </p>\r\n\t</div>\r\n</div> -->\r\n<div class=\"row\">\r\n\t<div class=\"col-12\">\r\n\t\t<p class=\"mt-3\">{{'spiegazione' | traduzione }}</p>\r\n\t</div>\r\n</div>\r\n<!-- <lib-info-pf\r\n\t[namespace]=\"namespace\"\r\n\t(done)=\"infoPfReady($event)\"\r\n\t[readOnly]=\"false\"\r\n\t[resetForm]=\"resetForm\"\r\n\t[validatorFormControl]=\"false\"\r\n>\r\n</lib-info-pf> -->\r\n<lib-pf\r\n\t(done)=\"infoPfReady($event)\"\r\n\t[resetForm]=\"resetForm\"\r\n>\r\n</lib-pf>\r\n<div class=\"col-12\">\r\n\t<div class=\"float-right mt-4\">\r\n\t\t<button \r\n\t\t\t(click)=\"pulisciForm();\"\r\n\t\t\tmat-stroked-button color=\"primary\"\r\n\t\t\tclass=\"mr-3\"\r\n\t\t\t[disabled]=\"!areSearchParameterValid()\"\r\n\t\t> {{'pulisci' | traduzione | uppercase}}\r\n\t\t</button>\r\n\t\t<button\r\n\t\t\t(click)=\"getListaPf();\"\r\n\t\t\tmat-flat-button color=\"primary\"\r\n\t\t\t[disabled]=\"!areSearchParameterValid()\"\r\n\t\t> {{'ricerca' | traduzione | uppercase}}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\n<br>\r\n<br>\r\n<div class=\"col-12\">\r\n\t<ng-container>\r\n\t\t<div class=\"col-md-12 mt-3\">\r\n\t\t\t<div *ngIf=\"showNoResults\">\r\n\t\t\t\t<p>\r\n\t\t\t\t{{'nessuno-risultato' | traduzione}}\r\n\t\t\t\t</p>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"viewIntPf\" class=\"mb-5\">\r\n\t\t\t<div class=\"col-md-12 mt-3\">\r\n\t\t\t\t<mat-chip-list>\r\n\t\t\t\t\t<p class=\"mr-3 mb-0\">{{'totale-risultati' | traduzione }} : {{resLenPf}}</p>\r\n\t\t\t\t</mat-chip-list>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div [hidden]=\"!viewResultTable\">\r\n\t\t\t<mat-table\r\n\t\t\t\tmat-table\r\n\t\t\t\t[dataSource]=\"dataSource\"\r\n\t\t\t\tclass=\"mat-elevation-z8 mt-3 border\">\r\n\r\n\t\t\t\t<!-- Codice Fiscale Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"codiceFiscale\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'codice-fiscale' | traduzione }} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\"> {{element.datiPersonaFisica.codiceFiscale}} </mat-cell>\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!-- Nome Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"nome\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'nome' | traduzione }} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\"> {{element.datiPersonaFisica.nome}} </mat-cell>\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!-- Cognome Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"cognome\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'cognome' | traduzione }} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\"> {{element.datiPersonaFisica.cognome}} </mat-cell>\r\n\t\t\t\t</ng-container>\r\n\t\t\t\t\r\n\t\t\t\t<!-- Selezione Column -->\r\n\t\t\t\t<ng-container  matColumnDef=\"seleziona\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'seleziona' | traduzione}} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell  *matCellDef=\"let element\"> \r\n\t\t\t\t\t\t<button (click)=\"personaFisicaSelected(element)\" mat-flat-button color=\"primary\">\r\n\t\t\t\t\t\t\t{{'seleziona' | traduzione}}\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t</mat-cell>\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\r\n\t\t\t\t<mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\r\n\r\n\t\t\t</mat-table>\r\n\t\t\t<mat-paginator [pageSizeOptions]=\"[5, 10, 20]\" showFirstLastButtons></mat-paginator>\r\n\t\t</div>\r\n\t</ng-container>\r\n</div>",
                    styles: [".mat-paginator{background:#fff}.mat-paginator,.mat-paginator-page-size .mat-select-trigger{color:rgba(0,0,0,.54)}.mat-paginator-decrement,.mat-paginator-increment{border-right:2px solid rgba(0,0,0,.54);border-top:2px solid rgba(0,0,0,.54)}.mat-paginator-first,.mat-paginator-last{border-top:2px solid rgba(0,0,0,.54)}.mat-icon-button[disabled] .mat-paginator-decrement,.mat-icon-button[disabled] .mat-paginator-first,.mat-icon-button[disabled] .mat-paginator-increment,.mat-icon-button[disabled] .mat-paginator-last{border-color:rgba(0,0,0,.38)}"]
                },] }
    ];
    RicercaPfComponent.ctorParameters = function () { return [
        { type: DelegheService }
    ]; };
    RicercaPfComponent.propDecorators = {
        namespace: [{ type: i0.Input }],
        readOnly: [{ type: i0.Input }],
        done: [{ type: i0.Output }],
        paginator: [{ type: i0.ViewChild, args: [paginator.MatPaginator, { static: true },] }]
    };

    var RicercaPgComponent = /** @class */ (function () {
        function RicercaPgComponent(delegheService) {
            this.delegheService = delegheService;
            this.showRagioneSociale = true;
            this.showPartitaIVA = true;
            // @Output()
            // personaGiuridicaSelezionata: EventEmitter<PersonaGiuridica> = new EventEmitter<PersonaGiuridica>();
            this.done = new i0.EventEmitter();
            this.resetForm = new rxjs.Subject();
            this.codiceFiscale = "";
            this.ragioneSociale = "";
            this.partitaIVA = "";
            this.offset = 0;
            this.pageNumber = 0;
            this.pageSize = 5;
            this.paged = true;
            this.viewIntPg = false;
            this.viewResultTable = false;
            this.resLenPg = 0;
            this.validationFormPG = false;
            this.displayedColumns = [
                'ragioneSociale',
                'pIva',
                'codFiscale',
                'seleziona'
            ];
        }
        RicercaPgComponent.prototype.ngOnInit = function () {
        };
        RicercaPgComponent.prototype.personaGiuridicaReady = function (pgStatus) {
            var _a, _b;
            // console.log("[personaGiuridicaReady]", pgStatus);
            this.validationFormPG = pgStatus.status;
            if (pgStatus.output.codiceFiscale != undefined) {
                this.codiceFiscale = pgStatus === null || pgStatus === void 0 ? void 0 : pgStatus.output.codiceFiscale.toUpperCase().trim();
            }
            if (((_a = pgStatus.output) === null || _a === void 0 ? void 0 : _a.ragioneSociale) != undefined) {
                this.ragioneSociale = pgStatus === null || pgStatus === void 0 ? void 0 : pgStatus.output.ragioneSociale.toUpperCase().trim();
            }
            if (((_b = pgStatus.output) === null || _b === void 0 ? void 0 : _b.partitaIVA) != undefined) {
                this.partitaIVA = pgStatus === null || pgStatus === void 0 ? void 0 : pgStatus.output.partitaIVA.toUpperCase().trim();
            }
            //TODO
            // this.changesPersonaGiuridica$.next(
            // 	pgStatus.mapValue(pg => (rap: LegaleRappresentanteDTO) => rap.datiSocieta = pg)
            // );
        };
        RicercaPgComponent.prototype.getListaPg = function () {
            var _this = this;
            this.listaPg = '';
            this.dataSource = new table.MatTableDataSource(this.listaPg);
            var pg = new PersonaGiuridicaDTO();
            pg.codiceFiscale = this.codiceFiscale;
            pg.ragioneSociale = this.ragioneSociale;
            pg.partitaIVA = this.partitaIVA;
            if (pg.codiceFiscale != "" && pg.partitaIVA == "" && pg.ragioneSociale == "") {
                console.log("[Ricerca Anagrafe Tributaria]");
                this.delegheService.getPersonaGiuridicaCodiceFiscale(pg.codiceFiscale).pipe(
                // pluck("datiPersonaGiuridica")
                )
                    .subscribe(function (res) {
                    console.log('[pg]', res);
                    _this.listaPg = res;
                    // console.log('[listaPg]', this.listaPg);
                    if (_this.listaPg) {
                        _this.showNoResults = false;
                        _this.viewIntPg = true;
                        _this.viewResultTable = true;
                        // this.dataSource = new MatTableDataSource(this.listaPg['content']);
                        _this.dataSource = new table.MatTableDataSource([_this.listaPg]);
                        // this.dataSource = new MatTableDataSource([res]);
                        // this.dataSource.paginator = this.paginator;
                        // this.resLenPg = res['content'].length;
                        _this.resLenPg = 1;
                    }
                    else {
                        _this.showNoResults = true;
                        _this.viewIntPg = false;
                        _this.viewResultTable = false;
                        _this.resLenPg = 0;
                    }
                }, function (err) {
                    // console.log('[errore - getListaPfPaged]', err);
                    _this.showNoResults = true;
                    _this.viewIntPg = false;
                    _this.viewResultTable = false;
                    _this.resLenPg = 0;
                });
            }
            else {
                console.log("[Ricerca Sul Portale]");
                this.delegheService.getListaPgPaged(this.pageSize, this.pageNumber, pg).subscribe(function (res) {
                    console.log('[pg]', res);
                    _this.listaPg = res;
                    // console.log('[listaPg]', this.listaPg);
                    if (_this.listaPg) {
                        _this.showNoResults = false;
                        _this.viewIntPg = true;
                        _this.viewResultTable = true;
                        _this.dataSource = new table.MatTableDataSource(_this.listaPg['content']);
                        _this.dataSource.paginator = _this.paginator;
                        _this.resLenPg = res['content'].length;
                    }
                    else {
                        _this.showNoResults = true;
                        _this.viewIntPg = false;
                        _this.viewResultTable = false;
                        _this.resLenPg = 0;
                    }
                }, function (err) {
                    // console.log('[errore - getListaPfPaged]', err);
                    _this.showNoResults = true;
                    _this.viewIntPg = false;
                    _this.viewResultTable = false;
                    _this.resLenPg = 0;
                });
            }
        };
        RicercaPgComponent.prototype.pulisciForm = function () {
            this.resetForm.next(true);
            this.viewResultTable = false;
            this.dataSource = new table.MatTableDataSource(null);
            this.viewIntPg = false;
            // console.log('[pulisciForm - resetForm]', this.resetForm);
        };
        RicercaPgComponent.prototype.areSearchParameterValid = function () {
            return (this.validationFormPG &&
                (this.codiceFiscale != "" ||
                    this.ragioneSociale != "" ||
                    this.partitaIVA != ""));
        };
        RicercaPgComponent.prototype.personaGiuridicaSelected = function (row) {
            // console.log('[PersonaGiuridica]', row);
            this.done.emit(ComponentOutputStatus.of(true, row));
        };
        return RicercaPgComponent;
    }());
    RicercaPgComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-ricerca-pg',
                    template: "<!-- <p>ricerca-pg works!</p> -->\r\n<!-- <div class=\"row\">\r\n\t<div class=\"col-12\">\r\n\t\t<p class=\"h6\"> {{'ricerca-nel-portale-dag' | traduzione}} </p>\r\n\t</div>\r\n</div> -->\r\n<!-- <div class=\"row\">\r\n\t<div class=\"col-12\">\r\n\t\t<p class=\"mt-3\">{{'spiegazione' | traduzione }}</p>\r\n\t</div>\r\n</div> -->\r\n<!-- <lib-persona-giuridica\r\n\t(done)=\"personaGiuridicaReady($event)\"\r\n\t[namespace]=\"namespace\"\r\n\t[resetForm]=\"resetForm\"\r\n\t[validatorFormControl]=\"false\"\r\n>\r\n</lib-persona-giuridica> -->\r\n<lib-pg\r\n\t(done)=\"personaGiuridicaReady($event)\"\r\n\t[resetForm]=\"resetForm\"\r\n\t[showPartitaIVA]=\"showPartitaIVA\"\r\n\t[showRagioneSociale]=\"showRagioneSociale\"\r\n>\r\n</lib-pg>\r\n<div class=\"col-12\">\r\n\t<div class=\"float-right mt-4\">\r\n\t\t<button\r\n\t\t\t(click)=\"pulisciForm();\"\r\n\t\t\tmat-stroked-button color=\"primary\"\r\n\t\t\tclass=\"mr-3\"\r\n\t\t\t[disabled]=\"!areSearchParameterValid()\"\r\n\t\t> {{'pulisci' | traduzione | uppercase}}\r\n\t\t</button>\r\n\t\t<button\r\n\t\t\t(click)=\"getListaPg();\"\r\n\t\t\tmat-flat-button color=\"primary\"\r\n\t\t\t[disabled]=\"!areSearchParameterValid()\"\r\n\t\t>{{'ricerca' | traduzione | uppercase}}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\n<br>\r\n<br>\r\n<div class=\"col-12\">\r\n\t<ng-container>\r\n\t\t<div class=\"col-md-12 mt-3\">\r\n\t\t\t<div *ngIf=\"showNoResults\">\r\n\t\t\t\t<p>\r\n\t\t\t\t\t{{'nessuno-risultato' | traduzione}}\r\n\t\t\t\t</p>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"viewIntPg\" class=\"mb-5\">\r\n\t\t\t<div class=\"col-md-12 mt-3\">\r\n\t\t\t\t<mat-chip-list>\r\n\t\t\t\t\t<p class=\"mr-3 mb-0\">{{'totale-risultati' | traduzione }} : {{resLenPg}}</p>\r\n\t\t\t\t</mat-chip-list>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div [hidden]=\"!viewResultTable\">\r\n\t\t\t<mat-table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 mt-3 border\">\r\n\r\n\t\t\t\t<!-- Ragione Sociale Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"ragioneSociale\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'ragione-sociale' | traduzione }} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\"> {{element.datiPersonaGiuridica.ragioneSociale}} </mat-cell>\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!-- PIVA Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"pIva\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'pIva' | traduzione }} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\"> {{element.datiPersonaGiuridica.partitaIVA}} </mat-cell>\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!-- Codice Fiscale Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"codFiscale\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'codice-fiscale' | traduzione }} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\"> {{element.datiPersonaGiuridica.codiceFiscale}} </mat-cell>\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!-- Selezione Column -->\r\n\t\t\t\t<ng-container matColumnDef=\"seleziona\">\r\n\t\t\t\t\t<mat-header-cell *matHeaderCellDef> {{'seleziona' | traduzione}} </mat-header-cell>\r\n\t\t\t\t\t<mat-cell *matCellDef=\"let element\">\r\n\t\t\t\t\t\t<button (click)=\"personaGiuridicaSelected(element)\" mat-flat-button color=\"primary\">\r\n\t\t\t\t\t\t\t{{'seleziona' | traduzione}}\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t</mat-cell>\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\r\n\t\t\t\t<mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\r\n\r\n\t\t\t</mat-table>\r\n\t\t\t<mat-paginator [pageSizeOptions]=\"[5, 10, 20]\" showFirstLastButtons></mat-paginator>\r\n\t\t</div>\r\n\t</ng-container>\r\n</div>\r\n",
                    styles: [".mat-header-cell{background-color:#dce9f5;color:#092644!important;font-weight:600}.mat-paginator{background:#fff}.mat-paginator,.mat-paginator-page-size .mat-select-trigger{color:rgba(0,0,0,.54)}.mat-paginator-decrement,.mat-paginator-increment{border-right:2px solid rgba(0,0,0,.54);border-top:2px solid rgba(0,0,0,.54)}.mat-paginator-first,.mat-paginator-last{border-top:2px solid rgba(0,0,0,.54)}.mat-icon-button[disabled] .mat-paginator-decrement,.mat-icon-button[disabled] .mat-paginator-first,.mat-icon-button[disabled] .mat-paginator-increment,.mat-icon-button[disabled] .mat-paginator-last{border-color:rgba(0,0,0,.38)}"]
                },] }
    ];
    RicercaPgComponent.ctorParameters = function () { return [
        { type: DelegheService }
    ]; };
    RicercaPgComponent.propDecorators = {
        namespace: [{ type: i0.Input }],
        readOnly: [{ type: i0.Input }],
        showRagioneSociale: [{ type: i0.Input }],
        showPartitaIVA: [{ type: i0.Input }],
        done: [{ type: i0.Output }],
        paginator: [{ type: i0.ViewChild, args: [paginator.MatPaginator, { static: true },] }]
    };

    var PgComponent = /** @class */ (function () {
        function PgComponent(msg) {
            this.msg = msg;
            this.showRagioneSociale = true;
            this.showPartitaIVA = true;
            this.done = new i0.EventEmitter();
        }
        PgComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.form = new forms.FormGroup({});
            if (this.resetForm) {
                this.subscription = this.resetForm.subscribe(function (val) { return val ? _this.pulisciForm() : ""; });
            }
            var codiceFiscale = new forms.FormControl({ value: '', disabled: false }, 
            //TOLTO controllo per dare la possiibilità di inserimento anche della ditta individuale
            // [
            // 	// Validators.required,
            // 	ValidationService.pattern(
            // 		ValidationService.partitaIva,
            // 		"partitaIVAInvalida"
            // 	),
            // ]
            [ValidationService.pattern(ValidationService._codiceFiscalePiva, "cfInvalidoFormalmente")
            ]);
            this.form.addControl("codiceFiscale", codiceFiscale);
            if (this.showRagioneSociale) {
                var ragioneSociale = new forms.FormControl({ value: '', disabled: false });
                this.form.addControl("ragioneSociale", ragioneSociale);
            }
            if (this.showPartitaIVA) {
                var partitaIVA = new forms.FormControl({ value: '', disabled: false }, [
                    // Validators.required,
                    ValidationService.pattern(
                    // ValidationService.partitaIvaMaxLen2,
                    // "partitaIVAMaxLen2"
                    ValidationService.partitaIva, "partitaIVAInvalida"),
                ]);
                this.form.addControl("partitaIVA", partitaIVA);
            }
            var changes$ = this.form.valueChanges.pipe(operators.map(function (_) {
                var _a, _b;
                var newSocieta = new PersonaGiuridicaDTO();
                newSocieta.codiceFiscale = _this.form.controls["codiceFiscale"].value;
                newSocieta.ragioneSociale = (_a = _this.form.controls["ragioneSociale"]) === null || _a === void 0 ? void 0 : _a.value;
                newSocieta.partitaIVA = (_b = _this.form.controls["partitaIVA"]) === null || _b === void 0 ? void 0 : _b.value;
                return ComponentOutputStatus.of(_this.form.valid, newSocieta);
            }));
            this.form.setValidators(function (form) {
                return (!form.get('codiceFiscale').value && (_this.showPartitaIVA && !form.get('partitaIVA').value)) ?
                    { requiredPG: true }
                    : null;
            });
            this.subscription = changes$.subscribe(function (_) { return _this.done.emit(_); });
        };
        PgComponent.prototype.ngOnDestroy = function () {
            if (this.subscription) {
                this.subscription.unsubscribe();
            }
        };
        PgComponent.prototype.pulisciForm = function () {
            var _this = this;
            var keys = Object.keys(this.form.value);
            keys.forEach(function (key) {
                var control = _this.form.get(key);
                control.setValue("");
            });
        };
        return PgComponent;
    }());
    PgComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-pg',
                    template: "<div [formGroup]=\"form\">\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}} {{'codice-fiscale' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{'codice-fiscale' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"codiceFiscale\" maxlength=\"16\" >\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['codiceFiscale'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('codiceFiscaleInvalido', form.controls[ 'codiceFiscale']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'codice-fiscale'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-md-4\" *ngIf=\"showRagioneSociale\">\r\n            <mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}}{{'ragione-sociale' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{'ragione-sociale' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"ragioneSociale\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['ragioneSociale'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('obbligatorio', form.controls['ragioneSociale']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'ragione-sociale'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-md-4\" *ngIf=\"showPartitaIVA\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}}{{'partita-iva' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{'partita-iva' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"partitaIVA\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['partitaIVA'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('partitaIVAInvalida', form.controls['partitaIVA']) | traduzione }}\r\n\t\t\t\t\t<!-- {{msg.produceMessage('partitaIVAMaxLen2', form.controls['partitaIVA']) | traduzione }} -->\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'partita-iva'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n        <div class=\"col-md-12\">\r\n            <mat-error *ngIf=\"form.getError('requiredPG')\">\r\n                {{msg.produceMessage('requiredPG', form) | traduzione }}\r\n            </mat-error>\r\n        </div>\r\n\t</div>\r\n</div>\r\n",
                    styles: [""]
                },] }
    ];
    PgComponent.ctorParameters = function () { return [
        { type: MessageService }
    ]; };
    PgComponent.propDecorators = {
        resetForm: [{ type: i0.Input }],
        showRagioneSociale: [{ type: i0.Input }],
        showPartitaIVA: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var PfComponent = /** @class */ (function () {
        function PfComponent(msg) {
            this.msg = msg;
            this.done = new i0.EventEmitter();
        }
        PfComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.form = new forms.FormGroup({});
            if (this.resetForm) {
                this.subscription = this.resetForm.subscribe(function (val) { return val ? _this.pulisciForm() : ""; });
            }
            var codiceFiscale = new forms.FormControl({ value: '', disabled: false }, [
                ValidationService.pattern(ValidationService.codiceFiscale, "cfInvalidoFormalmente"),
            ]);
            this.form.addControl("codiceFiscale", codiceFiscale);
            var nome = new forms.FormControl({ value: '', disabled: false }, [
                ValidationService.pattern(ValidationService.formatoName, "formatoName")
            ]);
            this.form.addControl("nome", nome);
            var cognome = new forms.FormControl({ value: '', disabled: false }, [
                ValidationService.pattern(ValidationService.formatoName, "formatoName")
            ]);
            this.form.addControl("cognome", cognome);
            var changes$ = this.form.valueChanges.pipe(operators.map(function (_) {
                var pf = new InfoAnagrafichePFDTO();
                pf.codFiscale = _this.form.controls["codiceFiscale"].value;
                pf.nome = _this.form.controls["nome"].value;
                pf.cognome = _this.form.controls["cognome"].value;
                return ComponentOutputStatus.of(_this.form.valid, pf);
            }));
            this.form.setValidators(function (form) {
                return (!form.get('codiceFiscale').value &&
                    (!form.get('cognome').value && !form.get('nome').value)) ?
                    { requiredPF: true } : null;
            });
            this.subscription = changes$.subscribe(function (_) { return _this.done.emit(_); });
        };
        PfComponent.prototype.ngOnDestroy = function () {
            if (this.subscription) {
                this.subscription.unsubscribe();
            }
        };
        PfComponent.prototype.pulisciForm = function () {
            var _this = this;
            var keys = Object.keys(this.form.value);
            keys.forEach(function (key) {
                var control = _this.form.get(key);
                control.setValue("");
            });
        };
        return PfComponent;
    }());
    PfComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-pf',
                    template: "<form [formGroup]=\"form\">\r\n\t<div class=\"row my-2\">\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}}{{'codice-fiscale' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{'codice-fiscale' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"codiceFiscale\" maxlength=\"16\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['codiceFiscale'].invalid\">\r\n\t\t\t\t\t{{msg.produceCFMessage(form.controls['codiceFiscale']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-md-4\">\r\n            <mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}}{{'cognome' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{'cognome' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"cognome\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['cognome'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('obbligatorio',form.controls['cognome']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-md-4\">\r\n            <mat-form-field>\r\n\t\t\t\t<!-- <input matInput placeholder=\"{{'required' | traduzione}}{{'nome' | traduzione}}\" -->\r\n\t\t\t\t<input matInput placeholder=\"{{'nome' | traduzione}}\"\r\n\t\t\t\t\tformControlName=\"nome\">\r\n\t\t\t\t<mat-error *ngIf=\"form.controls['nome'].invalid\">\r\n\t\t\t\t\t{{msg.produceMessage('obbligatorio',form.controls['nome']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n        <div class=\"col-md-12\">\r\n            <mat-error *ngIf=\"form.getError('requiredPF')\">\r\n                {{msg.produceMessage('requiredPF', form) | traduzione }}\r\n            </mat-error>\r\n        </div>\r\n\t</div>\r\n</form>",
                    styles: [""]
                },] }
    ];
    PfComponent.ctorParameters = function () { return [
        { type: MessageService }
    ]; };
    PfComponent.propDecorators = {
        resetForm: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var TabellaSediComponent = /** @class */ (function () {
        function TabellaSediComponent(ref) {
            this.ref = ref;
            this.showLargeHeader = true;
            this.displayedColumns = ['tipo', 'indirizzo', 'seleziona'];
            this.done = new i0.EventEmitter();
        }
        TabellaSediComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.valid = false;
            this.selection = new collections.SelectionModel(false, []);
            this.form = new forms.FormGroup({});
            this.selected = new forms.FormControl({ value: '', disabled: false });
            this.form.addControl('selected', this.selected);
            var changeSelection$ = this.selection.changed.pipe(operators.map(function (change) {
                _this.validazioneeSede = change.added.length > 0 ? true : false;
                return ComponentOutputStatus.of(_this.validazioneeSede, change.added);
            }), operators.tap(function (_) { return console.log("changeSelection", _); }));
            this.dataSource$ = this.sedi$
                .pipe(operators.tap(function (_) {
                _this.selected.setValue('');
                _this.selection.clear();
            }), operators.map(function (sedi) { return new table.MatTableDataSource(sedi); }), operators.tap(function (_) { return console.log("dataSource", _.data); }), operators.tap(function (dataSource) {
                _this.idSedeSelezionata ?
                    _this.initialSelection(dataSource.data) :
                    null;
                _this.ref.detectChanges();
            }));
            changeSelection$.subscribe(function (output) { return _this.done.emit(output); });
        };
        TabellaSediComponent.prototype.initialSelection = function (sedi) {
            var _this = this;
            if (this.idSedeSelezionata) {
                setTimeout(function () {
                    sedi
                        .forEach(function (row) {
                        if (row.id == _this.idSedeSelezionata) {
                            _this.selection.select(row);
                        }
                    });
                }, 0);
            }
        };
        return TabellaSediComponent;
    }());
    TabellaSediComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-tabella-sedi',
                    template: "<ng-container *ngIf=\"dataSource$ | async as dataSource\" [formGroup]=\"form\">\r\n\r\n    <h4 *ngIf=\"showLargeHeader\" class=\"border-bottom font-weight-bold mt-4 h5\"><info-tip-label label=\"sedi\"></info-tip-label></h4>\r\n\r\n    <h5 *ngIf=\"!showLargeHeader\" class=\"border-bottom font-weight-bold mt-4\" style=\"font-family: 'Roboto', Helvetica Neue, Arial, Noto Sans, sans-serif !important;font-size: 1rem;\"><info-tip-label label=\"sedi\"></info-tip-label></h5>\r\n\r\n    <mat-table *ngIf=\"dataSource.data.length > 0\" [dataSource]=\"dataSource\" class=\"mat-elevation-z8 mt-3 border\">\r\n\r\n        <!-- Tipo Column -->\r\n        <ng-container matColumnDef=\"tipo\">\r\n            <mat-header-cell *matHeaderCellDef> {{'tipo' | traduzione}} </mat-header-cell>\r\n            <mat-cell *matCellDef=\"let element\"> {{element.tipoSede.descrizione}} </mat-cell>\r\n            <mat-hint *infoTip=\"'tipo'\"></mat-hint>\r\n        </ng-container>\r\n\r\n        <!-- Indirizzo Column -->\r\n        <ng-container matColumnDef=\"indirizzo\">\r\n            <mat-header-cell *matHeaderCellDef> {{'indirizzo' | traduzione}} </mat-header-cell>\r\n            <mat-cell *matCellDef=\"let element\">\r\n                <span *ngIf=\"!element?.indirizzo?.estero\"> {{element?.indirizzo?.indirizzo}}\r\n                    {{element?.indirizzo?.civico}} {{element?.indirizzo?.cap}} -\r\n                    {{element?.indirizzo?.comune?.denominazione}}\r\n                    {{element?.indirizzo?.provincia?.denominazione}}</span>\r\n                <span *ngIf=\"element?.indirizzo?.estero\"> {{element?.indirizzo?.nazione?.denominazione}} -\r\n                    {{element?.indirizzo?.indirizzo}} </span>\r\n            </mat-cell>\r\n            <mat-hint *infoTip=\"'indirizzo'\"></mat-hint>\r\n        </ng-container>\r\n\r\n        <!-- Selezione Column -->\r\n        <ng-container matColumnDef=\"seleziona\">\r\n            <mat-header-cell *matHeaderCellDef> {{'seleziona' | traduzione}}\r\n            </mat-header-cell>\r\n            <mat-cell *matCellDef=\"let row\">\r\n                <mat-checkbox\r\n                    (click)=\"$event.stopPropagation()\"\r\n                    (change)=\"$event ? selection.toggle(row) : null\"\r\n                    [checked]=\"selection.isSelected(row)\"\r\n                    formControlName=\"selected\"\r\n                    [disabled]=\"disabled\">\r\n                </mat-checkbox>\r\n            </mat-cell>\r\n            <mat-hint *infoTip=\"'seleziona'\"></mat-hint>\r\n        </ng-container>\r\n\r\n        <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\r\n        <mat-row *matRowDef=\"let row; columns: displayedColumns;\"></mat-row>\r\n\r\n    </mat-table>\r\n    <ng-container *ngIf=\"dataSource.data.length > 0; else nessunaSede\">\r\n        <div class=\"collapse-body mt-2\">\r\n            <div class=\"col-md-12\">\r\n                <mat-error *ngIf=\"!validazioneeSede\">\r\n                    {{'requiredSede' | traduzione }}\r\n                </mat-error>\r\n            </div>\r\n        </div>\r\n    </ng-container>\r\n\r\n    <ng-template #nessunaSede>\r\n        <mat-error>\r\n            {{'nessunaSede' | traduzione }}\r\n        </mat-error>\r\n    </ng-template>\r\n\r\n</ng-container>\r\n",
                    styles: [""]
                },] }
    ];
    TabellaSediComponent.ctorParameters = function () { return [
        { type: i0.ChangeDetectorRef }
    ]; };
    TabellaSediComponent.propDecorators = {
        sedi$: [{ type: i0.Input }],
        idSedeSelezionata: [{ type: i0.Input }],
        disabled: [{ type: i0.Input }],
        showLargeHeader: [{ type: i0.Input }],
        done: [{ type: i0.Output }]
    };

    var InfoTipLabelComponent = /** @class */ (function () {
        function InfoTipLabelComponent() {
        }
        return InfoTipLabelComponent;
    }());
    InfoTipLabelComponent.decorators = [
        { type: i0.Component, args: [{ selector: 'info-tip-label',
                    template: '<ng-container *infoTip="label; showIcon: true"></ng-container>' },] }
    ];
    InfoTipLabelComponent.propDecorators = {
        label: [{ type: i0.Input }]
    };

    var InfoTipWrapperComponent = /** @class */ (function () {
        function InfoTipWrapperComponent() {
        }
        return InfoTipWrapperComponent;
    }());
    InfoTipWrapperComponent.decorators = [
        { type: i0.Component, args: [{ exportAs: 'dag-info-tip-wrapper', template: "<ng-container *ngIf=\"(showIcon || false); else noIcon\">\r\n\t<ng-container *ngIf=\"(info$ | async) as tip; else noTip\">\r\n\t\t<!-- {{tip.tipoLabel == \"CAMPO\" && \"SEZIONE_PAGINA\" ? '': tip.label}} -->\r\n\t\t{{ tip.label }}\r\n\t\t<!-- OLD\r\n\t\t<button class=\"dag-info-label mat-flat-button bg-transparent px-0\">\r\n\t\t\t<span class=\"fas fa-info-circle icon-color-primary ml-1\"\r\n\t\t\t\t[matTooltip]=\"tip.tooltip || tip.label\"\r\n\t\t\t><p class=\"sr-only\">{{ tip.tooltip }}</p></span>\r\n\t\t</button> -->\r\n\t\t<button class=\"dag-info-label mat-flat-button bg-transparent px-0\"\r\n\t\t\t[matTooltip]=\"tip.tooltip || tip.label\"\r\n\t\t\taria-label=\"{{tip.tooltip}}\">\r\n\t\t\t<span class=\"fas fa-info-circle icon-color-primary ml-1\">\r\n\t\t\t\t<p class=\"sr-only\">{{ tip.tooltip }}</p>\r\n\t\t\t</span>\r\n\t\t</button>\r\n\t</ng-container>\r\n\t<ng-template #noTip>\r\n\t\t<span class=\"dag-info-label\">\r\n\t\t\t{{ elseLabel }}\r\n\t\t\t<span\r\n\t\t\t\tclass=\"dag-info-tip ml-1\"\r\n\t\t\t\t[matTooltip]=\"elseLabel\"\r\n\t\t\t></span>\r\n\t\t</span>\r\n\t</ng-template>\r\n</ng-container>\r\n<ng-template #noIcon>\r\n\t<ng-container *ngIf=\"(info$ | async) as tip\">\r\n\t\t{{ tip.tooltip }}\r\n\t</ng-container>\r\n</ng-template>\r\n", styles: ["span.dag-info-tip:after{--color:#06f;--size:1rem;border:1px solid var(--color);border-color:var(--color);border-radius:var(--size);color:var(--color);content:\"i\";cursor:help;display:inline-block;font-size:var(--size);font-weight:700;height:var(--size);line-height:var(--size);text-align:center;vertical-align:middle;width:var(--size)}.dag-info-label{min-width:15px!important}"] },] }
    ];
    InfoTipWrapperComponent.propDecorators = {
        info$: [{ type: i0.Input }],
        elseLabel: [{ type: i0.Input }],
        showIcon: [{ type: i0.Input }]
    };

    var InfoTip = /** @class */ (function () {
        // private embeddedViewRef: EmbeddedViewRef<InfoTipDirectiveContext>;
        function InfoTip(infoTipService, templateRef, viewContainer, componentFactoryResolver) {
            this.infoTipService = infoTipService;
            this.templateRef = templateRef;
            this.viewContainer = viewContainer;
            this.componentFactoryResolver = componentFactoryResolver;
        }
        InfoTip.prototype.ngOnInit = function () {
            var view = this.viewContainer.createEmbeddedView(this.templateRef);
            view.detach();
            this.wrapperRef = this.viewContainer.createComponent(this.componentFactoryResolver.resolveComponentFactory(InfoTipWrapperComponent));
            this.wrapperRef.instance.elseLabel = this.infoTip;
            this.wrapperRef.instance.showIcon = this.infoTipShowIcon || false;
            this.wrapperRef.instance.info$ = this.infoTipService.getInfo$(this.infoTip);
            view.reattach();
        };
        InfoTip.prototype.ngOnDestroy = function () {
            this.wrapperRef.destroy();
            // this.embeddedViewRef.destroy();
        };
        return InfoTip;
    }());
    InfoTip.decorators = [
        { type: i0.Directive, args: [{
                    exportAs: 'dag-info-tip',
                    selector: '[infoTip]'
                },] }
    ];
    InfoTip.ctorParameters = function () { return [
        { type: InfoTipService },
        { type: i0.TemplateRef },
        { type: i0.ViewContainerRef },
        { type: i0.ComponentFactoryResolver }
    ]; };
    InfoTip.propDecorators = {
        infoTip: [{ type: i0.Input }],
        infoTipShowIcon: [{ type: i0.Input }]
    };

    var InfoTipModule = /** @class */ (function () {
        function InfoTipModule() {
        }
        return InfoTipModule;
    }());
    InfoTipModule.decorators = [
        { type: i0.NgModule, args: [{ declarations: [InfoTip,
                        InfoTipWrapperComponent,
                        InfoTipLabelComponent
                    ],
                    exports: [InfoTip,
                        InfoTipLabelComponent
                    ],
                    imports: [tooltip.MatTooltipModule,
                        common.CommonModule,
                        i1$2.I18nLibModule
                    ],
                    id: 'dag-info-tip'
                },] }
    ];

    var UpperCaseDirective = /** @class */ (function () {
        function UpperCaseDirective(ref, control) {
            this.ref = ref;
            this.control = control;
        }
        UpperCaseDirective.prototype.input = function (event) {
            var _a;
            this.ref.nativeElement.value = event.target.value.toUpperCase();
            if ((_a = this === null || this === void 0 ? void 0 : this.control) === null || _a === void 0 ? void 0 : _a.control) {
                this.control.control.setValue(this.ref.nativeElement.value);
            }
        };
        return UpperCaseDirective;
    }());
    UpperCaseDirective.decorators = [
        { type: i0.Directive, args: [{
                    selector: '[uppercase]'
                },] }
    ];
    UpperCaseDirective.ctorParameters = function () { return [
        { type: i0.ElementRef },
        { type: forms.NgControl }
    ]; };
    UpperCaseDirective.propDecorators = {
        input: [{ type: i0.HostListener, args: ['input', ['$event'],] }]
    };

    var UppercaseModule = /** @class */ (function () {
        function UppercaseModule() {
        }
        return UppercaseModule;
    }());
    UppercaseModule.decorators = [
        { type: i0.NgModule, args: [{
                    declarations: [
                        UpperCaseDirective
                    ],
                    imports: [
                        common.CommonModule,
                    ],
                    exports: [
                        UpperCaseDirective
                    ],
                    providers: [],
                },] }
    ];

    var MY_DATE_FORMATS = {
        parse: {
            dateInput: "DD/MM/YYYY",
        },
        display: {
            dateInput: "DD/MM/YYYY",
            monthYearLabel: "MM YYYY",
            dateA11yLabel: "DD/MM/YYYY",
            monthYearA11yLabel: "MM YYYY",
        },
    };
    core.NativeDateAdapter;
    // export function delegheServiceFactory(http: HttpClient, injector: Injector) {
    // 	return new DelegheService(http, injector);
    // }
    function codiceFiscaleServiceFactory(http, conf) {
        // return !environment.isMock
        // 	? new CodiceFiscaleServiceImpl(http, paths)
        // 	: new CodiceFiscaleServiceMock();
        return new CodiceFiscaleServiceImpl(http, conf);
    }
    function validationServiceFactory(checkCFService) {
        return new ValidationService(checkCFService);
    }
    var ɵ0$1 = { strict: true };
    var DepositiModule = /** @class */ (function () {
        function DepositiModule() {
        }
        return DepositiModule;
    }());
    DepositiModule.decorators = [
        { type: i0.NgModule, args: [{
                    declarations: [
                        ContattiComponent,
                        DatiAnagraficiComponent,
                        DatiDomicilioComponent,
                        DatiResidenzaComponent,
                        RichiedenteComponent,
                        DelegheComponent,
                        GenericModalComponent,
                        PersonaFisicaComponent,
                        InfoPfComponent,
                        InfoNascitaComponent,
                        PersonaGiuridicaComponent,
                        IndirizzoComponent,
                        IndirizzoItalianoComponent,
                        IndirizzoEsteroComponent,
                        StradaComponent,
                        LocalitaComponent,
                        AccettazioneComponent,
                        DocumentazioneComponent,
                        CaricaDocumentiComponent,
                        TipologiaDepositoComponent,
                        PagamentoComponent,
                        DatiTribunaleComponent,
                        DatiDeposito,
                        TabellaDocumentiComponent,
                        AltriSoggettiComponent,
                        StepperNavigatorComponent,
                        RicercaPfComponent,
                        RicercaPgComponent,
                        PgComponent,
                        PfComponent,
                        TabellaSediComponent
                    ],
                    entryComponents: [GenericModalComponent],
                    imports: [
                        common.CommonModule,
                        i1.HttpClientModule,
                        table.MatTableModule,
                        TranslateModule,
                        expansion.MatExpansionModule,
                        i1$2.I18nLibModule,
                        select.MatSelectModule,
                        core.MatNativeDateModule,
                        button.MatButtonModule,
                        card.MatCardModule,
                        input.MatInputModule,
                        forms.ReactiveFormsModule,
                        formField.MatFormFieldModule,
                        i1$1.MatDialogModule,
                        paginator.MatPaginatorModule,
                        icon.MatIconModule,
                        progressBar.MatProgressBarModule,
                        radio.MatRadioModule,
                        checkbox.MatCheckboxModule,
                        datepicker.MatDatepickerModule,
                        core.MatOptionModule,
                        list.MatListModule,
                        AllegatiModule,
                        UppercaseModule,
                        ngBootstrap.NgbModule,
                        sort.MatSortModule,
                        InfoTipModule,
                        materialMomentAdapter.MomentDateModule
                    ],
                    exports: [
                        RichiedenteComponent,
                        DelegheComponent,
                        AccettazioneComponent,
                        DocumentazioneComponent,
                        TipologiaDepositoComponent,
                        PagamentoComponent,
                        DatiDeposito,
                        StepperNavigatorComponent,
                        AltriSoggettiComponent,
                        RicercaPgComponent,
                        RicercaPfComponent,
                        AltriSoggettiComponent,
                        GenericModalComponent,
                        DatiTribunaleComponent,
                        IndirizzoComponent,
                        ContattiComponent,
                        PersonaFisicaComponent,
                        PersonaGiuridicaComponent,
                        TabellaSediComponent,
                        UppercaseModule
                    ],
                    providers: [
                        // {
                        // 	provide: I18N_CONFIG,
                        // 	useValue: {
                        // 		codiceApplicazione: "LP"
                        // 	}
                        // },
                        // {
                        // 	provide: TipologicheService
                        // },
                        {
                            provide: CodiceFiscaleService,
                            useFactory: codiceFiscaleServiceFactory,
                            deps: [i1.HttpClient, ConfigurationService]
                        },
                        // {
                        // 	provide: DelegheService,
                        // 	// useFactory: delegheServiceFactory,
                        // 	// deps: [HttpClient, Injector],
                        // },
                        {
                            provide: ValidationService,
                            useFactory: validationServiceFactory,
                            deps: [CodiceFiscaleServiceImpl]
                        },
                        { provide: core.MAT_DATE_LOCALE, useValue: "it-IT" },
                        { provide: core.MAT_DATE_FORMATS, useValue: MY_DATE_FORMATS },
                        { provide: materialMomentAdapter.MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: ɵ0$1 },
                        {
                            provide: core.DateAdapter,
                            useClass: materialMomentAdapter.MomentDateAdapter,
                            deps: [core.MAT_DATE_LOCALE, materialMomentAdapter.MAT_MOMENT_DATE_ADAPTER_OPTIONS],
                        },
                    ],
                },] }
    ];

    var TipologicaDTO = /** @class */ (function () {
        function TipologicaDTO() {
        }
        return TipologicaDTO;
    }());

    var TipoDocumento = /** @class */ (function () {
        function TipoDocumento() {
        }
        TipoDocumento.of = function (codice, descrizione) {
            var td = new TipoDocumento();
            td.codice = codice;
            td.descrizione = descrizione;
            return td;
        };
        return TipoDocumento;
    }());

    var CostituzioneDepositoDTO = /** @class */ (function () {
        function CostituzioneDepositoDTO() {
        }
        return CostituzioneDepositoDTO;
    }());

    var CostituzioneDepositoVolontarioDTO = /** @class */ (function () {
        function CostituzioneDepositoVolontarioDTO() {
        }
        return CostituzioneDepositoVolontarioDTO;
    }());

    var CostituzioneDepositoCauzionaleDTO = /** @class */ (function () {
        function CostituzioneDepositoCauzionaleDTO() {
        }
        return CostituzioneDepositoCauzionaleDTO;
    }());

    var CostituzioneDepositoEsproprioDTO = /** @class */ (function () {
        function CostituzioneDepositoEsproprioDTO() {
        }
        return CostituzioneDepositoEsproprioDTO;
    }());

    var CostituzioneDepositoGiudiziarioDTO = /** @class */ (function () {
        function CostituzioneDepositoGiudiziarioDTO() {
        }
        return CostituzioneDepositoGiudiziarioDTO;
    }());

    var CostituzioneDepositoNoEsproprioDTO = /** @class */ (function () {
        function CostituzioneDepositoNoEsproprioDTO() {
        }
        return CostituzioneDepositoNoEsproprioDTO;
    }());

    var AutoritaOrdinanteDTO = /** @class */ (function () {
        function AutoritaOrdinanteDTO() {
        }
        return AutoritaOrdinanteDTO;
    }());

    var DatiDepositoNoEsproprioDTO = /** @class */ (function (_super) {
        __extends(DatiDepositoNoEsproprioDTO, _super);
        function DatiDepositoNoEsproprioDTO() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        return DatiDepositoNoEsproprioDTO;
    }(DatiDepositoDTO));

    var EnteRichiedenteCauzioneDTO = /** @class */ (function () {
        function EnteRichiedenteCauzioneDTO() {
        }
        return EnteRichiedenteCauzioneDTO;
    }());

    var AutoritaEsproprianteDTO = /** @class */ (function () {
        function AutoritaEsproprianteDTO() {
        }
        return AutoritaEsproprianteDTO;
    }());

    var ParticellaDTO = /** @class */ (function () {
        function ParticellaDTO() {
        }
        return ParticellaDTO;
    }());

    var DocumentoDTO = /** @class */ (function () {
        function DocumentoDTO() {
        }
        return DocumentoDTO;
    }());

    var BozzaDepositoDTO = /** @class */ (function () {
        function BozzaDepositoDTO() {
        }
        return BozzaDepositoDTO;
    }());

    var IdentificativoRichiestaDTO = /** @class */ (function () {
        function IdentificativoRichiestaDTO() {
        }
        return IdentificativoRichiestaDTO;
    }());

    var CreazioneBozzaResponse = /** @class */ (function () {
        function CreazioneBozzaResponse() {
        }
        return CreazioneBozzaResponse;
    }());

    var ComuneDTO = /** @class */ (function () {
        function ComuneDTO() {
        }
        return ComuneDTO;
    }());

    var ProprietarioDTO = /** @class */ (function () {
        function ProprietarioDTO() {
        }
        return ProprietarioDTO;
    }());

    var ProvinciaDTO = /** @class */ (function () {
        function ProvinciaDTO() {
        }
        return ProvinciaDTO;
    }());

    var DatiOperaDTO = /** @class */ (function () {
        function DatiOperaDTO() {
        }
        return DatiOperaDTO;
    }());

    var NaturaRichiedenteRequestDTO = /** @class */ (function () {
        function NaturaRichiedenteRequestDTO() {
        }
        return NaturaRichiedenteRequestDTO;
    }());

    var TipiDocumentoRequestDTO = /** @class */ (function () {
        function TipiDocumentoRequestDTO() {
        }
        return TipiDocumentoRequestDTO;
    }());

    var TipoDocumentoDTO = /** @class */ (function () {
        function TipoDocumentoDTO() {
        }
        return TipoDocumentoDTO;
    }());

    var TribunaleDTO = /** @class */ (function () {
        function TribunaleDTO() {
        }
        return TribunaleDTO;
    }());

    var RtsDTO = /** @class */ (function () {
        function RtsDTO() {
        }
        return RtsDTO;
    }());

    var regioneDTO = /** @class */ (function () {
        function regioneDTO() {
        }
        return regioneDTO;
    }());

    var NazioneDTO = /** @class */ (function () {
        function NazioneDTO() {
        }
        return NazioneDTO;
    }());

    var ListaPagamentiComponent = /** @class */ (function () {
        function ListaPagamentiComponent(translateService, translatePipe) {
            this.translateService = translateService;
            this.translatePipe = translatePipe;
        }
        ListaPagamentiComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.translatePipe.transform('');
            this.translateService.traduzioniLib$
                .pipe(operators.tap(function (_) { return _ ? _this.loadingLinguage = true : null; }))
                .subscribe();
        };
        return ListaPagamentiComponent;
    }());
    ListaPagamentiComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-lista-pagamenti',
                    template: "<div *ngIf=\"loadingLinguage\">\r\n    <div *ngFor=\"let pagamento of pagamenti; let indice = index \" class=\"card card-primary shadow mb-3\">\r\n        <div class=\"card-header px-3 py-2\">\r\n            <h4 class=\"card-title mb-0 font-weight-bold d-inline text-uppercase h5\">\r\n                {{pagamento.servizio?.descrizione}} - {{pagamento?.idPagamento}}</h4>\r\n            <span class=\"badge badge-light float-right text-uppercase\"><span\r\n                    class=\"font-weight-normal\">{{'statoPagamento' | traduzione }}</span>\r\n                {{pagamento?.stato}}</span>\r\n        </div>\r\n        <div class=\"card-body px-3 py-2\">\r\n            <lib-dati-pagamento [pagamento]=\"pagamento\"></lib-dati-pagamento>\r\n            <lib-visualizza-dettagli [pagamento]=\"pagamento\"></lib-visualizza-dettagli>\r\n        </div>\r\n        <!--   <div class=\"col-12 text-right mb-3\">\r\n            <button mat-flat-button color=\"primary\">\r\n                {{'buttonDownload' | traduzione }}\r\n            </button>\r\n        </div> -->\r\n    </div>\r\n</div>",
                    styles: [".card-primary>.card-header{background-color:#b9c9d8}.btn-excel{line-height:27px;padding:0 8px}.mat-expansion-panel-body{padding-left:0!important;padding-right:0!important}"]
                },] }
    ];
    ListaPagamentiComponent.ctorParameters = function () { return [
        { type: TranslateService },
        { type: TranslatePipe }
    ]; };
    ListaPagamentiComponent.propDecorators = {
        pagamenti: [{ type: i0.Input }]
    };

    var VisualizzaDettagliComponent$1 = /** @class */ (function () {
        function VisualizzaDettagliComponent(traduzione) {
            this.traduzione = traduzione;
        }
        VisualizzaDettagliComponent.prototype.ngOnInit = function () {
            this.dettagli = this.traduzione.transform('visualizzaDettagli');
            this.data = this.pagamento.dataValuta != null ?
                moment(new Date(this.pagamento.dataValuta)).format("DD/MM/YYYY") : '';
            this.contaRighe();
        };
        VisualizzaDettagliComponent.prototype.accordionOpened = function () {
            this.dettagli = this.traduzione.transform('nascondiDettagli');
        };
        VisualizzaDettagliComponent.prototype.accordionClosed = function () {
            this.dettagli = this.traduzione.transform('visualizzaDettagli');
        };
        VisualizzaDettagliComponent.prototype.contaRighe = function () {
            if (this.pagamento.motivoScarto) {
                var par = this.pagamento.motivoScarto;
                par = par.replace(/(^\s*)|(\s*$)/gi, "");
                par = par.replace(/[ ]{2,}/gi, " ");
                par = par.replace(/\n /, "\n");
                var numeroRighe = par.split('').length / 180;
                this.numeroRighe = Math.ceil(numeroRighe).toString();
            }
        };
        return VisualizzaDettagliComponent;
    }());
    VisualizzaDettagliComponent$1.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-visualizza-dettagli',
                    template: "<mat-accordion class=\"example-headers-align\" multi>\r\n  <mat-expansion-panel class=\"panel-dettagli\" (opened)=\"accordionOpened()\" (closed)=\"accordionClosed()\">\r\n    <mat-expansion-panel-header class=\"detail-pagamenti\">\r\n      <mat-panel-title class=\"text-white\">\r\n        {{dettagli}}\r\n      </mat-panel-title>\r\n    </mat-expansion-panel-header>\r\n    <div class=\"detail-content\">\r\n    <div class=\"row mt-4\">\r\n      <div class=\"col-4\">\r\n        <p class=\"mb-0 font-weight-bold\">{{'beneficiario' | traduzione}}:</p>\r\n        <p>{{pagamento?.denominazione}}</p>\r\n      </div>\r\n      <div class=\"col-4\">\r\n        <p class=\"mb-0 font-weight-bold\">{{'dataValuta' | traduzione}}:</p>\r\n        <p>{{data}}</p>\r\n      </div>\r\n      <div class=\"col-4\">\r\n        <p class=\"mb-0 font-weight-bold\">{{'cro' | traduzione}}:</p>\r\n        <p>{{pagamento?.cro}}</p>\r\n      </div>\r\n      <div class=\"col-12\">\r\n        <p class=\"mb-0 font-weight-bold\">{{'modalitaPagamaneto' | traduzione}}:</p>\r\n        <p>{{pagamento.modalitaPagamento?.descrizione}}</p>\r\n      </div>\r\n      <div *ngIf=\"pagamento.motivoScarto\" class=\"col-12 col-md-12\">\r\n        <p class=\"mb-0 font-weight-bold\">{{'motivoScarto' | traduzione}}:</p>\r\n        <textarea disabled=\"true\" matInput value={{pagamento.motivoScarto}} rows={{numeroRighe}}></textarea>\r\n      </div>\r\n    </div>\r\n    <h5 class=\"border-bottom font-weight-bold mt-4\">{{'titolo_cronologia_stati' | traduzione}}</h5>\r\n    <lib-tabella-cronologica-stati [idPagamento]=\"pagamento?.idPagamento\"></lib-tabella-cronologica-stati>\r\n  </div>\r\n  </mat-expansion-panel>\r\n</mat-accordion>\r\n",
                    styles: [".mat-flat-button{line-height:25px;padding:0 12px}.mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:0 3px 1px -2px transparent,0 0 0 0 transparent,0 0 0 0 transparent}.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled=true]):hover{background:#1d65da}.mat-expansion-panel-header.mat-expanded:focus{background:#1953b0}.mat-expansion-indicator:after{color:#fff!important;margin-top:-3px}.mat-expansion-panel-header{background-color:#1953b0!important;display:inline-flex;height:25px;padding:0 12px}.mat-expansion-panel-header.mat-expanded:hover{background:#1d65da!important}.detail-content{margin:0 -24px}.mat-input-element:disabled{color:#000}", "\n  ::ng-deep .detail-pagamenti > .mat-expansion-indicator:after {\n    color: white;\n    margin-top: -3px;\n  }\n"]
                },] }
    ];
    VisualizzaDettagliComponent$1.ctorParameters = function () { return [
        { type: TranslatePipe }
    ]; };
    VisualizzaDettagliComponent$1.propDecorators = {
        pagamento: [{ type: i0.Input }]
    };

    var DatiPagamentoComponent = /** @class */ (function () {
        function DatiPagamentoComponent() {
        }
        DatiPagamentoComponent.prototype.ngOnInit = function () {
            this.dataR = this.pagamento.dataEmissione != null ?
                moment(new Date(this.pagamento.dataEmissione)).format("DD/MM/YYYY") : '';
        };
        return DatiPagamentoComponent;
    }());
    DatiPagamentoComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-dati-pagamento',
                    template: "<div class=\"row mt-2 mb-3\">\r\n    <div class=\"col-4\">\r\n        <p class=\"mb-0 font-weight-bold\">{{'dataPagamento' | traduzione  }}:</p>\r\n        <p>{{dataR}}</p>\r\n    </div>\r\n    <div class=\"col-4\">\r\n        <p class=\"mb-0 font-weight-bold\">{{'causale' | traduzione }}:</p>\r\n        <p>{{pagamento?.causale}}</p>\r\n    </div>\r\n    <div class=\"col-4\">\r\n        <p class=\"mb-0 font-weight-bold\">{{'importo' | traduzione }}:</p>\r\n        <p>{{pagamento?.importo | number :'1.2-2' | formattaImporto}}</p>\r\n    </div>\r\n    <div class=\"col-4\">\r\n        <p class=\"mb-0 font-weight-bold\">{{'identificativo' | traduzione }}:</p>\r\n        <p>{{pagamento?.identificativo}}</p>\r\n    </div>\r\n</div>\r\n",
                    styles: [""]
                },] }
    ];
    DatiPagamentoComponent.ctorParameters = function () { return []; };
    DatiPagamentoComponent.propDecorators = {
        pagamento: [{ type: i0.Input }]
    };

    var FormattaImportoPipe = /** @class */ (function () {
        function FormattaImportoPipe() {
        }
        FormattaImportoPipe.prototype.transform = function (value) {
            if (value) {
                // value.replace(',', 'v');
                var arrConfig = [[',', 'v'], ['.', ','], ['v', '.']];
                var reduced = arrConfig.reduce(function (acc, config) {
                    return acc.replace(config[0], config[1]);
                }, value);
                return reduced;
            }
            return '';
        };
        return FormattaImportoPipe;
    }());
    FormattaImportoPipe.decorators = [
        { type: i0.Pipe, args: [{
                    name: 'formattaImporto'
                },] }
    ];

    var Paths = /** @class */ (function () {
        function Paths(configurationService) {
            this.configurationService = configurationService;
            this.V1 = this.configurationService.servicePaths.get("GESTIONE_PAGAMENTI_MS_API_URL") + "/v1/";
        }
        Paths.prototype.get_V1_CRONOLOGIA_STATI = function (idPagamento) {
            return this.V1 + 'cronologia/' + idPagamento;
        };
        return Paths;
    }());
    Paths.decorators = [
        { type: i0.Injectable }
    ];
    Paths.ctorParameters = function () { return [
        { type: ConfigurationService }
    ]; };

    var PagamentiService = /** @class */ (function () {
        function PagamentiService(paths, http) {
            this.paths = paths;
            this.http = http;
        }
        PagamentiService.prototype.getCronologiaStati$ = function (idPagamento) {
            var url = this.paths.get_V1_CRONOLOGIA_STATI(idPagamento);
            return this.http.get(url).pipe(operators.shareReplay());
        };
        return PagamentiService;
    }());
    PagamentiService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PagamentiService_Factory() { return new PagamentiService(i0.ɵɵinject(Paths), i0.ɵɵinject(i1.HttpClient)); }, token: PagamentiService, providedIn: "root" });
    PagamentiService.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    PagamentiService.ctorParameters = function () { return [
        { type: Paths },
        { type: i1.HttpClient }
    ]; };

    var TabellaCronologicaStatiComponent = /** @class */ (function () {
        function TabellaCronologicaStatiComponent(pagamentiService) {
            this.pagamentiService = pagamentiService;
        }
        TabellaCronologicaStatiComponent.prototype.ngOnInit = function () {
            this.cronologiaStati$ = this.pagamentiService.getCronologiaStati$(this.idPagamento);
        };
        return TabellaCronologicaStatiComponent;
    }());
    TabellaCronologicaStatiComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-tabella-cronologica-stati',
                    template: "<div class=\"table-responsive\">\r\n\t<table class=\"table border\">\r\n\t\t<thead>\r\n\t\t\t<tr>\r\n\t\t\t\t<th scope=\"col\">{{'colonna_data' | traduzione}}</th>\r\n\t\t\t\t<th scope=\"col\">{{'colonna_stato'| traduzione}}</th>\r\n\t\t\t\t<th scope=\"col\">{{'colonna_note' | traduzione}}</th>\r\n\t\t\t</tr>\r\n\t\t</thead>\r\n\t\t<tbody>\r\n\t\t\t<tr *ngFor=\"let stato of cronologiaStati$ | async\">\r\n\t\t\t\t<td>{{stato.dataModifica | date: \"dd/MM/yyyy\"}}</td>\r\n\t\t\t\t<td>{{stato.descrizioneStato}}</td>\r\n\t\t\t\t<td>{{stato.nota}}</td>\r\n\t\t\t</tr>\r\n\t\t</tbody>\r\n\t</table>\r\n</div>\r\n",
                    styles: [".card-primary>.card-header{background-color:#d3deea}.table>thead{background-color:#0a2644;color:#fff}.table td,.table th{border-top:0;padding:.75rem;vertical-align:top}.table tr{border-bottom:1px solid #dee2e6}.table tbody tr:hover{background-color:#dee2e6}.btn-link{color:#0061c2}.btn-link:hover{color:#053a9a}.btn-primary{background-color:#0061c2}.btn-primary:hover{background-color:#053a9a}"]
                },] }
    ];
    TabellaCronologicaStatiComponent.ctorParameters = function () { return [
        { type: PagamentiService }
    ]; };
    TabellaCronologicaStatiComponent.propDecorators = {
        idPagamento: [{ type: i0.Input }]
    };

    var PagamentiModule = /** @class */ (function () {
        function PagamentiModule() {
        }
        return PagamentiModule;
    }());
    PagamentiModule.decorators = [
        { type: i0.NgModule, args: [{
                    declarations: [ListaPagamentiComponent,
                        DatiPagamentoComponent,
                        VisualizzaDettagliComponent$1,
                        FormattaImportoPipe,
                        TabellaCronologicaStatiComponent
                    ],
                    imports: [
                        common.CommonModule,
                        i1.HttpClientModule,
                        table.MatTableModule,
                        TranslateModule,
                        expansion.MatExpansionModule,
                        button.MatButtonModule,
                        input.MatInputModule
                    ],
                    exports: [ListaPagamentiComponent],
                    providers: [Paths],
                },] }
    ];

    var CronologiaStatoDTO = /** @class */ (function () {
        function CronologiaStatoDTO() {
        }
        return CronologiaStatoDTO;
    }());

    var ConfigurationModule = /** @class */ (function () {
        function ConfigurationModule() {
        }
        ConfigurationModule.forRoot = function (configurazioneModulo) {
            var http;
            return {
                ngModule: ConfigurationModule,
                providers: [
                    {
                        provide: ConfigurationService,
                        useFactory: function () { return new ConfigurationService(configurazioneModulo); }
                    }
                ]
            };
        };
        return ConfigurationModule;
    }());
    ConfigurationModule.decorators = [
        { type: i0.NgModule, args: [{
                    declarations: [],
                    imports: [
                        common.CommonModule
                    ]
                },] }
    ];

    var capPattern = '[0-9][0-9][0-9][0-9][0-9]';
    var passwordPattern = /^(?:(?=.*\d)(?=.*[A-Z]).{8,})/;
    var zeroCentoPattern = '^([0-9]|[1-9][0-9]|100)$';
    var formatoData = /^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/;
    var formatoEmail = /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/;
    var iban = /^(?:(?:IT|SM)\d{2}[A-Z]\d{22}|CY\d{2}[A-Z]\d{23}|NL\d{2}[A-Z]{4}\d{10}|LV\d{2}[A-Z]{4}\d{13}|(?:BG|BH|GB|IE)\d{2}[A-Z]{4}\d{14}|GI\d{2}[A-Z]{4}\d{15}|RO\d{2}[A-Z]{4}\d{16}|KW\d{2}[A-Z]{4}\d{22}|MT\d{2}[A-Z]{4}\d{23}|NO\d{13}|(?:DK|FI|GL|FO)\d{16}|MK\d{17}|(?:AT|EE|KZ|LU|XK)\d{18}|(?:BA|HR|LI|CH|CR)\d{19}|(?:GE|DE|LT|ME|RS)\d{20}|IL\d{21}|(?:AD|CZ|ES|MD|SA)\d{22}|PT\d{23}|(?:BE|IS)\d{24}|(?:FR|MR|MC)\d{25}|(?:AL|DO|LB|PL)\d{26}|(?:AZ|HU)\d{27}|(?:GR|MU)\d{28})$/;
    var formatoSwift = /^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/;
    //static codiceFiscale = /^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$/;
    var codiceFiscale = /([a-z]{6}|[A-Z]{6})(l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|\d{1})(l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|\d{1})(a|b|c|d|e|h|l|m|p|r|s|t|A|B|C|D|E|H|L|M|P|R|S|T)((((l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|0|1|2|3|4|5|6)(l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|\d{1}))|71|70|TM|Tm|tM|tm|TL|tl|Tl|tL))([a-z]{1}|[A-Z]{1})(L|M|N|P|Q|R|S|T|U|V|\d{1})(l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|\d{1})(l|m|n|p|q|r|s|t|u|v|L|M|N|P|Q|R|S|T|U|V|\d{1})([a-z]{1}|[A-Z]{1})/;
    var partitaIva = /^[0-9]{11}$/;
    var codiceFiscalePiva = '^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$|^[0-9]{11}$';
    var _codiceFiscalePiva = /^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$|^[0-9]{11}$/;
    var anno = /^[1-2][0-9]{3}$/;
    var nSentenza = /^[0-9]*\/[1-2][0-9]{3}$/;
    var numberPattern = /^[0-9]*$/;
    var phoneNumberPattern = /^\+{0,1}[0-9]*$/;
    var moneyPattern = /^([0-9]+)|((([1-9][0-9]*)|([0-9]))([,])[0-9]{2})$/;
    var moneyCommaSeparated = /^\d+,\d{2}$/;
    var moneyCommaSeparatedGreaterThanZero = /^\s*(?=.*[1-9])\d*(?:\,\d{1,2})?\s*$/;
    var numbers = /^\d+/;
    var formatoName = /^[a-zA-Zàèìòùé ']+$/;
    var numRegex = /^-?\d*[.,]?\d{0,2}$/;
    var validationMessages = {
        maxlength: "validation-maxlength",
        requiredInfoDecreto: "validation-requiredInfoDecreto",
        requiredMail: "validation-requiredMail",
        cfInvalidoFormalmente: "validation-cfInvalidoFormalmente",
        invalidCF: "validation-invalidCF",
        nSentenza: "validation-nSentenza",
        required: "obbligatorio",
        email: "validation-email",
        tel: "validation-tel",
        iban: "validation-iban",
        partitaIVAInvalida: "validation-partitaIVAInvalida",
        money: "validation-money",
        invalidName: "validation-invalidName",
        invalidDate: "validation-invalidDate",
        pattern: "validation-pattern",
        invalidDateFormat: "validation-invalidDateFormat",
        requiredDefinizione: "validation-requiredDefinizione",
        validationServiceFailed: "validation-validationServiceFailed",
        cfValidationPG: "validation-cfValidationPG",
        cfDifferentRichiedente: "validation-cfDifferentRichiedente",
        requiredDomicilio: "validation-requiredDomicilio",
        requiredSede: "validation-requiredSede",
        matDatepickerParse: "validation-invalidDateFormat",
        matDatepickerMax: "error-upper-bound"
    };

    function getErrorMessage(control) {
        var error = Object.keys(control['errors'])[0];
        return getMessageLabel(error);
    }
    function getDateErrorMessage(control) {
        var errors = Object.keys(control['errors']);
        if (errors.find(function (err) { return err == 'matDatepickerParse'; })) {
            return getMessageLabel('matDatepickerParse');
        }
        var error = Object.keys(control['errors'])[0];
        return getMessageLabel(error);
    }
    function getMessageLabel(messageKey) {
        var message = validationMessages[messageKey];
        if (message) {
            return message;
        }
        else {
            return messageKey;
        }
    }

    var BonificoSepaComponent = /** @class */ (function () {
        function BonificoSepaComponent() {
            this.viewSessoPF = false;
            this.validateSepaPersonaFisicaEmitter = new i0.EventEmitter();
            this.resetEstremiPersonaFisicaSepaFormEmitter = new i0.EventEmitter();
            this.bonificoSepaReady = new i0.EventEmitter();
            this.personaFisicaEmitter = new i0.EventEmitter();
            this.getErrorMessage = getErrorMessage;
            this.ibanValidators = [forms.Validators.required, this.sepaCountriesValidator(), ngxIban.ibanValidator()];
            this.sepaCountries = [{ "name": "Austria", "code": "AT", "iban": "AT493200056563289974" }, { "name": "Belgium", "code": "BE", "iban": "BE65561689528896" }, { "name": "Bulgaria", "code": "BG", "iban": "BG92TTBB94006559266188" }, { "name": "Cyprus", "code": "CY", "iban": "CY52665561416772369457864437" }, { "name": "Croatia", "code": "HR", "iban": "HR5523400098663266246" }, { "name": "Denmark", "code": "DK", "iban": "DK2550515918328528" }, { "name": "Estonia", "code": "EE", "iban": "EE591286653867491786" }, { "name": "Finland", "code": "FI", "iban": "FI8479486911788598" }, { "name": "France", "code": "FR", "iban": "FR8514508000707239488738J21" }, { "name": "Germany", "code": "DE", "iban": "DE14500105174185484177" }, { "name": "Greece", "code": "GR", "iban": "GR9201494491588141549531799" }, { "name": "Ireland", "code": "IE", "iban": "IE29AIBK93115212345678" }, { "name": "Italy", "code": "IT", "iban": "IT77R0300203280648419668253" }, { "name": "Latvia", "code": "LV", "iban": "LV80BANK0000435195001" }, { "name": "Lithuania", "code": "LT", "iban": "LT275168179993645428" }, { "name": "Luxembourg", "code": "LU", "iban": "LU350106814331716425" }, { "name": "Malta", "code": "MT", "iban": "MT54WLCI12377529685589454747835" }, { "name": "Netherlands", "code": "NL", "iban": "NL13INGB6755037397" }, { "name": "Poland", "code": "PL", "iban": "PL06109024023962236263666664" }, { "name": "Portugal", "code": "PT", "iban": "PT26003506516995234369482" }, { "name": "Czech Republic", "code": "CZ", "iban": "CZ1350515343291243261222" }, { "name": "Romania", "code": "RO", "iban": "RO64RZBR2335521926768262" }, { "name": "Slovakia", "code": "SK", "iban": "SK6053419589142643828262" }, { "name": "Slovenia", "code": "SI", "iban": "SI97975426678332786" }, { "name": "Spain", "code": "ES", "iban": "ES7231904977492569944158" }, { "name": "Sweden", "code": "SE", "iban": "SE4949996195749755572136" }, { "name": "Hungary", "code": "HU", "iban": "HU42117730161111101800000000" }, { "name": "Norway", "code": "NO", "iban": "NO9386011117947" }, { "name": "Liechtenstein", "code": "LI", "iban": "LI7008800683146527484" }, { "name": "Iceland", "code": "IS", "iban": "IS140159260076545510730339" }, { "name": "Switzerland", "code": "CH", "iban": "CH4789144623328263139" }, { "name": "United Kingdom", "code": "GB", "iban": "GB09BARC20040416289669" }, { "name": "Monaco", "code": "MC", "iban": "MC2112739000407179846124F08" }, { "name": "Andorra", "code": "AD", "iban": "AD5127638574262995775744" }, { "name": "San Marino", "code": "SM", "iban": "SM86U0322509800000000270100" }, { "name": "Holy See (Vatican City State)", "code": "VA", "iban": "VA59001123000012345678" }];
            // this.initSepaForm();
        }
        BonificoSepaComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.initSepaForm();
            this.sepaForm.valueChanges.subscribe(function () {
                // if (this.sepaForm.valid) {
                var bonificoSepa = {
                    iban: _this.sepaForm.get('iban').value,
                    delegato: _this.sepaForm.get('existsDelegatoRiscossione').value,
                    delegatoRiscossione: _this.sepaForm.get('existsDelegatoRiscossione').value ? _this.delegato : null,
                };
                var isFormValid = _this.sepaForm.valid;
                var isFormDelegatoValid = _this.sepaForm.get('existsDelegatoRiscossione').value === true ? _this.isDelegatoValid : true;
                var isValid = isFormValid && isFormDelegatoValid;
                _this.bonificoSepaReady.emit({ bonifico: bonificoSepa, isValid: isValid });
                //}
            });
        };
        BonificoSepaComponent.prototype.initSepaForm = function () {
            var _a;
            this.sepaForm = new forms.FormGroup({
                existsDelegatoRiscossione: new forms.FormControl(this.bonificoSepa != null ? this.bonificoSepa.delegato : false, [forms.Validators.required]),
                iban: new forms.FormControl((_a = this.bonificoSepa) === null || _a === void 0 ? void 0 : _a.iban, this.ibanValidators),
            });
        };
        BonificoSepaComponent.prototype.onValidateSepaPersonaFisica = function () {
            this.validateSepaPersonaFisicaEmitter.emit();
        };
        BonificoSepaComponent.prototype.onExistsDelegatoRiscossioneChange = function (tipo) {
            if (!tipo.value) {
                this.resetEstremiPersonaFisicaSepaFormEmitter.emit();
            }
        };
        BonificoSepaComponent.prototype.sepaCountriesValidator = function () {
            var _this = this;
            return function (form) {
                var iban = form.value;
                if (!iban || (iban === null || iban === void 0 ? void 0 : iban.length) < 2) {
                    return null;
                }
                var countryCode = iban.substring(0, 2);
                if (!_this.sepaCountries.some(function (element) { return element.code === countryCode; })) {
                    return { ibanExtraSepa: true };
                }
                return null;
            };
        };
        BonificoSepaComponent.prototype.onDelegatoRiscossioneReady = function (event) {
            this.delegato = event.persona;
            this.isDelegatoValid = event.isValid;
            this.personaFisicaEmitter.emit({ persona: event.persona, isValid: event.isValid });
        };
        BonificoSepaComponent.prototype.convertToUppercase = function (value) {
            this.sepaForm.get('iban').setValue(value.toUpperCase());
        };
        return BonificoSepaComponent;
    }());
    BonificoSepaComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: "lib-bonifico-sepa",
                    template: "<form [formGroup]=\"sepaForm\" [ngxsForm]=\"sepaFormPath\">\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-md-8\">\r\n\t\t\t<label id=\"existsDelegatoRiscossioneLabel\">{{ \"exists-delegato-riscossione\" | traduzione }}</label>\r\n\t\t\t<mat-radio-group class=\"radio-group\" aria-labelledby=\"existsDelegatoRiscossioneLabel\"\r\n\t\t\t\t\t\t\t\t\t\t\t formControlName=\"existsDelegatoRiscossione\"\r\n\t\t\t\t\t\t\t\t\t\t\t (change)=\"onExistsDelegatoRiscossioneChange($event)\">\r\n\t\t\t\t<mat-radio-button class=\"radio-button pl-2\" [value]=\"true\">\r\n\t\t\t\t\t{{ \"si\" | traduzione }}\r\n\t\t\t\t</mat-radio-button>\r\n\t\t\t\t<mat-radio-button class=\"radio-button pl-2\" [value]=\"false\">\r\n\t\t\t\t\t{{ \"no\" | traduzione }}\r\n\t\t\t\t</mat-radio-button>\r\n\t\t\t</mat-radio-group>\r\n\t\t\t<br/>\r\n\t\t\t<mat-hint *infoTip=\"'exists-delegato-riscossione'\"></mat-hint>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div *ngIf=\"sepaForm.controls['existsDelegatoRiscossione'].value\" class=\"row mt-3\">\r\n\t\t<div class=\"col-12\">\r\n\t\t\t<div class=\"row mt-4\">\r\n\t\t\t\t<div class=\"col-12\">\r\n\t\t\t\t\t<lib-estremi-persona-fisica [ngxsFormPath]=\"estremiPFSepaFormPath\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[province]=\"province\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[nazioni]=\"nazioni\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[isPersonaFisicaValid]=\"isPersonaFisicaSepaValid\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[personaFisica]=\"bonificoSepa?.delegatoRiscossione\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[viewSessoPF]=\"viewSessoPF\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(validatePersonaFisicaEmitter)=\"onValidateSepaPersonaFisica()\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(personaFisicaEmitter)=\"onDelegatoRiscossioneReady($event)\">\r\n\t\t\t\t\t</lib-estremi-persona-fisica>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<lib-dati-residenza [validateAndGetResidenza]=\"validateAndGetResidenza\"></lib-dati-residenza>\r\n\t</div>\r\n\t</div>\r\n\r\n\t<div class=\"row my-4 mt-4\">\r\n\t\t<div class=\"col-md-4\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input matInput placeholder=\"{{ 'required' | traduzione }}{{ 'codice-iban' | traduzione }}\"\r\n\t\t\t\t\tformControlName=\"iban\"\r\n\t\t\t\t\t(input)=\"convertToUppercase($event.target.value)\"/>\r\n\t\t\t\t<mat-error *ngIf=\"sepaForm.controls['iban'].invalid\">\r\n\t\t\t\t\t{{ getErrorMessage(sepaForm.controls['iban']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n</form>\r\n",
                    styles: [""]
                },] }
    ];
    BonificoSepaComponent.ctorParameters = function () { return []; };
    BonificoSepaComponent.propDecorators = {
        bonificoSepa: [{ type: i0.Input }],
        nazioni: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        isPersonaFisicaSepaValid: [{ type: i0.Input }],
        sepaFormPath: [{ type: i0.Input }],
        estremiPFSepaFormPath: [{ type: i0.Input }],
        viewSessoPF: [{ type: i0.Input }],
        validateAndGetResidenza: [{ type: i0.Input }],
        validateSepaPersonaFisicaEmitter: [{ type: i0.Output }],
        resetEstremiPersonaFisicaSepaFormEmitter: [{ type: i0.Output }],
        bonificoSepaReady: [{ type: i0.Output }],
        personaFisicaEmitter: [{ type: i0.Output }]
    };

    function ValidateMail(control) {
        if (formatoEmail.test(control.value)) {
            return null;
        }
        return { invalidMail: true };
    }
    function ValidateDate(control) {
        if (new Date().getTime() < control.value) {
            return { invalidDate: true };
        }
        return null;
    }
    function ValidateName(control) {
        if (formatoName.test(control.value)) {
            return null;
        }
        return { invalidName: true };
    }
    function ValidatePassword(control) {
        if (passwordPattern.test(control.value)) {
            return null;
        }
        return { invalidPassword: true };
    }
    function ValidateIban(control) {
        if (iban.test(control.value)) {
            return null;
        }
        return { invalidIban: true };
    }
    function ValidazioneData(control) {
        if (formatoData.test(control.value)) {
            return null;
        }
        return { invalidFormatDate: true };
    }
    function ValidateCodiceFiscale(control) {
        if (codiceFiscale.test(control.value)) {
            return null;
        }
        return { codiceFiscaleInvalido: true };
    }
    function ValidateCodiceFiscalePIVA(control) {
        var _a;
        if (_codiceFiscalePiva.test(control.value) && ((_a = control.value) === null || _a === void 0 ? void 0 : _a.length) >= 11) {
            return null;
        }
        return { cfInvalidoFormalmente: true };
    }
    function ValidatePartitaIva(control) {
        if (partitaIva.test(control.value)) {
            return null;
        }
        return { cfInvalidoFormalmente: true };
    }
    function ValidateImportoFormato(valoreImporto) {
        return /^[0-9]*,[0-9]{2}$/.test(valoreImporto);
    }
    function ValidatoreSwift(control) {
        if (formatoSwift.test(control.value)) {
            return null;
        }
        return { invalidSwift: true };
    }
    function ValidatePhone(control) {
        if (!control.value || phoneNumberPattern.test(control.value)) {
            return null;
        }
        return { pattern: true };
    }

    var ModalitaPagamentoService = /** @class */ (function () {
        function ModalitaPagamentoService(http, configurationService, appRef) {
            var _this = this;
            this.http = http;
            this.configurationService = configurationService;
            this.appRef = appRef;
            console.log('[ModalitaPagamentoService]');
            this.urlAnagrafe = configurationService.servicePaths.get("ANAGRAFE_MS_API_URL") + "/v1";
            console.log('[urlAnagrafe - lib]', this.urlAnagrafe);
            var lingua$ = configurationService.lingua$;
            // console.log('[lingua]', configurationService.servicePaths.get("I18N_MS_API_URL"));
            //TODO
            // const urlNazioni: string = this.paths.get_V1Nazioni();
            var urlNazioni = this.urlAnagrafe + "/nazioni";
            // console.log('[urlNazioni]', urlNazioni);
            this.nazioni$ = lingua$.pipe(operators.switchMap(function (lingua) { return _this.http.get(urlNazioni, { headers: new i1.HttpHeaders({ 'i18n_language': lingua }) }); }), operators.tap(function (_) { return appRef.tick(); }), operators.shareReplay());
            //TODO
            // const urlProvince: string = this.paths.get_V1Province();
            var urlProvince = this.urlAnagrafe + '/province';
            // console.log('[urlProvince]', urlProvince);
            // TODO
            // const urlRegioni: string = this.urlAnagrafe + '/regioni';
            var urlRegioni = this.urlAnagrafe + '/regioni/nonSoppresse/';
            //TODO
            // this.province$ = this.http.get<Array<Localita>>(urlProvince);
            this.province$ = lingua$.pipe(operators.switchMap(function (lingua) { return _this.http.get(urlProvince, { headers: new i1.HttpHeaders({ 'i18n_language': lingua }) }); }), operators.tap(function (_) { return appRef.tick(); }), operators.shareReplay());
            this.regioni$ = lingua$.pipe(operators.switchMap(function (lingua) { return _this.http.get(urlRegioni, { headers: new i1.HttpHeaders({ 'i18n_language': lingua }) }); }), operators.tap(function (_) { return appRef.tick(); }), operators.shareReplay());
        }
        ModalitaPagamentoService.prototype.getProvince$ = function () {
            return this.province$;
        };
        ModalitaPagamentoService.prototype.getProvincePerRegione$ = function (regione) {
            var _this = this;
            //TODO
            // return this.configurationService.lingua$
            // 	.pipe(switchMap(lingua => this.http.get<Array<Localita>>(
            // 		this.urlAnagrafe + `/regione/${regione.sigla}/province`,
            // 		{ headers: new HttpHeaders({ 'i18n_language': lingua }) }
            // 	)));
            var url = this.urlAnagrafe + "/regione/" + regione.sigla + "/province/nonSoppresse/?codiceRegione=" + regione.sigla;
            return this.configurationService.lingua$.pipe(operators.switchMap(function (lingua) { return _this.http.get(url, { headers: new i1.HttpHeaders({ 'i18n_language': lingua }) }); }), operators.tap(function (_) { return _this.appRef.tick(); }), operators.shareReplay());
        };
        ModalitaPagamentoService.prototype.getComuni$ = function (siglaProvincia) {
            //TODO
            // const url: string = this.paths.get_V1ComuniByProvincia(siglaProvincia);
            // const url: string = `${this.urlAnagrafe}/provincia/${siglaProvincia}/comuni`
            var url = this.urlAnagrafe + "/provincia/" + siglaProvincia + "/comuni/nonSoppressi";
            return this.http.get(url).pipe(operators.shareReplay());
        };
        ModalitaPagamentoService.prototype.getComune$ = function (codiceCatastale) {
            var url = this.urlAnagrafe + "/comune/codiceCatastale/" + codiceCatastale;
            return this.http.get(url).pipe(operators.shareReplay());
        };
        ModalitaPagamentoService.prototype.getNazioni$ = function () {
            return this.nazioni$;
        };
        ModalitaPagamentoService.prototype.getCap$ = function (idComune) {
            //TODO
            // const url: string = this.paths.get_V1CapByIdComune(idComune);
            var url = this.urlAnagrafe + "/comuni/" + idComune + "/cap";
            return this.http.get(url);
        };
        ModalitaPagamentoService.prototype.getRegioni$ = function () {
            return this.regioni$;
        };
        return ModalitaPagamentoService;
    }());
    ModalitaPagamentoService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ModalitaPagamentoService_Factory() { return new ModalitaPagamentoService(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(ConfigurationService), i0.ɵɵinject(i0.ApplicationRef)); }, token: ModalitaPagamentoService, providedIn: "root" });
    ModalitaPagamentoService.decorators = [
        { type: i0.Injectable, args: [{
                    providedIn: 'root',
                },] }
    ];
    ModalitaPagamentoService.ctorParameters = function () { return [
        { type: i1.HttpClient },
        { type: ConfigurationService },
        { type: i0.ApplicationRef }
    ]; };

    var EstremiPersonaFisicaComponent = /** @class */ (function () {
        function EstremiPersonaFisicaComponent(modalitaPagamentoService) {
            this.modalitaPagamentoService = modalitaPagamentoService;
            this.viewSessoPF = false;
            this.validatePersonaFisicaEmitter = new i0.EventEmitter();
            this.personaFisicaEmitter = new i0.EventEmitter();
            this.maxDataNascita = new Date();
            this.subscription = new rxjs.Subscription();
            this.getErrorMessage = getErrorMessage;
            this.getDateErrorMessage = getDateErrorMessage;
            // this.initPersonaFisicaForm();
            // this.setCodiceFiscaleValidators();
        }
        Object.defineProperty(EstremiPersonaFisicaComponent.prototype, "_disableForm", {
            set: function (val) {
                this.disableForm = val;
                if (this.disableForm) {
                    this.estremiPersonaFisicaForm.disable();
                    this.validatePersonaFisicaEmitter.emit();
                }
                else {
                    this.estremiPersonaFisicaForm.enable();
                }
            },
            enumerable: false,
            configurable: true
        });
        EstremiPersonaFisicaComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.initPersonaFisicaForm();
            this.setFormControlsValue();
            this.setCodiceFiscaleValidators();
            // Set/Unset form controls validation on isNatoEstero Value Change
            this.subscription.add(this.estremiPersonaFisicaForm.controls['isNatoEstero'].valueChanges.subscribe(function (isNatoEstero) {
                if (isNatoEstero) {
                    _this.estremiPersonaFisicaForm.controls['provinciaNascita'].setValidators([]);
                    _this.estremiPersonaFisicaForm.controls['provinciaNascita'].patchValue(null);
                    _this.estremiPersonaFisicaForm.controls['provinciaNascita'].updateValueAndValidity();
                    _this.estremiPersonaFisicaForm.controls['codiceComuneNascita'].setValidators([]);
                    _this.estremiPersonaFisicaForm.controls['codiceComuneNascita'].patchValue(null);
                    _this.estremiPersonaFisicaForm.controls['codiceComuneNascita'].updateValueAndValidity();
                    _this.estremiPersonaFisicaForm.controls['nazioneNascita'].setValidators([forms.Validators.required]);
                    _this.estremiPersonaFisicaForm.controls['nazioneNascita'].updateValueAndValidity();
                }
                else {
                    _this.estremiPersonaFisicaForm.controls['provinciaNascita'].setValidators([forms.Validators.required]);
                    _this.estremiPersonaFisicaForm.controls['provinciaNascita'].updateValueAndValidity();
                    _this.estremiPersonaFisicaForm.controls['codiceComuneNascita'].setValidators([forms.Validators.required]);
                    _this.estremiPersonaFisicaForm.controls['codiceComuneNascita'].updateValueAndValidity();
                    _this.estremiPersonaFisicaForm.controls['nazioneNascita'].setValidators([]);
                    _this.estremiPersonaFisicaForm.controls['nazioneNascita'].patchValue(null);
                    _this.estremiPersonaFisicaForm.controls['nazioneNascita'].updateValueAndValidity();
                }
            }));
            this.getComuniOnProvinciaChange();
            this.validatePersonaFisica();
            this.personaFisicaEmit();
        };
        EstremiPersonaFisicaComponent.prototype.getComuniOnProvinciaChange = function () {
            var _this = this;
            this.subscription.add(this.estremiPersonaFisicaForm.controls['provinciaNascita'].valueChanges.pipe(operators.distinctUntilChanged(), operators.switchMap(function (siglaProvinciaNascita) { return rxjs.iif(function () { return !!siglaProvinciaNascita; }, _this.modalitaPagamentoService.getComuni$(siglaProvinciaNascita).pipe(operators.take(1)), rxjs.of([])); })).subscribe(function (comuni) {
                _this.comuni = comuni;
            }));
        };
        EstremiPersonaFisicaComponent.prototype.validatePersonaFisica = function () {
            var _this = this;
            this.subscription.add(this.estremiPersonaFisicaForm.valueChanges.pipe(operators.debounceTime(500), operators.filter(function () { return _this.estremiPersonaFisicaForm.valid; })).subscribe(function (_) {
                _this.validatePersonaFisicaEmitter.emit();
            }));
        };
        EstremiPersonaFisicaComponent.prototype.personaFisicaEmit = function () {
            var _this = this;
            this.subscription.add(this.estremiPersonaFisicaForm.valueChanges.pipe(operators.debounceTime(500)).subscribe(function (_) {
                var personaFisica = {
                    infoAnagrafiche: {
                        codFiscale: _this.estremiPersonaFisicaForm.controls['codiceFiscale'].value,
                        cognome: _this.estremiPersonaFisicaForm.controls['cognome'].value,
                        nome: _this.estremiPersonaFisicaForm.controls['nome'].value
                    },
                    infoNascita: {
                        comuneNascita: _this.estremiPersonaFisicaForm.controls['codiceComuneNascita'].value,
                        provinciaNascita: _this.estremiPersonaFisicaForm.controls['provinciaNascita'].value,
                        dataNascita: _this.estremiPersonaFisicaForm.controls['dataNascita'].value
                    }
                };
                var isValid = _this.estremiPersonaFisicaForm.valid;
                _this.personaFisicaEmitter.emit({ persona: personaFisica ? personaFisica : null, isValid: isValid });
            }));
        };
        EstremiPersonaFisicaComponent.prototype.initPersonaFisicaForm = function () {
            this.estremiPersonaFisicaForm = new forms.FormGroup({
                codiceFiscale: new forms.FormControl(null),
                nome: new forms.FormControl(null, [forms.Validators.required, ValidateName]),
                cognome: new forms.FormControl(null, [forms.Validators.required, ValidateName]),
                isNatoEstero: new forms.FormControl(false),
                provinciaNascita: new forms.FormControl(null),
                codiceComuneNascita: new forms.FormControl(null),
                nazioneNascita: new forms.FormControl(null),
                dataNascita: new forms.FormControl(null, [forms.Validators.required]),
                sesso: new forms.FormControl(null, this.viewSessoPF ? [forms.Validators.required] : [])
            });
        };
        EstremiPersonaFisicaComponent.prototype.setCodiceFiscaleValidators = function () {
            this.estremiPersonaFisicaForm.controls['codiceFiscale'].setValidators([
                forms.Validators.required,
                ValidateCodiceFiscalePIVA
            ]);
        };
        EstremiPersonaFisicaComponent.prototype.ngOnDestroy = function () {
            this.subscription.unsubscribe();
        };
        EstremiPersonaFisicaComponent.prototype.convertToUppercase = function (event) {
            this.estremiPersonaFisicaForm.get('codiceFiscale').setValue(event.target.value.toUpperCase());
        };
        EstremiPersonaFisicaComponent.prototype.onProvinciaChange = function () {
            this.estremiPersonaFisicaForm.controls['codiceComuneNascita'].patchValue(null);
            this.estremiPersonaFisicaForm.controls['codiceComuneNascita'].markAsTouched();
        };
        EstremiPersonaFisicaComponent.prototype.setFormControlsValue = function () {
            var _a;
            this.estremiPersonaFisicaForm.controls['codiceFiscale'].setValue(this.personaFisica ? this.personaFisica.infoAnagrafiche.codFiscale : null);
            this.estremiPersonaFisicaForm.controls['nome'].setValue(this.personaFisica ? this.personaFisica.infoAnagrafiche.nome : null);
            this.estremiPersonaFisicaForm.controls['cognome'].setValue(this.personaFisica ? this.personaFisica.infoAnagrafiche.cognome : null);
            this.estremiPersonaFisicaForm.controls['isNatoEstero'].setValue(this.personaFisica && this.personaFisica.infoNascita.comuneNascita.startsWith("Z") ? true : false);
            this.estremiPersonaFisicaForm.controls['provinciaNascita'].setValue(this.personaFisica && !this.personaFisica.infoNascita.comuneNascita.startsWith("Z") ? this.personaFisica.infoNascita.provinciaNascita : null);
            this.estremiPersonaFisicaForm.controls['codiceComuneNascita'].setValue(this.personaFisica && !this.personaFisica.infoNascita.comuneNascita.startsWith("Z") ? this.personaFisica.infoNascita.comuneNascita : null);
            this.estremiPersonaFisicaForm.controls['dataNascita'].setValue(this.personaFisica ? this.personaFisica.infoNascita.dataNascita : null);
            // TODO
            this.estremiPersonaFisicaForm.controls['sesso'].setValue(this.viewSessoPF ? 'M' : null);
            this.estremiPersonaFisicaForm.controls['nazioneNascita'].setValue(this.personaFisica && this.personaFisica.infoNascita.comuneNascita.startsWith("Z") ? (_a = this.personaFisica.infoNascita) === null || _a === void 0 ? void 0 : _a.comuneNascita : null);
        };
        return EstremiPersonaFisicaComponent;
    }());
    EstremiPersonaFisicaComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-estremi-persona-fisica',
                    template: "<form [formGroup]=\"estremiPersonaFisicaForm\" [ngxsForm]=\"ngxsFormPath\">\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-12 col-lg-4 mt-2 mt-lg-0\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input formControlName=\"codiceFiscale\"\r\n\t\t\t\t\t\tmatInput\r\n\t\t\t\t\t\t[maxlength]=\"16\"\r\n\t\t\t\t\t\tplaceholder=\"{{ 'required' | traduzione }} {{ 'codice-fiscale' | traduzione }}\"\r\n\t\t\t\t\t\t(input)=\"convertToUppercase($event)\" />\r\n\t\t\t\t<mat-error *ngIf=\"estremiPersonaFisicaForm.controls['codiceFiscale'].invalid\">\r\n\t\t\t\t\t{{ getErrorMessage(estremiPersonaFisicaForm.controls['codiceFiscale']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-12 col-lg-4 mt-2 mt-lg-0\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input formControlName=\"nome\"\r\n\t\t\t\t\t\tmatInput\r\n\t\t\t\t\t\t[maxlength]=\"100\"\r\n\t\t\t\t\t\tplaceholder=\"{{ 'required' | traduzione }} {{ 'nome' | traduzione }}\"/>\r\n\t\t\t\t<mat-error *ngIf=\"estremiPersonaFisicaForm?.controls['nome'].invalid\">\r\n\t\t\t\t\t{{ getErrorMessage(estremiPersonaFisicaForm.controls['nome']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div class=\"col-12 col-lg-4 mt-2 mt-lg-0\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input formControlName=\"cognome\"\r\n\t\t\t\t\t\tmatInput\r\n\t\t\t\t\t\t[maxlength]=\"100\"\r\n\t\t\t\t\t\tplaceholder=\"{{ 'required' | traduzione }} {{ 'cognome' | traduzione }}\"/>\r\n\t\t\t\t<mat-error *ngIf=\"estremiPersonaFisicaForm?.controls['cognome'].invalid\">\r\n\t\t\t\t\t{{ getErrorMessage(estremiPersonaFisicaForm.controls['cognome']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-12 pt-3 pb-2 pt-lg-2 pb-lg-2\">\r\n\t\t\t<mat-checkbox formControlName=\"isNatoEstero\"\r\n\t\t\t\t\t\t  color=\"primary\">\r\n\t\t\t\t<info-tip-label label=\"localita-nascita-estera\"></info-tip-label>\r\n\t\t\t</mat-checkbox>\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"row\">\r\n\t\t<ng-container *ngIf=\"!estremiPersonaFisicaForm?.controls['isNatoEstero']?.value else nascitaEstera\">\r\n\t\t\t<div class=\"col-12 col-lg-4 mt-2 mt-lg-0\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{ 'provincia-nascita' | traduzione }}</mat-label>\r\n\t\t\t\t\t<mat-select [placeholder]=\"'seleziona' | traduzione\" formControlName=\"provinciaNascita\" (valueChange)=\"onProvinciaChange()\">\r\n\t\t\t\t\t\t<mat-option *ngFor=\"let provincia of province\" [value]=\"provincia.sigla\">\r\n\t\t\t\t\t\t\t{{ provincia.denominazione }}\r\n\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t<mat-error *ngIf=\"estremiPersonaFisicaForm.controls['provinciaNascita'].invalid\">\r\n\t\t\t\t\t\t{{ 'obbligatorio' | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"col-12 col-lg-4 mt-2 mt-lg-0\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{ 'comune-nascita' | traduzione }}</mat-label>\r\n\t\t\t\t\t<mat-select placeholder=\"{{ 'seleziona' | traduzione }}\" formControlName=\"codiceComuneNascita\">\r\n\t\t\t\t\t\t<mat-option *ngFor=\"let comune of comuni\" [value]=\"comune.codiceCatastale\">\r\n\t\t\t\t\t\t\t{{ comune.denominazione }}\r\n\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t<mat-error *ngIf=\"estremiPersonaFisicaForm.controls['codiceComuneNascita'].invalid\">\r\n\t\t\t\t\t\t{{ 'obbligatorio' | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t</ng-container>\r\n\t\t<ng-template #nascitaEstera>\r\n\t\t\t<div class=\"col-12 col-lg-4 mt-2 mt-lg-0\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{ 'nazione-nascita' | traduzione }}</mat-label>\r\n\t\t\t\t\t<mat-select [placeholder]=\"'seleziona' | traduzione\" formControlName=\"nazioneNascita\">\r\n\t\t\t\t\t\t<mat-option *ngFor=\"let nazione of nazioni\" [value]=\"nazione.codiceCatastale\">\r\n\t\t\t\t\t\t\t{{ nazione.denominazione }}\r\n\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t<mat-error *ngIf=\"estremiPersonaFisicaForm.controls['nazioneNascita'].invalid\">\r\n\t\t\t\t\t\t{{ 'obbligatorio' | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t</ng-template>\r\n\t\t<div class=\"col-12\" [ngClass]=\"viewSessoPF ?\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\testremiPersonaFisicaForm?.controls['isNatoEstero']?.value ? ' col-lg-4 mt-2 mt-lg-0'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: ' col-lg-2 mt-2 mt-lg-0'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: ' col-lg-4 mt-2 mt-lg-0'\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input formControlName=\"dataNascita\"\r\n\t\t\t\t\t\t[max]=\"maxDataNascita\"\r\n\t\t\t\t\t\tmatInput\r\n\t\t\t\t\t\t[matDatepicker]=\"dataNascita\"\r\n\t\t\t\t\t\t[placeholder]=\"('required' | traduzione) + ('data-nascita' | traduzione)\">\r\n\t\t\t\t<mat-datepicker-toggle matSuffix [for]=\"dataNascita\"></mat-datepicker-toggle>\r\n\t\t\t\t<mat-datepicker #dataNascita></mat-datepicker>\r\n\t\t\t\t<mat-error *ngIf=\"estremiPersonaFisicaForm.controls['dataNascita'].invalid\">\r\n\t\t\t\t\t{{ getDateErrorMessage(estremiPersonaFisicaForm.controls['dataNascita']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-hint *infoTip=\"'formato-data'\"></mat-hint>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"viewSessoPF\" class=\"col-12 col-lg-2 mt-2 mt-lg-0\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{ 'sesso' | traduzione }}</mat-label>\r\n\t\t\t\t<mat-select [placeholder]=\"'seleziona' | traduzione\" formControlName=\"sesso\">\r\n\t\t\t\t\t<mat-option [value]=\"null\"> {{ \"seleziona\" | traduzione }} </mat-option>\r\n\t\t\t\t\t<mat-option value=\"M\">{{ \"maschio\" | traduzione }}</mat-option>\r\n\t\t\t\t\t<mat-option value=\"F\">{{ \"femmina\" | traduzione }}</mat-option>\r\n\t\t\t\t</mat-select>\r\n\t\t\t\t<mat-error *ngIf=\"estremiPersonaFisicaForm.controls['sesso'].invalid\">\r\n\t\t\t\t\t{{ 'obbligatorio' | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-12 mt-2 mt-lg-0\">\r\n\t\t\t<mat-error *ngIf=\"!isPersonaFisicaValid && (estremiPersonaFisicaForm.dirty)\">\r\n\t\t\t\t{{'invalid-dati-anagrafici' | traduzione }}\r\n\t\t\t</mat-error>\r\n\t\t</div>\r\n\t</div>\r\n</form>\r\n\r\n",
                    styles: [""]
                },] }
    ];
    EstremiPersonaFisicaComponent.ctorParameters = function () { return [
        { type: ModalitaPagamentoService }
    ]; };
    EstremiPersonaFisicaComponent.propDecorators = {
        ngxsFormPath: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        nazioni: [{ type: i0.Input }],
        isPersonaFisicaValid: [{ type: i0.Input }],
        personaFisica: [{ type: i0.Input }],
        viewSessoPF: [{ type: i0.Input }],
        validatePersonaFisicaEmitter: [{ type: i0.Output }],
        personaFisicaEmitter: [{ type: i0.Output }],
        _disableForm: [{ type: i0.Input, args: ['disableForm',] }]
    };

    var BonificoExtraSepaComponent = /** @class */ (function () {
        function BonificoExtraSepaComponent() {
            this.viewSessoPF = false;
            this.validateExtraSepaPersonaFisicaEmitter = new i0.EventEmitter();
            this.resetEstremiPersonaFisicaExtraSepaFormEmitter = new i0.EventEmitter();
            this.bonificoExtraSepaReady = new i0.EventEmitter();
            this.personaFisicaEmitter = new i0.EventEmitter();
            this.ibanValidators = [forms.Validators.required, this.extraSepaCountriesValidator(), ngxIban.ibanValidator()];
            this.codiceContoValidators = [forms.Validators.required, this.ValidateNotIban, forms.Validators.maxLength(44)];
            this.subscription = new rxjs.Subscription();
            this.getErrorMessage = getErrorMessage;
            this.sepaCountries = [{ "name": "Austria", "code": "AT", "iban": "AT493200056563289974" }, { "name": "Belgium", "code": "BE", "iban": "BE65561689528896" }, { "name": "Bulgaria", "code": "BG", "iban": "BG92TTBB94006559266188" }, { "name": "Cyprus", "code": "CY", "iban": "CY52665561416772369457864437" }, { "name": "Croatia", "code": "HR", "iban": "HR5523400098663266246" }, { "name": "Denmark", "code": "DK", "iban": "DK2550515918328528" }, { "name": "Estonia", "code": "EE", "iban": "EE591286653867491786" }, { "name": "Finland", "code": "FI", "iban": "FI8479486911788598" }, { "name": "France", "code": "FR", "iban": "FR8514508000707239488738J21" }, { "name": "Germany", "code": "DE", "iban": "DE14500105174185484177" }, { "name": "Greece", "code": "GR", "iban": "GR9201494491588141549531799" }, { "name": "Ireland", "code": "IE", "iban": "IE29AIBK93115212345678" }, { "name": "Italy", "code": "IT", "iban": "IT77R0300203280648419668253" }, { "name": "Latvia", "code": "LV", "iban": "LV80BANK0000435195001" }, { "name": "Lithuania", "code": "LT", "iban": "LT275168179993645428" }, { "name": "Luxembourg", "code": "LU", "iban": "LU350106814331716425" }, { "name": "Malta", "code": "MT", "iban": "MT54WLCI12377529685589454747835" }, { "name": "Netherlands", "code": "NL", "iban": "NL13INGB6755037397" }, { "name": "Poland", "code": "PL", "iban": "PL06109024023962236263666664" }, { "name": "Portugal", "code": "PT", "iban": "PT26003506516995234369482" }, { "name": "Czech Republic", "code": "CZ", "iban": "CZ1350515343291243261222" }, { "name": "Romania", "code": "RO", "iban": "RO64RZBR2335521926768262" }, { "name": "Slovakia", "code": "SK", "iban": "SK6053419589142643828262" }, { "name": "Slovenia", "code": "SI", "iban": "SI97975426678332786" }, { "name": "Spain", "code": "ES", "iban": "ES7231904977492569944158" }, { "name": "Sweden", "code": "SE", "iban": "SE4949996195749755572136" }, { "name": "Hungary", "code": "HU", "iban": "HU42117730161111101800000000" }, { "name": "Norway", "code": "NO", "iban": "NO9386011117947" }, { "name": "Liechtenstein", "code": "LI", "iban": "LI7008800683146527484" }, { "name": "Iceland", "code": "IS", "iban": "IS140159260076545510730339" }, { "name": "Switzerland", "code": "CH", "iban": "CH4789144623328263139" }, { "name": "United Kingdom", "code": "GB", "iban": "GB09BARC20040416289669" }, { "name": "Monaco", "code": "MC", "iban": "MC2112739000407179846124F08" }, { "name": "Andorra", "code": "AD", "iban": "AD5127638574262995775744" }, { "name": "San Marino", "code": "SM", "iban": "SM86U0322509800000000270100" }, { "name": "Holy See (Vatican City State)", "code": "VA", "iban": "VA59001123000012345678" }];
            // this.initExtraSepaForm();
        }
        BonificoExtraSepaComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.initExtraSepaForm();
            this.subscription.add(this.extraSepaForm.controls['codiceContoPresent'].valueChanges.subscribe(function (codiceContoPresent) {
                if (codiceContoPresent) {
                    _this.extraSepaForm.controls['iban'].setValidators([]);
                    _this.extraSepaForm.controls['iban'].patchValue(null);
                    _this.extraSepaForm.controls['iban'].updateValueAndValidity();
                    _this.extraSepaForm.controls['codiceConto'].setValidators(_this.codiceContoValidators);
                    _this.extraSepaForm.controls['codiceConto'].updateValueAndValidity();
                }
                else {
                    _this.extraSepaForm.controls['codiceConto'].setValidators([]);
                    _this.extraSepaForm.controls['codiceConto'].patchValue(null);
                    _this.extraSepaForm.controls['codiceConto'].updateValueAndValidity();
                    _this.extraSepaForm.controls['iban'].setValidators(_this.ibanValidators);
                    _this.extraSepaForm.controls['iban'].updateValueAndValidity();
                }
            }));
            this.subscription.add(this.extraSepaForm.controls['swiftBicPresent'].valueChanges.subscribe(function (swiftBicPresent) {
                if (swiftBicPresent) {
                    _this.extraSepaForm.controls['swift'].setValidators([forms.Validators.required, forms.Validators.maxLength(11), forms.Validators.minLength(8)]);
                    _this.extraSepaForm.controls['swift'].updateValueAndValidity();
                    _this.extraSepaForm.controls['nazione'].setValidators([]);
                    _this.extraSepaForm.controls['nazione'].patchValue(null);
                    _this.extraSepaForm.controls['nazione'].updateValueAndValidity();
                    _this.extraSepaForm.controls['citta'].setValidators([]);
                    _this.extraSepaForm.controls['citta'].patchValue(null);
                    _this.extraSepaForm.controls['citta'].updateValueAndValidity();
                    _this.extraSepaForm.controls['banca'].setValidators([]);
                    _this.extraSepaForm.controls['banca'].patchValue(null);
                    _this.extraSepaForm.controls['banca'].updateValueAndValidity();
                    _this.extraSepaForm.controls['indirizzo'].setValidators([]);
                    _this.extraSepaForm.controls['indirizzo'].patchValue(null);
                    _this.extraSepaForm.controls['indirizzo'].updateValueAndValidity();
                    _this.extraSepaForm.controls['zipCode'].setValidators([]);
                    _this.extraSepaForm.controls['zipCode'].patchValue(null);
                    _this.extraSepaForm.controls['zipCode'].updateValueAndValidity();
                    _this.extraSepaForm.controls['civico'].setValidators([]);
                    _this.extraSepaForm.controls['civico'].updateValueAndValidity();
                    _this.extraSepaForm.controls['civico'].patchValue(null);
                }
                else {
                    _this.extraSepaForm.controls['swift'].setValidators([]);
                    _this.extraSepaForm.controls['swift'].patchValue(null);
                    _this.extraSepaForm.controls['swift'].updateValueAndValidity();
                    _this.extraSepaForm.controls['nazione'].setValidators([forms.Validators.required]);
                    _this.extraSepaForm.controls['nazione'].updateValueAndValidity();
                    _this.extraSepaForm.controls['citta'].setValidators([forms.Validators.required]);
                    _this.extraSepaForm.controls['citta'].updateValueAndValidity();
                    _this.extraSepaForm.controls['banca'].setValidators([forms.Validators.required]);
                    _this.extraSepaForm.controls['banca'].updateValueAndValidity();
                    _this.extraSepaForm.controls['indirizzo'].setValidators([forms.Validators.required]);
                    _this.extraSepaForm.controls['indirizzo'].updateValueAndValidity();
                    _this.extraSepaForm.controls['zipCode'].setValidators([forms.Validators.required]);
                    _this.extraSepaForm.controls['zipCode'].updateValueAndValidity();
                    _this.extraSepaForm.controls['civico'].setValidators([forms.Validators.required]);
                    _this.extraSepaForm.controls['civico'].updateValueAndValidity();
                }
            }));
            this.extraSepaForm.valueChanges.subscribe(function () {
                // if (this.extraSepaForm.valid) {
                var bonificoExtraSepa = {
                    swift: _this.extraSepaForm.get('swift').value,
                    codiceContoPresent: _this.extraSepaForm.get('codiceContoPresent').value,
                    codiceConto: _this.extraSepaForm.get('codiceConto').value,
                    iban: _this.extraSepaForm.get('iban').value,
                    delegato: _this.extraSepaForm.get('existsDelegatoRiscossione').value,
                    delegatoRiscossione: _this.extraSepaForm.get('existsDelegatoRiscossione').value ? _this.delegato : null,
                    banca: _this.extraSepaForm.get('banca').value,
                    filiale: _this.extraSepaForm.get('citta').value,
                    indirizzo: _this.extraSepaForm.get('indirizzo').value,
                    swiftBicPresent: _this.extraSepaForm.get('swiftBicPresent').value,
                    nazione: _this.extraSepaForm.get('nazione').value,
                    zipCode: _this.extraSepaForm.get('zipCode').value,
                    codiceProvincia: 'EE',
                    civico: _this.extraSepaForm.get('civico').value,
                };
                var isFormValid = _this.extraSepaForm.valid;
                var isFormDelegatoValid = _this.extraSepaForm.get('existsDelegatoRiscossione').value === true ? _this.isDelegatoValid : true;
                var isValid = isFormValid && isFormDelegatoValid;
                _this.bonificoExtraSepaReady.emit({ bonifico: bonificoExtraSepa, isValid: isValid });
                //}
            });
        };
        BonificoExtraSepaComponent.prototype.initExtraSepaForm = function () {
            var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
            this.extraSepaForm = new forms.FormGroup({
                existsDelegatoRiscossione: new forms.FormControl(this.bonificoExtraSepa != null ? this.bonificoExtraSepa.delegato : false, [forms.Validators.required]),
                swift: new forms.FormControl((_a = this.bonificoExtraSepa) === null || _a === void 0 ? void 0 : _a.swift, [forms.Validators.required, forms.Validators.maxLength(11), forms.Validators.minLength(8)]),
                banca: new forms.FormControl((_b = this.bonificoExtraSepa) === null || _b === void 0 ? void 0 : _b.banca, [forms.Validators.required]),
                indirizzo: new forms.FormControl((_c = this.bonificoExtraSepa) === null || _c === void 0 ? void 0 : _c.indirizzo, [forms.Validators.required]),
                codiceContoPresent: new forms.FormControl(this.bonificoExtraSepa != null ? this.bonificoExtraSepa.codiceContoPresent : false, [forms.Validators.required]),
                codiceConto: new forms.FormControl((_d = this.bonificoExtraSepa) === null || _d === void 0 ? void 0 : _d.codiceConto, this.codiceContoValidators),
                iban: new forms.FormControl((_e = this.bonificoExtraSepa) === null || _e === void 0 ? void 0 : _e.iban, this.ibanValidators),
                swiftBicPresent: new forms.FormControl(((_f = this.bonificoExtraSepa) === null || _f === void 0 ? void 0 : _f.swift) ? true : false, [forms.Validators.required]),
                nazione: new forms.FormControl((_g = this.bonificoExtraSepa) === null || _g === void 0 ? void 0 : _g.nazione, [forms.Validators.required]),
                citta: new forms.FormControl((_h = this.bonificoExtraSepa) === null || _h === void 0 ? void 0 : _h.filiale, [forms.Validators.required]),
                zipCode: new forms.FormControl((_j = this.bonificoExtraSepa) === null || _j === void 0 ? void 0 : _j.zipCode, [forms.Validators.required]),
                civico: new forms.FormControl((_k = this.bonificoExtraSepa) === null || _k === void 0 ? void 0 : _k.civico, [forms.Validators.required]),
            });
        };
        BonificoExtraSepaComponent.prototype.ngOnDestroy = function () {
            this.subscription.unsubscribe();
        };
        BonificoExtraSepaComponent.prototype.onValidateExtraSepaPersonaFisica = function () {
            this.validateExtraSepaPersonaFisicaEmitter.emit();
        };
        BonificoExtraSepaComponent.prototype.onExistsDelegatoRiscossioneChange = function (tipo) {
            if (!tipo.value) {
                this.isDelegatoValid = true;
                this.resetEstremiPersonaFisicaExtraSepaFormEmitter.emit();
            }
        };
        BonificoExtraSepaComponent.prototype.byCode = function (n1, n2) {
            return (n1 === null || n1 === void 0 ? void 0 : n1.codiceCatastale) == (n2 === null || n2 === void 0 ? void 0 : n2.codiceCatastale);
        };
        BonificoExtraSepaComponent.prototype.ValidateNotIban = function (control) {
            if (!control.value) {
                return null;
            }
            var ibanRegex = /^(?:(?:IT|SM)\d{2}[A-Z]\d{22}|CY\d{2}[A-Z]\d{23}|NL\d{2}[A-Z]{4}\d{10}|LV\d{2}[A-Z]{4}\d{13}|(?:BG|BH|GB|IE)\d{2}[A-Z]{4}\d{14}|GI\d{2}[A-Z]{4}\d{15}|RO\d{2}[A-Z]{4}\d{16}|KW\d{2}[A-Z]{4}\d{22}|MT\d{2}[A-Z]{4}\d{23}|NO\d{13}|(?:DK|FI|GL|FO)\d{16}|MK\d{17}|(?:AT|EE|KZ|LU|XK)\d{18}|(?:BA|HR|LI|CH|CR)\d{19}|(?:GE|DE|LT|ME|RS)\d{20}|IL\d{21}|(?:AD|CZ|ES|MD|SA)\d{22}|PT\d{23}|(?:BE|IS)\d{24}|(?:FR|MR|MC)\d{25}|(?:AL|DO|LB|PL)\d{26}|(?:AZ|HU)\d{27}|(?:GR|MU)\d{28})$/;
            if (ibanRegex.test(control.value.toString().trim())) {
                return { codiceContoSchouldNotBeIban: true };
            }
            return null;
        };
        BonificoExtraSepaComponent.prototype.extraSepaCountriesValidator = function () {
            var _this = this;
            return function (form) {
                var iban = form.value;
                if (!iban || (iban === null || iban === void 0 ? void 0 : iban.length) < 2) {
                    return null;
                }
                var countryCode = iban.substring(0, 2);
                if (_this.sepaCountries.some(function (element) { return element.code === countryCode; })) {
                    return { ibanSepa: true };
                }
                return null;
            };
        };
        BonificoExtraSepaComponent.prototype.onDelegatoRiscossioneReady = function (event) {
            this.delegato = event.persona;
            this.isDelegatoValid = event.isValid;
            this.personaFisicaEmitter.emit({ persona: event.persona, isValid: event.isValid });
        };
        BonificoExtraSepaComponent.prototype.convertToUppercase = function (value) {
            if (this.extraSepaForm.controls['codiceContoPresent'].value) {
                this.extraSepaForm.get('codiceConto').setValue(value.toUpperCase());
            }
            else {
                this.extraSepaForm.get('iban').setValue(value.toUpperCase());
            }
        };
        return BonificoExtraSepaComponent;
    }());
    BonificoExtraSepaComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-bonifico-extra-sepa',
                    template: "<ng-container [formGroup]=\"extraSepaForm\" [ngxsForm]=\"extraSepaFormPath\">\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-md-8\">\r\n\t\t\t<label id=\"existsDelegatoRiscossioneLabel\">{{ \"exists-delegato-riscossione\" | traduzione }}</label>\r\n\t\t\t<mat-radio-group class=\"radio-group\"\r\n\t\t\t\t\t\t\t aria-labelledby=\"existsDelegatoRiscossioneLabel\"\r\n\t\t\t\t\t\t\t formControlName=\"existsDelegatoRiscossione\"\r\n\t\t\t\t\t\t\t (change)=\"onExistsDelegatoRiscossioneChange($event)\">\r\n\t\t\t\t<mat-radio-button class=\"radio-button pl-2\" [value]=\"true\">\r\n\t\t\t\t\t{{ \"si\" | traduzione }}\r\n\t\t\t\t</mat-radio-button>\r\n\r\n\t\t\t\t<mat-radio-button class=\"radio-button pl-2\" [value]=\"false\">\r\n\t\t\t\t\t{{ \"no\" | traduzione }}\r\n\t\t\t\t</mat-radio-button>\r\n\t\t\t</mat-radio-group>\r\n\t\t\t<br /><br />\r\n\t\t\t<mat-hint *infoTip=\"'exists-delegato-riscossione'\"></mat-hint>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div *ngIf=\"extraSepaForm.controls['existsDelegatoRiscossione'].value\" class=\"row mt-3\">\r\n\t\t<div class=\"col-12\">\r\n\t\t\t<div class=\"row mt-4\">\r\n\t\t\t\t<div class=\"col-12\">\r\n\t\t\t\t\t<lib-estremi-persona-fisica [ngxsFormPath]=\"estremiPFExtraSepaFormPath\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[province]=\"province\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[nazioni]=\"nazioni\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[isPersonaFisicaValid]=\"isPersonaFisicaExtraSepaValid\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[personaFisica]=\"bonificoExtraSepa?.delegatoRiscossione\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[viewSessoPF]=\"viewSessoPF\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(validatePersonaFisicaEmitter)=\"onValidateExtraSepaPersonaFisica()\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(personaFisicaEmitter)=\"onDelegatoRiscossioneReady($event)\">\r\n\t\t\t\t\t</lib-estremi-persona-fisica>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<lib-dati-residenza [validateAndGetResidenza]=\"validateAndGetResidenza\"></lib-dati-residenza>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div class=\"row mt-4\">\r\n\t\t<div class=\"col-md-8\">\r\n\t\t\t<label id=\"existsBicSwiftLabel\">{{ \"exists-bic-swift\" | traduzione }}</label>\r\n\t\t\t<mat-radio-group class=\"radio-group\"\r\n\t\t\t\t\t\t\t aria-labelledby=\"existsBicSwiftLabel\"\r\n\t\t\t\t\t\t\t formControlName=\"swiftBicPresent\">\r\n\t\t\t\t<mat-radio-button class=\"radio-button pl-2\" [value]=\"true\">\r\n\t\t\t\t\t{{ \"si\" | traduzione }}\r\n\t\t\t\t</mat-radio-button>\r\n\r\n\t\t\t\t<mat-radio-button class=\"radio-button pl-2\" [value]=\"false\">\r\n\t\t\t\t\t{{ \"no\" | traduzione }}\r\n\t\t\t\t</mat-radio-button>\r\n\t\t\t</mat-radio-group>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div *ngIf=\"extraSepaForm.controls['swiftBicPresent'].value; else noswiftBic\" class=\"row\">\r\n\t\t<div class=\"col-md-8\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input matInput placeholder=\"{{ 'required' | traduzione }}{{ 'swift' | traduzione }}\" formControlName=\"swift\" />\r\n\t\t\t\t<!-- <mat-error *ngIf=\"extraSepaForm.controls['swift'].invalid\">\r\n\t\t\t\t\t{{ getErrorMessage(extraSepaForm.controls['swift']) | traduzione }}\r\n\t\t\t\t</mat-error> -->\r\n\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['swift']?.hasError('required')\">\r\n\t\t\t\t\t{{'validation-required'| traduzione}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['swift']?.hasError('minlength')\">\r\n\t\t\t\t\t{{'validation-swift-min' | traduzione}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['swift']?.hasError('maxlength')\">\r\n\t\t\t\t\t{{'validation-swift-max' | traduzione}}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<ng-template #noswiftBic>\r\n\t\t<div class=\"row my-4 mt-4\">\r\n\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{ 'nazione' | traduzione }}</mat-label>\r\n\t\t\t\t\t<mat-select [placeholder]=\"'seleziona' | traduzione\" formControlName=\"nazione\" [compareWith]=\"byCode\">\r\n\t\t\t\t\t\t<mat-option *ngFor=\"let nazione of nazioni\" [value]=\"nazione\">\r\n\t\t\t\t\t\t\t{{ nazione.denominazione }}\r\n\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['nazione'].invalid\">\r\n\t\t\t\t\t\t{{ 'obbligatorio' | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<input matInput [maxlength]=\"70\" formControlName=\"banca\" placeholder=\"{{ 'required' | traduzione }}{{ 'banca' | traduzione }}\" />\r\n\t\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['banca'].invalid\">\r\n\t\t\t\t\t\t{{ getErrorMessage(extraSepaForm.controls['banca']) | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<input matInput [maxlength]=\"35\" placeholder=\"{{ 'required' | traduzione }}{{ 'citta' | traduzione }}\" formControlName=\"citta\" />\r\n\t\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['citta'].invalid\">\r\n\t\t\t\t\t\t{{ getErrorMessage(extraSepaForm.controls['citta']) | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div class=\"row mt-4\">\r\n\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<input matInput [maxlength]=\"70\" formControlName=\"indirizzo\" placeholder=\"{{ 'required' | traduzione }}{{ 'indirizzo' | traduzione }}\" />\r\n\t\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['indirizzo'].invalid\">\r\n\t\t\t\t\t\t{{ getErrorMessage(extraSepaForm.controls['indirizzo']) | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<input matInput [maxlength]=\"16\" placeholder=\"{{ 'required' | traduzione }}{{ 'civico' | traduzione }}\" formControlName=\"civico\" />\r\n\t\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['civico'].invalid\">\r\n\t\t\t\t\t\t{{ getErrorMessage(extraSepaForm.controls['civico']) | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"col-md-4\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<input matInput [maxlength]=\"16\" placeholder=\"{{ 'required' | traduzione }}{{ 'cap-estero' | traduzione }}\" formControlName=\"zipCode\" />\r\n\t\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['zipCode'].invalid\">\r\n\t\t\t\t\t\t{{ getErrorMessage(extraSepaForm.controls['zipCode']) | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</ng-template>\r\n\r\n\t<div class=\"row mt-4\">\r\n\t\t<div class=\"col-md-8\">\r\n\t\t\t<mat-radio-group class=\"radio-group\" aria-labelledby=\"codiceContoPresentLabel\" formControlName=\"codiceContoPresent\">\r\n\t\t\t\t<mat-radio-button class=\"radio-button pl-2\" [value]=\"true\">\r\n\t\t\t\t\t{{ \"codice-conto\" | traduzione }}\r\n\t\t\t\t</mat-radio-button>\r\n\r\n\t\t\t\t<mat-radio-button class=\"radio-button pl-2\" [value]=\"false\">\r\n\t\t\t\t\t{{ \"codice-iban\" | traduzione }}\r\n\t\t\t\t</mat-radio-button>\r\n\t\t\t</mat-radio-group>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div class=\"row mt-4\">\r\n\t\t<div class=\"col-md-8\" *ngIf=\"extraSepaForm.controls['codiceContoPresent'].value; else iban\">\r\n\t\t\t<mat-form-field>\r\n\t\t\t\t<input matInput placeholder=\"{{ 'required' | traduzione }}{{ 'codice-conto' | traduzione }}\"\r\n\t\t\t\t\tformControlName=\"codiceConto\"\r\n\t\t\t\t\t(input)=\"convertToUppercase($event.target.value)\" />\r\n\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['codiceConto'].invalid\">\r\n\t\t\t\t\t{{ getErrorMessage(extraSepaForm.controls['codiceConto']) | traduzione }}\r\n\t\t\t\t</mat-error>\r\n\t\t\t</mat-form-field>\r\n\t\t</div>\r\n\r\n\t\t<ng-template #iban>\r\n\t\t\t<div class=\"col-md-8\">\r\n\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t<input matInput placeholder=\"{{ 'required' | traduzione }}{{ 'codice-iban' | traduzione }}\"\r\n\t\t\t\t\t\tformControlName=\"iban\"\r\n\t\t\t\t\t\t(input)=\"convertToUppercase($event.target.value)\" />\r\n\t\t\t\t\t<mat-error *ngIf=\"extraSepaForm.controls['iban'].invalid\">\r\n\t\t\t\t\t\t{{ getErrorMessage(extraSepaForm.controls['iban']) | traduzione }}\r\n\t\t\t\t\t</mat-error>\r\n\t\t\t\t</mat-form-field>\r\n\t\t\t</div>\r\n\t\t</ng-template>\r\n\t</div>\r\n</ng-container>\r\n",
                    styles: [""]
                },] }
    ];
    BonificoExtraSepaComponent.ctorParameters = function () { return []; };
    BonificoExtraSepaComponent.propDecorators = {
        bonificoExtraSepa: [{ type: i0.Input }],
        isPersonaFisicaExtraSepaValid: [{ type: i0.Input }],
        nazioni: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        extraSepaFormPath: [{ type: i0.Input }],
        estremiPFExtraSepaFormPath: [{ type: i0.Input }],
        viewSessoPF: [{ type: i0.Input }],
        validateAndGetResidenza: [{ type: i0.Input }],
        validateExtraSepaPersonaFisicaEmitter: [{ type: i0.Output }],
        resetEstremiPersonaFisicaExtraSepaFormEmitter: [{ type: i0.Output }],
        bonificoExtraSepaReady: [{ type: i0.Output }],
        personaFisicaEmitter: [{ type: i0.Output }]
    };

    var VagliaBdiComponent = /** @class */ (function () {
        function VagliaBdiComponent(modalitaPagamentoService) {
            this.modalitaPagamentoService = modalitaPagamentoService;
            this.setComuni = new i0.EventEmitter();
            this.getCapOptions = new i0.EventEmitter();
            this.resetIndirizzoForm = new i0.EventEmitter();
            this.vagliaReady = new i0.EventEmitter();
            this.indirizzoEmitter = new i0.EventEmitter();
            this.subscription = new rxjs.Subscription();
            this.getErrorMessage = getErrorMessage;
            // this.initVagliaForm();
        }
        VagliaBdiComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.initVagliaForm();
            this.vagliaForm.setValidators(function (form) {
                return (!form.get('pec').value && !form.get('email').value) &&
                    (form.get('domicilioRichiedenteCoincideConResidenza').value === false) ?
                    { requiredMail: true } : null;
            });
            this.subscription.add(this.vagliaForm.controls['domicilioRichiedenteCoincideConResidenza'].valueChanges.subscribe(function (isDomicilio) {
                if (isDomicilio) {
                    _this.vagliaForm.controls['nome'].setValidators([]);
                    _this.vagliaForm.controls['nome'].patchValue(null);
                    _this.vagliaForm.controls['nome'].updateValueAndValidity();
                    _this.vagliaForm.controls['cognome'].setValidators([]);
                    _this.vagliaForm.controls['cognome'].patchValue(null);
                    _this.vagliaForm.controls['cognome'].updateValueAndValidity();
                    _this.vagliaForm.controls["email"].patchValue(null);
                    _this.vagliaForm.controls["pec"].patchValue(null);
                    _this.vagliaForm.controls["telefono"].patchValue(null);
                    _this.resetIndirizzoForm.emit();
                }
                else {
                    _this.vagliaForm.controls['nome'].setValidators([forms.Validators.required, ValidateName]),
                        _this.vagliaForm.controls['nome'].updateValueAndValidity();
                    _this.vagliaForm.controls['cognome'].setValidators([forms.Validators.required, ValidateName]),
                        _this.vagliaForm.controls['cognome'].updateValueAndValidity();
                }
            }));
            this.vagliaForm.valueChanges.subscribe(function () {
                // if (this.vagliaForm.valid) {
                var vaglia = {
                    intestatarioStudioLegale: _this.vagliaForm.get('intestatoSudioLegale').value,
                    domicilioRichiedenteCoincideConResidenza: _this.vagliaForm.get('domicilioRichiedenteCoincideConResidenza').value,
                    nome: _this.vagliaForm.get('nome').value,
                    denominazione: _this.vagliaForm.get('cognome').value,
                    contatti: _this.vagliaForm.get('domicilioRichiedenteCoincideConResidenza').value === true ? null :
                        {
                            email: _this.vagliaForm.get('email').value,
                            pec: _this.vagliaForm.get('pec').value,
                            telefono: _this.vagliaForm.get('telefono').value,
                        },
                    indirizzo: _this.vagliaForm.get('domicilioRichiedenteCoincideConResidenza').value === true ? null : _this.indirizzo
                };
                var isFormValid = _this.vagliaForm.valid;
                var isFormIndirizzoValid = _this.vagliaForm.get('domicilioRichiedenteCoincideConResidenza').value === true ? true : _this.isIndirizzoValid;
                var isValid = isFormValid && isFormIndirizzoValid;
                _this.vagliaReady.emit({ vaglia: vaglia, isValid: isValid });
                //}
            });
        };
        VagliaBdiComponent.prototype.initVagliaForm = function () {
            var _a, _b, _c, _d, _e, _f, _g, _h;
            this.vagliaForm = new forms.FormGroup({
                nome: new forms.FormControl((_a = this.vagliaBDI) === null || _a === void 0 ? void 0 : _a.nome),
                cognome: new forms.FormControl((_b = this.vagliaBDI) === null || _b === void 0 ? void 0 : _b.denominazione),
                email: new forms.FormControl((_d = (_c = this.vagliaBDI) === null || _c === void 0 ? void 0 : _c.contatti) === null || _d === void 0 ? void 0 : _d.email, [this.ValidateMail, forms.Validators.maxLength(200)]),
                pec: new forms.FormControl((_f = (_e = this.vagliaBDI) === null || _e === void 0 ? void 0 : _e.contatti) === null || _f === void 0 ? void 0 : _f.pec, [this.ValidateMail, forms.Validators.maxLength(200)]),
                telefono: new forms.FormControl((_h = (_g = this.vagliaBDI) === null || _g === void 0 ? void 0 : _g.contatti) === null || _h === void 0 ? void 0 : _h.telefono, [ValidatePhone]),
                intestatoSudioLegale: new forms.FormControl(this.vagliaBDI != null ? this.vagliaBDI.intestatarioStudioLegale : false, this.isAntistatario ? [forms.Validators.required] : null),
                domicilioRichiedenteCoincideConResidenza: new forms.FormControl(this.vagliaBDI != null ? this.vagliaBDI.domicilioRichiedenteCoincideConResidenza : false, [forms.Validators.required]),
            });
        };
        VagliaBdiComponent.prototype.getComuni = function (siglaProvincia) {
            var _this = this;
            if (siglaProvincia) {
                this.modalitaPagamentoService.getComuni$(siglaProvincia).pipe(operators.take(1))
                    .subscribe(function (comuni) {
                    _this.setComuni.emit(comuni);
                    var comune = comuni.find(function (comuneItem) { return comuneItem.codiceCatastale === _this.codiceCatastale; });
                    _this.getCapOptions.emit(comune === null || comune === void 0 ? void 0 : comune.codiceIstat);
                });
            }
            else {
                this.setComuni.emit([]);
            }
        };
        VagliaBdiComponent.prototype.getCap = function (codiceCatastale) {
            var _a;
            if (codiceCatastale) {
                this.codiceCatastale = codiceCatastale;
            }
            var comune = (_a = this.comuni) === null || _a === void 0 ? void 0 : _a.find(function (comuneItem) { return comuneItem.codiceCatastale === codiceCatastale; });
            this.getCapOptions.emit(comune === null || comune === void 0 ? void 0 : comune.codiceIstat);
        };
        VagliaBdiComponent.prototype.ngOnDestroy = function () {
            this.subscription.unsubscribe();
        };
        VagliaBdiComponent.prototype.ValidateMail = function (control) {
            if (!control.value) {
                return null;
            }
            var formatoEmail = /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/;
            if (formatoEmail.test(control.value)) {
                return null;
            }
            return { invalidMail: true };
        };
        VagliaBdiComponent.prototype.onIndirizzoReady = function (event) {
            this.indirizzo = event.indirizzo;
            this.isIndirizzoValid = event.isValid;
            this.indirizzoEmitter.emit({ indirizzo: event.indirizzo, isValid: event.isValid });
        };
        return VagliaBdiComponent;
    }());
    VagliaBdiComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-vaglia-bdi',
                    template: "<form [formGroup]=\"vagliaForm\" [ngxsForm]=\"vagliaFormPath\">\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-12\">\r\n\t\t\t<div class=\"col-12\">\r\n\t\t\t\t<h3 class=\"h5 mb-0\">{{ \"accreditamento-bdi\" | traduzione }}</h3>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"col-md-12 my-3\">\r\n\t\t\t\t<div class=\"alert alert-primary\" role=\"alert\">\r\n\t\t\t\t\t<p>\r\n\t\t\t\t\t\t{{ \"nota-bdi\" | traduzione }}\r\n\t\t\t\t\t</p>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"row\">\r\n\t\t\t\t<div class=\"col-12\">\r\n\t\t\t\t\t<mat-radio-group class=\"radio-group\"\r\n\t\t\t\t\t\t\t\t\taria-labelledby=\"radio-group-label-1\"\r\n\t\t\t\t\t\t\t\t\tformControlName=\"domicilioRichiedenteCoincideConResidenza\">\r\n\t\t\t\t\t\t<mat-radio-button class=\"radio-button pl-2\" [value]=\"true\">\r\n\t\t\t\t\t\t\t{{ \"domicilio-coincide-con-residenza\" | traduzione }}\r\n\t\t\t\t\t\t</mat-radio-button>\r\n\t\t\t\t\t\t<mat-radio-button class=\"radio-button pl-2\" [value]=\"false\">\r\n\t\t\t\t\t\t\t{{ \"domicilio-non-coincide-con-residenza\" | traduzione }}\r\n\t\t\t\t\t\t</mat-radio-button>\r\n\t\t\t\t\t</mat-radio-group>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"col-12\" *ngIf=\"!vagliaForm.controls['domicilioRichiedenteCoincideConResidenza'].value\">\r\n\t\t\t\t<div class=\"row my-2\">\r\n\t\t\t\t\t<div class=\"col-md-6\">\r\n\t\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t\t<input matInput [maxlength]=\"100\" placeholder=\"{{ 'required' | traduzione }}{{ 'nome' | traduzione }}\" formControlName=\"nome\" />\r\n\t\t\t\t\t\t\t<mat-error *ngIf=\"vagliaForm.controls['nome'].invalid\">\r\n\t\t\t\t\t\t\t\t{{ getErrorMessage(vagliaForm.controls['nome']) | traduzione }}\r\n\t\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"col-md-6\">\r\n\t\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t\t<input matInput [maxlength]=\"100\" placeholder=\"{{ 'required' | traduzione }}{{ 'denominazione' | traduzione }}\" formControlName=\"cognome\" />\r\n\t\t\t\t\t\t\t<mat-error *ngIf=\"vagliaForm.controls['cognome'].invalid\">\r\n\t\t\t\t\t\t\t\t{{ getErrorMessage(vagliaForm.controls['cognome']) | traduzione }}\r\n\t\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<lib-indirizzo-pagamento [ngxsFormPath]=\"indirizzoVagliaFormPath\"\r\n\t\t\t\t\t\t\t\t[nazioni]=\"nazioni\"\r\n\t\t\t\t\t\t\t\t[province]=\"province\"\r\n\t\t\t\t\t\t\t\t[comuni]=\"comuni\"\r\n\t\t\t\t\t\t\t\t[capOptions]=\"capOptions\"\r\n\t\t\t\t\t\t\t\t[indirizzo]=\"vagliaBDI?.indirizzo\"\r\n\t\t\t\t\t\t\t\t(selectedProvinciaEmitter)=\"getComuni($event)\"\r\n\t\t\t\t\t\t\t\t(selectedComuneEmitter)=\"getCap($event)\"\r\n\t\t\t\t\t\t\t\t(indirizzoEmitter)=\"onIndirizzoReady($event)\">\r\n\t\t\t\t>\r\n\t\t\t\t</lib-indirizzo-pagamento>\r\n\t\t\t\t<div class=\"row mt-2\">\r\n\t\t\t\t\t<div class=\"col-12 col-md-4\">\r\n\t\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{'email' | traduzione}}</mat-label>\r\n\t\t\t\t\t\t\t<input matInput formControlName=\"email\" />\r\n\t\t\t\t\t\t\t<mat-error *ngIf=\"vagliaForm.controls['email'].invalid\">\r\n\t\t\t\t\t\t\t\t{{ getErrorMessage(vagliaForm.controls['email']) | traduzione }}\r\n\t\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"col-12 col-md-4\">\r\n\t\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{'pec' | traduzione}}</mat-label>\r\n\t\t\t\t\t\t\t<input matInput formControlName=\"pec\" />\r\n\t\t\t\t\t\t\t<mat-error *ngIf=\"vagliaForm.controls['pec'].invalid\">\r\n\t\t\t\t\t\t\t\t{{ getErrorMessage(vagliaForm.controls['pec']) | traduzione }}\r\n\t\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"col-12 col-md-4\">\r\n\t\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t\t<mat-label>{{ \"telefono\" | traduzione }}</mat-label>\r\n\t\t\t\t\t\t\t<input matInput  [maxlength]=\"20\" formControlName=\"telefono\" />\r\n\t\t\t\t\t\t\t<mat-error *ngIf=\"vagliaForm.controls['telefono'].invalid\">\r\n\t\t\t\t\t\t\t\t{{ getErrorMessage(vagliaForm.controls['telefono']) | traduzione }}\r\n\t\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"col-md-12\">\r\n\t\t\t\t\t\t<mat-error *ngIf=\"vagliaForm.getError('requiredMail')\">\r\n\t\t\t\t\t\t\t{{ \"validation-requiredMail\" | traduzione }}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<ng-container *ngIf=\"isAntistatario\">\r\n\t\t\t\t<div class=\"col-12 mt-3\">\r\n\t\t\t\t\t<h3 class=\"h5 mb-0\">{{ \"intestatario\" | traduzione }}</h3>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-md-12 my-3\">\r\n\t\t\t\t\t<mat-radio-group class=\"radio-group\" aria-labelledby=\"radio-group-label-1\" formControlName=\"intestatoSudioLegale\">\r\n\t\t\t\t\t\t<mat-radio-button class=\"radio-button\" [value]=\"false\">{{ \"me-medesimo\" | traduzione }} </mat-radio-button>\r\n\t\t\t\t\t\t<mat-radio-button class=\"pl-3 radio-button\" [value]=\"true\">{{ \"studio-legale\" | traduzione }} </mat-radio-button>\r\n\t\t\t\t\t</mat-radio-group>\r\n\t\t\t\t</div>\r\n\t\t\t</ng-container>\r\n\t\t</div>\r\n\t</div>\r\n</form>\r\n\r\n",
                    styles: [""]
                },] }
    ];
    VagliaBdiComponent.ctorParameters = function () { return [
        { type: ModalitaPagamentoService }
    ]; };
    VagliaBdiComponent.propDecorators = {
        vagliaBDI: [{ type: i0.Input }],
        comuni: [{ type: i0.Input }],
        capOptions: [{ type: i0.Input }],
        isAntistatario: [{ type: i0.Input }],
        nazioni: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        vagliaFormPath: [{ type: i0.Input }],
        indirizzoVagliaFormPath: [{ type: i0.Input }],
        setComuni: [{ type: i0.Output }],
        getCapOptions: [{ type: i0.Output }],
        resetIndirizzoForm: [{ type: i0.Output }],
        vagliaReady: [{ type: i0.Output }],
        indirizzoEmitter: [{ type: i0.Output }]
    };

    var IndirizzoPagamentoComponent = /** @class */ (function () {
        function IndirizzoPagamentoComponent() {
            this.selectedProvinciaEmitter = new i0.EventEmitter();
            this.selectedComuneEmitter = new i0.EventEmitter();
            this.indirizzoEmitter = new i0.EventEmitter();
            this.subscription = new rxjs.Subscription();
            // this.initIndirizzoForm();
            // this.subscription.add(this.indirizzoForm.controls['isEstero'].valueChanges.subscribe(isEstero => {
            // 	this.indirizzoForm.controls['civico'].setValidators(isEstero ? [] : [Validators.required]);
            // 	this.indirizzoForm.controls['civico'].patchValue(null);
            // 	this.indirizzoForm.controls['civico'].updateValueAndValidity();
            // 	this.indirizzoForm.controls['provincia'].setValidators(isEstero ? [] : [Validators.required]);
            // 	this.indirizzoForm.controls['provincia'].patchValue(null);
            // 	this.indirizzoForm.controls['provincia'].updateValueAndValidity();
            // 	this.indirizzoForm.controls['comune'].setValidators(isEstero ? [] : [Validators.required]);
            // 	this.indirizzoForm.controls['comune'].patchValue(null);
            // 	this.indirizzoForm.controls['comune'].updateValueAndValidity();
            // 	this.indirizzoForm.controls['cap'].setValidators(isEstero ? [] : [Validators.required]);
            // 	this.indirizzoForm.controls['cap'].patchValue(null);
            // 	this.indirizzoForm.controls['cap'].updateValueAndValidity();
            // 	this.indirizzoForm.controls['nazione'].setValidators(isEstero ? [Validators.required] : []);
            // 	this.indirizzoForm.controls['nazione'].patchValue(null);
            // 	this.indirizzoForm.controls['nazione'].updateValueAndValidity();
            // }));
            // this.subscription.add(this.indirizzoForm.controls['provincia'].valueChanges.subscribe(siglaProvincia => this.selectedProvinciaEmitter.emit(siglaProvincia)));
            // this.subscription.add(this.indirizzoForm.controls['comune'].valueChanges.subscribe(codiceCatastale => this.selectedComuneEmitter.emit(codiceCatastale)));
        }
        Object.defineProperty(IndirizzoPagamentoComponent.prototype, "_disableForm", {
            set: function (val) {
                this.disableForm = val;
                if (this.disableForm) {
                    this.indirizzoForm.disable();
                }
                else {
                    this.indirizzoForm.enable();
                }
            },
            enumerable: false,
            configurable: true
        });
        IndirizzoPagamentoComponent.prototype.ngOnInit = function () {
            var _this = this;
            this.initIndirizzoForm();
            this.setFormControlsValue();
            this.subscription.add(this.indirizzoForm.controls['isEstero'].valueChanges.subscribe(function (isEstero) {
                _this.indirizzoForm.controls['civico'].setValidators(isEstero ? [] : [forms.Validators.required]);
                _this.indirizzoForm.controls['civico'].patchValue(null);
                _this.indirizzoForm.controls['civico'].updateValueAndValidity();
                _this.indirizzoForm.controls['provincia'].setValidators(isEstero ? [] : [forms.Validators.required]);
                _this.indirizzoForm.controls['provincia'].patchValue(null);
                _this.indirizzoForm.controls['provincia'].updateValueAndValidity();
                _this.indirizzoForm.controls['comune'].setValidators(isEstero ? [] : [forms.Validators.required]);
                _this.indirizzoForm.controls['comune'].patchValue(null);
                _this.indirizzoForm.controls['comune'].updateValueAndValidity();
                _this.indirizzoForm.controls['cap'].setValidators(isEstero ? [] : [forms.Validators.required]);
                _this.indirizzoForm.controls['cap'].patchValue(null);
                _this.indirizzoForm.controls['cap'].updateValueAndValidity();
                _this.indirizzoForm.controls['nazione'].setValidators(isEstero ? [forms.Validators.required] : []);
                _this.indirizzoForm.controls['nazione'].patchValue(null);
                _this.indirizzoForm.controls['nazione'].updateValueAndValidity();
            }));
            this.subscription.add(this.indirizzoForm.controls['provincia'].valueChanges.subscribe(function (siglaProvincia) { return _this.selectedProvinciaEmitter.emit(siglaProvincia); }));
            this.subscription.add(this.indirizzoForm.controls['comune'].valueChanges.subscribe(function (codiceCatastale) { return _this.selectedComuneEmitter.emit(codiceCatastale); }));
            this.indirizzoEmit();
        };
        IndirizzoPagamentoComponent.prototype.ngOnDestroy = function () {
            this.subscription.unsubscribe();
        };
        IndirizzoPagamentoComponent.prototype.initIndirizzoForm = function () {
            this.indirizzoForm = new forms.FormGroup({
                isEstero: new forms.FormControl(null),
                indirizzo: new forms.FormControl(null, [forms.Validators.required]),
                nazione: new forms.FormControl(null),
                civico: new forms.FormControl(null),
                provincia: new forms.FormControl(null),
                comune: new forms.FormControl(null),
                cap: new forms.FormControl(null),
            });
        };
        IndirizzoPagamentoComponent.prototype.onProvinciaChange = function (siglaProvincia) {
            this.indirizzoForm.controls['comune'].patchValue(null);
            this.indirizzoForm.controls['comune'].markAsTouched();
            this.indirizzoForm.controls['cap'].patchValue(null);
            this.indirizzoForm.controls['cap'].markAsTouched();
        };
        IndirizzoPagamentoComponent.prototype.onComuneChange = function (codiceCatastale) {
            this.indirizzoForm.controls['cap'].patchValue(null);
            this.indirizzoForm.controls['cap'].markAsTouched();
        };
        IndirizzoPagamentoComponent.prototype.indirizzoEmit = function () {
            var _this = this;
            this.subscription.add(this.indirizzoForm.valueChanges.pipe(operators.debounceTime(500)).subscribe(function (_) {
                var indirizzo = {
                    strada: {
                        civico: _this.indirizzoForm.controls['civico'].value,
                        inidirizzo: _this.indirizzoForm.controls['indirizzo'].value,
                        tipoToponimo: null
                    },
                    localita: {
                        cap: _this.indirizzoForm.controls['cap'].value,
                        comune: _this.indirizzoForm.controls['comune'].value,
                        nazione: _this.indirizzoForm.controls['nazione'].value,
                        provincia: _this.indirizzoForm.controls['provincia'].value
                    }
                };
                var isValid = _this.indirizzoForm.valid;
                _this.indirizzoEmitter.emit({ indirizzo: indirizzo ? indirizzo : null, isValid: isValid });
            }));
        };
        IndirizzoPagamentoComponent.prototype.setFormControlsValue = function () {
            var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
            this.indirizzoForm.controls['isEstero'].setValue(this.indirizzo && ((_b = (_a = this.indirizzo) === null || _a === void 0 ? void 0 : _a.localita) === null || _b === void 0 ? void 0 : _b.comune.startsWith("Z")) ? true : false);
            this.indirizzoForm.controls['indirizzo'].setValue(this.indirizzo ? this.indirizzo.strada.inidirizzo : null);
            this.indirizzoForm.controls['nazione'].setValue(this.indirizzo ? (_d = (_c = this.indirizzo) === null || _c === void 0 ? void 0 : _c.localita) === null || _d === void 0 ? void 0 : _d.nazione : null);
            this.indirizzoForm.controls['civico'].setValue(this.indirizzo ? this.indirizzo.strada.civico : null);
            this.indirizzoForm.controls['provincia'].setValue(this.indirizzo && !((_f = (_e = this.indirizzo) === null || _e === void 0 ? void 0 : _e.localita) === null || _f === void 0 ? void 0 : _f.comune.startsWith("Z")) ? this.indirizzo.localita.provincia : null);
            this.indirizzoForm.controls['comune'].setValue(this.indirizzo && !((_h = (_g = this.indirizzo) === null || _g === void 0 ? void 0 : _g.localita) === null || _h === void 0 ? void 0 : _h.comune.startsWith("Z")) ? this.indirizzo.localita.comune : null);
            this.indirizzoForm.controls['cap'].setValue(this.indirizzo && !((_k = (_j = this.indirizzo) === null || _j === void 0 ? void 0 : _j.localita) === null || _k === void 0 ? void 0 : _k.comune.startsWith("Z")) ? this.indirizzo.localita.cap : null);
        };
        return IndirizzoPagamentoComponent;
    }());
    IndirizzoPagamentoComponent.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-indirizzo-pagamento',
                    template: "<form [formGroup]=\"indirizzoForm\" [ngxsForm]=\"ngxsFormPath\">\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-12\">\r\n\t\t\t<div class=\"row align-items-center\">\r\n\t\t\t\t<div class=\"col-12 col-md-4\">\r\n\t\t\t\t\t<mat-checkbox formControlName=\"isEstero\" color=\"primary\">\r\n\t\t\t\t\t\t<info-tip-label label=\"indirizzo-estero\"></info-tip-label>\r\n\t\t\t\t\t</mat-checkbox>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"row\">\r\n\t\t\t\t<div class=\"col-12 col-md-4\" *ngIf=\"indirizzoForm.controls['isEstero'].value\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{ 'nazione' | traduzione }}</mat-label>\r\n\t\t\t\t\t\t<mat-select formControlName=\"nazione\">\r\n\t\t\t\t\t\t\t<mat-option *ngFor=\"let nazione of nazioni\" [value]=\"nazione.codiceCatastale\">\r\n\t\t\t\t\t\t\t\t{{ nazione.denominazione }}\r\n\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"indirizzoForm.controls['nazione'].invalid\">\r\n\t\t\t\t\t\t\t{{ 'validation-required' | traduzione }}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-12\" [ngClass]=\"indirizzoForm.controls['isEstero'].value ? ' col-md-8': ' col-md-10'\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{'indirizzo' | traduzione }}</mat-label>\r\n\t\t\t\t\t\t<input [maxlength]=\"70\" formControlName=\"indirizzo\" matInput>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"indirizzoForm.controls['indirizzo'].invalid\">\r\n\t\t\t\t\t\t\t{{ 'validation-required' | traduzione }}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-12 col-md-2\" *ngIf=\"!indirizzoForm.controls['isEstero'].value\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{'civico' | traduzione }}</mat-label>\r\n\t\t\t\t\t\t<input [maxlength]=\"16\" formControlName=\"civico\" matInput>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"indirizzoForm.controls['civico'].invalid\">\r\n\t\t\t\t\t\t\t{{ 'validation-required' | traduzione }}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"row\" *ngIf=\"!indirizzoForm.controls['isEstero'].value\">\r\n\t\t\t\t<div class=\"col-12 col-md-5\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{ 'provincia' | traduzione }}</mat-label>\r\n\t\t\t\t\t\t<mat-select formControlName=\"provincia\" (valueChange)=\"onProvinciaChange($event)\">\r\n\t\t\t\t\t\t\t<mat-option *ngFor=\"let provincia of province\" [value]=\"provincia.sigla\">\r\n\t\t\t\t\t\t\t\t{{ provincia.denominazione }}\r\n\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"indirizzoForm.controls['provincia'].invalid\">\r\n\t\t\t\t\t\t\t{{ 'validation-required' | traduzione }}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-12 col-md-5\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{ 'comune' | traduzione }}</mat-label>\r\n\t\t\t\t\t\t<mat-select formControlName=\"comune\" (valueChange)=\"onComuneChange($event)\">\r\n\t\t\t\t\t\t\t<mat-option *ngFor=\"let comune of comuni\" [value]=\"comune.codiceCatastale\">\r\n\t\t\t\t\t\t\t\t{{ comune.denominazione }}\r\n\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"indirizzoForm.controls['comune'].invalid\">\r\n\t\t\t\t\t\t\t{{ 'validation-required' | traduzione }}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"col-12 col-md-2\">\r\n\t\t\t\t\t<mat-form-field>\r\n\t\t\t\t\t\t<mat-label>{{ 'required' | traduzione }}{{ 'cap' | traduzione }}</mat-label>\r\n\t\t\t\t\t\t<mat-select formControlName=\"cap\">\r\n\t\t\t\t\t\t\t<mat-option *ngFor=\"let cap of capOptions\" [value]=\"cap\">\r\n\t\t\t\t\t\t\t\t{{ cap }}\r\n\t\t\t\t\t\t\t</mat-option>\r\n\t\t\t\t\t\t</mat-select>\r\n\t\t\t\t\t\t<mat-error *ngIf=\"indirizzoForm.controls['cap'].invalid\">\r\n\t\t\t\t\t\t\t{{ 'validation-required' | traduzione }}\r\n\t\t\t\t\t\t</mat-error>\r\n\t\t\t\t\t</mat-form-field>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</form>\r\n\r\n\r\n",
                    styles: [""]
                },] }
    ];
    IndirizzoPagamentoComponent.ctorParameters = function () { return []; };
    IndirizzoPagamentoComponent.propDecorators = {
        ngxsFormPath: [{ type: i0.Input }],
        nazioni: [{ type: i0.Input }],
        province: [{ type: i0.Input }],
        comuni: [{ type: i0.Input }],
        capOptions: [{ type: i0.Input }],
        indirizzo: [{ type: i0.Input }],
        _disableForm: [{ type: i0.Input, args: ['disableForm',] }],
        selectedProvinciaEmitter: [{ type: i0.Output }],
        selectedComuneEmitter: [{ type: i0.Output }],
        indirizzoEmitter: [{ type: i0.Output }]
    };

    var DatiResidenzaComponent$1 = /** @class */ (function () {
        function DatiResidenzaComponent() {
        }
        DatiResidenzaComponent.prototype.ngOnInit = function () {
        };
        return DatiResidenzaComponent;
    }());
    DatiResidenzaComponent$1.decorators = [
        { type: i0.Component, args: [{
                    selector: 'lib-dati-residenza',
                    template: "<div class=\"row mt-4\">\n\t<div class=\"col-12\">\n\t\t<mat-expansion-panel class=\"panel\" [expanded]=\"true\" *ngIf=\"validateAndGetResidenza !=null && validateAndGetResidenza?.valido\">\n\t\t\t<mat-expansion-panel-header [collapsedHeight]=\"'48px'\" [expandedHeight]=\"'48px'\" class=\"custom-header\">\n\t\t\t\t<mat-panel-title>\n\t\t\t\t\t<h3 class=\"h5 mb-0\"><info-tip-label label=\"dati-residenza\"></info-tip-label></h3>\n\t\t\t\t</mat-panel-title>\n\t\t\t</mat-expansion-panel-header>\n\t\t\t<div class=\"collapse-body mt-2\">\n\t\t\t\t<ng-container>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<div class=\"col-md-4\">\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'nazione' | traduzione }}:</p>\n\t\t\t\t\t\t\t<!-- <mat-hint *infoTip=\"nazioneToltip\"></mat-hint> -->\n\t\t\t\t\t\t\t<p>{{validateAndGetResidenza?.residenza?.nazione?.denominazione}}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div *ngIf=\"!validateAndGetResidenza?.residenza.estero\" class=\"col-md-8\">\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'regione' | traduzione }}:</p>\n\t\t\t\t\t\t\t<!-- <mat-hint *infoTip=\"regioneToltip\"></mat-hint> -->\n\t\t\t\t\t\t\t<p>{{validateAndGetResidenza?.residenza?.regione?.denominazione}}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<div class=\"col-md-4\">\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'indirizzo' | traduzione }}:</p>\n\t\t\t\t\t\t\t<!-- <mat-hint *infoTip=\"indirizzoToltip\"></mat-hint> -->\n\t\t\t\t\t\t\t<p>{{validateAndGetResidenza?.residenza?.indirizzo}}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div *ngIf=\"!validateAndGetResidenza?.residenza.estero\" class=\"col-md-8\">\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'civico' | traduzione }}:</p>\n\t\t\t\t\t\t\t<!-- <mat-hint *infoTip=\"civicoToltip\"></mat-hint> -->\n\t\t\t\t\t\t\t<p>{{validateAndGetResidenza?.residenza?.civico}}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div *ngIf=\"!validateAndGetResidenza?.residenza.estero\" class=\"row\">\n\t\t\t\t\t\t<div class=\"col-md-4\">\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'provincia' | traduzione }}:</p>\n\t\t\t\t\t\t\t<!-- <mat-hint *infoTip=\"provinciaToltip\"></mat-hint> -->\n\t\t\t\t\t\t\t<p>{{validateAndGetResidenza?.residenza?.provincia?.denominazione}}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"col-md-4\">\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'comune' | traduzione }}:</p>\n\t\t\t\t\t\t\t<!-- <mat-hint *infoTip=\"comuneToltip\"></mat-hint> -->\n\t\t\t\t\t\t\t<p>{{validateAndGetResidenza?.residenza?.comune?.denominazione}}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"col-md-4\">\n\t\t\t\t\t\t\t<p class=\"mb-0 font-weight-bold\">{{'cap' | traduzione }}:</p>\n\t\t\t\t\t\t\t<!-- <mat-hint *infoTip=\"capToltip\"></mat-hint> -->\n\t\t\t\t\t\t\t<p>{{validateAndGetResidenza?.residenza?.cap}}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\n\t\t\t</div>\n\t\t</mat-expansion-panel>\n\t</div>\n</div>\n",
                    styles: [""]
                },] }
    ];
    DatiResidenzaComponent$1.ctorParameters = function () { return []; };
    DatiResidenzaComponent$1.propDecorators = {
        validateAndGetResidenza: [{ type: i0.Input }]
    };

    var ModalitaPagamentoModule = /** @class */ (function () {
        function ModalitaPagamentoModule() {
        }
        return ModalitaPagamentoModule;
    }());
    ModalitaPagamentoModule.decorators = [
        { type: i0.NgModule, args: [{
                    declarations: [
                        BonificoSepaComponent,
                        EstremiPersonaFisicaComponent,
                        BonificoExtraSepaComponent,
                        VagliaBdiComponent,
                        IndirizzoPagamentoComponent,
                        DatiResidenzaComponent$1
                    ],
                    imports: [
                        common.CommonModule,
                        i1.HttpClientModule,
                        forms.ReactiveFormsModule,
                        formPlugin.NgxsFormPluginModule,
                        formField.MatFormFieldModule,
                        select.MatSelectModule,
                        TranslateModule,
                        input.MatInputModule,
                        radio.MatRadioModule,
                        InfoTipModule,
                        datepicker.MatDatepickerModule,
                        checkbox.MatCheckboxModule,
                        expansion.MatExpansionModule
                    ],
                    exports: [
                        BonificoSepaComponent,
                        EstremiPersonaFisicaComponent,
                        BonificoExtraSepaComponent,
                        VagliaBdiComponent,
                        IndirizzoPagamentoComponent
                    ],
                    providers: []
                },] }
    ];

    var modalitaPagamentoExtraSepaFormDefaults = {
        existsDelegatoRiscossione: false,
        swift: null,
        banca: null,
        indirizzo: null,
        codiceContoPresent: false,
        codiceConto: null,
        iban: null,
        swiftBicPresent: false,
        nazione: null,
        citta: null,
        zipCode: null
    };

    var modalitaPagamentoVagliaFormDefaults = {
        nome: null,
        cognome: null,
        email: null,
        pec: null,
        telefono: null,
        intestatoSudioLegale: false,
        domicilioRichiedenteCoincideConResidenza: false
    };

    var Country = /** @class */ (function () {
        function Country() {
        }
        return Country;
    }());

    var ModalitaPagamentoExtraSepaForm = /** @class */ (function () {
        function ModalitaPagamentoExtraSepaForm() {
        }
        return ModalitaPagamentoExtraSepaForm;
    }());

    var PG = "PG";
    var PF = "PF";
    var AN = "AN";
    var TipoAttore = /** @class */ (function () {
        function TipoAttore() {
        }
        return TipoAttore;
    }());
    var TIPOLOGIE_ATTORE = [
        { value: false, descrizione: "richiedente" },
        { value: true, descrizione: "incaricato-alla-trasmissione" },
    ];
    var TipologiaRichiedente = /** @class */ (function () {
        function TipologiaRichiedente() {
        }
        TipologiaRichiedente.prototype.isIncaricato = function () {
            return this.incaricatoTrasmissione;
        };
        TipologiaRichiedente.prototype.isPersonaGiuridica = function () {
            var _a;
            return ((_a = this.tipoRicorrente) === null || _a === void 0 ? void 0 : _a.codice) == PG;
        };
        TipologiaRichiedente.prototype.isPersonaFisica = function () {
            var _a;
            return ((_a = this.tipoRicorrente) === null || _a === void 0 ? void 0 : _a.codice) == PF;
        };
        TipologiaRichiedente.prototype.isAntistatario = function () {
            var _a;
            return ((_a = this.tipoRicorrente) === null || _a === void 0 ? void 0 : _a.codice) == AN;
        };
        return TipologiaRichiedente;
    }());

    var EMPTY_INDIRIZZO_MODEL = {
        cap: '',
        civico: '',
        comune: {
            codiceCatastale: '',
            codiceIstat: '',
            denominazione: ''
        },
        estero: false,
        id: null,
        indirizzo: '',
        nazione: {
            codiceCatastale: '',
            denominazione: '',
            sigla: '',
            id: ''
        },
        presso: '',
        provincia: {
            denominazione: '',
            sigla: ''
        },
        regione: {
            denominazione: '',
            sigla: ''
        }
    };

    var ModalitaPagamentoVagliaForm = /** @class */ (function () {
        function ModalitaPagamentoVagliaForm() {
        }
        return ModalitaPagamentoVagliaForm;
    }());

    /*
     * Public API Surface of portal-common-component-lib
     */

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

    exports.AccettazioneComponent = AccettazioneComponent;
    exports.AllegatiComponent = AllegatiComponent;
    exports.AllegatiModule = AllegatiModule;
    exports.AltriSoggettiComponent = AltriSoggettiComponent;
    exports.AltriSoggettiGiudiziarioDTO = AltriSoggettiGiudiziarioDTO;
    exports.AltriSoggettiNoEsproprioDTO = AltriSoggettiNoEsproprioDTO;
    exports.AutoritaEsproprianteDTO = AutoritaEsproprianteDTO;
    exports.AutoritaOrdinanteDTO = AutoritaOrdinanteDTO;
    exports.Azione = Azione;
    exports.BonificoExtraSepaComponent = BonificoExtraSepaComponent;
    exports.BonificoSepaComponent = BonificoSepaComponent;
    exports.BozzaDepositoDTO = BozzaDepositoDTO;
    exports.ComponentOutputStatus = ComponentOutputStatus;
    exports.ComponentReducer = ComponentReducer;
    exports.ComuneDTO = ComuneDTO;
    exports.ConfigurationModule = ConfigurationModule;
    exports.ContattiComponent = ContattiComponent;
    exports.ContattoDTO = ContattoDTO;
    exports.CostituzioneDepositoCauzionaleDTO = CostituzioneDepositoCauzionaleDTO;
    exports.CostituzioneDepositoDTO = CostituzioneDepositoDTO;
    exports.CostituzioneDepositoEsproprioDTO = CostituzioneDepositoEsproprioDTO;
    exports.CostituzioneDepositoGiudiziarioDTO = CostituzioneDepositoGiudiziarioDTO;
    exports.CostituzioneDepositoNoEsproprioDTO = CostituzioneDepositoNoEsproprioDTO;
    exports.CostituzioneDepositoVolontarioDTO = CostituzioneDepositoVolontarioDTO;
    exports.Country = Country;
    exports.CreazioneBozzaResponse = CreazioneBozzaResponse;
    exports.CronologiaStatoDTO = CronologiaStatoDTO;
    exports.DatiDeposito = DatiDeposito;
    exports.DatiDepositoDTO = DatiDepositoDTO;
    exports.DatiDepositoGiudiziarioDTO = DatiDepositoGiudiziarioDTO;
    exports.DatiDepositoNoEsproprioDTO = DatiDepositoNoEsproprioDTO;
    exports.DatiOperaDTO = DatiOperaDTO;
    exports.DatiRichiedenteDTO = DatiRichiedenteDTO;
    exports.DatiTribunaleComponent = DatiTribunaleComponent;
    exports.DelegheComponent = DelegheComponent;
    exports.DelegheService = DelegheService;
    exports.DepositiModule = DepositiModule;
    exports.DichiarazioneDTO = DichiarazioneDTO;
    exports.DocumentazioneComponent = DocumentazioneComponent;
    exports.DocumentoDTO = DocumentoDTO;
    exports.DomicilioDTO = DomicilioDTO;
    exports.EMPTY_INDIRIZZO_MODEL = EMPTY_INDIRIZZO_MODEL;
    exports.EnteRichiedenteCauzioneDTO = EnteRichiedenteCauzioneDTO;
    exports.EstremiPersonaFisicaComponent = EstremiPersonaFisicaComponent;
    exports.GenericModalComponent = GenericModalComponent;
    exports.GenericModalData = GenericModalData;
    exports.IdentificativoRichiestaDTO = IdentificativoRichiestaDTO;
    exports.IndirizzoComponent = IndirizzoComponent;
    exports.IndirizzoDTO = IndirizzoDTO;
    exports.IndirizzoPagamentoComponent = IndirizzoPagamentoComponent;
    exports.InfoAnagrafichePFDTO = InfoAnagrafichePFDTO;
    exports.InfoNascitaPFDTO = InfoNascitaPFDTO;
    exports.InfoTip = InfoTip;
    exports.InfoTipLabelComponent = InfoTipLabelComponent;
    exports.InfoTipModule = InfoTipModule;
    exports.ListaPagamentiComponent = ListaPagamentiComponent;
    exports.LocalitaDTO = LocalitaDTO;
    exports.MY_DATE_FORMATS = MY_DATE_FORMATS;
    exports.MessageService = MessageService;
    exports.MieDelegheDTO = MieDelegheDTO;
    exports.ModalitaPagamentoDTO = ModalitaPagamentoDTO;
    exports.ModalitaPagamentoExtraSepaForm = ModalitaPagamentoExtraSepaForm;
    exports.ModalitaPagamentoModule = ModalitaPagamentoModule;
    exports.ModalitaPagamentoVagliaForm = ModalitaPagamentoVagliaForm;
    exports.Modals = Modals;
    exports.NaturaRichiedenteDTO = NaturaRichiedenteDTO;
    exports.NaturaRichiedenteRequestDTO = NaturaRichiedenteRequestDTO;
    exports.NazioneDTO = NazioneDTO;
    exports.ORGANO_CORTE_DI_APPELLO = ORGANO_CORTE_DI_APPELLO;
    exports.ORGANO_TAR = ORGANO_TAR;
    exports.PagamentiModule = PagamentiModule;
    exports.PagamentoComponent = PagamentoComponent;
    exports.ParticellaDTO = ParticellaDTO;
    exports.PersonaFisicaComponent = PersonaFisicaComponent;
    exports.PersonaFisicaDTO = PersonaFisicaDTO;
    exports.PersonaGiuridicaComponent = PersonaGiuridicaComponent;
    exports.PersonaGiuridicaDTO = PersonaGiuridicaDTO;
    exports.PfComponent = PfComponent;
    exports.PgComponent = PgComponent;
    exports.ProprietarioDTO = ProprietarioDTO;
    exports.ProvinciaDTO = ProvinciaDTO;
    exports.RappresentanteDTO = RappresentanteDTO;
    exports.RicercaPfComponent = RicercaPfComponent;
    exports.RicercaPgComponent = RicercaPgComponent;
    exports.RichiedenteComponent = RichiedenteComponent;
    exports.RtsDTO = RtsDTO;
    exports.StepperNavigatorComponent = StepperNavigatorComponent;
    exports.StradaDTO = StradaDTO;
    exports.TIPOLOGIE_ATTORE = TIPOLOGIE_ATTORE;
    exports.TRIBUNALE = TRIBUNALE;
    exports.TabellaSediComponent = TabellaSediComponent;
    exports.TerritorioService = TerritorioService;
    exports.TipiDocumentoRequestDTO = TipiDocumentoRequestDTO;
    exports.TipoAttore = TipoAttore;
    exports.TipoDocumento = TipoDocumento;
    exports.TipoDocumentoDTO = TipoDocumentoDTO;
    exports.TipologiaDepositoComponent = TipologiaDepositoComponent;
    exports.TipologiaRichiedente = TipologiaRichiedente;
    exports.TipologicaDTO = TipologicaDTO;
    exports.TipologicheService = TipologicheService;
    exports.TranslateModule = TranslateModule;
    exports.TranslatePipe = TranslatePipe;
    exports.TranslateService = TranslateService;
    exports.TribunaleDTO = TribunaleDTO;
    exports.UpperCaseDirective = UpperCaseDirective;
    exports.UppercaseModule = UppercaseModule;
    exports.Utente = Utente;
    exports.UtenteService = UtenteService;
    exports.VagliaBdiComponent = VagliaBdiComponent;
    exports.ValidateCodiceFiscale = ValidateCodiceFiscale;
    exports.ValidateCodiceFiscalePIVA = ValidateCodiceFiscalePIVA;
    exports.ValidateDate = ValidateDate;
    exports.ValidateIban = ValidateIban;
    exports.ValidateImportoFormato = ValidateImportoFormato;
    exports.ValidateMail = ValidateMail;
    exports.ValidateName = ValidateName;
    exports.ValidatePartitaIva = ValidatePartitaIva;
    exports.ValidatePassword = ValidatePassword;
    exports.ValidatePhone = ValidatePhone;
    exports.ValidatoreSwift = ValidatoreSwift;
    exports.ValidazioneData = ValidazioneData;
    exports._codiceFiscalePiva = _codiceFiscalePiva;
    exports.anno = anno;
    exports.annotationsOf = annotationsOf;
    exports.bind = bind;
    exports.capPattern = capPattern;
    exports.coalesce = coalesce;
    exports.codiceFiscale = codiceFiscale;
    exports.codiceFiscalePiva = codiceFiscalePiva;
    exports.codiceFiscaleServiceFactory = codiceFiscaleServiceFactory;
    exports.constructorNameOf = constructorNameOf;
    exports.constructorOf = constructorOf;
    exports.curry = curry;
    exports.formatoData = formatoData;
    exports.formatoEmail = formatoEmail;
    exports.formatoName = formatoName;
    exports.formatoSwift = formatoSwift;
    exports.fromIdAndTipo = fromIdAndTipo;
    exports.ftor = ftor;
    exports.getDateErrorMessage = getDateErrorMessage;
    exports.getErrorMessage = getErrorMessage;
    exports.given = given;
    exports.iban = iban;
    exports.is = is;
    exports.isDefined = isDefined;
    exports.isGreaterOrEqualTo = isGreaterOrEqualTo;
    exports.isGreaterThan = isGreaterThan;
    exports.isLessOrEqualTo = isLessOrEqualTo;
    exports.isLessThan = isLessThan;
    exports.isNotNull = isNotNull;
    exports.isNotNullOrUndefined = isNotNullOrUndefined;
    exports.isNotUndefined = isNotUndefined;
    exports.isNull = isNull;
    exports.isNullOrUndefined = isNullOrUndefined;
    exports.isUndefined = isUndefined;
    exports.lazyApply1 = lazyApply1;
    exports.modalitaPagamentoExtraSepaFormDefaults = modalitaPagamentoExtraSepaFormDefaults;
    exports.modalitaPagamentoVagliaFormDefaults = modalitaPagamentoVagliaFormDefaults;
    exports.moneyCommaSeparated = moneyCommaSeparated;
    exports.moneyCommaSeparatedGreaterThanZero = moneyCommaSeparatedGreaterThanZero;
    exports.moneyPattern = moneyPattern;
    exports.nSentenza = nSentenza;
    exports.not = not;
    exports.numRegex = numRegex;
    exports.numberPattern = numberPattern;
    exports.numbers = numbers;
    exports.partial1 = partial1;
    exports.partitaIva = partitaIva;
    exports.passwordPattern = passwordPattern;
    exports.phoneNumberPattern = phoneNumberPattern;
    exports.protoOf = protoOf;
    exports.regioneDTO = regioneDTO;
    exports.self = self;
    exports.validationMessages = validationMessages;
    exports.validationServiceFactory = validationServiceFactory;
    exports.zeroCentoPattern = zeroCentoPattern;
    exports.ɵ0 = ɵ0$1;
    exports.ɵ1 = ɵ1;
    exports.ɵ10 = ɵ10;
    exports.ɵ11 = ɵ11;
    exports.ɵ12 = ɵ12;
    exports.ɵ13 = ɵ13;
    exports.ɵ14 = ɵ14;
    exports.ɵ15 = ɵ15;
    exports.ɵ16 = ɵ16;
    exports.ɵ17 = ɵ17;
    exports.ɵ18 = ɵ18;
    exports.ɵ19 = ɵ19;
    exports.ɵ2 = ɵ2;
    exports.ɵ20 = ɵ20;
    exports.ɵ21 = ɵ21;
    exports.ɵ22 = ɵ22;
    exports.ɵ23 = ɵ23;
    exports.ɵ24 = ɵ24;
    exports.ɵ25 = ɵ25;
    exports.ɵ26 = ɵ26;
    exports.ɵ27 = ɵ27;
    exports.ɵ3 = ɵ3;
    exports.ɵ4 = ɵ4;
    exports.ɵ5 = ɵ5;
    exports.ɵ6 = ɵ6;
    exports.ɵ7 = ɵ7;
    exports.ɵ8 = ɵ8;
    exports.ɵ9 = ɵ9;
    exports.ɵa = ConfigurationService;
    exports.ɵb = CodiceFiscaleServiceImpl;
    exports.ɵc = CodiceFiscaleService;
    exports.ɵd = ValidationService;
    exports.ɵe = DatiAnagraficiComponent;
    exports.ɵf = DatiDomicilioComponent;
    exports.ɵg = DatiResidenzaComponent;
    exports.ɵh = InfoPfComponent;
    exports.ɵi = InfoNascitaComponent;
    exports.ɵj = IndirizzoItalianoComponent;
    exports.ɵk = IndirizzoEsteroComponent;
    exports.ɵl = StradaComponent;
    exports.ɵm = LocalitaComponent;
    exports.ɵn = CaricaDocumentiComponent;
    exports.ɵo = InfoTipService;
    exports.ɵp = TabellaDocumentiComponent;
    exports.ɵq = VisualizzaDettagliComponent;
    exports.ɵr = InfoTipWrapperComponent;
    exports.ɵs = DatiPagamentoComponent;
    exports.ɵt = VisualizzaDettagliComponent$1;
    exports.ɵu = FormattaImportoPipe;
    exports.ɵv = TabellaCronologicaStatiComponent;
    exports.ɵw = PagamentiService;
    exports.ɵx = Paths;
    exports.ɵy = ModalitaPagamentoService;
    exports.ɵz = DatiResidenzaComponent$1;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=infordata-web-portal-common-component-lib.umd.js.map