import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "../al-view-helper/al-view-helper.component";
import * as i3 from "primeng-lts/button";
var _c0 = function () { return {}; };
function AlWizardStepperComponent_div_2_i_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "i", 15);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngStyle", (ctx_r2.headerOptions == null ? null : ctx_r2.headerOptions.iconStyle) ? ctx_r2.headerOptions == null ? null : ctx_r2.headerOptions.iconStyle : i0.ɵɵpureFunction0(2, _c0));
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(ctx_r2.headerOptions.icon);
} }
function AlWizardStepperComponent_div_2_i_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 16);
} if (rf & 2) {
    var ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngClass", ctx_r3.headerOptions.classIcon)("ngStyle", (ctx_r3.headerOptions == null ? null : ctx_r3.headerOptions.iconStyle) ? ctx_r3.headerOptions == null ? null : ctx_r3.headerOptions.iconStyle : i0.ɵɵpureFunction0(2, _c0));
} }
function AlWizardStepperComponent_div_2_p_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "p");
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r4 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r4.headerOptions.title, " ");
} }
function AlWizardStepperComponent_div_2_button_5_Template(rf, ctx) { if (rf & 1) {
    var _r7 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 17);
    i0.ɵɵlistener("click", function AlWizardStepperComponent_div_2_button_5_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r7); var ctx_r6 = i0.ɵɵnextContext(2); return ctx_r6.onCancelButton.emit(); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r5 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("label", ctx_r5.headerOptions == null ? null : ctx_r5.headerOptions.secondaryAction == null ? null : ctx_r5.headerOptions.secondaryAction.text)("disabled", ctx_r5.headerOptions == null ? null : ctx_r5.headerOptions.secondaryAction == null ? null : ctx_r5.headerOptions.secondaryAction.disabled);
} }
function AlWizardStepperComponent_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9);
    i0.ɵɵtemplate(1, AlWizardStepperComponent_div_2_i_1_Template, 2, 3, "i", 10);
    i0.ɵɵtemplate(2, AlWizardStepperComponent_div_2_i_2_Template, 1, 3, "i", 11);
    i0.ɵɵtemplate(3, AlWizardStepperComponent_div_2_p_3_Template, 2, 1, "p", 12);
    i0.ɵɵelement(4, "span", 13);
    i0.ɵɵtemplate(5, AlWizardStepperComponent_div_2_button_5_Template, 1, 2, "button", 14);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.headerOptions == null ? null : ctx_r0.headerOptions.icon);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.headerOptions == null ? null : ctx_r0.headerOptions.classIcon);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", (ctx_r0.headerOptions == null ? null : ctx_r0.headerOptions.title) !== "");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", ctx_r0.headerOptions == null ? null : ctx_r0.headerOptions.secondaryAction);
} }
function AlWizardStepperComponent_div_5_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 23);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var i_r9 = i0.ɵɵnextContext().index;
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(i_r9 + 1);
} }
function AlWizardStepperComponent_div_5_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 24);
    i0.ɵɵelementStart(1, "i", 25);
    i0.ɵɵtext(2, "check");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} }
