import {
    a as w
} from "./chunk-JLPDNABD.js";
import {
    b as D
} from "./chunk-XF2CNCVA.js";
import {
    e as y
} from "./chunk-IIZSMBNO.js";
import {
    N as b,
    S as L,
    T as M,
    a as I
} from "./chunk-LNCD4SA3.js";
import {
    z as E
} from "./chunk-XPOKHL3M.js";
import "./chunk-Z33DM23Z.js";
import "./chunk-GHJJ2Z4D.js";
import {
    n as v,
    y as S
} from "./chunk-OYJWBUYU.js";
import {
    Ab as l,
    Db as h,
    Jb as n,
    Kb as s,
    Ya as a,
    Zb as m,
    cb as o,
    jc as d,
    kc as p,
    lb as g,
    lc as u,
    rb as c,
    tc as f
} from "./chunk-SSI6PFOR.js";
import "./chunk-JYUAQH2U.js";
import "./chunk-FFRAY7OK.js";
var F = () => ({
    "max-width": "40%"
});

function C(t, $) {
    if (t & 1 && (n(0, "p"), d(1), s()), t & 2) {
        let i = m();
        a(), u(" ", i.message, `
`);
    }
}
var K = (() => {
    class t {
        constructor(i, e, r, H, x) {
            this.oktaAuth = i, this.router = e, this.authService = r, this.spinner = H, this.user = x, this.message = "Processing login...", this.pendingMessage = "Your registration is currently pending approval by the admin. Once approved, you will receive an email notification with instructions on how to access the application.", this.pendingHeader = "Thank you for registering with Vision!", this.pendingFooter = "If you need further assistance, please contact your admin.", this.standardErrorMessage = "Please try again after some time.", this.standardErrorHeader = "An Error Has Occurred.", this.showError = !1;
        }
        ngOnInit() {
            this.spinner.show("mainSpinner"), this.authService.login(), this.authService.isLoggedIn$.subscribe({
                next: i => {
                    if (i === !0) {
                        this.spinner.hide("mainSpinner");
                        let e = sessionStorage.getItem("redirect") ? .split("?")[0];
                        e && e !== "/" ? (sessionStorage.removeItem("redirect"), this.user.userData.defaultDashboardSetting === !0 ? localStorage.setItem("defaultLandingSelection", "trackingDashboard") : this.user.userData.defaultDashboardSetting === !1 && localStorage.setItem("defaultLandingSelection", "reportingDashboard"), this.router.navigateByUrl(e)) : this.user.userData.defaultDashboardSetting === !0 ? (localStorage.setItem("defaultLandingSelection", "trackingDashboard"), this.router.navigate(["/dashboard"])) : this.user.userData.defaultDashboardSetting === !1 && (localStorage.setItem("defaultLandingSelection", "reportingDashboard"), this.router.navigate(["/reporting-dashboard"]));
                    }
                },
                error: i => {
                    this.spinner.hide("mainSpinner"), i === "inactive" ? (this.displayHeader = this.pendingHeader, this.displayMessage = this.pendingMessage, this.displayFooter = this.pendingFooter, this.showError = !0) : (this.displayHeader = this.standardErrorHeader, this.displayMessage = this.standardErrorMessage, this.displayFooter = "", this.showError = !0);
                }
            });
        }
        static {
            this.ɵfac = function(e) {
                return new(e || t)(o(D), o(y), o(w), o(I), o(b));
            };
        }
        static {
            this.ɵcmp = g({
                type: t,
                selectors: [
                    ["app-login"]
                ],
                decls: 6,
                vars: 9,
                consts: [
                    [4, "ngIf"],
                    [1, "pur-dialog", 3, "header", "visible", "closable"],
                    [2, "padding-bottom", "10vw", "padding-top", "5vw", "margin-top", "auto", "margin-bottom", "auto"]
                ],
                template: function(e, r) {
                    e & 1 && (c(0, C, 2, 1, "p", 0), n(1, "p-dialog", 1)(2, "p", 2), d(3), s(), n(4, "p"), d(5), s()()), e & 2 && (l("ngIf", !r.showError), a(), h(f(8, F)), l("header", r.displayHeader)("visible", r.showError)("closable", !1), a(2), p(r.displayMessage), a(2), p(r.displayFooter));
                },
                dependencies: [S, v, E, M, L],
                encapsulation: 2
            });
        }
    }
    return t;
})();
export {
    K as LoginComponent
}; /**i18n:6e1dbccd4192d215e143e99fb4b6a095cee3c871f5aa7cd380ca91231f35e8e0*/