import * as i0 from '@angular/core';
import { forwardRef, Input, Component, EventEmitter, Output, ViewChild, Injectable, Pipe, Inject, NgModule } from '@angular/core';
import * as i1$1 from '@sellan/core';
import { CoreAbstractAccessorComponent, UploaderConfig, FileTypeEnum, Utility, InfoUser, CoreDialog, InfoType, CoreNotificationModule, CoreBaseModule, CoreMatModule, CoreDirectiveModule, CoreControlModule, CoreDialogModule, CoreDaDataModule, CorePipeModule, CoreCompositeAccessSchemaModule, CoreOrganizationModule, CoreUploaderModule, InvalidFormService, CoreNotification, ButtonLoadingService, EventBrokerService, ContextService, CryptoSignService, RolesEnum, CoreFilePreviewDialogWindow } from '@sellan/core';
import * as i1 from '@angular/forms';
import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
import * as i2 from '@angular/router';
import * as i1$2 from '@angular/material/dialog';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import * as i2$1 from '@angular/common';
import * as i4 from 'ngx-scrollbar';
import * as i3 from '@angular/material/radio';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { of, ReplaySubject, takeUntil } from 'rxjs';
import { EntityTypeEnum, GenerationService } from '@sellan/dgm';

class AdditionalInfo {
}

class CommonAdditionalInfoComponent extends CoreAbstractAccessorComponent {
    ngOnInit() {
        this._initAdditionalFilesUploader();
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (model === null || model === undefined) {
            return new AdditionalInfo();
        }
        if (typeof model === 'string' && model.startsWith('{') && model.endsWith('}')) {
            model = JSON.parse(model);
        }
        return model;
    }
    onInternalValueChange($event) {
        this.valueChange.emit(this.value);
    }
    onUnfocus($event) {
        this.unfocus.emit(this.value);
    }
    onAdditionalFilesChange(model) {
        this.value.additionalFiles = model;
        this.valueChange.emit(this.value);
        this.unfocus.emit(this.value);
    }
    _initAdditionalFilesUploader() {
        this.additionalFilesCfg = new UploaderConfig(Number(FileTypeEnum.None));
        this.additionalFilesCfg.typeName = 'Приложения к дополнительной информации';
        this.additionalFilesCfg.multiple = true;
        this.additionalFilesCfg.isNeedSign = true;
        this.additionalFilesCfg.isReadOnly = this.disabled;
        this.additionalFilesCfg.hideSelectBtn = this.disabled === true;
        this.additionalFilesCfg.isRequired = false;
        if (!Utility.isEmpty(this.value) && !Utility.isEmpty(this.value.additionalFiles) && this.value?.additionalFiles.length > 0) {
            this.additionalFilesCfg.files = this.value.additionalFiles;
        }
    }
    // implements Validator
    validate(control) {
        return null;
    }
    // implements Validator
    registerOnValidatorChange(fn) {
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CommonAdditionalInfoComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CommonAdditionalInfoComponent, isStandalone: false, selector: "bpm-common-additional-info", inputs: { fieldType: "fieldType", fieldSubType: "fieldSubType", anonymAccessItemId: "anonymAccessItemId" }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CommonAdditionalInfoComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CommonAdditionalInfoComponent,
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "@if(!!value) {\n  <div class=\"row\" style=\"margin-top: 15px;\">\n    <div class=\"col-md-12 sln-financial-slide\">\n      <core-field-bool [(ngModel)]=\"value.needAdditionInfo\" name=\"needAdditionInfo\" fieldName=\"needAdditionInfo\" placeholder=\"\u0412\u043D\u0435\u0441\u0442\u0438 \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0443\u044E \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044E \u043F\u043E \u0437\u0430\u044F\u0432\u043A\u0435?\" (valueChange)=\"onInternalValueChange($event)\" (unfocus)=\"onUnfocus($event)\" [settings]=\"{ mode: 'Slide' }\" [disabled]=\"disabled\"></core-field-bool>\n    </div>\n  </div>\n  @if (value.needAdditionInfo) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-addition-info\">\n        \u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u043E\u0433\u0443\u0442 \u043F\u043E\u0432\u043B\u0438\u044F\u0442\u044C \u043D\u0430 \u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u0444\u0430\u043A\u0442\u043E\u0440\u0430 \u0438\u043B\u0438 \u043D\u0430 \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u043F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0435\u043C\u044B\u0439 \u0441\u043F\u043E\u0441\u043E\u0431 \u043E\u043F\u043B\u0430\u0442\u044B \u043A\u043E\u043C\u0438\u0441\u0441\u0438\u0438 \u0437\u0430 \u0444\u0430\u043A\u0442\u043E\u0440\u0438\u043D\u0433, \u0436\u0435\u043B\u0430\u0435\u043C\u044B\u0439 \u043E\u0431\u044A\u0435\u043C \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0438 \u0434\u0440.\n      </div>\n      <div class=\"col-md-12 sln-addition-string\">\n        <core-field-textarea [(ngModel)]=\"value.additionalText\" name=\"additionalText\" fieldName=\"additionalText\" placeholder=\"\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F\" (valueChange)=\"onInternalValueChange($event)\" (unfocus)=\"onUnfocus($event)\" [disabled]=\"disabled\"\n        [settings]=\"{ maxLength: 4000, defaultText: '\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u043E\u0433\u0443\u0442 \u043F\u043E\u0432\u043B\u0438\u044F\u0442\u044C \u043D\u0430 \u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u0444\u0430\u043A\u0442\u043E\u0440\u0430 \u0438\u043B\u0438 \u043D\u0430 \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u043F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0435\u043C\u044B\u0439 \u0441\u043F\u043E\u0441\u043E\u0431 \u043E\u043F\u043B\u0430\u0442\u044B \u043A\u043E\u043C\u0438\u0441\u0441\u0438\u0438 \u0437\u0430 \u0444\u0430\u043A\u0442\u043E\u0440\u0438\u043D\u0433, \u0436\u0435\u043B\u0430\u0435\u043C\u044B\u0439 \u043E\u0431\u044A\u0435\u043C \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0438 \u0434\u0440.' }\"></core-field-textarea>\n      </div>\n      <div class=\"col-md-12\">\n        <div class=\"sln-scrollbar\">\n          <core-file-uploader [(ngModel)]=\"value.additionalFiles\" name=\"additionalFiles\" elementId=\"1000\"\n            [config]=\"additionalFilesCfg\" (valueChange)=\"onAdditionalFilesChange($event)\"\n            [anonymAccessItemId]=\"anonymAccessItemId\"\n          [disabled]=\"disabled\"></core-file-uploader>\n        </div>\n      </div>\n    </div>\n  }\n}", styles: [".sln-addition-info{margin-bottom:20px;color:var(--DARK-GREY)}\n"], dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i1$1.CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: i1$1.CoreFieldTypeTextareaComponent, selector: "core-field-textarea" }, { kind: "component", type: i1$1.CoreFileUploaderComponent, selector: "core-file-uploader", inputs: ["config", "needUpload", "elementId", "anonymAccessItemId"], outputs: ["valueChange", "autogenerateClick", "filesLoaded"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CommonAdditionalInfoComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bpm-common-additional-info', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CommonAdditionalInfoComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CommonAdditionalInfoComponent,
                            multi: true
                        }
                    ], standalone: false, template: "@if(!!value) {\n  <div class=\"row\" style=\"margin-top: 15px;\">\n    <div class=\"col-md-12 sln-financial-slide\">\n      <core-field-bool [(ngModel)]=\"value.needAdditionInfo\" name=\"needAdditionInfo\" fieldName=\"needAdditionInfo\" placeholder=\"\u0412\u043D\u0435\u0441\u0442\u0438 \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0443\u044E \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044E \u043F\u043E \u0437\u0430\u044F\u0432\u043A\u0435?\" (valueChange)=\"onInternalValueChange($event)\" (unfocus)=\"onUnfocus($event)\" [settings]=\"{ mode: 'Slide' }\" [disabled]=\"disabled\"></core-field-bool>\n    </div>\n  </div>\n  @if (value.needAdditionInfo) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-addition-info\">\n        \u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u043E\u0433\u0443\u0442 \u043F\u043E\u0432\u043B\u0438\u044F\u0442\u044C \u043D\u0430 \u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u0444\u0430\u043A\u0442\u043E\u0440\u0430 \u0438\u043B\u0438 \u043D\u0430 \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u043F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0435\u043C\u044B\u0439 \u0441\u043F\u043E\u0441\u043E\u0431 \u043E\u043F\u043B\u0430\u0442\u044B \u043A\u043E\u043C\u0438\u0441\u0441\u0438\u0438 \u0437\u0430 \u0444\u0430\u043A\u0442\u043E\u0440\u0438\u043D\u0433, \u0436\u0435\u043B\u0430\u0435\u043C\u044B\u0439 \u043E\u0431\u044A\u0435\u043C \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0438 \u0434\u0440.\n      </div>\n      <div class=\"col-md-12 sln-addition-string\">\n        <core-field-textarea [(ngModel)]=\"value.additionalText\" name=\"additionalText\" fieldName=\"additionalText\" placeholder=\"\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F\" (valueChange)=\"onInternalValueChange($event)\" (unfocus)=\"onUnfocus($event)\" [disabled]=\"disabled\"\n        [settings]=\"{ maxLength: 4000, defaultText: '\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u043E\u0433\u0443\u0442 \u043F\u043E\u0432\u043B\u0438\u044F\u0442\u044C \u043D\u0430 \u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u0444\u0430\u043A\u0442\u043E\u0440\u0430 \u0438\u043B\u0438 \u043D\u0430 \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F. \u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u043F\u0440\u0435\u0434\u043F\u043E\u0447\u0438\u0442\u0430\u0435\u043C\u044B\u0439 \u0441\u043F\u043E\u0441\u043E\u0431 \u043E\u043F\u043B\u0430\u0442\u044B \u043A\u043E\u043C\u0438\u0441\u0441\u0438\u0438 \u0437\u0430 \u0444\u0430\u043A\u0442\u043E\u0440\u0438\u043D\u0433, \u0436\u0435\u043B\u0430\u0435\u043C\u044B\u0439 \u043E\u0431\u044A\u0435\u043C \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0438 \u0434\u0440.' }\"></core-field-textarea>\n      </div>\n      <div class=\"col-md-12\">\n        <div class=\"sln-scrollbar\">\n          <core-file-uploader [(ngModel)]=\"value.additionalFiles\" name=\"additionalFiles\" elementId=\"1000\"\n            [config]=\"additionalFilesCfg\" (valueChange)=\"onAdditionalFilesChange($event)\"\n            [anonymAccessItemId]=\"anonymAccessItemId\"\n          [disabled]=\"disabled\"></core-file-uploader>\n        </div>\n      </div>\n    </div>\n  }\n}", styles: [".sln-addition-info{margin-bottom:20px;color:var(--DARK-GREY)}\n"] }]
        }], propDecorators: { fieldType: [{
                type: Input
            }], fieldSubType: [{
                type: Input
            }], anonymAccessItemId: [{
                type: Input
            }] } });

class CounteragentDepartmentId {
}

