import * as i0 from '@angular/core';
import { input, booleanAttribute, output, Component, NgModule } from '@angular/core';
import { CdkMenuTrigger } from '@angular/cdk/menu';
import { elementOptionsVertical, elementRight4, elementLeft4 } from '@siemens/element-icons';
import { addIcons, SiIconComponent } from '@siemens/element-ng/icon';
import { SiMenuFactoryComponent } from '@siemens/element-ng/menu';
import { t, SiTranslatePipe } from '@siemens/element-translate-ng/translate';

/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
class SiElectrontitlebarComponent {
    /**
     * Title of your application
     */
    appTitle = input.required(...(ngDevMode ? [{ debugName: "appTitle" }] : []));
    /**
     * Defines if the application can go back or not
     *
     * @defaultValue false
     */
    canGoBack = input(false, { ...(ngDevMode ? { debugName: "canGoBack" } : {}), transform: booleanAttribute });
    /**
     * Defines if the application can go forward or not
     *
     * @defaultValue false
     */
    canGoForward = input(false, { ...(ngDevMode ? { debugName: "canGoForward" } : {}), transform: booleanAttribute });
    /**
     * Defines if the application is focused or not
     *
     * @defaultValue true
     */
    hasFocus = input(true, { ...(ngDevMode ? { debugName: "hasFocus" } : {}), transform: booleanAttribute });
    /**
     * List of menu items for the dropdown
     * In this dropdown should the zoom functionality as well as the refresh function be provided
     *
     * @defaultValue []
     */
    menuItems = input([], ...(ngDevMode ? [{ debugName: "menuItems" }] : []));
    /**
     * Browsing forward function
     */
    forward = output();
    /**
     * Browsing back function
     */
    back = output();
    /**
     * Aria Label for Forward Button
     *
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_ELECTRON_TITLEBAR.FORWARD:Forward`)
     * ```
     */
    ariaLabelForward = input(t(() => $localize `:@@SI_ELECTRON_TITLEBAR.FORWARD:Forward`), ...(ngDevMode ? [{ debugName: "ariaLabelForward" }] : []));
    /**
     * Aria Label for Back Button
     *
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_ELECTRON_TITLEBAR.BACK:Back`)
     * ```
     */
    ariaLabelBack = input(t(() => $localize `:@@SI_ELECTRON_TITLEBAR.BACK:Back`), ...(ngDevMode ? [{ debugName: "ariaLabelBack" }] : []));
    /**
     * Aria Label for Menu Button
     *
     * @defaultValue
     * ```
     * t(() => $localize`:@@SI_ELECTRON_TITLEBAR.MENU:Menu`)
     * ```
     */
    ariaLabelMenu = input(t(() => $localize `:@@SI_ELECTRON_TITLEBAR.MENU:Menu`), ...(ngDevMode ? [{ debugName: "ariaLabelMenu" }] : []));
    icons = addIcons({ elementLeft4, elementRight4, elementOptionsVertical });
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiElectrontitlebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: SiElectrontitlebarComponent, isStandalone: true, selector: "si-electron-titlebar", inputs: { appTitle: { classPropertyName: "appTitle", publicName: "appTitle", isSignal: true, isRequired: true, transformFunction: null }, canGoBack: { classPropertyName: "canGoBack", publicName: "canGoBack", isSignal: true, isRequired: false, transformFunction: null }, canGoForward: { classPropertyName: "canGoForward", publicName: "canGoForward", isSignal: true, isRequired: false, transformFunction: null }, hasFocus: { classPropertyName: "hasFocus", publicName: "hasFocus", isSignal: true, isRequired: false, transformFunction: null }, menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelForward: { classPropertyName: "ariaLabelForward", publicName: "ariaLabelForward", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelBack: { classPropertyName: "ariaLabelBack", publicName: "ariaLabelBack", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelMenu: { classPropertyName: "ariaLabelMenu", publicName: "ariaLabelMenu", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { forward: "forward", back: "back" }, ngImport: i0, template: "<div class=\"electron-title-bar-container w-100 bg-base-1 border-bottom fixed-top\">\n  <div class=\"electron-title-bar align-items-center d-flex h-100 gap-6\">\n    <span\n      class=\"mx-6 si-body electron-title-bar-app-name text-truncate\"\n      [class.unfocused]=\"!hasFocus()\"\n      >{{ appTitle() }}</span\n    >\n    <button\n      type=\"button\"\n      class=\"btn btn-icon btn-sm btn-tertiary\"\n      [class.unfocused]=\"!hasFocus()\"\n      [attr.aria-label]=\"ariaLabelBack() | translate\"\n      [disabled]=\"!canGoBack()\"\n      (click)=\"back.emit()\"\n    >\n      <si-icon class=\"flip-rtl\" [icon]=\"icons.elementLeft4\" />\n    </button>\n    <button\n      type=\"button\"\n      class=\"btn btn-icon btn-sm btn-tertiary\"\n      [class.unfocused]=\"!hasFocus()\"\n      [attr.aria-label]=\"ariaLabelForward() | translate\"\n      [disabled]=\"!canGoForward()\"\n      (click)=\"forward.emit()\"\n    >\n      <si-icon class=\"flip-rtl\" [icon]=\"icons.elementRight4\" />\n    </button>\n    @if (menuItems().length > 0) {\n      <button\n        type=\"button\"\n        class=\"btn btn-icon electron-title-bar-btn btn-tertiary btn-sm\"\n        [class.unfocused]=\"!hasFocus()\"\n        [attr.aria-label]=\"ariaLabelMenu() | translate\"\n        [cdkMenuTriggerFor]=\"menu\"\n      >\n        <si-icon [icon]=\"icons.elementOptionsVertical\" />\n      </button>\n    }\n    <div class=\"electron-title-bar-draggable flex-grow-1 w-100 h-100\"></div>\n  </div>\n</div>\n<ng-template #menu>\n  <div class=\"mt-2\">\n    <si-menu-factory [items]=\"menuItems()\" />\n  </div>\n</ng-template>\n", styles: [".electron-title-bar-container{block-size:36px;z-index:1033;inset-block-start:var(--element-system-banner-spacing, 0px)}.electron-title-bar{position:absolute;inset-inline-start:env(titlebar-area-x,0);inline-size:env(titlebar-area-width,100%)}.electron-title-bar-app-name{color:var(--element-text-secondary);-webkit-app-region:drag;-webkit-user-select:none;user-select:none}.electron-title-bar-draggable{flex-basis:content;-webkit-app-region:drag}.unfocused{color:var(--element-ui-3)}\n"], dependencies: [{ kind: "directive", type: CdkMenuTrigger, selector: "[cdkMenuTriggerFor]", inputs: ["cdkMenuTriggerFor", "cdkMenuPosition", "cdkMenuTriggerData", "cdkMenuTriggerTransformOriginOn"], outputs: ["cdkMenuOpened", "cdkMenuClosed"], exportAs: ["cdkMenuTriggerFor"] }, { kind: "component", type: SiMenuFactoryComponent, selector: "si-menu-factory", inputs: ["items", "actionParam"] }, { kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiElectrontitlebarComponent, decorators: [{
            type: Component,
            args: [{ selector: 'si-electron-titlebar', imports: [CdkMenuTrigger, SiMenuFactoryComponent, SiIconComponent, SiTranslatePipe], template: "<div class=\"electron-title-bar-container w-100 bg-base-1 border-bottom fixed-top\">\n  <div class=\"electron-title-bar align-items-center d-flex h-100 gap-6\">\n    <span\n      class=\"mx-6 si-body electron-title-bar-app-name text-truncate\"\n      [class.unfocused]=\"!hasFocus()\"\n      >{{ appTitle() }}</span\n    >\n    <button\n      type=\"button\"\n      class=\"btn btn-icon btn-sm btn-tertiary\"\n      [class.unfocused]=\"!hasFocus()\"\n      [attr.aria-label]=\"ariaLabelBack() | translate\"\n      [disabled]=\"!canGoBack()\"\n      (click)=\"back.emit()\"\n    >\n      <si-icon class=\"flip-rtl\" [icon]=\"icons.elementLeft4\" />\n    </button>\n    <button\n      type=\"button\"\n      class=\"btn btn-icon btn-sm btn-tertiary\"\n      [class.unfocused]=\"!hasFocus()\"\n      [attr.aria-label]=\"ariaLabelForward() | translate\"\n      [disabled]=\"!canGoForward()\"\n      (click)=\"forward.emit()\"\n    >\n      <si-icon class=\"flip-rtl\" [icon]=\"icons.elementRight4\" />\n    </button>\n    @if (menuItems().length > 0) {\n      <button\n        type=\"button\"\n        class=\"btn btn-icon electron-title-bar-btn btn-tertiary btn-sm\"\n        [class.unfocused]=\"!hasFocus()\"\n        [attr.aria-label]=\"ariaLabelMenu() | translate\"\n        [cdkMenuTriggerFor]=\"menu\"\n      >\n        <si-icon [icon]=\"icons.elementOptionsVertical\" />\n      </button>\n    }\n    <div class=\"electron-title-bar-draggable flex-grow-1 w-100 h-100\"></div>\n  </div>\n</div>\n<ng-template #menu>\n  <div class=\"mt-2\">\n    <si-menu-factory [items]=\"menuItems()\" />\n  </div>\n</ng-template>\n", styles: [".electron-title-bar-container{block-size:36px;z-index:1033;inset-block-start:var(--element-system-banner-spacing, 0px)}.electron-title-bar{position:absolute;inset-inline-start:env(titlebar-area-x,0);inline-size:env(titlebar-area-width,100%)}.electron-title-bar-app-name{color:var(--element-text-secondary);-webkit-app-region:drag;-webkit-user-select:none;user-select:none}.electron-title-bar-draggable{flex-basis:content;-webkit-app-region:drag}.unfocused{color:var(--element-ui-3)}\n"] }]
        }], propDecorators: { appTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "appTitle", required: true }] }], canGoBack: [{ type: i0.Input, args: [{ isSignal: true, alias: "canGoBack", required: false }] }], canGoForward: [{ type: i0.Input, args: [{ isSignal: true, alias: "canGoForward", required: false }] }], hasFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasFocus", required: false }] }], menuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuItems", required: false }] }], forward: [{ type: i0.Output, args: ["forward"] }], back: [{ type: i0.Output, args: ["back"] }], ariaLabelForward: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelForward", required: false }] }], ariaLabelBack: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelBack", required: false }] }], ariaLabelMenu: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelMenu", required: false }] }] } });

