import { NXClickEvent, NXComponent, AXComponent, NXEvent } from '@acorex/cdk/common';
import { AXDecoratorGenericComponent, AXDecoratorIconComponent } from '@acorex/components/decorators';
import { isBrowser } from '@acorex/core/platform';
import { AXUnsubscriber, AXHtmlUtil } from '@acorex/core/utils';
import { AXZIndexService } from '@acorex/core/z-index';
import { isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
import * as i0 from '@angular/core';
import { Injectable, signal, inject, Renderer2, computed, output, input, afterNextRender, HostBinding, HostListener, ChangeDetectionStrategy, ViewEncapsulation, Component, DOCUMENT, PLATFORM_ID, NgModule } from '@angular/core';
import { cloneDeep } from 'lodash-es';
import { Subject } from 'rxjs';

class AXMenuService {
    constructor() {
        this.closeAll$ = new Subject();
        this.open$ = new Subject();
        this.close$ = new Subject();
        this.closeExcept$ = new Subject();
        this.openContextMenu$ = new Subject();
        this.closeAllContextMenu$ = new Subject();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXMenuService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXMenuService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXMenuService, decorators: [{
            type: Injectable
        }] });

class AXRootMenu {
}
class AXMenuItemComponentBase {
}
class AXMenuItem {
}
class AXMenuItemClickBaseEvent extends NXClickEvent {
    constructor() {
        super(...arguments);
        this.canceled = false;
    }
}

/**
 * Represents a menu item component used within an `ax-menu`.
 * @category Components
 */
class AXMenuItemComponent extends NXComponent {
    constructor() {
        super();
        this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
        this.hasSubItems = signal(false, ...(ngDevMode ? [{ debugName: "hasSubItems" }] : []));
        this.isFirstLevel = signal(false, ...(ngDevMode ? [{ debugName: "isFirstLevel" }] : []));
        this.root = inject(AXRootMenu);
        this.isRoot = () => this.parent == null;
        this.service = inject(AXMenuService);
        this.scrollableParents = [];
        this.unsuscriber = inject(AXUnsubscriber);
        this.renderer = inject(Renderer2);
        this.zIndexService = inject(AXZIndexService);
        this.zToken = null;
        this.arrowIcon = computed(() => {
            const isRtl = AXHtmlUtil.isRtl(this.nativeElement);
            return this.root.orientation() == 'horizontal' && this.isFirstLevel()
                ? 'ax-icon-chevron-down'
                : isRtl
                    ? 'ax-icon-chevron-left'
                    : 'ax-icon-chevron-right';
        }, ...(ngDevMode ? [{ debugName: "arrowIcon" }] : []));
        this.onClick = output();
        this.name = input(...(ngDevMode ? [undefined, { debugName: "name" }] : []));
        this.data = input(...(ngDevMode ? [undefined, { debugName: "data" }] : []));
        this.disabled = input(...(ngDevMode ? [undefined, { debugName: "disabled" }] : []));
        this.color = input(...(ngDevMode ? [undefined, { debugName: "color" }] : []));
        //
        afterNextRender(() => {
            this.detectSubItems();
            this.observeMutations();
            this.bindScrollEvents();
        });
        //
        this.service.closeAll$.pipe(this.unsuscriber.takeUntilDestroy).subscribe(() => this.close());
        this.service.open$.pipe(this.unsuscriber.takeUntilDestroy).subscribe((item) => {
            if (this === item) {
                this.isOpen.set(true);
                this.calculatePosition();
            }
        });
        //
        this.service.close$.pipe(this.unsuscriber.takeUntilDestroy).subscribe((item) => {
            if (this == item) {
                this.isOpen.set(false);
            }
        });
        //
        this.service.closeExcept$.pipe(this.unsuscriber.takeUntilDestroy).subscribe((item) => {
            this.closeExcept(item);
        });
    }
    closeExcept(item) {
        const list = [item];
        // TODO: Check for better solution
        const parentEl = this.nativeElement.parentElement?.parentElement;
        this.parent = parentEl?.tagName == 'AX-MENU-ITEM' ? parentEl?.['__axContext__'] : null;
        //
        let parent = item.parent;
        while (parent != null) {
            list.push(parent);
            parent = parent.parent;
        }
        //
        if (!list.includes(this)) {
            this.close();
        }
    }
    observeMutations() {
        this.mutationObserver = new MutationObserver(() => {
            this.detectSubItems();
        });
        // Start observing changes in child elements
        this.mutationObserver.observe(this.nativeElement, {
            childList: true,
            subtree: true,
        });
    }
    getText() {
        return this.nativeElement.querySelector('ax-text')?.innerText;
    }
    /**
     * Manually detect all `ax-menu-item` elements and check if this menu item has sub-items.
     */
    detectSubItems() {
        //
        const parentEl = this.nativeElement.parentElement?.parentElement;
        this.parent = parentEl?.tagName == 'AX-MENU-ITEM' ? parentEl?.['__axContext__'] : null;
        //
        const tag = this.nativeElement.parentElement?.tagName;
        this.isFirstLevel.set(tag == 'AX-MENU' || tag == 'AX-CONTEXT-MENU');
        const subItems = this.nativeElement.querySelectorAll('ax-menu-item');
        if (subItems.length > 0) {
            this.hasSubItems.set(true);
        }
        else {
            this.hasSubItems.set(false);
        }
    }
    /**
     * Opens the submenu of this menu item if it has sub-items and is not disabled.
     *
     * Inherited behavior: Uses the injected service to notify other items to close.
     *
     * @returns void - No return value. Triggers submenu opening side-effects.
     */
    open() {
        this.service.closeExcept$.next(this);
        if (!this.disabled() && this.hasSubItems()) {
            // Acquire z-index token for this submenu
            if (!this.zToken) {
                this.zToken = this.zIndexService.acquire();
            }
            this.service.open$.next(this);
        }
    }
    /**
     * Closes the submenu of this menu item if open.
     *
     * @returns void - No return value. Triggers submenu closing side-effects.
     */
    close() {
        this.service.close$.next(this);
        // Release z-index token
        this.zIndexService.release(this.zToken);
        this.zToken = null;
    }
    /**
     * Calculate the position of the submenu to avoid it going out of the viewport.
     */
    calculatePosition() {
        const submenu = this.nativeElement.querySelector('.ax-menu-items');
        if (!submenu)
            return;
        // Temporarily show the menu to measure its dimensions, but keep it invisible
        this.renderer.setStyle(submenu, 'visibility', 'hidden');
        this.renderer.setStyle(submenu, 'display', 'block');
        const submenuRect = submenu.getBoundingClientRect();
        const itemRect = this.nativeElement.getBoundingClientRect();
        const windowWidth = window.innerWidth;
        const windowHeight = window.innerHeight;
        // Reset temporary styles
        this.renderer.removeStyle(submenu, 'visibility');
        this.renderer.removeStyle(submenu, 'display');
        const isRtl = AXHtmlUtil.isRtl(this.nativeElement);
        let finalTop;
        let finalLeft;
        // --- 1. VERTICAL POSITIONING ---
        const preferredTop = this.isFirstLevel() && this.root.orientation() === 'horizontal'
            ? itemRect.bottom // For horizontal menu, open below
            : itemRect.top; // For vertical menu, align with parent top
        const alternateTop = itemRect.top - submenuRect.height; // Position for opening upwards
        if (preferredTop + submenuRect.height <= windowHeight) {
            finalTop = preferredTop;
        }
        else if (this.isFirstLevel() && this.root.orientation() === 'horizontal' && alternateTop >= 0) {
            finalTop = alternateTop;
        }
        else {
            finalTop = windowHeight - submenuRect.height;
        }
        if (finalTop < 0) {
            finalTop = 0;
        }
        // --- 2. HORIZONTAL POSITIONING ---
        if (this.isFirstLevel() && this.root.orientation() === 'horizontal') {
            const preferredLeft = isRtl ? itemRect.right - submenuRect.width : itemRect.left;
            const alternateLeft = isRtl ? itemRect.left : itemRect.right - submenuRect.width;
            if (preferredLeft >= 0 && preferredLeft + submenuRect.width <= windowWidth) {
                finalLeft = preferredLeft;
            }
            else {
                finalLeft = Math.max(0, Math.min(alternateLeft, windowWidth - submenuRect.width));
            }
        }
        else {
            const preferredLeftRtl = itemRect.left - submenuRect.width;
            const alternateLeftRtl = itemRect.right;
            const preferredLeftLtr = itemRect.right;
            const alternateLeftLtr = itemRect.left - submenuRect.width;
            if (isRtl) {
                if (preferredLeftRtl >= 0) {
                    finalLeft = preferredLeftRtl;
                }
                else if (alternateLeftRtl + submenuRect.width <= windowWidth) {
                    finalLeft = alternateLeftRtl;
                }
                else {
                    finalLeft = 0;
                }
            }
            else {
                if (preferredLeftLtr + submenuRect.width <= windowWidth) {
                    finalLeft = preferredLeftLtr;
                }
                else if (alternateLeftLtr >= 0) {
                    finalLeft = alternateLeftLtr;
                }
                else {
                    finalLeft = windowWidth - submenuRect.width;
                }
            }
        }
        // --- 3. NEW: OVERLAP-AWARE VERTICAL SHIFT ---
        const isNestedMenu = !(this.isFirstLevel() && this.root.orientation() === 'horizontal');
        if (isNestedMenu) {
            const overlapsParent = finalLeft < itemRect.right && itemRect.left < finalLeft + submenuRect.width;
            if (overlapsParent) {
                const shiftedTop = itemRect.bottom;
                if (shiftedTop + submenuRect.height <= windowHeight) {
                    finalTop = shiftedTop;
                }
            }
        }
        // --- 4. APPLY FINAL STYLES ---
        this.renderer.setStyle(submenu, 'position', 'fixed');
        this.renderer.setStyle(submenu, 'top', `${finalTop}px`);
        this.renderer.setStyle(submenu, 'left', `${finalLeft}px`);
        // Apply z-index from token
        if (this.zToken) {
            this.renderer.setStyle(submenu, 'z-index', String(this.zToken.zIndex));
        }
    }
    handleClick(e) {
        e.stopPropagation();
        if (this.disabled())
            return;
        //
        const event = {
            sender: this,
            nativeEvent: e,
            canceled: false,
            item: {
                name: this.name(),
                text: this.getText(),
                data: this.data(),
            },
        };
        //
        this.onClick.emit(event);
        this.root.onItemClick.emit({ ...event, ...{ sender: this.root } });
        //
        if (this.hasSubItems() && !event.canceled) {
            this.open();
        }
        else if (!event.canceled) {
            this.service.closeAll$.next();
            this.service.closeAllContextMenu$.next({ sender: this.root });
        }
    }
    handleMouseEnter(event) {
        event.stopPropagation();
        // Cancel the close delay if the mouse re-enters the element
        if (this.mouseLeaveTimeout) {
            clearTimeout(this.mouseLeaveTimeout);
            this.mouseLeaveTimeout = null; // Reset the timeout
        }
        if (!this.isFirstLevel() || this.root.openOn() == 'hover') {
            this.open();
        }
    }
    handleMouseLeave(event) {
        event.stopPropagation();
        if (this.hasSubItems() && this.root.closeOn() === 'leave') {
            // Clear any previous timeout to avoid multiple triggers
            if (this.mouseLeaveTimeout) {
                clearTimeout(this.mouseLeaveTimeout);
            }
            // Set a delay before closing the submenu
            this.mouseLeaveTimeout = setTimeout(() => {
                this.close();
            }, 500); // Adjust the delay (500ms in this case) as per your requirement
        }
    }
    onWindowEvent() {
        this.service.closeAll$.next(); // Close all menus on scroll or resize
    }
    /**
     * Close all menus if clicking outside the root menu and all sub-items.
     */
    onClickOutside(event) {
        const hostElement = this.root.nativeElement;
        if (!hostElement.contains(event.target)) {
            this.service.closeAll$.next(); // Close all menus if click is outside the root and sub-items
        }
    }
    ngOnDestroy() {
        this.removeScrollEvents();
    }
    bindScrollEvents() {
        this.scrollableParents = AXHtmlUtil.getScrollableParents(this.nativeElement);
        this.scrollableParents.forEach((parent) => {
            parent.addEventListener('scroll', this.onContainerScroll.bind(this));
        });
    }
    // Remove scroll event listeners
    removeScrollEvents() {
        this.scrollableParents.forEach((parent) => {
            parent.removeEventListener('scroll', this.onContainerScroll.bind(this));
        });
    }
    /**
     * Handler for scroll events (window or scrollable parent containers)
     */
    onContainerScroll() {
        this.service.closeAll$.next(); // Close all menus on scroll
    }
    /** @ignore */
    get __hostClass() {
        const list = ['ax-action-item'];
        if (this.disabled()) {
            list.push('ax-state-disabled');
        }
        list.push(`ax-${this.color() ?? 'default'}`);
        return list;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXMenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: AXMenuItemComponent, isStandalone: true, selector: "ax-menu-item", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onClick: "onClick" }, host: { listeners: { "click": "handleClick($event)", "mouseenter": "handleMouseEnter($event)", "mouseleave": "handleMouseLeave($event)", "window:scroll": "onWindowEvent($event)", "window:resize": "onWindowEvent($event)", "document:click": "onClickOutside($event)" }, properties: { "class": "this.__hostClass" } }, providers: [
            {
                provide: AXMenuItemComponentBase,
                useExisting: AXMenuItemComponent,
            },
            AXUnsubscriber,
            {
                provide: AXComponent,
                useExisting: AXMenuItemComponent,
            },
        ], usesInheritance: true, ngImport: i0, template: "<div class=\"ax-action-item-prefix\">\n  <ng-content select=\"ax-prefix\"></ng-content>\n  <ng-content select=\"ax-text\"></ng-content>\n</div>\n<div class=\"ax-action-item-suffix\">\n  <ng-content select=\"ax-suffix\"></ng-content>\n  @if (hasSubItems() && (!isRoot() || root?.hasArrow())) {\n    <i class=\"ax-icon ax-icon-solid {{ arrowIcon() }} \"></i>\n  }\n</div>\n<div class=\"ax-menu-items ax-action-list ax-action-list-vertical\" [class.ax-state-open]=\"isOpen()\">\n  <ng-content select=\"ax-menu-item,ax-title,ax-divider,ng-container\"></ng-content>\n</div>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXMenuItemComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-menu-item', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
                        {
                            provide: AXMenuItemComponentBase,
                            useExisting: AXMenuItemComponent,
                        },
                        AXUnsubscriber,
                        {
                            provide: AXComponent,
                            useExisting: AXMenuItemComponent,
                        },
                    ], template: "<div class=\"ax-action-item-prefix\">\n  <ng-content select=\"ax-prefix\"></ng-content>\n  <ng-content select=\"ax-text\"></ng-content>\n</div>\n<div class=\"ax-action-item-suffix\">\n  <ng-content select=\"ax-suffix\"></ng-content>\n  @if (hasSubItems() && (!isRoot() || root?.hasArrow())) {\n    <i class=\"ax-icon ax-icon-solid {{ arrowIcon() }} \"></i>\n  }\n</div>\n<div class=\"ax-menu-items ax-action-list ax-action-list-vertical\" [class.ax-state-open]=\"isOpen()\">\n  <ng-content select=\"ax-menu-item,ax-title,ax-divider,ng-container\"></ng-content>\n</div>\n" }]
        }], ctorParameters: () => [], propDecorators: { onClick: [{ type: i0.Output, args: ["onClick"] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], handleClick: [{
                type: HostListener,
                args: ['click', ['$event']]
            }], handleMouseEnter: [{
                type: HostListener,
                args: ['mouseenter', ['$event']]
            }], handleMouseLeave: [{
                type: HostListener,
                args: ['mouseleave', ['$event']]
            }], onWindowEvent: [{
                type: HostListener,
                args: ['window:scroll', ['$event']]
            }, {
                type: HostListener,
                args: ['window:resize', ['$event']]
            }], onClickOutside: [{
                type: HostListener,
                args: ['document:click', ['$event']]
            }], __hostClass: [{
                type: HostBinding,
                args: ['class']
            }] } });