class CommonCounteragentDepartmentIdComponent extends CoreAbstractAccessorComponent {
    get parent() {
        return this.value.parent;
    }
    constructor(_eventBroker, _route, _cd) {
        super();
        this._eventBroker = _eventBroker;
        this._route = _route;
        this._cd = _cd;
        this.freezeCalled = new EventEmitter();
        this.requestId = this._route.snapshot.params['requestId'];
    }
    ngOnInit() {
        setTimeout(() => {
            if (Utility.isEmpty(this.value)) {
                this.value = new CounteragentDepartmentId();
            }
            // при инициализации пробуем смотреть саму заявку и если потом будет срабатывание события то меняем parentId
            if (!this.value.parent) {
                this.value.parent = { id: this.requestId, text: '' };
            }
        }, 0);
        const busName = 'field-event-getvalue-' + this.fieldName;
        this._eventListener = this._eventBroker.listenDom(busName, (element) => {
            if (this.value) {
                if (this.value.parent !== element.value) {
                    this.value.parent = element.value;
                    this._cd.detectChanges();
                    if (this._counteragentCmbx && this._counteragentCmbx.disabled === false) {
                        this._counteragentCmbx.loadValues(undefined, true, false);
                    }
                }
            }
        });
    }
    ngAfterViewInit() {
        this._cd.detectChanges();
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this._eventListener.ignore();
    }
    writeLogic(_) { }
    disabledLogic(_) { }
    formatValue(model) {
        if (Utility.isEmpty(model)) {
            return new CounteragentDepartmentId();
        }
        if (typeof model === 'string' && model.startsWith('{') && model.endsWith('}')) {
            model = JSON.parse(model);
        }
        return model;
    }
    onInternalValueChange($event) {
        this.valueChange.emit(this.value);
        this.freezeCalled.emit(!!$event);
    }
    onUnfocus($event) {
        this.unfocus.emit(this.value);
    }
    // implements Validator
    validate(control) {
        if (this.settings?.isRequired) {
            if (control.value === null || control.value === undefined) {
                return { 'required': true };
            }
            const val = control.value;
            if (Utility.isEmpty(val.departmentId)) {
                return { 'required': true };
            }
        }
        return null;
    }
    // implements Validator
    registerOnValidatorChange(fn) {
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CommonCounteragentDepartmentIdComponent, deps: [{ token: i1$1.EventBrokerService }, { token: i2.ActivatedRoute }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CommonCounteragentDepartmentIdComponent, isStandalone: false, selector: "bpm-common-counteragent-department-id", inputs: { fieldType: "fieldType", fieldSubType: "fieldSubType" }, outputs: { freezeCalled: "freezeCalled" }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CommonCounteragentDepartmentIdComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CommonCounteragentDepartmentIdComponent,
                multi: true
            }
        ], viewQueries: [{ propertyName: "_counteragentCmbx", first: true, predicate: ["counteragentBoxCmbx"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"col-md-12 sln-department-Id\">\n   @if(!!value){\n    <core-field-combobox [(ngModel)]=\"value.departmentId\"\n        #counteragentBoxCmbx\n        name=\"diadocDepartmentId\"\n        fieldName=\"diadocDepartmentId\"\n        [placeholder]=placeholder\n        [settings]=\"{ isRequired: settings.isRequired,  hideEmpty: true, selectFirst: true,  recordCount: 50, hideSearch: true,  sourceCode:'CounteragentDepartments', expressionD: [{ key: 'parentId', value: parent?.id ?? requestId, skipIfEmpty: true  }] }\"\n        [disabled]=\"disabled\"\n        (valueChange)=\"onInternalValueChange($event)\"\n        class=\"sln-department-Id-combobox\"\n        (unfocus)=\"onUnfocus($event)\">\n            <ng-template let-item>\n            <span>{{item?.ediTypeName}}{{item?.ediTypeName ? ':' : ''}} {{item?.text}}</span><br/>\n            <small>{{item?.description}}</small>\n            </ng-template>\n    </core-field-combobox>\n   }\n\n    \n</div>\n\n", styles: [".sln-department-Id{margin-top:15px}\n"], dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i1$1.CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CommonCounteragentDepartmentIdComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bpm-common-counteragent-department-id', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CommonCounteragentDepartmentIdComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CommonCounteragentDepartmentIdComponent,
                            multi: true
                        }
                    ], standalone: false, template: "<div class=\"col-md-12 sln-department-Id\">\n   @if(!!value){\n    <core-field-combobox [(ngModel)]=\"value.departmentId\"\n        #counteragentBoxCmbx\n        name=\"diadocDepartmentId\"\n        fieldName=\"diadocDepartmentId\"\n        [placeholder]=placeholder\n        [settings]=\"{ isRequired: settings.isRequired,  hideEmpty: true, selectFirst: true,  recordCount: 50, hideSearch: true,  sourceCode:'CounteragentDepartments', expressionD: [{ key: 'parentId', value: parent?.id ?? requestId, skipIfEmpty: true  }] }\"\n        [disabled]=\"disabled\"\n        (valueChange)=\"onInternalValueChange($event)\"\n        class=\"sln-department-Id-combobox\"\n        (unfocus)=\"onUnfocus($event)\">\n            <ng-template let-item>\n            <span>{{item?.ediTypeName}}{{item?.ediTypeName ? ':' : ''}} {{item?.text}}</span><br/>\n            <small>{{item?.description}}</small>\n            </ng-template>\n    </core-field-combobox>\n   }\n\n    \n</div>\n\n", styles: [".sln-department-Id{margin-top:15px}\n"] }]
        }], ctorParameters: () => [{ type: i1$1.EventBrokerService }, { type: i2.ActivatedRoute }, { type: i0.ChangeDetectorRef }], propDecorators: { _counteragentCmbx: [{
                type: ViewChild,
                args: ['counteragentBoxCmbx', { static: false }]
            }], fieldType: [{
                type: Input
            }], fieldSubType: [{
                type: Input
            }], freezeCalled: [{
                type: Output
            }] } });

class BpmActorCommonInfoComponent {
    get operatorShortName() {
        if (this.actor.operator) {
            return InfoUser.getOperatorShortName(this.actor.operator);
        }
        return '';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BpmActorCommonInfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: BpmActorCommonInfoComponent, isStandalone: false, selector: "bpm-actor-info", inputs: { title: "title", actor: "actor" }, ngImport: i0, template: "<div class=\"client-info-wrap\">\n  <span class=\"sln-name\" copyClipboard>{{ actor.organization?.nameShort }}</span>\n  <div class=\"sln-doc\">\n    <div>\n      <small><span class=\"sln-title\">\u0418\u041D\u041D: &nbsp;</span> <span class=\"sln-name\" copyClipboard>{{ actor.organization?.inn }}</span></small> &nbsp;\n    </div>\n  </div>\n  @if (actor.operator) {\n    <span><span class=\"sln-title\">\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440: &nbsp;</span> <span class=\"sln-name\">{{ operatorShortName }}</span></span>\n  }\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.CopyClipboardDirective, selector: "[copyClipboard]", inputs: ["tooltip", "delay"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BpmActorCommonInfoComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bpm-actor-info', standalone: false, template: "<div class=\"client-info-wrap\">\n  <span class=\"sln-name\" copyClipboard>{{ actor.organization?.nameShort }}</span>\n  <div class=\"sln-doc\">\n    <div>\n      <small><span class=\"sln-title\">\u0418\u041D\u041D: &nbsp;</span> <span class=\"sln-name\" copyClipboard>{{ actor.organization?.inn }}</span></small> &nbsp;\n    </div>\n  </div>\n  @if (actor.operator) {\n    <span><span class=\"sln-title\">\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440: &nbsp;</span> <span class=\"sln-name\">{{ operatorShortName }}</span></span>\n  }\n</div>\n\n" }]
        }], propDecorators: { title: [{
                type: Input
            }], actor: [{
                type: Input
            }] } });

class CustomerEmail {
}

class CommonCustomerEmailComponent extends CoreAbstractAccessorComponent {
    writeLogic(_) { }
    disabledLogic(_) { }
    formatValue(model) {
        if (model === null || model === undefined) {
            return new CustomerEmail();
        }
        if (typeof model === 'string' && model.startsWith('{') && model.endsWith('}')) {
            model = JSON.parse(model);
        }
        return model;
    }
    onInternalValueChange($event) {
        this.valueChange.emit(this.value);
    }
    onUnfocus($event) {
        this.unfocus.emit(this.value);
    }
    onAdditionalFilesChange(model) { }
    // implements Validator
    validate(control) {
        return null;
    }
    // implements Validator
    registerOnValidatorChange(fn) { }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CommonCustomerEmailComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CommonCustomerEmailComponent, isStandalone: false, selector: "bpm-common-customer-email", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CommonCustomerEmailComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CommonCustomerEmailComponent,
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "@if(!!value) {\n  <div class=\"row\" style=\"margin-top: 15px;\">\n    <div class=\"col-md-12 sln-financial-slide\">\n      <core-field-bool [(ngModel)]=\"value.needSendingEmail\" name=\"needSendingEmail\" fieldName=\"needSendingEmail\" placeholder=\"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0437\u0430\u044F\u0432\u043A\u0443 \u043A\u043B\u0438\u0435\u043D\u0442\u0443 \u043D\u0430 email?\" (valueChange)=\"onInternalValueChange($event)\" (unfocus)=\"onUnfocus($event)\" [settings]=\"{ mode: 'Slide' }\" [disabled]=\"disabled\"></core-field-bool>\n    </div>\n  </div>\n  @if (value.needSendingEmail) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-addition-string\">\n        <core-field-string [(ngModel)]=\"value.email\" name=\"email\" fieldName=\"email\" placeholder=\"Email \u043A\u043B\u0438\u0435\u043D\u0442\u0430\" (valueChange)=\"onInternalValueChange($event)\" (unfocus)=\"onUnfocus($event)\" [disabled]=\"disabled\"\n        [settings]=\"{ maxLength: 4000, defaultText: 'Email \u043A\u043B\u0438\u0435\u043D\u0442\u0430' }\"></core-field-string>\n      </div>\n    </div>\n  }\n}", styles: [".sln-customer-email{margin-bottom:20px;color:var(--DARK-GREY);font-family:var(--font-medium)}\n"], dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i1$1.CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: i1$1.CoreFieldTypeStringComponent, selector: "core-field-string" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CommonCustomerEmailComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bpm-common-customer-email', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CommonCustomerEmailComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CommonCustomerEmailComponent,
                            multi: true
                        }
                    ], standalone: false, template: "@if(!!value) {\n  <div class=\"row\" style=\"margin-top: 15px;\">\n    <div class=\"col-md-12 sln-financial-slide\">\n      <core-field-bool [(ngModel)]=\"value.needSendingEmail\" name=\"needSendingEmail\" fieldName=\"needSendingEmail\" placeholder=\"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0437\u0430\u044F\u0432\u043A\u0443 \u043A\u043B\u0438\u0435\u043D\u0442\u0443 \u043D\u0430 email?\" (valueChange)=\"onInternalValueChange($event)\" (unfocus)=\"onUnfocus($event)\" [settings]=\"{ mode: 'Slide' }\" [disabled]=\"disabled\"></core-field-bool>\n    </div>\n  </div>\n  @if (value.needSendingEmail) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-addition-string\">\n        <core-field-string [(ngModel)]=\"value.email\" name=\"email\" fieldName=\"email\" placeholder=\"Email \u043A\u043B\u0438\u0435\u043D\u0442\u0430\" (valueChange)=\"onInternalValueChange($event)\" (unfocus)=\"onUnfocus($event)\" [disabled]=\"disabled\"\n        [settings]=\"{ maxLength: 4000, defaultText: 'Email \u043A\u043B\u0438\u0435\u043D\u0442\u0430' }\"></core-field-string>\n      </div>\n    </div>\n  }\n}", styles: [".sln-customer-email{margin-bottom:20px;color:var(--DARK-GREY);font-family:var(--font-medium)}\n"] }]
        }] });

// действия реализуемы по процессу
var ActionEnum;
(function (ActionEnum) {
    ActionEnum[ActionEnum["SaveAsDraft"] = 1] = "SaveAsDraft";
    ActionEnum[ActionEnum["SendRequest"] = 2] = "SendRequest";
    ActionEnum[ActionEnum["RevokeRequest"] = 3] = "RevokeRequest";
    ActionEnum[ActionEnum["GoToStatus"] = 4] = "GoToStatus";
    ActionEnum[ActionEnum["ChangeStatus"] = 5] = "ChangeStatus";
    ActionEnum[ActionEnum["TakeToReviewRequest"] = 6] = "TakeToReviewRequest";
    ActionEnum[ActionEnum["AssignToRequest"] = 7] = "AssignToRequest";
    ActionEnum[ActionEnum["ForceTransaction"] = 8] = "ForceTransaction";
    ActionEnum[ActionEnum["Refuse"] = 10] = "Refuse";
    ActionEnum[ActionEnum["CreateSubtask"] = 11] = "CreateSubtask";
    ActionEnum[ActionEnum["AgentSaveAsDraft"] = 12] = "AgentSaveAsDraft";
    ActionEnum[ActionEnum["AgentSend"] = 13] = "AgentSend";
    ActionEnum[ActionEnum["AgentRevoke"] = 14] = "AgentRevoke";
    ActionEnum[ActionEnum["ReturnRevision"] = 15] = "ReturnRevision";
    ActionEnum[ActionEnum["DownloadDocuments"] = 16] = "DownloadDocuments";
    ActionEnum[ActionEnum["ChatDialog"] = 17] = "ChatDialog";
    ActionEnum[ActionEnum["Rescore"] = 18] = "Rescore";
    ActionEnum[ActionEnum["DownloadFundingGuide"] = 19] = "DownloadFundingGuide";
    ActionEnum[ActionEnum["GetDocumentPageLink"] = 20] = "GetDocumentPageLink";
})(ActionEnum || (ActionEnum = {}));
var TransactionTypeEnum;
(function (TransactionTypeEnum) {
    TransactionTypeEnum[TransactionTypeEnum["Refill"] = 1] = "Refill";
    TransactionTypeEnum[TransactionTypeEnum["Withdrawals"] = 2] = "Withdrawals";
    TransactionTypeEnum[TransactionTypeEnum["Blocking"] = 3] = "Blocking";
    TransactionTypeEnum[TransactionTypeEnum["Unblocking"] = 4] = "Unblocking";
    TransactionTypeEnum[TransactionTypeEnum["DebitCommission"] = 5] = "DebitCommission";
    TransactionTypeEnum[TransactionTypeEnum["Debit"] = 6] = "Debit";
    TransactionTypeEnum[TransactionTypeEnum["UnblockingPart"] = 7] = "UnblockingPart";
})(TransactionTypeEnum || (TransactionTypeEnum = {}));
class RequestButton {
}

