import * as i0 from '@angular/core';
import { inject, ViewEncapsulation, Component } from '@angular/core';
import * as i3 from '@acorex/components/avatar';
import { AXAvatarModule } from '@acorex/components/avatar';
import { AXButtonModule } from '@acorex/components/button';
import { AXCheckBoxModule } from '@acorex/components/check-box';
import { AXDecoratorModule } from '@acorex/components/decorators';
import { AXFormModule } from '@acorex/components/form';
import { AXImageModule } from '@acorex/components/image';
import { AXLabelModule } from '@acorex/components/label';
import { AXLoadingModule } from '@acorex/components/loading';
import { AXTextBoxModule } from '@acorex/components/text-box';
import * as i5 from '@acorex/core/translation';
import { AXTranslationModule } from '@acorex/core/translation';
import { AXPSessionService } from '@acorex/platform/auth';
import { AXP_PLATFORM_CONFIG_TOKEN, AXPLogoComponent } from '@acorex/platform/common';
import { AXPUserAvatarComponent } from '@acorex/platform/layout/components';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import { Router } from '@angular/router';
import { of } from 'rxjs';
import { b as AXPTenantChooserDropdownComponent, c as AXPAppChooserListComponent } from './acorex-modules-auth-acorex-modules-auth-D1GLmcE-.mjs';

