import { AXBadgeModule } from '@acorex/components/badge';
import { AXBreadcrumbsModule } from '@acorex/components/breadcrumbs';
import { AXButtonModule } from '@acorex/components/button';
import * as i3 from '@acorex/components/decorators';
import { AXDecoratorModule } from '@acorex/components/decorators';
import { AXDropdownButtonModule } from '@acorex/components/dropdown-button';
import { AXLoadingModule } from '@acorex/components/loading';
import * as i3$1 from '@acorex/components/search-box';
import { AXSearchBoxModule } from '@acorex/components/search-box';
import { AXTabsModule } from '@acorex/components/tabs';
import * as i1$2 from '@acorex/core/translation';
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
import { AXUnsubscriber } from '@acorex/core/utils';
import { RootConfig, AXPReportDefinitionService } from './acorex-modules-report-management.mjs';
import { AXPThemeLayoutBlockComponent, AXPThemeLayoutToolbarComponent, AXPThemeLayoutHeaderComponent, AXPThemeLayoutStartSideComponent, AXPStateMessageComponent } from '@acorex/platform/layout/components';
import { AXPPageLayoutBaseComponent, AXPPageLayoutComponent, AXPPageLayoutBase } from '@acorex/platform/layout/views';
import { AXPLayoutThemeService } from '@acorex/platform/themes/shared';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { computed, inject, output, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
import * as i1$1 from '@angular/forms';
import { FormsModule } from '@angular/forms';
import { ActivatedRoute, Router, NavigationEnd, RouterModule } from '@angular/router';
import { merge, filter, startWith, firstValueFrom } from 'rxjs';
import { AXPPageStatus } from '@acorex/platform/layout/widget-core';
import { signalStore, withState, withComputed, withMethods, patchState, withHooks } from '@ngrx/signals';
import { isNil, isEmpty } from 'lodash-es';
import { AXLocaleService } from '@acorex/core/locale';
import * as i2 from '@acorex/components/tree-view';
import { AXTreeViewModule } from '@acorex/components/tree-view';
import { AXPWorkflowService } from '@acorex/platform/workflow';

const AXPReportRunnerRootViewModel = signalStore(withState(() => ({
    activeCategory: undefined,
    categories: [],
    reports: [],
    activeCategoriesPath: [],
    //
    searchExpression: null,
    //
    status: AXPPageStatus.Processing,
})), withComputed((store, layout = inject(AXPLayoutThemeService)) => ({
    searchResults: computed(() => []),
    hasActiveCategory: computed(() => store.activeCategory() != null),
    showSideMenu: computed(() => layout.isLarge()),
    isSearching: computed(() => store.searchExpression() != null),
    isBusy: computed(() => store.status() == AXPPageStatus.Processing),
    isLoaded: computed(() => store.activeCategory() != null),
    title: computed(() => store.activeCategory()?.title ?? `@${RootConfig.config.i18n}:features.report-runner.page-title`),
    description: computed(() => store.activeCategory()?.description ?? `@${RootConfig.config.i18n}:features.report-runner.page-description`),
})), withMethods((store, reportDefinitionService = inject(AXPReportDefinitionService)) => ({
    async loadRootCategories() {
        patchState(store, {
            activeCategory: undefined,
            reports: [],
            activeCategoriesPath: [],
        });
        //
        patchState(store, {
            status: AXPPageStatus.Processing,
        });
        patchState(store, {
            categories: await reportDefinitionService.getCategories(),
        });
        patchState(store, {
            status: AXPPageStatus.Idle,
        });
    },
    async getCategories(parentId) {
        patchState(store, {
            status: AXPPageStatus.Processing,
        });
        //
        const result = await reportDefinitionService.getCategories(parentId);
        //
        patchState(store, {
            status: AXPPageStatus.Idle,
        });
        //
        return result;
    },
    async getReports(categoryId) {
        patchState(store, {
            status: AXPPageStatus.Processing,
        });
        //
        const result = await reportDefinitionService.getReportsByCategoryId(categoryId);
        //
        patchState(store, {
            status: AXPPageStatus.Idle,
        });
        //
        return result;
    },
    async setActiveCategory(category) {
        //
        patchState(store, {
            status: AXPPageStatus.Processing,
        });
        //
        patchState(store, {
            activeCategory: category,
        });
        //
        patchState(store, {
            categories: await reportDefinitionService.getCategories(category.id),
            reports: await reportDefinitionService.getReportsByCategoryId(category.id),
            activeCategoriesPath: await reportDefinitionService.getCategoriesPathById(category.id),
        });
        //
        patchState(store, {
            status: AXPPageStatus.Idle,
        });
    },
    async setActiveCategoryById(id) {
        //
        patchState(store, {
            status: AXPPageStatus.Processing,
        });
        //
        const category = await reportDefinitionService.getCategoryById(id);
        if (category) {
            patchState(store, {
                activeCategory: category,
            });
            //
            patchState(store, {
                categories: await reportDefinitionService.getCategories(category.id),
                reports: await reportDefinitionService.getReportsByCategoryId(category.id),
                activeCategoriesPath: await reportDefinitionService.getCategoriesPathById(category.id),
            });
        }
        //
        patchState(store, {
            status: AXPPageStatus.Idle,
        });
    },
    //
    async search(expression) {
        if (!isNil(expression) && !isEmpty(expression)) {
            patchState(store, {
                searchExpression: expression,
            });
        }
        else {
            patchState(store, {
                searchExpression: null,
            });
        }
    },
    clearSearch() {
        patchState(store, {
            searchExpression: null,
        });
    },
})), withHooks((store, translationService = inject(AXTranslationService), localeService = inject(AXLocaleService)) => ({
    async onInit() {
        merge(translationService.langChanges$, localeService.profileChanged$).subscribe(async () => {
        });
        //
        await store.loadRootCategories();
    },
    onDestroy() { },
})));

//#region ----   Imports   ----
//#endregion
class AXPReportCategoriesTreeComponent {
    constructor() {
        //#region ----   Services & Dependencies   ----
        this.reportDefinitionService = inject(AXPReportDefinitionService);
        //#endregion
        //#region ----   Output Events   ----
        /**
         * Emitted when a category node is clicked
         */
        this.categoryClick = output();
        /**
         * Emitted when a report node is clicked
         */
        this.reportClick = output();
        //#endregion
        //#region ----   Data Loading Methods   ----
        /**
         * Provide lazy loading tree data
         */
        this.provideLazyTreeView = async (selectedItemId) => {
            if (selectedItemId) {
                // Get categories (folders) for the selected parent
                const categories = (await this.reportDefinitionService.getCategories(selectedItemId)).map((item) => ({
                    id: item.id,
                    title: item.title,
                    hasChild: (item.hasChild || item.hasReport) ?? false,
                    item: item,
                    type: 'category',
                    expanded: isNil(item.parentId) ? true : false,
                }));
                // Get report definitions (files) for the selected category
                // This should use cached data from the category API response
                // Note: This will use the cached data from the category API call
                const definitions = (await this.reportDefinitionService.getReportsByCategoryId(selectedItemId)).map((item) => ({
                    id: item.id,
                    title: item.title,
                    hasChild: false,
                    item: item,
                    type: 'definition',
                    expanded: false,
                }));
                return [...categories, ...definitions];
            }
            else {
                // Root level - only show categories
                const categories = await this.reportDefinitionService.getCategories();
                const items = categories.map((item) => ({
                    id: item.id,
                    title: item.title,
                    hasChild: (item.hasChild || item.hasReport) ?? false,
                    item: item,
                    type: 'category',
                    expanded: false,
                }));
                return items;
            }
        };
    }
    //#endregion
    //#region ----   Event Handlers   ----
    /**
     * Handle tree node click events
     */
    async handleNodeClick(event) {
        const node = event.data;
        if (node.type === 'category') {
            this.categoryClick.emit(node.item);
        }
        else if (node.type === 'definition') {
            this.reportClick.emit(node.item);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPReportCategoriesTreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXPReportCategoriesTreeComponent, isStandalone: true, selector: "axp-report-categories-tree", outputs: { categoryClick: "categoryClick", reportClick: "reportClick" }, host: { classAttribute: "axp-report-categories-tree" }, ngImport: i0, template: "<ax-tree-view\n  [showCheckbox]=\"false\"\n  [itemTemplate]=\"itemTemplate\"\n  [textField]=\"'title'\"\n  [hasChildField]=\"'hasChild'\"\n  [valueField]=\"'id'\"\n  [expandedField]=\"'expanded'\"\n  [items]=\"provideLazyTreeView\"\n  (onNodeClick)=\"handleNodeClick($event)\"\n>\n</ax-tree-view>\n\n<ng-template #itemTemplate let-item>\n  @if (item.type === 'category') {\n    <ax-icon class=\"fas ax-text-warning fa-folder\"></ax-icon>\n  } @else {\n    <ax-icon class=\"fas ax-text-accent1 fa-file-chart-column\"></ax-icon>\n  }\n  {{ item.title }}\n</ng-template>\n", styles: [".axp-report-categories-tree{height:100%;width:100%}.axp-report-categories-tree .__tree-view .__item{display:flex;align-items:center;gap:.5rem}.axp-report-categories-tree .__tree-view .__item .__icon{flex-shrink:0}.axp-report-categories-tree .__tree-view .__item .__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.axp-report-categories-tree .__tree-view .__item:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXTreeViewModule }, { kind: "component", type: i2.AXTreeViewComponent, selector: "ax-tree-view", inputs: ["items", "showCheckbox", "hasCheckboxField", "selectionMode", "selectionBehavior", "selectionScope", "focusNodeEnabled", "valueField", "textField", "visibleField", "disableField", "hasChildField", "selectedField", "expandedField", "tooltipField", "childrenField", "activeField", "indeterminateField", "parentField", "iconField", "toggleIcons", "look", "showEmptyNodeMassage", "itemTemplate", "emptyTemplate", "expandOn"], outputs: ["onSelectionChanged", "onItemSelectedChanged", "onNodeClick", "onCollapsedChanged", "onNodedbClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPReportCategoriesTreeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'axp-report-categories-tree', standalone: true, imports: [
                        CommonModule,
                        AXDecoratorModule,
                        AXTreeViewModule,
                    ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { class: 'axp-report-categories-tree' }, template: "<ax-tree-view\n  [showCheckbox]=\"false\"\n  [itemTemplate]=\"itemTemplate\"\n  [textField]=\"'title'\"\n  [hasChildField]=\"'hasChild'\"\n  [valueField]=\"'id'\"\n  [expandedField]=\"'expanded'\"\n  [items]=\"provideLazyTreeView\"\n  (onNodeClick)=\"handleNodeClick($event)\"\n>\n</ax-tree-view>\n\n<ng-template #itemTemplate let-item>\n  @if (item.type === 'category') {\n    <ax-icon class=\"fas ax-text-warning fa-folder\"></ax-icon>\n  } @else {\n    <ax-icon class=\"fas ax-text-accent1 fa-file-chart-column\"></ax-icon>\n  }\n  {{ item.title }}\n</ng-template>\n", styles: [".axp-report-categories-tree{height:100%;width:100%}.axp-report-categories-tree .__tree-view .__item{display:flex;align-items:center;gap:.5rem}.axp-report-categories-tree .__tree-view .__item .__icon{flex-shrink:0}.axp-report-categories-tree .__tree-view .__item .__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.axp-report-categories-tree .__tree-view .__item:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}\n"] }]
        }] });

