import { AXPUnauthorizedError, AXPUnauthenticatedError, AXPSessionService, AXPAuthStrategyRegistryService, AXPAuthGuard } from '@acorex/platform/auth';
import { AXPLayoutThemeService } from '@acorex/platform/themes/shared';
import * as i1$3 from '@angular/common/http';
import { HttpErrorResponse } from '@angular/common/http';
import * as i0 from '@angular/core';
import { inject, isDevMode, Injectable, InjectionToken, Component, ViewChild, ViewEncapsulation, ChangeDetectionStrategy, signal, NgModule, Injector } from '@angular/core';
import * as i1$2 from '@angular/router';
import { Router, RouterModule, ROUTES } from '@angular/router';
import * as i1$5 from '@acorex/platform/common';
import { AXPHomePageService, AXPDataProvider, AXP_ROOT_CONFIG_TOKEN, AXPSettingService, AXPCommonModule, AXP_MENU_PROVIDER, AXP_SETTING_DEFINITION_PROVIDER } from '@acorex/platform/common';
import { AXPCommandExecutor, provideCommandSetups } from '@acorex/platform/runtime';
import * as i1$1 from '@angular/common';
import { CommonModule, AsyncPipe } from '@angular/common';
import { firstValueFrom, of, first, Subject, timer, map } from 'rxjs';
import * as i1$4 from '@acorex/platform/layout/components';
import { AXPUserAvatarComponent, AXPComponentSlotModule } from '@acorex/platform/layout/components';
import * as i2$1 from '@acorex/components/button';
import { AXButtonModule } from '@acorex/components/button';
import * as i1 from '@acorex/components/decorators';
import { AXDecoratorModule } from '@acorex/components/decorators';
import * as i2$2 from '@acorex/components/popover';
import { AXPopoverModule } from '@acorex/components/popover';
import * as i2 from '@acorex/components/loading';
import { AXLoadingModule } from '@acorex/components/loading';
import { AXAvatarModule } from '@acorex/components/avatar';
import { AXImageModule } from '@acorex/components/image';
import { AXPopupService } from '@acorex/components/popup';
import { AXPlatform } from '@acorex/core/platform';
import * as i5 from '@acorex/core/translation';
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
import { AXChipsModule } from '@acorex/components/chips';
import { AXTagModule } from '@acorex/components/tag';
import { AXPPlatformScope } from '@acorex/platform/core';
import { startWith, switchMap, tap } from 'rxjs/operators';
import { AXMEntityCrudServiceImpl } from '@acorex/platform/layout/entity';

class AXMAuthErrorHandler {
    constructor() {
        this.router = inject(Router);
        this.layoutService = inject(AXPLayoutThemeService);
    }
    handleError(error, next) {
        if (error instanceof HttpErrorResponse) {
            // if (error.status == 401) {
            //     this.router.navigate(['/auth/login']);
            // }
            // else if (error.status == 404) {
            //     this.router.navigate(['/404']);
            // }
        }
        else if (error instanceof AXPUnauthorizedError) {
            const redirectUrl = error.data?.redirectUrl;
            console.error(error.message);
            this.router.navigate(['/401'], { queryParams: redirectUrl ? { redirectUrl: redirectUrl } : null });
        }
        else if (error instanceof AXPUnauthenticatedError) {
            console.error(error.message);
            const redirectUrl = error.data?.redirectUrl;
            this.router.navigate(['/auth/login'], { queryParams: redirectUrl ? { redirectUrl: redirectUrl } : null });
        }
        else {
            if (isDevMode()) {
                next(error); // Pass the error to the next handler
            }
            else {
                next(error); // maybe we need a error page
            }
        }
        this.layoutService.setNavigationLoading(false);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMAuthErrorHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMAuthErrorHandler }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMAuthErrorHandler, decorators: [{
            type: Injectable
        }] });

var AXMAuthenticationTypes;
(function (AXMAuthenticationTypes) {
    AXMAuthenticationTypes[AXMAuthenticationTypes["UsernamePassword"] = 0] = "UsernamePassword";
    AXMAuthenticationTypes[AXMAuthenticationTypes["UsernameEmailPassword"] = 1] = "UsernameEmailPassword";
    AXMAuthenticationTypes[AXMAuthenticationTypes["EmailPassword"] = 2] = "EmailPassword";
    AXMAuthenticationTypes[AXMAuthenticationTypes["MobilePassword"] = 3] = "MobilePassword";
    AXMAuthenticationTypes[AXMAuthenticationTypes["EmailCode"] = 4] = "EmailCode";
    AXMAuthenticationTypes[AXMAuthenticationTypes["MobileCode"] = 5] = "MobileCode";
})(AXMAuthenticationTypes || (AXMAuthenticationTypes = {}));
const AXM_AUTH_CONFIG_TOKEN = new InjectionToken('app-module-auth-config', {
    providedIn: 'root',
    factory: () => {
        return AXMDefaultAuthConfigs;
    },
});
const AXMDefaultAuthConfigs = {
    type: AXMAuthenticationTypes.UsernamePassword,
    // defaultStrategyName:'oidc',
    // حذف authConfig از اینجا چون از environment خوانده می‌شود
    defaultStrategyName: 'user-pass'
};
function configAuthModule(config = AXMDefaultAuthConfigs) {
    return { ...AXMDefaultAuthConfigs, ...config };
}