class AXContextMenuOpeningEvent extends NXEvent {
    constructor() {
        super(...arguments);
        this.canceled = false;
    }
}
/**
 * Represents a menu component that displays context menu.
 * @category Components
 */
class AXContextMenuComponent extends NXComponent {
    // Constructor (Dependency Injection)
    /** @ignore */
    constructor() {
        super();
        // Inputs and Outputs
        this.orientation = input('vertical', ...(ngDevMode ? [{ debugName: "orientation" }] : []));
        this.openOn = input('hover', ...(ngDevMode ? [{ debugName: "openOn" }] : []));
        this.closeOn = input('click', ...(ngDevMode ? [{ debugName: "closeOn" }] : []));
        this.originalItems = input([], ...(ngDevMode ? [{ debugName: "originalItems", alias: 'items' }] : [{ alias: 'items' }]));
        this.target = input(...(ngDevMode ? [undefined, { debugName: "target" }] : []));
        this.onItemClick = output();
        this.onOpening = output();
        this.hasArrow = signal(true, ...(ngDevMode ? [{ debugName: "hasArrow" }] : []));
        // Injected Services
        this.service = inject(AXMenuService);
        this.renderer = inject(Renderer2);
        this.document = inject(DOCUMENT);
        this.platformID = inject(PLATFORM_ID);
        this.zIndexService = inject(AXZIndexService);
        this.zToken = null;
        this.originalNextSibling = null;
        this.originalParent = null;
        this.items = signal([], ...(ngDevMode ? [{ debugName: "items" }] : []));
        //
        afterNextRender(() => {
            this.bindContextEvent();
        });
        this.service.closeAllContextMenu$.subscribe(() => {
            this.service.closeAll$.next();
            this.close();
        });
        this.service.openContextMenu$.subscribe((e) => {
            if (e.sender == this) {
                this.internalShowAt(e.point);
            }
        });
    }
    // Lifecycle Hooks
    ngOnDestroy() {
        if (isBrowser()) {
            this.removeContextEvent();
        }
    }
    /**
     * Refreshes the context menu by rebinding event listeners to target elements.
     */
    refresh() {
        this.bindContextEvent();
    }
    /**
     * Shows the context menu at a specific point.
     * @param point - The coordinates where the menu should appear
     * @param targetElement - Optional target element for the context menu
     * @param event - Optional opening event with menu items
     */
    showAt(point, targetElement, event) {
        const sender = this;
        this.service.closeAllContextMenu$.next({ sender });
        this.service.openContextMenu$.next({ sender, point });
        if (isPlatformBrowser(this.platformID)) {
            if (!targetElement) {
                targetElement = this.document.elementFromPoint(point.x, point.y);
            }
            if (!event) {
                event = {
                    sender: this,
                    canceled: false,
                    targetElement: targetElement,
                    items: cloneDeep(this.originalItems()),
                };
                if (event.canceled)
                    return;
            }
            this.onOpening.emit(event);
            this.items.set(event.items);
        }
    }
    /**
     * Closes the context menu and removes the backdrop.
     */
    close() {
        this.nativeElement.classList.remove('ax-state-open');
        this.removeBackdrop();
        // Release z-index token
        this.zIndexService.release(this.zToken);
        this.zToken = null;
    }
    // Private Methods (Internal Logic)
    /** @ignore */
    getTargetElements() {
        if (isPlatformBrowser(this.platformID)) {
            const elements = typeof this.target() == 'string'
                ? Array.from(this.document.querySelectorAll(this.target()))
                : Array.isArray(this.target())
                    ? this.target()
                    : [this.target()];
            return elements;
        }
        return null;
    }
    /** @ignore */
    bindContextEvent() {
        this.getTargetElements().forEach((e) => {
            e?.addEventListener('contextmenu', this.handleContextMenu.bind(this));
        });
    }
    /** @ignore */
    removeContextEvent() {
        this.getTargetElements().forEach((e) => {
            e?.removeEventListener('contextmenu', this.handleContextMenu.bind(this));
        });
    }
    /** @ignore */
    handleContextMenu(e) {
        e.preventDefault();
        e.stopPropagation();
        //
        if (isPlatformBrowser(this.platformID)) {
            const elementsUnderMouse = this.document.elementsFromPoint(e.x, e.y);
            const targetElements = this.getTargetElements();
            const targetElement = elementsUnderMouse.find((target) => targetElements.includes(target));
            //
            const event = {
                sender: this,
                canceled: false,
                targetElement: targetElement,
                items: cloneDeep(this.originalItems()),
            };
            //
            if (!event.canceled) {
                this.showAt({ x: e.clientX, y: e.clientY }, targetElement, event);
            }
        }
    }
    /** @ignore */
    internalShowAt(point) {
        const elementRef = this.nativeElement;
        elementRef.classList.add('ax-state-open');
        const itemRect = elementRef.getBoundingClientRect();
        const windowWidth = window.innerWidth;
        const windowHeight = window.innerHeight;
        // Detect RTL (Right-To-Left) mode
        const isRtl = AXHtmlUtil.isRtl(elementRef);
        let left;
        if (isRtl) {
            left = point.x - itemRect.width;
            if (left < 0) {
                left = point.x;
            }
        }
        else {
            left = point.x;
            if (left + itemRect.width > windowWidth) {
                left = point.x - itemRect.width;
            }
        }
        const bottom = point.y + itemRect.height;
        let top;
        if (bottom > windowHeight) {
            top = point.y - itemRect.height;
            if (top < 0) {
                top = 0;
            }
        }
        else {
            top = point.y;
        }
        this.renderer.setStyle(elementRef, 'left', `${left}px`);
        this.renderer.setStyle(elementRef, 'top', `${top}px`);
        this.renderer.setStyle(elementRef, 'position', 'fixed');
        this.createBackdrop();
    }
    /** @ignore */
    createBackdrop() {
        if (!this.originalParent) {
            this.originalParent = this.nativeElement.parentElement;
            this.originalNextSibling = this.nativeElement.nextSibling;
        }
        // Acquire z-index token
        this.zToken = this.zIndexService.acquire();
        this.backdropElement = this.renderer.createElement('div');
        this.renderer.setStyle(this.backdropElement, 'position', 'fixed');
        this.renderer.setStyle(this.backdropElement, 'top', '0');
        this.renderer.setStyle(this.backdropElement, 'left', '0');
        this.renderer.setStyle(this.backdropElement, 'width', '100%');
        this.renderer.setStyle(this.backdropElement, 'height', '100%');
        this.renderer.setStyle(this.backdropElement, 'z-index', String(this.zToken.zIndex));
        this.renderer.setStyle(this.backdropElement, 'background', 'transparent');
        this.createEventListeners(this.backdropElement);
        this.document.body.appendChild(this.backdropElement);
        this.backdropElement.appendChild(this.nativeElement);
    }
    /** @ignore */
    removeBackdrop() {
        if (this.backdropElement) {
            if (this.originalParent) {
                this.renderer.insertBefore(this.originalParent, this.nativeElement, this.originalNextSibling);
            }
            if (this.backdropElement.parentNode) {
                this.renderer.removeChild(this.backdropElement.parentNode, this.backdropElement);
            }
            this.backdropElement = null;
        }
    }
    createEventListeners(el) {
        const l1 = this.renderer.listen(el, 'click', () => {
            this.close();
            l1();
        });
        const l2 = this.renderer.listen(el, 'wheel', () => {
            this.close();
            l2();
        });
        const l3 = this.renderer.listen(el, 'contextmenu', (e) => {
            this.close();
            // Get all elements under the mouse pointer
            if (isPlatformBrowser(this.platformID)) {
                const elementsUnderMouse = this.document.elementsFromPoint(e.x, e.y);
                const targetElements = this.getTargetElements();
                if (targetElements.some((target) => elementsUnderMouse.includes(target))) {
                    e.preventDefault();
                    setTimeout(() => {
                        //this.internalShowAt({ x: e.x, y: e.y });
                        this.handleContextMenu(e);
                    });
                }
            }
            l3();
        });
    }
    // Host Listeners (UI Interaction Handling)
    /** @ignore */
    onWindowEvent() {
        const sender = this;
        this.service.closeAllContextMenu$.next({ sender: sender }); // Close all menus on scroll or resize
    }
    /** @ignore */
    get __hostClass() {
        return ['ax-menu-container', `ax-orientation-${this.orientation()}`, 'ax-action-list', 'ax-action-list-vertical'];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXContextMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: AXContextMenuComponent, isStandalone: true, selector: "ax-context-menu", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, openOn: { classPropertyName: "openOn", publicName: "openOn", isSignal: true, isRequired: false, transformFunction: null }, closeOn: { classPropertyName: "closeOn", publicName: "closeOn", isSignal: true, isRequired: false, transformFunction: null }, originalItems: { classPropertyName: "originalItems", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onItemClick: "onItemClick", onOpening: "onOpening" }, host: { listeners: { "window:scroll": "onWindowEvent($event)", "window:resize": "onWindowEvent($event)" }, properties: { "class": "this.__hostClass" } }, providers: [
            AXMenuService,
            {
                provide: AXRootMenu,
                useExisting: AXContextMenuComponent,
            },
            {
                provide: AXComponent,
                useExisting: AXContextMenuComponent,
            },
        ], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"ax-menu-item,ax-divider,ax-title,ng-container\"></ng-content>\n\n@for (node of items(); track node) {\n  <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: node }\"> </ng-container>\n}\n\n<ng-template #Recursion let-item>\n  @if (item.group?.title) {\n    <ax-title>{{ item.group?.title }}</ax-title>\n  }\n  <ax-menu-item [name]=\"item.name\" [data]=\"item.data\" [disabled]=\"item.disabled\" [color]=\"item.color\">\n    @if (item.icon) {\n      <ax-prefix>\n        <ax-icon [icon]=\"item.icon\"> </ax-icon>\n      </ax-prefix>\n    }\n    @if (item.text) {\n      <ax-text>{{ item.text }}</ax-text>\n    }\n    @if (item.suffix) {\n      <ax-suffix>\n        <ax-text>{{ item.suffix.text }}</ax-text>\n      </ax-suffix>\n    }\n    @for (child of item.items; track child) {\n      <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: child }\"></ng-container>\n    }\n  </ax-menu-item>\n  @if (item.break) {\n    <ax-divider></ax-divider>\n  }\n</ng-template>\n", styles: ["ax-context-menu,ax-menu{--ax-comp-menu-items-min-width: 12rem;--ax-comp-menu-action-list-hover-decorator-opacity: .7;--ax-comp-menu-action-list-horizontal-min-width: 12rem;--ax-comp-menu-action-list-horizontal-gap: 1.25rem;--ax-comp-menu-action-list-vertical-min-width: 12rem}ax-context-menu ax-menu-item.ax-primary,ax-menu ax-menu-item.ax-primary{--ax-comp-menu-item-text-color: var(--ax-sys-color-primary-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-primary-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-primary-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-primary-surface)}ax-context-menu ax-menu-item.ax-secondary,ax-menu ax-menu-item.ax-secondary{--ax-comp-menu-item-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-secondary-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-secondary-surface)}ax-context-menu ax-menu-item.ax-success,ax-menu ax-menu-item.ax-success{--ax-comp-menu-item-text-color: var(--ax-sys-color-success-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-success-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-success-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-success-surface)}ax-context-menu ax-menu-item.ax-warning,ax-menu ax-menu-item.ax-warning{--ax-comp-menu-item-text-color: var(--ax-sys-color-warning-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-warning-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-warning-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-warning-surface)}ax-context-menu ax-menu-item.ax-danger,ax-menu ax-menu-item.ax-danger{--ax-comp-menu-item-text-color: var(--ax-sys-color-danger-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-danger-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-danger-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-danger-surface)}ax-context-menu ax-menu-item.ax-accent1,ax-menu ax-menu-item.ax-accent1{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent1-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent1-surface)}ax-context-menu ax-menu-item.ax-accent2,ax-menu ax-menu-item.ax-accent2{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent2-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent2-surface)}ax-context-menu ax-menu-item.ax-accent3,ax-menu ax-menu-item.ax-accent3{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent3-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent3-surface)}ax-context-menu ax-menu-item.ax-accent4,ax-menu ax-menu-item.ax-accent4{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent4-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent4-surface)}ax-context-menu ax-menu-item.ax-accent5,ax-menu ax-menu-item.ax-accent5{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent5-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent5-surface)}ax-context-menu ax-menu-item.ax-accent6,ax-menu ax-menu-item.ax-accent6{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent6-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent6-surface)}ax-context-menu ax-menu-item.ax-accent7,ax-menu ax-menu-item.ax-accent7{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent7-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent7-surface)}ax-context-menu,ax-menu{width:100%;color:inherit;display:flex;width:max-content}ax-context-menu.ax-menu-container,ax-context-menu .ax-menu-items,ax-menu.ax-menu-container,ax-menu .ax-menu-items{--ax-comp-action-item-padding-inline: .875rem;opacity:0;display:flex;position:fixed;visibility:hidden;width:max-content;height:max-content;flex-direction:column;min-width:var(--ax-comp-menu-items-min-width);color:rgba(var(--ax-comp-menu-items-text-color, var(--ax-sys-color-on-lightest-surface)));background-color:rgba(var(--ax-comp-menu-sub-item-bg-color, var(--ax-sys-color-lightest-surface)));padding-block:var(--ax-comp-menu-items-padding-block, .5rem);border-width:var(--ax-comp-menu-items-border-width, 1px);border-radius:var(--ax-comp-menu-items-border-radius, var(--ax-sys-border-radius));border-color:rgba(var(--ax-comp-menu-items-border-color, var(--ax-sys-color-border-lightest-surface)));--ax-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ax-shadow-colored: 0 4px 6px -1px var(--ax-shadow-color), 0 2px 4px -2px var(--ax-shadow-color);box-shadow:var(--ax-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-shadow);transition-property:opacity,color;transition-duration:var(--ax-sys-transition-duration);transition-timing-function:var(--ax-sys-transition-timing-function)}ax-context-menu.ax-menu-container.ax-state-open,ax-context-menu .ax-menu-items.ax-state-open,ax-menu.ax-menu-container.ax-state-open,ax-menu .ax-menu-items.ax-state-open{opacity:1;visibility:visible}ax-context-menu.ax-menu-container ax-menu-item,ax-context-menu .ax-menu-items ax-menu-item,ax-menu.ax-menu-container ax-menu-item,ax-menu .ax-menu-items ax-menu-item{color:rgba(var(--ax-comp-menu-item-text-color, var(--ax-sys-color-on-surface)))}ax-context-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item ax-suffix ax-text{color:rgba(var(--ax-comp-menu-item-suffix-text-color))}ax-context-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled),ax-context-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled),ax-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled),ax-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled){color:rgba(var(--ax-comp-menu-item-hover-text-color, var(--ax-sys-color-on-surface)));background-color:rgba(var(--ax-comp-menu-item-hover-bg-color, var(--ax-sys-color-surface)))!important}ax-context-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text{color:rgba(var(--ax-comp-menu-item-hover-suffix-text-color))}ax-context-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item ax-suffix ax-text{font-weight:400!important}ax-context-menu.ax-action-list-horizontal{padding-inline:var(--ax-comp-menu-action-list-horizontal-padding-inline, 1rem)}ax-menu>ax-menu-item{--ax-comp-action-item-padding-inline: 0}ax-menu>ax-menu-item:has(>.ax-action-item-suffix:not(:empty)){gap:.5rem}ax-menu.ax-action-list-horizontal{min-width:var(--ax-comp-menu-action-list-horizontal-min-width);gap:var(--ax-comp-menu-action-list-horizontal-gap)}ax-menu.ax-action-list-horizontal>ax-title{display:none}ax-menu.ax-action-list-horizontal>ax-menu-item{font-weight:500}ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-prefix{padding-inline-start:0!important}ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-suffix:not(ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-suffix:empty){padding-inline-end:0!important;margin-inline-start:0!important}ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled){background-color:transparent!important}ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-prefix,ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-suffix{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}ax-menu.ax-action-list-vertical{width:max-content;min-width:var(--ax-comp-menu-action-list-vertical-min-width)}ax-menu.ax-action-list-vertical>ax-menu-item{font-weight:500}ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled){background-color:transparent!important}ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-prefix,ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-suffix{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}ax-menu>ax-menu-item{padding-block:var(--ax-comp-menu-items-padding-block, .5rem)}ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled){border-radius:var(--ax-comp-menu-items-border-radius, var(--ax-sys-border-radius))}ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled)>ax-icon,ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled)>ax-text{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: 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: "component", type: AXMenuItemComponent, selector: "ax-menu-item", inputs: ["name", "data", "disabled", "color"], outputs: ["onClick"] }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXContextMenuComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-context-menu', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
                        AXMenuService,
                        {
                            provide: AXRootMenu,
                            useExisting: AXContextMenuComponent,
                        },
                        {
                            provide: AXComponent,
                            useExisting: AXContextMenuComponent,
                        },
                    ], imports: [NgTemplateOutlet, AXDecoratorGenericComponent, AXMenuItemComponent, AXDecoratorIconComponent], template: "<ng-content select=\"ax-menu-item,ax-divider,ax-title,ng-container\"></ng-content>\n\n@for (node of items(); track node) {\n  <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: node }\"> </ng-container>\n}\n\n<ng-template #Recursion let-item>\n  @if (item.group?.title) {\n    <ax-title>{{ item.group?.title }}</ax-title>\n  }\n  <ax-menu-item [name]=\"item.name\" [data]=\"item.data\" [disabled]=\"item.disabled\" [color]=\"item.color\">\n    @if (item.icon) {\n      <ax-prefix>\n        <ax-icon [icon]=\"item.icon\"> </ax-icon>\n      </ax-prefix>\n    }\n    @if (item.text) {\n      <ax-text>{{ item.text }}</ax-text>\n    }\n    @if (item.suffix) {\n      <ax-suffix>\n        <ax-text>{{ item.suffix.text }}</ax-text>\n      </ax-suffix>\n    }\n    @for (child of item.items; track child) {\n      <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: child }\"></ng-container>\n    }\n  </ax-menu-item>\n  @if (item.break) {\n    <ax-divider></ax-divider>\n  }\n</ng-template>\n", styles: ["ax-context-menu,ax-menu{--ax-comp-menu-items-min-width: 12rem;--ax-comp-menu-action-list-hover-decorator-opacity: .7;--ax-comp-menu-action-list-horizontal-min-width: 12rem;--ax-comp-menu-action-list-horizontal-gap: 1.25rem;--ax-comp-menu-action-list-vertical-min-width: 12rem}ax-context-menu ax-menu-item.ax-primary,ax-menu ax-menu-item.ax-primary{--ax-comp-menu-item-text-color: var(--ax-sys-color-primary-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-primary-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-primary-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-primary-surface)}ax-context-menu ax-menu-item.ax-secondary,ax-menu ax-menu-item.ax-secondary{--ax-comp-menu-item-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-secondary-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-secondary-surface)}ax-context-menu ax-menu-item.ax-success,ax-menu ax-menu-item.ax-success{--ax-comp-menu-item-text-color: var(--ax-sys-color-success-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-success-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-success-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-success-surface)}ax-context-menu ax-menu-item.ax-warning,ax-menu ax-menu-item.ax-warning{--ax-comp-menu-item-text-color: var(--ax-sys-color-warning-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-warning-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-warning-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-warning-surface)}ax-context-menu ax-menu-item.ax-danger,ax-menu ax-menu-item.ax-danger{--ax-comp-menu-item-text-color: var(--ax-sys-color-danger-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-danger-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-danger-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-danger-surface)}ax-context-menu ax-menu-item.ax-accent1,ax-menu ax-menu-item.ax-accent1{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent1-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent1-surface)}ax-context-menu ax-menu-item.ax-accent2,ax-menu ax-menu-item.ax-accent2{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent2-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent2-surface)}ax-context-menu ax-menu-item.ax-accent3,ax-menu ax-menu-item.ax-accent3{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent3-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent3-surface)}ax-context-menu ax-menu-item.ax-accent4,ax-menu ax-menu-item.ax-accent4{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent4-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent4-surface)}ax-context-menu ax-menu-item.ax-accent5,ax-menu ax-menu-item.ax-accent5{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent5-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent5-surface)}ax-context-menu ax-menu-item.ax-accent6,ax-menu ax-menu-item.ax-accent6{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent6-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent6-surface)}ax-context-menu ax-menu-item.ax-accent7,ax-menu ax-menu-item.ax-accent7{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent7-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent7-surface)}ax-context-menu,ax-menu{width:100%;color:inherit;display:flex;width:max-content}ax-context-menu.ax-menu-container,ax-context-menu .ax-menu-items,ax-menu.ax-menu-container,ax-menu .ax-menu-items{--ax-comp-action-item-padding-inline: .875rem;opacity:0;display:flex;position:fixed;visibility:hidden;width:max-content;height:max-content;flex-direction:column;min-width:var(--ax-comp-menu-items-min-width);color:rgba(var(--ax-comp-menu-items-text-color, var(--ax-sys-color-on-lightest-surface)));background-color:rgba(var(--ax-comp-menu-sub-item-bg-color, var(--ax-sys-color-lightest-surface)));padding-block:var(--ax-comp-menu-items-padding-block, .5rem);border-width:var(--ax-comp-menu-items-border-width, 1px);border-radius:var(--ax-comp-menu-items-border-radius, var(--ax-sys-border-radius));border-color:rgba(var(--ax-comp-menu-items-border-color, var(--ax-sys-color-border-lightest-surface)));--ax-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ax-shadow-colored: 0 4px 6px -1px var(--ax-shadow-color), 0 2px 4px -2px var(--ax-shadow-color);box-shadow:var(--ax-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-shadow);transition-property:opacity,color;transition-duration:var(--ax-sys-transition-duration);transition-timing-function:var(--ax-sys-transition-timing-function)}ax-context-menu.ax-menu-container.ax-state-open,ax-context-menu .ax-menu-items.ax-state-open,ax-menu.ax-menu-container.ax-state-open,ax-menu .ax-menu-items.ax-state-open{opacity:1;visibility:visible}ax-context-menu.ax-menu-container ax-menu-item,ax-context-menu .ax-menu-items ax-menu-item,ax-menu.ax-menu-container ax-menu-item,ax-menu .ax-menu-items ax-menu-item{color:rgba(var(--ax-comp-menu-item-text-color, var(--ax-sys-color-on-surface)))}ax-context-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item ax-suffix ax-text{color:rgba(var(--ax-comp-menu-item-suffix-text-color))}ax-context-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled),ax-context-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled),ax-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled),ax-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled){color:rgba(var(--ax-comp-menu-item-hover-text-color, var(--ax-sys-color-on-surface)));background-color:rgba(var(--ax-comp-menu-item-hover-bg-color, var(--ax-sys-color-surface)))!important}ax-context-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text{color:rgba(var(--ax-comp-menu-item-hover-suffix-text-color))}ax-context-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item ax-suffix ax-text{font-weight:400!important}ax-context-menu.ax-action-list-horizontal{padding-inline:var(--ax-comp-menu-action-list-horizontal-padding-inline, 1rem)}ax-menu>ax-menu-item{--ax-comp-action-item-padding-inline: 0}ax-menu>ax-menu-item:has(>.ax-action-item-suffix:not(:empty)){gap:.5rem}ax-menu.ax-action-list-horizontal{min-width:var(--ax-comp-menu-action-list-horizontal-min-width);gap:var(--ax-comp-menu-action-list-horizontal-gap)}ax-menu.ax-action-list-horizontal>ax-title{display:none}ax-menu.ax-action-list-horizontal>ax-menu-item{font-weight:500}ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-prefix{padding-inline-start:0!important}ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-suffix:not(ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-suffix:empty){padding-inline-end:0!important;margin-inline-start:0!important}ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled){background-color:transparent!important}ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-prefix,ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-suffix{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}ax-menu.ax-action-list-vertical{width:max-content;min-width:var(--ax-comp-menu-action-list-vertical-min-width)}ax-menu.ax-action-list-vertical>ax-menu-item{font-weight:500}ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled){background-color:transparent!important}ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-prefix,ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-suffix{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}ax-menu>ax-menu-item{padding-block:var(--ax-comp-menu-items-padding-block, .5rem)}ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled){border-radius:var(--ax-comp-menu-items-border-radius, var(--ax-sys-border-radius))}ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled)>ax-icon,ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled)>ax-text{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}\n"] }]
        }], ctorParameters: () => [], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], openOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "openOn", required: false }] }], closeOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOn", required: false }] }], originalItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }], onItemClick: [{ type: i0.Output, args: ["onItemClick"] }], onOpening: [{ type: i0.Output, args: ["onOpening"] }], onWindowEvent: [{
                type: HostListener,
                args: ['window:scroll', ['$event']]
            }, {
                type: HostListener,
                args: ['window:resize', ['$event']]
            }], __hostClass: [{
                type: HostBinding,
                args: ['class']
            }] } });