class AXMReportRunnerRootPageComponent extends AXPPageLayoutBaseComponent {
    constructor() {
        super(...arguments);
        this.vm = inject(AXPReportRunnerRootViewModel);
        this.layoutService = inject(AXPLayoutThemeService);
        this.activatedRoute = inject(ActivatedRoute);
        this.unsubscribe = inject(AXUnsubscriber);
        this.reportDefinitionService = inject(AXPReportDefinitionService);
        this.workflow = inject(AXPWorkflowService);
        this.router = inject(Router);
        this.baseRoutes = [this.sessionService.application?.name, 'report-management', 'reports'];
    }
    async ngOnInit() {
        await super.ngOnInit();
        //
        this.router.events
            .pipe(this.unsubscribe.takeUntilDestroy, filter((event) => event instanceof NavigationEnd), startWith(null))
            .subscribe(async () => {
            await this.loadFromRoute();
        });
    }
    async loadFromRoute() {
        const snapshot = this.activatedRoute.snapshot;
        const segments = await firstValueFrom(this.activatedRoute.url);
        let categoryId = segments[segments.length - 1]?.path ?? null;
        if (categoryId) {
            await this.vm.setActiveCategoryById(categoryId);
        }
        else {
            await this.vm.loadRootCategories();
            return;
        }
        //
        let reportId = snapshot.queryParamMap.get('report') ?? null;
        if (reportId) {
            // Navigate directly to viewer instead of showing parameters
            await this.navigateToViewer(reportId);
        }
    }
    //#region ----   Event Handlers   ----
    /**
     * Handle category selection from tree
     */
    async onCategoryClick(category) {
        await this.navigateToCategory(category);
    }
    /**
     * Handle report selection from tree
     */
    async onReportClick(report) {
        await this.navigateToReport(report);
    }
    /**
     * Navigate directly to report viewer with the selected report
     */
    async navigateToViewer(reportId) {
        const baseViewerRoute = [this.sessionService.application?.name, 'report-management', 'viewer'];
        await this.router.navigate(baseViewerRoute, {
            queryParams: { reportId }
        });
    }
    //#endregion
    async navigateToCategory(category) {
        // Find the path to this category
        const path = await this.reportDefinitionService.getCategoriesPathById(category.id);
        // Find the index of the target category in the path
        let urlParts = [...this.baseRoutes];
        for (const cat of path) {
            urlParts.push(cat.id);
        }
        await this.router.navigate(urlParts);
    }
    async navigateToReport(report) {
        // Navigate directly to viewer instead of showing parameters in runner
        await this.navigateToViewer(report.id);
    }
    //#region ----   Page Configuration Overrides   ----
    async getPageBreadcrumbs() {
        const path = this.vm.activeCategoriesPath();
        const report = {
            name: 'reports',
            title: await this.translateService.translateAsync('@report-management:root-menu'),
            command: {
                name: 'navigate-to-reports-root',
            },
        };
        if (!path || path.length === 0) {
            return [report];
        }
        const breadcrumbs = [report];
        let urlParts = [...this.baseRoutes];
        for (const cat of path) {
            urlParts = [...urlParts, cat.id];
            breadcrumbs.push({
                name: cat.id,
                title: cat.title,
                command: {
                    name: 'navigate-to-category',
                    options: {
                        category: cat,
                    },
                },
            });
        }
        return breadcrumbs;
    }
    async getSecondaryMenuItems() {
        return [];
    }
    async getPageTitle() {
        return this.vm.title();
    }
    async getPageDescription() {
        return this.vm.description();
    }
    async getBackButton() {
        const categoriesPath = this.vm.activeCategoriesPath();
        if (!categoriesPath || categoriesPath.length === 0) {
            // At root level, no back button
            return null;
        }
        if (categoriesPath.length === 1) {
            // At first level category, back to reports root
            return {
                title: await this.translateService.translateAsync('@report-management:root-menu'),
            };
        }
        // At deeper level, back to parent category
        const parentCategory = categoriesPath[categoriesPath.length - 2];
        return {
            title: parentCategory.title,
        };
    }
    async onBackButtonClick() {
        const categoriesPath = this.vm.activeCategoriesPath();
        if (!categoriesPath || categoriesPath.length <= 1) {
            // Navigate back to reports root
            await this.router.navigate([...this.baseRoutes]);
        }
        else {
            // Navigate to parent category
            const parentCategoriesPath = categoriesPath.slice(0, -1);
            let urlParts = [...this.baseRoutes];
            for (const cat of parentCategoriesPath) {
                urlParts.push(cat.id);
            }
            await this.router.navigate(urlParts);
        }
    }
    async execute(command) {
        switch (command.name) {
            case 'navigate-to-category':
                await this.navigateToCategory(command.options?.['category']);
                break;
            case 'navigate-to-reports-root':
                await this.router.navigate([...this.baseRoutes]);
                break;
            case 'create-report':
                await this.workflow.execute('report-create', {
                    data: {
                        categoryId: this.vm.activeCategory()?.id ?? null,
                    },
                });
                break;
        }
    }
    async getPrimaryMenuItems() {
        return [
            {
                title: '@general:actions.create.title',
                icon: 'fa-light fa-plus',
                color: 'primary',
                command: {
                    name: 'create-report',
                },
            },
        ];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMReportRunnerRootPageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXMReportRunnerRootPageComponent, isStandalone: true, selector: "ng-component", host: { classAttribute: "axp-report-runner-root-page" }, providers: [
            AXUnsubscriber,
            AXPReportRunnerRootViewModel,
            {
                provide: AXPPageLayoutBase,
                useExisting: AXMReportRunnerRootPageComponent,
            },
        ], usesInheritance: true, ngImport: i0, template: "<axp-page-layout *translate=\"let t\">\n  @if (vm.showSideMenu()) {\n    <axp-layout-start-side>\n      <axp-layout-header>\n        <axp-layout-title>{{ t('@report-management:features.report-runner.menu-title') | async }}</axp-layout-title>\n        <axp-layout-toolbar>\n          <ax-search-box\n            [delayTime]=\"300\"\n            [ngModel]=\"vm.searchExpression()\"\n            (onValueChanged)=\"vm.search($event.value)\"\n            [placeholder]=\"t('@report-management:search.placeholder') | async\"\n          >\n            <ax-clear-button></ax-clear-button>\n          </ax-search-box>\n        </axp-layout-toolbar>\n      </axp-layout-header>\n      <axp-layout-content>\n        <axp-report-categories-tree (categoryClick)=\"onCategoryClick($event)\" (reportClick)=\"onReportClick($event)\" />\n      </axp-layout-content>\n    </axp-layout-start-side>\n  }\n\n  <axp-page-content>\n    <!-- Desktop and Mobile: Always show desktop template -->\n    <ng-container *ngTemplateOutlet=\"desktop\"> </ng-container>\n  </axp-page-content>\n\n  <!-- Desktop: Grid-based browser for main content -->\n  <ng-template #desktop>\n    <div class=\"__reports-browser\">\n      @if (vm.categories().length > 0) {\n        <div class=\"__section\">\n          <h3 class=\"__section-title\">Categories</h3>\n          <div class=\"__items-grid\">\n            @for (category of vm.categories(); track category.id) {\n              <div class=\"__item __category\" (click)=\"navigateToCategory(category)\">\n                <div class=\"__item-icon\">\n                  <ax-icon class=\"fa-solid fa-folder\"></ax-icon>\n                </div>\n                <div class=\"__item-content\">\n                  <div class=\"__item-title\">{{ category.title }}</div>\n                  @if (category.description) {\n                    <div class=\"__item-description\">{{ category.description }}</div>\n                  }\n                </div>\n              </div>\n            }\n          </div>\n        </div>\n      }\n\n      @if (vm.reports().length > 0) {\n        <div class=\"__section\">\n          <h3 class=\"__section-title\">Reports</h3>\n          <div class=\"__items-grid\">\n            @for (report of vm.reports(); track report.id) {\n              <div class=\"__item __report\" (click)=\"navigateToReport(report)\">\n                <div class=\"__item-icon\">\n                  <ax-icon class=\"fa-solid fa-file-chart-column\"></ax-icon>\n                </div>\n                <div class=\"__item-content\">\n                  <div class=\"__item-title\">{{ report.title }}</div>\n                  @if (report.description) {\n                    <div class=\"__item-description\">{{ report.description }}</div>\n                  }\n                </div>\n              </div>\n            }\n          </div>\n        </div>\n      }\n\n      @if (vm.categories().length === 0 && vm.reports().length === 0) {\n        <axp-state-message\n          icon=\"fa-light fa-folder-open\"\n          [title]=\"'@report-management:no-items-found.title'\"\n          [description]=\"'@report-management:no-items-found.description'\"\n        >\n        </axp-state-message>\n      }\n    </div>\n  </ng-template>\n</axp-page-layout>\n", styles: [".axp-report-runner-root-page axp-layout-start-side{height:100%;width:20rem;border-inline-end-width:1px;background-color:rgb(var(--ax-sys-color-lightest-surface));color:rgb(var(--ax-sys-color-on-lightest-surface));border-color:rgb(var(--ax-sys-color-border-lightest-surface))}@media (min-width: 1920px){.axp-report-runner-root-page axp-layout-start-side{width:24rem}}.axp-report-runner-root-page axp-layout-start-side axp-layout-content{overflow-x:auto;padding-left:1rem;padding-right:1rem}.axp-report-runner-root-page .__reports-browser>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.axp-report-runner-root-page .__reports-browser{padding:.75rem}@media (min-width: 1024px){.axp-report-runner-root-page .__reports-browser{padding:1.5rem}}.axp-report-runner-root-page .__reports-browser .__section>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.axp-report-runner-root-page .__reports-browser .__section .__section-title{display:flex;align-items:center;gap:.5rem;font-size:1.125rem;line-height:1.75rem;font-weight:600}.axp-report-runner-root-page .__reports-browser .__section .__section-title ax-icon{--tw-text-opacity: 1;color:rgba(var(--ax-sys-color-primary-500),var(--tw-text-opacity, 1))}.axp-report-runner-root-page .__reports-browser .__section .__items-grid{display:grid;grid-template-columns:repeat(1,minmax(0,1fr));gap:1rem}@media (min-width: 768px){.axp-report-runner-root-page .__reports-browser .__section .__items-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width: 1280px){.axp-report-runner-root-page .__reports-browser .__section .__items-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width: 1536px){.axp-report-runner-root-page .__reports-browser .__section .__items-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 2560px){.axp-report-runner-root-page .__reports-browser .__section .__items-grid{grid-template-columns:repeat(5,minmax(0,1fr))}}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item{cursor:pointer;border-radius:.5rem;border-width:1px;padding:1rem;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s;background-color:rgb(var(--ax-sys-color-lightest-surface));color:rgb(var(--ax-sys-color-on-lightest-surface));border-color:rgb(var(--ax-sys-color-border-lightest-surface))}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item:is(.ax-dark *){background-color:rgb(var(--ax-sys-color-lighter-surface));color:rgb(var(--ax-sys-color-on-lighter-surface));border-color:rgb(var(--ax-sys-color-border-lighter-surface))}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item{display:flex;align-items:flex-start;gap:.75rem}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item .__item-icon{display:flex;height:2.5rem;width:2.5rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:.25rem;font-size:1.125rem;line-height:1.75rem}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item .__item-content{min-width:0px;flex:1 1 0%}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item .__item-content .__item-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item .__item-content .__item-description{margin-top:.25rem;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-size:.875rem;line-height:1.25rem;opacity:.75}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__category .__item-icon{background-color:rgba(var(--ax-sys-color-warning-500),.1)}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__category .__item-icon ax-icon{--tw-text-opacity: 1;color:rgba(var(--ax-sys-color-warning-500),var(--tw-text-opacity, 1))}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__category:hover{--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-warning-500),var(--tw-border-opacity, 1));background-color:rgba(var(--ax-sys-color-warning-500),.05)}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__report .__item-icon{background-color:rgba(var(--ax-sys-color-primary-500),.1)}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__report .__item-icon ax-icon{--tw-text-opacity: 1;color:rgba(var(--ax-sys-color-primary-500),var(--tw-text-opacity, 1))}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__report:hover{--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-primary-500),var(--tw-border-opacity, 1));background-color:rgba(var(--ax-sys-color-primary-500),.05)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type: 
                //
                AXSearchBoxModule }, { kind: "component", type: i3$1.AXSearchBoxComponent, selector: "ax-search-box", inputs: ["disabled", "readonly", "tabIndex", "placeholder", "value", "state", "name", "id", "look", "class", "delayTime", "type"], outputs: ["valueChange", "stateChange", "onValueChanged", "onBlur", "onFocus", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i3.AXDecoratorClearButtonComponent, selector: "ax-clear-button", inputs: ["icon"] }, { kind: "ngmodule", type: AXBreadcrumbsModule }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "directive", type: i1$2.AXTranslatorDirective, selector: "[translate]" }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXTabsModule }, { kind: "ngmodule", type: AXBadgeModule }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "ngmodule", type: AXDropdownButtonModule }, { kind: "component", type: 
                //
                AXPPageLayoutComponent, selector: "axp-page-layout" }, { kind: "component", type: AXPThemeLayoutBlockComponent, selector: "    axp-page-content,     axp-page-footer-container,    axp-page-footer,    axp-page-header,    axp-page-header-container,    axp-page-toolbar,    axp-layout-content,     axp-layout-page-content,     axp-layout-sections,    axp-layout-body,    axp-layout-page-body,    axp-layout-prefix,    axp-layout-suffix,    axp-layout-title-bar,    axp-layout-title,     axp-layout-title-actions,     axp-layout-nav-button,     axp-layout-description,     axp-layout-breadcrumbs,    axp-layout-list-action,    " }, { kind: "component", type: AXPThemeLayoutToolbarComponent, selector: "axp-layout-toolbar" }, { kind: "component", type: AXPThemeLayoutHeaderComponent, selector: "axp-layout-header" }, { kind: "component", type: AXPThemeLayoutStartSideComponent, selector: "axp-layout-page-start-side, axp-layout-start-side" }, { kind: "component", type: 
                //
                AXPReportCategoriesTreeComponent, selector: "axp-report-categories-tree", outputs: ["categoryClick", "reportClick"] }, { kind: "component", type: AXPStateMessageComponent, selector: "axp-state-message", inputs: ["mode", "icon", "title", "description", "variant"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMReportRunnerRootPageComponent, decorators: [{
            type: Component,
            args: [{ standalone: true, imports: [
                        CommonModule,
                        FormsModule,
                        RouterModule,
                        //
                        AXSearchBoxModule,
                        AXDecoratorModule,
                        AXBreadcrumbsModule,
                        AXTranslationModule,
                        AXButtonModule,
                        AXTabsModule,
                        AXBadgeModule,
                        AXLoadingModule,
                        AXDropdownButtonModule,
                        //
                        AXPPageLayoutComponent,
                        AXPThemeLayoutBlockComponent,
                        AXPThemeLayoutToolbarComponent,
                        AXPThemeLayoutHeaderComponent,
                        AXPThemeLayoutStartSideComponent,
                        //
                        AXPReportCategoriesTreeComponent,
                        AXPStateMessageComponent,
                    ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
                        AXUnsubscriber,
                        AXPReportRunnerRootViewModel,
                        {
                            provide: AXPPageLayoutBase,
                            useExisting: AXMReportRunnerRootPageComponent,
                        },
                    ], host: { class: 'axp-report-runner-root-page' }, template: "<axp-page-layout *translate=\"let t\">\n  @if (vm.showSideMenu()) {\n    <axp-layout-start-side>\n      <axp-layout-header>\n        <axp-layout-title>{{ t('@report-management:features.report-runner.menu-title') | async }}</axp-layout-title>\n        <axp-layout-toolbar>\n          <ax-search-box\n            [delayTime]=\"300\"\n            [ngModel]=\"vm.searchExpression()\"\n            (onValueChanged)=\"vm.search($event.value)\"\n            [placeholder]=\"t('@report-management:search.placeholder') | async\"\n          >\n            <ax-clear-button></ax-clear-button>\n          </ax-search-box>\n        </axp-layout-toolbar>\n      </axp-layout-header>\n      <axp-layout-content>\n        <axp-report-categories-tree (categoryClick)=\"onCategoryClick($event)\" (reportClick)=\"onReportClick($event)\" />\n      </axp-layout-content>\n    </axp-layout-start-side>\n  }\n\n  <axp-page-content>\n    <!-- Desktop and Mobile: Always show desktop template -->\n    <ng-container *ngTemplateOutlet=\"desktop\"> </ng-container>\n  </axp-page-content>\n\n  <!-- Desktop: Grid-based browser for main content -->\n  <ng-template #desktop>\n    <div class=\"__reports-browser\">\n      @if (vm.categories().length > 0) {\n        <div class=\"__section\">\n          <h3 class=\"__section-title\">Categories</h3>\n          <div class=\"__items-grid\">\n            @for (category of vm.categories(); track category.id) {\n              <div class=\"__item __category\" (click)=\"navigateToCategory(category)\">\n                <div class=\"__item-icon\">\n                  <ax-icon class=\"fa-solid fa-folder\"></ax-icon>\n                </div>\n                <div class=\"__item-content\">\n                  <div class=\"__item-title\">{{ category.title }}</div>\n                  @if (category.description) {\n                    <div class=\"__item-description\">{{ category.description }}</div>\n                  }\n                </div>\n              </div>\n            }\n          </div>\n        </div>\n      }\n\n      @if (vm.reports().length > 0) {\n        <div class=\"__section\">\n          <h3 class=\"__section-title\">Reports</h3>\n          <div class=\"__items-grid\">\n            @for (report of vm.reports(); track report.id) {\n              <div class=\"__item __report\" (click)=\"navigateToReport(report)\">\n                <div class=\"__item-icon\">\n                  <ax-icon class=\"fa-solid fa-file-chart-column\"></ax-icon>\n                </div>\n                <div class=\"__item-content\">\n                  <div class=\"__item-title\">{{ report.title }}</div>\n                  @if (report.description) {\n                    <div class=\"__item-description\">{{ report.description }}</div>\n                  }\n                </div>\n              </div>\n            }\n          </div>\n        </div>\n      }\n\n      @if (vm.categories().length === 0 && vm.reports().length === 0) {\n        <axp-state-message\n          icon=\"fa-light fa-folder-open\"\n          [title]=\"'@report-management:no-items-found.title'\"\n          [description]=\"'@report-management:no-items-found.description'\"\n        >\n        </axp-state-message>\n      }\n    </div>\n  </ng-template>\n</axp-page-layout>\n", styles: [".axp-report-runner-root-page axp-layout-start-side{height:100%;width:20rem;border-inline-end-width:1px;background-color:rgb(var(--ax-sys-color-lightest-surface));color:rgb(var(--ax-sys-color-on-lightest-surface));border-color:rgb(var(--ax-sys-color-border-lightest-surface))}@media (min-width: 1920px){.axp-report-runner-root-page axp-layout-start-side{width:24rem}}.axp-report-runner-root-page axp-layout-start-side axp-layout-content{overflow-x:auto;padding-left:1rem;padding-right:1rem}.axp-report-runner-root-page .__reports-browser>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.axp-report-runner-root-page .__reports-browser{padding:.75rem}@media (min-width: 1024px){.axp-report-runner-root-page .__reports-browser{padding:1.5rem}}.axp-report-runner-root-page .__reports-browser .__section>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.axp-report-runner-root-page .__reports-browser .__section .__section-title{display:flex;align-items:center;gap:.5rem;font-size:1.125rem;line-height:1.75rem;font-weight:600}.axp-report-runner-root-page .__reports-browser .__section .__section-title ax-icon{--tw-text-opacity: 1;color:rgba(var(--ax-sys-color-primary-500),var(--tw-text-opacity, 1))}.axp-report-runner-root-page .__reports-browser .__section .__items-grid{display:grid;grid-template-columns:repeat(1,minmax(0,1fr));gap:1rem}@media (min-width: 768px){.axp-report-runner-root-page .__reports-browser .__section .__items-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width: 1280px){.axp-report-runner-root-page .__reports-browser .__section .__items-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width: 1536px){.axp-report-runner-root-page .__reports-browser .__section .__items-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 2560px){.axp-report-runner-root-page .__reports-browser .__section .__items-grid{grid-template-columns:repeat(5,minmax(0,1fr))}}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item{cursor:pointer;border-radius:.5rem;border-width:1px;padding:1rem;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s;background-color:rgb(var(--ax-sys-color-lightest-surface));color:rgb(var(--ax-sys-color-on-lightest-surface));border-color:rgb(var(--ax-sys-color-border-lightest-surface))}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item:is(.ax-dark *){background-color:rgb(var(--ax-sys-color-lighter-surface));color:rgb(var(--ax-sys-color-on-lighter-surface));border-color:rgb(var(--ax-sys-color-border-lighter-surface))}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item{display:flex;align-items:flex-start;gap:.75rem}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item .__item-icon{display:flex;height:2.5rem;width:2.5rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:.25rem;font-size:1.125rem;line-height:1.75rem}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item .__item-content{min-width:0px;flex:1 1 0%}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item .__item-content .__item-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item .__item-content .__item-description{margin-top:.25rem;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-size:.875rem;line-height:1.25rem;opacity:.75}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__category .__item-icon{background-color:rgba(var(--ax-sys-color-warning-500),.1)}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__category .__item-icon ax-icon{--tw-text-opacity: 1;color:rgba(var(--ax-sys-color-warning-500),var(--tw-text-opacity, 1))}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__category:hover{--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-warning-500),var(--tw-border-opacity, 1));background-color:rgba(var(--ax-sys-color-warning-500),.05)}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__report .__item-icon{background-color:rgba(var(--ax-sys-color-primary-500),.1)}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__report .__item-icon ax-icon{--tw-text-opacity: 1;color:rgba(var(--ax-sys-color-primary-500),var(--tw-text-opacity, 1))}.axp-report-runner-root-page .__reports-browser .__section .__items-grid .__item.__report:hover{--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-primary-500),var(--tw-border-opacity, 1));background-color:rgba(var(--ax-sys-color-primary-500),.05)}\n"] }]
        }] });

export { AXMReportRunnerRootPageComponent };
//# sourceMappingURL=acorex-modules-report-management-report-runner-root-page.component-DgIAlRUA.mjs.map