const routes = [
    {
        path: 'auth',
        children: [
            {
                path: '',
                pathMatch: 'full',
                redirectTo: 'login',
            },
            {
                path: '',
                loadComponent: () => import('./acorex-modules-auth-master.layout-D0iHJc_T.mjs').then((c) => c.AXPAuthMasterLayoutComponent),
                loadChildren: () => import('./acorex-modules-auth-login.module-C3YVgPHp.mjs').then((c) => c.AXPSignInModule),
            },
            {
                path: '',
                loadComponent: () => import('./acorex-modules-auth-master.layout-D0iHJc_T.mjs').then((c) => c.AXPAuthMasterLayoutComponent),
                loadChildren: () => import('./acorex-modules-auth-two-factor.module-BzFLnBad.mjs').then((c) => c.AXPTwoFactorModule),
            },
            {
                path: '',
                loadComponent: () => import('./acorex-modules-auth-master.layout-D0iHJc_T.mjs').then((c) => c.AXPAuthMasterLayoutComponent),
                loadChildren: () => import('./acorex-modules-auth-routes-CR8yYe3M.mjs').then((c) => c),
            },
            {
                path: 'axp-oauth-callback',
                loadComponent: () => import('./acorex-modules-auth-oauth-callback.component-CfTRvv9t.mjs').then((c) => c.AXPOAuthCallbackComponent),
            },
            {
                path: 'account',
                loadComponent: () => import('./acorex-modules-auth-blank.layout-B9NO91NS.mjs').then((c) => c.AXPAuthBlankLayoutComponent),
                loadChildren: () => Promise.resolve().then(function () { return account_module; }).then((c) => c.AXPAccountModule),
            },
            // {
            //   path: 'signincallback',
            //   loadComponent: () =>
            //     import('./pages/callback/oauth-callback.component').then((c) => c.AXPOAuthCallbackComponent),
            // },
            // {
            //   path: '',
            //   loadComponent: () =>
            //     import('./shared/layouts/master/master.layout').then((c) => c.AXPAuthMasterLayoutComponent),
            //   loadChildren: () => import('./register/register.module').then((c) => c.AXPRegisterModule),
            // },
        ],
    },
];

const AXPAuthMenuKeys = {
    UserProfile: 'user:profile',
};

class AXMSecurityManagementModuleMenuProvider {
    constructor() {
        this.sessionService = inject(AXPSessionService);
    }
    async provide(context) {
        const isAuthorized = await firstValueFrom(this.sessionService.isAuthorized$);
        if (!isAuthorized) {
            return;
        }
        //
        context.addItems([
            {
                name: AXPAuthMenuKeys.UserProfile,
                text: `@auth:profile.title`,
                icon: 'fa-light fa-user',
                children: [],
            },
        ]);
    }
}

class AXPAppChooserListComponent {
    constructor() {
        this.router = inject(Router);
        this.sessionService = inject(AXPSessionService);
        this.homePageService = inject(AXPHomePageService);
        this.authStrategyRegistry = inject(AXPAuthStrategyRegistryService);
        this.strategyName = this.sessionService.getSessionData()?.strategy;
        this.strategy = this.authStrategyRegistry.get(this.strategyName);
        this.selectedApplication = null;
        this.applications$ = this.sessionService.applications$;
    }
    async chooseApplication(item) {
        this.selectedApplication = item;
        const tenantId = this.sessionService.tenant?.id || '';
        if (!tenantId) {
            throw new Error('Tenant ID is missing. Cannot choose application.');
        }
        if (this.strategy && typeof this.strategy.updateToken === 'function') {
            const updateContext = {
                application: item,
                user: this.sessionService.user,
                tenant: this.sessionService.tenant,
            };
            await this.sessionService.updateToken(updateContext);
        }
        return await this.homePageService.navigateTo();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPAppChooserListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXPAppChooserListComponent, isStandalone: true, selector: "axp-app-chooser-list", ngImport: i0, template: "<div class=\" ax-w-full ax-overflow-auto ax-max-h-[300px] ax-pe-2\">\n    @for(application of (applications$ | async); track $index){\n    <div class=\"ax-flex ax-gap-2 ax-justify-between ax-border-b last:ax-border-b-0 ax-py-3 ax-items-start ax-cursor-pointer\"\n        (click)=\"chooseApplication(application)\">\n        <div class=\"ax-flex ax-flex-1 ax-gap-2 ax-items-center ax-justify-center ax-font-medium\">\n            <div\n                class=\"ax-w-12 ax-h-12 ax-flex ax-justify-center ax-items-center ax-rounded-full ax-bg-neutral-100 ax-m-auto\">\n                <ax-icon class=\"fa-solid fa-computer ax-text-neutral-500 ax-text-lg\"> </ax-icon>\n                <!-- TODO: logo instead of application icon -->\n                <!-- <axp-logo [source]=\"application.logo\" [attr.alt]=\"application.title\"\n            class=\"!ax-flex ax-items-center ax-justify-center !ax-text-sm ax-mx-auto ax-w-10 ax-h-10 ax-bg-neutral-200 ax-rounded-full\"></axp-logo> -->\n            </div>\n            <span class=\"ax-flex-1 ax-text-start md:ax-text-base ax-text-sm\">{{ application.title }}</span>\n            <span class=\"ax-text-gray-500 md:ax-text-sm ax-text-xs\">{{application.editionName}}</span>\n            @if(application.name===selectedApplication?.name){\n            <ax-loading></ax-loading>\n            }@else {\n            <ax-icon class=\"fa-solid fa-chevron-right ax-text-neutral-400\"> </ax-icon>\n            }\n        </div>\n    </div>\n    }\n</div>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "component", type: i2.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPAppChooserListComponent, decorators: [{
            type: Component,
            args: [{ selector: 'axp-app-chooser-list', imports: [CommonModule, AXDecoratorModule, AXLoadingModule], template: "<div class=\" ax-w-full ax-overflow-auto ax-max-h-[300px] ax-pe-2\">\n    @for(application of (applications$ | async); track $index){\n    <div class=\"ax-flex ax-gap-2 ax-justify-between ax-border-b last:ax-border-b-0 ax-py-3 ax-items-start ax-cursor-pointer\"\n        (click)=\"chooseApplication(application)\">\n        <div class=\"ax-flex ax-flex-1 ax-gap-2 ax-items-center ax-justify-center ax-font-medium\">\n            <div\n                class=\"ax-w-12 ax-h-12 ax-flex ax-justify-center ax-items-center ax-rounded-full ax-bg-neutral-100 ax-m-auto\">\n                <ax-icon class=\"fa-solid fa-computer ax-text-neutral-500 ax-text-lg\"> </ax-icon>\n                <!-- TODO: logo instead of application icon -->\n                <!-- <axp-logo [source]=\"application.logo\" [attr.alt]=\"application.title\"\n            class=\"!ax-flex ax-items-center ax-justify-center !ax-text-sm ax-mx-auto ax-w-10 ax-h-10 ax-bg-neutral-200 ax-rounded-full\"></axp-logo> -->\n            </div>\n            <span class=\"ax-flex-1 ax-text-start md:ax-text-base ax-text-sm\">{{ application.title }}</span>\n            <span class=\"ax-text-gray-500 md:ax-text-sm ax-text-xs\">{{application.editionName}}</span>\n            @if(application.name===selectedApplication?.name){\n            <ax-loading></ax-loading>\n            }@else {\n            <ax-icon class=\"fa-solid fa-chevron-right ax-text-neutral-400\"> </ax-icon>\n            }\n        </div>\n    </div>\n    }\n</div>" }]
        }] });