// типы финализации действия реализуемы по процессу
var ActionFinishTypeEnum;
(function (ActionFinishTypeEnum) {
    ActionFinishTypeEnum[ActionFinishTypeEnum["RequestList"] = 1] = "RequestList";
    ActionFinishTypeEnum[ActionFinishTypeEnum["OperationDone"] = 2] = "OperationDone";
    ActionFinishTypeEnum[ActionFinishTypeEnum["RefreshPage"] = 3] = "RefreshPage";
    ActionFinishTypeEnum[ActionFinishTypeEnum["None"] = 4] = "None";
    ActionFinishTypeEnum[ActionFinishTypeEnum["OpenNewWindow"] = 5] = "OpenNewWindow";
})(ActionFinishTypeEnum || (ActionFinishTypeEnum = {}));
class ActionFinishOptions {
    constructor(html, request, isFormValid = false) {
        this.requestId = request.requestUid;
        this.requestNum = request.requestNum;
        this.distributionNum = request.distribution ? request.distribution.distributionNum : undefined;
        this.systemObjectId = request.metadata.systemObjectId;
        this.systemObject = request.metadata.systemObjectDescription;
        this.html = html;
        this.showFundingGuideButton = request.buttons.some(x => x.processActionId == ActionEnum.AgentSend);
        this.showDocumentPackageLink = request.buttons.some(x => x.processActionId == ActionEnum.AgentSend && x.showDocumentPackageLink && isFormValid);
    }
}

class ActionFinishService {
    constructor(_router) {
        this._router = _router;
    }
    execute(finishTypeId, option) {
        switch (finishTypeId) {
            case ActionFinishTypeEnum.RequestList: {
                this._goToRequestList(option);
                break;
            }
            case ActionFinishTypeEnum.OperationDone: {
                this._goToOperationDone(option);
                break;
            }
            case ActionFinishTypeEnum.RefreshPage: {
                this._refreshPage();
                break;
            }
            case ActionFinishTypeEnum.OpenNewWindow: {
                console.error('Метод не реализован!');
                break;
            }
            default: {
                break;
            }
        }
    }
    _goToRequestList(option) {
        this._router.navigate(['/requests/' + option.systemObjectId]);
    }
    _goToOperationDone(option) {
        this._router.navigate(['requests/' + option.systemObjectId + '/done'], { state: { data: option } });
    }
    _refreshPage() {
        window.location.reload();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ActionFinishService, deps: [{ token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ActionFinishService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ActionFinishService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i2.Router }] });

class RequestBaseService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    // сохранение черновика
    saveDraft(request) {
        const url = this._startUp.apiRoot('actions/draft', 'bpm');
        return this._ajaxM.post({ url: url, data: request });
    }
    // проверка основополагающих документов поставщика процесса
    getProviders(metadata, requestUid) {
        const api = Utility.isEmpty(metadata.moduleUrl) ? 'bpm' : metadata.moduleUrl;
        const url = !!requestUid
            ? this._startUp.apiRoot('providers/by-request/' + requestUid, api)
            : this._startUp.apiRoot('providers/' + metadata.systemObjectId, api);
        return this._ajaxM.post({ url: url, data: metadata.runDocument });
    }
    // проверка наличия версионируемого документа в рамках процесса заявки
    checkRequestVersionedDocument(pack) {
        const url = this._startUp.apiRoot('requests/check-versioned-forms', 'bpm');
        return this._ajaxM.post({ url: url, data: pack });
    }
    // сохранение состояния панели заявки
    updateRequestData(item) {
        const url = this._startUp.apiRoot('requests/update-request', 'bpm');
        return this._ajaxM.post({ url: url, data: item });
    }
    checkActualChildRequest(requestId) {
        const url = this._startUp.apiRoot('requests/check-actual-child?requestId=' + requestId, 'bpm');
        return this._ajaxM.get({ url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RequestBaseService, deps: [{ token: i1$1.Startup }, { token: i1$1.AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RequestBaseService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RequestBaseService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i1$1.Startup }, { type: i1$1.AjaxService }] });

class SearchProductPipe {
    transform(value, key, term) {
        return value.filter((item) => {
            if (item.hasOwnProperty(key)) {
                if (term) {
                    const p = item.products.find(x => x.code === term.id);
                    return p !== undefined;
                }
                else {
                    return true;
                }
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SearchProductPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: SearchProductPipe, isStandalone: false, name: "searchProduct", pure: false }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SearchProductPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'searchProduct', pure: false,
                    standalone: false
                }]
        }] });