/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
class SiElectrontitlebarModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiElectrontitlebarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.8", ngImport: i0, type: SiElectrontitlebarModule, imports: [SiElectrontitlebarComponent], exports: [SiElectrontitlebarComponent] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiElectrontitlebarModule, imports: [SiElectrontitlebarComponent] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiElectrontitlebarModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [SiElectrontitlebarComponent],
                    exports: [SiElectrontitlebarComponent]
                }]
        }] });

/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
/** */
const runsInElectron = () => {
    const windowAny = window;
    const processAny = windowAny.process;
    // Renderer process
    if (typeof windowAny !== 'undefined' &&
        typeof processAny === 'object' &&
        processAny.type === 'renderer') {
        return true;
    }
    // Main process
    if (typeof processAny !== 'undefined' &&
        typeof processAny.versions === 'object' &&
        !!processAny.versions.electron) {
        return true;
    }
    // Detect the user agent when the `nodeIntegration` option is set to true
    if (typeof navigator === 'object' &&
        typeof navigator.userAgent === 'string' &&
        navigator.userAgent.includes('Electron')) {
        return true;
    }
    return false;
};

/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */

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

export { SiElectrontitlebarComponent, SiElectrontitlebarModule, runsInElectron };
//# sourceMappingURL=siemens-element-ng-electron-titlebar.mjs.map