class AXMAppChooserSlotComponent {
    constructor() {
        this.sessionService = inject(AXPSessionService);
        this.homePageService = inject(AXPHomePageService);
        this.authStrategyRegistry = inject(AXPAuthStrategyRegistryService);
        this.strategyName = this.sessionService.getSessionData()?.strategy;
        this.strategy = this.authStrategyRegistry.get(this.strategyName);
        this.tenant$ = this.sessionService.tenant$;
        this.application$ = this.sessionService.application$;
        this.applications$ = of([]);
    }
    async chooseApplication(item) {
        const tenantId = this.sessionService.tenant?.id || '';
        if (this.strategy && typeof this.strategy.updateToken === 'function') {
            const updateContext = {
                tenant: this.sessionService.tenant,
                user: this.sessionService.user,
                application: item,
            };
            await this.sessionService.updateToken(updateContext);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMAppChooserSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXMAppChooserSlotComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "@if(((applications$ | async)?.length ?? 0) > 1) {\n<ax-button color=\"default\" look=\"blank\" #appChooser>\n  <ax-icon>\n    <i class=\"fa-solid fa-grid-2 ax-text-slate-400 dark:ax-text-slate-200\"></i>\n  </ax-icon>\n</ax-button>\n<ax-popover [target]=\"appChooser\" [openOn]=\"'toggle'\" [closeOn]=\"'clickOut'\" [adaptivityEnabled]=\"true\">\n  <div class=\"ax-bg-lightest ax-border ax-overflow-hidden ax-rounded-md ax-shadow-md ax-w-full ax-min-w-64 ax-p-3\">\n    <axp-app-chooser-list></axp-app-chooser-list>\n  </div>\n</ax-popover>\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXPopoverModule }, { kind: "component", type: i2$2.AXPopoverComponent, selector: "ax-popover", inputs: ["width", "disabled", "offsetX", "offsetY", "target", "placement", "content", "openOn", "closeOn", "hasBackdrop", "openAfter", "closeAfter", "backdropClass", "panelClass", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: AXPAppChooserListComponent, selector: "axp-app-chooser-list" }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMAppChooserSlotComponent, decorators: [{
            type: Component,
            args: [{ imports: [CommonModule, AXButtonModule, AXPopoverModule, AXDecoratorModule, AXPAppChooserListComponent], template: "@if(((applications$ | async)?.length ?? 0) > 1) {\n<ax-button color=\"default\" look=\"blank\" #appChooser>\n  <ax-icon>\n    <i class=\"fa-solid fa-grid-2 ax-text-slate-400 dark:ax-text-slate-200\"></i>\n  </ax-icon>\n</ax-button>\n<ax-popover [target]=\"appChooser\" [openOn]=\"'toggle'\" [closeOn]=\"'clickOut'\" [adaptivityEnabled]=\"true\">\n  <div class=\"ax-bg-lightest ax-border ax-overflow-hidden ax-rounded-md ax-shadow-md ax-w-full ax-min-w-64 ax-p-3\">\n    <axp-app-chooser-list></axp-app-chooser-list>\n  </div>\n</ax-popover>\n}\n" }]
        }] });

