import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { CdkOverlayOrigin, CdkConnectedOverlay } from '@angular/cdk/overlay';
import { TechlifyListingControllerInterface } from '../base-model';
import { MaterialModule } from '../material.module';
import * as i0 from "@angular/core";
import * as i1 from "../services/techlify-app.service";
import * as i2 from "../core";
import * as i3 from "@angular/common";
import * as i4 from "@angular/material/button";
import * as i5 from "@angular/material/icon";
import * as i6 from "@angular/material/card";
export class AppSwitcherComponent extends TechlifyListingControllerInterface {
    constructor(appService, errorHandler) {
        super();
        this.appService = appService;
        this.errorHandler = errorHandler;
        this.isOpen = false;
    }
    ngOnInit() {
        this.loadData();
    }
    loadData() {
        this.isWorking = true;
        this.appService.index({}, true).subscribe({
            next: (response) => {
                this.models = response.data;
                this.isWorking = false;
            },
            error: (error) => {
                this.errorHandler.handleError(error);
                this.isWorking = false;
            },
            complete: () => {
                this.isWorking = false;
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AppSwitcherComponent, deps: [{ token: i1.TechlifyAppService }, { token: i2.ErrorHandlerService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: AppSwitcherComponent, isStandalone: true, selector: "app-switcher", usesInheritance: true, ngImport: i0, template: "<!-- Button to open app switcher -->\n<button mat-icon-button (click)=\"isOpen = !isOpen\" cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\" class='d-flex justify-content-center align-items-center'>\n  <mat-icon>apps</mat-icon>\n</button>\n\n<!-- Overlay container -->\n<ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"trigger\" [cdkConnectedOverlayOpen]=\"isOpen\"\n  (overlayOutsideClick)=\"isOpen = false\">\n  <mat-card>\n    <mat-card-content class=\"d-flex justify-content-start align-items-center\">\n      <div *ngFor=\"let app of models\">\n        <a [href]=\"app.url\" target=\"_blank\" class=\"d-flex flex-column align-items-center gap-1 app-item p-2 text-decoration-none text-dark\">\n          <img [src]=\"app.icon_url\" [alt]=\"app.title\" class=\"app-icon\" width='50px' />\n          <p>{{ app.title }}</p>\n        </a>\n      </div>\n    </mat-card-content>\n  </mat-card>\n</ng-template>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "ngmodule", type: MaterialModule }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i6.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i6.MatCardContent, selector: "mat-card-content" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AppSwitcherComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-switcher', standalone: true, imports: [
                        CommonModule,
                        CdkOverlayOrigin,
                        CdkConnectedOverlay,
                        MaterialModule,
                    ], template: "<!-- Button to open app switcher -->\n<button mat-icon-button (click)=\"isOpen = !isOpen\" cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\" class='d-flex justify-content-center align-items-center'>\n  <mat-icon>apps</mat-icon>\n</button>\n\n<!-- Overlay container -->\n<ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"trigger\" [cdkConnectedOverlayOpen]=\"isOpen\"\n  (overlayOutsideClick)=\"isOpen = false\">\n  <mat-card>\n    <mat-card-content class=\"d-flex justify-content-start align-items-center\">\n      <div *ngFor=\"let app of models\">\n        <a [href]=\"app.url\" target=\"_blank\" class=\"d-flex flex-column align-items-center gap-1 app-item p-2 text-decoration-none text-dark\">\n          <img [src]=\"app.icon_url\" [alt]=\"app.title\" class=\"app-icon\" width='50px' />\n          <p>{{ app.title }}</p>\n        </a>\n      </div>\n    </mat-card-content>\n  </mat-card>\n</ng-template>" }]
        }], ctorParameters: () => [{ type: i1.TechlifyAppService }, { type: i2.ErrorHandlerService }] });
//# sourceMappingURL=data:application/json;base64, 