class BpmProviderListDialogWindow {
    get selectedP() {
        let count = 0;
        this.providers.forEach((p) => {
            if (p.selected === true) {
                count++;
            }
        });
        return count;
    }
    get notSelectedP() {
        let count = 0;
        this.providers.forEach((p) => {
            if (p.selected === false) {
                count++;
            }
        });
        return count;
    }
    get availableP() {
        return this.providers.length;
    }
    constructor(_dialogRef, data) {
        this._dialogRef = _dialogRef;
        this.data = data;
        this.providers = data;
    }
    getMaxContentHeight() {
        return { height: 315 + 'px' };
    }
    selectedAll() {
        if (this.notSelectedP > 0 && this.selectedP > 0) {
            this.providers.forEach((provider) => {
                provider.selected = false;
            });
            return;
        }
        this.providers.forEach((provider) => {
            provider.selected = !provider.selected;
        });
    }
    selectItem(provider) {
        provider.selected = !provider.selected;
    }
    save() {
        const array = new Array();
        this.providers.forEach((provider) => {
            if (provider.selected) {
                array.push({
                    organizationId: provider.organizationId,
                    fileGenerations: provider.fileGenerations
                });
            }
        });
        if (array.length > 0) {
            this._dialogRef.close(array);
        }
        else {
            const msg = 'Необходимо выбрать хотя бы одного исполнителя услуги.';
            CoreDialog.notificate(msg, InfoType.Danger);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BpmProviderListDialogWindow, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: BpmProviderListDialogWindow, isStandalone: false, selector: "ng-component", ngImport: i0, template: "<core-dialog dialogTitle=\"\u0412\u044B\u0431\u043E\u0440 \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u0443\u044E\u0449\u0435\u0439 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438\" class=\"sln-dialog-provider-list\" width=\"600\">\n  <div body>\n    <form #currentForm=\"ngForm\" novalidate class=\"sln-dialog-provider-list__form\">\n      <div class=\"row sln-dialog-provider-list__selected\">\n        <p class=\"sln-dialog-provider-list__title\">\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043A\u0443\u0434\u0430 \u043D\u0430\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0437\u0430\u044F\u0432\u043A\u0443:</p>\n        <div class=\"flex\">\n          <div class=\"flex__item-sec\">\n            <a (click)=\"selectedAll()\">{{ selectedP !== 0 ? '\u0421\u043D\u044F\u0442\u044C \u0432\u044B\u0434\u0435\u043B\u0435\u043D\u0438\u0435' : '\u0412\u0441\u0435' }}</a>\n          </div>\n          <div class=\"flex__item-two\">\n            <p>\u0412\u044B\u0431\u0440\u0430\u043D\u043E ({{ selectedP  }} \u0438\u0437 {{ availableP }})</p>\n          </div>\n        </div>\n      </div>\n      <div class=\"ibox\">\n        <div class=\"ibox-content sln-dialog-provider-list__content\">\n          <ng-scrollbar [ngStyle]=\"getMaxContentHeight()\">\n            <div class=\"feed-activity-list\">\n              @for (provider of providers | searchProduct:'products':productF; track provider; let f = $index) {\n                <div class=\"feed-element\" [style.background-color]=\"provider.selected ? '#f3f3f3' : null\" (click)=\"selectItem(provider)\">\n                  @if (provider.icon) {\n                    <div class=\"logo\">\n                      <img src=\"assets/common/images/common-icons/company.logos/{{provider.icon}}\" alt=\"\">\n                    </div>\n                  }\n                  @if (!provider.icon) {\n                    <div  class=\"float-left\">\n                    </div>\n                  }\n                  <div class=\"media-body\">\n                    <strong>{{ provider.name }}</strong><br/>\n                    <small class=\"text-muted\">\u0418\u041D\u041D: {{ provider.inn }}</small><br/>\n                    <small class=\"product\"> <span style=\"border-bottom: 1px solid;\">\u041F\u0440\u043E\u0434\u0443\u043A\u0442\u044B: </span>&nbsp;@for (product of provider.products; track product) {\n                    <p>{{ product.product }} &nbsp; </p>\n                  } </small>\n                  @if (provider.isAgreementFileSign) {\n                    <small>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u044F \u043D\u0430 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0443 \u0437\u0430\u044F\u0432\u043E\u043A \u0443\u0436\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044B</small>\n                  }\n                </div>\n                <div class=\"media-body__icons\">\n                  @if (provider.isAgreementFileSign === true) {\n                    <div class=\"sln-common-document-attribute\"></div>\n                  }\n                </div>\n              </div>\n            }\n          </div>\n        </ng-scrollbar>\n      </div>\n    </div>\n  </form>\n</div>\n<div footer>\n  <button type=\"button\" class=\"light-btn-primary\" (click)=\"save()\" [disabled]=\"selectedP === 0\">\n    \u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\n  </button>\n</div>\n</core-dialog>\n", styles: [".sln-dialog-provider-list__title{color:#77809b;font-size:14px}.sln-dialog-provider-list__selected{display:flex;align-items:center;flex-wrap:wrap;margin-bottom:2rem;padding:0 15px}.sln-dialog-provider-list__selected .flex{display:flex;justify-content:flex-end;flex-grow:1;align-items:center;letter-spacing:.032em;text-transform:uppercase;color:#b2c7cf;font-size:11px;position:relative}.sln-dialog-provider-list__selected .flex__item-sec{padding-right:15px}.sln-dialog-provider-list__selected .flex__item-sec a{text-decoration:none;color:#b2c7cf;cursor:pointer;font-family:var(--font-bold)}.sln-dialog-provider-list__selected .flex__item-two p{font-family:var(--font-bold);letter-spacing:.032em;padding:0!important}.sln-dialog-provider-list .feed-element{display:flex;margin-bottom:1rem;padding:10px 15px;cursor:pointer;align-items:center}.sln-dialog-provider-list .feed-element:hover{background:#fafafa}.sln-dialog-provider-list .feed-element .float-left{background:#3345a7;width:75px;height:75px;border-radius:50%;position:relative;margin-right:1rem;display:flex;align-items:center;justify-content:center}.sln-dialog-provider-list .feed-element .float-left p{font-size:10px;color:#fff}.sln-dialog-provider-list .feed-element .logo img{width:75px;margin-right:1rem}.sln-dialog-provider-list .media-body{flex:1}.sln-dialog-provider-list .media-body__icons{padding-right:5px}.sln-dialog-provider-list .media-body strong{color:#3f4c72}.sln-dialog-provider-list .media-body small,.sln-dialog-provider-list .media-body span{color:#77809b;font-family:var(--font-medium);font-size:12px}.sln-dialog-provider-list .media-body .product{display:flex;margin-top:3px;margin-bottom:5px}.sln-dialog-provider-list .media-body .product p{color:#abb1c2;padding:0!important}.sln-dialog-provider-list .feed-element:hover strong,.sln-dialog-provider-list .feed-element:hover p{color:#3f4c72}.sln-dialog-provider-list .feed-element:hover small,.sln-dialog-provider-list .feed-element:hover span{color:#77809b}.sln-dialog-provider-list__combobox .mat-form-field-appearance .mat-form-field-wrapper{padding-bottom:0!important}.media-body:focus .strong{background:#3469f4}\n"], dependencies: [{ kind: "directive", type: i2$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "component", type: i1$1.CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "pipe", type: SearchProductPipe, name: "searchProduct" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BpmProviderListDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u0412\u044B\u0431\u043E\u0440 \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u0443\u044E\u0449\u0435\u0439 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438\" class=\"sln-dialog-provider-list\" width=\"600\">\n  <div body>\n    <form #currentForm=\"ngForm\" novalidate class=\"sln-dialog-provider-list__form\">\n      <div class=\"row sln-dialog-provider-list__selected\">\n        <p class=\"sln-dialog-provider-list__title\">\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043A\u0443\u0434\u0430 \u043D\u0430\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0437\u0430\u044F\u0432\u043A\u0443:</p>\n        <div class=\"flex\">\n          <div class=\"flex__item-sec\">\n            <a (click)=\"selectedAll()\">{{ selectedP !== 0 ? '\u0421\u043D\u044F\u0442\u044C \u0432\u044B\u0434\u0435\u043B\u0435\u043D\u0438\u0435' : '\u0412\u0441\u0435' }}</a>\n          </div>\n          <div class=\"flex__item-two\">\n            <p>\u0412\u044B\u0431\u0440\u0430\u043D\u043E ({{ selectedP  }} \u0438\u0437 {{ availableP }})</p>\n          </div>\n        </div>\n      </div>\n      <div class=\"ibox\">\n        <div class=\"ibox-content sln-dialog-provider-list__content\">\n          <ng-scrollbar [ngStyle]=\"getMaxContentHeight()\">\n            <div class=\"feed-activity-list\">\n              @for (provider of providers | searchProduct:'products':productF; track provider; let f = $index) {\n                <div class=\"feed-element\" [style.background-color]=\"provider.selected ? '#f3f3f3' : null\" (click)=\"selectItem(provider)\">\n                  @if (provider.icon) {\n                    <div class=\"logo\">\n                      <img src=\"assets/common/images/common-icons/company.logos/{{provider.icon}}\" alt=\"\">\n                    </div>\n                  }\n                  @if (!provider.icon) {\n                    <div  class=\"float-left\">\n                    </div>\n                  }\n                  <div class=\"media-body\">\n                    <strong>{{ provider.name }}</strong><br/>\n                    <small class=\"text-muted\">\u0418\u041D\u041D: {{ provider.inn }}</small><br/>\n                    <small class=\"product\"> <span style=\"border-bottom: 1px solid;\">\u041F\u0440\u043E\u0434\u0443\u043A\u0442\u044B: </span>&nbsp;@for (product of provider.products; track product) {\n                    <p>{{ product.product }} &nbsp; </p>\n                  } </small>\n                  @if (provider.isAgreementFileSign) {\n                    <small>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u044F \u043D\u0430 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0443 \u0437\u0430\u044F\u0432\u043E\u043A \u0443\u0436\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044B</small>\n                  }\n                </div>\n                <div class=\"media-body__icons\">\n                  @if (provider.isAgreementFileSign === true) {\n                    <div class=\"sln-common-document-attribute\"></div>\n                  }\n                </div>\n              </div>\n            }\n          </div>\n        </ng-scrollbar>\n      </div>\n    </div>\n  </form>\n</div>\n<div footer>\n  <button type=\"button\" class=\"light-btn-primary\" (click)=\"save()\" [disabled]=\"selectedP === 0\">\n    \u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\n  </button>\n</div>\n</core-dialog>\n", styles: [".sln-dialog-provider-list__title{color:#77809b;font-size:14px}.sln-dialog-provider-list__selected{display:flex;align-items:center;flex-wrap:wrap;margin-bottom:2rem;padding:0 15px}.sln-dialog-provider-list__selected .flex{display:flex;justify-content:flex-end;flex-grow:1;align-items:center;letter-spacing:.032em;text-transform:uppercase;color:#b2c7cf;font-size:11px;position:relative}.sln-dialog-provider-list__selected .flex__item-sec{padding-right:15px}.sln-dialog-provider-list__selected .flex__item-sec a{text-decoration:none;color:#b2c7cf;cursor:pointer;font-family:var(--font-bold)}.sln-dialog-provider-list__selected .flex__item-two p{font-family:var(--font-bold);letter-spacing:.032em;padding:0!important}.sln-dialog-provider-list .feed-element{display:flex;margin-bottom:1rem;padding:10px 15px;cursor:pointer;align-items:center}.sln-dialog-provider-list .feed-element:hover{background:#fafafa}.sln-dialog-provider-list .feed-element .float-left{background:#3345a7;width:75px;height:75px;border-radius:50%;position:relative;margin-right:1rem;display:flex;align-items:center;justify-content:center}.sln-dialog-provider-list .feed-element .float-left p{font-size:10px;color:#fff}.sln-dialog-provider-list .feed-element .logo img{width:75px;margin-right:1rem}.sln-dialog-provider-list .media-body{flex:1}.sln-dialog-provider-list .media-body__icons{padding-right:5px}.sln-dialog-provider-list .media-body strong{color:#3f4c72}.sln-dialog-provider-list .media-body small,.sln-dialog-provider-list .media-body span{color:#77809b;font-family:var(--font-medium);font-size:12px}.sln-dialog-provider-list .media-body .product{display:flex;margin-top:3px;margin-bottom:5px}.sln-dialog-provider-list .media-body .product p{color:#abb1c2;padding:0!important}.sln-dialog-provider-list .feed-element:hover strong,.sln-dialog-provider-list .feed-element:hover p{color:#3f4c72}.sln-dialog-provider-list .feed-element:hover small,.sln-dialog-provider-list .feed-element:hover span{color:#77809b}.sln-dialog-provider-list__combobox .mat-form-field-appearance .mat-form-field-wrapper{padding-bottom:0!important}.media-body:focus .strong{background:#3469f4}\n"] }]
        }], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class BpmFieldSettingsComponent {
    constructor() {
        this.isHiddenField = false;
        this.valueChange = new EventEmitter();
    }
    onValueChange() {
        this.valueChange.emit(this.settings);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BpmFieldSettingsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: BpmFieldSettingsComponent, isStandalone: false, selector: "bpm-field-settings", inputs: { fieldType: "fieldType", isHiddenField: "isHiddenField", settings: "settings" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<div provideParentForm>\n  <div class=\"form-group\">\n    <core-field-bool [(ngModel)]=\"settings.isRequired\" name=\"isRequired\" fieldName=\"isRequired\" placeholder=\"\u041F\u043E\u043B\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u043C \u043A \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044E\"\n    [settings]=\"{ mode: 'Checkbox' }\" [disabled]=\"isHiddenField\"></core-field-bool>\n  </div>\n\n  <!-- \u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0434\u043B\u044F \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u044B\u0445 \u0442\u0438\u043F\u043E\u0432 -->\n  <!--\u0414\u043B\u044F \u0442\u0438\u043F\u0430 string-->\n  @if (fieldType === 1) {\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.maxLength\" name=\"maxLength\" fieldName=\"maxLength\" placeholder=\"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430\" [settings]=\"{ min: 0, max: 500, decimals:0 }\"></core-field-number>\n    </div>\n    <div class=\"form-group\">\n      <core-field-string [(ngModel)]=\"settings.defaultText\" name=\"defaultText\" fieldName=\"defaultText\" placeholder=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E\u043B\u044F \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E\" [settings]=\"{ maxLength: 100 }\"></core-field-string>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.useMask\" name=\"useMask\" fieldName=\"useMask\" placeholder=\"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043C\u0430\u0441\u043A\u0443 \u0434\u043B\u044F \u0434\u0430\u043D\u043D\u044B\u0445\" [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n    @if (settings.useMask) {\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"settings.maskExpression\" name=\"maskExpression\" fieldName=\"maskExpression\" placeholder=\"\u041C\u0430\u0441\u043A\u0430 \u0434\u043B\u044F \u0434\u0430\u043D\u043D\u044B\u0445\" [settings]=\"{ isRequired: settings.useMask, maxLength: 100, useInformer: true, informerText: '\u041C\u0430\u0441\u043A\u0430 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044F \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 NgxMask' }\"></core-field-string>\n      </div>\n    }\n  }\n\n  <!--\u0414\u043B\u044F \u0442\u0438\u043F\u0430 number-->\n  @if (fieldType === 2 || fieldType === 4) {\n    @if (fieldType === 4) {\n      <div class=\"form-group\">\n        <core-field-number [(ngModel)]=\"settings.decimals\" name=\"decimals\" fieldName=\"decimals\" placeholder=\"\u0417\u043D\u0430\u043A\u043E\u0432 \u043F\u043E\u0441\u043B\u0435 \u0437\u0430\u043F\u044F\u0442\u043E\u0439\" [settings]=\"{ min: 0, max: 4, decimals:0 }\"></core-field-number>\n      </div>\n    }\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.min\" name=\"min\" fieldName=\"min\" placeholder=\"\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\" [settings]=\"{ decimals:0 }\"></core-field-number>\n    </div>\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.max\" name=\"max\" fieldName=\"max\" placeholder=\"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\" [settings]=\"{ decimals:0 }\"></core-field-number>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.isMoney\" name=\"isMoney\" fieldName=\"isMoney\" placeholder=\"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u0434\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0434\u0435\u043D\u0435\u0433\" [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.isPercentage\" name=\"isPercentage\" fieldName=\"isPercentage\" placeholder=\"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u0434\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043F\u0440\u043E\u0446\u0435\u043D\u0442\u043E\u0432\" [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n  }\n\n  <!--\u0414\u043B\u044F \u0442\u0438\u043F\u0430 boolean-->\n  @if (fieldType === 3) {\n    <div class=\"form-group sln-option-view\">\n      <mat-radio-group [(ngModel)]=\"settings.mode\" name=\"mode\">\n        <mat-radio-button value=\"Option\" style=\"margin-left: 5px;\">Option</mat-radio-button>\n        <mat-radio-button value=\"Checkbox\">Checkbox</mat-radio-button>\n        <mat-radio-button value=\"Slide\" style=\"margin-left: 5px;\">Slide</mat-radio-button>\n      </mat-radio-group>\n    </div>\n    <div class=\"form-group\">\n      <core-field-string [(ngModel)]=\"settings.positiveText\" name=\"positiveText\" fieldName=\"positiveText\" placeholder=\"\u0422\u0435\u043A\u0441\u0442 \u043F\u043E\u043B\u043E\u0436\u0438\u0442\u0435\u043B\u044C\u043D\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F\" [settings]=\"{ maxLength: 100, defaultText: '\u0414\u0430' }\"></core-field-string>\n    </div>\n    <div class=\"form-group\">\n      <core-field-string [(ngModel)]=\"settings.negativeText\" name=\"negativeText\" fieldName=\"negativeText\" placeholder=\"\u0422\u0435\u043A\u0441\u0442 \u043E\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F\" [settings]=\"{ maxLength: 100, defaultText: '\u041D\u0435\u0442' }\"></core-field-string>\n    </div>\n  }\n\n  <!--\u0414\u043B\u044F \u0442\u0438\u043F\u0430 datetime-->\n  @if (fieldType === 5) {\n    <div class=\"form-group\">\n      <core-field-date [(ngModel)]=\"settings.min\" name=\"min\" fieldName=\"min\" placeholder=\"\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\"></core-field-date>\n    </div>\n    <div class=\"form-group\">\n      <core-field-date [(ngModel)]=\"settings.max\" name=\"max\" fieldName=\"max\" placeholder=\"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\"></core-field-date>\n    </div>\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.minCount\" name=\"minCount\" fieldName=\"minCount\" placeholder=\"\u0414\u043D\u0435\u0439 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u0432 \u043F\u0440\u043E\u0448\u043B\u043E\u043C\"\n      [settings]=\"{ min: 0, decimals:0 }\"></core-field-number>\n    </div>\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.maxCount\" name=\"maxCount\" fieldName=\"maxCount\" placeholder=\"\u0414\u043D\u0435\u0439 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043C\"\n      [settings]=\"{ min: 0, decimals:0 }\"></core-field-number>\n    </div>\n  }\n\n  <!--\u0414\u043B\u044F \u0442\u0438\u043F\u0430 combobox-->\n  @if (fieldType === 7) {\n    <div class=\"form-group\">\n      <core-field-combobox [(ngModel)]=\"settings.sourceCode\" name=\"sourceCode\" fieldName=\"sourceCode\" placeholder=\"\u0421\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\"\n      [settings]=\"{ sourceCode:'DirectoryList', isRequired: true }\"></core-field-combobox>\n    </div>\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.recordCount\" name=\"recordCount\" fieldName=\"recordCount\" placeholder=\"\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u043D\u0430 \u0437\u0430\u043F\u0440\u043E\u0441\"\n      [settings]=\"{ min: 0, decimals:0 }\"></core-field-number>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.selectFirst\" name=\"selectFirst\" fieldName=\"selectFirst\" placeholder=\"\u0412\u044B\u0431\u0438\u0440\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u0443\u044E \u0437\u0430\u043F\u0438\u0441\u044C \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E\"\n      [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.hideEmpty\" name=\"hideEmpty\" fieldName=\"hideEmpty\" placeholder=\"\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043F\u0443\u0441\u0442\u043E\u0439 \u0432\u044B\u0431\u043E\u0440\"\n      [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.hideSearch\" name=\"hideSearch\" fieldName=\"hideSearch\" placeholder=\"\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043F\u043E\u0438\u0441\u043A\"\n      [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n  }\n\n  <!--\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u043D\u0444\u043E\u0440\u043C\u0435\u0440\u0430-->\n  @if ([1,2,3,4,5,7].includes(fieldType)) {\n    <div class=\"form-group\" >\n      <core-field-bool [(ngModel)]=\"settings.useInformer\" name=\"useInformer\" fieldName=\"useInformer\" placeholder=\"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0443-\u0438\u043D\u0444\u043E\u0440\u043C\u0435\u0440\" [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n    @if (settings.useInformer) {\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"settings.informerIcon\" name=\"informerIcon\" fieldName=\"informerIcon\" placeholder=\"\u0418\u043A\u043E\u043D\u043A\u0430 \u0438\u043D\u0444\u043E\u0440\u043C\u0435\u0440\u0430\" [settings]=\"{ maxLength: 50, defaultText:'fa-question-circle-o' }\"></core-field-string>\n      </div>\n      @if (fieldType !== 3 || (fieldType === 3 && settings.mode !== 'Option')) {\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"settings.informerText\" name=\"informerText\" fieldName=\"informerText\" placeholder=\"\u0422\u0435\u043A\u0441\u0442 \u0438\u043D\u0444\u043E\u0440\u043C\u0435\u0440\u0430\" [settings]=\"{ isRequired: settings.useInformer, maxLength: 400 }\"></core-field-string>\n        </div>\n      }\n      @if (fieldType === 3 && settings.mode === 'Option') {\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"settings.positiveinformerText\" name=\"positiveinformerText\" fieldName=\"positiveinformerText\" placeholder=\"\u0418\u043D\u0444\u043E\u0440\u043C\u0435\u0440 \u043F\u043E\u043B\u043E\u0436\u0438\u0442\u0435\u043B\u044C\u043D\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F\" [settings]=\"{ maxLength: 250 }\"></core-field-string>\n        </div>\n      }\n      @if (fieldType === 3 && settings.mode === 'Option') {\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"settings.negativeinformerText\" name=\"negativeinformerText\" fieldName=\"negativeinformerText\" placeholder=\"\u0418\u043D\u0444\u043E\u0440\u043C\u0435\u0440 \u043E\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F\" [settings]=\"{ maxLength: 250 }\"></core-field-string>\n        </div>\n      }\n    }\n  }\n</div>", styles: [".sln-option-view{height:45px;margin-top:10px;padding-top:5px}\n"], dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1$1.ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: i3.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i3.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "component", type: i1$1.CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: i1$1.CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: i1$1.CoreFieldTypeDateTimeComponent, selector: "core-field-date" }, { kind: "component", type: i1$1.CoreFieldTypeNumberComponent, selector: "core-field-number", inputs: ["isInt"] }, { kind: "component", type: i1$1.CoreFieldTypeStringComponent, selector: "core-field-string" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BpmFieldSettingsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bpm-field-settings', standalone: false, template: "<div provideParentForm>\n  <div class=\"form-group\">\n    <core-field-bool [(ngModel)]=\"settings.isRequired\" name=\"isRequired\" fieldName=\"isRequired\" placeholder=\"\u041F\u043E\u043B\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u043C \u043A \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044E\"\n    [settings]=\"{ mode: 'Checkbox' }\" [disabled]=\"isHiddenField\"></core-field-bool>\n  </div>\n\n  <!-- \u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0434\u043B\u044F \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u044B\u0445 \u0442\u0438\u043F\u043E\u0432 -->\n  <!--\u0414\u043B\u044F \u0442\u0438\u043F\u0430 string-->\n  @if (fieldType === 1) {\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.maxLength\" name=\"maxLength\" fieldName=\"maxLength\" placeholder=\"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430\" [settings]=\"{ min: 0, max: 500, decimals:0 }\"></core-field-number>\n    </div>\n    <div class=\"form-group\">\n      <core-field-string [(ngModel)]=\"settings.defaultText\" name=\"defaultText\" fieldName=\"defaultText\" placeholder=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E\u043B\u044F \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E\" [settings]=\"{ maxLength: 100 }\"></core-field-string>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.useMask\" name=\"useMask\" fieldName=\"useMask\" placeholder=\"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043C\u0430\u0441\u043A\u0443 \u0434\u043B\u044F \u0434\u0430\u043D\u043D\u044B\u0445\" [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n    @if (settings.useMask) {\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"settings.maskExpression\" name=\"maskExpression\" fieldName=\"maskExpression\" placeholder=\"\u041C\u0430\u0441\u043A\u0430 \u0434\u043B\u044F \u0434\u0430\u043D\u043D\u044B\u0445\" [settings]=\"{ isRequired: settings.useMask, maxLength: 100, useInformer: true, informerText: '\u041C\u0430\u0441\u043A\u0430 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044F \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 NgxMask' }\"></core-field-string>\n      </div>\n    }\n  }\n\n  <!--\u0414\u043B\u044F \u0442\u0438\u043F\u0430 number-->\n  @if (fieldType === 2 || fieldType === 4) {\n    @if (fieldType === 4) {\n      <div class=\"form-group\">\n        <core-field-number [(ngModel)]=\"settings.decimals\" name=\"decimals\" fieldName=\"decimals\" placeholder=\"\u0417\u043D\u0430\u043A\u043E\u0432 \u043F\u043E\u0441\u043B\u0435 \u0437\u0430\u043F\u044F\u0442\u043E\u0439\" [settings]=\"{ min: 0, max: 4, decimals:0 }\"></core-field-number>\n      </div>\n    }\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.min\" name=\"min\" fieldName=\"min\" placeholder=\"\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\" [settings]=\"{ decimals:0 }\"></core-field-number>\n    </div>\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.max\" name=\"max\" fieldName=\"max\" placeholder=\"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\" [settings]=\"{ decimals:0 }\"></core-field-number>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.isMoney\" name=\"isMoney\" fieldName=\"isMoney\" placeholder=\"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u0434\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0434\u0435\u043D\u0435\u0433\" [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.isPercentage\" name=\"isPercentage\" fieldName=\"isPercentage\" placeholder=\"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u0434\u043B\u044F \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043F\u0440\u043E\u0446\u0435\u043D\u0442\u043E\u0432\" [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n  }\n\n  <!--\u0414\u043B\u044F \u0442\u0438\u043F\u0430 boolean-->\n  @if (fieldType === 3) {\n    <div class=\"form-group sln-option-view\">\n      <mat-radio-group [(ngModel)]=\"settings.mode\" name=\"mode\">\n        <mat-radio-button value=\"Option\" style=\"margin-left: 5px;\">Option</mat-radio-button>\n        <mat-radio-button value=\"Checkbox\">Checkbox</mat-radio-button>\n        <mat-radio-button value=\"Slide\" style=\"margin-left: 5px;\">Slide</mat-radio-button>\n      </mat-radio-group>\n    </div>\n    <div class=\"form-group\">\n      <core-field-string [(ngModel)]=\"settings.positiveText\" name=\"positiveText\" fieldName=\"positiveText\" placeholder=\"\u0422\u0435\u043A\u0441\u0442 \u043F\u043E\u043B\u043E\u0436\u0438\u0442\u0435\u043B\u044C\u043D\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F\" [settings]=\"{ maxLength: 100, defaultText: '\u0414\u0430' }\"></core-field-string>\n    </div>\n    <div class=\"form-group\">\n      <core-field-string [(ngModel)]=\"settings.negativeText\" name=\"negativeText\" fieldName=\"negativeText\" placeholder=\"\u0422\u0435\u043A\u0441\u0442 \u043E\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F\" [settings]=\"{ maxLength: 100, defaultText: '\u041D\u0435\u0442' }\"></core-field-string>\n    </div>\n  }\n\n  <!--\u0414\u043B\u044F \u0442\u0438\u043F\u0430 datetime-->\n  @if (fieldType === 5) {\n    <div class=\"form-group\">\n      <core-field-date [(ngModel)]=\"settings.min\" name=\"min\" fieldName=\"min\" placeholder=\"\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\"></core-field-date>\n    </div>\n    <div class=\"form-group\">\n      <core-field-date [(ngModel)]=\"settings.max\" name=\"max\" fieldName=\"max\" placeholder=\"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\"></core-field-date>\n    </div>\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.minCount\" name=\"minCount\" fieldName=\"minCount\" placeholder=\"\u0414\u043D\u0435\u0439 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u0432 \u043F\u0440\u043E\u0448\u043B\u043E\u043C\"\n      [settings]=\"{ min: 0, decimals:0 }\"></core-field-number>\n    </div>\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.maxCount\" name=\"maxCount\" fieldName=\"maxCount\" placeholder=\"\u0414\u043D\u0435\u0439 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043C\"\n      [settings]=\"{ min: 0, decimals:0 }\"></core-field-number>\n    </div>\n  }\n\n  <!--\u0414\u043B\u044F \u0442\u0438\u043F\u0430 combobox-->\n  @if (fieldType === 7) {\n    <div class=\"form-group\">\n      <core-field-combobox [(ngModel)]=\"settings.sourceCode\" name=\"sourceCode\" fieldName=\"sourceCode\" placeholder=\"\u0421\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\"\n      [settings]=\"{ sourceCode:'DirectoryList', isRequired: true }\"></core-field-combobox>\n    </div>\n    <div class=\"form-group\">\n      <core-field-number [(ngModel)]=\"settings.recordCount\" name=\"recordCount\" fieldName=\"recordCount\" placeholder=\"\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u043D\u0430 \u0437\u0430\u043F\u0440\u043E\u0441\"\n      [settings]=\"{ min: 0, decimals:0 }\"></core-field-number>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.selectFirst\" name=\"selectFirst\" fieldName=\"selectFirst\" placeholder=\"\u0412\u044B\u0431\u0438\u0440\u0430\u0442\u044C \u043F\u0435\u0440\u0432\u0443\u044E \u0437\u0430\u043F\u0438\u0441\u044C \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E\"\n      [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.hideEmpty\" name=\"hideEmpty\" fieldName=\"hideEmpty\" placeholder=\"\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043F\u0443\u0441\u0442\u043E\u0439 \u0432\u044B\u0431\u043E\u0440\"\n      [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n    <div class=\"form-group\">\n      <core-field-bool [(ngModel)]=\"settings.hideSearch\" name=\"hideSearch\" fieldName=\"hideSearch\" placeholder=\"\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u043F\u043E\u0438\u0441\u043A\"\n      [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n  }\n\n  <!--\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u043D\u0444\u043E\u0440\u043C\u0435\u0440\u0430-->\n  @if ([1,2,3,4,5,7].includes(fieldType)) {\n    <div class=\"form-group\" >\n      <core-field-bool [(ngModel)]=\"settings.useInformer\" name=\"useInformer\" fieldName=\"useInformer\" placeholder=\"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0443-\u0438\u043D\u0444\u043E\u0440\u043C\u0435\u0440\" [settings]=\"{ mode: 'Checkbox' }\"></core-field-bool>\n    </div>\n    @if (settings.useInformer) {\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"settings.informerIcon\" name=\"informerIcon\" fieldName=\"informerIcon\" placeholder=\"\u0418\u043A\u043E\u043D\u043A\u0430 \u0438\u043D\u0444\u043E\u0440\u043C\u0435\u0440\u0430\" [settings]=\"{ maxLength: 50, defaultText:'fa-question-circle-o' }\"></core-field-string>\n      </div>\n      @if (fieldType !== 3 || (fieldType === 3 && settings.mode !== 'Option')) {\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"settings.informerText\" name=\"informerText\" fieldName=\"informerText\" placeholder=\"\u0422\u0435\u043A\u0441\u0442 \u0438\u043D\u0444\u043E\u0440\u043C\u0435\u0440\u0430\" [settings]=\"{ isRequired: settings.useInformer, maxLength: 400 }\"></core-field-string>\n        </div>\n      }\n      @if (fieldType === 3 && settings.mode === 'Option') {\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"settings.positiveinformerText\" name=\"positiveinformerText\" fieldName=\"positiveinformerText\" placeholder=\"\u0418\u043D\u0444\u043E\u0440\u043C\u0435\u0440 \u043F\u043E\u043B\u043E\u0436\u0438\u0442\u0435\u043B\u044C\u043D\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F\" [settings]=\"{ maxLength: 250 }\"></core-field-string>\n        </div>\n      }\n      @if (fieldType === 3 && settings.mode === 'Option') {\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"settings.negativeinformerText\" name=\"negativeinformerText\" fieldName=\"negativeinformerText\" placeholder=\"\u0418\u043D\u0444\u043E\u0440\u043C\u0435\u0440 \u043E\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0433\u043E \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F\" [settings]=\"{ maxLength: 250 }\"></core-field-string>\n        </div>\n      }\n    }\n  }\n</div>", styles: [".sln-option-view{height:45px;margin-top:10px;padding-top:5px}\n"] }]
        }], propDecorators: { fieldType: [{
                type: Input
            }], isHiddenField: [{
                type: Input
            }], settings: [{
                type: Input
            }], valueChange: [{
                type: Output
            }] } });