class AXPTenantChooserDropdownComponent {
    constructor() {
        this.router = inject(Router);
        this.sessionService = inject(AXPSessionService);
        this.tenants$ = this.sessionService.tenants$;
        this.tenant = this.sessionService.tenant;
    }
    tenantChooser() {
        this.router.navigate(['/auth/account/tenant-chooser']);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPTenantChooserDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXPTenantChooserDropdownComponent, isStandalone: true, selector: "axp-tenant-chooser-dropdown", ngImport: i0, template: "<!-- <ng-container *ngIf=\"tenants$ | async as tenants\">\n@if(tenants.length>1){\n  <div (click)=\"tenantChooser()\"\n    class=\"ax-flex ax-items-center ax-border ax-rounded-full ax-px-4 ax-py-1 ax-gap-2 ax-cursor-pointer\">\n    <ax-icon class=\"fa-solid fa-building ax-text-neutral-500 ax-text-xs\"></ax-icon>\n    <p class=\"ax-text-neutral-500 ax-text-sm ax-font-medium\">\n      {{ tenant?.title }}\n    </p>\n    <ax-icon class=\"fa-regular fa-chevron-down ax-text-neutral-400\"></ax-icon>\n  </div>\n  }@else {\n  <div class=\"ax-flex ax-items-center ax-border ax-rounded-full ax-px-4 ax-py-1 ax-gap-2 ax-cursor-pointer\">\n    <ax-icon class=\"fa-solid fa-building ax-text-neutral-500\"></ax-icon>\n    <p class=\"ax-text-neutral-500 ax-text-sm ax-font-medium\">\n      {{ tenant?.title }}\n    </p>\n  </div>\n}\n</ng-container> -->\n\n@if (tenants$ | async; as tenants) {\n  <ax-button [text]=\"tenant?.title ?? ''\" class=\"ax-xs\" look=\"blank\">\n    @if(tenants.length > 1){\n      <ax-suffix>\n        <ax-icon class=\"fa-solid fa-caret-down\"></ax-icon>\n      </ax-suffix>\n    }\n  </ax-button>\n}", dependencies: [{ kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXChipsModule }, { kind: "ngmodule", type: AXTagModule }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPTenantChooserDropdownComponent, decorators: [{
            type: Component,
            args: [{ selector: 'axp-tenant-chooser-dropdown', imports: [AXDecoratorModule, AXChipsModule, AXTagModule, CommonModule, AXButtonModule], template: "<!-- <ng-container *ngIf=\"tenants$ | async as tenants\">\n@if(tenants.length>1){\n  <div (click)=\"tenantChooser()\"\n    class=\"ax-flex ax-items-center ax-border ax-rounded-full ax-px-4 ax-py-1 ax-gap-2 ax-cursor-pointer\">\n    <ax-icon class=\"fa-solid fa-building ax-text-neutral-500 ax-text-xs\"></ax-icon>\n    <p class=\"ax-text-neutral-500 ax-text-sm ax-font-medium\">\n      {{ tenant?.title }}\n    </p>\n    <ax-icon class=\"fa-regular fa-chevron-down ax-text-neutral-400\"></ax-icon>\n  </div>\n  }@else {\n  <div class=\"ax-flex ax-items-center ax-border ax-rounded-full ax-px-4 ax-py-1 ax-gap-2 ax-cursor-pointer\">\n    <ax-icon class=\"fa-solid fa-building ax-text-neutral-500\"></ax-icon>\n    <p class=\"ax-text-neutral-500 ax-text-sm ax-font-medium\">\n      {{ tenant?.title }}\n    </p>\n  </div>\n}\n</ng-container> -->\n\n@if (tenants$ | async; as tenants) {\n  <ax-button [text]=\"tenant?.title ?? ''\" class=\"ax-xs\" look=\"blank\">\n    @if(tenants.length > 1){\n      <ax-suffix>\n        <ax-icon class=\"fa-solid fa-caret-down\"></ax-icon>\n      </ax-suffix>\n    }\n  </ax-button>\n}" }]
        }] });

class AXMAuthProfileSlotComponent {
    constructor() {
        this.router = inject(Router);
        this.sessionService = inject(AXPSessionService);
        this.themeService = inject(AXPLayoutThemeService);
        this.popupService = inject(AXPopupService);
        this.platform = inject(AXPlatform);
        this.translateService = inject(AXTranslationService);
        this.commandExecutor = inject(AXPCommandExecutor);
        this.isDarkMode = this.themeService.isDarkMode;
        this.user$ = this.sessionService.user$;
        this.tenant$ = this.sessionService.tenant$;
        this.isAuthenticated$ = this.sessionService.isAuthenticated$;
        this.appName = () => this.sessionService.application?.name;
    }
    editProfile() {
        this.router.navigate([`/${this.appName()}/m/SecurityManagement/e/profile/0/view`]);
    }
    async logOut() {
        await this.sessionService.signout();
    }
    toggleProfileMenu() {
        this.profilePopover.open();
    }
    handleSignIn() {
        this.router.navigate(['/auth/login']);
    }
    async openUserSession() {
        const com = await import('./acorex-modules-auth-user-sessions.component-Bfb74eNc.mjs').then((c) => c.AXMUserSessionsComponent);
        this.popupService.open(com, {
            size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'sm',
            title: await this.translateService.translateAsync('@auth:profile.sessions.title'),
        });
    }
    async showProfile() {
        this.commandExecutor.execute('auth:profile', {});
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMAuthProfileSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXMAuthProfileSlotComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "profilePopover", first: true, predicate: ["profilePopover"], descendants: true }], ngImport: i0, template: "@if (isAuthenticated$ | async) {\n  <div class=\"ax-size-fit\">\n    <div #avatar>\n      <axp-user-avatar [size]=\"36\" [userId]=\"(user$ | async)?.id!\"></axp-user-avatar>\n    </div>\n\n    <ax-popover [target]=\"avatar\" [openOn]=\"'toggle'\" [closeOn]=\"'clickOut'\" #p>\n      <div class=\"ax-bg-lightest ax-border ax-border-lightest ax-rounded-md ax-shadow-md ax-w-full ax-min-w-64\">\n        <div class=\"ax-flex ax-flex-col ax-items-center ax-p-4 ax-border-b\">\n          <axp-user-avatar [size]=\"64\" [userId]=\"(user$ | async)?.id!\"></axp-user-avatar>\n\n          <div class=\"ax-flex ax-flex-col ax-items-center ax-justify-center ax-mt-2\">\n            <div class=\"ax-text-base ax-font-bold\">{{ (user$ | async)?.title }}</div>\n            <axp-tenant-chooser-dropdown></axp-tenant-chooser-dropdown>\n          </div>\n        </div>\n        <div class=\"axp-profile-slot-menus\">\n          <ul>\n            <li>\n              <a (click)=\"showProfile()\">\n                <i class=\"fa-light fa-user\"></i>\n                <span>{{ '@auth:profile.edit' | translate | async }}</span>\n              </a>\n            </li>\n            <li>\n              <a (click)=\"p.close()\" [routerLink]=\"['/', appName(), 'settings', 'user']\">\n                <i class=\"fa-light fa-gear\"></i>\n                <span>{{ '@auth:profile.settings' | translate | async }}</span>\n              </a>\n            </li>\n            <li>\n              <a (click)=\"openUserSession()\">\n                <i class=\"fa-light fa-mobile\"></i>\n                <span>{{ '@auth:profile.sessions' | translate | async }}</span>\n              </a>\n            </li>\n            <li class=\"ax-text-danger-500\">\n              <a (click)=\"logOut()\">\n                <i class=\"fa-light fa-arrow-right-from-bracket\"></i>\n                <span>{{ '@auth:profile.logout' | translate | async }}</span>\n              </a>\n            </li>\n          </ul>\n        </div>\n      </div>\n    </ax-popover>\n  </div>\n} @else {\n  <ax-button color=\"default\" look=\"blank\" text=\"Sign Up / Sign In\" (click)=\"handleSignIn()\">\n    <ax-icon>\n      <i class=\"fa-solid fa-user ax-text-slate-400 dark:ax-text-slate-200\"></i>\n    </ax-icon>\n  </ax-button>\n}\n", styles: [".axp-profile-slot-menus ul{margin-top:.5rem;border-bottom-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-border-lightest-surface),var(--tw-border-opacity, 1));padding-left:.5rem;padding-right:.5rem}.axp-profile-slot-menus ul:last-child{border-width:0px}.axp-profile-slot-menus ul li{display:flex;cursor:pointer;border-radius:.375rem}.axp-profile-slot-menus ul li:last-child{margin-bottom:.5rem}.axp-profile-slot-menus ul li:hover{--tw-bg-opacity: 1;background-color:rgba(var(--ax-sys-color-dark-surface),var(--tw-bg-opacity, 1))}.axp-profile-slot-menus ul li i{margin-inline-end:.75rem;display:grid;height:1.5rem;width:1.5rem;place-items:center;font-size:1.25rem;line-height:1.75rem}.axp-profile-slot-menus ul li a{display:flex;height:100%;width:100%;align-items:center;padding:.5rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: 
                //
                AXImageModule }, { kind: "ngmodule", type: AXAvatarModule }, { kind: "ngmodule", type: AXPopoverModule }, { kind: "component", type: i2$2.AXPopoverComponent, selector: "ax-popover", inputs: ["width", "disabled", "offsetX", "offsetY", "target", "placement", "content", "openOn", "closeOn", "hasBackdrop", "openAfter", "closeAfter", "backdropClass", "panelClass", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "component", type: AXPUserAvatarComponent, selector: "axp-user-avatar", inputs: ["size", "userId"] }, { kind: "component", type: 
                //
                AXPTenantChooserDropdownComponent, selector: "axp-tenant-chooser-dropdown" }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMAuthProfileSlotComponent, decorators: [{
            type: Component,
            args: [{ imports: [
                        CommonModule,
                        RouterModule,
                        //
                        AXImageModule,
                        AXAvatarModule,
                        AXPopoverModule,
                        AXButtonModule,
                        AXDecoratorModule,
                        AXLoadingModule,
                        AXTranslationModule,
                        AXPUserAvatarComponent,
                        //
                        AXPTenantChooserDropdownComponent,
                    ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "@if (isAuthenticated$ | async) {\n  <div class=\"ax-size-fit\">\n    <div #avatar>\n      <axp-user-avatar [size]=\"36\" [userId]=\"(user$ | async)?.id!\"></axp-user-avatar>\n    </div>\n\n    <ax-popover [target]=\"avatar\" [openOn]=\"'toggle'\" [closeOn]=\"'clickOut'\" #p>\n      <div class=\"ax-bg-lightest ax-border ax-border-lightest ax-rounded-md ax-shadow-md ax-w-full ax-min-w-64\">\n        <div class=\"ax-flex ax-flex-col ax-items-center ax-p-4 ax-border-b\">\n          <axp-user-avatar [size]=\"64\" [userId]=\"(user$ | async)?.id!\"></axp-user-avatar>\n\n          <div class=\"ax-flex ax-flex-col ax-items-center ax-justify-center ax-mt-2\">\n            <div class=\"ax-text-base ax-font-bold\">{{ (user$ | async)?.title }}</div>\n            <axp-tenant-chooser-dropdown></axp-tenant-chooser-dropdown>\n          </div>\n        </div>\n        <div class=\"axp-profile-slot-menus\">\n          <ul>\n            <li>\n              <a (click)=\"showProfile()\">\n                <i class=\"fa-light fa-user\"></i>\n                <span>{{ '@auth:profile.edit' | translate | async }}</span>\n              </a>\n            </li>\n            <li>\n              <a (click)=\"p.close()\" [routerLink]=\"['/', appName(), 'settings', 'user']\">\n                <i class=\"fa-light fa-gear\"></i>\n                <span>{{ '@auth:profile.settings' | translate | async }}</span>\n              </a>\n            </li>\n            <li>\n              <a (click)=\"openUserSession()\">\n                <i class=\"fa-light fa-mobile\"></i>\n                <span>{{ '@auth:profile.sessions' | translate | async }}</span>\n              </a>\n            </li>\n            <li class=\"ax-text-danger-500\">\n              <a (click)=\"logOut()\">\n                <i class=\"fa-light fa-arrow-right-from-bracket\"></i>\n                <span>{{ '@auth:profile.logout' | translate | async }}</span>\n              </a>\n            </li>\n          </ul>\n        </div>\n      </div>\n    </ax-popover>\n  </div>\n} @else {\n  <ax-button color=\"default\" look=\"blank\" text=\"Sign Up / Sign In\" (click)=\"handleSignIn()\">\n    <ax-icon>\n      <i class=\"fa-solid fa-user ax-text-slate-400 dark:ax-text-slate-200\"></i>\n    </ax-icon>\n  </ax-button>\n}\n", styles: [".axp-profile-slot-menus ul{margin-top:.5rem;border-bottom-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-border-lightest-surface),var(--tw-border-opacity, 1));padding-left:.5rem;padding-right:.5rem}.axp-profile-slot-menus ul:last-child{border-width:0px}.axp-profile-slot-menus ul li{display:flex;cursor:pointer;border-radius:.375rem}.axp-profile-slot-menus ul li:last-child{margin-bottom:.5rem}.axp-profile-slot-menus ul li:hover{--tw-bg-opacity: 1;background-color:rgba(var(--ax-sys-color-dark-surface),var(--tw-bg-opacity, 1))}.axp-profile-slot-menus ul li i{margin-inline-end:.75rem;display:grid;height:1.5rem;width:1.5rem;place-items:center;font-size:1.25rem;line-height:1.75rem}.axp-profile-slot-menus ul li a{display:flex;height:100%;width:100%;align-items:center;padding:.5rem}\n"] }]
        }], propDecorators: { profilePopover: [{
                type: ViewChild,
                args: ['profilePopover']
            }] } });

class AXMUserProfileCardSlotComponent {
    constructor() {
        this.router = inject(Router);
        this.sessionService = inject(AXPSessionService);
        this.dataService = inject(AXPDataProvider, { optional: true });
        this.hasPicture = signal(true, ...(ngDevMode ? [{ debugName: "hasPicture" }] : []));
        this.avatarText = signal('', ...(ngDevMode ? [{ debugName: "avatarText" }] : []));
        this.user$ = this.sessionService.user$;
        this.tenant$ = this.sessionService.tenant$;
        this.isAuthenticated$ = this.sessionService.isAuthenticated$;
        this.appName = () => this.sessionService.application?.name;
        this.getAvatarText = () => {
            this.user$.pipe(first()).subscribe((user) => {
                const names = user?.title.split(' ');
                if (names?.length && names?.length > 1) {
                    this.avatarText.set(`${names[0][0].toUpperCase()}${names[names.length - 1][0].toUpperCase()}`);
                }
                else
                    return this.avatarText.set('AC');
            });
        };
        this.loadImage();
        this.getAvatarText();
    }
    editProfile() {
        this.router.navigate([`/${this.appName()}/m/securityManagement/e/profile/0/view`]);
    }
    async logOut() {
        await this.sessionService.signout();
    }
    toggleProfileMenu() {
        this.profilePopover.open();
    }
    handleSignIn() {
        this.router.navigate(['/auth/login']);
    }
    onImageError(event) {
        this.hasPicture.set(false);
    }
    async loadImage() {
        try {
            const url = this.sessionService.user?.avatar;
            if (url?.toLowerCase().startsWith('http')) {
                this.src = url;
            }
            else if (this.sessionService.user?.avatar != 'null' && this.dataService) {
                const blob = await this.dataService.viewFile(url, '');
                this.src = URL.createObjectURL(blob);
            }
            else {
                //this.src = this.mockerService.avatar();
            }
        }
        catch (error) {
            this.hasPicture.set(false);
            console.error('Failed to load image by ID:', error);
            this.src = '';
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMUserProfileCardSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXMUserProfileCardSlotComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "profilePopover", first: true, predicate: ["profilePopover"], descendants: true }], ngImport: i0, template: "@if((isAuthenticated$ | async)) {\n<div class=\"ax-p-3 ax-flex ax-items-center ax-gap-1 ax-border-b ax-border-lighter\">\n  <div #avatar>\n    <axp-user-avatar [size]=\"48\" [userId]=\"(user$ | async)?.id!\"></axp-user-avatar>\n  </div>\n  <div class=\"ax-flex ax-flex-col\">\n    <ax-title class=\"ax-text-sm ax-font-medium ax-px-3\">{{ (user$ | async)?.title }}</ax-title>\n    <axp-tenant-chooser-dropdown />\n  </div>\n</div>\n}\n", dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type: 
                //
                AXImageModule }, { kind: "ngmodule", type: AXAvatarModule }, { kind: "ngmodule", type: AXPopoverModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "component", type: 
                //
                AXPTenantChooserDropdownComponent, selector: "axp-tenant-chooser-dropdown" }, { kind: "component", type: AXPUserAvatarComponent, selector: "axp-user-avatar", inputs: ["size", "userId"] }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMUserProfileCardSlotComponent, decorators: [{
            type: Component,
            args: [{ imports: [
                        RouterModule,
                        //
                        AXImageModule,
                        AXAvatarModule,
                        AXPopoverModule,
                        AXButtonModule,
                        AXDecoratorModule,
                        AXLoadingModule,
                        AXTranslationModule,
                        //
                        AXPTenantChooserDropdownComponent,
                        AsyncPipe,
                        AXPUserAvatarComponent,
                    ], template: "@if((isAuthenticated$ | async)) {\n<div class=\"ax-p-3 ax-flex ax-items-center ax-gap-1 ax-border-b ax-border-lighter\">\n  <div #avatar>\n    <axp-user-avatar [size]=\"48\" [userId]=\"(user$ | async)?.id!\"></axp-user-avatar>\n  </div>\n  <div class=\"ax-flex ax-flex-col\">\n    <ax-title class=\"ax-text-sm ax-font-medium ax-px-3\">{{ (user$ | async)?.title }}</ax-title>\n    <axp-tenant-chooser-dropdown />\n  </div>\n</div>\n}\n" }]
        }], ctorParameters: () => [], propDecorators: { profilePopover: [{
                type: ViewChild,
                args: ['profilePopover']
            }] } });

