import * as i0 from '@angular/core';
import { Component, Input, NgModule } from '@angular/core';
import * as i1 from '@angular/forms';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import * as i2 from '@softpak/frontend-components-ng';
import { SpfModule } from '@softpak/frontend-components-ng';
import * as i3 from '@softpak/ng-components/spa-capitalize';
import { SpaCapitalizeModule } from '@softpak/ng-components/spa-capitalize';
import { CommonModule } from '@angular/common';

const ctrlAppStoreVersion = 'appStoreVersion';
const ctrlChannel = 'channel';
const ctrlNextVersionNumber = 'nextVersionNumber';
const ctrlVersionNumber = 'versionNumber';
class SpaUpdateInfoComponent {
    constructor(formBuilder) {
        this.formBuilder = formBuilder;
        this.form = this.formBuilder.group({
            [ctrlAppStoreVersion]: [null, []],
            [ctrlChannel]: [null, []],
            [ctrlNextVersionNumber]: [null, []],
            [ctrlVersionNumber]: [null, []],
        });
    }
    get ctrlVersionNumber() { return this.form.get(ctrlVersionNumber); }
    get ctrlNextVersionNumber() { return this.form.get(ctrlNextVersionNumber); }
    get ctrlConfiguredChannel() { return this.form.get(ctrlChannel); }
    get ctrlAppStoreVersion() { return this.form.get(ctrlAppStoreVersion); }
    update(appStoreVersion, channel, nextVersion, version) {
        this.ctrlVersionNumber.setValue({
            value: version,
        });
        this.ctrlNextVersionNumber.setValue({
            value: nextVersion,
        });
        this.ctrlConfiguredChannel.setValue({
            value: channel,
        });
        this.ctrlAppStoreVersion.setValue({
            value: appStoreVersion,
        });
    }
}
SpaUpdateInfoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUpdateInfoComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
SpaUpdateInfoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SpaUpdateInfoComponent, selector: "spa-update-info", inputs: { txtAppStoreVersion: "txtAppStoreVersion", txtChannel: "txtChannel", txtNextVersion: "txtNextVersion", txtVersion: "txtVersion" }, ngImport: i0, template: `<form [formGroup]="form" class="mt-3">
    <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3">
      <spn-input [formControl]="ctrlVersionNumber" [spfLabel]="txtVersion | capitalize"
        [spfReadonly]="true"></spn-input>
      <spn-input [formControl]="ctrlNextVersionNumber" [spfLabel]="txtNextVersion | capitalize"
        [spfReadonly]="true"></spn-input>
      <spn-input [formControl]="ctrlConfiguredChannel" [spfLabel]="txtChannel | capitalize"
        [spfReadonly]="true"></spn-input>
      <spn-input [formControl]="ctrlAppStoreVersion" [spfLabel]="txtAppStoreVersion | capitalize"
        [spfReadonly]="true"></spn-input>
    </div>
  </form>`, isInline: true, dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i2.SpnInput, selector: "spn-input", inputs: ["spfAutofocus", "spfCapitalize", "spfCompact", "spfE2E", "spfInputMode", "spfLabel", "spfMax", "spfMin", "spfName", "spfPattern", "spfReadonly", "spfRequired", "spfSelectDay", "spfSelectMonth", "spfShowEdit", "spfShowHelp", "spfShowSearch", "spfShowValidationMessages", "spfStep", "spfSuggestions", "spfType", "spfValidators", "value"] }, { kind: "directive", type: i2.TextValueAccessor, selector: "spf-input, spn-input" }, { kind: "pipe", type: i3.SpaCapitalizePipe, name: "capitalize" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUpdateInfoComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'spa-update-info',
                    template: `<form [formGroup]="form" class="mt-3">
    <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3">
      <spn-input [formControl]="ctrlVersionNumber" [spfLabel]="txtVersion | capitalize"
        [spfReadonly]="true"></spn-input>
      <spn-input [formControl]="ctrlNextVersionNumber" [spfLabel]="txtNextVersion | capitalize"
        [spfReadonly]="true"></spn-input>
      <spn-input [formControl]="ctrlConfiguredChannel" [spfLabel]="txtChannel | capitalize"
        [spfReadonly]="true"></spn-input>
      <spn-input [formControl]="ctrlAppStoreVersion" [spfLabel]="txtAppStoreVersion | capitalize"
        [spfReadonly]="true"></spn-input>
    </div>
  </form>`,
                }]
        }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { txtAppStoreVersion: [{
                type: Input
            }], txtChannel: [{
                type: Input
            }], txtNextVersion: [{
                type: Input
            }], txtVersion: [{
                type: Input
            }] } });

class SpaUpdateProgressComponent {
    ngOnInit() {
        this.startLoaderSync();
    }
    ngOnDestroy() {
        this.stopLoaderSync();
    }
    startLoaderSync() {
        if (this.syncTruckInterval === null) {
            this.syncTruckInterval = setInterval(() => {
                this.delayedPercentage = this.percentage;
            }, 200);
        }
    }
    stopLoaderSync() {
        if (this.syncTruckInterval !== null) {
            clearInterval(this.syncTruckInterval);
            this.syncTruckInterval = undefined;
        }
    }
}
SpaUpdateProgressComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUpdateProgressComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
SpaUpdateProgressComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: SpaUpdateProgressComponent, selector: "spa-update-progress", inputs: { title: "title", percentage: "percentage" }, ngImport: i0, template: `<spf-progress-bar [spfPercentage]="delayedPercentage" [spfTitle]="title | capitalize">
  </spf-progress-bar>`, isInline: true, dependencies: [{ kind: "component", type: i2.SpfProgressBar, selector: "spf-progress-bar", inputs: ["spfPercentage", "spfTitle"] }, { kind: "pipe", type: i3.SpaCapitalizePipe, name: "capitalize" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUpdateProgressComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'spa-update-progress',
                    template: `<spf-progress-bar [spfPercentage]="delayedPercentage" [spfTitle]="title | capitalize">
  </spf-progress-bar>`,
                }]
        }], propDecorators: { title: [{
                type: Input
            }], percentage: [{
                type: Input
            }] } });

class SpaUpdateModule {
}
SpaUpdateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUpdateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
SpaUpdateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: SpaUpdateModule, declarations: [SpaUpdateInfoComponent,
        SpaUpdateProgressComponent], imports: [CommonModule,
        FormsModule,
        ReactiveFormsModule,
        SpaCapitalizeModule,
        SpfModule], exports: [SpaUpdateInfoComponent,
        SpaUpdateProgressComponent] });
SpaUpdateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUpdateModule, imports: [CommonModule,
        FormsModule,
        ReactiveFormsModule,
        SpaCapitalizeModule,
        SpfModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SpaUpdateModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        SpaUpdateInfoComponent,
                        SpaUpdateProgressComponent,
                    ],
                    imports: [
                        CommonModule,
                        FormsModule,
                        ReactiveFormsModule,
                        SpaCapitalizeModule,
                        SpfModule,
                    ],
                    exports: [
                        SpaUpdateInfoComponent,
                        SpaUpdateProgressComponent,
                    ],
                }]
        }] });

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

export { SpaUpdateInfoComponent, SpaUpdateModule, SpaUpdateProgressComponent };
//# sourceMappingURL=softpak-ng-components-spa-update.mjs.map