class BpmComboboxBaseUriDescriptionService {
    constructor(_startUp) {
        this._startUp = _startUp;
    }
    getUri(code, module) {
        const urls = [
            // ada
            { code: 'Strategies', url: this._url('vectors/strategy/combobox') },
            { code: 'Rules', url: this._url('rules/combobox') },
            { code: 'RuleTypes', url: this._url('rules/combobox/types') },
            { code: 'RuleSettingCriterionConditions', url: this._url('rules/combobox/criterion-conditions') },
            { code: 'RuleSettingInOrNotInConditions', url: this._url('rules/combobox/in-or-not-in-conditions') },
            { code: 'AvailableRoutes', url: this._url('rules/combobox/check-route') },
            // bpm
            { code: 'ActionFinishTypes', url: this._url('actions/combobox/finish-types') },
            { code: 'ActionTypes', url: this._url('actions/combobox') },
            { code: 'StepTypes', url: this._url('steps/types/combobox') },
            { code: 'Steps', url: this._url('steps/combobox') },
            { code: 'Processes', url: this._url('processes/combobox') },
            { code: 'ProcessRoles', url: this._url('process-roles/combobox') },
            { code: 'ReviewRuleTypes', url: this._url('step-review-rules/combobox') },
            { code: 'CustomFieldTypes', url: this._url('step-fields/custom-fields/combobox') },
            { code: 'FieldRuleTypes', url: this._url('step-fields/rules/type/combobox') },
            { code: 'SendingTypes', url: this._url('step-edi-exchange/sending-types') },
            { code: 'OnetimeScopes', url: () => this._startUp.apiRoot('step-edi-exchange/onetime-scopes') },
            // etp
            { code: 'ProcessStatuses', url: this._url('requests/statuses/combobox') },
            { code: 'EdiRequestStatusFilter', url: this._url('edi-queue/filter/status-combobox') },
            { code: 'ReportStatuses', url: this._url('reports/statuses/combobox') },
            // cross-module
            { code: 'Providers', url: this._url('providers/combobox', module) },
            { code: 'ParentRequests', url: this._url('requests/parent-logic/combobox', module) },
        ];
        let url = urls.filter(x => x.code === code)[0]?.url();
        return url;
    }
    _url(part, module) {
        return () => this._startUp.apiRoot(part, module ?? 'bpm');
    }
    getLocalSourse(code, filters) {
        switch (code) {
            case 'Local_ActionTypeClass': {
                return this.getActionTypeClass();
            }
            case 'Local_DestinationType': {
                return this.getDestinationType();
            }
            case 'Local_ValidToUnit': {
                return this.getValidToUnit();
            }
            case 'Local_ViewMode': {
                return this.getViewMode();
            }
            case 'Local_RequestButtonMode': {
                return this.getRequestButtonMode();
            }
            case 'Local_DataType': {
                return this.getDataType();
            }
            case 'Local_PipeType': {
                return this.getPipeType();
            }
            case 'Local_FilterCondition': {
                return this.getFilterCondition();
            }
            case 'Local_ItMustBeBrokerRequest': {
                return this.getItMustBeBrokerRequest();
            }
            default: {
                return undefined;
            }
        }
    }
    // получение списка доступных классов для функционального действия
    getActionTypeClass() {
        const sourse = new Array();
        sourse.push({ id: 1, text: 'default', description: null });
        sourse.push({ id: 2, text: 'primary', description: null });
        sourse.push({ id: 3, text: 'success', description: null });
        sourse.push({ id: 4, text: 'info', description: null });
        sourse.push({ id: 5, text: 'warning', description: null });
        sourse.push({ id: 6, text: 'danger', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    getDestinationType() {
        const sourse = new Array();
        sourse.push({ id: 2, text: 'Автоматическое распределение', description: null });
        sourse.push({ id: 1, text: 'Прямое распределение', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    getValidToUnit() {
        const sourse = new Array();
        sourse.push({ id: 'D', text: 'День', description: null });
        sourse.push({ id: 'm', text: 'Минута', description: null });
        sourse.push({ id: 's', text: 'Секунда', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    getViewMode() {
        const sourse = new Array();
        sourse.push({ id: 'column', text: 'Колоночное отображение', description: null });
        sourse.push({ id: 'block', text: 'Блочное отображение', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    getRequestButtonMode() {
        const sourse = new Array();
        sourse.push({ id: 1, text: 'Классический режим ', description: null });
        sourse.push({ id: 2, text: 'Черновик в окне', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    /**Cправочники для настройки списка заявок**/
    getDataType() {
        const sourse = new Array();
        sourse.push({ id: 1, text: 'String', description: null });
        sourse.push({ id: 3, text: 'Boolean', description: null });
        sourse.push({ id: 4, text: 'Number', description: null });
        sourse.push({ id: 5, text: 'DateTime', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    getPipeType() {
        const sourse = new Array();
        sourse.push({ id: 'dateRu', text: 'dateRu', description: null });
        sourse.push({ id: 'dateTimeRu', text: 'dateTimeRu', description: null });
        sourse.push({ id: 'money', text: 'money', description: null });
        sourse.push({ id: 'percentTransform', text: 'percentTransform', description: "30 -> 30%" });
        sourse.push({ id: 'boolean', text: 'boolean', description: "true -> Да" });
        sourse.push({ id: 'proportion', text: 'proportion', description: "0.4 -> 40%" });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    getFilterCondition() {
        const sourse = new Array();
        sourse.push({ id: 'Contains', text: 'Contains', description: null });
        sourse.push({ id: 'EqualTo', text: 'EqualTo', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    getItMustBeBrokerRequest() {
        const sourse = new Array();
        sourse.push({ id: 'ItMustBe', text: 'Формировалась брокером', description: null });
        sourse.push({ id: 'ItNotMustBe', text: 'Не формировалась брокером', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BpmComboboxBaseUriDescriptionService, deps: [{ token: i1$1.Startup }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BpmComboboxBaseUriDescriptionService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BpmComboboxBaseUriDescriptionService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: i1$1.Startup }] });

class ProcessCommonModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ProcessCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: ProcessCommonModule, declarations: [
            // common
            BpmActorCommonInfoComponent,
            CommonAdditionalInfoComponent,
            CommonCustomerEmailComponent,
            CommonCounteragentDepartmentIdComponent,
            SearchProductPipe,
            BpmProviderListDialogWindow,
            BpmFieldSettingsComponent], imports: [CoreBaseModule,
            CoreMatModule,
            CoreDirectiveModule,
            CoreControlModule,
            CoreDialogModule,
            CoreDaDataModule,
            CorePipeModule,
            CoreCompositeAccessSchemaModule,
            CoreOrganizationModule,
            CoreUploaderModule,
            CoreNotificationModule], exports: [
            // common
            BpmActorCommonInfoComponent,
            CommonAdditionalInfoComponent,
            CommonCustomerEmailComponent,
            CommonCounteragentDepartmentIdComponent,
            SearchProductPipe,
            BpmProviderListDialogWindow,
            BpmFieldSettingsComponent,
            CoreNotificationModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ProcessCommonModule, providers: [
            provideHttpClient(withInterceptorsFromDi()),
            ActionFinishService,
            RequestBaseService,
            BpmComboboxBaseUriDescriptionService
        ], imports: [CoreBaseModule,
            CoreMatModule,
            CoreDirectiveModule,
            CoreControlModule,
            CoreDialogModule,
            CoreDaDataModule,
            CorePipeModule,
            CoreCompositeAccessSchemaModule,
            CoreOrganizationModule,
            CoreUploaderModule,
            CoreNotificationModule, CoreNotificationModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ProcessCommonModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        // common
                        BpmActorCommonInfoComponent,
                        CommonAdditionalInfoComponent,
                        CommonCustomerEmailComponent,
                        CommonCounteragentDepartmentIdComponent,
                        SearchProductPipe,
                        BpmProviderListDialogWindow,
                        BpmFieldSettingsComponent
                    ],
                    imports: [
                        CoreBaseModule,
                        CoreMatModule,
                        CoreDirectiveModule,
                        CoreControlModule,
                        CoreDialogModule,
                        CoreDaDataModule,
                        CorePipeModule,
                        CoreCompositeAccessSchemaModule,
                        CoreOrganizationModule,
                        CoreUploaderModule,
                        CoreNotificationModule
                    ],
                    providers: [
                        provideHttpClient(withInterceptorsFromDi()),
                        ActionFinishService,
                        RequestBaseService,
                        BpmComboboxBaseUriDescriptionService
                    ],
                    exports: [
                        // common
                        BpmActorCommonInfoComponent,
                        CommonAdditionalInfoComponent,
                        CommonCustomerEmailComponent,
                        CommonCounteragentDepartmentIdComponent,
                        SearchProductPipe,
                        BpmProviderListDialogWindow,
                        BpmFieldSettingsComponent,
                        CoreNotificationModule
                    ]
                }]
        }] });

class CommonActorInfo {
}

class DistributionResultMetadata {
}
class DistributionResultNode {
}
class DistributionResultRoot {
}
class DistributionResult {
}

class RequestReviewRuleDepartment {
}
class RequestReviewRuleMetadata {
}
class RequestReviewRuleMetadataMra {
}
class RequestReviewRule {
}

class ScoringResult {
}
class ScoringResultV2 {
}
class ScoreBaseDataV2 {
}
class ScoreFinBalance {
}
class ScoreFinBalanceCell {
}
class ScoreIndexBase {
}
class ScorePeriodIndexBase {
}
class ScoreMethodic {
}
class OrganizationScoreTable {
}
class ScoreTable {
}
class DymanicRuleGroup {
}
class DymanicRuleGroupWithScore extends DymanicRuleGroup {
}
class ScoreOrganization {
}
class RuleCalculationResult {
}

var FieldRuleType;
(function (FieldRuleType) {
    // Отображать поле
    FieldRuleType[FieldRuleType["IsVisible"] = 1] = "IsVisible";
    // Делать поле обязательным
    FieldRuleType[FieldRuleType["IsRequired"] = 2] = "IsRequired";
    // Заполнить по умолчанию
    FieldRuleType[FieldRuleType["FillDefault"] = 3] = "FillDefault";
    // Получить значение поля
    FieldRuleType[FieldRuleType["GetValue"] = 4] = "GetValue";
    // Передать данные в другое поле
    FieldRuleType[FieldRuleType["TransferData"] = 5] = "TransferData";
    // Передать данные в другое поле
    FieldRuleType[FieldRuleType["TransferDataUI"] = 6] = "TransferDataUI";
    // Сбросить документы при изменении
    FieldRuleType[FieldRuleType["SetDocumentsEmpty"] = 7] = "SetDocumentsEmpty";
    // Сбросить документы при изменении
    FieldRuleType[FieldRuleType["CleanControls"] = 8] = "CleanControls";
    // Отображать документ
    FieldRuleType[FieldRuleType["IsDocumentHidden"] = 9] = "IsDocumentHidden";
})(FieldRuleType || (FieldRuleType = {}));
class RequestFieldRule {
}
var CustomFieldEnum;
(function (CustomFieldEnum) {
    CustomFieldEnum[CustomFieldEnum["ContractObligations"] = 1] = "ContractObligations";
    CustomFieldEnum[CustomFieldEnum["GuaranteeType"] = 2] = "GuaranteeType";
    CustomFieldEnum[CustomFieldEnum["Contract"] = 3] = "Contract";
    CustomFieldEnum[CustomFieldEnum["FactoringProducts"] = 4] = "FactoringProducts";
    CustomFieldEnum[CustomFieldEnum["TariffsRange"] = 5] = "TariffsRange";
    CustomFieldEnum[CustomFieldEnum["FinancialRequirements"] = 6] = "FinancialRequirements";
    CustomFieldEnum[CustomFieldEnum["FactoringCondition"] = 7] = "FactoringCondition";
    CustomFieldEnum[CustomFieldEnum["AdditionalInfo"] = 8] = "AdditionalInfo";
    CustomFieldEnum[CustomFieldEnum["CounteragentBox"] = 9] = "CounteragentBox";
    CustomFieldEnum[CustomFieldEnum["FactoringConditionRequest"] = 10] = "FactoringConditionRequest";
    CustomFieldEnum[CustomFieldEnum["CustomerEmail"] = 11] = "CustomerEmail";
})(CustomFieldEnum || (CustomFieldEnum = {}));
class RequestField {
    constructor() {
        this.visible = undefined;
    }
}
class RequestDocument {
}
class RequestDocumentSignSide {
    constructor() {
        this.all = true;
    }
}

var UpdatedPanelElementTypeEnum;
(function (UpdatedPanelElementTypeEnum) {
    UpdatedPanelElementTypeEnum[UpdatedPanelElementTypeEnum["Field"] = 1] = "Field";
    UpdatedPanelElementTypeEnum[UpdatedPanelElementTypeEnum["Document"] = 2] = "Document";
    UpdatedPanelElementTypeEnum[UpdatedPanelElementTypeEnum["FinancialBalance"] = 3] = "FinancialBalance";
    UpdatedPanelElementTypeEnum[UpdatedPanelElementTypeEnum["FinancialXmlUid"] = 4] = "FinancialXmlUid";
    UpdatedPanelElementTypeEnum[UpdatedPanelElementTypeEnum["ProfileFile"] = 5] = "ProfileFile";
    UpdatedPanelElementTypeEnum[UpdatedPanelElementTypeEnum["ProfileXmlUid"] = 6] = "ProfileXmlUid";
    UpdatedPanelElementTypeEnum[UpdatedPanelElementTypeEnum["ProfileInternalFiles"] = 7] = "ProfileInternalFiles";
    UpdatedPanelElementTypeEnum[UpdatedPanelElementTypeEnum["PrintFromFile"] = 9] = "PrintFromFile";
})(UpdatedPanelElementTypeEnum || (UpdatedPanelElementTypeEnum = {}));

class RequestPanelMetadataParentLogic {
}
class RequestPanelMetadata {
}
class RequestPanel {
    constructor() {
        this.metadata = new RequestPanelMetadata();
    }
}

var ReviewResultEnum;
(function (ReviewResultEnum) {
    // Не выбрано
    ReviewResultEnum[ReviewResultEnum["NotSelected"] = 0] = "NotSelected";
    // Проверка пройдена
    ReviewResultEnum[ReviewResultEnum["Passed"] = 1] = "Passed";
    // Проверка не пройдена
    ReviewResultEnum[ReviewResultEnum["NotPassed"] = 2] = "NotPassed";
    // Требуется проверка
    ReviewResultEnum[ReviewResultEnum["Condition"] = 3] = "Condition";
    // Пропущено
    ReviewResultEnum[ReviewResultEnum["Skip"] = 4] = "Skip";
    // Ошибка вычисления
    ReviewResultEnum[ReviewResultEnum["Error"] = 5] = "Error";
})(ReviewResultEnum || (ReviewResultEnum = {}));
var ReviewRuleTypeEnum;
(function (ReviewRuleTypeEnum) {
    ReviewRuleTypeEnum[ReviewRuleTypeEnum["DefaultRule"] = 1] = "DefaultRule";
    ReviewRuleTypeEnum[ReviewRuleTypeEnum["MraRule"] = 2] = "MraRule";
})(ReviewRuleTypeEnum || (ReviewRuleTypeEnum = {}));

var DestinationType;
(function (DestinationType) {
    // прямое распределение
    DestinationType[DestinationType["Direct"] = 1] = "Direct";
    // Автоматическое распределение
    DestinationType[DestinationType["Ada"] = 2] = "Ada";
    // Каждому по одной
    DestinationType[DestinationType["OneByOne"] = 3] = "OneByOne";
})(DestinationType || (DestinationType = {}));
class EtpBaseEntity {
}
class Distribution extends EtpBaseEntity {
}
class RequestMetadata {
}
class StatusBarItem {
}
class RequestRunDocument {
}
class Request extends EtpBaseEntity {
    constructor() {
        super();
        this.metadata = new RequestMetadata();
    }
    static DefaltRequest(systemObjectId) {
        const request = new Request();
        request.metadata = new RequestMetadata();
        if (!Number.isNaN(systemObjectId)) {
            request.metadata.systemObjectId = systemObjectId;
        }
        request.editable = new RequestPanel();
        request.panels = new Array();
        request.buttons = new Array();
        return request;
    }
}
class RequestParentLink {
}

class IProvider {
}
class IProviderProduct {
}
class IProviderFileGeneration {
}

// Наименование очередей для событий обмена данными через EventBroker
class EventBusConstants {
    static { this.RequestPageProviderListener = 'bpm-request-page-provider-listener'; }
    // Событие обновления списка поставщиков в контроле bpm-provider-list
    static { this.RequestPageProviderListUpdatedListener = 'bpm-request-page-provider-list-updated-listener'; }
    static { this.RequestPageEditableStateListener = 'bpm-request-page-editable-state-listener'; }
    // Событие изменения поля ParentId
    static { this.RequestPageParentSelectedEvent = 'bpm-request-page-parent-selected-event'; }
    // Событие изменения результата скоринга для панели Reviews
    static { this.RequestPanelScoringResultUpdatedListener = 'bpm-request-panel-scoring-result-updated-listener'; }
    // Событие изменения индекса вкладки скоринга
    static { this.RequestPanelScoringTabIndexUpdatedListener = 'bpm-request-panel-scoring-tab-index-updated-listener'; }
}

class InvalidFormServiceExtension extends InvalidFormService {
    showErrorMessage(fields) {
        let errorMessage = '<span>Необходимо заполнить все обязательные поля:</span><ul>';
        const maxShown = 6;
        const slice = fields.length > maxShown ? fields.slice(0, maxShown) : fields;
        slice.forEach(field => {
            errorMessage += '<li>' + field + '</li>';
        });
        if (fields.length > maxShown) {
            const moreCount = fields.length - maxShown;
            errorMessage += '<li>Еще ' + moreCount + ' поле(й) не заполнено</li>';
        }
        errorMessage = errorMessage + '</ul>';
        CoreNotification.error(errorMessage, true);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: InvalidFormServiceExtension, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: InvalidFormServiceExtension, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: InvalidFormServiceExtension, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

class ActionExecutionBaseService {
    constructor(_injector, _popup) {
        this._injector = _injector;
        this._popup = _popup;
        this._destroy$ = new ReplaySubject(1);
    }
    ngOnDestroy() {
        this._destroy$.next(true);
        this._destroy$.complete();
    }
    takeUntilDestroyed() {
        return takeUntil(this._destroy$.asObservable());
    }
    actionBlock(target) {
        ButtonLoadingService.run(target);
        this._injector.get(EventBrokerService).emit(EventBusConstants.RequestPageEditableStateListener, true);
    }
    actionUnblock(target) {
        ButtonLoadingService.stop(target);
        this._injector.get(EventBrokerService).emit(EventBusConstants.RequestPageEditableStateListener, false);
    }
    saveAsDraft(data, finishFunc) {
        this._injector.get(RequestBaseService)
            .saveDraft(data.request)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                if (Utility.isEmpty(data.request.requestUid)) {
                    data.request.requestUid = entity.id;
                    data.request.requestNum = entity.requestNum;
                    this._injector.get(EventBrokerService).emit(EventBusConstants.RequestPageProviderListener, entity.providerId);
                }
                const printFormSettings = entity.buttons?.find(x => x.processActionId === data.action.processActionId)?.printFormSettings;
                if (printFormSettings) {
                    data.action.printFormSettings = printFormSettings;
                }
                data.request.editable.metadata.currentProviderId = entity.providerId;
                finishFunc(data);
            }
        }));
    }
    functionChainLogic(data, mainFunc) {
        // функция подписания документов формы edititable
        const signFunc = (excData) => {
            this._signFiles(excData, mainFunc);
        };
        // функция генерации и отображения печатной формы
        const generateFunc = (excData) => {
            this._generatePrint(excData, signFunc);
        };
        // функция логики "Подписание документа основания для работы с процессом"
        const agreementCheckFunc = (excData) => {
            // логика проверки документов генерируемых для старта процесса работает только при отправки заявки клиентом в сервис
            // действия: "Отправить заявку" и "Перейти в статус"
            const hasGoToStatus = excData.action.processActionId === ActionEnum.GoToStatus && excData.request.panels?.length === 0;
            const hasSendRequest = excData.action.processActionId === ActionEnum.SendRequest;
            const hasFoundationDoc = excData.request.metadata.runDocument?.length > 0;
            if (hasFoundationDoc && (hasSendRequest || hasGoToStatus || excData.action.hasProvidersChoice)) {
                this._providersCheck(excData, (filledData) => {
                    generateFunc(excData);
                });
            }
            else {
                generateFunc(excData);
            }
        };
        const action = data.action;
        const isFormValid = this._injector.get(InvalidFormServiceExtension).invalidFormLogicCall().length === 0;
        if (action.itMustValidate === false || (action.itMustValidate === true && isFormValid === true)) {
            if (Utility.isEmpty(data.request.requestUid) || data.request.statusId === 10) { // Draft
                this.saveAsDraft(data, agreementCheckFunc);
            }
            else {
                agreementCheckFunc(data);
            }
        }
    }
    _providersCheck(excData, callback) {
        this._injector.get(RequestBaseService).getProviders(excData.request.metadata, excData.request.requestUid)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                const selected = entity.filter(x => excData.request.metadata.selectedProviders.includes(x.organizationId));
                if (selected.length === 1 && selected[0].isAgreementFileSign === true) {
                    // если поставщик выбран только один и договор подписан, то не имеет смысла открывать окно выбора поставщика                    
                    this._generateProviderForms(selected, excData, callback);
                }
                else {
                    // должны отобразить все организации, но те которые не вошли в выбранную группу должны быть в состоянии "не выбрано"
                    excData.request.metadata.selectedProviders.forEach(x => {
                        const p = entity.find(y => y.organizationId === x);
                        if (p) {
                            p.selected = true;
                        }
                    });
                    CoreDialog.window(BpmProviderListDialogWindow, entity, (result) => {
                        //поскольку в окне может изменится состав поставщиков, то нужно заменить блок selectedProviders в заявке                       
                        excData.request.metadata.selectedProviders = result.map(x => x.organizationId);
                        // если поменялся состав выбранных поставщиков, то нужно обновить их состав и в контроле bpm-provider-list
                        this._injector
                            .get(EventBrokerService)
                            .emit(EventBusConstants.RequestPageProviderListUpdatedListener, excData.request.metadata.selectedProviders);
                        this._generateProviderForms(result, excData, callback);
                    }, () => {
                        this.actionUnblock(excData.target);
                    });
                }
            }
        }));
    }
    _generateProviderForms(providers, data, callback) {
        const request = data.request;
        const entityTypeId = Number(Utility.isEmpty(request.distribution) ? EntityTypeEnum.Request : EntityTypeEnum.Distribution);
        const entityId = Utility.isEmpty(request.distribution) ? request.requestUid : request.distribution.distributionNum;
        const statusId = Utility.isEmpty(request.distribution) ? request.statusId : request.distribution.statusId;
        if (!data.addionalFile) {
            data.addionalFile = new Array();
        }
        const current = this._injector.get(ContextService).session?.organizations?.currentLink;
        const context = { entityTypeId: entityTypeId, entities: [] };
        for (let index = 0; index < providers.length; index++) {
            const provider = providers[index];
            provider.fileGenerations.forEach((x) => {
                context.entities.push({
                    templateOwnerId: provider.organizationId,
                    entityId: entityId,
                    vector: {
                        fileTypeId: x.fileTypeId,
                        systemObjectId: request.metadata.systemObjectId,
                        statusId: statusId,
                        organizationOkopfCode: current.detail.okopfCode,
                        roleId: current.detail.globalRoleId
                    }
                });
            });
        }
        if (context.entities.length > 0) {
            this._injector.get(GenerationService).generateLink(context).subscribe(response => this._popup.HandleIEntityResponse({
                response: response,
                successCallback: (entity) => {
                    entity.forEach((file) => {
                        data.addionalFile.push(file);
                    });
                    callback(data);
                }
            }));
        }
        else {
            callback(data);
        }
    }
    _signFiles(data, callback) {
        if (data.button) {
            this.actionBlock(data.button.target);
        }
        if (data.isSignatureWorkEnabled && data.action.itMustSign) {
            const editable = data.request.editable;
            const filesIds = new Array();
            if (editable.printForms?.length > 0) {
                editable.printForms.forEach(form => {
                    if (form.printFormFile?.length > 0) {
                        const canSign = this._checkSignSide(form.signSide);
                        if (canSign) {
                            form.printFormFile.forEach(file => {
                                filesIds.push({ fileId: file.fileId });
                            });
                        }
                    }
                });
            }
            const canSign = this._checkSignSide({ all: false, system: false, provider: true, broker: false, customer: true });
            if (canSign) {
                if (editable.profileInternalFiles?.length > 0) {
                    editable.profileInternalFiles.forEach(fileId => {
                        filesIds.push({ fileId: fileId });
                    });
                }
                if (editable.profileFile?.length > 0) {
                    editable.profileFile.forEach(file => {
                        filesIds.push({ fileId: file.fileId });
                    });
                }
                if (editable.financialBalance?.length > 0) {
                    editable.financialBalance.forEach(file => {
                        filesIds.push({ fileId: file.fileId });
                    });
                }
                if (data.addionalFile?.length > 0) {
                    data.addionalFile.forEach(file => {
                        const multi = file.attributes?.find(x => x.attributeTypeId === 4)?.value;
                        filesIds.push({ fileId: file.fileId, multiOrganizationId: multi === undefined ? undefined : Number(multi) });
                    });
                }
                // получаем файлы на подписание из контролов
                if (editable && editable.metadata.panelTypeId === 1) { //TextPanel
                    editable.fields.forEach(field => {
                        const fieldFiles = this.getFilesFunction(field);
                        if (fieldFiles?.length > 0) {
                            fieldFiles.forEach((file) => {
                                filesIds.push({ fileId: file.fileId });
                            });
                        }
                    });
                }
            }
            if (editable.documents?.length > 0) {
                for (let i = 0; i < editable.documents.length; i++) {
                    if (editable.documents[i].isNeedSign && editable.documents[i].files?.length > 0) {
                        const canSign = this._checkSignSide(editable.documents[i].signSide);
                        if (canSign) {
                            editable.documents[i].files.forEach(file => {
                                filesIds.push({ fileId: file.fileId, multiOrganizationId: data.request?.distribution?.provider.organization?.id });
                            });
                        }
                    }
                }
            }
            if (filesIds.length > 0) {
                this._injector.get(CryptoSignService).signFiles(filesIds, true, (sing) => {
                    callback(data);
                }, (result) => {
                    if (data.button) {
                        ButtonLoadingService.stop(data.button.target);
                    }
                });
            }
            else {
                callback(data);
            }
        }
        else {
            callback(data);
        }
    }
    _checkSignSide(signSide) {
        if (Utility.isEmpty(signSide))
            return true;
        if (signSide?.all === true)
            return true;
        switch (this._injector.get(ContextService).session.organizations.currentLink.detail.globalRoleId) {
            case RolesEnum.System:
                return signSide?.system === true;
            case RolesEnum.Provider:
                return signSide?.provider === true;
            case RolesEnum.Broker:
                return signSide?.broker === true;
            case RolesEnum.Consumer:
                return signSide?.customer === true;
        }
        return false;
    }
    _generatePrint(data, callback) {
        const formSettings = data.action.printFormSettings;
        const joinSettings = new Array();
        if (data.action.printFormSettings?.itMustGeneratePrintForm === true) {
            if (formSettings.printForms && formSettings.printForms.length > 0) {
                formSettings.printForms.forEach(x => x.isNeedCustomData = data.action.printFormSettings.isNeedCustomData);
                joinSettings.push(...formSettings.printForms);
            }
        }
        if (data.action.printFormSettings?.itMustGenerateVersionedForm === true) {
            if (formSettings.versionedForms && formSettings.versionedForms.length > 0) {
                formSettings.versionedForms.forEach(x => x.isVersioned = true);
                joinSettings.push(...formSettings.versionedForms);
            }
        }
        if (joinSettings.length > 0) {
            if (joinSettings.filter(x => x.isVersioned === true).length > 0) {
                // обработка с учетом проверки версионирования
                const versioned = joinSettings.filter(x => x.isVersioned === true);
                const checkDto = { versionedTypes: [] };
                for (let i = 0; i < versioned.length; i++) {
                    checkDto.versionedTypes.push({
                        providerId: versioned[i].itMustProviderForm === true ? data.request.editable.metadata.currentProviderId : undefined,
                        versionedTypeId: Utility.isEmpty(versioned[i].formType?.id) ? Number(FileTypeEnum.PanelPrintForm) : versioned[i].formType?.id,
                    });
                }
                this._injector.get(RequestBaseService)
                    .checkRequestVersionedDocument(checkDto)
                    .pipe(this.takeUntilDestroyed())
                    .subscribe((responseFiles) => this._popup.HandleIEntityResponse({
                    response: responseFiles,
                    successCallback: (allFiles) => {
                        this._callGenerateLink(data, callback, joinSettings, allFiles);
                    }
                }));
            }
            else {
                // обработка без учета проверки версионирования
                this._callGenerateLink(data, callback, joinSettings, null);
            }
        }
        else {
            callback(data);
        }
    }
    _callGenerateLink(data, callback, joinSettings, versionedCheck) {
        const generateFunc = (files, printedForm, data, callback) => {
            const options = {
                fileType: FileTypeEnum.PanelPrintForm,
                previewTitle: 'Печатные формы',
                previewText: 'Перед подтверждением действия проверьте содержимое печатных форм. Документы будут размещены в хранилище или присоединены к панели заявки ' + (data.action.itMustSign ? 'и подписаны вашей ЭП' : '') + '.' + (data.textInFilesPreview ? data.textInFilesPreview : ''),
                files: files,
                callback: callback,
                metadata: data
            };
            CoreDialog.window(CoreFilePreviewDialogWindow, options, () => {
                if (printedForm.length > 0 && data.request.editable) {
                    // в случае печатных форм нужно откатить состояние до того, которое было до момента генерации     
                    data.request.editable.printForms = pForm ?? [];
                }
            }, () => {
                this.actionUnblock(data.target);
            });
        };
        const request = data.request;
        const context = this._getContext(request, joinSettings);
        if (versionedCheck) {
            // фильтруем только те объекты генерации в контексте, которые еще не сформированы или относятся к печатным формам
            const wasGenerated = versionedCheck.filter(x => x.isGenerated === true).map(x => x.typeId);
            if (!wasGenerated || wasGenerated.length > 0) {
                const printedTypes = joinSettings.filter(x => x.isVersioned !== true).map(x => x.formType.id);
                context.entities = context.entities.filter(x => !wasGenerated.includes(x.vector.fileTypeId) || printedTypes.includes(x.vector.fileTypeId));
            }
        }
        const pForm = data.request.editable.printForms;
        const files = new Array();
        if (context.entities.length > 0) {
            this._injector.get(GenerationService)
                .generateLink(context)
                .pipe(this.takeUntilDestroyed())
                .subscribe(response => this._popup.HandleIEntityResponse({
                response: response,
                successCallback: (entities) => {
                    //сортируем печатные и версионируемые формы, для последующей обработки разными алгоритмами
                    const printedForm = new Array();
                    const versionedForm = new Array();
                    entities.forEach((uploaded) => {
                        const fileTypeId = Number(uploaded.attributes.find(x => x.attributeTypeId === 5)?.value);
                        if (data.action.printFormSettings?.printForms?.filter(x => x.formType.id === fileTypeId).length > 0) {
                            printedForm.push(uploaded);
                        }
                        else {
                            versionedForm.push(uploaded);
                        }
                    });
                    // предварительная обработка печатных форм
                    if (printedForm.length > 0) {
                        data.request.editable.printForms = pForm?.length > 0 ? pForm.filter(x => x.needSavePreviousForms) : [];
                        for (let i = 0; i < printedForm.length; i++) {
                            const fileTypeId = Number(printedForm[i].attributes.find(x => x.attributeTypeId === 5)?.value);
                            if (data.request.editable.printForms.filter(x => x.fileTypeId == fileTypeId).length > 0) {
                                data.request.editable.printForms.filter(x => x.fileTypeId == fileTypeId)[0].printFormFile.push(printedForm[i]);
                            }
                            else {
                                const signSide = data.action.printFormSettings?.printForms?.filter(x => x.formType?.id === fileTypeId)[0]?.signSide;
                                data.request.editable.printForms.push({ fileTypeId: fileTypeId, signSide: signSide, printFormFile: [printedForm[i]] });
                            }
                        }
                        // дополнительные файлы сформированные ранее
                        data.addionalFile?.forEach((file) => {
                            files.push(file);
                        });
                        //печатные формы сформированные не по настройкам функционального действия, а дополнительно
                        if (!Utility.isEmpty(data.additionalPrintForms) && data.additionalPrintForms.length > 0) {
                            data.request.editable.printForms.push(...data.additionalPrintForms);
                            data.additionalPrintForms.forEach(x => files.push(...x.printFormFile));
                        }
                    }
                    // предварительная обработка версионируемых форм
                    if (versionedForm.length > 0) {
                        if (!data.addionalFile) {
                            data.addionalFile = new Array();
                        }
                        versionedForm.forEach((file) => {
                            data.addionalFile.push(file);
                        });
                    }
                    // печатная или версионируемая форма
                    entities.forEach((file) => {
                        files.push(file);
                    });
                    generateFunc(files, printedForm, data, callback);
                }
            }));
        }
        else {
            callback(data);
        }
    }
    _getContext(request, formItems) {
        if (Utility.isEmpty(formItems) || formItems.length === 0)
            return undefined;
        const revoked = request.statusId === 12; // отозвано
        const current = this._injector.get(ContextService).session?.organizations?.currentLink;
        const context = {
            entityTypeId: Number(Utility.isEmpty(request.distribution) || revoked ? EntityTypeEnum.Request : EntityTypeEnum.Distribution),
            entities: [],
            customData: []
        };
        if (Utility.isEmpty(request.editable.metadata.currentProviderId) && request.metadata.selectedProviders.length === 1) {
            request.editable.metadata.currentProviderId = request.metadata.selectedProviders[0];
        }
        formItems.forEach(x => {
            context.entities.push({
                templateOwnerId: x.itMustProviderForm === true ? request.editable.metadata.currentProviderId : undefined,
                entityId: Utility.isEmpty(request.distribution) || revoked ? request.requestUid : request.distribution.distributionNum,
                vector: {
                    fileTypeId: Utility.isEmpty(x.formType?.id) ? Number(FileTypeEnum.PanelPrintForm) : x.formType?.id,
                    systemObjectId: request.metadata.systemObjectId,
                    statusId: Utility.isEmpty(request.distribution) || revoked ? request.statusId : request.distribution.statusId,
                    organizationOkopfCode: current.detail.okopfCode,
                    roleId: current.detail.globalRoleId
                }
            });
        });
        if (formItems.some(x => x.isNeedCustomData === true) && request.editable && request.editable.metadata.panelTypeId === 1) { // TextPanel
            request.editable.fields.forEach((field) => {
                const key = 'COMPLEX_' + field.fieldType + '_' + (Utility.isEmpty(field.fieldSubType) ? '' : field.fieldSubType + '_') + field.fieldName;
                const info = { key: key, value: JSON.stringify({ text: field.placeholder, value: field.value }) };
                context.customData.push(info);
            });
        }
        return context;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ActionExecutionBaseService, deps: [{ token: i0.Injector }, { token: i1$1.PopupResults }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ActionExecutionBaseService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ActionExecutionBaseService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i0.Injector }, { type: i1$1.PopupResults }] });

// common part

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

export { ActionEnum, ActionExecutionBaseService, ActionFinishOptions, ActionFinishService, ActionFinishTypeEnum, AdditionalInfo, BpmActorCommonInfoComponent, BpmComboboxBaseUriDescriptionService, BpmFieldSettingsComponent, BpmProviderListDialogWindow, CommonActorInfo, CommonAdditionalInfoComponent, CommonCounteragentDepartmentIdComponent, CommonCustomerEmailComponent, CounteragentDepartmentId, CustomFieldEnum, CustomerEmail, DestinationType, Distribution, DistributionResult, DistributionResultMetadata, DistributionResultNode, DistributionResultRoot, DymanicRuleGroup, DymanicRuleGroupWithScore, EtpBaseEntity, EventBusConstants, FieldRuleType, IProvider, IProviderFileGeneration, IProviderProduct, InvalidFormServiceExtension, OrganizationScoreTable, ProcessCommonModule, Request, RequestBaseService, RequestButton, RequestDocument, RequestDocumentSignSide, RequestField, RequestFieldRule, RequestMetadata, RequestPanel, RequestPanelMetadata, RequestPanelMetadataParentLogic, RequestParentLink, RequestReviewRule, RequestReviewRuleDepartment, RequestReviewRuleMetadata, RequestReviewRuleMetadataMra, RequestRunDocument, ReviewResultEnum, ReviewRuleTypeEnum, RuleCalculationResult, ScoreBaseDataV2, ScoreFinBalance, ScoreFinBalanceCell, ScoreIndexBase, ScoreMethodic, ScoreOrganization, ScorePeriodIndexBase, ScoreTable, ScoringResult, ScoringResultV2, SearchProductPipe, StatusBarItem, TransactionTypeEnum, UpdatedPanelElementTypeEnum };
//# sourceMappingURL=sellan-process.mjs.map