class AXPIdleService {
    constructor() {
        this.configs = inject(AXM_AUTH_CONFIG_TOKEN);
        this.idle$ = new Subject();
        this.timeoutDuration = this.configs.idleTimeout ?? 10 * 60 * 1000;
        this.userActivity$ = new Subject();
        this.idleSubscription = null;
        this.setupActivityListeners();
    }
    get idleState$() {
        return this.idle$.asObservable();
    }
    setupActivityListeners() {
        const activityEvents = ['mousemove', 'keydown', 'wheel'];
        activityEvents.forEach(event => document.addEventListener(event, () => this.resetTimer()));
    }
    startWatching() {
        this.stopWatching(); // Stop any existing subscription
        this.idleSubscription = this.userActivity$.pipe(startWith(null), switchMap(() => timer(this.timeoutDuration)), tap(() => this.idle$.next())).subscribe();
    }
    resetTimer() {
        this.userActivity$.next();
    }
    stopWatching() {
        if (this.idleSubscription) {
            this.idleSubscription.unsubscribe();
            this.idleSubscription = null;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPIdleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPIdleService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPIdleService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [] });

class AXMDeviceSessionsService extends AXMEntityCrudServiceImpl {
}
class AXMDeviceSessionsServiceImpl extends AXMDeviceSessionsService {
    constructor(http) {
        super('SecurityManagement.DeviceSessions'); // Fixed: Use correct entity name format
        this.http = http;
        // private aXMAuthConfigs: AXMAuthConfigs = inject(AXM_AUTH_CONFIG_TOKEN);
        this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
    }
    terminate(id) {
        throw new Error('Method not implemented.');
    }
    async terminateAllCurrentUserSessions() {
        return (this.http
            .post(this.configs.baseUrl + '/security-management/device-sessions/Terminate-All', {})
            .pipe(map((t) => (t === undefined ? false : t)))
            .toPromise() ?? false);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMDeviceSessionsServiceImpl, deps: [{ token: i1$3.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMDeviceSessionsServiceImpl }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMDeviceSessionsServiceImpl, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i1$3.HttpClient }] });