/**
 * Represents a menu component that displays menu items.
 * @category Components
 */
class AXMenuComponent extends NXComponent {
    constructor() {
        super(...arguments);
        this.orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : []));
        this.openOn = input('hover', ...(ngDevMode ? [{ debugName: "openOn" }] : []));
        this.closeOn = input('leave', ...(ngDevMode ? [{ debugName: "closeOn" }] : []));
        this.service = inject(AXMenuService);
        this.onItemClick = output();
        this.items = input([], ...(ngDevMode ? [{ debugName: "items" }] : []));
        this.hasArrow = input(true, ...(ngDevMode ? [{ debugName: "hasArrow" }] : []));
    }
    /** @ignore */
    get __hostClass() {
        return [
            'ax-root-menu',
            'ax-action-list',
            `ax-action-list-${this.orientation()}`,
            `${!this.hasArrow() ? 'ax-hide-arrow' : ''}`,
        ];
    }
    /**
     * Closes all open menus and submenus for this root menu.
     *
     * @returns void - No return value. All open menu overlays are closed and hidden.
     */
    close() {
        this.service.closeAll$.next();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXMenuComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: AXMenuComponent, isStandalone: true, selector: "ax-menu", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, openOn: { classPropertyName: "openOn", publicName: "openOn", isSignal: true, isRequired: false, transformFunction: null }, closeOn: { classPropertyName: "closeOn", publicName: "closeOn", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, hasArrow: { classPropertyName: "hasArrow", publicName: "hasArrow", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onItemClick: "onItemClick" }, host: { properties: { "class": "this.__hostClass" } }, providers: [
            AXMenuService,
            {
                provide: AXRootMenu,
                useExisting: AXMenuComponent,
            },
            {
                provide: AXComponent,
                useExisting: AXMenuComponent,
            },
        ], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"ax-menu-item,ax-divider,ax-title,ng-container\"></ng-content>\n\n@for (node of items(); track node) {\n  <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: node }\"> </ng-container>\n}\n\n<ng-template #Recursion let-item>\n  @if (item.group?.title) {\n    <ax-title>{{ item.group?.title }}</ax-title>\n  }\n  <ax-menu-item [name]=\"item.name\" [data]=\"item.data\" [disabled]=\"item.disabled\" [color]=\"item.color\">\n    @if (item.icon) {\n      <ax-prefix>\n        <ax-icon [icon]=\"item.icon\"> </ax-icon>\n      </ax-prefix>\n    }\n    @if (item.text) {\n      <ax-text>{{ item.text }}</ax-text>\n    }\n    @if (item.suffix) {\n      <ax-suffix>\n        <ax-text>{{ item.suffix.text }}</ax-text>\n      </ax-suffix>\n    }\n    @for (child of item.items; track child) {\n      <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: child }\"></ng-container>\n    }\n  </ax-menu-item>\n  @if (item.break) {\n    <ax-divider></ax-divider>\n  }\n</ng-template>\n", styles: ["ax-context-menu,ax-menu{--ax-comp-menu-items-min-width: 12rem;--ax-comp-menu-action-list-hover-decorator-opacity: .7;--ax-comp-menu-action-list-horizontal-min-width: 12rem;--ax-comp-menu-action-list-horizontal-gap: 1.25rem;--ax-comp-menu-action-list-vertical-min-width: 12rem}ax-context-menu ax-menu-item.ax-primary,ax-menu ax-menu-item.ax-primary{--ax-comp-menu-item-text-color: var(--ax-sys-color-primary-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-primary-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-primary-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-primary-surface)}ax-context-menu ax-menu-item.ax-secondary,ax-menu ax-menu-item.ax-secondary{--ax-comp-menu-item-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-secondary-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-secondary-surface)}ax-context-menu ax-menu-item.ax-success,ax-menu ax-menu-item.ax-success{--ax-comp-menu-item-text-color: var(--ax-sys-color-success-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-success-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-success-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-success-surface)}ax-context-menu ax-menu-item.ax-warning,ax-menu ax-menu-item.ax-warning{--ax-comp-menu-item-text-color: var(--ax-sys-color-warning-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-warning-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-warning-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-warning-surface)}ax-context-menu ax-menu-item.ax-danger,ax-menu ax-menu-item.ax-danger{--ax-comp-menu-item-text-color: var(--ax-sys-color-danger-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-danger-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-danger-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-danger-surface)}ax-context-menu ax-menu-item.ax-accent1,ax-menu ax-menu-item.ax-accent1{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent1-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent1-surface)}ax-context-menu ax-menu-item.ax-accent2,ax-menu ax-menu-item.ax-accent2{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent2-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent2-surface)}ax-context-menu ax-menu-item.ax-accent3,ax-menu ax-menu-item.ax-accent3{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent3-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent3-surface)}ax-context-menu ax-menu-item.ax-accent4,ax-menu ax-menu-item.ax-accent4{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent4-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent4-surface)}ax-context-menu ax-menu-item.ax-accent5,ax-menu ax-menu-item.ax-accent5{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent5-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent5-surface)}ax-context-menu ax-menu-item.ax-accent6,ax-menu ax-menu-item.ax-accent6{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent6-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent6-surface)}ax-context-menu ax-menu-item.ax-accent7,ax-menu ax-menu-item.ax-accent7{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent7-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent7-surface)}ax-context-menu,ax-menu{width:100%;color:inherit;display:flex;width:max-content}ax-context-menu.ax-menu-container,ax-context-menu .ax-menu-items,ax-menu.ax-menu-container,ax-menu .ax-menu-items{--ax-comp-action-item-padding-inline: .875rem;opacity:0;display:flex;position:fixed;visibility:hidden;width:max-content;height:max-content;flex-direction:column;min-width:var(--ax-comp-menu-items-min-width);color:rgba(var(--ax-comp-menu-items-text-color, var(--ax-sys-color-on-lightest-surface)));background-color:rgba(var(--ax-comp-menu-sub-item-bg-color, var(--ax-sys-color-lightest-surface)));padding-block:var(--ax-comp-menu-items-padding-block, .5rem);border-width:var(--ax-comp-menu-items-border-width, 1px);border-radius:var(--ax-comp-menu-items-border-radius, var(--ax-sys-border-radius));border-color:rgba(var(--ax-comp-menu-items-border-color, var(--ax-sys-color-border-lightest-surface)));--ax-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ax-shadow-colored: 0 4px 6px -1px var(--ax-shadow-color), 0 2px 4px -2px var(--ax-shadow-color);box-shadow:var(--ax-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-shadow);transition-property:opacity,color;transition-duration:var(--ax-sys-transition-duration);transition-timing-function:var(--ax-sys-transition-timing-function)}ax-context-menu.ax-menu-container.ax-state-open,ax-context-menu .ax-menu-items.ax-state-open,ax-menu.ax-menu-container.ax-state-open,ax-menu .ax-menu-items.ax-state-open{opacity:1;visibility:visible}ax-context-menu.ax-menu-container ax-menu-item,ax-context-menu .ax-menu-items ax-menu-item,ax-menu.ax-menu-container ax-menu-item,ax-menu .ax-menu-items ax-menu-item{color:rgba(var(--ax-comp-menu-item-text-color, var(--ax-sys-color-on-surface)))}ax-context-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item ax-suffix ax-text{color:rgba(var(--ax-comp-menu-item-suffix-text-color))}ax-context-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled),ax-context-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled),ax-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled),ax-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled){color:rgba(var(--ax-comp-menu-item-hover-text-color, var(--ax-sys-color-on-surface)));background-color:rgba(var(--ax-comp-menu-item-hover-bg-color, var(--ax-sys-color-surface)))!important}ax-context-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text{color:rgba(var(--ax-comp-menu-item-hover-suffix-text-color))}ax-context-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item ax-suffix ax-text{font-weight:400!important}ax-context-menu.ax-action-list-horizontal{padding-inline:var(--ax-comp-menu-action-list-horizontal-padding-inline, 1rem)}ax-menu>ax-menu-item{--ax-comp-action-item-padding-inline: 0}ax-menu>ax-menu-item:has(>.ax-action-item-suffix:not(:empty)){gap:.5rem}ax-menu.ax-action-list-horizontal{min-width:var(--ax-comp-menu-action-list-horizontal-min-width);gap:var(--ax-comp-menu-action-list-horizontal-gap)}ax-menu.ax-action-list-horizontal>ax-title{display:none}ax-menu.ax-action-list-horizontal>ax-menu-item{font-weight:500}ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-prefix{padding-inline-start:0!important}ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-suffix:not(ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-suffix:empty){padding-inline-end:0!important;margin-inline-start:0!important}ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled){background-color:transparent!important}ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-prefix,ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-suffix{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}ax-menu.ax-action-list-vertical{width:max-content;min-width:var(--ax-comp-menu-action-list-vertical-min-width)}ax-menu.ax-action-list-vertical>ax-menu-item{font-weight:500}ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled){background-color:transparent!important}ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-prefix,ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-suffix{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}ax-menu>ax-menu-item{padding-block:var(--ax-comp-menu-items-padding-block, .5rem)}ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled){border-radius:var(--ax-comp-menu-items-border-radius, var(--ax-sys-border-radius))}ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled)>ax-icon,ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled)>ax-text{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: 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: "component", type: AXMenuItemComponent, selector: "ax-menu-item", inputs: ["name", "data", "disabled", "color"], outputs: ["onClick"] }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXMenuComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-menu', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
                        AXMenuService,
                        {
                            provide: AXRootMenu,
                            useExisting: AXMenuComponent,
                        },
                        {
                            provide: AXComponent,
                            useExisting: AXMenuComponent,
                        },
                    ], imports: [NgTemplateOutlet, AXDecoratorGenericComponent, AXMenuItemComponent, AXDecoratorIconComponent], template: "<ng-content select=\"ax-menu-item,ax-divider,ax-title,ng-container\"></ng-content>\n\n@for (node of items(); track node) {\n  <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: node }\"> </ng-container>\n}\n\n<ng-template #Recursion let-item>\n  @if (item.group?.title) {\n    <ax-title>{{ item.group?.title }}</ax-title>\n  }\n  <ax-menu-item [name]=\"item.name\" [data]=\"item.data\" [disabled]=\"item.disabled\" [color]=\"item.color\">\n    @if (item.icon) {\n      <ax-prefix>\n        <ax-icon [icon]=\"item.icon\"> </ax-icon>\n      </ax-prefix>\n    }\n    @if (item.text) {\n      <ax-text>{{ item.text }}</ax-text>\n    }\n    @if (item.suffix) {\n      <ax-suffix>\n        <ax-text>{{ item.suffix.text }}</ax-text>\n      </ax-suffix>\n    }\n    @for (child of item.items; track child) {\n      <ng-container [ngTemplateOutlet]=\"Recursion\" [ngTemplateOutletContext]=\"{ $implicit: child }\"></ng-container>\n    }\n  </ax-menu-item>\n  @if (item.break) {\n    <ax-divider></ax-divider>\n  }\n</ng-template>\n", styles: ["ax-context-menu,ax-menu{--ax-comp-menu-items-min-width: 12rem;--ax-comp-menu-action-list-hover-decorator-opacity: .7;--ax-comp-menu-action-list-horizontal-min-width: 12rem;--ax-comp-menu-action-list-horizontal-gap: 1.25rem;--ax-comp-menu-action-list-vertical-min-width: 12rem}ax-context-menu ax-menu-item.ax-primary,ax-menu ax-menu-item.ax-primary{--ax-comp-menu-item-text-color: var(--ax-sys-color-primary-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-primary-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-primary-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-primary-surface)}ax-context-menu ax-menu-item.ax-secondary,ax-menu ax-menu-item.ax-secondary{--ax-comp-menu-item-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-secondary-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-secondary-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-secondary-surface)}ax-context-menu ax-menu-item.ax-success,ax-menu ax-menu-item.ax-success{--ax-comp-menu-item-text-color: var(--ax-sys-color-success-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-success-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-success-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-success-surface)}ax-context-menu ax-menu-item.ax-warning,ax-menu ax-menu-item.ax-warning{--ax-comp-menu-item-text-color: var(--ax-sys-color-warning-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-warning-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-warning-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-warning-surface)}ax-context-menu ax-menu-item.ax-danger,ax-menu ax-menu-item.ax-danger{--ax-comp-menu-item-text-color: var(--ax-sys-color-danger-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-danger-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-danger-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-danger-surface)}ax-context-menu ax-menu-item.ax-accent1,ax-menu ax-menu-item.ax-accent1{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent1-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent1-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent1-surface)}ax-context-menu ax-menu-item.ax-accent2,ax-menu ax-menu-item.ax-accent2{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent2-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent2-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent2-surface)}ax-context-menu ax-menu-item.ax-accent3,ax-menu ax-menu-item.ax-accent3{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent3-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent3-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent3-surface)}ax-context-menu ax-menu-item.ax-accent4,ax-menu ax-menu-item.ax-accent4{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent4-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent4-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent4-surface)}ax-context-menu ax-menu-item.ax-accent5,ax-menu ax-menu-item.ax-accent5{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent5-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent5-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent5-surface)}ax-context-menu ax-menu-item.ax-accent6,ax-menu ax-menu-item.ax-accent6{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent6-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent6-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent6-surface)}ax-context-menu ax-menu-item.ax-accent7,ax-menu ax-menu-item.ax-accent7{--ax-comp-menu-item-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-menu-item-hover-text-color: var(--ax-sys-color-accent7-surface);--ax-comp-menu-item-hover-bg-color: var(--ax-sys-color-accent7-surface), .1;--ax-comp-menu-item-hover-suffix-text-color: var(--ax-sys-color-accent7-surface)}ax-context-menu,ax-menu{width:100%;color:inherit;display:flex;width:max-content}ax-context-menu.ax-menu-container,ax-context-menu .ax-menu-items,ax-menu.ax-menu-container,ax-menu .ax-menu-items{--ax-comp-action-item-padding-inline: .875rem;opacity:0;display:flex;position:fixed;visibility:hidden;width:max-content;height:max-content;flex-direction:column;min-width:var(--ax-comp-menu-items-min-width);color:rgba(var(--ax-comp-menu-items-text-color, var(--ax-sys-color-on-lightest-surface)));background-color:rgba(var(--ax-comp-menu-sub-item-bg-color, var(--ax-sys-color-lightest-surface)));padding-block:var(--ax-comp-menu-items-padding-block, .5rem);border-width:var(--ax-comp-menu-items-border-width, 1px);border-radius:var(--ax-comp-menu-items-border-radius, var(--ax-sys-border-radius));border-color:rgba(var(--ax-comp-menu-items-border-color, var(--ax-sys-color-border-lightest-surface)));--ax-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ax-shadow-colored: 0 4px 6px -1px var(--ax-shadow-color), 0 2px 4px -2px var(--ax-shadow-color);box-shadow:var(--ax-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--ax-shadow);transition-property:opacity,color;transition-duration:var(--ax-sys-transition-duration);transition-timing-function:var(--ax-sys-transition-timing-function)}ax-context-menu.ax-menu-container.ax-state-open,ax-context-menu .ax-menu-items.ax-state-open,ax-menu.ax-menu-container.ax-state-open,ax-menu .ax-menu-items.ax-state-open{opacity:1;visibility:visible}ax-context-menu.ax-menu-container ax-menu-item,ax-context-menu .ax-menu-items ax-menu-item,ax-menu.ax-menu-container ax-menu-item,ax-menu .ax-menu-items ax-menu-item{color:rgba(var(--ax-comp-menu-item-text-color, var(--ax-sys-color-on-surface)))}ax-context-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item ax-suffix ax-text{color:rgba(var(--ax-comp-menu-item-suffix-text-color))}ax-context-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled),ax-context-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled),ax-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled),ax-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled){color:rgba(var(--ax-comp-menu-item-hover-text-color, var(--ax-sys-color-on-surface)));background-color:rgba(var(--ax-comp-menu-item-hover-bg-color, var(--ax-sys-color-surface)))!important}ax-context-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item:hover:not(.ax-state-disabled) ax-suffix ax-text{color:rgba(var(--ax-comp-menu-item-hover-suffix-text-color))}ax-context-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-context-menu .ax-menu-items ax-menu-item ax-suffix ax-text,ax-menu.ax-menu-container ax-menu-item ax-suffix ax-text,ax-menu .ax-menu-items ax-menu-item ax-suffix ax-text{font-weight:400!important}ax-context-menu.ax-action-list-horizontal{padding-inline:var(--ax-comp-menu-action-list-horizontal-padding-inline, 1rem)}ax-menu>ax-menu-item{--ax-comp-action-item-padding-inline: 0}ax-menu>ax-menu-item:has(>.ax-action-item-suffix:not(:empty)){gap:.5rem}ax-menu.ax-action-list-horizontal{min-width:var(--ax-comp-menu-action-list-horizontal-min-width);gap:var(--ax-comp-menu-action-list-horizontal-gap)}ax-menu.ax-action-list-horizontal>ax-title{display:none}ax-menu.ax-action-list-horizontal>ax-menu-item{font-weight:500}ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-prefix{padding-inline-start:0!important}ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-suffix:not(ax-menu.ax-action-list-horizontal>ax-menu-item>.ax-action-item-suffix:empty){padding-inline-end:0!important;margin-inline-start:0!important}ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled){background-color:transparent!important}ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-prefix,ax-menu.ax-action-list-horizontal>ax-menu-item:hover:not(ax-menu.ax-action-list-horizontal>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-suffix{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}ax-menu.ax-action-list-vertical{width:max-content;min-width:var(--ax-comp-menu-action-list-vertical-min-width)}ax-menu.ax-action-list-vertical>ax-menu-item{font-weight:500}ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled){background-color:transparent!important}ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-prefix,ax-menu.ax-action-list-vertical>ax-menu-item:hover:not(ax-menu.ax-action-list-vertical>ax-menu-item:hover.ax-state-disabled)>.ax-action-item-suffix{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}ax-menu>ax-menu-item{padding-block:var(--ax-comp-menu-items-padding-block, .5rem)}ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled){border-radius:var(--ax-comp-menu-items-border-radius, var(--ax-sys-border-radius))}ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled)>ax-icon,ax-menu>ax-menu-item:hover:not(ax-menu>ax-menu-item:hover.ax-state-disabled)>ax-text{opacity:var(--ax-comp-menu-action-list-hover-decorator-opacity)}\n"] }]
        }], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], openOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "openOn", required: false }] }], closeOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOn", required: false }] }], onItemClick: [{ type: i0.Output, args: ["onItemClick"] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], hasArrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasArrow", required: false }] }], __hostClass: [{
                type: HostBinding,
                args: ['class']
            }] } });

class AXMenuModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.15", ngImport: i0, type: AXMenuModule, imports: [AXMenuItemComponent, AXMenuComponent, AXContextMenuComponent], exports: [AXMenuItemComponent, AXMenuComponent, AXContextMenuComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXMenuModule, imports: [AXMenuComponent, AXContextMenuComponent] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXMenuModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [AXMenuItemComponent, AXMenuComponent, AXContextMenuComponent],
                    exports: [AXMenuItemComponent, AXMenuComponent, AXContextMenuComponent],
                }]
        }] });

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

export { AXContextMenuComponent, AXContextMenuOpeningEvent, AXMenuComponent, AXMenuItem, AXMenuItemClickBaseEvent, AXMenuItemComponent, AXMenuItemComponentBase, AXMenuModule, AXMenuService, AXRootMenu };
//# sourceMappingURL=acorex-components-menu.mjs.map