function AlWizardStepperComponent_div_5_div_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 26);
} }
var _c1 = function (a0, a1) { return { "complete": a0, "active": a1 }; };
function AlWizardStepperComponent_div_5_Template(rf, ctx) { if (rf & 1) {
    var _r16 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 18);
    i0.ɵɵlistener("click", function AlWizardStepperComponent_div_5_Template_div_click_0_listener() { i0.ɵɵrestoreView(_r16); var step_r8 = ctx.$implicit; var ctx_r15 = i0.ɵɵnextContext(); return ctx_r15.onJumpStep(step_r8); });
    i0.ɵɵtemplate(1, AlWizardStepperComponent_div_5_div_1_Template, 2, 1, "div", 19);
    i0.ɵɵtemplate(2, AlWizardStepperComponent_div_5_div_2_Template, 3, 0, "div", 20);
    i0.ɵɵelementStart(3, "div", 21);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(5, AlWizardStepperComponent_div_5_div_5_Template, 1, 0, "div", 22);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var step_r8 = ctx.$implicit;
    var isLast_r10 = ctx.last;
    i0.ɵɵclassProp("disabled", !step_r8.complete && !step_r8.active);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction2(7, _c1, step_r8.complete, step_r8.active));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !step_r8.complete || step_r8.complete && step_r8.active);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", step_r8.complete && !step_r8.active);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(step_r8.stepTitle);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !isLast_r10);
} }
var _c2 = function (a0) { return { "stepper-content--one-col": a0 }; };
var _c3 = ["*"];
var AlWizardStepperComponent = /** @class */ (function () {
    function AlWizardStepperComponent() {
        this.loading = false;
        this.oneColumn = false;
        this.onStepSelected = new EventEmitter();
        this.onCancelButton = new EventEmitter();
        /**
         * Array of steps to display.
         */
        this.steps = [];
        /**
         * Index of the currently active step.
         */
        this.stepIndex = 0;
    }
    AlWizardStepperComponent.prototype.addStep = function (step) {
        if (this.steps.length === 0) {
            step.active = true;
            step.complete = false;
        }
        this.steps.push(step);
    };
    AlWizardStepperComponent.prototype.stepForward = function () {
        if (this.stepIndex < this.steps.length - 1) {
            this.steps[this.stepIndex].complete = true;
            var nextStep = this.steps[this.stepIndex + 1];
            this.selectStep(nextStep);
        }
    };
    AlWizardStepperComponent.prototype.stepBack = function () {
        if (this.stepIndex > 0) {
            this.selectStep(this.steps[this.stepIndex - 1]);
        }
    };
    AlWizardStepperComponent.prototype.selectStep = function (step) {
        this.steps.forEach(function (step) { return step.active = false; });
        step.active = true;
        this.stepIndex = this.steps.findIndex(function (step) { return step.active; });
        this.onStepSelected.emit(step);
    };
    AlWizardStepperComponent.prototype.onJumpStep = function (step) {
        if (!step.active && step.complete) {
            this.selectStep(step);
        }
    };
    AlWizardStepperComponent.prototype.reset = function () {
        this.stepIndex = 0;
        this.steps.forEach(function (step, index) {
            step.active = index === 0;
            step.complete = false;
        });
    };
    AlWizardStepperComponent.prototype.getIndex = function () {
        return this.stepIndex;
    };
    /** @nocollapse */ AlWizardStepperComponent.ɵfac = function AlWizardStepperComponent_Factory(t) { return new (t || AlWizardStepperComponent)(); };
    /** @nocollapse */ AlWizardStepperComponent.ɵcmp = i0.ɵɵdefineComponent({ type: AlWizardStepperComponent, selectors: [["al-wizard-stepper"]], inputs: { headerOptions: "headerOptions", loading: "loading", oneColumn: "oneColumn" }, outputs: { onStepSelected: "onStepSelected", onCancelButton: "onCancelButton" }, ngContentSelectors: _c3, decls: 10, vars: 7, consts: [[1, "al-wizzard-stepper"], [1, "al-wizard-stepper-header"], ["class", "p-grid p-align-center title-header", 4, "ngIf"], [1, "flex-col", "w-full"], [1, "margin-top-12", "steps-group"], ["class", "step", 3, "ngClass", "disabled", "click", 4, "ngFor", "ngForOf"], [3, "loading"], [1, "stepper-content", 3, "ngClass"], [1, "step-content", 3, "hidden"], [1, "p-grid", "p-align-center", "title-header"], ["class", "material-icons", 3, "ngStyle", 4, "ngIf"], ["class", "class-icon", 3, "ngClass", "ngStyle", 4, "ngIf"], [4, "ngIf"], [1, "p-col"], ["pButton", "", "class", "flat", "type", "button", 3, "label", "disabled", "click", 4, "ngIf"], [1, "material-icons", 3, "ngStyle"], [1, "class-icon", 3, "ngClass", "ngStyle"], ["pButton", "", "type", "button", 1, "flat", 3, "label", "disabled", "click"], [1, "step", 3, "ngClass", "click"], ["class", "step-no", 4, "ngIf"], ["class", "step-no check-icon", 4, "ngIf"], [1, "step-title"], ["class", "step-separator", 4, "ngIf"], [1, "step-no"], [1, "step-no", "check-icon"], [1, "material-icons"], [1, "step-separator"]], template: function AlWizardStepperComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵprojectionDef();
            i0.ɵɵelementStart(0, "div", 0);
            i0.ɵɵelementStart(1, "div", 1);
            i0.ɵɵtemplate(2, AlWizardStepperComponent_div_2_Template, 6, 4, "div", 2);
            i0.ɵɵelementStart(3, "div", 3);
            i0.ɵɵelementStart(4, "div", 4);
            i0.ɵɵtemplate(5, AlWizardStepperComponent_div_5_Template, 6, 10, "div", 5);
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵelement(6, "al-view-helper", 6);
            i0.ɵɵelementStart(7, "div", 7);
            i0.ɵɵelementStart(8, "div", 8);
            i0.ɵɵprojection(9);
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngIf", ctx.headerOptions);
            i0.ɵɵadvance(3);
            i0.ɵɵproperty("ngForOf", ctx.steps);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("loading", ctx.loading);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(5, _c2, ctx.oneColumn));
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("hidden", ctx.loading);
        } }, directives: [i1.NgIf, i1.NgForOf, i2.AlViewHelperComponent, i1.NgClass, i1.NgStyle, i3.ButtonDirective], styles: [".al-wizzard-stepper[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%}.al-wizard-stepper-header[_ngcontent-%COMP%]{border-bottom:1px solid #cbcbcb;padding:12px 40px;z-index:1}.steps-group[_ngcontent-%COMP%]{align-items:center;display:flex}.steps-group[_ngcontent-%COMP%]   .check-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:18px}.step[_ngcontent-%COMP%]{display:flex;flex-grow:0;flex-shrink:0;flex-wrap:nowrap;align-items:center;height:36px;color:#a8a8a8;cursor:pointer;font-size:16px}.step.complete[_ngcontent-%COMP%]{color:#57a0d7;font-weight:600;cursor:pointer}.step.disabled[_ngcontent-%COMP%]{cursor:not-allowed}.step[_ngcontent-%COMP%]   .step-no[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;flex-grow:0;flex-shrink:0;font-size:12px;line-height:16px;width:24px;height:24px;border-radius:50%;color:#fff;background-color:#a8a8a8}.step.active[_ngcontent-%COMP%]   .step-no[_ngcontent-%COMP%], .step.complete[_ngcontent-%COMP%]   .step-no[_ngcontent-%COMP%]{background-color:#57a0d7}.step.active[_ngcontent-%COMP%] > .step-title[_ngcontent-%COMP%], .step.complete[_ngcontent-%COMP%] > .step-title[_ngcontent-%COMP%]{color:#57a0d7}.step[_ngcontent-%COMP%]   .step-title[_ngcontent-%COMP%]{font-weight:600;margin-left:6px;font-size:14px;line-height:20px}.step.active[_ngcontent-%COMP%]   .step-title[_ngcontent-%COMP%]{color:#57a0d7}.step.active[_ngcontent-%COMP%]   .step-no[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #cbe2f2}.step-separator[_ngcontent-%COMP%]{width:30px;height:2px;background-color:#a8a8a8;margin-left:18px;margin-right:18px}.stepper-content[_ngcontent-%COMP%]{padding:20px 40px;margin-bottom:56px;overflow:auto;position:relative;display:flex;flex-direction:column;flex:1;height:-webkit-fill-available}.stepper-content--one-col[_ngcontent-%COMP%]{background-color:#f6f6f6}.stepper-content--one-col[_ngcontent-%COMP%]   .step-content[_ngcontent-%COMP%]{max-width:756px;padding:28px;width:100%;margin-left:auto;margin-right:auto;background:#fff;border:1px solid #cbcbcb;border-radius:6px}.title-header[_ngcontent-%COMP%]{padding:12px 6px 0}.title-header[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{font-size:28px;margin:5px 0 5px 12px;letter-spacing:0;color:#535353}.margin-top-12[_ngcontent-%COMP%]{margin-top:12px}"] });
    return AlWizardStepperComponent;
}());
export { AlWizardStepperComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(AlWizardStepperComponent, [{
        type: Component,
        args: [{
                selector: 'al-wizard-stepper',
                templateUrl: './al-wizard-stepper.component.html',
                styleUrls: ['./al-wizard-stepper.component.scss']
            }]
    }], null, { headerOptions: [{
            type: Input
        }], loading: [{
            type: Input
        }], oneColumn: [{
            type: Input
        }], onStepSelected: [{
            type: Output
        }], onCancelButton: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 