class AXMUserDeviceSessionsService {
}
class AXMUserDeviceSessionsServiceImp extends AXMUserDeviceSessionsService {
    constructor() {
        super(); // Call the base class constructor (good practice)
        this.sessionService = inject(AXPSessionService);
        this.deviceSessionsService = inject(AXMDeviceSessionsService);
        this.settingService = inject(AXPSettingService);
    }
    async getSessions() {
        const userId = this.sessionService.user?.id;
        if (!userId) {
            return [];
        }
        const response = await this.deviceSessionsService.query();
        const items = response.items.filter((item) => item.userId === userId && String(item.status).toLowerCase() === 'active' && !item.isActiveSession);
        return items;
    }
    async getCurrentActiveSessions() {
        const userId = this.sessionService.user?.id;
        if (!userId) {
            throw new Error('No user found in session');
        }
        const response = await this.deviceSessionsService.query();
        const activeSession = response.items.find((item) => item.userId === userId && String(item.status).toLowerCase() === 'active' && item.isActiveSession);
        return activeSession;
    }
    async terminateSession(sessionId) {
        await this.deviceSessionsService.updateOne(sessionId, { status: 'revoked' });
    }
    async terminateAllSession() {
        await this.deviceSessionsService.terminateAllCurrentUserSessions();
    }
    async setTokenLifetimeMinutes(value) {
        await this.settingService.scope(AXPPlatformScope.User).set('session-timeout', value);
        let s2 = await this.settingService.scope(AXPPlatformScope.User).get('session-timeout');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMUserDeviceSessionsServiceImp, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMUserDeviceSessionsServiceImp }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMUserDeviceSessionsServiceImp, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

const canActivateTenantChooser = async (route, state) => {
    const sessionService = inject(AXPSessionService);
    const authStrategyRegistry = inject(AXPAuthStrategyRegistryService);
    const router = inject(Router);
    const strategyName = sessionService.getSessionData()?.strategy;
    const strategy = authStrategyRegistry.get(strategyName);
    const tenants = await firstValueFrom(sessionService.tenants$);
    if (tenants.length === 0) {
        window.alert('You do not have any tenant assigned to your account and cannot use the site. Please contact your administrator.');
        return router.createUrlTree(['/auth/login']);
    }
    if (tenants.length === 1) {
        if (strategy && typeof strategy.updateToken === 'function') {
            const updateContext = {
                user: sessionService.user,
                tenant: tenants[0],
            };
            await sessionService.updateToken(updateContext);
            return router.createUrlTree(['/auth/account/app-chooser']);
        }
        return false;
    }
    return true;
};

const canActivateAppChooser = async (route, state) => {
    const sessionService = inject(AXPSessionService);
    const authStrategyRegistry = inject(AXPAuthStrategyRegistryService);
    const homePageService = inject(AXPHomePageService);
    const router = inject(Router);
    const strategyName = sessionService.getSessionData()?.strategy;
    const strategy = authStrategyRegistry.get(strategyName);
    const apps = await firstValueFrom(sessionService.applications$);
    if (apps.length === 0) {
        await router.navigate(['/auth/login']);
        return false;
    }
    if (apps.length === 1) {
        const tenantId = sessionService.tenant?.id;
        if (!tenantId) {
            throw new Error('Tenant ID is missing. Please contact support.');
        }
        if (strategy && typeof strategy.updateToken === 'function') {
            const updateContext = {
                user: sessionService.user,
                tenant: sessionService.tenant,
                application: apps[0],
            };
            await sessionService.updateToken(updateContext);
            return router.createUrlTree([homePageService.getCurrent().path]);
        }
        return false;
    }
    return true;
};

function routesFacory() {
    let routes = [];
    routes = [
        {
            path: 'tenant-chooser',
            loadComponent: () => import('./acorex-modules-auth-tenant-chooser.component-vI4qDxVt.mjs').then((c) => c.AXPAuthTenantChooserComponent),
            canActivate: [AXPAuthGuard, canActivateTenantChooser],
        },
        {
            path: 'app-chooser',
            loadComponent: () => import('./acorex-modules-auth-app-chooser.component-BwuQ1IDp.mjs').then((c) => c.AXPAuthAppChooserComponent),
            canActivate: [AXPAuthGuard, canActivateAppChooser],
        },
    ];
    return routes;
}
class AXPAccountModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPAccountModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXPAccountModule, imports: [RouterModule, i1$4.AXPComponentSlotModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPAccountModule, providers: [
            {
                provide: ROUTES,
                multi: true,
                useFactory: routesFacory,
            },
            {
                provide: AXMUserDeviceSessionsService,
                useClass: AXMUserDeviceSessionsServiceImp,
            },
        ], imports: [RouterModule,
            //
            AXPComponentSlotModule.forChild({
                'root-side-menu-header': [
                    {
                        priority: 1,
                        name: 'user-card',
                        component: AXMUserProfileCardSlotComponent,
                    },
                ],
                'root-header-end': [
                    {
                        priority: 98,
                        name: 'app-choser',
                        component: AXMAppChooserSlotComponent,
                    },
                    {
                        priority: 99,
                        name: 'profile',
                        component: AXMAuthProfileSlotComponent,
                    },
                ],
            })] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPAccountModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [],
                    imports: [
                        RouterModule,
                        //
                        AXPComponentSlotModule.forChild({
                            'root-side-menu-header': [
                                {
                                    priority: 1,
                                    name: 'user-card',
                                    component: AXMUserProfileCardSlotComponent,
                                },
                            ],
                            'root-header-end': [
                                {
                                    priority: 98,
                                    name: 'app-choser',
                                    component: AXMAppChooserSlotComponent,
                                },
                                {
                                    priority: 99,
                                    name: 'profile',
                                    component: AXMAuthProfileSlotComponent,
                                },
                            ],
                        }),
                    ],
                    exports: [],
                    providers: [
                        {
                            provide: ROUTES,
                            multi: true,
                            useFactory: routesFacory,
                        },
                        {
                            provide: AXMUserDeviceSessionsService,
                            useClass: AXMUserDeviceSessionsServiceImp,
                        },
                    ],
                }]
        }] });