class AXPAuthAppChooserComponent {
    constructor() {
        this.router = inject(Router);
        this.platformConfig = inject(AXP_PLATFORM_CONFIG_TOKEN);
        this.sessionService = inject(AXPSessionService);
        this.user = this.sessionService.user;
        this.tenants$ = of([]); //this.sessionService.tenants$;
        this.tenant = this.sessionService.tenant;
    }
    ngOnInit() {
    }
    tenantChooser() {
        this.router.navigate(['/auth/account/tenant-chooser']);
    }
    async handleSignout() {
        await this.sessionService.signout();
        this.router.navigate(['/auth/login']);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPAuthAppChooserComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXPAuthAppChooserComponent, isStandalone: true, selector: "axp-auth-app-chooser", ngImport: i0, template: "<main\n  *translate=\"let t\"\n  class=\"ax-w-full ax-space-y-10 ax-h-[100vh] ax-flex ax-flex-col ax-items-center ax-justify-center ax-bg-lightest md:ax-bg-default\"\n>\n  <section>\n    <axp-logo\n      [source]=\"platformConfig.logo?.full\"\n      [attr.alt]=\"platformConfig.title\"\n      class=\"ax-w-36 ax-mx-auto ax-text-2xl ax-font-bold\"\n    ></axp-logo>\n  </section>\n  <section class=\"ax-flex ax-justify-center\">\n    <div\n      class=\"ax-flex ax-gap-2 ax-justify-center ax-text-center ax-flex-col ax-items-center ax-border ax-rounded-lg ax-shadow-lg ax-p-6 md:ax-w-96 ax-w-80\"\n    >\n      <ax-avatar class=\"ax-rounded-full\" [size]=\"72\">\n        @if (user?.avatar) {\n          <!-- <ax-image [src]=\"user?.avatar\"></ax-image> -->\n          <axp-user-avatar [size]=\"72\" [userId]=\"user?.id!\"></axp-user-avatar>\n        }\n      </ax-avatar>\n      <h2 class=\"md:ax-text-lg ax-font-medium\">\n        {{ '@auth:welcome.message' | translate | async }}, {{ user?.title }}\n      </h2>\n      <axp-tenant-chooser-dropdown></axp-tenant-chooser-dropdown>\n      <p class=\"ax-text-neutral-500 ax-text-sm md:ax-text-base ax-font-medium\">\n        {{ '@auth:application-chooser.description' | translate | async }}\n      </p>\n      <div class=\"ax-mt-3 ax-w-full ax-overflow-auto ax-max-h-[300px] ax-pe-2\">\n        <axp-app-chooser-list></axp-app-chooser-list>\n      </div>\n    </div>\n  </section>\n  <section>\n    <p class=\"ax-text-neutral-400 ax-text-sm\">\n      {{ '@auth:application-chooser.footer' | translate | async }}\n      @if (tenants$ | async; as tenants) {\n        @if (tenants.length > 1) {\n          <a (click)=\"tenantChooser()\" class=\"ax-text-primary-500 ax-cursor-pointer ax-font-medium hover:ax-underline\">\n            {{ '@auth:application-chooser.backCompany' | translate | async }}\n          </a>\n        } @else {\n          <a (click)=\"handleSignout()\" class=\"ax-text-primary-500 ax-font-medium ax-cursor-pointer hover:ax-underline\">\n            {{ '@auth:backLogin' | translate | async }}\n          </a>\n        }\n      }\n    </p>\n  </section>\n</main>\n", styles: [".gradient{background:-webkit-linear-gradient(var(--ax-current-v1),var(--ax-current-v2));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXLabelModule }, { kind: "ngmodule", type: AXCheckBoxModule }, { kind: "ngmodule", type: AXAvatarModule }, { kind: "component", type: i3.AXAvatarComponent, selector: "ax-avatar", inputs: ["color", "size", "shape", "look"], outputs: ["sizeChange"] }, { kind: "ngmodule", type: AXImageModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: AXPLogoComponent, selector: "axp-logo", inputs: ["source"] }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "directive", type: i5.AXTranslatorDirective, selector: "[translate]" }, { kind: "component", type: AXPTenantChooserDropdownComponent, selector: "axp-tenant-chooser-dropdown" }, { kind: "component", type: AXPAppChooserListComponent, selector: "axp-app-chooser-list" }, { kind: "component", type: AXPUserAvatarComponent, selector: "axp-user-avatar", inputs: ["size", "userId"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.AXTranslatorPipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPAuthAppChooserComponent, decorators: [{
            type: Component,
            args: [{ selector: 'axp-auth-app-chooser', imports: [
                        CommonModule,
                        AXFormModule,
                        AXTextBoxModule,
                        AXButtonModule,
                        AXLabelModule,
                        AXCheckBoxModule,
                        AXAvatarModule,
                        AXImageModule,
                        AXDecoratorModule,
                        AXPLogoComponent,
                        AXLoadingModule,
                        AXTranslationModule,
                        AXPTenantChooserDropdownComponent,
                        AXPAppChooserListComponent,
                        AXPUserAvatarComponent,
                    ], encapsulation: ViewEncapsulation.None, template: "<main\n  *translate=\"let t\"\n  class=\"ax-w-full ax-space-y-10 ax-h-[100vh] ax-flex ax-flex-col ax-items-center ax-justify-center ax-bg-lightest md:ax-bg-default\"\n>\n  <section>\n    <axp-logo\n      [source]=\"platformConfig.logo?.full\"\n      [attr.alt]=\"platformConfig.title\"\n      class=\"ax-w-36 ax-mx-auto ax-text-2xl ax-font-bold\"\n    ></axp-logo>\n  </section>\n  <section class=\"ax-flex ax-justify-center\">\n    <div\n      class=\"ax-flex ax-gap-2 ax-justify-center ax-text-center ax-flex-col ax-items-center ax-border ax-rounded-lg ax-shadow-lg ax-p-6 md:ax-w-96 ax-w-80\"\n    >\n      <ax-avatar class=\"ax-rounded-full\" [size]=\"72\">\n        @if (user?.avatar) {\n          <!-- <ax-image [src]=\"user?.avatar\"></ax-image> -->\n          <axp-user-avatar [size]=\"72\" [userId]=\"user?.id!\"></axp-user-avatar>\n        }\n      </ax-avatar>\n      <h2 class=\"md:ax-text-lg ax-font-medium\">\n        {{ '@auth:welcome.message' | translate | async }}, {{ user?.title }}\n      </h2>\n      <axp-tenant-chooser-dropdown></axp-tenant-chooser-dropdown>\n      <p class=\"ax-text-neutral-500 ax-text-sm md:ax-text-base ax-font-medium\">\n        {{ '@auth:application-chooser.description' | translate | async }}\n      </p>\n      <div class=\"ax-mt-3 ax-w-full ax-overflow-auto ax-max-h-[300px] ax-pe-2\">\n        <axp-app-chooser-list></axp-app-chooser-list>\n      </div>\n    </div>\n  </section>\n  <section>\n    <p class=\"ax-text-neutral-400 ax-text-sm\">\n      {{ '@auth:application-chooser.footer' | translate | async }}\n      @if (tenants$ | async; as tenants) {\n        @if (tenants.length > 1) {\n          <a (click)=\"tenantChooser()\" class=\"ax-text-primary-500 ax-cursor-pointer ax-font-medium hover:ax-underline\">\n            {{ '@auth:application-chooser.backCompany' | translate | async }}\n          </a>\n        } @else {\n          <a (click)=\"handleSignout()\" class=\"ax-text-primary-500 ax-font-medium ax-cursor-pointer hover:ax-underline\">\n            {{ '@auth:backLogin' | translate | async }}\n          </a>\n        }\n      }\n    </p>\n  </section>\n</main>\n", styles: [".gradient{background:-webkit-linear-gradient(var(--ax-current-v1),var(--ax-current-v2));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}\n"] }]
        }] });

export { AXPAuthAppChooserComponent };
//# sourceMappingURL=acorex-modules-auth-app-chooser.component-BwuQ1IDp.mjs.map