var account_module = /*#__PURE__*/Object.freeze({
    __proto__: null,
    AXPAccountModule: AXPAccountModule
});

class AXMAuthModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXMAuthModule, imports: [CommonModule, i1$5.AXPCommonModule, i1$2.RouterModule, AXPAccountModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMAuthModule, providers: [
            AXMAuthErrorHandler,
            {
                provide: AXP_MENU_PROVIDER,
                useClass: AXMSecurityManagementModuleMenuProvider,
                multi: true,
            },
            {
                provide: AXP_SETTING_DEFINITION_PROVIDER,
                useFactory: async () => {
                    const injector = inject(Injector);
                    const provider = (await import('./acorex-modules-auth-settings.provider-P6ATx8ON.mjs')).AXMSettingProvider;
                    return new provider(injector);
                },
                multi: true,
            },
            provideCommandSetups([
                {
                    key: 'auth:profile',
                    command: () => import('./acorex-modules-auth-show-profile-command-BxzGxvJt.mjs').then((c) => c.AXPShowProfileCommand),
                },
            ]),
        ], imports: [CommonModule,
            AXPCommonModule.forChild({ errorHandlers: [AXMAuthErrorHandler] }),
            RouterModule.forChild(routes),
            AXPAccountModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMAuthModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        CommonModule,
                        AXPCommonModule.forChild({ errorHandlers: [AXMAuthErrorHandler] }),
                        RouterModule.forChild(routes),
                        AXPAccountModule,
                    ],
                    providers: [
                        AXMAuthErrorHandler,
                        {
                            provide: AXP_MENU_PROVIDER,
                            useClass: AXMSecurityManagementModuleMenuProvider,
                            multi: true,
                        },
                        {
                            provide: AXP_SETTING_DEFINITION_PROVIDER,
                            useFactory: async () => {
                                const injector = inject(Injector);
                                const provider = (await import('./acorex-modules-auth-settings.provider-P6ATx8ON.mjs')).AXMSettingProvider;
                                return new provider(injector);
                            },
                            multi: true,
                        },
                        provideCommandSetups([
                            {
                                key: 'auth:profile',
                                command: () => import('./acorex-modules-auth-show-profile-command-BxzGxvJt.mjs').then((c) => c.AXPShowProfileCommand),
                            },
                        ]),
                    ],
                }]
        }] });

var AXMSessionStatusTypes;
(function (AXMSessionStatusTypes) {
    AXMSessionStatusTypes["revoked"] = "revoked";
    AXMSessionStatusTypes["expired"] = "expired";
    AXMSessionStatusTypes["active"] = "active";
})(AXMSessionStatusTypes || (AXMSessionStatusTypes = {}));

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

export { AXM_AUTH_CONFIG_TOKEN as A, AXMAuthenticationTypes as a, AXPTenantChooserDropdownComponent as b, AXPAppChooserListComponent as c, AXMUserDeviceSessionsService as d, AXMAuthErrorHandler as e, AXMDefaultAuthConfigs as f, configAuthModule as g, AXMAuthModule as h, AXMSessionStatusTypes as i, AXPIdleService as j, AXMDeviceSessionsService as k, AXMDeviceSessionsServiceImpl as l };
//# sourceMappingURL=acorex-modules-auth-acorex-modules-auth-D1GLmcE-.mjs.map
